Skip to content

Commit

Permalink
OTFMUPointToField: Use tolerance on mesh
Browse files Browse the repository at this point in the history
Closes #115
  • Loading branch information
jschueller committed Oct 17, 2024
1 parent 64cee3d commit 6716944
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions otfmi/otfmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,16 +730,17 @@ def _assert_mesh_pertinence(self):
"""
mesh = self.getOutputMesh()
mesh_min = mesh.getVertices().getMin()[0]
mesh_max = mesh.getVertices().getMax()[0]
tol = (mesh_max - mesh_min) * 1e-6
assert (
mesh_min >= self.start_time
mesh_min + tol >= self.start_time
), """The mesh start time must be >= to FMU start time.\n
To set the FMU start time, use the argument *start_time* in
FMUPointToFieldFunction constructor."""

mesh_max = mesh.getVertices().getMax()[0]
assert (
mesh_max <= self.final_time
), """The mesh final time must be >= to FMU final time.\n
mesh_max <= self.final_time + tol
), """The mesh final time must be <= to FMU final time.\n
To set the FMU final time, use the argument final_time in
FMUPointToFieldFunction constructor."""

Expand Down

0 comments on commit 6716944

Please sign in to comment.