Skip to content

elastic-tube-1d: Solvers do not support subcycling in implicit coupling #240

Open
@MakisH

Description

@MakisH

Looking at the FluidSolver.py, I noticed that a few things are a bit uncommon in the time loop:

while interface.is_coupling_ongoing():
# When an implicit coupling scheme is used, checkpointing is required
if interface.is_action_required(action_write_iteration_checkpoint()):
interface.mark_action_fulfilled(action_write_iteration_checkpoint())
velocity, pressure, success = perform_partitioned_implicit_euler_step(
velocity_old, pressure_old, crossSectionLength_old, crossSectionLength, dx, precice_dt, velocity_in(
t + precice_dt), custom_coupling=True)
interface.write_block_scalar_data(pressureID, vertexIDs, pressure)
interface.advance(precice_dt)
crossSectionLength = interface.read_block_scalar_data(
crossSectionLengthID, vertexIDs)
# i.e. not yet converged
if interface.is_action_required(action_read_iteration_checkpoint()):
interface.mark_action_fulfilled(action_read_iteration_checkpoint())
else: # converged, timestep complete
t += precice_dt
if plotting_mode is config.PlottingModes.VIDEO:
tubePlotting.doPlotting(
ax, crossSectionLength_old, velocity_old, pressure_old, dx, t)
if writeVideoToFile:
writer.grab_frame()
ax.cla()
velocity_old = np.copy(velocity)
pressure_old = np.copy(pressure)
crossSectionLength_old = np.copy(crossSectionLength)
writeOutputToVTK(time_it, "out_fluid_", dx, datanames=["velocity", "pressure", "diameter"], data=[
velocity_old, pressure_old, crossSectionLength_old])
time_it += 1

It looks like the checkpointing assumes that the solver time step is equal to the coupling time window. More specifically, whenever preCICE does not ask the solver to read a checkpoint, the solver writes a checkpoint of the current solution. However, this also means that the checkpoint will be updated at every solver time step and the solver will not return to the right state when subcycling.

Two more problems:

  • There is no checkpointing of the time itself, we only have a time_it += 1.
  • We are essentially tricking preCICE, telling it that we read/wrote checkpoints at different points that we actually do. This makes the code difficult to follow.

The SolidSolver.py, as well as the C++ solvers, also have the same flaw.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions