|
[Sponsors] |
Adding a body force term in the SIMPLE algorithm |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 9, 2020, 11:47 |
Adding a body force term in the SIMPLE algorithm
|
#1 |
New Member
Join Date: Jan 2013
Posts: 7
Rep Power: 13 |
Hi all,
I need to add an electric body force term (let's call it Fci) in the Navier-Stokes momentum equation and I chose the simpleFoam solver because I have an incompressible and steady-state flow...so I first modified the createFields.H file in this solver by adding the new entries highlighted in red: Code:
Info<< "Reading field p\n" << endl; volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Fci\n" << endl; volVectorField Fci ( IOobject ( "Fci", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh ); #include "createPhi.H" label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, simple.dict(), pRefCell, pRefValue); mesh.setFluxRequired(p.name()); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); #include "createMRF.H" #include "createFvOptions.H" Afterwards I added the bodyforce term Fci divided by rho (also highlighted in red) in the UEqn.H file: Code:
// Momentum predictor MRF.correctBoundaryVelocity(U); tmp<fvVectorMatrix> tUEqn ( fvm::div(phi, U) + MRF.DDt(U) + turbulence->divDevReff(U) == fvOptions(U) ); fvVectorMatrix& UEqn = tUEqn.ref(); UEqn.relax(); fvOptions.constrain(UEqn); if (simple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)+Fci/rho); fvOptions.correct(U); } Code:
tmp<fvVectorMatrix> tUEqn ( fvm::div(phi, U) + MRF.DDt(U) + turbulence->divDevReff(U) == fvOptions(U) + Fci/rho ); Guess underrelaxation and the command fvOptions.constrain(UEqn) have the effect that I get different results... Many thanks in advance and stay healthy in these difficult times!
__________________
Kind Regards Karman |
|
April 10, 2020, 14:34 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
I would create a new fvOptions instead of modifying simpleFoam.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
June 20, 2022, 09:11 |
|
#3 |
Member
Mahmoud
Join Date: Nov 2020
Location: United Kingdom
Posts: 43
Rep Power: 6 |
Hi, I am simulating an open channel flow with simpleFoam. I used fvOptions to add gravity as a momentum source. What I'd like to know is how to set the outlet BC? I can set it as zero fixedValue as we have hydrostatic Pressure there. Do you have any idea how to set HP pressure at the outlet? Cheers |
|
Tags |
body force, momentum equation, openfoam, simple algorithm, source term |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SIMPLE algorithm in collocated non orthogonal body fitted grid | Waliur Rahman | Main CFD Forum | 5 | April 6, 2022 09:33 |
EHD + body force + vectorCodedSource | Pavithra | OpenFOAM Running, Solving & CFD | 2 | May 17, 2021 07:32 |
no current magnetic magnet force term in N-S body force in COMSOL | 7363 | Electromagnetics | 3 | December 22, 2019 18:19 |
body force term | Goutam | OpenFOAM Programming & Development | 0 | February 1, 2012 10:13 |
Problems with SUPG body force term | FEM question | Main CFD Forum | 0 | January 21, 2006 18:51 |