Identify the type and get the value of a boundary

Questions and remarks about Code_Saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
C0st4s
Posts: 42
Joined: Fri May 11, 2018 12:21 pm

Identify the type and get the value of a boundary

Post by C0st4s » Fri Aug 09, 2019 12:43 pm

Hi,

I have a simple question. Is it possible to get the type and the value of an assigned boundary condition inside the cs_user_modules.f90?

I tried:
call user_boundary_conditions(nvar, itypfb, icodcl, rcodcl)
write(*,*) itypfb(ifac), icodcl(ifac, ivart), rcodcl(ifac, ivart,3) !,cvar_scalt(ifac)

And the values does not make any sense with what I assign in the GUI (heat flux condition).

Best regards,
Costas

Yvan Fournier
Posts: 2689
Joined: Mon Feb 20, 2012 3:25 pm

Re: Identify the type and get the value of a boundary

Post by Yvan Fournier » Fri Aug 09, 2019 8:49 pm

Hello,

cs_user_modules.f90 allows adding functions which can be called from any other user subroutine. Depending where you call those from you will have access to the icodcl, rcodcl, ... arrays.

Regards,

Yvan

C0st4s
Posts: 42
Joined: Fri May 11, 2018 12:21 pm

Re: Identify the type and get the value of a boundary

Post by C0st4s » Sun Aug 11, 2019 5:55 pm

Dear Yvan,

Really appreciate your reply. Though, the main issue that I face is that the boundary conditions are prescribed in the GUI (smooth wall with heat flux) and I want to call the value and the type of that in the cs_user_modules.f90.

Best regards,
Costas

Yvan Fournier
Posts: 2689
Joined: Mon Feb 20, 2012 3:25 pm

Re: Identify the type and get the value of a boundary

Post by Yvan Fournier » Mon Aug 12, 2019 8:56 am

Hello,

Could you explain where cs_user_modules is used/called from in your code ?

Regards,

Yvan

C0st4s
Posts: 42
Joined: Fri May 11, 2018 12:21 pm

Re: Identify the type and get the value of a boundary

Post by C0st4s » Wed Aug 14, 2019 11:05 am

Dear Yvan,

I call the routines of the cs_user_modules in cs_user_source_terms.f90 under cs_user_turbulence_source_terms since I modifying sources in the turbulent transport equations. The import thing is to get the face index of each boundary wall face which I am not sure if can do it with rcodcl(ifac,iu).eq.5 since I set every boundary condition in the GUI.

Thanks,
Costas

Yvan Fournier
Posts: 2689
Joined: Mon Feb 20, 2012 3:25 pm

Re: Identify the type and get the value of a boundary

Post by Yvan Fournier » Wed Aug 14, 2019 3:45 pm

Hello,

No, the icodcl and rcodcl arrays are temporary, so they exist when in cs_user_boundary_conditions.f90 (and are initialized by the GUI), but do not exist anymore in cs_user_source_terms.f90.

You could either save a copy to your cs_user_modules by adding a copy operation from cs_user_boundary_conditions, duplicate the selection process in cs_user_modules, or try to work directly with the coefa/coefb arrays which are always available for a given variable field.

Best regards,

Yvan

C0st4s
Posts: 42
Joined: Fri May 11, 2018 12:21 pm

Re: Identify the type and get the value of a boundary

Post by C0st4s » Mon Aug 19, 2019 5:34 pm

Hi,
Thanks Yvan again!

I use the approach of defining the boundary conditions in cs_user_boundary_conditions.f90 and calling that routine in my module. It works fine. Where can I find an example of the coefa and coefb approach that you suggested just to have a look? Is it similar to the one in the energy balance?

Cheers,
Costas

Post Reply