Skip to content

Commit

Permalink
remove time dependent bcs
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Nov 2, 2023
1 parent b5804e8 commit 6c41bf3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
3 changes: 0 additions & 3 deletions festim/boundary_conditions/dirichlet_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(self, subdomain, value, species) -> None:

self.value_fenics = None
self.bc_expr = None
self.time_dependent = False

@property
def value_fenics(self):
Expand Down Expand Up @@ -103,13 +102,11 @@ def create_value(
self.value_fenics = F.as_fenics_constant(
mesh=mesh, value=self.value(t=float(t))
)
self.time_dependent = True
else:
self.value_fenics = fem.Function(function_space)
kwargs = {}
if "t" in arguments:
kwargs["t"] = t
self.time_dependent = True
if "x" in arguments:
kwargs["x"] = x
if "T" in arguments:
Expand Down
41 changes: 0 additions & 41 deletions test/test_dirichlet_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,44 +377,3 @@ def test_integration_with_a_multispecies_HTransportProblem(value_A, value_B):
if isinstance(expected_value, Conditional):
expected_value = float(expected_value)
assert np.isclose(computed_value, expected_value)


@pytest.mark.parametrize(
"value",
[
1.0,
lambda t: t,
lambda t: 1.0 + t,
lambda x: 1.0 + x[0],
lambda x, t: 1.0 + x[0] + t,
lambda x, t, T: 1.0 + x[0] + t + T,
lambda x, t: ufl.conditional(ufl.lt(t, 1.0), 100.0 + x[0], 0.0),
],
)
def test_time_dependence_attribute(value):
subdomain = F.SurfaceSubdomain1D(1, x=0)
vol_subdomain = F.VolumeSubdomain1D(1, borders=[0, 1], material=dummy_mat)

my_model = F.HydrogenTransportProblem(
mesh=F.Mesh(mesh),
subdomains=[vol_subdomain, subdomain],
)
my_model.species = [F.Species("H")]
my_bc = F.DirichletBC(subdomain, value, "H")
my_model.boundary_conditions = [my_bc]

my_model.temperature = fem.Constant(my_model.mesh.mesh, 550.0)

my_model.settings = F.Settings(atol=1, rtol=0.1, final_time=2)
my_model.settings.stepsize = F.Stepsize(initial_value=1)

my_model.initialise()

if isinstance(value, (float, int)):
assert not my_model.boundary_conditions[0].time_dependent
else:
arguments = value.__code__.co_varnames
if "t" in arguments:
assert my_model.boundary_conditions[0].time_dependent
else:
assert not my_model.boundary_conditions[0].time_dependent

0 comments on commit 6c41bf3

Please sign in to comment.