Skip to content

Commit

Permalink
removed DirichletBC.create_form method
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Oct 25, 2023
1 parent 5687d5b commit 2a81986
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
13 changes: 0 additions & 13 deletions festim/boundary_conditions/dirichlet_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,6 @@ def create_value(
)
self.value_fenics.interpolate(self.bc_expr)

def create_formulation(self, dofs, function_space):
"""Applies the boundary condition
Args:
dofs (numpy.ndarray): the degrees of freedom of surface facets
function_space (dolfinx.fem.FunctionSpace): the function space
"""
form = fem.dirichletbc(
value=self.value_fenics,
dofs=dofs,
V=function_space,
)
return form

def update(self, t):
"""Updates the boundary condition value
Expand Down
20 changes: 17 additions & 3 deletions festim/hydrogen_transport_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@ def define_boundary_conditions(self):
self.bc_forms.append(form)

def create_dirichletbc_form(self, bc):
"""Creates a dirichlet boundary condition form
Args:
bc (festim.DirichletBC): _description_
Returns:
dolfinx.fem.bcs.DirichletBC: _description_
"""
# create value_fenics
if callable(bc.value):
if len(self.species) == 1:
Expand Down Expand Up @@ -283,11 +291,17 @@ def create_dirichletbc_form(self, bc):

# create form
if (len(self.species) == 1) and (isinstance(bc.value_fenics, (fem.Function))):
return bc.create_formulation(dofs=bc_dofs, function_space=None)
form = fem.dirichletbc(
value=bc.value_fenics,
dofs=bc_dofs,
)
else:
return bc.create_formulation(
dofs=bc_dofs, function_space=bc.species.sub_function_space
form = fem.dirichletbc(
value=bc.value_fenics,
dofs=bc_dofs,
V=bc.species.sub_function_space,
)
return form

def create_formulation(self):
"""Creates the formulation of the model"""
Expand Down

0 comments on commit 2a81986

Please sign in to comment.