CFD Online Discussion Forums

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

Fabian December 16, 2009 08:51

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();
}

Now things starting to get complicated, at least with my programming knowledge.

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


All times are GMT -4. The time now is 20:37.