Second-Order Temporal Discretization Except for Turbulence Model Equations

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
finzeo
Posts: 70
Joined: Fri Sep 09, 2022 4:23 pm

Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by finzeo »

Hi everyone,

I would like to use, where possible, a second-order temporal discretization for all relevant equations in an incompressible case with the DDES k-omega SST turbulence model. I understand that, in the case of this model, there is a restriction against using second-order time discretization for the k and omega equations. However, I would like to at least enable second-order time discretization for the other equations. I am using version 8.0.

I have tried various ways to achieve this, but I always encounter some failure or a warning indicating that some variables are being treated as first-order. Below is my latest attempt. The following code was added to cs_user_parameters.c:

Code: Select all

cs_time_scheme_t *t_sc = cs_get_glob_time_scheme();
//t_sc->time_order = 2; // it gets error for iturb=60 (k-omega SST)
t_sc->istmpf = 2;
t_sc->isno2t = 1;
t_sc->thetcp = 1/2;
int key_t_ext_id_t = cs_field_key_id("time_extrapolated");
cs_field_set_key_int(cs_field_by_name("density"), key_t_ext_id_t, 1);
I receive the following warning message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ @@ WARNING: ADVANCED MODIFICATION FOR
@ ========,
@ velocity OF THE VARIABLE
@ THETAV.
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@

@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ @@ WARNING: ADVANCED MODIFICATION FOR
@ ========,
@ k OF THE VARIABLE
@ THETAV.
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@

@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ @@ WARNING: ADVANCED MODIFICATION FOR
@ ========,
@ omega OF THE VARIABLE
@ THETAV.
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@

@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ @@ WARNING : WHEN READING INPUT DATA
@ =========
@ CHOICE OF TIME-SCHEME
@
@ TIME-SCHEME FOR VELOCITY IS SECOND ORDER
@ (THETAV = 0.50E+00)
@ SOME TERMS ARE HOWEVER FIRST ORDER IN TIME WITH
@ THE FOLLOWING SETTINGS:
@
@ parameters ISTMPF ISNO2T ISTO2T IROEXT IVIEXT ICPEXT
@ Values entered 2 1 0 1 0 0
@
@ computation will go on.
@
@ Check the input data.
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
I am also attaching the setup.log file.

What is still set as first-order time discretization that I could change to second-order? How do I change it in the code?

Thank you in advance.
Attachments
setup.log
(39.71 KiB) Downloaded 462 times
Yvan Fournier
Posts: 4125
Joined: Mon Feb 20, 2012 3:25 pm

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by Yvan Fournier »

Hello,

I know the handling of "per variable" time scheme is a complicated mess, with some options that have been available for years but never really tested, and others which may be missing but would make sense.

I am not too well versed in this part of the code, but will ask some colleagues if there is a solution to this, or if you can just ignore those warnings (which, if I understand, do not prevent the computation from running ?).

Best regards,

Yvan
finzeo
Posts: 70
Joined: Fri Sep 09, 2022 4:23 pm

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by finzeo »

Yvan,

Yes, with the code I showed, the simulation runs despite the warnings.
This is interesting because using second-order in time allows for larger time steps (under a certain accuracy criterion), thereby reducing the need for extensive cluster resources over time.
Yvan Fournier
Posts: 4125
Joined: Mon Feb 20, 2012 3:25 pm

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by Yvan Fournier »

Hello,

Any detailed feedback on this is very welcome :-)

Best regards,

Yvan
finzeo
Posts: 70
Joined: Fri Sep 09, 2022 4:23 pm

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by finzeo »

Update: I managed to prevent the program from aborting when setting time_order=2 by editing the varpos.f90 file. By activating time_order=2, everything implemented for second-order time discretization executes accordingly. Analyzing cs_turbulence_kw.c, I noticed there's no code to run in second order, but at least everything else is running in second order in time and it works.

In fact, I modified the cs_turbulence_kw.c code to incorporate a theta=0.5 in the corresponding expressions, but I did not obtain positive results (it diverges if I do this; if I don't edit it, it does not diverge). My strategy is basically to leave the explicit terms as they are and multiply the implicit terms by a factor of theta=0.5. Do you see anything I might be forgetting? I attach this source file. Any suggestion to advance this is appreciated.
Attachments
varpos.f90
(38.91 KiB) Downloaded 462 times
cs_turbulence_kw.c
(62.99 KiB) Downloaded 468 times
Yvan Fournier
Posts: 4125
Joined: Mon Feb 20, 2012 3:25 pm

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by Yvan Fournier »

Hello,

I asked a colleague, who told me trying to force 2nd order this way is risky and might ne behave well, and that a PhD student might be looking into this soon, but have no more details.

I'll keep you updated if I get more info on what can be done.

Best regards,

Yvan
finzeo
Posts: 70
Joined: Fri Sep 09, 2022 4:23 pm

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by finzeo »

Thanks, Yvan.

Similarly, if I manage to make any progress, I'll post it here.
daniele
Posts: 150
Joined: Wed Feb 01, 2017 11:42 am

Re: Second-Order Temporal Discretization Except for Turbulence Model Equations

Post by daniele »

Hello,

If it can help, my personal way of running "non LES" setups with second-order time scheme for the momentum equations, is to force the second order for the velocity inside the varpos routine, while keeping first order for the turbulence equations.

It seems similar to what you do. But I don't have the warning messages you have, probably we don't edit varpos exactly in the same way.
I have performed some "validation" tests and I haven't noticed any inconsistency in the results.

Kind regards,

Daniele
Post Reply