Saturne - Syrthes coupling: synchronization

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
dezsit
Posts: 2
Joined: Tue Dec 11, 2018 11:11 am

Saturne - Syrthes coupling: synchronization

Post by dezsit »

Hello,

Is there any possibility to force the synchronization in a coupled Saturne - Syrthes simulation as for example
100 iteration in Saturne -> synchronization -> converged time step iteration in Syrthes?

The Saturne case would be steady state, so the time step should not have physical meaning. Do we think well, the synchronization done iteration by iteration, as default
or time step by time step ?

What we see in the code, that we can have a cs_coupling_set_sync_flag which somehow alter the default synchronization behavior, but we do not really understand how,
and did not experience any effect if we set this flag.

So I would reformulate slightly my question: how we can influence the default synchronization behavior? Could you provide us with some examples?

An other question: the real purpose of the cs_coupling_set_ts_multiplier is not really clear to us. How and when should be using it?

Thank you very much for your help.
Kind regards,
dezsit
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Saturne - Syrthes coupling: synchronization

Post by Yvan Fournier »

Hello,

By default, there is no time synchronization, only "time step" synchronization, so either fixed and identical time steps may be used on each side for a transient problem, or independent time steps may be used to accelerate convergence towards a steady state (possibly even using a local time step on the Code_Saturne side).

In any case, each time step is coupled, and there is currently no option to couple "one out of every n" time steps.

Using cs_coupling_set_sync_flag can allow synchronization even with a variable time step.

For example, in cs_user_coupling.c (or even cs_user_parameters.c) you can add:

Code: Select all

cs_coupling_set_sync_flag(PLE_COUPLING_TS_MIN);
to indicate all coupled codes will agree on using the smallest time step proposed by each of them, or

Code: Select all

cs_coupling_set_sync_flag(PLE_COUPLING_TS_LEADER);
to indicate Code_Saturne will impose its time step to Syrthes. In case of multiple couplings (for example 2 fluid domains on each side of an exchanger, with separate Code_Saturne cases, obviously only one can be leader.

This is really useful only when using time varying (but fixed in space) adaptive time steps for transient cases. Otherwise simply using appropriate multiple time steps is enough.

Setting a time step multiplier (using cs_coupling_set_ts_multiplier) is useful for example when the fluid flow time scale is smaller than the thermal time scale, for example when the flow is mostly steady or adapts rapidly but thermal time scales are larger (with to a large solid mass and low conductivity), such as cooling in a tunnel. It may also be useful the other way around. I have not used it in a long time and the logic behind it is a bit tricky, but it simply multiplies the time step applied to the same scalar on the fluid side, so as to align with the solid side.

So it might be a good solution in your case, as it is a good fit for "near steady state" on one side, tough you need to get the multiplier right (i.e. in the correct direction).

Best regards,

Yvan
dezsit
Posts: 2
Joined: Tue Dec 11, 2018 11:11 am

Re: Saturne - Syrthes coupling: synchronization

Post by dezsit »

Dear Yvan,

Thank you for your detailed answer!
We would have some other questions connecting to the cs_coupling_set_sync_flag:
We found these options:
PLE_COUPLING_STEADY
PLE_COUPLING_UNSTEADY
PLE_COUPLING_CONVERGED (this latest one can be found only in the source of the PLE library, so we think it cannot be used at all)

Are they usage implemented? If yes, what are their exact purpose (based on the names we suppose something, but when we set up them in a simulation, we did not experience any effect. Of course, it is also possible, that our model does not fit the possible usage of these keywords)
Or they are just in the code, but cannot be used during running?

Also, PLE_COUPLING_USER* exist. Could be used that to implement such a synchronization behavior, which described in my first post?

Thank you again,
Kind regards,
dezsit
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Saturne - Syrthes coupling: synchronization

Post by Yvan Fournier »

Hello,

PLE_COUPLING_STEADY and PLE_COUPLING_UNSTEADY were defined as "metadata" for cases where this infomation could be used to help select or tune algorithms, but are not really used so far.

The PLE_COUPLING_USER_* options could be used for any additional user info, but to use if for the behavior you are interested it in your first post, you woul need to modify not only this behavior but that of boundary exchanges:

Basically, each coupled Code_Saturne/Syrthes time seps has the following messages:
  • ple_coupling time step synchronization (used to agreple_coupling time step synchronization (used to agree whether the time loop continues or one code requests stopping, possibly synchronzing the time step, ...)
  • send wall temperature from Syrthes to Code_Saturne
  • send local heat transfer coefficient and near-wall fluid temperature from Code_Saturne to Syrthes
I need to check, but there migh be an additional, specific synchronization metadata exchange (to enforce balances for example) in addition to the main PLE synchronization message.

In any case, if you want to synchronize 1 out of n time steps, you also need to skip time steps (and used saved values from previous time steps) in the BC code, modifying the coupbi.f90 and coupbo.f90 for this.

Best regards,

Yvan
Post Reply