diff --git a/festim/boundary_conditions/dirichlet_bc.py b/festim/boundary_conditions/dirichlet_bc.py index cd334c483..aea5c2753 100644 --- a/festim/boundary_conditions/dirichlet_bc.py +++ b/festim/boundary_conditions/dirichlet_bc.py @@ -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 diff --git a/festim/hydrogen_transport_problem.py b/festim/hydrogen_transport_problem.py index aee3319dc..00fa90bf4 100644 --- a/festim/hydrogen_transport_problem.py +++ b/festim/hydrogen_transport_problem.py @@ -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: @@ -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"""