cs_user_physical_properties.f90 trouble

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

cs_user_physical_properties.f90 trouble

Post by Pablo »

Hello everyone:

I have been using the fluid properties with thermal dependence (density, viscosity etc.) by mean of the xml file (with small expressions editor which is launch in the GUI). Now I would like to do the same but by mean of the user_properties definition function "usphyv" with fortran files but I am having several troubles I can't manage, and I can't find any answer in the existing topics.

The issue happens when I configure the density property, so that the following error is shown in the listing:

"Fortran pointer of rank 1 requested for values of field "velocity",
which have rank 2."


As far as I have searched in the forums, it seems to be related with the scalar or field definition of the call functions, but I have observed this error happens when the density is being defined, while for the viscosity this error does not happen. (both definitions maintains the same structure of command, see attached files).

Any advise/comment about this user_property definition?



Thanks in advance
Attachments
customVISC.f90
(2.08 KiB) Downloaded 222 times
customRHO.f90
(2.33 KiB) Downloaded 223 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_user_physical_properties.f90 trouble

Post by Yvan Fournier »

Hello,

Your user subroutines seem OK, but possibly some property is defined as constant in the XML setup. Could you post the rest of your case setup (no need for the mesh, but at least the xml and all user subroutines) ? Also, could you post the whole listing and error files, as per the forum usage recommendations ?

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: cs_user_physical_properties.f90 trouble

Post by Pablo »

Hello Yvan:

You can find attached the results (compressed) files, the XML and the only subroutine used.



Kind regads,
Attachments
RUN00.XML
(8.78 KiB) Downloaded 213 times
20161002-2137.tar.gz
(655.38 KiB) Downloaded 206 times
customRHO.f90
(2.38 KiB) Downloaded 210 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_user_physical_properties.f90 trouble

Post by Yvan Fournier »

Hello,

Running this under a debugger, it seem the error comes from the fact that 'ibeta' is zero (so it is mistaken for Velocity).

To have the correct value of 'ibeta', you need to activate variable density, so indicate in the GUI that the density is variable (or set irovar = 1 in cs_user_parameters.f90).

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: cs_user_physical_properties.f90 trouble

Post by Pablo »

Hello Yvan:

As usual, thanks for your kind answer.

The point is I don't understand why in this C_S version (4.0b) it is not possible to indicate for every physical property the old option "user subroutine" in the emergent menu when the physical properties were being indicated in the GUI. There only can be selectable the "variable" option which allows to use the Mathematical expression editor but it does not seems to allow to use the user_physical_properties files as it really does.

Anyway, the density seems to be marked as "variable" in line 126 of the provided XML file.
Is that the "variable" definition for the density you are referring to?

I read in the existent forums entries it was required to indicate as "variable" the requested variable, as I have done with other user_physical property (molecular viscosity), which works, and that's why I don't understand what am I doing wrong for the user_physical property density.

May it be compulsory to indicate irovar = 1 in cs_user_parameters anyway?


Kind regards,
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_user_physical_properties.f90 trouble

Post by Yvan Fournier »

Hello Pablo,

The changes in the GUI were for simplification reasons, but can be tricky. The solution is indeed to use a MEI expression for density, so irovar should be set automatically and memory allocated.

I did not check your XML file, just traced the cause of the crash.

In any case, if you are using a 4.0 beta version, you should upgrade to 4.0.5 to avoid possibly fixed bugs.

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: cs_user_physical_properties.f90 trouble

Post by Pablo »

Hello Yvan:

I have specified manually the irovar=1 option in the "user_parameters" function, but the simulation still fails.
In the other hand,I have tried to run the same case (without specifying irovar=1 option in "user_parameters" function) in CS4.3 so that the XML shows the "variable" option in the density as you have have suggested, but unfortunately the results are, once again, the same: Error with the ranks.

This is a very annoying error as as far as I can remember this user function was pretty simple to integrate within the simulation in older CS versions (3.x) with the "user subroutine" option in the fluid physical properties menu.

May I be forgetting something in the cs_physical properties specification? (the submitted "customRHO.f90" file )

I will investigate a little more about the cs_user_parameter and cs_physical_properties anyway and I will inform you.



Thanks.
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_user_physical_properties.f90 trouble

Post by Yvan Fournier »

Hello Pablo,

I'll try to take a look this evening.

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: cs_user_physical_properties.f90 trouble

Post by Pablo »

Hello Yvan:

I have been making some test about this issue, and there are several concerns I don't really understand but it seems that everything is related with the ibeta you mentioned.
- If it is indicated in the XML density as "variable" with a MEI expression, this expression is taken independently if a density law is indicated in usphyv, so that whatever it may happens with the ibeta, it shall be solved within the user-functions.
- If it is indicated in the XML the density as variable without a MEI expression (density=-1), this means the density law should be defined in usphyv independently if irovar=1 is indicated in usipsu, and in this scenario is when the simulation fails.
- I have tried to comment the "ibeta" loop within usphyv, but then the density is taken as constant.

Any clue?

Thanks in advance. ;)
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_user_physical_properties.f90 trouble

Post by Yvan Fournier »

Hello,

The problem is that you are using ibeta / cpro_beta in addition to the density, and this is defined only when you are using a GGDH, AFM or DFM turbulence flux model.

So you should avoid using ibeta, while indicating in the GUI a "variable" density, with any value, plus your user subroutine definition.

Regards,

Yvan
Post Reply