CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Implementing Radiation Model into buoyantBoussinesqPisoFoam compiling error (https://www.cfd-online.com/Forums/openfoam-programming-development/71123-implementing-radiation-model-into-buoyantboussinesqpisofoam-compiling-error.html)

Fabian December 16, 2009 07:55

Implementing Radiation Model into buoyantBoussinesqPisoFoam compiling error
 
Hi All,


I am trying to implement a radiation model into the existing buoyantBoussinesqPisoFoam solver. I have just recently started to work with OpenFOAM and this is the first time for me to try to build my own solver; hence please excuse some beginner mistakes...

I copied the directory "OpenFOAM/OpenFOAM-1.6/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam" to "OpenFOAM/fhampp-1.6/applications/solvers/" and renamed the directory and accordingly the .C file to "buoyantBoussinesqPisoRadiationFoam". Then I changed the files "Make/files" and "Make/options" as follows.

Make/files
buoyantBoussinesqPisoRadiationFoam.C
EXE = $FOAM_USER_SOLVERS/buoyantBoussinesqPisoRadiationFoam

Make/options
EXE_INC = \
-I$FOAM_SOLVERS/heatTransfer/buoyantBoussinesqSimpleFoam \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel
EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lradiation \
-lfiniteVolume \
-lmeshTools \
-lincompressibleRASModels \
-lincompressibleTransportModels


I also copied the readTransportProperties.H file from the directory "OpenFOAM/OpenFOAM-1.6/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam" into my directory

readTransportProperties.H
singlePhaseTransportModel laminarTransport(U, phi);
// Thermal expansion coefficient [1/K]
dimensionedScalar beta(laminarTransport.lookup("beta"));
// Reference temperature [K]
dimensionedScalar TRef(laminarTransport.lookup("TRef"));
// Laminar Prandtl number
dimensionedScalar Pr(laminarTransport.lookup("Pr"));
// Turbulent Prandtl number
dimensionedScalar Prt(laminarTransport.lookup("Prt"));


Then I modified my .C file corresponding to the buoyantSimpleRadiationFoam.C as follows (red text is added)

buoyantBoussinesqPisoRadiationFoam.C
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "basicPsiThermo.H"
#include "fixedGradientFvPatchFields.H"
#include "radiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "createRadiationModel.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
p.storePrevIter();
rho.storePrevIter();
#include "UEqn.H"
#include "hEqn.H"
#include "TEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pEqn.H"
}
turbulence->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}


I also copied hEqn.H from the solver "buoyantPisoFoam" and modified it according to "buoyantSimpleRadiationFoam" as follows.

hEqn.H
{
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
+ radiation->Sh(thermo)
);
hEqn.relax();
hEqn.solve();
thermo.correct();
}


This is the compiling error:

Making dependency list for source file buoyantBoussinesqPisoRadiationFoam.C
SOURCE=buoyantBoussinesqPisoRadiationFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -IOAM_SOLVERS/heatTransfer/buoyantBoussinesqSimpleFoam -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/cfdTools -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/basic/lnInclude -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/radiation/lnInclude -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/turbulenceModels -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/turbulenceModels/incompressible/RAS/lnInclude -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/transportModels -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/transportModels/incompressible/singlePhaseTransportModel -IlnInclude -I. -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/buoyantBoussinesqPisoRadiationFoam.o
In file included from buoyantBoussinesqPisoRadiationFoam.C:65:
/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/radiation/lnInclude/createRadiationModel.H: In function ‘int main(int, char**)’:
/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/radiation/lnInclude/createRadiationModel.H:3: error: ‘thermo’ was not declared in this scope
buoyantBoussinesqPisoRadiationFoam.C:85: error: ‘rho’ was not declared in this scope
In file included from buoyantBoussinesqPisoRadiationFoam.C:88:
hEqn.H:4: error: ‘h’ was not declared in this scope
hEqn.H:6: error: ‘class Foam::incompressible::RASModel’ has no member named ‘alphaEff’
hEqn.H:8: error: ‘DpDt’ was not declared in this scope
/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’
/home/fhampp/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’
make: *** [Make/linux64GccDPOpt/buoyantBoussinesqPisoRadiationFoam.o] Error 1


Here my questions:
1st: do I have to solve the enthalpy or only if I have compressible flow?
2nd: as far as I understand the first error, I have to declare "thermo" before I use "createRadiationModel.H" but I have no idea where.
3rd: I guess similar problem with hEqn.H
4th: Is it even possible to combine those two models in a relatively easy way or do I have to start from scratch writing a new solver?
5th: Can you recommend any good programming tutorials for OpenFOAM?


I appreciate any help and if you need any further details, please let me know.
Thanks a lot in advance,
best regards, Fabian

dhuckaby December 16, 2009 08:53

Fabian,

2) "thermo" is generally declared in "createFields.H", see buoyantPisoFoam.

4) I don't think you need to start from scratch. To build a transient solver with bouyancy, I think you could add radiation to buoyantPisoFoam or transient terms to bouyantRadiationSimpleFoam. This would avoid the errors from the hEqn.H

5) The previous workshop (Basic & Advanced training) has some good tutorial material: http://www.openfoamworkshop.org/2009/4th_Workshop/

Hope this helps.

Dave

Fabian December 17, 2009 12:42

Thanks Dave,

your hints helped a lot. I follow your recommendation and made bouyantRadiationSimpleFoam transient. Unfortunately I run into a different error as follows. I can simulate a few time steps but three things are concerning myself.

1) why do i calculate rho in the beginning and with the pressure, is this correct?
2) The solver does not need any iteration for the calculation of rho. Is this correct or could it be possible that I made the solver anywhere incompressible?
and 3) what does this error mean?

Thanks a lot in advance,

Best regards

Fabian

!!! Error Message:

Courant Number mean: 0.0148611 max: 0.138988
Time = 0.28

diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Ux, Initial residual = 0.224731, Final residual = 1.45725e-09, No Iterations 2
DILUPBiCG: Solving for Uy, Initial residual = 0.899876, Final residual = 1.18918e-09, No Iterations 2
DILUPBiCG: Solving for h, Initial residual = 0.177634, Final residual = 6.19952e-09, No Iterations 2
DICPCG: Solving for p, Initial residual = 0.48412, Final residual = 0.0440553, No Iterations 8
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0.00124261, global = 2.08827e-05, cumulative = -3.15106e-05
DICPCG: Solving for p, Initial residual = 0.0285576, Final residual = 8.32981e-07, No Iterations 36
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 4.33048e-08, global = 2.76174e-09, cumulative = -3.15079e-05
DILUPBiCG: Solving for epsilon, Initial residual = 0.161125, Final residual = 1.08227e-06, No Iterations 1
DILUPBiCG: Solving for k, Initial residual = 0.552436, Final residual = 1.88081e-11, No Iterations 2
ExecutionTime = 7.11 s ClockTime = 7 s

Courant Number mean: 0.0468625 max: 0.219
Time = 0.3

diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Ux, Initial residual = 0.466304, Final residual = 5.59278e-11, No Iterations 2
DILUPBiCG: Solving for Uy, Initial residual = 0.744887, Final residual = 4.29536e-09, No Iterations 2
DILUPBiCG: Solving for h, Initial residual = 0.245595, Final residual = 7.89469e-07, No Iterations 3
#0 Foam::error::printStack(Foam::Ostream&) in "/home/fhampp/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/fhampp/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib/libc.so.6"
#3 Foam::hRhoThermo<Foam::pureMixture<Foam::sutherlan dTransport<Foam::specieThermo<Foam::hConstThermo<F oam::perfectGas> > > > >::calculate() in "/home/fhampp/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libbasicThermophysicalModels.so"
#4 Foam::hRhoThermo<Foam::pureMixture<Foam::sutherlan dTransport<Foam::specieThermo<Foam::hConstThermo<F oam::perfectGas> > > > >::correct() in "/home/fhampp/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libbasicThermophysicalModels.so"
#5 Uninterpreted: ./buoyantPisoRadiationFoam
#6 __libc_start_main in "/lib/libc.so.6"
#7 Uninterpreted: ./buoyantPisoRadiationFoam
Floating point exception


dhuckaby December 18, 2009 14:24

Fabian,
1) I think there are two different "rho" fields. A transported "rho" calculated by the mass conservation equation and thermodynamic "rho" calculated from "p" and "T".

2) Yes, the solver does not need to iterate to solve for rho, since this is a fully explicit equation. fvc (explicit) vs. fvm (implicit)

Looking through the code there are some subtle difference between between the implementation of the PISO and SIMPLE algorthms, thus it would be better
to use a PISO solver and add radiation as opposed to the opposite.

Have you tried decreasing the time-step at least during the initial transient ?

Dave

maruthamuthu_venkatraman February 8, 2010 08:59

How to Include Radition heat sources in BuoyantPISOFoam
 
Have you succeeded in implimenting Radiation sources in BuoyantPisoFoam ? If so, then could you give me the instructions to follow the same.

Thanks

rob3rt 0ng September 5, 2010 22:28

Hi David and Fabian,

I have a question which may sound kind of stupid....

I think buoyantBoussinesqPisoFoam is only meant to solve incompressible flow, if this is the case then why did you need to bother about hEqn.h and thermo stuffs?

Isn't there any other way to implement incompressible flow with radiative heat transfer apart from this?

Thank you for your time and attention.

Robert

kirankarki October 26, 2010 16:46

Hi Fabian and Dhuckaby,
Greetings,
I guess from your conservation, u have included transient terms into simpleradiationFoam solver. I am also trying to add conduction and convection heat transfer into simpleradiationFoam solver. For this, i am thinking to use transport equation to the radiation solver. Is this the right way to do this? Would you please tell me how you included transient terms into radiation solver with steps to follow?

Any help will be greatly appreciated,
Thanks a lot,


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