Lagrangien module and boundary conditions

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
jtache
Posts: 25
Joined: Thu Apr 19, 2012 4:01 pm

Lagrangien module and boundary conditions

Post 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
Yvan Fournier
Posts: 4075
Joined: Mon Feb 20, 2012 3:25 pm

Re: Lagrangien module and boundary conditions

Post 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
jtache
Posts: 25
Joined: Thu Apr 19, 2012 4:01 pm

Re: Lagrangien module and boundary conditions

Post 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
Yvan Fournier
Posts: 4075
Joined: Mon Feb 20, 2012 3:25 pm

Re: Lagrangien module and boundary conditions

Post 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
jtache
Posts: 25
Joined: Thu Apr 19, 2012 4:01 pm

Re: Lagrangien module and boundary conditions

Post 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
Yvan Fournier
Posts: 4075
Joined: Mon Feb 20, 2012 3:25 pm

Re: Lagrangien module and boundary conditions

Post 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
jtache
Posts: 25
Joined: Thu Apr 19, 2012 4:01 pm

Re: Lagrangien module and boundary conditions

Post 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
Yvan Fournier
Posts: 4075
Joined: Mon Feb 20, 2012 3:25 pm

Re: Lagrangien module and boundary conditions

Post 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
jtache
Posts: 25
Joined: Thu Apr 19, 2012 4:01 pm

Re: Lagrangien module and boundary conditions

Post by jtache »

Dear Yvan,

This is exactly what I need.

Again, with all my thanks for your support,

Jeremie
Post Reply