CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

programming with external term and equation

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 8, 2015, 09:18
Default programming with external term and equation
  #1
New Member
 
Join Date: Sep 2014
Posts: 9
Rep Power: 3
yongxiang is on a distinguished road
Hello everyone, I am quite new to OpenFoam, especially to the programming part. Now I would like to solve the following equation:

ddt(U)+div(phi,U)-laplacian(nu,U) == -grad(p) - chi * (U-Ubar)

ddt(Ubar) == omega * (U - Ubar)

in which Ubar is another field vector. For the last red terms in both equation, they are direct multiplication of scalar and vector field. How should I discrete it? Like for other terms: fvm::div(phi,U), what is the operator for such a direct calculation?

Many thanks
Yong
yongxiang is offline   Reply With Quote

Old   October 8, 2015, 10:04
Default
  #2
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 323
Rep Power: 10
mkraposhin is on a distinguished road
first equation

Code:
fvm::ddt(U)
+
fvm::div(phi,U)
-
fvm::laplacian(nu,U) 
+
fvm::SuSp(chi, U)
-
fvc::Sp(chi, Ubar)
==
-grad(p)
second equation
Code:
fvm::ddt(Ubar) 
+
fvm::SuSp(omega,Ubar)
-
fvc::Sp(omega,U)
mkraposhin is offline   Reply With Quote

Old   October 8, 2015, 12:38
Default
  #3
New Member
 
Join Date: Sep 2014
Posts: 9
Rep Power: 3
yongxiang is on a distinguished road
Hi Matvej, thanks for the quick reply. I've tried your suggestion and find that the following term can not pass compilation.
fvm::SuSp(chi, U)

with the error:

error: no matching function for call to ‘SuSp(Foam::dimensionedScalar&, Foam::volVectorField&)’
+ fvm::SuSp(chi, U)

it seems the match problem of dimensionedScalar and volVectorField.
But if I use
fvm::Sp(chi, U)
the compilation passed.
Would you mind to explained a bit for me the difference of Sp and SuSp.
Regards
Yong

yongxiang is offline   Reply With Quote

Old   October 8, 2015, 12:44
Default
  #4
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 323
Rep Power: 10
mkraposhin is on a distinguished road
fvm::Sp - implicit source term
fvc::Sp - explicit source term

fvm::SuSp(chi,U) - dynamically switched term, for cells where chi >= 0 it is treated as implicit , where chi < 0 it is treated as explicit to preserve diagonal elements untouched

if you want to use fvm::SuSp, then variable chi must be of type volScalarField
mkraposhin is offline   Reply With Quote

Old   October 8, 2015, 13:01
Default
  #5
New Member
 
Join Date: Sep 2014
Posts: 9
Rep Power: 3
yongxiang is on a distinguished road
Hi Matvej,
this time I understand, thank you very much
regards
yong
yongxiang is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 06:27
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 2 September 3, 2014 21:24
viscosity term in discetrization momentum equation hans-186 Main CFD Forum 4 April 1, 2013 13:34
How to? Extra term in k-e equation. Implicit-Explicit be_inspired OpenFOAM Programming & Development 1 March 19, 2013 11:50
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45


All times are GMT -4. The time now is 19:09.