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

Modeling Source Term in Continuity Equation (icoFoam solver)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2020, 18:39
Default Modeling Source Term in Continuity Equation (icoFoam solver)
  #1
New Member
 
Bruno
Join Date: Jul 2018
Posts: 6
Rep Power: 8
Onurb is on a distinguished road
Hello,

I am modifying the icoFoam solver in the following way:

Code:
fvScalarMatrix CEqn 
(
    fvm::ddt(C) + fvm::div(phi,C) - fvm::laplacian (D,C) == fvm::Sp(-CTE_1,C)
);
CEqn.solve();

fvVectorMatrix UEqn
(
    fvm::ddt(U) + fvm::div(phi,U) - fvm::laplacian(nu,U) == fvm::Sp(-CTE_2,U) 
);

if (piso.momentumPredictor())
{
    solve(UEqn == -fvc::grad(p));
}

while (piso.correct())
{
    volScalarField rAU(1.0/UEqn.A());

    volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));

    surfaceScalarField phiHbyA
    (
        "phiHbyA", fvc::flux(HbyA) + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
    );

    adjustPhi(phiHbyA, U, p);

    constrainPressure(p, U, phiHbyA, rAU);

    while (piso.correctNonOrthogonal())
    {
        fvScalarMatrix pEqn
        (
            fvm::laplacian(rAU, p) == fvc::div(phiHbyA) - CTE_3*C
        );

        pEqn.setReference(pRefCell, pRefValue);

        pEqn.solve();

        if (piso.finalNonOrthogonalIter())
        {
            phi = phiHbyA + pEqn.flux();
        }
    }
    #include "continuityErrs.H"            

    U = HbyA - rAU*fvc::grad(p);
    U.correctBoundaryConditions();
}
The solver converges until the source term in the continuity equation became nonzero. If I set CTE_3*C = 0, everything works fine. Could someone verify if is there any mistake in the implementation?
Onurb is offline   Reply With Quote

Reply

Tags
icofoam, source term


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
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 3 September 7, 2022 04:09
[swak4Foam] Installation Problem with OF 6 version Aurel OpenFOAM Community Contributions 14 November 18, 2020 17:18
[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
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 13:41


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