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

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

January 26, 2021, 08:13
How to add source term and material derivative of log(T) in openFaom.
#1
Member

idrees khan
Join Date: Jun 2019
Posts: 36
Rep Power: 6
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,
Code:
```// Stress transport equation
fvSymmTensorMatrix tauEqn
(
fvm::ddt(tau_)
+ fvm::div(phi(), tau_)
==

etaP/lambda*twoD
+ twoSymm(C)
- fvm::Sp(1/lambda, tau_)
);```
tauEqn.relax();
tauEqn.solve();
}

But for non-isothermal case in the stress equation
Code:
```//-  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 (
Code:
`lambda*tua_*D(log(T))/Dt`
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
Code:
`  lambda*tua_*D(log(T)/Dt`
rest of the equation is same as given above.

if i define it like
Code:
`volScalarField  logT = log(T);`
Code:
```// 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:
Code:
` fvc::div(phi()*tau_,logT),`
phi is a surface field that are multiplying a volumetric field,I'm getting erorr's while compiling

if define like so
Code:
`volScalarField  logT = log(T);`
// material derivative term of log(T) in multiplication with tau_
Code:
`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
Code:
`argument of transcendental function is not dimensionless`
which is i think because of the declaration of
Code:
`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

Code:
`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
Code:
`  lambda*tua_*D(log(T)/Dt`
also i want to add the source term to momentum eqaution,
source term
Code:
`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
Code:
`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)

regards
idrees
Attached Images
 Screenshot of consitutive eqaution.png (41.1 KB, 9 views) Erro from adding source term.jpg (167.2 KB, 8 views)

 January 27, 2021, 14:32 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,938 Rep Power: 38 Hi, 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.