CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to add a source term (body force) to icoFoam? (https://www.cfd-online.com/Forums/openfoam-programming-development/82787-how-add-source-term-body-force-icofoam.html)

chris Liu December 6, 2010 01:46

How to add a source term (body force) to icoFoam?
 
1 Attachment(s)
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.

nakul December 6, 2010 09:18

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.

chris Liu December 7, 2010 02:57

How to add a source term (body force) to icoFoam?
 
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

Janez Turk February 17, 2012 07:51

Did It work
 
Did it work?

how did you get incompressibility with body force?

LP Janez

gironidegirona October 27, 2014 15:38

I'm trying to the same thing!
 
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!


All times are GMT -4. The time now is 13:31.