Skip to content

Commit 6130be0

Browse files
authored
BUG: Fix EquationBC + matfree + fieldsplit (#4734)
* BUG: Fix EquationBC + matfree + fieldsplit
1 parent e141b42 commit 6130be0

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

firedrake/assemble.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,9 @@ def _apply_bc(self, tensor, bc, u=None):
12481248
bc.apply(r, u=u)
12491249
elif isinstance(bc, EquationBCSplit):
12501250
bc.zero(tensor)
1251+
if isinstance(bc.f, ufl.ZeroBaseForm) or bc.f.empty():
1252+
# form is empty, do nothing
1253+
return
12511254
OneFormAssembler(bc.f, bcs=bc.bcs,
12521255
form_compiler_parameters=self._form_compiler_params,
12531256
needs_zeroing=False,

firedrake/bcs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,6 @@ def reconstruct(self, field=None, V=None, subu=None, u=None, row_field=None, col
641641
rank = len(self.f.arguments())
642642
splitter = ExtractSubBlock()
643643
form = splitter.split(self.f, argument_indices=(row_field, col_field)[:rank])
644-
if isinstance(form, ufl.ZeroBaseForm) or form.empty():
645-
# form is empty, do nothing
646-
return
647644
if u is not None:
648645
form = firedrake.replace(form, {self.u: u})
649646
if action_x is not None:

tests/firedrake/equation_bcs/test_equation_bcs.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def linear_poisson_mixed(solver_parameters, mesh_num, porder):
174174
u1 = cos(2 * pi * y) / 2
175175
n = FacetNormal(mesh)
176176

177-
a = (inner(sigma, tau) + inner(u, div(tau)) + inner(div(sigma), v)) * dx
178-
L = inner(u1, dot(tau, n)) * ds(1) + inner(f, v) * dx
177+
a = inner(sigma, tau)*dx + inner(u, div(tau))*dx + inner(div(sigma), v + div(tau))*dx
178+
L = inner(u1, dot(tau, n)) * ds(1) + inner(f, v + div(tau)) * dx
179179

180180
g = as_vector([-2 * pi * sin(2 * pi * x + pi / 3) * cos(2 * pi * y), -2 * pi * cos(2 * pi * x + pi / 3) * sin(2 * pi * y)])
181181

@@ -331,24 +331,24 @@ def test_EquationBC_mixedpoisson_matfree_fieldsplit():
331331
eq_type = "linear"
332332
porder = 0
333333
# Mixed poisson with EquationBCs
334-
# matfree with fieldsplit pc
334+
# matfree with fieldsplit schur direct solver
335335

336336
solver_parameters = {'mat_type': mat_type,
337-
'ksp_type': 'fgmres',
338-
'ksp_atol': 1e-11,
339-
'ksp_max_it': 200,
337+
'ksp_type': 'preonly',
340338
'pc_type': 'fieldsplit',
341339
'pc_fieldsplit_type': 'schur',
342340
'pc_fieldsplit_schur_fact_type': 'full',
343-
'fieldsplit_0_ksp_type': 'cg',
341+
'fieldsplit_0_ksp_type': 'preonly',
344342
'fieldsplit_0_pc_type': 'python',
345343
'fieldsplit_0_pc_python_type': 'firedrake.AssembledPC',
346344
'fieldsplit_0_assembled_pc_type': 'lu',
347-
'fieldsplit_1_ksp_type': 'cg',
348-
'fieldsplit_1_pc_use_amat': True,
345+
'fieldsplit_0_assembled_pc_factor_mat_solver_type': 'mumps',
346+
'fieldsplit_1_ksp_type': 'gmres',
349347
'fieldsplit_1_pc_type': 'python',
350348
'fieldsplit_1_pc_python_type': 'firedrake.MassInvPC',
351-
'fieldsplit_1_Mp_pc_type': 'icc'}
349+
'fieldsplit_1_Mp_pc_type': 'lu',
350+
'fieldsplit_1_Mp_pc_factor_mat_solver_type': 'mumps',
351+
}
352352
err = []
353353
mesh_sizes = [16, 32]
354354
if eq_type == "linear":

0 commit comments

Comments
 (0)