CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Temporary deallocated error (http://www.cfd-online.com/Forums/openfoam-solving/57822-temporary-deallocated-error.html)

waynezw0618 March 10, 2009 11:35

hi everyone: i modify the tur
 
hi everyone:
i modify the turboFoam to add coriolis force and centrifugal force according to MRFsimpleFoam. and when i run the code it gives errors like:

temporary deallocated

From function T& tmp<t>::operator()()
in file /home/waynezw0618/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/tmpI.H at line 164.

FOAM aborting

what is the problem? how can i resolve it?
--------------------code-------------------------
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RASModel/RASModel.H"
#include "MRFZones.H"
#include "IFstream.H"
#include "OFstream.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{

# include "setRootCase.H"

# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
//# include "createAverages.H"
# include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

for (runTime++; !runTime.end(); runTime++)
{
Info<< "Time = " << runTime.timeName() << nl << endl;

# include "readPISOControls.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"

// Pressure-velocity PISO corrector
{
// Momentum predictor

tmp<fvvectormatrix> UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
);
mrfZones.addCoriolis(UEqn());
UEqn().relax();

solve(UEqn == -fvc::grad(p));

// --- PISO loop

for (int corr=0; corr<nCorr; corr++)
{
volScalarField rAU = 1.0/UEqn().A();
U = rAU*UEqn().H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, U, phi);
mrfZones.relativeFlux(phi);
adjustPhi(phi, U, p);

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
// Pressure corrector

fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}

# include "continuityErrs.H"

U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
}

turbulence->correct();

//# include "calculateAverages.H"

runTime.write();

//# include "writeNaveragingSteps.H"

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return(0);
}


// ************************************************** *********************** //

wayne

rob3rt July 31, 2010 04:05

Dear Wayne,

I am having a similar "temporary deallocated" problem like you had but only I'm using different solver.

How did you resolve that problem?

Kind Regards,
Robert.

dima June 6, 2011 04:58

hallo foamers, i am new to openfoam
got advanced knowlage in C, basic knowlage in C++ and basic knowlage in fluiddynamics

current i am modifying the rhoPisoaFoam (transient) solver, by implementing a porousZone like in rhoPorousSimpleFoam (steadystate)

source code is modified, mesh is modified(porouseZone in pitzDaily), porousZones file is included

partially it works, but with the following setting an error occurs
nUCorrectors 2; => sets pressureImplicitPorosity = true;

i located the error to the "+ fvc::ddtPhiCorr(trAU, rho, U, phi)" part of

phi =
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(trAU, rho, U, phi)
);

what is wrong, how could i resolve this error?

i thought about to do something like

if (pressureImplicitPorosity)
{
phi =
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
);
}
else
{
phi =
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(trAU, rho, U, phi)
);
}

but is it correct in refer to the phi equation? its just a (transient) Corrector term, isn't it?


error message:

Create time

Create mesh for time = 0

Reading thermophysical properties

Selecting thermodynamics package hPsiThermo<pureMixture<constTransport<specieThermo <hConstThermo<perfectGas>>>>>
Reading field rho


Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type RASModel
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
C3 -0.33;
sigmak 1;
sigmaEps 1.3;
Prt 1;
}

Creating field DpDt

Creating porous zone: porosity
Courant Number mean: 0 max: 0.126355

Starting time loop

Courant Number mean: 0 max: 0.126355
Time = 1e-05

diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for h, Initial residual = 0.55759, Final residual = 7.51342e-05, No Iterations 1


--> FOAM FATAL ERROR:
temporary deallocated

From function const T& tmp<T>::operator()() const
in file /home/dima/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/tmpI.H at line 187.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) in "/home/dima/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/dima/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >::operator()() const in "/home/dima/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linux64GccDPOpt/rhoPorousPisoFoam"
#3
in "/home/dima/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linux64GccDPOpt/rhoPorousPisoFoam"
#4 __libc_start_main in "/lib64/libc.so.6"
#5
at /usr/src/packages/BUILD/glibc-2.11.2/csu/../sysdeps/x86_64/elf/start.S:116
*/################################################## ###############################################/*

i'm sorry for my not very good english :o , hope you could understand what i mean
i would be thankful for any kind of reply

with kind regards
Dima

rob3rt 0ng June 16, 2011 12:46

Hi Dima,

I think you should decrease both nOuterCorrectors and nCorrectors in system/fvSolution to 1.

Regards,
Robert

dima June 17, 2011 05:09

Hi Robert,
thank you for reply

i try the settings you suggested, but same error occurs

meanwhile i was advised of the rhoPorousMRFPimpleFoam (transient)
and there the above processes term is
set off in OF-1.7.1

Code:

    phi =
        fvc::interpolate(rho)*
        (
            (fvc::interpolate(U) & mesh.Sf())
        //+ fvc::ddtPhiCorr(rUA, rho, U, phi)
        );

and set on in OF-2.0.0

Code:

    phi =
        fvc::interpolate(rho)*
        (
            (fvc::interpolate(U) & mesh.Sf())
          + fvc::ddtPhiCorr(rAU, rho, U, phi)
        );

so i will take a look to the new version

regards, Dima

TDidi January 12, 2012 12:06

I had the same problem with the error message: "temporary deallocated" after creating a new turbulent solver.

The problem was missing parenthesis after UEqn for the fvVectorMatrix. So I changed "UEqn" to "UEqn()". Hope it challenges your problem, too.

Friederike April 29, 2014 09:24

Thank you so much, Taieb! You saved me a lot of searching and trouble :D

adkar May 13, 2016 03:40

Quote:

Originally Posted by TDidi (Post 339064)
I had the same problem with the error message: "temporary deallocated" after creating a new turbulent solver.

The problem was missing parenthesis after UEqn for the fvVectorMatrix. So I changed "UEqn" to "UEqn()". Hope it challenges your problem, too.

Thank you so much for your comment!!!
You saved my day!! I really appreciate your comment:):):)
Thank you once again.


All times are GMT -4. The time now is 06:33.