Skip to content

Commit

Permalink
fixed formulation test
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Jan 15, 2024
1 parent ea4b5ba commit b1218aa
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions test/unit/test_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,26 @@ def test_with_traps_transient(self):
c_0_n = my_mobile.previous_solution
expected_form = ((c_0 - c_0_n) / self.dt.value) * v * self.my_mesh.dx(1)
expected_form += f.dot(D * f.grad(c_0), f.grad(v)) * self.my_mesh.dx(1)
form_trapping_expected = 0
for trap in my_traps.traps:
expected_form += (
((trap.solution - trap.previous_solution) / self.dt.value)
form_trapping_expected += (
(
-trap.k_0
* f.exp(-trap.E_k / festim.k_B / self.my_temp.T)
* c_0
* (trap.density[0] - trap.solution)
)
* v
* self.my_mesh.dx
* self.my_mesh.dx(1)
)

form_trapping_expected += (
trap.p_0
* f.exp(-trap.E_p / festim.k_B / self.my_temp.T)
* trap.solution
* v
* self.my_mesh.dx(1)
)
expected_form += -form_trapping_expected
print("expected F:")
print(expected_form)
print("produced F:")
Expand Down

0 comments on commit b1218aa

Please sign in to comment.