00001 { 00002 surfaceScalarField alphaf = fvc::interpolate(alpha); 00003 surfaceScalarField betaf = scalar(1) - alphaf; 00004 00005 volScalarField rUaA = 1.0/UaEqn.A(); 00006 volScalarField rUbA = 1.0/UbEqn.A(); 00007 00008 phia == (fvc::interpolate(Ua) & mesh.Sf()); 00009 phib == (fvc::interpolate(Ub) & mesh.Sf()); 00010 00011 rUaAf = fvc::interpolate(rUaA); 00012 surfaceScalarField rUbAf = fvc::interpolate(rUbA); 00013 00014 Ua = rUaA*UaEqn.H(); 00015 Ub = rUbA*UbEqn.H(); 00016 00017 surfaceScalarField phiDraga = 00018 fvc::interpolate(beta/rhoa*K*rUaA)*phib + rUaAf*(g & mesh.Sf()); 00019 00020 if (g0.value() > 0.0) 00021 { 00022 phiDraga -= ppMagf*fvc::snGrad(alpha)*mesh.magSf(); 00023 } 00024 00025 if (kineticTheory.on()) 00026 { 00027 phiDraga -= rUaAf*fvc::snGrad(kineticTheory.pa()/rhoa)*mesh.magSf(); 00028 } 00029 00030 surfaceScalarField phiDragb = 00031 fvc::interpolate(alpha/rhob*K*rUbA)*phia + rUbAf*(g & mesh.Sf()); 00032 00033 // Fix for gravity on outlet boundary. 00034 forAll(p.boundaryField(), patchi) 00035 { 00036 if (isA<zeroGradientFvPatchScalarField>(p.boundaryField()[patchi])) 00037 { 00038 phiDraga.boundaryField()[patchi] = 0.0; 00039 phiDragb.boundaryField()[patchi] = 0.0; 00040 } 00041 } 00042 00043 phia = (fvc::interpolate(Ua) & mesh.Sf()) + fvc::ddtPhiCorr(rUaA, Ua, phia) 00044 + phiDraga; 00045 00046 phib = (fvc::interpolate(Ub) & mesh.Sf()) + fvc::ddtPhiCorr(rUbA, Ub, phib) 00047 + phiDragb; 00048 00049 phi = alphaf*phia + betaf*phib; 00050 00051 surfaceScalarField Dp 00052 ( 00053 "(rho*(1|A(U)))", 00054 alphaf*rUaAf/rhoa 00055 + betaf*rUbAf/rhob 00056 ); 00057 00058 for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) 00059 { 00060 fvScalarMatrix pEqn 00061 ( 00062 fvm::laplacian(Dp, p) == fvc::div(phi) 00063 ); 00064 00065 pEqn.setReference(pRefCell, pRefValue); 00066 pEqn.solve(); 00067 00068 if (nonOrth == nNonOrthCorr) 00069 { 00070 surfaceScalarField SfGradp = pEqn.flux()/Dp; 00071 00072 phia -= rUaAf*SfGradp/rhoa; 00073 phib -= rUbAf*SfGradp/rhob; 00074 phi = alphaf*phia + betaf*phib; 00075 00076 p.relax(); 00077 SfGradp = pEqn.flux()/Dp; 00078 00079 Ua += fvc::reconstruct(phiDraga - rUaAf*SfGradp/rhoa); 00080 Ua.correctBoundaryConditions(); 00081 00082 Ub += fvc::reconstruct(phiDragb - rUbAf*SfGradp/rhob); 00083 Ub.correctBoundaryConditions(); 00084 00085 U = alpha*Ua + beta*Ub; 00086 } 00087 } 00088 } 00089 00090 #include <finiteVolume/continuityErrs.H>