How to access to the mass flow of a cross section?
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
How to access to the mass flow of a cross section?
Hi Code Saturne develop team:
In one of my script, I need to visit the mass flow of a cross section of the fluid channel. From the cs_field API, I can only get access to the variables stored in cells. How can I get the mass flow of a cross section (a certain layer of internal faces)? Thank you!
Regards!
Jundi
In one of my script, I need to visit the mass flow of a cross section of the fluid channel. From the cs_field API, I can only get access to the variables stored in cells. How can I get the mass flow of a cross section (a certain layer of internal faces)? Thank you!
Regards!
Jundi
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: How to access to the mass flow of a cross section?
Hello,
You can check the "cs_user_extra_operations-energy_balance.f90" in the example directory. In this example the kimasf (interior convective mass flux key ids of the variables) is used to access to the mass flow on internal faces.
Maybe this can help you.
Regards,
Luciano
You can check the "cs_user_extra_operations-energy_balance.f90" in the example directory. In this example the kimasf (interior convective mass flux key ids of the variables) is used to access to the mass flow on internal faces.
Code: Select all
....
call field_get_key_int(ivarfl(ivar), kimasf, iflmas)
call field_get_val_s(iflmas, imasfl)
.....
Regards,
Luciano
Re: How to access to the mass flow of a cross section?
Thanks for the example script, it;s useful. So after calling the two functions:
call field_get_key_int(ivarfl(ivar), kimasf, iflmas)
call field_get_val_s(iflmas, imasfl)
if ifac is the id of the internal face, I can access to the mass flow of this face by:
imasfl(ifac)
is it correct? Thanks!
call field_get_key_int(ivarfl(ivar), kimasf, iflmas)
call field_get_val_s(iflmas, imasfl)
if ifac is the id of the internal face, I can access to the mass flow of this face by:
imasfl(ifac)
is it correct? Thanks!
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: How to access to the mass flow of a cross section?
Hello,
Yes, it is correct.
Also, you can use the balance by zone in the GUI. The output is printed in the listing file and you can get the mass flow rate.
Regards,
Luciano
Yes, it is correct.
Also, you can use the balance by zone in the GUI. The output is printed in the listing file and you can get the mass flow rate.
Regards,
Luciano
Re: How to access to the mass flow of a cross section?
Normally I will use a do loop to all the internal faces:
do ifac = 1, nfac
can I directly use nfac (the total number of all the faces), or I need to first define it?
Another question is that if I have a face id, ifac, can I access to the coordinate of the face centre? Like the way I visit the coordinate of the cell centre: xyzcen(1,iel). Many thanks.
Regards!
Jundi
do ifac = 1, nfac
can I directly use nfac (the total number of all the faces), or I need to first define it?
Another question is that if I have a face id, ifac, can I access to the coordinate of the face centre? Like the way I visit the coordinate of the cell centre: xyzcen(1,iel). Many thanks.
Regards!
Jundi
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: How to access to the mass flow of a cross section?
Hello,
I suppose that you need to compute the mass flow over a subset of internal faces (because you ask about a cross section). If you need to compute the mass flow over all the internal faces you can use nfac (Fortran variables are global in the code, accessible directly by their name).
If you need to access to mesh entities or mesh quantities, this doxygen pages has the information
https://www.code-saturne.org/doxygen/src/mesh.html
To access to the interior faces coordinate use cdgfac (Center of gravity of interior faces).
Regards,
Luciano
I suppose that you need to compute the mass flow over a subset of internal faces (because you ask about a cross section). If you need to compute the mass flow over all the internal faces you can use nfac (Fortran variables are global in the code, accessible directly by their name).
If you need to access to mesh entities or mesh quantities, this doxygen pages has the information
https://www.code-saturne.org/doxygen/src/mesh.html
To access to the interior faces coordinate use cdgfac (Center of gravity of interior faces).
Regards,
Luciano
Re: How to access to the mass flow of a cross section?
OK, global variables means that I can directly visit in the scripts.
About the coordinate of the internal faces, if ifac is the face id, and I visit the z coordinate of the face centre:
cdgfac(3,ifac)
is this the correct way? Thanks!
Regards!
Jundi
About the coordinate of the internal faces, if ifac is the face id, and I visit the z coordinate of the face centre:
cdgfac(3,ifac)
is this the correct way? Thanks!
Regards!
Jundi
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: How to access to the mass flow of a cross section?
Yes, This is the correct way.
Regards,
Luciano
Regards,
Luciano
Re: How to access to the mass flow of a cross section?
Thank you, this helps me a lot.
Jundi
Jundi
Re: How to access to the mass flow of a cross section?
Hi:
Can I visit the current number of iteration in the script? I guess it is another global number which I can directly access. Thanks!
Jundi
Can I visit the current number of iteration in the script? I guess it is another global number which I can directly access. Thanks!
Jundi