Skip to content

Commit

Permalink
added corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanGSDUFOUR committed Jul 23, 2024
1 parent f141f29 commit f2ba663
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
10 changes: 4 additions & 6 deletions festim/generic_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def attribute_source_terms(self):
# set sources
for source in self.sources:
if source.field == "T" and not isinstance(
self.T, festim.temperature.temperature_solver.HeatTransferProblem
self.T, festim.HeatTransferProblem
): # check that there is not a source defined in T as the same time as a festim.Temperature
raise ValueError(
raise TypeError(
"Heat transfer sources can only be used with HeatTransferProblem"
)
if isinstance(source, festim.RadioactiveDecay) and source.field == "all":
Expand Down Expand Up @@ -249,10 +249,8 @@ def check_boundary_conditions(self):
raise ValueError("SurfaceKinetics can only be used in 1D simulations")

# check that there is not a Temperature defined at the same time as a boundary condition in T
if bc.field == "T" and not isinstance(
self.T, festim.temperature.temperature_solver.HeatTransferProblem
):
raise ValueError(
if bc.field == "T" and not isinstance(self.T, festim.HeatTransferProblem):
raise TypeError(
"Heat transfer boundary conditions can only be used with HeatTransferProblem"
)

Expand Down
11 changes: 3 additions & 8 deletions test/system/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_error_DirichletBC_on_same_surface(field, surfaces):
field == "T"
): # with festim.Temperature already defined there is another error given
with pytest.raises(
ValueError,
TypeError,
match="Heat transfer boundary conditions can only be used with HeatTransferProblem",
):
sim.initialise()
Expand Down Expand Up @@ -197,11 +197,8 @@ def test_BC_on_T_with_Temp(bc):
sim.settings = F.Settings(
transient=False, absolute_tolerance=1e8, relative_tolerance=1e-8
)
sim.sources = []
sim.dt = None
sim.exports = []
with pytest.raises(
ValueError,
TypeError,
match="Heat transfer boundary conditions can only be used with HeatTransferProblem",
):
sim.initialise()
Expand All @@ -222,10 +219,8 @@ def test_source_on_T_with_Temp():
transient=False, absolute_tolerance=1e8, relative_tolerance=1e-8
)
sim.sources = [F.Source(value=1, volume=1, field="T")]
sim.dt = None
sim.exports = []
with pytest.raises(
ValueError,
TypeError,
match="Heat transfer sources can only be used with HeatTransferProblem",
):
sim.initialise()
Expand Down

0 comments on commit f2ba663

Please sign in to comment.