CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   nonuniform body force loaded from a text file (

Farshad_Noravesh April 18, 2011 09:06

nonuniform body force loaded from a text file
I want to add a nonluniform body force F(x,y) to an equation such as momentum equation. The force function should be loaded from a text file.
So at each point (x,y) the F(x,y) has a value that should be read from the text file.

Please help me how i should define this volScalarField in createFields.

Thanks alot,

maysmech April 22, 2011 09:52

I have same question.

cheng1988sjtu March 2, 2016 16:38


I have the same issue here, did yo find the solution to this?


wyldckat March 26, 2016 06:20

Quick answer with questions: Without more details, it's very hard to help here. There is a thread here on the forum that explains what should be provided so that people are able to answer to your questions:

Because the main problem is that the applied force field may or may not be constant as time passes by, therefore this is the first problem.

The second problem is that without a test case, it's very hard to be certain that we're able to provide you with the correct answer. Because the quickest answer is to simply convert the force into a surface pressure field, defined on the boundary of the object where the force is meant to be applied.
Right now I can't remember if there is already such a boundary condition, but as I've already mentioned, we need to know if this field is constant over time or if it should change with the flow.

edit: Recent thread on this topic:

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