adding gravity term in pisoFoam
Hi
I'm being set up the LES model for the channel flows. At first, I refer to channelFoam. However, in its driving force for the flows is pressure gradients. but I would like to consider the gravity term for the driving force. So, I added a new term to the original pisoFoam. But I'm not sure my attempt. My code is as follows. I'll thank you any advice. ## pisoFoam.c while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; #include "readPISOControls.H" #include "CourantNo.H" // Pressure-velocity PISO corrector { // Momentum predictor fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) // == // Gravity ); UEqn.relax(); if (momentumPredictor) { solve(UEqn == -fvc::grad(p)+Gravity2); //corrected } // --- PISO loop for (int corr=0; corr<nCorr; corr++) { volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA("HbyA", U); HbyA = rAU*(UEqn.H()+Gravity2); //corrected surfaceScalarField phiHbyA ( "phiHbyA", (fvc::interpolate(HbyA) & mesh.Sf()) + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi) ); adjustPhi(phiHbyA, U, p); // Non-orthogonal pressure corrector loop for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { // Pressure corrector fvScalarMatrix pEqn ( fvm::laplacian(rAU, p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); if ( corr == nCorr-1 && nonOrth == nNonOrthCorr ) { pEqn.solve(mesh.solver("pFinal")); } else { pEqn.solve(); } if (nonOrth == nNonOrthCorr) { phi = phiHbyA - pEqn.flux(); } } // #include "continuityErrs.H" U = HbyA - rAU*(fvc::grad(p)); U.correctBoundaryConditions(); } } ##createFiedls.H volVectorField Gravity2 ( IOobject ( "Gravity2", runTime.constant(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh, dimensionedVector("Gravity2", dimensionSet(0,1,-2,0,0,0,0),vector(0,-9.81,0)) ); |
All times are GMT -4. The time now is 13:42. |