Skip to content

Commit

Permalink
FSF solver test
Browse files Browse the repository at this point in the history
AlexGubkin committed Nov 1, 2022
1 parent c48cede commit 60775d7
Showing 10 changed files with 49 additions and 48 deletions.
2 changes: 1 addition & 1 deletion applications/solvers/interFSFFoam/UEqn.H
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
// + fvc::snGrad(pc)
+ fvc::snGrad(pc)
) * mesh.magSf()
+ phic
)
6 changes: 3 additions & 3 deletions applications/solvers/interFSFFoam/pEqn.H
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
surfaceScalarField phig
(
phic*rAUf
// + fvc::snGrad(pc)*rAUf*mesh.magSf()
+ fvc::snGrad(pc)*rAUf*mesh.magSf()
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
);

@@ -76,7 +76,7 @@
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);

p == p_rgh + rho*gh;
p == p_rgh + rho*gh - pc;

if (p_rgh.needReference())
{
@@ -87,7 +87,7 @@
pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
);
p_rgh = p - rho*gh;
p_rgh = p - rho*gh + pc;
}

if (!correctPhi)
53 changes: 27 additions & 26 deletions applications/solvers/interFSFFoam/pcEqn.H
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// fcf.storePrevIter();
fcf.storePrevIter();
fcfFilt.storePrevIter();

// const scalar cPhicFilterCoeff(alphaControls.lookupOrDefault<scalar>("cPhicFilterCoeff", 0.1));
const scalar cPhicFilterCoeff(alphaControls.lookupOrDefault<scalar>("cPhicFilterCoeff", 0.1));
const scalar cPhicThresholdCoeff(alphaControls.lookupOrDefault<scalar>("cPhicThresholdCoeff", 0.01));

// label pcRefCell = 0;
@@ -21,18 +21,19 @@ fcf =
*fvc::interpolate(w2*kappa)
/fvc::interpolate(w2)*deltaf;

fcf.relax();

fc = fvc::reconstruct(fcf*mesh.magSf());

// fcfFilt =
// deltaf/(mag(deltaf) + mixture.deltaN())
// mag(deltaf)/(mag(deltaf) + mixture.deltaN())
// *(
// fcfFilt.oldTime()
// + cPhicFilterCoeff*((gradPcf - (gradPcf & nHatfv)*nHatfv) & mesh.Sf()/mesh.magSf())
// + cPhicFilterCoeff*(fvc::interpolate(gradPc - (gradPc & nHatv)*nHatv) & (mesh.Sf()/mesh.magSf()))
// );

fcfFilt =
mag(deltaf)/(mag(deltaf) + mixture.deltaN())
*fvc::interpolate(gradPc - (gradPc & nHatv)*nHatv) & (mesh.Sf()/mesh.magSf());
cPhicFilterCoeff*fvc::interpolate(gradPc - (gradPc & nHatv)*nHatv) & (mesh.Sf()/mesh.magSf());

fcfFilt.relax();

@@ -47,7 +48,7 @@ while (pimple.correctNonOrthogonal())
fvScalarMatrix pcEqn
(
fvm::laplacian(pc)
== fvc::div((fcf - fcfFilt)*mesh.magSf())
== fvc::div((fcf)*mesh.magSf())
);

pcEqn.setReference
@@ -68,34 +69,34 @@ while (pimple.correctNonOrthogonal())
// 1.0
// );
// phic = pcEqn.flux();
// phic = (fcf - fvc::snGrad(pc))*mesh.magSf();
phic = (fcf - fvc::snGrad(pc))*mesh.magSf();
// phicFilt =
// pos(phic)*mag(phic)
// - (1.0 - pos(phic))*mag(phic);
phic = mag(deltaf)/(mag(deltaf) + mixture.deltaN())*fvc::snGrad(pc)*mesh.magSf();
// phic = mag(deltaf)/(mag(deltaf) + mixture.deltaN())*fvc::snGrad(pc)*mesh.magSf();
// phic = fvc::snGrad(pc)*mesh.magSf();

const dimensionedScalar phicAvg
const dimensionedScalar fcfAvg
(
dimensionSet(dimForce/dimLength),
dimensionSet(dimForce/dimVolume),
// average(mag(fcf))/(average(pos(mag(fcf))) + SMALL)
// average(mag(fcf))
cPhicThresholdCoeff*gSum(mag(fcf.field()*mesh.magSf()))
/gSum(SMALL + pos(mag(fcf.field()) - SMALL))
average(mag(fcf.field()))
// cPhicThresholdCoeff*gSum(mag(fcf.field()*mesh.magSf()))
// /gSum(SMALL + pos(mag(fcf.field()) - SMALL))
);

Info<< "phicAvg = " << phicAvg.value() << nl;

// phic -=
// max
// (
// min
// (
// phic,
// phicAvg
// ),
// - phicAvg
// );
Info<< "fcfAvg = " << fcfAvg.value() << nl;

phic -=
max
(
min
(
phic,
cPhicThresholdCoeff*fcfAvg*mesh.magSf()
),
- cPhicThresholdCoeff*fcfAvg*mesh.magSf()
);

// phic -= cPhicThresholdCoeff*phicFilt;
}
6 changes: 3 additions & 3 deletions tests/dropletRelaxation2D/calculate.sh
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
#Variables section
caseName=case1

scaleSize=$(echo "0.0001" | bc -l)
scaleSize=$(echo "0.000001" | bc -l)

cd ${caseName}

@@ -27,9 +27,9 @@ runApplication transformPoints "scale=(${scaleSize} ${scaleSize} ${scaleSize})"
rm log.transformPoints
runParallel transformPoints "scale=(${scaleSize} ${scaleSize} ${scaleSize})"

foamDictionary -entry endTime -set $(echo "0.05" | bc -l) system/controlDict
foamDictionary -entry endTime -set $(echo "0.005" | bc -l) system/controlDict
foamDictionary -entry deltaT -set $(echo "0.000001" | bc -l) system/controlDict
foamDictionary -entry writeInterval -set $(echo "0.0001" | bc -l) system/controlDict
foamDictionary -entry writeInterval -set $(echo "0.00001" | bc -l) system/controlDict
foamDictionary -entry adjustTimeStep -set "yes" system/controlDict
foamDictionary -entry maxCo -set $(echo "0.1" | bc -l) system/controlDict
foamDictionary -entry maxAlphaCo -set $(echo "0.1" | bc -l) system/controlDict
2 changes: 1 addition & 1 deletion tests/dropletRelaxation2D/src/constant/phaseProperties
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ phases (phase1 phase2);

pMin 1000;

sigma 0.07;
sigma 0.02;

// sigma
// {
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@ FoamFile

viscosityModel constant;

nu 1e-06;
nu 2e-06;

rho 1000;
rho 800;

// thermoType
// {
8 changes: 4 additions & 4 deletions tests/dropletRelaxation2D/src/system/blockMeshDict
Original file line number Diff line number Diff line change
@@ -16,12 +16,12 @@ FoamFile

convertToMeters 1;

boxWidth 10.0;
boxHeight 10.0;
boxWidth 60.0;
boxHeight 60.0;
boxDepth 1.0;

Nx 80;
Ny 80;
Nx 60;
Ny 60;
Nz 1;

box0Nx $Nx;
2 changes: 1 addition & 1 deletion tests/dropletRelaxation2D/src/system/fvSchemes
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ divSchemes
{
// div(rhoPhi,U) Gauss linearUpwind grad(U);
div(rhoPhi,U) Gauss vanLeerV;
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
div(phi,alpha) Gauss interfaceCompression vanLeer 0;
// div(phi,alpha) Gauss PLICU interfaceCompression vanLeer 1;
// div(phi,alpha) Gauss MPLIC;
// div(phi,alpha) Gauss MPLICU;
12 changes: 6 additions & 6 deletions tests/dropletRelaxation2D/src/system/fvSolution
Original file line number Diff line number Diff line change
@@ -30,12 +30,12 @@ solvers
tolerance 1e-12;
relTol 0;

nAlphaSmoothers 3;
nAlphaSmoothers 7;
cSmCoeff 0.5;
cShCoeff 0.98;
cShCoeff 0.1;
nKappaSmoothers 2;
// cPhicFilterCoeff 0.1;
cPhicThresholdCoeff 0.01;
cPhicFilterCoeff 0.9;
cPhicThresholdCoeff 0.05;
}

".*(rho|rhoFinal)"
@@ -157,8 +157,8 @@ relaxationFactors
// p_rghFinal 1;
// phic 0.7;
// phicFinal 1;
// fcf 0.7;
// fcfFinal 1;
fcf 0.7;
fcfFinal 1;
fcfFilt 0.7;
fcfFiltFinal 1;
}
2 changes: 1 addition & 1 deletion tests/dropletRelaxation2D/src/system/setFieldsDict
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ regions
(
boxToCell
{
box (-2 -2 -2) (2 2 2);
box (-15 -15 -15) (15 15 15);
fieldValues
(
volScalarFieldValue alpha.phase1 0

0 comments on commit 60775d7

Please sign in to comment.