Skip to content

Commit 0b2e523

Browse files
authored
Multicomponent demo sub bcs for EquationBC (#4695)
* sub bcs for EquationBC * explanation sub_bcs
1 parent 6130be0 commit 0b2e523

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

demos/multicomponent/multicomponent.py.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,15 @@ only apply to the normal component of H(div) functions.
428428
Elsewhere on the boundary we enforce :math:`J_i \cdot N = 0`. Finally, instead of specifying
429429
the value of the barycentric velocity :math:`v` on the inflows and outflows,
430430
we enforce :math:`v = \rho^{-1}(G_1 + G_2)`. Boundary conditions that couple
431-
unknowns and/or are nonlinear must be implemented with :class:`~.EquationBC` instead of :class:`~.DirichletBC`. ::
431+
unknowns and/or are nonlinear must be implemented with :class:`~.EquationBC` instead of :class:`~.DirichletBC`.
432+
Since the barycentric velocity is in :math:`[\textrm{CG}_k]^2` it has degrees of freedom located at the points
433+
where the inlets/outlet meet the walls. Even though the boundary conditions on the inlets/outlet
434+
and the walls are compatible at these points, :class:`~.EquationBC` enforces the boundary conditions weakly whilst
435+
:class:`~.DirichletBC` enforces them strongly. Hence, to avoid ambiguity, we set Dirichlet boundary
436+
conditions on the boundary of the boundary, i.e. the points where the inlets/outlet meet the walls.
437+
To enforce these Dirichlet boundary conditions, tuples with the numbers of the boundary edges coincidental
438+
to these points need to be constructed first. This is then passed on to a Dirichlet boundary condition
439+
which is passed on to :class:`~.EquationBC`.::
432440

433441
# Reference species velocities, which we choose to symmetrize so that the molar fluxes agree
434442
v_ref_1 = Constant(0.4e-6) # Reference inflow velocity of benzene, m / s
@@ -449,7 +457,9 @@ unknowns and/or are nonlinear must be implemented with :class:`~.EquationBC` ins
449457
# Boundary conditions on the barycentric velocity are enforced via EquationBC
450458
bc_data = {inlet_1_id: rho_v_inflow_1_bc_func, inlet_2_id: rho_v_inflow_2_bc_func, outlet_id: rho_v_outflow_bc_func}
451459
F_bc = sum(inner(v - rho_inv * flux, u) * ds(*subdomain) for subdomain, flux in bc_data.items())
452-
v_bc = EquationBC(F_bc == 0, solution, (*inlet_1_id, *inlet_2_id, *outlet_id), V=Z_h.sub(2))
460+
ridges = [(i, j) for i in [*inlet_1_id, *inlet_2_id, *outlet_id] for j in walls_ids]
461+
sub_bcs = [DirichletBC(Z_h.sub(2), 0, ridges)] # bc on the boundary of the boundary
462+
v_bc = EquationBC(F_bc == 0, solution, (*inlet_1_id, *inlet_2_id, *outlet_id), V=Z_h.sub(2), bcs=sub_bcs)
453463

454464
# The boundary conditions on the fluxes and barycentric velocity
455465
# Note that BCs on H(div) spaces only apply to the normal component

0 commit comments

Comments
 (0)