CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Implement source term in rhoSimpleFoam

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

LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2020, 18:08
Default Implement source term in rhoSimpleFoam
New Member
Join Date: Jul 2017
Location: London, UK
Posts: 16
Rep Power: 8
Soll is on a distinguished road

Recently I'm working on adding source term to rhoSimpleFoam.
I read through the source code and did some test, but still I have some problems unsolved. Please if someone could help:

1. Is it correct to add source term, i.e., mySource (volVectorField, constant but updated at every iteration) to the three locations?
a. In UEqn.H:
solve(UEqn == -fvc::grad(p)+mySource);
b. In pEqn.H, NonOrthogonal correction
fvScalarMatrix pEqn
          - fvm::laplacian(rhorAUf, p)
          + fvc::div(mySource*rAU)

            fvOptions(psi, p,
c. In pEqn.H, corrector
U = HbyA - rAU*fvc::grad(p) + mySource;
I saw a thread
HTML Code:
related to this. Basically they are discussing adding source term to a. and c., but why not b.?

2. Why in pEqn.H phiHbyA is interpolated like this
surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(rho)*fvc::flux(HbyA));
instead of
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
like the way rhorAUf did, or they are the same.

3. Why rho*HbyA is interpolated to the cell surface in the first place? may be it is more of a algorithm question but I just cant figure it out.

Last edited by Soll; January 7, 2020 at 18:39. Reason: typo
Soll is offline   Reply With Quote

Old   January 8, 2020, 07:19
New Member
Join Date: Jul 2017
Location: London, UK
Posts: 16
Rep Power: 8
Soll is on a distinguished road
I think I know the answer to question 3 if I'm correct

post here if anyone is interested:
for any volVectorField V

fvc::div(fvc::flux(V)) equals to fvc::div(V)
with additional options to specify the interpolation schemes
Soll is offline   Reply With Quote


openfaom-7, programing, rhosimplefoam, source terms

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 35 April 29, 2022 15:35
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 03:04
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
implement a source term!! stage81 FLUENT 4 October 7, 2010 07:50

All times are GMT -4. The time now is 02:51.