File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,7 +145,9 @@ def linear_solve_args(self):
145145 initial_guess = InitialGuess (target , exprs , arrays , self .time_mapper )
146146
147147 constrain_exprs = self ._get_constrain_exprs (exprs )
148- constrain_bc = ConstrainBC (target , constrain_exprs , arrays ) if constrain_exprs else None
148+ constrain_bc = None
149+ if constrain_exprs :
150+ constrain_bc = ConstrainBC (target , constrain_exprs , arrays )
149151
150152 field_data = FieldData (
151153 target = target ,
@@ -205,11 +207,11 @@ def linear_solve_args(self):
205207 jacobian .target_scaler_mapper
206208 )
207209
208- constrain_bc = {
209- t : ConstrainBC ( t , self . _get_constrain_exprs ( as_tuple ( self . target_exprs [ t ])), arrays )
210- for t in targets
211- if self . _get_constrain_exprs ( as_tuple ( self . target_exprs [ t ]))
212- }
210+ constrain_bc = {}
211+ for t in targets :
212+ cexprs = self . _get_constrain_exprs ( as_tuple ( self . target_exprs [ t ]))
213+ if cexprs :
214+ constrain_bc [ t ] = ConstrainBC ( t , cexprs , arrays )
213215 constrain_bc = constrain_bc if constrain_bc else None
214216
215217 all_data = MultipleFieldData (
Original file line number Diff line number Diff line change @@ -125,17 +125,17 @@ def symbolic_shape(self):
125125 return DimensionTuple (* field_from_composites [::- 1 ], getters = self .dimensions )
126126
127127 # TODO: Is this necessary? Taken directly from `Function`.
128- def _eval_at (self , func ):
129- if self .staggered == func .staggered :
130- return self
128+ def _eval_at (self , func ):
129+ if self .staggered == func .staggered :
130+ return self
131131 mapper = {}
132- for d in self .dimensions :
133- try :
134- if self .indices_ref [d ] is not func .indices_ref [d ]:
135- mapper [self .indices_ref [d ]] = func .indices_ref [d ]
136- except KeyError :
137- pass
138- return self .subs (mapper )
132+ for d in self .dimensions :
133+ try :
134+ if self .indices_ref [d ] is not func .indices_ref [d ]:
135+ mapper [self .indices_ref [d ]] = func .indices_ref [d ]
136+ except KeyError :
137+ pass
138+ return self .subs (mapper )
139139
140140
141141class PetscBundle (Bundle ):
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class EssentialBC(Eq):
1010
1111 The compiler will automatically zero the corresponding rows/columns in the Jacobian
1212 and lift the boundary terms into the residual RHS, unless the BC is constrained
13- via a `PetscSection`. In which case, they are set once and removed from the global solver.
14- Constraining can be enabled in two ways:
13+ via a `PetscSection`. In which case, they are set once and removed from the
14+ global solver. Constraining can be enabled in two ways:
1515
1616 - Globally: pass `constrain_bcs=True` to `petscsolve` to constrain all
1717 `EssentialBC`s in the solve.
You can’t perform that action at this time.
0 commit comments