specify spatial density distribution?

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
senartcon
Posts: 37
Joined: Wed May 08, 2013 6:46 pm

specify spatial density distribution?

Post by senartcon »

Hello All,
I am new to Code_Saturne. I found that density, defined using user law, can be varied only with TempC. Is it possible to specify/impose a spatial density distribution?

My aim is to simulate a gas-liquid plume in a cylindrical vessel for which I have the distribution of mixture density. As a note, the density distribution is time invariant and also the simulation.

Thanks
Anand

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

Re: specify spatial density distribution?

Post by Yvan Fournier »

Hello,

If you define additional scalar fields (species under the GUI), you can also use those in the MEI expression used to define density.

If this is not enough, you may have finer control using the usphyv user subroutine in cs_user_physical_properties.f90 user subroutine (to be copied from a case's SRC/REFERENCE to SRC subdirectory, then adapted for your use).

Code_Saturne's numerical scheme not as well adapted to gas-liquid flows as that of the NEPTUNE_CFD code is dedicated to those types of flows and is based in part on Code_Saturne, with additional gradient reconstruction options, but a quite different time scheme. As it is not purely an EDF code, its distribution is more restricted (we could not decide alone to open-source it like Code_Saturne); its spatial discretization is basically the of Code_Saturne

As your case is time invariant, things should still be OK here.

Regards,

Yvan
senartcon
Posts: 37
Joined: Wed May 08, 2013 6:46 pm

Re: specify spatial density distribution?

Post by senartcon »

Hello Yvan,
Thanks for your reply. I have two doubts:
If I define a scalar, wont it be transported by the flow field? I want a time invariant density distribution to be imposed.
To specify the density distribution using user subroutine, how to access spatial variables ? using x or y in the formula gives compilation error.
Thanks
Anand
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: specify spatial density distribution?

Post by Yvan Fournier »

Hello,

Yes, a scalar would be convected and diffused.

In user subroutines, you need to access existing code variables (or define new ones). Search for xyzcen in the user documentation pdf, but I also recommend taking at least a brief look at other provided user subroutine examples.

Regards,

Yvan
senartcon
Posts: 37
Joined: Wed May 08, 2013 6:46 pm

Re: specify spatial density distribution?

Post by senartcon »

Now I have a problem that Code_Saturne ignores user law specification through usphyv (though it is compiled), but takes only the value at GUI.

The code in usphyv is:

Code: Select all

iutile = 1
if(iutile.eq.1) then

 ipcrom = ipproc(irom)
  do iel = 1, ncel
    propce(iel,ipcrom) = 140.00   ! arbitrary value for now
  enddo

endif ! --- Test on 'iutile'
Am i missing something?

My code version is 2.1.0 installed by apt-get install in Ubuntu 12.04
I am also attaching various files, if they would help fixing this issue.

Thank you!!
Anand[/color]
Attachments
usphyv.f90
(10.41 KiB) Downloaded 176 times
preprocessor.log
(5.31 KiB) Downloaded 170 times
compile.log
(3.26 KiB) Downloaded 175 times
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: specify spatial density distribution?

Post by Yvan Fournier »

Hello,

In any case, upgrading to version 3.0 is recommended (though it is only packaged in Debian experimental, not even Sid yet, so you would need to compile it).

Could you add a print statement such as

print *, 'I am here'

in usphyv, to check if it is used. Normally, it is, but we have seen some cases with packaged versions where the user version is not "prioritary" relative to the reference version (which is a bug, but a packaging bug, not a bug you would have with a compiled Code_Saturne version).

Otherwise, if you indicated under the GUI you would use a user subroutine, and it compiled correctly (which is the case, according to your compile.log), I do not know why usphyv should be ignored.

Again, versions 2.1 and 2.2 are not supported anymore, and 2.3 has no advantage over 3.0 (which, as 2.0, is a "long-term support" version, with full validation, so I would strongly suggest you to upgrade to version 3.0, especially if you are only starting with Code_Saturne and do not have any "legacy" case setup.

Regards,

Yvan
senartcon
Posts: 37
Joined: Wed May 08, 2013 6:46 pm

Re: specify spatial density distribution?

Post by senartcon »

Thanks for your reply Yvan and OK I will install version 3.0.
BTW, i couldnt get the print statement work.

Thanks
Anand
Post Reply