errors when use cs_user_initialization.f90

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
CandiceLIU
Posts: 11
Joined: Thu Mar 02, 2023 5:36 pm

errors when use cs_user_initialization.f90

Post by CandiceLIU »

Dear code_saturne developers and users

I am using code_saturne V7. When I used cs_user_initialization-compressbile.f90, I had an error as shown in the figure.
Same error occurs when I used cs_user_initialization-gas_ebu.f90 for the combustion case.

Does anyone also have the same problems when using cs_user_initialization.f90?


Best regards,
Liyuan
Attachments
Picture36.png
Li Ma
Posts: 7
Joined: Thu Nov 17, 2022 3:54 pm

Re: errors when use cs_user_initialization.f90

Post by Li Ma »

It seems there were errors of dimension when accessing the velocity array.
under fortran if you get the pointer of velocity vel, then the initialisation for the cell iel is
vel(1, iel) = u0
vel(2, iel) = v0
vel(3, iel) = w0.

Notice now the compressible module is not compatible with combustion module, the behaviour is not tested. I posted under your previous question how to consider the density variation. If your scenario is low mach where the acoustic wave is negligible, you don't need to use compressible algorithm.
CandiceLIU
Posts: 11
Joined: Thu Mar 02, 2023 5:36 pm

Re: errors when use cs_user_initialization.f90

Post by CandiceLIU »

Thanks Li for your reply.

I am setting up a case with low Ma number. I was trying to set up a state equation by using the cs_user_physical_properties.f90 and the cs_user_initialization.f90 was required. Currently, what I need is having an viable density with temperature follow the BML expression.
Li Ma
Posts: 7
Joined: Thu Nov 17, 2022 3:54 pm

Re: errors when use cs_user_initialization.f90

Post by Li Ma »

So you just need to use the idilat option to represent the variable density.
Feel free if you have any questions about the initialization

Li
CandiceLIU
Posts: 11
Joined: Thu Mar 02, 2023 5:36 pm

Re: errors when use cs_user_initialization.f90

Post by CandiceLIU »

Dear Li,


I have used the incompressible with variable density as you suggested. I have figured out the variable density issue by using the cs_user_initialization.c and cs_user_physical_properties.c Now the density output is as expected.

However, I feel confused about how the algorithm works by using incompressible solver to solve compressible flow introduced by variable temperature? Do you have any suggestion for understanding it?

Best regards,
Liyuan
Li Ma
Posts: 7
Joined: Thu Nov 17, 2022 3:54 pm

Re: errors when use cs_user_initialization.f90

Post by Li Ma »

Hello,

The variation in density is not necessarily linked to the compresibility of the fluids. As you see in your case, the density is only or almost only a function of temperature, sometimes the density is a function of mixture of two gases too, though the Mach number is actually low(even smaller than 0.1). The incompressible solver may be used with a density variation term as source term for the pressure equation.

In fact, one must consider the compressibility if the density depends significantly on the pressure, when drho/dp = 1/c^2 becomes non-negligible, that is to say the sound speed here c is no longer infinite.
Otherwise, it is what happens in your case, drho/dp equals nearly zero and drho/dT is quite significant. If a true compressible solver was used for this kind of fluids, the computation would be very slow and sometimes diverge without a preconditioner.

Li
CandiceLIU
Posts: 11
Joined: Thu Mar 02, 2023 5:36 pm

Re: errors when use cs_user_initialization.f90

Post by CandiceLIU »

Hey Li,

Thanks for your informative reply. Now I can understand. My problems are solved by implementing the BML expression.
I have attached the code as well for others who have the same confusion.

Best regards,
Liyuan
Attachments
cs_user_physical_properties.c
(3.63 KiB) Downloaded 44 times
Post Reply