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

How to add a source term (body force) to icoFoam?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By chris Liu
  • 1 Post By nakul
  • 1 Post By gironidegirona

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2010, 02:46
Default How to add a source term (body force) to icoFoam?
  #1
New Member
 
刘会星
Join Date: Nov 2010
Posts: 4
Rep Power: 16
chris Liu is on a distinguished road
Hi, foamers:

I am a new OpenFOAM user, and i want to add a source term (body force) to icoFoam.

I creat a new field named "F" and add F to the N-S equation. After complie, i test it in the lid-driven-cavity example, and use the force on the lid to drive the fluid instead of the lid velocity. However, the fluid stay still and the force fill the cavity.(I want the force on the lid only and the fluid is driven.)

Any suggestions will be appreciated!
Best regards!
chris Liu

createFields.H
// add source term;
Info<< "Reading field F\n" << endl;
volVectorField F
(
IOobject
(
"F",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

icoFoam-force.C
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)

);

solve(UEqn == F -fvc::grad(p)); //add source term;


Detailed source file in the attachment.
Attached Files
File Type: gz icoFoam-force.tar.gz (19.2 KB, 128 views)
Prosper and rasool_soofi like this.
chris Liu is offline   Reply With Quote

Old   December 6, 2010, 10:18
Default
  #2
Senior Member
 
Nakul
Join Date: Apr 2010
Location: India
Posts: 147
Rep Power: 16
nakul is on a distinguished road
Hi

If you need the force to be applied only on the lid then you have to define it as a boundary condition.

What you have done is that you have defined F as a volume field, i.e., on your mesh domain.

If you want to involve body force effects try buoyant solvers or define a new BC specific to your case.
Yage likes this.
nakul is offline   Reply With Quote

Old   December 7, 2010, 03:57
Default How to add a source term (body force) to icoFoam?
  #3
New Member
 
刘会星
Join Date: Nov 2010
Posts: 4
Rep Power: 16
chris Liu is on a distinguished road
Hi, nakul

Thank you for your advice!

I find that my expression was inconsistent.
The body force is a non-uniform field and depend on two factors, the distance to the patch and the orientation of the cell surface on the patch (e.g. lid). The body force (Lorentz force) is used to control the flow.

I will try the buoyant solves and post it here if i work it out.

Best regards
chris Liu
chris Liu is offline   Reply With Quote

Old   February 17, 2012, 08:51
Default Did It work
  #4
New Member
 
Janez Turk
Join Date: Jul 2010
Posts: 6
Rep Power: 16
Janez Turk is on a distinguished road
Did it work?

how did you get incompressibility with body force?

LP Janez
Janez Turk is offline   Reply With Quote

Old   October 27, 2014, 16:38
Default I'm trying to the same thing!
  #5
New Member
 
---
Join Date: Jan 2013
Posts: 17
Rep Power: 13
gironidegirona is on a distinguished road
Hi chris Liu,

I'm trying to do the same thing, I want to add a source term into the transport equation. It is like a dragging force in the middle of the region.

I don't know how to implement that,

Can you give us a clue how you did it?

Thanks!
Prosper likes this.
gironidegirona is offline   Reply With Quote

Reply


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
Add a source term to simpleFoam markc OpenFOAM 9 September 10, 2009 11:55
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
Problems with SUPG body force term FEM question Main CFD Forum 0 January 21, 2006 18:51


All times are GMT -4. The time now is 17:22.