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

Adding source terms to rhoCentralFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2014, 04:06
Default Adding source terms to rhoCentralFoam
  #1
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
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:
Code:
solve(fvm::ddt(rhoU) + fvc::div(phiUp));

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

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

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

        solve
        (
            fvm::ddt(rhoE)
          + fvc::div(phiEp)
          - fvc::div(sigmaDotU)
        );

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

        if (!inviscid)
        {
            solve
            (
                fvm::ddt(rho, e) - fvc::ddt(rho, e)
              - fvm::laplacian(turbulence->alphaEff(), e)
            );
            thermo.correct();
            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:
http://www.cimec.org.ar/ojs/index.ph...File/4231/4157

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

Old   July 1, 2023, 14:08
Default
  #2
Senior Member
 
qutadah
Join Date: Jun 2021
Location: USA
Posts: 101
Rep Power: 5
qutadah.r is on a distinguished road
I think this solver uses flux terms to calculate the field using some kind of flux splitting scheme, and therefore it needs the equations in the conservative form, which have d(rho*U)/dt = RHS and d(rho*E)/dt = RHS for both momentum and energy equations, therefore you find the rho*U and rho*E recalculated again using the appropriate boundary conditions.
qutadah.r is offline   Reply With Quote

Reply


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
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 37 August 17, 2022 15:22
[Other] OpenFOAM Installation for navalFoam sachinlb OpenFOAM Community Contributions 22 July 28, 2017 06:26
HELP! adding a mass source to VOF eqn. by UDF??? ROOZBEH FLUENT 5 December 3, 2016 18:53
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 11:57
Source Terms in momentum Balance vidyaraja FLUENT 0 May 25, 2009 14:16


All times are GMT -4. The time now is 15:58.