Previous: New solver Up: Creating new OpenFOAM solver Next: Test case set up
This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.
Implementation
- Solver already exists, make sure by listing:
# ls $FOAM_USER_APPBIN - In file createFields.H create new constant for heat constant coefficient kappa and new quantity T :
Info<< "Reading transportProperties\n" << endl; IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar nu ( "nu", dimViscosity, transportProperties.lookup("nu") ); dimensionedScalar kappa ( "kappa", dimViscosity, transportProperties.lookup("kappa") ); Info<< "Reading field p\n" << endl; volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field T\n" <<endl; volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field U\n" << endl; volVectorField U ( ...
- Now, in source code file icoTempFoam.C implement equation for temperature.
- Temperature is dependent on velocity field, let us place the temperature equation right after the PISO loop:
#include "continuityErrs.H" U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); } fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(kappa, T) ); TEqn.solve(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
- Each term of temperature equation is discretized and written in matrix of linear system
- Compile solver:
# wmake