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

renumberMesh_porosity_rhoReactingBuoyantFoam_editi ng_solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 17, 2020, 18:34
Question renumberMesh_porosity_rhoReactingBuoyantFoam_editi ng_solver
  #1
Member
 
nikhil108's Avatar
 
Nikhil
Join Date: May 2020
Location: Freiburg
Posts: 43
Rep Power: 5
nikhil108 is on a distinguished road
Hallo Foamers,

I want to add porous capability to rhoReactingBuoyantFoam, for that by taking rhoPorousSimpleFoam as reference, I did the respective changes in UEqn.H, pEqn.H and .C file. I tested the solver with a known case, and everything runs good. But, when I use renumberMesh and run the solver, then it throws a tmp deallocated error as follows.
Code:
Starting time loop

Courant Number mean: 0 max: 0
deltaT = 1.2e-10
Time = 1.2e-10

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for C3H8, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for h, Initial residual = 5.23194e-05, Final residual = 1.20767e-20, No Iterations 1
min/max(T) = 293, 293


--> FOAM FATAL ERROR:
tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> deallocated

    From function const T& Foam::tmp<T>::operator()() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]
    in file /opt/OpenFOAM/OpenFOAM-7/src/OpenFOAM/lnInclude/tmpI.H at line 278.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >::operator()() const in "/disk/nmittapa/FOAM_USER_APPBIN/rhoPorousBuoyantFoam"
#3  ? in "/disk/nmittapa/FOAM_USER_APPBIN/rhoPorousBuoyantFoam"
#4  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#5  ? in "/disk/nick/FOAM_USER_APPBIN/rhoPorousBuoyantFoam"
Aborted
Complete case files are attached here. It seems, I missed something when editing the solver. I have no idea, whats causing this, can someone shed some light on this please

UEqn.H
Code:
 MRF.correctBoundaryVelocity(U);

    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U) + fvm::div(phi, U)
      + MRF.DDt(rho, U)
      + turbulence->divDevRhoReff(U)
     ==
        fvOptions(rho, U)
    );

    UEqn.relax();


    tmp<volScalarField> trAU;
    tmp<volTensorField> trTU;

    if (pressureImplicitPorosity)
    {
    tmp<volTensorField> tTU = tensor(I)*UEqn.A();
    pZones.addResistance(UEqn, tTU.ref());
    trTU = inv(tTU());
    trTU.ref().rename("rAU");
    fvOptions.constrain(UEqn);
    volVectorField gradp(fvc::reconstruct
            ( (
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
            )*mesh.magSf()
            ) );
        for (int UCorr=0; UCorr<nUCorr; UCorr++)
        {
         U = trTU() & (UEqn.H() - gradp);
        }
    U.correctBoundaryConditions();
    fvOptions.correct(U);
    K = 0.5*magSqr(U);
    }
   else
{
   pZones.addResistance(UEqn);
   fvOptions.constrain(UEqn);
        if(pimple.momentumPredictor())
        {
        solve
        (
            UEqn
         ==
            fvc::reconstruct
            (
            (
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
            )*mesh.magSf()
            )
        );

        fvOptions.correct(U);
        K = 0.5*magSqr(U);
        trAU = 1.0/UEqn.A();
        trAU.ref().rename("rAU");

        }
   }
pEqn.H
Code:
rho = thermo.rho();

const volScalarField psip0(psi*p);

volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
tmp<volVectorField> tHbyA;
if (pressureImplicitPorosity)
{
        tHbyA = constrainHbyA(trTU()&UEqn.H(), U, p);
}
else
{
        tHbyA = constrainHbyA(trAU()*UEqn.H(), U, p);
}

volVectorField& HbyA = tHbyA.ref();

surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());

surfaceScalarField phiHbyA
(
    "phiHbyA",
    (
        fvc::flux(rho*HbyA)
      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
    )
  + phig
);

MRF.makeRelative(fvc::interpolate(rho), phiHbyA);

constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);

fvScalarMatrix p_rghDDtEqn
(
    fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
  + fvc::div(phiHbyA)
  ==
    fvOptions(psi, p_rgh, rho.name())
);

while (pimple.correctNonOrthogonal())
{
        tmp<fvScalarMatrix> tpEqn;

        if (pressureImplicitPorosity)
        {
                tpEqn =
                (
                p_rghDDtEqn
                - fvm::laplacian(rho*trTU(), p_rgh)
                );

        }
        else
        {
                tpEqn =
                (
                p_rghDDtEqn
                -fvm::laplacian(rho*trAU(), p_rgh)
                );

        }
fvScalarMatrix& p_rghEqn = tpEqn.ref();
p_rghEqn.solve();

        if (pimple.finalNonOrthogonalIter())
        {
        phi = phiHbyA + p_rghEqn.flux();

        p_rgh.relax();

                if (pressureImplicitPorosity)
                {

                U = HbyA + (trTU() & fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf));
                }

                else

                {

                U = HbyA + (trAU()*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf));
                }
        U.correctBoundaryConditions();
        fvOptions.correct(U);
        K = 0.5*magSqr(U);
        }

}

p = p_rgh + rho*gh;

thermo.correctRho(psi*p - psip0);

if (thermo.dpdt())
{
    dpdt = fvc::ddt(p);
}

#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
I used tmp variables, like they are used in other solvers to operate on A(), (for explicit and implicit porosity).

Please, let me know if any other details are needed.
nikhil108 is offline   Reply With Quote

Reply

Tags
c++, deallocation, programming, renumbermesh, solver compilation


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



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