CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to add source term and material derivative of log(T) in openFaom.

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By alexeym

LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2021, 08:13
Default How to add source term and material derivative of log(T) in openFaom.
idrees khan
Join Date: Jun 2019
Posts: 36
Rep Power: 6
idrees khan is on a distinguished road
Hi Dear's

I'm adding non-isothermal Oldroyd-B model to viscoelasticFluidFaom solver the stress equation(using Oldroyd-B model) for isothermal case is like so,
// Stress transport equation
    fvSymmTensorMatrix tauEqn
      + fvm::div(phi(), tau_)
      + twoSymm(C)
      - fvm::Sp(1/lambda, tau_)

But for non-isothermal case in the stress equation
//-  WLF to update viscosities for temperature dependence
    volScalarField lambda = Foam::exp( -C11_*(T - To_) / (C21_ + T - To_) )*lambda_;
    volScalarField etaP   = Foam::exp( -C11_*(T - To_) / (C21_ + T - To_) )*etaP_;
there is a term (
where Lambda is relaxation time which also depends upon temperature i.e as define above ) means multiplication of relaxation time lambda(T) tau_ and material derivative of log(T) please have a look of screenshot)

my question is how to define it in openFoam term
rest of the equation is same as given above.

if i define it like
volScalarField  logT = log(T);
// material derivative term of log(T) in multiplication with tau_
       fvc::ddt(tau_/lambda,logT) +fvc::div(phi()*tau_,logT/lambda)
which is wrong beacause this:
phi is a surface field that are multiplying a volumetric field,I'm getting erorr's while compiling

if define like so
volScalarField  logT = log(T);
// material derivative term of log(T) in multiplication with tau_
tau_*fvc::ddt(1/lambda,logT) + tau_*fvc::div(phi(),logT/lambda)
But I'm not sure although it compile successfully by running "wmake libso"
but give me and error when I'm running the solver saying
argument of transcendental function is not dimensionless
which is i think because of the declaration of
volScalarField  logT = log(T);
but if I'm not declaring it like so it doesn't compile with "wmake libso"

what i'm thinking just like we define material derivative in momentum eqaution i.e DU/Dt which is wrtten in openFaom

fvm::ddt(U) +fvm::phi ,U)
here U is a variable to whom we are taking the derivative.
so I'm applying the same track for
also i want to add the source term to momentum eqaution,
source term
F=g*Cb(T - To)
where F is is the body force due to thermal convection with g gravitational accelaration and Cb thermal expansion
i write
fvm::Sp(g*Cb, T)   - g*Cb*To   or fvc::Sp(g*Cb, T)   - g*Cb*To and simply  (g*Cb(T - To))
but getting error's (Have a look screenshot please)

Attached Images
File Type: png Screenshot of consitutive eqaution.png (41.1 KB, 9 views)
File Type: jpg Erro from adding source term.jpg (167.2 KB, 8 views)
idrees khan is offline   Reply With Quote

Old   January 27, 2021, 14:32
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym

1. There is fvc::DDt(phi, Field). Here is a link to Foundation's documentation (fvc::DDt), guess, foam-extend has something similar.
2. To use T in log, T should be dimensionless. Either divide the field by 1K, or do something more appropriate.
3. Error screenshot is irrelevant. Post simple text of the whole error. But it seems, you have tried to add different types of fields (ex. vector and tensor).
idrees khan likes this.
alexeym is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Add the material derivative of log(T) in the constitutive equation's. idrees khan OpenFOAM Programming & Development 5 January 21, 2021 07:57
curvature correction term, material derivative of a tensor volker OpenFOAM Programming & Development 7 June 3, 2010 08:08
UDF Scalar Code: HT 1 Greg Perkins FLUENT 8 October 20, 2000 12:40
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 03:43

All times are GMT -4. The time now is 08:10.