Heat exchange coefficient

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
vlado285
Posts: 16
Joined: Fri Feb 12, 2021 9:52 am

Heat exchange coefficient

Post by vlado285 »

Hello all,

I need to help with calculation of heat exchange coefficient h on boundary faces. This field is necessary to have in med file if I want to make a coupling with code aster. It should be possible via subroutine but I didn't find some example.

Thank in advance.
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Heat exchange coefficient

Post by Yvan Fournier »

Hello,

You can easily obtain the heat flux, and wall temperature, but for an exchange coefficient, you would also need to define the fluid temperature in the "F = h.(Twall - Tfluid)" expression.

How do you want to defined the fluid temperature ? You need some sort of bulk temperature, as taking the temperature a the cells near the wall make no sense: for a fixed heat flux, refining the mesh would lead to using fluid values closer to the wall, thereby reducing the Twall - Tfluid difference, and thus changing the computed heat flux, which is obviously wrong.

The wall laws do compute some form of local exchange coefficient, but its interpretation is tricky, as explained above, so from an application point of view, using bulk values by volume and surface zones makes more sense.
If you only need the exchange coefficient in a manner similar to what is used for Syrthes coupling, where the flux is explained in a relaxed form using an exchange coefficient, then the interpretation is not a problem, so you can simply use the heat flux at faces, the wall temperature, and the fluid temperature at adjacent cell centers to reconstruct an equivalent exchange coeficient (using the values computed for Syrthes would be nicer, but there is currently no user-defined function call point where that would be needed).

Best regards,

Yvan
vlado285
Posts: 16
Joined: Fri Feb 12, 2021 9:52 am

Re: Heat exchange coefficient

Post by vlado285 »

Hello Yvan,

I also thought about this expression F = h.(Twall - Tfluid) and also about the problem when the mesh is doing finer in surface area. If I use the internal coupling in code saturne (solid -fluid)is there no value (exchange coefficient) that I can to extract and save in med file? The code aster can read only temp and heat exchange coefficient on surface mesh. From that reason I can't read the fluid mesh but only boundary mesh.
Otherwise if it is not possible then can You help me simply use the heat flux at faces, the wall temperature, and the fluid temperature at adjacent cell centers to reconstruct an equivalent exchange coeficient. I have no idea how to do it in subroutine. Otherwise it is not possible to make this coupling without this field in med file.


Best regards,

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

Re: Heat exchange coefficient

Post by Yvan Fournier »

Hello,

In the post-processing field examples from the documentation (https://www.code-saturne.org/documentat ... var_p.html), the "Output of a variable on a surface mesh" example should be a good starting point (you can remove the initial test restricting it to a given output mesh, or adapt it to your case).
The following page may also help you to replace the pressure with the temperature: https://www.code-saturne.org/documentat ... _dico.html

in you case, you will have only the boundary (not interior) faces, and replace the pressure with the interior temperature.

I suggest you adapt that example to output the adjacent fluid temperature to the boundary, visualize it to check; and when that is done, it will be easy to access the flux and wall temperature to obtain an equivalent heat transfer value. But I recommend progressing step by step, so you can get help here at each step if needed.

Best regards,

Yvan
vlado285
Posts: 16
Joined: Fri Feb 12, 2021 9:52 am

Re: Heat exchange coefficient

Post by vlado285 »

Hello Yvan,

I was able to adapt the "Output of a variable on a surface mesh" to my case of temperature.
But how can I access the boundary temperature and boundary flux?
(something like cs_real_t*cvar_scalt=CS_F(t) for temperature)

I found in forum some example of boundary flux in fortran like bflux but it didnt work in c.

Thanks.

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

Re: Heat exchange coefficient

Post by Yvan Fournier »

Hello,

For those, using "cs_field_by_name" is the best solution.

Temperature is always named "temperature".

For the boundary heat flux, I do not remember exactly, but if you activate it in the boundary fields postprocessing outpour and check the field names in the run_solver.log generated by a run, you will find its exact name.

Best regards,

Yvan
vlado285
Posts: 16
Joined: Fri Feb 12, 2021 9:52 am

Re: Heat exchange coefficient

Post by vlado285 »

Hello Yvan,

1. if I active the thermal flux for boundary faces then in run_solver.log I have only Boundary temperature and Yplus. (it miss the thermal flux on boundary faces)
2. I need also the field Boundary temperature but with cs_real_t *cvar_ptt = cs_field_by_name("Boundary temperature")->val; it is not possible. This field was not found.
Attachments
cs_user_postprocess.c
(5.77 KiB) Downloaded 89 times
boundary temperature.JPG
boundary temperature not found.JPG
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Heat exchange coefficient

Post by Yvan Fournier »

Hello,

For field names, it is better to check "setup.log" than "run_solver.log", as you will also have the "canonical" names and not just labels.

For the heat flux, it may use a temporary array rather than a permanent field, so you can use the cs_post_boundary_flux utility function to compute it: https://www.code-saturne.org/documentat ... adc0fb5bbc
(it is defined in cs_post.h).
See also src/user_examples/cs_user_extra_operations-nusselt_and_friction_calculation.c in the code's sources to see how it is called (this example might be missing from the Doxygen-generated doc).

Best regards,

Yvan
Post Reply