SimVascular / svSolver

Separate repository for svSolver
16 stars 23 forks source link

Can't start from given time step #103

Open mrp089 opened 3 years ago

mrp089 commented 3 years ago

As a way to deal with #96, I created the following workflow:

  1. Run a 0D simulation with coronary BCs for nstep time steps until it reaches a periodic state
  2. Project 0D solution to 3D and generate restart.0.1 file
  3. Generate *HistCOR.dat.nstep files from the history of the 0D solution
  4. Run 3D simulation for one time step to generate restart.0.* files for each processor
  5. Rename restart.0.* files to restart.nstep.*
  6. Restart 3D simulation at time step nstep
  7. Have perfectly initialized simulation with coronary BCs ...
  8. Profit

My goal is thus to provide svSolver with initial conditions for flow and pressure and tricking it into thinking I'm restarting a simulation with coronary BCs at time step nstep with the history provided in *HistCOR.dat.nstep.

Unfortunately, whenever I run step 6, svSolver starts computing time step 1 and not time step nstep. I've uploaded my project here. @ktbolt Can you check if I'm doing something dumb that prevents me from restarting at the chosen time step? Thank you!!

mrp089 commented 3 years ago

Still not working, but some lessons learned:

  1. Contrary to popular (mine) belief, restart.0.* does NOT contain a parallel distribution of initial conditions, i.e. "time step zero". Instead. it holds variable wall properties (in case those are defined): https://github.com/SimVascular/svSolver/blob/9e5ebbca23c86ee1837774b97f99c3fe731e3c22/Code/FlowSolvers/ThreeDSolver/svSolver/readnblk-varwall.f#L459-L460 So I would have to use time step one to rename restart files in step 5 above.
  2. It seems that the time step itself is written into the restart files (not just the file name). Not sure where that happens but that messes up step 5 above.
  3. Variable lstep used to read/write *HistRCR.dat.nstep https://github.com/SimVascular/svSolver/blob/9e5ebbca23c86ee1837774b97f99c3fe731e3c22/Code/FlowSolvers/ThreeDSolver/svSolver/coronary_subroutines.f#L130 is not the same as numstep to read restart.nstep.* files https://github.com/SimVascular/svSolver/blob/9e5ebbca23c86ee1837774b97f99c3fe731e3c22/Code/FlowSolvers/ThreeDSolver/svSolver/readnblk-varwall.f#L100-L101 So you end up with displacements/velocities from a different time step than boundary condition history.

More investigation is needed...