Skip to content
Snippets Groups Projects
Commit d4be28ca authored by Jean-Baptiste Keck's avatar Jean-Baptiste Keck
Browse files

fix forced timestep update

parent a59519e0
No related branches found
No related tags found
1 merge request!16MPI operators
Pipeline #21921 failed
...@@ -7,12 +7,20 @@ from hysop.core.graph.graph import op_apply ...@@ -7,12 +7,20 @@ from hysop.core.graph.graph import op_apply
from hysop.fields.continuous_field import Field from hysop.fields.continuous_field import Field
from hysop.parameters.parameter import Parameter from hysop.parameters.parameter import Parameter
from hysop.topology.cartesian_descriptor import CartesianTopologyDescriptors from hysop.topology.cartesian_descriptor import CartesianTopologyDescriptors
from hysop.operator.base.spatial_filtering import RemeshLowpassFilterBase, SpectralLowpassFilterBase from hysop.operator.base.spatial_filtering import RemeshLowpassFilterBase, SpectralLowpassFilterBase, SubgridLowpassFilterBase
from hysop.backend.device.opencl.opencl_copy_kernel_launchers import OpenClCopyBufferRectLauncher from hysop.backend.device.opencl.opencl_copy_kernel_launchers import OpenClCopyBufferRectLauncher
from hysop.backend.device.opencl.opencl_kernel_launcher import OpenClKernelListLauncher from hysop.backend.device.opencl.opencl_kernel_launcher import OpenClKernelListLauncher
from hysop.backend.device.opencl.opencl_elementwise import OpenClElementwiseKernelGenerator from hysop.backend.device.opencl.opencl_elementwise import OpenClElementwiseKernelGenerator
from hysop.symbolic.relational import Assignment from hysop.symbolic.relational import Assignment
class OpenClSubgridLowpassFilter(SubgridLowpassFilterBase, OpenClOperator):
"""
OpenCL implementation for lowpass spatial filtering: small grid -> coarse grid
using the subgrid method.
"""
pass
class OpenClSpectralLowpassFilter(SpectralLowpassFilterBase, OpenClOperator): class OpenClSpectralLowpassFilter(SpectralLowpassFilterBase, OpenClOperator):
""" """
OpenCL implementation for lowpass spatial filtering: small grid -> coarse grid OpenCL implementation for lowpass spatial filtering: small grid -> coarse grid
......
...@@ -30,7 +30,7 @@ class LowpassFilterFrontend(MultiComputationalGraphNodeFrontend): ...@@ -30,7 +30,7 @@ class LowpassFilterFrontend(MultiComputationalGraphNodeFrontend):
from hysop.backend.host.python.operator.spatial_filtering import \ from hysop.backend.host.python.operator.spatial_filtering import \
PythonRemeshLowpassFilter, PythonSpectralLowpassFilter, PythonSubgridLowpassFilter PythonRemeshLowpassFilter, PythonSpectralLowpassFilter, PythonSubgridLowpassFilter
from hysop.backend.device.opencl.operator.spatial_filtering import \ from hysop.backend.device.opencl.operator.spatial_filtering import \
OpenClSpectralLowpassFilter OpenClSpectralLowpassFilter, OpenClSubgridLowpassFilter
ai = { ai = {
FilteringMethod.SPECTRAL: { FilteringMethod.SPECTRAL: {
Implementation.PYTHON: PythonSpectralLowpassFilter, Implementation.PYTHON: PythonSpectralLowpassFilter,
...@@ -40,7 +40,8 @@ class LowpassFilterFrontend(MultiComputationalGraphNodeFrontend): ...@@ -40,7 +40,8 @@ class LowpassFilterFrontend(MultiComputationalGraphNodeFrontend):
Implementation.PYTHON: PythonRemeshLowpassFilter Implementation.PYTHON: PythonRemeshLowpassFilter
}, },
FilteringMethod.SUBGRID: { FilteringMethod.SUBGRID: {
Implementation.PYTHON: PythonSubgridLowpassFilter Implementation.PYTHON: PythonSubgridLowpassFilter,
Implementation.OPENCL: OpenClSubgridLowpassFilter
}, },
} }
return ai return ai
......
...@@ -253,6 +253,7 @@ class Simulation(object): ...@@ -253,6 +253,7 @@ class Simulation(object):
self._print_banner(msg) self._print_banner(msg)
self.tkp1 = self.target_time_of_interest self.tkp1 = self.target_time_of_interest
self.update_time_step(self.target_time_of_interest - self.t()) self.update_time_step(self.target_time_of_interest - self.t())
self._last_forced_timestep = self.dt()
elif (self.tkp1 >= self.end): elif (self.tkp1 >= self.end):
msg='** Next iteration is last iteration, clamping dt to achieve t={}. **' msg='** Next iteration is last iteration, clamping dt to achieve t={}. **'
msg=msg.format(self.end) msg=msg.format(self.end)
...@@ -261,8 +262,9 @@ class Simulation(object): ...@@ -261,8 +262,9 @@ class Simulation(object):
self._next_is_last = True self._next_is_last = True
self.tkp1 = self.end self.tkp1 = self.end
self.update_time_step(self.end - self.t()) self.update_time_step(self.end - self.t())
else: elif (self.dt() == self._last_forced_timestep):
self.update_time_step(self._dt0) self.update_time_step(self._dt0)
self._last_forced_timestep = None
self.current_iteration += 1 self.current_iteration += 1
self.time = self.tkp1 self.time = self.tkp1
...@@ -347,6 +349,7 @@ class Simulation(object): ...@@ -347,6 +349,7 @@ class Simulation(object):
self.is_over = False self.is_over = False
self.current_iteration = 0 self.current_iteration = 0
self._is_ready = True self._is_ready = True
self._last_forced_timestep = None
for (io_params, params, kwds) in self._parameters_to_write: for (io_params, params, kwds) in self._parameters_to_write:
filename = io_params.filename filename = io_params.filename
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment