Skip to content

SNES VI and mixed systems #3403

Feb 11, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

You always have to pass in functions that represent the bounds in the full space, but you can put "unobtainable" bounds in the slots you don't want to constrain. See https://petsc.org/main/manualpages/SNES/SNESVISetVariableBounds/

So something like:

import numpy as np
from firedrake.datatypes import ScalarType # can't remember where this one lives
MAX_REAL = np.finfo(ScalarType).max
# recreating code in petscmath.h
BOUND_POS_INF = MAX_REAL / 4
BOUND_NEG_INF = -BOUND_POS_INF
lbound = Function(W)
lbound.sub(0).interpolate(some_known_bound)
lbound.sub(1).interpolate(BOUND_NEG_INF)
... # same for upper bound

solver = ...
solver.solve(bounds=(lbound, ubound))

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@danshapero
Comment options

@wence-
Comment options

@colinjcotter
Comment options

colinjcotter Feb 19, 2024
Maintainer Author

Answer selected by colinjcotter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants