|
[Sponsors] |
December 15, 2016, 09:08 |
Temperature in icoFoam
|
#1 |
New Member
Join Date: May 2016
Posts: 25
Rep Power: 10 |
Hi,
i modified the icoFoam solver to solve the temperature following this wiki: https://openfoamwiki.net/index.php/H...ure_to_icoFoam I run the cavity example and everything worked. Now i'm trying to simulate a mixing elbow in which the two flows have different velocities (I know icoFoam is only laminar but i'm learning this and then i'll move to simpleFoam to account the turbulence) The simulation runs without errors but the results are incorrect (see attached image) This is the temperature BC: Code:
dimensions [0 0 0 1 0 0 0]; internalField uniform 0; boundaryField { wall { type zeroGradient; } inletSmall { type fixedValue; value uniform 40; } inletBig { type fixedValue; value uniform 20; } outlet { type zeroGradient; } } Code:
Info<< "Reading transportProperties\n" << endl; IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); dimensionedScalar nu ( "nu", dimViscosity, transportProperties.lookup("nu") ); dimensionedScalar DT ( transportProperties.lookup("DT") ); 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 ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); #include "createPhi.H" label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); mesh.setFluxRequired(p.name()); Code:
#include "fvCFD.H" #include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" pisoControl piso(mesh); #include "createFields.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; #include "CourantNo.H" // Momentum predictor fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } // --- PISO loop while (piso.correct()) { volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", fvc::flux(HbyA) + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi) ); adjustPhi(phiHbyA, U, p); // Update the pressure BCs to ensure flux consistency constrainPressure(p, U, phiHbyA, rAU); // Non-orthogonal pressure corrector loop while (piso.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn ( fvm::laplacian(rAU, p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(mesh.solver(p.select(piso.finalInnerIter()))); if (piso.finalNonOrthogonalIter()) { phi = phiHbyA - pEqn.flux(); } } #include "continuityErrs.H" U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); } fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(DT, T) ); TEqn.solve(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; } Thanks! |
|
December 17, 2016, 18:55 |
|
#2 |
New Member
Join Date: May 2016
Posts: 25
Rep Power: 10 |
I kept looking for errors but i didn't.
I tried to run a different simulation (2D T junction) with the same solver and similar BC and this one worked! How is that possible? |
|
Tags |
icofoam, solver, temperature |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shadow Wall and temperature | norger | FLUENT | 10 | September 28, 2019 12:43 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
Inlet won't apply UDF and has temperature at 0K! | tccruise | Fluent UDF and Scheme Programming | 2 | September 14, 2012 07:08 |
icofoam with temperature and 3D model | hsingtzu | OpenFOAM Running, Solving & CFD | 0 | March 8, 2012 18:13 |
monitoring point of total temperature | rogbrito | FLUENT | 0 | June 21, 2009 18:31 |