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

Adding source terms to rhoCentralFoam

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

LinkBack Thread Tools Display Modes
Old   July 18, 2014, 03:06
Default Adding source terms to rhoCentralFoam
Senior Member
Join Date: Oct 2013
Posts: 321
Rep Power: 6
chriss85 is on a distinguished road
I would like to add some source terms to the density, impulse and energy equations in rhoCentralFoam. Unfortunately I don't have a complete understanding of the algorithm yet, so it's somewhat difficult for me.

Why are two equations solved for impulse and energy respectively (viscid case), i.e. for rhoU and for U? Same goes for rhoE and e...

for U:
solve(fvm::ddt(rhoU) + fvc::div(phiUp));

        U.dimensionedInternalField() =
        rhoU.boundaryField() = rho.boundaryField()*U.boundaryField();

        volScalarField rhoBydt(rho/runTime.deltaT());

        if (!inviscid)
                fvm::ddt(rho, U) - fvc::ddt(rho, U)
              - fvm::laplacian(muEff, U)
              - fvc::div(tauMC)
            rhoU = rho*U;
and for e:
// --- Solve energy
        surfaceScalarField sigmaDotU
              + (mesh.Sf() & fvc::interpolate(tauMC))
            & (a_pos*U_pos + a_neg*U_neg)

          + fvc::div(phiEp)
          - fvc::div(sigmaDotU)

        e = rhoE/rho - 0.5*magSqr(U);
        rhoE.boundaryField() =
                e.boundaryField() + 0.5*magSqr(U.boundaryField())

        if (!inviscid)
                fvm::ddt(rho, e) - fvc::ddt(rho, e)
              - fvm::laplacian(turbulence->alphaEff(), e)
            rhoE = rho*(e + 0.5*magSqr(U));
To which of these equations can I add my source terms?
I would think to the latter ones, as the turbulence is added there, however, some terms also appear in the first equations.
Do I need to discretize them using a central(upwind) scheme somehow?

By the way, for anyone interested, I think this might be a good read about the pressure and density-based solvers in OF:

Last edited by chriss85; July 18, 2014 at 06:04.
chriss85 is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM Installation for navalFoam sachinlb OpenFOAM Installation 21 June 23, 2014 08:07
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 35 March 1, 2012 21:41
Source Terms in momentum Balance vidyaraja FLUENT 0 May 25, 2009 13:16
HELP! adding a mass source to VOF eqn. by UDF??? ROOZBEH FLUENT 4 May 29, 2003 09:54

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