Page 1 of 1

Lagrangien module and boundary conditions

Posted: Wed Aug 26, 2020 9:25 am
by jtache
Dear CS team & saturnians,

I'm using the lagrangien module of Code_Saturne for studying the dispersion of particles. What I would like to do is to define an inlet boundary condition for particles which is discontinued : at a certain time T0 (that comes after a restart) the particles are entering the domain with a certain velocity during a duration DT then the inlet of particles is stopped. The dispersion is then calculated based on the flow field.
So the BC for particles is only an inlet between T0 and (T0+DT).

Could you help me with that? Which is the subroutine that I need to modifiy with a test like :

Code: Select all

if ((ttcabs . GT. T0) .and. (ttcabs .LT. (T0+DT))) then ..
.

Thanks in advance for any help.

Jérémie

Re: Lagrangien module and boundary conditions

Posted: Wed Aug 26, 2020 12:01 pm
by Yvan Fournier
Hello,

You would need to use the "cs_user_lagr_boundary_conditions" user function (see examples), and based on the time step (cs_glob_time_step structure), modify the injection frequency or number of particles for the selected zone.

Best regards,

Yvan

Re: Lagrangien module and boundary conditions

Posted: Wed Aug 26, 2020 1:54 pm
by jtache
Thank you very much for your answer Yvan.
Unfortunately, I don't have access to CS6 for the moment due to configuration issues.
Would I be able to the same thing in uslain() subroutine for CS4?

Best regards,
Jeremie

Re: Lagrangien module and boundary conditions

Posted: Wed Aug 26, 2020 3:14 pm
by Yvan Fournier
Hello,

Yes I believe that would work also. There have been quite a few improvements in the Lagrangian module in recent years, so upgrading is recommended.

Do you have specific configuration issues prevent upgrading ? Or simply many user subroutines to upgrade ?

Best regards,

Yvan

Re: Lagrangien module and boundary conditions

Posted: Wed Aug 26, 2020 3:47 pm
by jtache
Both...
I will try an upgrade for using these improvements of the Lagrangian module.
Another question : it's not clear for me how to play with time step, frequency and number of particles for defining my injection between (and only between) t=t_start and t=t_stop?

Best regards,
Jeremie

Re: Lagrangien module and boundary conditions

Posted: Wed Aug 26, 2020 10:32 pm
by Yvan Fournier
Hello,

You can simply (accessing an injection zone through a variable named zis as in the example) try something similar to this:

Code: Select all

zis->injection_frequency = 1;

if (   cs_glob_time_step->t_cur >= t_start
    && cs_glob_time_step->t_cur < t_end)
   zis->n_inject = 100;
else
   zis->n_inject = 0;
Best regards,

Yvan

Re: Lagrangien module and boundary conditions

Posted: Sat Aug 29, 2020 9:10 am
by jtache
Hello Yvan,

Thank you very much for your help, I've installed CS6 and your solution is actually working!

I would need another information on cs_glob_time_step structure : when I work with a constant time step, I can use cs_glob_time_step->dt_ref to retrieve the current time step but when I use a varying time step, I saw in the doxygen that the time step is the array cs_glob_time_step->dt[3].
So my question is the following : how can I retrieve the (current) time step when it's varying over the computation?

Best regards,
Jeremie

Re: Lagrangien module and boundary conditions

Posted: Sun Aug 30, 2020 6:20 pm
by Yvan Fournier
Hello,

cs_glob_time_step->dt[0] contains the current time step, dt[1] the previous one, and dt[2] the one before that.

So cs_glob_time_step->dt[0] should be what you need.

As regards notations: dt is used for time stepx, t for (cumulative, "physical") time.

Best regards,

Yvan

Re: Lagrangien module and boundary conditions

Posted: Mon Aug 31, 2020 8:07 am
by jtache
Dear Yvan,

This is exactly what I need.

Again, with all my thanks for your support,

Jeremie