diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index a9c3365bdf73fedfa445979e9cf7e5b2f2ebf937..06444163304bdae83032ea072608fe5459b896ac 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -56,12 +56,13 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createDynamicFvMesh.H" #include "readGravitationalAcceleration.H" + #include "initContinuityErrs.H" pimpleControl pimple(mesh); - #include "readControls.H" - #include "initContinuityErrs.H" #include "createFields.H" + #include "createUf.H" + #include "readControls.H" #include "createPrghCorrTypes.H" #include "CourantNo.H" #include "setInitialDeltaT.H" @@ -74,9 +75,6 @@ int main(int argc, char *argv[]) #include "readControls.H" #include "CourantNo.H" - // Make the fluxes absolute - fvc::makeAbsolute(phi, U); - #include "setDeltaT.H" runTime++; @@ -85,7 +83,7 @@ int main(int argc, char *argv[]) { // Store divU from the previous mesh for the correctPhi - volScalarField divU(fvc::div(phi)); + volScalarField divU(fvc::div(fvc::absolute(phi, U))); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); @@ -104,13 +102,16 @@ int main(int argc, char *argv[]) if (mesh.changing() && correctPhi) { + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + #include "correctPhi.H" + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); } } - // Make the fluxes relative to the mesh motion - fvc::makeRelative(phi, U); - if (mesh.changing() && checkMeshCourantNo) { #include "meshCourantNo.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H index c8709d33476c0e4e8425583ac33d369e8caba7be..76e9217b650ce32a9d36ea72b131e7c806583ab5 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H @@ -40,8 +40,6 @@ dimensionedScalar Dp("Dp", dimTime/rho.dimensions(), 1.0); - adjustPhi(phi, U, pcorr); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..c86921371f52ec96f0cff265257110280f460546 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H @@ -0,0 +1,133 @@ +{ + volScalarField rAU("rAU", 1.0/UEqn.A()); + surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + + volVectorField HbyA("HbyA", U); + HbyA = rAU*UEqn.H(); + + surfaceScalarField phiHbyA + ( + "phiHbyA", + (fvc::interpolate(HbyA) & mesh.Sf()) + + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf) + ); + + surfaceScalarField phig + ( + ( + fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) + - ghf*fvc::snGrad(rho) + )*rAUf*mesh.magSf() + ); + + phiHbyA += phig; + + // Update the fixedFluxPressure BCs to ensure flux consistency + setSnGrad<fixedFluxPressureFvPatchScalarField> + ( + p_rgh.boundaryField(), + ( + phiHbyA.boundaryField() + - (mesh.Sf().boundaryField() & U.boundaryField()) + )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) + ); + + tmp<fvScalarMatrix> p_rghEqnComp1; + tmp<fvScalarMatrix> p_rghEqnComp2; + + if (pimple.transonic()) + { + surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi); + surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi); + + p_rghEqnComp1 = + fvc::ddt(rho1) + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1) + + correction + ( + psi1*fvm::ddt(p_rgh) + + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) + ); + deleteDemandDrivenData(p_rghEqnComp1().faceFluxCorrectionPtr()); + p_rghEqnComp1().relax(); + + p_rghEqnComp2 = + fvc::ddt(rho2) + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2) + + correction + ( + psi2*fvm::ddt(p_rgh) + + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) + ); + deleteDemandDrivenData(p_rghEqnComp2().faceFluxCorrectionPtr()); + p_rghEqnComp2().relax(); + } + else + { + p_rghEqnComp1 = + fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh)) + + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1); + + p_rghEqnComp2 = + fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh)) + + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2); + } + + // Cache p_rgh prior to solve for density update + volScalarField p_rgh_0(p_rgh); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_rghEqnIncomp + ( + fvc::div(phiHbyA) + - fvm::laplacian(rAUf, p_rgh) + ); + + solve + ( + ( + (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1() + + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2() + ) + + p_rghEqnIncomp, + mesh.solver(p_rgh.select(pimple.finalInnerIter())) + ); + + if (pimple.finalNonOrthogonalIter()) + { + p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); + p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh; + + dgdt = + ( + pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2 + - pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1 + ); + + phi = phiHbyA + p_rghEqnIncomp.flux(); + + U = HbyA + + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf); + U.correctBoundaryConditions(); + } + } + + { + Uf = fvc::interpolate(U); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf()); + } + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); + + // Update densities from change in p_rgh + rho1 += psi1*(p_rgh - p_rgh_0); + rho2 += psi2*(p_rgh - p_rgh_0); + + rho = alpha1*rho1 + alpha2*rho2; + + K = 0.5*magSqr(U); + + Info<< "max(U) " << max(mag(U)).value() << endl; + Info<< "min(p_rgh) " << min(p_rgh).value() << endl; +} diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/T b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/T new file mode 100644 index 0000000000000000000000000000000000000000..94f61b78252fd4ac59fea878fd1c3fbdd907f6c9 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/T @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + walls + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/U b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/U new file mode 100644 index 0000000000000000000000000000000000000000..e18422b1de70bcafb4d5148125b2c2c329d429a5 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/U @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + front + { + type empty; + } + back + { + type empty; + } + walls + { + type movingWallVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/alpha.water.org b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/alpha.water.org new file mode 100644 index 0000000000000000000000000000000000000000..70366ec29f7aae0cb1cc50f62a3d186553321883 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/alpha.water.org @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + front + { + type empty; + } + back + { + type empty; + } + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/p b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/p new file mode 100644 index 0000000000000000000000000000000000000000..ca99ff2f92f2265c5f58bb44c9ce79ec78ead77f --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/p @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e6; + +boundaryField +{ + front + { + type empty; + } + back + { + type empty; + } + walls + { + type calculated; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/p_rgh b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..b4a73cde4217f67330b55bfb964f427ae53c8072 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/0/p_rgh @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e6; + +boundaryField +{ + front + { + type empty; + } + back + { + type empty; + } + walls + { + type fixedFluxPressure; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allclean b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..46bf04f6aa941c241cd04b7b4fc9fb5f70348f2b --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +foamCleanTutorials cases +rm -rf 0/alpha.water 0/alpha.water.gz 0/T.air.gz 0/T.water.gz \ + probes wallPressure pRefProbe + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..7ea0ac7744adb48402cd7061e4ef780e8853c3df --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun @@ -0,0 +1,13 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict +runApplication blockMesh +cp 0/alpha.water.org 0/alpha.water +runApplication setFields +runApplication `getApplication` + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/RASProperties b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..4773e27a41a100b308cec5d0fd481bb6aab1eda0 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel laminar; + +turbulence off; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/dynamicMeshDict b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..f8a9a9bd8b3dd8cd97772d60b537574b1f46ea6c --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/dynamicMeshDict @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh solidBodyMotionFvMesh; + +solidBodyMotionFvMeshCoeffs +{ + solidBodyMotionFunction SDA; + SDACoeffs + { + CofG ( 0 0 0 ); + lamda 50; + rollAmax 0.22654; + rollAmin 0.10472; + heaveA 3.79; + swayA 2.34; + Q 2; + Tp 13.93; + Tpn 11.93; + dTi 0.059; + dTp -0.001; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/g b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..897615a50df92736e7b9c64bb2e64fba539496fc --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 new file mode 100644 index 0000000000000000000000000000000000000000..8285c3af966ad1948fe17e4883ee8ed5d357dd50 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 @@ -0,0 +1,145 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + `format' ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General m4 macros + +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> +define(VCOUNT, 0) +define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) + +define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) +define(quad2D, (b$1 b$2 f$2 f$1)) +define(frontQuad, (f$1 f$2 f$3 f$4)) +define(backQuad, (b$1 b$4 b$3 b$2)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// User-defined parameters + +convertToMeters 1; + +define(l, 1.0) // Length of tank (x-direction) +define(b, 40) // Breadth of tank (y-direction) +define(h, 30) // Depth of tank (z-direction) + +define(hlc, 5) // Depth to the top (height) of lower chamfer +define(huc, 10) // Height of upper chamfer + +define(thetalc, 45) // Angle of lower chamfer to the horizontal +define(thetauc, 45) // Angle of upper chamfer to the horizontal + +define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction +define(CofGz, 10.0) // Centre of gravity in z-direction + +define(Nl, 1) // Number of cells in the length (1 for 2D) +define(Nb, 40) // Number of cells in the breadth +define(Nhlc, 6) // Number of cells in the height of the lower champfer +define(Nh, 16) // Number of cells in the height between the chamfers +define(Nhuc, 12) // Number of cells in the height of the upper champfer + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Derived parameters + +define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer +define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer + +define(Yl, -CofGy) +define(Yllc, calc(Yl + blc)) +define(Yluc, calc(Yl + buc)) + +define(Yr, calc(Yl + b)) +define(Yrlc, calc(Yr - blc)) +define(Yruc, calc(Yr - buc)) + +define(Zb, -CofGz) +define(Zlc, calc(Zb + hlc)) +define(Zt, calc(Zb + h)) +define(Zuc, calc(Zt - huc)) + +define(Xf, calc(l/2.0)) +define(Xb, calc(Xf - l)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Parametric description + +vertices +( + (Xb Yllc Zb) vlabel(bllcb) + (Xb Yl Zlc) vlabel(bllc) + (Xb Yl Zuc) vlabel(bluc) + (Xb Yluc Zt) vlabel(bluct) + (Xb Yrlc Zb) vlabel(brlcb) + (Xb Yr Zlc) vlabel(brlc) + (Xb Yr Zuc) vlabel(bruc) + (Xb Yruc Zt) vlabel(bruct) + + (Xf Yllc Zb) vlabel(fllcb) + (Xf Yl Zlc) vlabel(fllc) + (Xf Yl Zuc) vlabel(fluc) + (Xf Yluc Zt) vlabel(fluct) + (Xf Yrlc Zb) vlabel(frlcb) + (Xf Yr Zlc) vlabel(frlc) + (Xf Yr Zuc) vlabel(fruc) + (Xf Yruc Zt) vlabel(fruct) +); + +blocks +( + // block0 + hex2D(llcb, rlcb, rlc, llc) + (Nb Nhlc Nl) + simpleGrading (1 1 1) + + // block1 + hex2D(llc, rlc, ruc, luc) + (Nb Nh Nl) + simpleGrading (1 1 1) + + // block2 + hex2D(luc, ruc, ruct, luct) + (Nb Nhuc Nl) + simpleGrading (1 1 1) +); + +patches +( + patch walls + ( + quad2D(llcb, rlcb) + quad2D(rlcb, rlc) + quad2D(rlc, ruc) + quad2D(ruc, ruct) + quad2D(ruct, luct) + quad2D(luct, luc) + quad2D(luc, llc) + quad2D(llc, llcb) + ) + + empty front + ( + frontQuad(llcb, rlcb, rlc, llc) + frontQuad(llc, rlc, ruc, luc) + frontQuad(luc, ruc, ruct, luct) + ) + + empty back + ( + backQuad(llcb, rlcb, rlc, llc) + backQuad(llc, rlc, ruc, luc) + backQuad(luc, ruc, ruct, luct) + ) +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/polyMesh/boundary b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..f1bde7bdce369c1bfc963511de82c352d2772aab --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/polyMesh/boundary @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +3 +( + walls + { + type patch; + nFaces 148; + startFace 2646; + } + front + { + type empty; + inGroups 1(empty); + nFaces 1360; + startFace 2794; + } + back + { + type empty; + inGroups 1(empty); + nFaces 1360; + startFace 4154; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..ad67959d02f43287554544a0f4f34f975eba3441 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +pMin pMin [ 1 -1 -2 0 0 0 0 ] 1000; + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0; + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties.air b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties.air new file mode 100644 index 0000000000000000000000000000000000000000..e61009c10be927d2af1b6981cc75ad368e85d5c3 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties.air @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleInternalEnergy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + thermodynamics + { + Cp 1007; + Hf 0; + } + transport + { + mu 1.84e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties.water b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties.water new file mode 100644 index 0000000000000000000000000000000000000000..1ffcbddad7b44c5aecf0266ac4d48835674b0344 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/thermophysicalProperties.water @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectFluid; + specie specie; + energy sensibleInternalEnergy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 18.0; + } + equationOfState + { + R 3000; + rho0 1027; + } + thermodynamics + { + Cp 4195; + Hf 0; + } + transport + { + mu 3.645e-4; + Pr 2.289; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/transportProperties b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..3729fc7648bb9d76cae6c48139d4b359b92e526c --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/transportProperties @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 998.2; +} + +air +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/turbulenceProperties b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..c2c3b28a1b4e8f4a2cae55f58bd61f9b1a67b488 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/controlDict b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..255b465ca02f1260eeee34d836c9dea027b3991a --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/controlDict @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application compressibleInterDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 40; + +deltaT 0.0001; + +writeControl adjustableRunTime; + +writeInterval 0.05; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression compressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; +maxAlphaCo 0.5; + +maxDeltaT 1; + +functions +{ + probes + { + type probes; + functionObjectLibs ("libsampling.so"); + outputControl outputTime; + probeLocations + ( + ( 0 9.95 19.77 ) + ( 0 -9.95 19.77 ) + ); + fields + ( + p + ); + } + + wallPressure + { + type surfaces; + functionObjectLibs ("libsampling.so"); + outputControl outputTime; + surfaceFormat raw; + fields + ( + p + ); + interpolationScheme cellPoint; + + surfaces + ( + walls + { + type patch; + patches (walls); + triangulate false; + } + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/decomposeParDict b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..46583aaa1d5d6c360b1cd177b31d54802a80888a --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/decomposeParDict @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 16; + +method hierarchical; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 4 2 2 ); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/fvSchemes b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..3d39f5b409eb703d6ffea93e60538665384fb81b --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/fvSchemes @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss interfaceCompression 1; + + div(rho*phi,U) Gauss vanLeerV; + div(phi,thermo:rho.water) Gauss linear; + div(phi,thermo:rho.air) Gauss linear; + div(rho*phi,T) Gauss vanLeer; + div(rho*phi,K) Gauss linear; + div((phi+meshPhi),p) Gauss linear; + + div((muEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_rgh; + pcorr; + alpha; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/fvSolution b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..2bec428fa53bd8344a668261028dd009bc1920d1 --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/fvSolution @@ -0,0 +1,134 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + alpha.water + { + nAlphaCorr 1; + nAlphaSubCycles 3; + cAlpha 1.5; + } + + ".*(rho|rhoFinal)" + { + solver diagonal; + } + + pcorr + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-05; + relTol 0; + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 1e-05; + relTol 0; + maxIter 100; + } + + p_rgh + { + solver GAMG; + tolerance 1e-08; + relTol 0.01; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + p_rghFinal + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 2e-09; + relTol 0; + nVcycles 2; + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 2e-09; + relTol 0; + maxIter 20; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } + + "(T|k|B|nuTilda).*" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-08; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + transonic no; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + correctPhi no; +} + +relaxationFactors +{ + fields + { + } + equations + { + "U.*" 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/setFieldsDict b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..410a0a6f10301fb287d4b429143355dd6ccd526d --- /dev/null +++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box ( -100 -100 -100 ) ( 100 100 0 ); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution index 7a04bf3624c8cbb92370b2dca60cf45a3f15530c..60308edee51a2c3dcbd68c32fe3d56f46210acfe 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution +++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution @@ -24,6 +24,11 @@ solvers cAlpha 1; } + ".*(rho|rhoFinal)" + { + solver diagonal; + } + pcorr { solver PCG; @@ -46,11 +51,6 @@ solvers maxIter 100; } - ".*(rho|rhoFinal)" - { - solver diagonal; - } - p_rgh { solver GAMG;