Importing thermal_flux values

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Pisolino
Posts: 86
Joined: Thu Apr 26, 2012 1:55 pm

Importing thermal_flux values

Post by Pisolino »

Hi all,
i'm trying to import like a boundary field (i.e yplus) the boundary thermal flux (input_thermal_flux in paraview or thermal_flux in CS gui) using .c subroutines. However, as i checked, the field is not defined when user_postprocess is called and so i just can't import it. How can i read such field inside my function?

Thank you

Andrea
Andrea
CEO and R&D manager @ ARGO srl

mail: info@argosrl.eu
site: www.argosrl.eu
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Importing thermal_flux values

Post by Yvan Fournier »

Hello,

Which version of the code are you using ? Are you also using the GUI ? Depending on postprocessing options, the matching field is created or not (see src/addflf.f90 for the definition logic if you need more details).

Best regards,

Yvan
Pisolino
Posts: 86
Joined: Thu Apr 26, 2012 1:55 pm

Re: Importing thermal_flux values

Post by Pisolino »

Hi Yvan,
I'm using CS 4.0 builded on linux Ubuntu 16.04 and on Win7. I can't find addflf.f90, instead i have addfld.f90 that i suppose is the subroutine you wanted me to look. Yes i always use GUI to setup the postprocessing surface output. How can i call the f90 function to create such thermal_flux field before my postprocessing cs_user_postprocess.c subroutine call?

Thank you

Andrea
Andrea
CEO and R&D manager @ ARGO srl

mail: info@argosrl.eu
site: www.argosrl.eu
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Importing thermal_flux values

Post by Yvan Fournier »

Hello,

Sorry, you used the right file (my typo), but this is the right file only for more recent versions. In version 4.0, the file to check was fldini.f90, and the field is created if ineedy is set (in cs_user_parameters.f90, in usipsu), or if a field named "boundary_forces" located on boundary faces is defined in cs_user_parameters.c.

Best regards,

Yvan
Pisolino
Posts: 86
Joined: Thu Apr 26, 2012 1:55 pm

Re: Importing thermal_flux values

Post by Pisolino »

Hi Yvan,
from the file you suggested me :

Code: Select all

! Additional fields
325 	!------------------
326 	
327 	! Fields used to save postprocessing data
328 	
329 	itycat = FIELD_INTENSIVE + FIELD_PROPERTY
330 	ityloc = 3 ! boundary faces
331 	
332 	! If postprocessing of boundary temperature or boundary layer Nusselt required
333 	if (ipstdv(ipsttb).gt.0 .or. ipstdv(ipstnu).gt.0) then
334 	  call field_create('tplus', itycat, ityloc, idim1, ilved, inoprv, iflid)
335 	  call field_create('tstar', itycat, ityloc, idim1, ilved, inoprv, iflid)
336 	endif
337 	
338 	ilved = .true.
339 	
340 	if (ineedf.eq.1) then
341 	  call field_create('boundary_forces', itycat, ityloc, idim3, ilved, inoprv, &
342 	                    iforbr)
343 	endif
344 	
345 	if (ipstdv(ipstyp).ne.0) then
346 	  call field_create('yplus', itycat, ityloc, idim1, ilved, inoprv, iyplbr)
347 	endif
i prepared a simulation with some printf in the cs_user_postprocess.c to better understand the fields and their values. This is the output:

Code: Select all

field number =  20 
field list =
Velocity 
 Pressure 
 k 
 omega 
 TempC 
 Density 
 Boundary Density 
 LamVisc 
 TurbVisc 
 CourantNb 
 FourierNb 
 total_pressure 
 Local Time Step 
 dttens 
 inner_mass_flux 
 boundary_mass_flux 
 tplus 
 tstar 
 boundary_forces 
 Yplus 
  
based on what you said i imported the boundary_forces field however such values are not comparable to the "input_thermal_flux" field .

boundary forces values :
fmin= -0.000166 fmean 0.000001 fmax= 0.000196
input_thermal_flux (from paraview) :
min -3.2e+03 max = -1.8e+02

Any idea on what is wrong ?

Thank you
Andrea
CEO and R&D manager @ ARGO srl

mail: info@argosrl.eu
site: www.argosrl.eu
Pisolino
Posts: 86
Joined: Thu Apr 26, 2012 1:55 pm

Re: Importing thermal_flux values

Post by Pisolino »

I tryed again leaving only, as surface postprocessing: Yplus, Dimensionless Thermal flux, Boundary temperature, Thermal flux, Tplus . And the field boundary_forces doesn't exist anymore, so i suppore is related only to stress/force efforts not to thermal flux.

Code: Select all

field number= 19 
field list =
Velocity 
 Pressure 
 k 
 omega 
 TempC 
 Density 
 Boundary Density 
 LamVisc 
 TurbVisc 
 CourantNb 
 FourierNb 
 total_pressure 
 Local Time Step 
 dttens 
 inner_mass_flux 
 boundary_mass_flux 
 tplus 
 tstar 
 Yplus 
Andrea
CEO and R&D manager @ ARGO srl

mail: info@argosrl.eu
site: www.argosrl.eu
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Importing thermal_flux values

Post by Yvan Fournier »

Hello,

Here again, I may have answered a bit fast and lost track of whether you required boundary forces and boundary thermal fluxes...

A minor remark: no need for user postprocessing to check which files exist, since the setup.log file lists all fields which are defined (at least all fields defined before the time loop, which is the recommended practice).

In any case, extra fields are created in fldini.f90 and addfld.f90 at different stages. Main resolved variables in fldvar.f90, main properties in fldprp.f90 (and specific physical modeals have their own extra initializations). But checking again, the "input-thermal_flux" output is not a field, but a locally evaluated expression (see dvvpst.f90). This should be generalized in the future as "evaluators" (similar to fields but with local/temporary lifecycle), but wok on this has not started yet (so it will be post-5.0).

So to compute (locally) the boundary thermal flux, you need to call the "post_boundary_thermal_flux" routine from the post_util module. There is no C version in 4.0 (in 5.0, there are both the legacy Fortran version and a new C version).

Best regards,

Yvan
Post Reply