Difference between revisions of "BubbleFoam"
From OpenFOAMWiki
(→Implementation of the pressure equation) |
(→Implementation of the pressure equation) |
||
Line 334: | Line 334: | ||
<cpp> | <cpp> | ||
{ | { | ||
− | // The phase fraction | + | // The phase fraction fields are interpolated at cell faces |
surfaceScalarField alphaf = fvc::interpolate(alpha); | surfaceScalarField alphaf = fvc::interpolate(alpha); | ||
surfaceScalarField betaf = scalar(1) - alphaf; | surfaceScalarField betaf = scalar(1) - alphaf; | ||
Line 342: | Line 342: | ||
volScalarField rUbA = 1.0/UbEqn.A(); | volScalarField rUbA = 1.0/UbEqn.A(); | ||
− | // The values of the central | + | // The values of the central coefficients are interpolated at cell faces |
surfaceScalarField rUaAf = fvc::interpolate(rUaA); | surfaceScalarField rUaAf = fvc::interpolate(rUaA); | ||
surfaceScalarField rUbAf = fvc::interpolate(rUbA); | surfaceScalarField rUbAf = fvc::interpolate(rUbA); | ||
Line 350: | Line 350: | ||
Ub = rUbA*UbEqn.H(); | Ub = rUbA*UbEqn.H(); | ||
− | // Accounting for the explict drag term and buoyancy | + | // Accounting for the explict drag term and buoyancy effect. Both |
− | // these terms are managed at cell faces and their effect is included in the phase | + | // these terms are managed at cell faces and their effect is included in the phase flux. |
− | // Note that the whole drag term is interpolated and then multiplied by the | + | // Note that the whole drag term is interpolated and then multiplied by the flux, |
// instead of reusing the previously computed value of the central coefficient at cell | // instead of reusing the previously computed value of the central coefficient at cell | ||
// faces (rUaAf). | // faces (rUaAf). | ||
Line 372: | Line 372: | ||
} | } | ||
− | // The phase | + | // The phase fluxes and the total flux are computed |
phia = (fvc::interpolate(Ua) & mesh.Sf()) + | phia = (fvc::interpolate(Ua) & mesh.Sf()) + | ||
fvc::ddtPhiCorr(rUaA, Ua, phia) + phiDraga; | fvc::ddtPhiCorr(rUaA, Ua, phia) + phiDraga; | ||
Line 404: | Line 404: | ||
surfaceScalarField SfGradp = pEqn.flux()/Dp; | surfaceScalarField SfGradp = pEqn.flux()/Dp; | ||
− | // The phase | + | // The phase fluxes and the total flux are corrected to account for the updated |
− | // pressure | + | // pressure field. |
phia -= rUaAf*SfGradp/rhoa; | phia -= rUaAf*SfGradp/rhoa; | ||
phib -= rUbAf*SfGradp/rhob; | phib -= rUbAf*SfGradp/rhob; | ||
Line 411: | Line 411: | ||
phi = alphaf*phia + betaf*phib; | phi = alphaf*phia + betaf*phib; | ||
− | // Pressure is explicitly relaxed before correcting the phase velocity | + | // Pressure is explicitly relaxed before correcting the phase velocity fields |
p.relax(); | p.relax(); | ||
Line 418: | Line 418: | ||
// Velocities are not updated using directly the pressure, as done conventionally, | // Velocities are not updated using directly the pressure, as done conventionally, | ||
− | // but reconstructing the velocity update from the | + | // but reconstructing the velocity update from the fluxes, which are the primary |
// variable [8] | // variable [8] | ||