Hello
I was running a coupled pipe case between OpenFOAM and CalculiX however, after running for some time, I received the following error, which stopped coupling:
Adapter writing coupling data…
Adapter calling advance()…
—[precice] ^[[31mERROR: ^[[0m advance() cannot be called with a timestep size of 0.
Please find attached log files for both OpenFOAM and CalculiX calculix.out (3.4 MB) foam.out (4.7 MB)
This error comes from the CalculiX side. There we couple via iterations and not by the actual CalculiX timestep and it seems like your CalculiX simulation reached its timestep and the next increment for the iteration would be 0, which legitimatly conflicts with precice, that doesn’t accept 0 as a timestep. Can you maybe share your input files for CalculiX and precice?
As @mattfrei mentioned, this seems to be coming from the CalculiX side. Looking at the output:
Adjusting time step for transient step
precice_dt dtheta = 0.010000, dtheta = 0.000000, solver_dt = 0.000000
Adapter reading coupling data...
Reading FORCES coupling data with ID '3'.
Adapter writing checkpoint...
increment 101 attempt 1
increment size= 0.000000e+00
sum of previous increments=1.000000e-02
actual step time=1.000000e-02
actual total time=1.000000e-02
printf("Adjusting time step for transient step\n");
printf("precice_dt dtheta = %f, dtheta = %f, solver_dt = %f\n", sim->precice_dt / *sim->tper, *sim->dtheta, fmin(sim->precice_dt, *sim->dtheta * *sim->tper));
fflush(stdout);
// Compute the normalized time step used by CalculiX
*sim->dtheta = fmin(sim->precice_dt / *sim->tper, *sim->dtheta);
// Compute the non-normalized time step used by preCICE
sim->solver_dt = (*sim->dtheta) * (*sim->tper);
If I understand correctly, CalculiX (or the CalculiX adapter) works in terms of “increments” (could tper mean time per increment?). Or at least that’s how I understand the “normalized time step”. I suspect that something is going wrong with this normalization, leading CalculiX to do zero increments / give a zero dt to preCICE.
you specify the (initial) increment size with the first argument and the time period of the CalculiX step with the second one. In your case:
0.0001, 0.01
With the keyword DIRECT you keep the increment size fixed.
Now the problem is that the CalculiX Timestep is finished after 100*0.0001s(increment size)=0.01s(timeperiod of the timestep). And as the CalculiX adapter doesn’t support more Timesteps in CalculiX it just takes the increments of this one timestep and an error occurs if the increment is legitimately set to 0, which is the case, when the time period is reached.
I guess the solution for your case to run until 1s would be to specify the time period of the timestep as 1, leading to the following lines in your CalculiX input file:
That was it! Thank you so much!
I do have another quick question; if I want my simulation to restart from latest time, do I just have to change the startTime to latestTime in OF or would I have to change something in the precice-config?