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