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

Implement source term in rhoSimpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2020, 19:08
Default Implement source term in rhoSimpleFoam
  #1
New Member
 
Zeng
Join Date: Jul 2017
Location: London, UK
Posts: 16
Rep Power: 9
Soll is on a distinguished road
Greetings!


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:
Code:
solve(UEqn == -fvc::grad(p)+mySource);
b. In pEqn.H, NonOrthogonal correction
Code:
fvScalarMatrix pEqn
        (
            fvc::div(phiHbyA)
          - fvm::laplacian(rhorAUf, p)
          + fvc::div(mySource*rAU)

          ==
            fvOptions(psi, p, rho.name())
        );
c. In pEqn.H, corrector
Code:
U = HbyA - rAU*fvc::grad(p) + mySource;
I saw a thread
HTML Code:
https://www.cfd-online.com/Forums/openfoam/65293-add-source-term-simplefoam.html
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
Code:
surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(rho)*fvc::flux(HbyA));
instead of
Code:
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 19:39. Reason: typo
Soll is offline   Reply With Quote

Old   January 8, 2020, 08:19
Default
  #2
New Member
 
Zeng
Join Date: Jul 2017
Location: London, UK
Posts: 16
Rep Power: 9
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

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

Reply

Tags
openfaom-7, programing, rhosimplefoam, source terms


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 36 July 16, 2024 04:52
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 02:22
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 04:04
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 12:32
implement a source term!! stage81 FLUENT 4 October 7, 2010 08:50


All times are GMT -4. The time now is 16:59.