variable definition and it's gradient

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
vshinde
Posts: 31
Joined: Fri Jan 04, 2013 9:36 am

variable definition and it's gradient

Post by vshinde »

Dear CS team,

I am simulating a turbulent flow using k-epsilon model. I wanted to define an extra variable (ev) which I derive from k and epsilon. Later, I must compute gradient of this (ev) variable in order to add it as a source term in k and epsilon equation.
I was wondering how shall I define this variable so that I can use grdcel subroutine? As this subroutine need coefficients (coefa, coefb etc.).
Any suggestions please, if that sounds out of scope :?
Thanks in advance for your time.

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

Re: variable definition and it's gradient

Post by Yvan Fournier »

Hello,

Simply define a user scalar : it will have boundary coefficients, coefa/coefb, et you may define gradients on it; actually, you may compute gradients on any cell-based 1d or 3d array, but "real" variables such as scalars have their own (and not temporary) coefa/coefb values.

Regards,

Yvan
vshinde
Posts: 31
Joined: Fri Jan 04, 2013 9:36 am

Re: variable definition and it's gradient

Post by vshinde »

Dear Yvan,

Thanks for the concern.
How is it possible to add a physical porperty synonymous to lets say turbulent viscosity? I tried to define it using user scalar, but it seems code saturne consider it for species transport equation (with some diffusivity coefficient). How can I have it in propce array so that I can keep the time average as well?

Thanks a lot.

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

Re: variable definition and it's gradient

Post by Yvan Fournier »

Hello,

For a simple property, defining a field is simplest (in cs_user_parameters.f90, preferably in cs_user_field_parameters or in usipsu). You can check in src/base/fldini.f90 to see how standard fields are defined (for versions 3.0 to 3.2; in trunk an future 3.3, varaibles are defined earlier, in fldvar.f90).

For gradients, you will then need to build local "coeffa/b" values. Just grep the code for "grdcel to find examples of this (doing this on 3.2 will be even better, as fields which have their own coeffa/coefb use anther routine).

Regards,

Yvan
Post Reply