00001 { 00002 rho = thermo.rho(); 00003 rho.relax(); 00004 00005 volScalarField rUA = 1.0/UEqn().A(); 00006 surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); 00007 00008 U = rUA*UEqn().H(); 00009 UEqn.clear(); 00010 00011 phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); 00012 bool closedVolume = adjustPhi(phi, U, p_rgh); 00013 00014 surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf(); 00015 phi -= buoyancyPhi; 00016 00017 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) 00018 { 00019 fvScalarMatrix p_rghEqn 00020 ( 00021 fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi) 00022 ); 00023 00024 p_rghEqn.setReference 00025 ( 00026 pRefCell, getRefCellValue(p_rgh, pRefCell) 00027 ); 00028 00029 eqnResidual = p_rghEqn.solve().initialResidual(); 00030 00031 // Retain the residual from the first iteration 00032 if (nonOrth == 0) 00033 { 00034 maxResidual = max(eqnResidual, maxResidual); 00035 } 00036 00037 if (nonOrth == nNonOrthCorr) 00038 { 00039 // Calculate the conservative fluxes 00040 phi -= p_rghEqn.flux(); 00041 00042 // Explicitly relax pressure for momentum corrector 00043 p_rgh.relax(); 00044 00045 // Correct the momentum source with the pressure gradient flux 00046 // calculated from the relaxed pressure 00047 U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf); 00048 U.correctBoundaryConditions(); 00049 } 00050 } 00051 00052 #include <finiteVolume/continuityErrs.H> 00053 00054 p = p_rgh + rho*gh; 00055 00056 // For closed-volume cases adjust the pressure level 00057 // to obey overall mass continuity 00058 if (closedVolume) 00059 { 00060 p += (initialMass - fvc::domainIntegrate(psi*p)) 00061 /fvc::domainIntegrate(psi); 00062 p_rgh = p - rho*gh; 00063 } 00064 00065 rho = thermo.rho(); 00066 rho.relax(); 00067 Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() 00068 << endl; 00069 }