dumping a user defined parameter

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
leguichet
Posts: 34
Joined: Wed Sep 03, 2014 1:00 pm

dumping a user defined parameter

Post by leguichet »

I am using the version 3.0.6

I added a user defined parameter served to output a scalar, which is based on the flow properties: velocity amplitude, temperature and radiative intensity. Since it is unnecessary to be solved by the transport equation, I think it is better to declare this variable as a user defined parameter, such as the it4m (T⁴) in the combustion model.

So I added a new position in the varpos.f90
iprop = iprop + 1
ipprob(iutci) = iprop
and iutci declared in the cs_user_module.f90

I can dump the 3D field of this new 'iutci' for the ensight visualization.
However, I do not know how to dump it in timeseries at each monitoring variables as other variables.

I tried to add the following lines in cs_user_parameters.f90
!ZG UTCI
! ---- UTCI
ipp = ipppro(ipproc(iutci))
! nomvar(ipp) = 'UTCI'
ichrvr(ipp) = 1
ilisvr(ipp) = 1
ihisvr(ipp,1) = -1
!ZG UTCI
Nothing happened in the monitoring folder

When I uncommented ! nomvar(ipp) = 'UTCI', the code stops before reading the mesh, by giving an error for opening the listing file.

So I would like to know to dump 3D field properly with ensight as well as on the monitoring points.
Thank you
Yohann Eude
Posts: 19
Joined: Mon Aug 12, 2013 9:36 am

Re: dumping a user defined parameter

Post by Yohann Eude »

Hello,

I don't know if my answer will be good for you but if I were you I will use a scalar (scalar01) via the GUI or via the user subroutines and use this scalar to do the monitoring. In cs_user_extra_operation, I will write scalar01 = your own variable.

Regards,

Yohann
leguichet
Posts: 34
Joined: Wed Sep 03, 2014 1:00 pm

Re: dumping a user defined parameter

Post by leguichet »

Thank you for your reply. It is time to give some feedback.

I did some search in the code version 3.0.6. It seems that we can declare a new "propce", but the number of variables is not automatically incremented for the global number of variables, unless they are already declared in the specific models. I do not know whether it is a bug?

So the only way to do is to use user_extra_operation, as you said. However, it can not be declared as scalar via GUI or via user subroutines, since it will additionally create a transport equation for this scalar, which is not physical and pose some numerical convergence problems (iteration stops at 2nd step... in my case).

So the best way seems to declare a global matrix/table in user_module and use user_extra_operation to dump the data.

It is also a bit tricky that the function "findpt" will find the closest cell to the monitoring point, not necessarily the cell containing the monitoring point.

Best regards & Merry Christmas

Zhenlan
Yohann Eude wrote:Hello,

I don't know if my answer will be good for you but if I were you I will use a scalar (scalar01) via the GUI or via the user subroutines and use this scalar to do the monitoring. In cs_user_extra_operation, I will write scalar01 = your own variable.

Regards,

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

Re: dumping a user defined parameter

Post by Yvan Fournier »

Hello,

I do not recommend adding a new "propce" in version 3.0 if you are not very familiar with the code. In version 4.0 (starting with version 3.3), we did a lot of simplification work in varpos (splitting it into fldvar, fldprp, varpos, and rayprp), using utility functions to make adding variables and properties easier, precisely because it was too complex and error-prone in previous versions. So learning how to do this properly in 3.0 is probably a waste of your time.

Note that for probes, you have some additional examples in ushist.f90.

findpt was expected to disappear an be replaced by a cleaner system this year, but for lack of time, it has still not been replaced by a better system. I know how I want to replace it (using the ple_locator/fvm_point_location functions in the code, which do find the cell containing the point, and not the cell whose center is closest), but it will have to wait a few more months...

Still, with a few weeks, I hope to add user examples in version 4.0's documentation (and the appropriate Fortran bindings) so as to make it easier to use those "true" location functions, which could the be used in advanced setups in cs_user_extra_operations.f90 or ushist.f90.

Regards,

Yvan
Post Reply