OpenFoam with subcycling

Hello preCICE-community,

I have a more technical question regarding the OpenFOAM adapter ( and maybe the other fluid solver adapters). Right now preCICE only stores the values at the end of the coupling window and sends them to my structure solver as initial condition. If I do subcycling on the OpenFOAM side, i would get several intermediate values that are interesting too. Is there a way to retrieve them without changing the adapter ? Maybe with the python callback interface ?

I’ve seen that Benjamin Rüth defined several quantities like “Temperature1, Temperature2, Temperature3, …” in the preCICE config file to communicate those values.

So on the wiki page, the python callback interface example looks quite like the thing that would make it possible storing intermediate values directly to precice and afterwards OpenFOAM would overwrite the step internally to calculate new ones etc. …

Is my question clear ? If not i can maybe draw something …

Thanks for your help.
Max

Hi Max,

Correct

I guess you could hack sth together with the Python callback interface, yes.

The easier solution for you could however be to fake preCICE on the structure side to do smaller timesteps. Instead of

advance(solid_dt);

just call:

advance(solid_dt / 4);
advance(solid_dt / 4);
advance(solid_dt / 4);
advance(solid_dt / 4);

and store the values in between.

In the mid future, we will implement waveform relaxation in preCICE. Then, preCICE will already do useful things with those intermediate values and the user does not need to care.

More on what we plan to do: https://onlinelibrary.wiley.com/doi/full/10.1002/nme.6443

In this paper, we did a similar trick to test waveform relaxation, but technically that’s not what we want in the long run.

Hey,

ok, so it seems it’s not that easy to retrieve intermediate values with the already implemented adapters right now.

On the structure side I’m basically free and can do “whatever” I want, theoretically. I already sub-cycle there, let’s say 10 iterations per time-window on average, thus i call advance that often to reach my coupling window end. Actually, I may need some further explanation about how calling advance more often would help me :sweat_smile:. Couldn’t I call the send/write function of precice each time i do a timestep with some different tag like create different IDs of “Temperature_X”. I guess there are several options … The values should just be buffered then with different IDs and send at the time window end. The communication with other solvers is only triggered at the end of the time window, so the advance in between is only there to track the time inside the window, right ?

I’m just asking to see whats possible right now, to get some deeper understanding and a feeling how this might work in the future.

Hi again,

I am afraid what I suggested above will indeed not work. That would require changes (hacks) in the OpenFOAM adapter as well.

Yes, that’s the reason.

I guess what you could try is to indeed copy the value after each sub timestep Temperature with a Python action to a field Temperature_X and then read the values Temperature_X on the structure side.

Then you only have to call advance once on the structure side with the full solid_dt.

I have not tried this yet. Please let me know how it goes.

To avoid misunderstandings:

  • Subcycling is the term we use for smaller timesteps a solver does within a time window.
  • Subiteration or coupling iterations we use for the multiple executions of a time window due to implicit coupling.

Right now: only with some hacking.
Future: waveform relaxation will be completely done by preCICE. As a user you just do normal subcycling, but you get high order values at each timestep within a time window after calling advance. Data is still only communicated at the end of each time window, but the data then is a high-order representation of what happened during the time window; say coefficients of a time interpolant … things we still need to figure out and which will also be hidden from the user.
More or less understandable?

Hey,

yeah everything is clear now.
Actually I’m not sure if i find the time to fully test the value copying with the python callback.

But thanks for the help so far.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.