Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MakisH opened this issue Oct 8, 2021 · 0 comments
Open
Labels
bug good first issue Good for newcomers

Comments

@MakisH
Copy link
Member

MakisH commented Oct 8, 2021

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.

@MakisH MakisH added bug good first issue Good for newcomers labels Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant