From f59c8cb3eafe43f35b5f0d0464931a3cf812da82 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Thu, 29 Jun 2023 12:09:59 -0400 Subject: [PATCH 1/3] removed unused import --- test/unit/test_boundary_conditions.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/unit/test_boundary_conditions.py b/test/unit/test_boundary_conditions.py index 23cb7bf33..e8ed850e6 100644 --- a/test/unit/test_boundary_conditions.py +++ b/test/unit/test_boundary_conditions.py @@ -1,5 +1,3 @@ -from attr import has -from sympy.matrices import expressions import festim import fenics import pytest From c30e92bf58ab7e8b36fe0f8f3dd0e0508630080a Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Thu, 29 Jun 2023 12:12:45 -0400 Subject: [PATCH 2/3] np.isnot instead of != --- festim/generic_simulation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/festim/generic_simulation.py b/festim/generic_simulation.py index 29f32016b..5183253b3 100644 --- a/festim/generic_simulation.py +++ b/festim/generic_simulation.py @@ -1,6 +1,7 @@ import festim from festim.h_transport_problem import HTransportProblem from fenics import * +import numpy as np class Simulation: @@ -332,7 +333,7 @@ def iterate(self): # avoid t > final_time next_time = self.t + float(self.dt.value) - if next_time > self.settings.final_time and self.t != self.settings.final_time: + if next_time > self.settings.final_time and not np.isclose(self.t, self.settings.final_time): self.dt.value.assign(self.settings.final_time - self.t) def display_time(self): @@ -343,7 +344,7 @@ def display_time(self): msg = "{:.1f} % ".format(simulation_percentage) msg += "{:.1e} s".format(simulation_time) msg += " Ellapsed time so far: {:.1f} s".format(elapsed_time) - if self.t != self.settings.final_time and self.log_level == 40: + if not np.isclose(self.t, self.settings.final_time) and self.log_level == 40: print(msg, end="\r") else: print(msg) From e90b6abe4d1ef574b7a35b2db086f8de1c3f87e5 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Thu, 29 Jun 2023 13:33:22 -0400 Subject: [PATCH 3/3] black --- festim/generic_simulation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/festim/generic_simulation.py b/festim/generic_simulation.py index 88e05a677..1f7dfbe57 100644 --- a/festim/generic_simulation.py +++ b/festim/generic_simulation.py @@ -332,7 +332,9 @@ def iterate(self): # avoid t > final_time next_time = self.t + float(self.dt.value) - if next_time > self.settings.final_time and not np.isclose(self.t, self.settings.final_time): + if next_time > self.settings.final_time and not np.isclose( + self.t, self.settings.final_time + ): self.dt.value.assign(self.settings.final_time - self.t) def display_time(self):