twoPhaseEulerFoam: Improved handling of velocity/flux boundary conditions

Updated tutorials to converge pressure during PIMPLE loop to avoid
phase-fraction unboundedness which limits thermodynamics convergence.
This commit is contained in:
Henry
2015-04-12 09:57:56 +01:00
parent 56e9699cb0
commit f5bb944965
19 changed files with 63 additions and 42 deletions

View File

@ -30,6 +30,7 @@ volScalarField dragCoeff(fluid.dragCoeff());
U1Eqn.relax(); U1Eqn.relax();
U1Eqn += fvm::Sp(dragCoeff, U1); U1Eqn += fvm::Sp(dragCoeff, U1);
fvOptions.constrain(U1Eqn); fvOptions.constrain(U1Eqn);
U1.correctBoundaryConditions();
} }
{ {
@ -52,5 +53,6 @@ volScalarField dragCoeff(fluid.dragCoeff());
U2Eqn.relax(); U2Eqn.relax();
U2Eqn += fvm::Sp(dragCoeff, U2); U2Eqn += fvm::Sp(dragCoeff, U2);
fvOptions.constrain(U2Eqn); fvOptions.constrain(U2Eqn);
U2.correctBoundaryConditions();
} }
} }

View File

@ -13,6 +13,12 @@ while (pimple.correct())
// Update continuity errors due to temperature changes // Update continuity errors due to temperature changes
#include "correctContErrs.H" #include "correctContErrs.H"
// Correct flux BCs to be consistent with the velocity BCs
phi1.boundaryField() ==
mrfZones.relative(mesh.Sf().boundaryField() & U1.boundaryField());
phi2.boundaryField() ==
mrfZones.relative(mesh.Sf().boundaryField() & U2.boundaryField());
volVectorField HbyA1 volVectorField HbyA1
( (
IOobject::groupName("HbyA", phase1.name()), IOobject::groupName("HbyA", phase1.name()),
@ -92,9 +98,9 @@ while (pimple.correct())
surfaceScalarField phiCorrCoeff1(pos(alpha1fBar - 0.99)); surfaceScalarField phiCorrCoeff1(pos(alpha1fBar - 0.99));
surfaceScalarField phiCorrCoeff2(pos(0.01 - alpha1fBar)); surfaceScalarField phiCorrCoeff2(pos(0.01 - alpha1fBar));
// Set ddtPhiCorr to 0 on non-coupled boundaries
forAll(mesh.boundary(), patchi) forAll(mesh.boundary(), patchi)
{ {
// Set ddtPhiCorr to 0 on non-coupled boundaries
if if
( (
!mesh.boundary()[patchi].coupled() !mesh.boundary()[patchi].coupled()
@ -272,18 +278,7 @@ while (pimple.correct())
((phi1s + D1f*phi2s) - (phi2s + D2f*phi1s))/(1 - D1f*D2f) ((phi1s + D1f*phi2s) - (phi2s + D2f*phi1s))/(1 - D1f*D2f)
); );
phi1.boundaryField() ==
mrfZones.relative
(
mesh.Sf().boundaryField() & U1.boundaryField()
);
phi1 = phi + alpha2f*phir; phi1 = phi + alpha2f*phir;
phi2.boundaryField() ==
mrfZones.relative
(
mesh.Sf().boundaryField() & U2.boundaryField()
);
phi2 = phi - alpha1f*phir; phi2 = phi - alpha1f*phir;
} }

View File

@ -37,6 +37,7 @@ Description
#include "IOMRFZoneList.H" #include "IOMRFZoneList.H"
#include "fvIOoptionList.H" #include "fvIOoptionList.H"
#include "fixedFluxPressureFvPatchScalarField.H" #include "fixedFluxPressureFvPatchScalarField.H"
#include "fixedValueFvsPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -60,13 +60,15 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
const blendingMethod& blending, const blendingMethod& blending,
const phasePair& pair, const phasePair& pair,
const orderedPhasePair& pair1In2, const orderedPhasePair& pair1In2,
const orderedPhasePair& pair2In1 const orderedPhasePair& pair2In1,
const bool correctFixedFluxBCs
) )
: :
pair_(pair), pair_(pair),
pair1In2_(pair1In2), pair1In2_(pair1In2),
pair2In1_(pair2In1), pair2In1_(pair2In1),
blending_(blending) blending_(blending),
correctFixedFluxBCs_(correctFixedFluxBCs)
{ {
if (modelTable.found(pair_)) if (modelTable.found(pair_))
{ {
@ -161,7 +163,11 @@ Foam::BlendedInterfacialModel<modelType>::K() const
x() += model2In1_->K()*f2; x() += model2In1_->K()*f2;
} }
if (model_.valid() || model1In2_.valid() || model2In1_.valid()) if
(
correctFixedFluxBCs_
&& (model_.valid() || model1In2_.valid() || model2In1_.valid())
)
{ {
correctFixedFluxBCs(x()); correctFixedFluxBCs(x());
} }
@ -217,7 +223,11 @@ Foam::BlendedInterfacialModel<modelType>::F() const
x() -= model2In1_->F()*f2; // note : subtraction x() -= model2In1_->F()*f2; // note : subtraction
} }
if (model_.valid() || model1In2_.valid() || model2In1_.valid()) if
(
correctFixedFluxBCs_
&& (model_.valid() || model1In2_.valid() || model2In1_.valid())
)
{ {
correctFixedFluxBCs(x()); correctFixedFluxBCs(x());
} }
@ -272,7 +282,11 @@ Foam::BlendedInterfacialModel<modelType>::D() const
x() += model2In1_->D()*f2; x() += model2In1_->D()*f2;
} }
if (model_.valid() || model1In2_.valid() || model2In1_.valid()) if
(
correctFixedFluxBCs_
&& (model_.valid() || model1In2_.valid() || model2In1_.valid())
)
{ {
correctFixedFluxBCs(x()); correctFixedFluxBCs(x());
} }

View File

@ -75,6 +75,9 @@ class BlendedInterfacialModel
//- Blending model //- Blending model
const blendingMethod& blending_; const blendingMethod& blending_;
//- If true set coefficients and forces to 0 at fixed-flux BCs
bool correctFixedFluxBCs_;
// Private Member Functions // Private Member Functions
@ -103,7 +106,8 @@ public:
const blendingMethod& blending, const blendingMethod& blending,
const phasePair& pair, const phasePair& pair,
const orderedPhasePair& pair1In2, const orderedPhasePair& pair1In2,
const orderedPhasePair& pair2In1 const orderedPhasePair& pair2In1,
const bool correctFixedFluxBCs = true
); );

View File

@ -184,7 +184,8 @@ Foam::twoPhaseSystem::twoPhaseSystem
), ),
pair_, pair_,
pair1In2_, pair1In2_,
pair2In1_ pair2In1_,
false // Do not zero drag coefficent at fixed-flux BCs
) )
); );

View File

@ -28,7 +28,7 @@ boundaryField
{ {
type inletOutlet; type inletOutlet;
phi phi.water; phi phi.water;
inletValue uniform 300; inletValue $internalField;
value $internalField; value $internalField;
} }
inlet inlet

View File

@ -35,7 +35,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -28,7 +28,7 @@ boundaryField
{ {
type inletOutlet; type inletOutlet;
phi phi.water; phi phi.water;
inletValue uniform 300; inletValue $internalField;
value $internalField; value $internalField;
} }
inlet inlet

View File

@ -35,7 +35,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -42,7 +42,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -28,7 +28,7 @@ boundaryField
{ {
type inletOutlet; type inletOutlet;
phi phi.water; phi phi.water;
inletValue uniform 300; inletValue $internalField;
value $internalField; value $internalField;
} }
inlet inlet

View File

@ -35,7 +35,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -28,7 +28,7 @@ boundaryField
{ {
type inletOutlet; type inletOutlet;
phi phi.water; phi phi.water;
inletValue uniform 300; inletValue $internalField;
value $internalField; value $internalField;
} }
inlet inlet

View File

@ -35,7 +35,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -42,7 +42,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -23,7 +23,7 @@ injector1
selectionMode points; selectionMode points;
points points
( (
(0.075 0.1 0.05) (0.075 0.2 0.05)
); );
} }

View File

@ -35,7 +35,7 @@ solvers
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0;
} }
p_rghFinal p_rghFinal

View File

@ -25,17 +25,21 @@ solvers
p_rgh p_rgh
{ {
solver GAMG; solver PCG;
smoother DIC; preconditioner
nPreSweeps 0; {
nPostSweeps 2; preconditioner GAMG;
nFinestSweeps 2; smoother GaussSeidel;
cacheAgglomeration true; nPreSweeps 0;
nCellsInCoarsestLevel 10; nPostSweeps 2;
agglomerator faceAreaPair; nFinestSweeps 2;
mergeLevels 1; cacheAgglomeration true;
tolerance 1e-7; nCellsInCoarsestLevel 10;
relTol 0.01; agglomerator faceAreaPair;
mergeLevels 1;
}
tolerance 1e-6;
relTol 0;
} }
p_rghFinal p_rghFinal