diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/compressibleContinuityErrs.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/compressibleContinuityErrs.H new file mode 100644 index 0000000000000000000000000000000000000000..f56e211be5327a69daf88d65faf4d3f84801e3ba --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/compressibleContinuityErrs.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Global + continuityErrs + +Description + Calculates and prints the continuity errors. + +\*---------------------------------------------------------------------------*/ + +{ + dimensionedScalar totalMass = fvc::domainIntegrate(cellMask*rho); + + scalar sumLocalContErr = + ( + fvc::domainIntegrate(mag(cellMask*(rho - thermo.rho())))/totalMass + ).value(); + + scalar globalContErr = + ( + fvc::domainIntegrate(cellMask*(rho - thermo.rho()))/totalMass + ).value(); + + cumulativeContErr += globalContErr; + + Info<< "time step continuity errors : sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr + << endl; +} + +// ************************************************************************* // diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H index 37072312ff88b09d5a7e600de73bcfa5b7f7f13f..584be00b5e488e1d568206527467df2e7d8e065c 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H @@ -1,11 +1,84 @@ -CorrectPhi -( - U, - phi, - p, - rho, - psi, - dimensionedScalar("rAUf", dimTime, 1), - divrhoU, - pimple -); +if (mesh.changing()) +{ + volVectorField::Boundary& bfld = U.boundaryFieldRef(); + forAll(bfld, patchi) + { + if (bfld[patchi].fixesValue()) + { + bfld[patchi].initEvaluate(); + } + } + + surfaceScalarField::Boundary& phiBfld = phi.boundaryFieldRef(); + forAll(bfld, patchi) + { + if (bfld[patchi].fixesValue()) + { + bfld[patchi].evaluate(); + + phiBfld[patchi] = + rho.boundaryField()[patchi] + * ( + bfld[patchi] + & mesh.Sf().boundaryField()[patchi] + ); + } + } +} + // Initialize BCs list for pcorr to zero-gradient + wordList pcorrTypes + ( + p.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName + ); + + // Set BCs of pcorr to fixed-value for patches at which p is fixed + forAll(p.boundaryField(), patchi) + { + if (p.boundaryField()[patchi].fixesValue()) + { + pcorrTypes[patchi] = fixedValueFvPatchScalarField::typeName; + } + } + + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar(p.dimensions(), Zero), + pcorrTypes + ); + + mesh.setFluxRequired(pcorr.name()); + +{ + dimensionedScalar rAUf("rAUf", dimTime, 1.0); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pcorrEqn + ( + fvm::ddt(psi, pcorr) + + fvc::div(phi) + - fvm::laplacian(rAUf, pcorr) + == + divrhoU() + ); + + pcorrEqn.solve(mesh.solver(pcorr.select(pimple.finalInnerIter()))); + //Bypass virtual layer + //mesh.fvMesh::solve(pcorrEqn, d); + + if (pimple.finalNonOrthogonalIter()) + { + phi += pcorrEqn.flux(); + } + } +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H index 4c888d9e3a1d5125783f8898dea8548e96a4a584..724bc2ca9af47995a909da166f897309c68138ef 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H @@ -1,11 +1,4 @@ -#include "createTimeControls.H" - -bool correctPhi +bool ddtCorr ( - pimple.dict().lookupOrDefault("correctPhi", true) -); - -bool checkMeshCourantNo -( - pimple.dict().lookupOrDefault("checkMeshCourantNo", false) + pimple.dict().lookupOrDefault("ddtCorr", true) ); diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H index adb9fa1b61280a8e9638e368f3f10ef2476fbc62..8b99b2343979e1d7f04db8f5fb5d5cdea93684be 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H @@ -1,10 +1,10 @@ Info<< "Reading thermophysical properties\n" << endl; -autoPtr<psiThermo> pThermo +autoPtr<fluidThermo> pThermo ( - psiThermo::New(mesh) + fluidThermo::New(mesh) ); -psiThermo& thermo = pThermo(); +fluidThermo& thermo = pThermo(); thermo.validate(args.executable(), "h", "e"); volScalarField& p = thermo.p(); @@ -39,6 +39,8 @@ volVectorField U #include "compressibleCreatePhi.H" +pressureControl pressureControl(p, rho, pimple.dict(), false); + dimensionedScalar rhoMax ( dimensionedScalar::lookupOrDefault @@ -63,42 +65,25 @@ dimensionedScalar rhoMin mesh.setFluxRequired(p.name()); -Info<< "Creating field dpdt\n" << endl; -volScalarField dpdt -( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(p.dimensions()/dimTime, Zero) -); - -Info<< "Creating field kinetic energy K\n" << endl; -volScalarField K("K", 0.5*magSqr(U)); +#include "createDpdt.H" +#include "createK.H" //- Overset specific // Add solver-specific interpolations { - dictionary oversetDict; - oversetDict.add("U", true); - oversetDict.add("p", true); - oversetDict.add("HbyA", true); - oversetDict.add("grad(p)", true); - - const_cast<dictionary&> - ( - mesh.schemesDict() - ).add - ( - "oversetInterpolationRequired", - oversetDict, - true - ); + wordHashSet& nonInt = + const_cast<wordHashSet&>(Stencil::New(mesh).nonInterpolatedFields()); + + nonInt.insert("HbyA"); + nonInt.insert("grad(p)"); + nonInt.insert("surfaceIntegrate(phi)"); + nonInt.insert("surfaceIntegrate(phiHbyA)"); + nonInt.insert("cellMask"); + nonInt.insert("cellDisplacement"); + nonInt.insert("interpolatedCells"); + nonInt.insert("cellInterpolationWeight"); } // Mask field for zeroing out contributions on hole cells diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/overRhoPimpleDyMFoam.C b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/overRhoPimpleDyMFoam.C index 14120c924da5292e15133850f420508d0918d78f..b8439d075a3c4449d65d498b7fd0017be77a6a91 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/overRhoPimpleDyMFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/overRhoPimpleDyMFoam.C @@ -38,10 +38,11 @@ Description #include "fvCFD.H" #include "dynamicFvMesh.H" -#include "psiThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "bound.H" #include "pimpleControl.H" +#include "pressureControl.H" #include "CorrectPhi.H" #include "fvOptions.H" #include "localEulerDdtScheme.H" @@ -56,13 +57,13 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createDynamicFvMesh.H" - #include "createControl.H" + #include "createDyMControls.H" #include "createRDeltaT.H" #include "initContinuityErrs.H" #include "createFields.H" #include "createMRF.H" #include "createFvOptions.H" - #include "createRhoUf.H" + #include "createRhoUfIfPresent.H" #include "createControls.H" turbulence->validate(); @@ -80,66 +81,107 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readControls.H" + #include "readDyMControls.H" + + // Store divrhoU from the previous mesh so that it can be mapped + // and used in correctPhi to ensure the corrected phi has the + // same divergence + autoPtr<volScalarField> divrhoU; + if (correctPhi) { - // Store divrhoU from the previous mesh so that it can be mapped - // and used in correctPhi to ensure the corrected phi has the - // same divergence - volScalarField divrhoU + divrhoU.reset ( - "divrhoU", - fvc::div(fvc::absolute(phi, rho, U)) + new volScalarField + ( + "divrhoU", + fvc::div(fvc::absolute(phi, rho, U)) + ) ); + } - if (LTS) - { - #include "setRDeltaT.H" - } - else + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + } + + ++runTime; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + if (pimple.firstIter() || moveMeshOuterCorrectors) { - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - } - ++runTime; + // Do any mesh changes + mesh.update(); - Info<< "Time = " << runTime.timeName() << nl << endl; + if (mesh.changing()) + { + MRF.update(); - // Store momentum to set rhoUf for introduced faces. - volVectorField rhoU("rhoU", rho*U); + #include "setCellMask.H" - // Do any mesh changes - mesh.update(); + const surfaceScalarField faceMaskOld + ( + localMin<scalar>(mesh).interpolate(cellMask.oldTime()) + ); - if (mesh.changing()) - { - #include "setCellMask.H" - } + // Zero Uf on old faceMask (H-I) + rhoUf() *= faceMaskOld; - if (mesh.changing() && correctPhi) - { - // Calculate absolute flux from the mapped surface velocity - phi = mesh.Sf() & rhoUf; + surfaceVectorField rhoUfint(fvc::interpolate(rho*U)); - #include "correctPhi.H" + // Update Uf and phi on new C-I faces + rhoUf() += (1-faceMaskOld)*rhoUfint; - // Make the fluxes relative to the mesh-motion - fvc::makeRelative(phi, rho, U); - } - } + // Update Uf boundary + forAll(rhoUf().boundaryField(), patchI) + { + rhoUf().boundaryFieldRef()[patchI] = + rhoUfint.boundaryField()[patchI]; + } - if (mesh.changing() && checkMeshCourantNo) - { - #include "meshCourantNo.H" - } + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & rhoUf(); - #include "rhoEqn.H" - Info<< "rhoEqn max/min : " << max(rho).value() - << " " << min(rho).value() << endl; + if (correctPhi) + { + #include "correctPhi.H" + } + + // Zero phi on current H-I + const surfaceScalarField faceMask + ( + localMin<scalar>(mesh).interpolate(cellMask) + ); + + phi *= faceMask; + U *= cellMask; + + // Make the fluxes relative to the mesh-motion + fvc::makeRelative(phi, rho, U); + + } + + if (checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + + if (pimple.firstIter() && !pimple.SIMPLErho()) + { + #include "rhoEqn.H" + } - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { #include "UEqn.H" #include "EEqn.H" @@ -155,6 +197,8 @@ int main(int argc, char *argv[]) } } + rho = thermo.rho(); + runTime.write(); runTime.printExecutionTime(Info); diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H index ec31872e6d432f65d96bbd632d29fc0c736ec296..9c5414fb5c9ac530b67da4f71eaf2d2fb9162447 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H @@ -1,80 +1,93 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); +if (!pimple.SIMPLErho()) +{ + rho = thermo.rho(); +} +// Thermodynamic density needs to be updated by psi*d(p) after the +// pressure solution +const volScalarField psip0(psi*p); -surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); +volScalarField rAU("rAU", 1.0/UEqn.A()); +mesh.interpolate(rAU); -volScalarField rAU(1.0/UEqn.A()); -surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU)); +surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); -HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p); + +HbyA = constrainHbyA(rAU*UEqn.H(), U, p); if (pimple.nCorrPISO() <= 1) { tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + fvc::interpolate(rho)*fvc::flux(HbyA) +); + +if (ddtCorr) +{ + surfaceScalarField faceMaskOld + ( + localMin<scalar>(mesh).interpolate(cellMask.oldTime()) + ); + + phiHbyA += + faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)); +} + +fvc::makeRelative(phiHbyA, rho, U); +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - fvc::makeRelative(phid, psi, U); - MRF.makeRelative(fvc::interpolate(psi), phid); + phiHbyA -= fvc::interpolate(psi*p)*phiHbyA/fvc::interpolate(rho); + + fvScalarMatrix pDDtEqn + ( + fvc::ddt(rho) + psi*correction(fvm::ddt(p)) + + fvc::div(phiHbyA) + fvm::div(phid, p) + == + fvOptions(psi, p, rho.name()) + ); while (pimple.correctNonOrthogonal()) { - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvm::div(phid, p) - - fvm::laplacian(rhorAUf, p) - == - fvOptions(psi, p, rho.name()) - ); + fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAUf, p)); + + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA + fvScalarMatrix pDDtEqn ( - "phiHbyA", - fvc::flux(rho*HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, rhoUf) + fvc::ddt(rho) + psi*correction(fvm::ddt(p)) + + fvc::div(phiHbyA) + == + fvOptions(psi, p, rho.name()) ); - fvc::makeRelative(phiHbyA, rho, U); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (pimple.correctNonOrthogonal()) { - // Pressure corrector - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvc::div(phiHbyA) - - fvm::laplacian(rhorAUf, p) - == - fvOptions(psi, p, rho.name()) - ); + fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAUf, p)); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); @@ -91,25 +104,24 @@ else // Explicitly relax pressure for momentum corrector p.relax(); -// Recalculate density from the relaxed pressure -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); -Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; - volVectorField gradP(fvc::grad(p)); //mesh.interpolate(gradP); -U = HbyA - rAU*cellMask*gradP; +U = cellMask*(HbyA - rAU*gradP); U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); +if (pressureControl.limit(p)) { - rhoUf = fvc::interpolate(rho*U); - surfaceVectorField n(mesh.Sf()/mesh.magSf()); - rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); + p.correctBoundaryConditions(); +} + +thermo.correctRho(psi*p - psip0, rhoMin, rhoMax) ; +rho = thermo.rho(); + +{ + // Correct rhoUf if the mesh is moving + fvc::correctRhoUf(rhoUf, rho, U, phi); } if (thermo.dpdt()) @@ -121,3 +133,9 @@ if (thermo.dpdt()) dpdt -= fvc::div(fvc::meshPhi(rho, U), p); } } + +surfaceScalarField faceMask +( + localMin<scalar>(mesh).interpolate(cellMask) +); +phi *= faceMask; diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H index 08ab3a6af7a80a7054df2c437d903c44a0dd994f..8f43318cabed6e5b0f9b25fbee8cab3d4916c064 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H @@ -1,6 +1,9 @@ #include "readTimeControls.H" -correctPhi = pimple.dict().lookupOrDefault("correctPhi", true); +correctPhi = pimple.dict().lookupOrDefault("correctPhi", false); checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); + + +ddtCorr = pimple.dict().lookupOrDefault("ddtCorr", true); diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H index 625a6b786e9d3f374c6d611ddc2ea1a9348a62f5..142dfa783f7fade62f8b133ea239e23c9524302b 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H @@ -107,7 +107,6 @@ fvOptions.correct(U); Uf += n*(phi/mesh.magSf() - (n & Uf)); } - // Make the fluxes relative to the mesh motion fvc::makeRelative(phi, U); diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/alphaSuSp.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/alphaSuSp.H new file mode 100644 index 0000000000000000000000000000000000000000..6e9483044f9330ab015f287fede696d62980290a --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/alphaSuSp.H @@ -0,0 +1,9 @@ +zeroField Su; +zeroField Sp; + +volScalarField::Internal divU +( + mesh.moving() + ? fvc::div(phiCN() + mesh.phi()) + : fvc::div(phiCN()) +); diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H index cd96b9f5c01d12ea97f41f092980be0fb9a894b1..1174979f41c6232ac41be954932ed3cd36a60c8f 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H @@ -132,10 +132,4 @@ phi -= pcorrEqn.flux(); } } - - //if (runTime.writeTime()) - //{ - // volScalarField("contPhiPcorr", fvc::div(phi)).write(); - // pcorr.write(); - //} } diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H index 9f0ff19da7798b9217f290c8432bdea3724786e6..044859b088165252572f2833c8f0ea558e330709 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H @@ -30,37 +30,31 @@ volVectorField U #include "createPhi.H" +//- Overset specific +// Add solver-specific interpolations +{ + wordHashSet& nonInt = + const_cast<wordHashSet&>(Stencil::New(mesh).nonInterpolatedFields()); + + nonInt.insert("HbyA"); + nonInt.insert("grad(p_rgh)"); + nonInt.insert("nHat"); + nonInt.insert("surfaceIntegrate(phi)"); + nonInt.insert("surfaceIntegrate(phiHbyA)"); + nonInt.insert("cellMask"); + nonInt.insert("cellDisplacement"); + nonInt.insert("interpolatedCells"); + nonInt.insert("cellInterpolationWeight"); + nonInt.insert("pcorr"); +} - //- Overset specific - - // Add solver-specific interpolations - { - dictionary oversetDict; - oversetDict.add("U", true); - oversetDict.add("p", true); - oversetDict.add("HbyA", true); - oversetDict.add("p_rgh", true); - oversetDict.add("alpha1", true); - oversetDict.add("minGradP", true); - - const_cast<dictionary&> - ( - mesh.schemesDict() - ).add - ( - "oversetInterpolationRequired", - oversetDict, - true - ); - } - - // Mask field for zeroing out contributions on hole cells - #include "createCellMask.H" - // Create bool field with interpolated cells - #include "createInterpolatedCells.H" +// Mask field for zeroing out contributions on hole cells +#include "createCellMask.H" +// Create bool field with interpolated cells +#include "createInterpolatedCells.H" Info<< "Reading transportProperties\n" << endl; diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/overInterDyMFoam.C b/applications/solvers/multiphase/interFoam/overInterDyMFoam/overInterDyMFoam.C index 371e253f562b83274a9e67c829ce33fee4798c92..7f1df58eb95f876f7b4486d01eef4bedd76d4393 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/overInterDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/overInterDyMFoam.C @@ -150,23 +150,47 @@ int main(int argc, char *argv[]) // Update cellMask field for blocking out hole cells #include "setCellMask.H" #include "setInterpolatedCells.H" - } - if ((mesh.changing() && correctPhi) || mesh.topoChanging()) - { - // Calculate absolute flux from the mapped surface velocity - // Note: temporary fix until mapped Uf is assessed - Uf = fvc::interpolate(U); + const surfaceScalarField faceMaskOld + ( + localMin<scalar>(mesh).interpolate(cellMask.oldTime()) + ); + + // Zero Uf on old faceMask (H-I) + Uf *= faceMaskOld; + + const surfaceVectorField Uint(fvc::interpolate(U)); + // Update Uf and phi on new C-I faces + Uf += (1-faceMaskOld)*Uint; + + // Update Uf boundary + forAll(Uf.boundaryField(), patchI) + { + Uf.boundaryFieldRef()[patchI] = + Uint.boundaryField()[patchI]; + } - // Calculate absolute flux from the mapped surface velocity phi = mesh.Sf() & Uf; - #include "correctPhi.H" + // Correct phi on individual regions + if (correctPhi) + { + #include "correctPhi.H" + } + + mixture.correct(); + + // Zero phi on current H-I + const surfaceScalarField faceMask + ( + localMin<scalar>(mesh).interpolate(cellMask) + ); + phi *= faceMask; + U *= cellMask; // Make the flux relative to the mesh motion fvc::makeRelative(phi, U); - mixture.correct(); } if (mesh.changing() && checkMeshCourantNo) @@ -175,9 +199,16 @@ int main(int argc, char *argv[]) } } + #include "alphaControls.H" #include "alphaEqnSubCycle.H" + const surfaceScalarField faceMask + ( + localMin<scalar>(mesh).interpolate(cellMask) + ); + rhoPhi *= faceMask; + mixture.correct(); #include "UEqn.H" diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H index 0c63e22006a6ffdb0ec7cfb4b4934e253816265a..8b36eb2347e2a7b4330fafe769bd34f59ea20ce4 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H @@ -1,23 +1,39 @@ { rAU = 1.0/UEqn.A(); + //mesh.interpolate(rAU); + surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + volVectorField H("H", UEqn.H()); + volVectorField HbyA("HbyA", U); //HbyA = rAU*UEqn.H(); - HbyA = constrainHbyA(rAU*UEqn.H(), U, p_rgh); + HbyA = constrainHbyA(rAU*H, U, p_rgh); if (massFluxInterpolation) { #include "interpolatedFaces.H" } + if (runTime.outputTime()) + { + H.write(); + rAU.write(); + HbyA.write(); + } + surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); if (ddtCorr) { - phiHbyA += fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf); + surfaceScalarField faceMaskOld + ( + localMin<scalar>(mesh).interpolate(cellMask.oldTime()) + ); + phiHbyA += + fvc::interpolate(rho*rAU)*faceMaskOld*fvc::ddtCorr(U, Uf); } MRF.makeRelative(phiHbyA); @@ -35,7 +51,6 @@ fvc::makeAbsolute(phiHbyA, U); } - surfaceScalarField phig ( ( @@ -60,7 +75,7 @@ { fvScalarMatrix p_rghEqn ( - fvm::laplacian(faceMask*rAUf, p_rgh) == fvc::div(phiHbyA) + fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) ); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); @@ -73,14 +88,12 @@ p_rgh.relax(); - // Reconstruct body forces (-grad(p) and gh etc) - volVectorField minGradP - ( - "minGradP", - fvc::reconstruct((phig - p_rghEqn.flux())/rAUf) - ); - //U = HbyA + rAU*cellMask*minGradP; - U = fvc::reconstruct(phi); + U = + cellMask* + ( + HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf) + ); + U.correctBoundaryConditions(); fvOptions.correct(U); } @@ -97,16 +110,19 @@ // Make the fluxes relative to the mesh motion fvc::makeRelative(phi, U); + // Zero faces H-I for transport Eq after pEq + phi *= faceMask; + p == p_rgh + rho*gh; if (p_rgh.needReference()) { - p += dimensionedScalar + p_rgh += dimensionedScalar ( - "p", + "p_rgh", p.dimensions(), - pRefValue - getRefCellValue(p, pRefCell) + pRefValue - getRefCellValue(p_rgh, pRefCell) ); - p_rgh = p - rho*gh; + p == p_rgh + rho*gh; } } diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 7168900d6c4375b8cf544eb1487db4d3c9c0eeb1..6632b3a83a51064b9d47e7fc9a54e7e463c90d19 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -977,6 +977,40 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() walkFront(layerRelax, allCellTypes, allWeight); + // Check previous iteration cellTypes_ for any hole->calculated changes + { + label nCalculated = 0; + + forAll(cellTypes_, celli) + { + if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) + { + if (allStencil[celli].size() == 0) + { + FatalErrorInFunction + << "Cell:" << celli + << " at:" << mesh_.cellCentres()[celli] + << " zone:" << zoneID[celli] + << " changed from hole to calculated" + << " but there is no donor" + << exit(FatalError); + } + else + { + allCellTypes[celli] = INTERPOLATED; + nCalculated++; + } + } + } + + if (debug) + { + Pout<< "Detected " << nCalculated << " cells changing from hole" + << " to calculated. Changed these to interpolated" + << endl; + } + } + // Normalise weights, Clear storage forAll(allCellTypes, cellI) { @@ -1060,39 +1094,39 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() } - // Check previous iteration cellTypes_ for any hole->calculated changes - { - label nCalculated = 0; - - forAll(cellTypes_, celli) - { - if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) - { - if (allStencil[celli].size() == 0) - { - FatalErrorInFunction - << "Cell:" << celli - << " at:" << mesh_.cellCentres()[celli] - << " zone:" << zoneID[celli] - << " changed from hole to calculated" - << " but there is no donor" - << exit(FatalError); - } - else - { - allCellTypes[celli] = INTERPOLATED; - nCalculated++; - } - } - } - - if (debug) - { - Pout<< "Detected " << nCalculated << " cells changing from hole" - << " to calculated. Changed these to interpolated" - << endl; - } - } +// // Check previous iteration cellTypes_ for any hole->calculated changes +// { +// label nCalculated = 0; +// +// forAll(cellTypes_, celli) +// { +// if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE) +// { +// if (allStencil[celli].size() == 0) +// { +// FatalErrorInFunction +// << "Cell:" << celli +// << " at:" << mesh_.cellCentres()[celli] +// << " zone:" << zoneID[celli] +// << " changed from hole to calculated" +// << " but there is no donor" +// << exit(FatalError); +// } +// else +// { +// allCellTypes[celli] = INTERPOLATED; +// nCalculated++; +// } +// } +// } +// +// if (debug) +// { +// Pout<< "Detected " << nCalculated << " cells changing from hole" +// << " to calculated. Changed these to interpolated" +// << endl; +// } +// } cellTypes_.transfer(allCellTypes); diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C index 5d8a3fe5f20bc82eec47935d95137efda0eb42ad..bfb2288cf6cb1db9f95c8c184ff4c964d8513f42 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C @@ -335,10 +335,9 @@ void Foam::dynamicOversetFvMesh::addInterpolation(fvMatrix<Type>& m) const lower[facei] = 0.0; } - // For safety we make zero the HOLES const scalar normalisation = V()[celli]; diag[celli] = normalisation; - source[celli] = pTraits<Type>::zero;//normalisation*m.psi()[celli]; + source[celli] = normalisation*m.psi()[celli]; } } diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/T b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/T new file mode 100644 index 0000000000000000000000000000000000000000..50b859927b3cb6370aedd6d327146c5e5d9f750a --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/T @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + "(walls|outlet|inlet)" + { + type zeroGradient; + } + + hole + { + type fixedValue; + value uniform 400; + } + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/U b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..686016a479e433cf611ea29b492d314103d38fa4 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ 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 +{ + #includeEtc "caseDicts/setConstraintTypes" + + walls + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + hole + { + type movingWallVelocity; + value uniform (0 0 0); + } + + outlet + { + type uniformFixedValue; + uniformValue (0 0 0); + } + inlet + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/alphat b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/alphat new file mode 100644 index 0000000000000000000000000000000000000000..4f5befa39d4f464c8144c6c2e8928f466626c5c2 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/alphat @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type compressible::alphatWallFunction;; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/epsilon b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..983cc058b14e80463fb96c18be8f7135e5bc55e3 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/epsilon @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 0.1; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type epsilonWallFunction; + value $internalField; + } + +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/k b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/k new file mode 100644 index 0000000000000000000000000000000000000000..d186d01d4fb88d56555b43ba813a0b86650a724d --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/k @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 0.01; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type kqRWallFunction; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/nut b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/nut new file mode 100644 index 0000000000000000000000000000000000000000..fa2790c57b7b855317beaaf6ca399d662ae34c2e --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/nut @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -1 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type nutkWallFunction; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/p b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/p new file mode 100644 index 0000000000000000000000000000000000000000..418a59ba4cbaa71a01bf5d756b0b9ce57d7e6a89 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/p @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + "(walls|hole|outlet|inlet)" + { + type zeroGradient; + } + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/pointDisplacement b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..f20520b4046fc013bb7f626d672731efbac9d662 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/pointDisplacement @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + ".*" + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + hole + { + type zeroGradient; + } + + overset + { + patchType overset; + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/zoneID b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..165e25275d61b7957bc24d7cd44fd62210c52f30 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/0.orig/zoneID @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus.master.develop | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object zoneID; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allclean b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..aab71fa2ca4ea5faeb699a7c0497ec6841e7bce5 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase0 + +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID +rm -f constant/cellInterpolationWeight + +#------------------------------------------------------------------------------ diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allrun b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..cd2da7c1423e04509786dadd2d9d68f76f1a7d48 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allrun @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions + +./Allrun.pre + +# Serial +runApplication $(getApplication) + +# Parallel +#runApplication decomposePar -cellDist +#runParallel $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allrun.pre b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..abccd3163c95858a729642290f99bd730f2d248b --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/Allrun.pre @@ -0,0 +1,20 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions + +runApplication blockMesh + +# Select cellSets +runApplication -s 1 topoSet + +runApplication subsetMesh box -patch hole -overwrite + +# Select cellSets +runApplication -s 2 topoSet + +restore0Dir + +# Use cellSets to write zoneID +runApplication setFields + +#------------------------------------------------------------------------------ diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/README.txt b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb98b26f8d7b0f7275069a25a70ad38373c539e0 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/README.txt @@ -0,0 +1,3 @@ +Transient, moving mesh +---------------------- +Two turning rotors diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/dynamicMeshDict b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..283e809a4176f2409ae0157b223d3824acbf67e5 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/dynamicMeshDict @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicOversetFvMesh; + +solver multiSolidBodyMotionSolver; + +multiSolidBodyMotionSolverCoeffs +{ + movingZone1 + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0.005 0.005 0.005); + axis (0 0 1); + omega 100.0; + } + } + + movingZone2 + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0.013 0.005 0.005); + axis (0 0 1); + omega -100.0; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/thermophysicalProperties b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..d47cf91cb70206d365c0efd01c47121ef001c5b7 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/thermophysicalProperties @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport sutherland; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 28.9; + } + thermodynamics + { + Cp 1007; + Hf 0; + } + transport + { + As 1.4792e-06; + Ts 116; + } +} + +dpdt true; + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/turbulenceProperties b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..0b94fd597241e4108f2343b9d4f7ba47d1eb7f0e --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/constant/turbulenceProperties @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/blockMeshDict b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..7ce2714e19a9e02796be513842d285deadfe8106 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/blockMeshDict @@ -0,0 +1,165 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 0.01; + +vertices +( + ( 0.00 0.0 0) + ( 2.00 0.0 0) + ( 2.00 1.0 0) + ( 0.00 1.0 0) + ( 0.00 0.0 1) + ( 2.00 0.0 1) + ( 2.00 1.0 1) + ( 0.00 1.0 1) + + // movingZone1 + ( 0.15 0.35 0) + ( 0.85 0.35 0) + ( 0.85 0.65 0) + ( 0.15 0.65 0) + ( 0.15 0.35 1) + ( 0.85 0.35 1) + ( 0.85 0.65 1) + ( 0.15 0.65 1) + +// // movingZone2 + ( 1.15 0.15 0) + ( 1.45 0.15 0) + ( 1.45 0.85 0) + ( 1.15 0.85 0) + ( 1.15 0.15 1) + ( 1.45 0.15 1) + ( 1.45 0.85 1) + ( 1.15 0.85 1) + +// ( 0.75 0.15 0) +// ( 1.05 0.15 0) +// ( 1.05 0.85 0) +// ( 0.75 0.85 0) +// ( 0.75 0.15 1) +// ( 1.05 0.15 1) +// ( 1.05 0.85 1) +// ( 0.75 0.85 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (140 70 1) simpleGrading (1 1 1) + + hex (8 9 10 11 12 13 14 15) movingZone1 (60 24 1) simpleGrading (1 1 1) + + hex (16 17 18 19 20 21 22 23) movingZone2 (24 60 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + overset1 + { + type overset; + faces + ( + ( 8 12 15 11) + (10 14 13 9) + (11 15 14 10) + ( 9 13 12 8) + ); + } + + overset2 + { + type overset; + faces + ( + (16 20 23 19) + (18 22 21 17) + (19 23 22 18) + (17 21 20 16) + ); + } + + walls + { + type wall; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + inlet + { + type wall; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type wall; + faces + ( + (2 6 5 1) + ); + } + + // Populated by subsetMesh + hole + { + type wall; + faces (); + } + + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } + + frontAndBack1 + { + type empty; + faces + ( + ( 8 11 10 9) + (12 13 14 15) + ); + } + + frontAndBack2 + { + type empty; + faces + ( + (16 19 18 17) + (20 21 22 23) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/controlDict b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..b00b45bc7ee1db83f01e7e2e4f58d01dd2f54520 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/controlDict @@ -0,0 +1,127 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("liboverset.so"); + +DebugSwitches +{ + overset 0; + dynamicOversetFvMesh 0; + cellVolumeWeight 0; +} + +application overRhoPimpleDyMFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 1.0; + +deltaT 2e-5; + +writeControl adjustableRunTime; + +writeInterval 0.01; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep true; + +maxCo 0.2; + +functions +{ + // #include "catalyst" + probes + { + type probes; + libs ("libsampling.so"); + + // Name of the directory for probe data + name probes; + + // Write at same frequency as fields + writeControl timeStep; + writeInterval 1; + + // Fields to be probed + fields (p U); + + // Optional: interpolation scheme to use (default is cell) + interpolationScheme cell; + + probeLocations + ( + (0.015 0.005 0.005) + ); + + } + + mass + { + type volFieldValue; + libs ("libfieldFunctionObjects.so"); + + writeControl timeStep; + writeInterval 1; + writeFields false; + log true; + + operation volIntegrate; + + fields + ( + rho + ); + } + + rhoVol + { + libs ("libutilityFunctionObjects.so"); + type coded; + name rhoVolume; + writeControl timeStep; + writeInterval 10; + + codeWrite + #{ + + const volScalarField& rho = + mesh().lookupObject<volScalarField>("rho"); + + Info<< "rho volume = " << rho.weightedAverage(mesh().Vsc()) << endl; + + #}; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/fvSchemes b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..40863a12a918e65bf4b9a3618ef6f55ba9daa4c8 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/fvSchemes @@ -0,0 +1,77 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss upwind; + + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,h) Gauss limitedLinear 1; + div(phi,K) Gauss linear; + + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; + div(meshPhi,p) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; + laplacian(diffusivity,cellDisplacement) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +oversetInterpolation +{ + method cellVolumeWeight; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + +oversetInterpolationSuppressed +{ + grad(p); + surfaceIntegrate(phiHbyA); + //grad(pcorr); + //surfaceIntegrate(((rAUf*magSf)*snGradCorr(pcorr))); +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/fvSolution b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..2e106c6e7855c1423ade1686df1c25a30a569c55 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/fvSolution @@ -0,0 +1,107 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + cellDisplacement + { + solver PCG; + preconditioner DIC; + + tolerance 1e-06; + relTol 0; + maxIter 100; + } + + "(rho|h)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-8; + relTol 0.1; + } + + "(rho|h)Final" + { + $rho; + tolerance 1e-8; + relTol 0; + } + + p + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-11; + relTol 0.01; + } + + pFinal + { + $p; + relTol 0; + } + + pcorr + { + $pFinal; + } + + pcorrFinal + { + $pcorr; + relTol 0; + } + + "(U|k|epsilon)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0; + } + + "(U|k|epsilon)Final" + { + $U; + tolerance 1e-6; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor false; + correctPhi true; + nOuterCorrectors 1; + nCorrectors 4; + nNonOrthogonalCorrectors 0; + ddtCorr false; + +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/setFieldsDict b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..35b2bff4cb17aba7c0a0f054f03a0d82a7992e58 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/setFieldsDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue zoneID 123 +); + +regions +( + // Set cell values + // (does zerogradient on boundaries) + cellToCell + { + set c0; + + fieldValues + ( + volScalarFieldValue zoneID 0 + ); + } + + cellToCell + { + set c1; + + fieldValues + ( + volScalarFieldValue zoneID 1 + ); + } + + cellToCell + { + set c2; + + fieldValues + ( + volScalarFieldValue zoneID 2 + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/topoSetDict b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..1730a01d246c3b8e812f22c8f15cb2721b3b9f79 --- /dev/null +++ b/tutorials/compressible/overRhoPimpleDyMFoam/twoSimpleRotors/system/topoSetDict @@ -0,0 +1,117 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source regionsToCell; + sourceInfo + { + insidePoints ((0.001 0.001 0.001)); + } + } + + { + name c1; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c0; + } + } + + { + name c1; + type cellSet; + action invert; + } + + { + name c2; + type cellSet; + action new; + source regionsToCell; + sourceInfo + { + insidePoints ((0.0116 0.00151 0.001));//((0.0076 0.00151 0.001)); + set c1; + } + } + + { + name c1; + type cellSet; + action delete; + source cellToCell; + sourceInfo + { + set c2; + } + } + + // Select box to remove from region 1 and 2 + + { + name box; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c1; + } + } + + { + name box; + type cellSet; + action add; + source cellToCell; + sourceInfo + { + set c2; + } + } + + { + name box; + type cellSet; + action subset; + source boxToCell; + sourceInfo + { + boxes + ( + (0.0025 0.0045 -100)(0.0075 0.0055 100) + //(0.0085 0.0025 -100)(0.0095 0.0075 100) + (0.0125 0.0025 -100)(0.0135 0.0075 100) + ); + } + } + + { + name box; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict index 103e65031d12de027c58045e9f4556192f88e071..9211acd497255d732e2b435efa484bd2f1b89635 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict @@ -61,6 +61,7 @@ sixDoFRigidBodyMotionCoeffs report on; accelerationRelaxation 0.6; + accelerationDamping 0.9; solver { diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties index 4788c40b670ba08e192c2c22b9fe7e0c7243532b..ec5b45835728762d809479ba3dbbf21a8e271339 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties @@ -30,6 +30,6 @@ air rho rho [ 1 -3 0 0 0 0 0 ] 1; } -sigma sigma [ 1 0 -2 0 0 0 0 ] 0; +sigma sigma [ 1 0 -2 0 0 0 0 ] 0.007; // ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict index 82ef6b83923ca56455eb507e9605495287ab8e98..5e2b8bfe466c96be3007487b977c731a7158812a 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict @@ -18,19 +18,19 @@ scale 1; vertices ( - (0 0 0) - (1 0 0) - (1 1 0) - (0 1 0) - (0 0 1) - (1 0 1) - (1 1 1) - (0 1 1) + (-0.2 -0.2 -0.2) + (1.2 -0.2 -0.2) + (1.2 1.2 -0.2) + (-0.2 1.2 -0.2) + (-0.2 -0.2 1) + (1.2 -0.2 1) + (1.2 1.2 1) + (-0.2 1.2 1) ); blocks ( - hex (0 1 2 3 4 5 6 7) (35 35 35) simpleGrading (1 1 1) + hex (0 1 2 3 4 5 6 7) (80 80 70) simpleGrading (1 1 1) ); edges diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict index 77b7b71e7f57e304694e2956ef1e1edbc3b264ad..522a801578d9c6202d419efeb1ae0b78ff3e39f4 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict @@ -14,24 +14,30 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Load the additional patches, patchFields etc. libs ("liboverset.so"); +DebugSwitches +{ + overset 0; + dynamicOversetFvMesh 0; + cellVolumeWeight 1; +} + application overInterDyMFoam ; -startFrom latestTime;//startTime; +startFrom latestTime; startTime 0.0; stopAt endTime; -endTime 4; +endTime 15; deltaT 0.001; writeControl adjustableRunTime; -writeInterval 0.1; +writeInterval 0.5; purgeWrite 0; @@ -49,8 +55,55 @@ runTimeModifiable yes; adjustTimeStep yes; -maxCo 2.0; +maxCo 1.5; maxAlphaCo 2.0; maxDeltaT 1; +functions +{ + probes + { + type probes; + libs ("libsampling.so"); + + // Name of the directory for probe data + name probes; + + // Write at same frequency as fields + writeControl timeStep; + writeInterval 1; + + // Fields to be probed + fields (p U); + + // Optional: interpolation scheme to use (default is cell) + interpolationScheme cell; + + probeLocations + ( + (0.00132 0.0009 0.005) + ); + + } + + alphaVol + { + libs ("libutilityFunctionObjects.so"); + type coded; + name alphaVolume; + writeControl timeStep; + writeInterval 10; + + codeWrite + #{ + + const volScalarField& alpha = + mesh().lookupObject<volScalarField>("alpha.water"); + + Info<< "Alpha volume = " << alpha.weightedAverage(mesh().Vsc()) << endl; + + #}; + } +} + // ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes index e7c9e1b8130bc5a35a8650746dae7b6f0967130e..7ce5641defbbe9bc20e9f2cf3ad386227abce63a 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes @@ -26,7 +26,7 @@ gradSchemes divSchemes { - div(rhoPhi,U) Gauss limitedLinearV 1; + div(rhoPhi,U) Gauss upwind; div(U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss linear; @@ -54,12 +54,13 @@ snGradSchemes oversetInterpolation { - method inverseDistance; + method cellVolumeWeight; } -oversetInterpolationRequired +oversetInterpolationSuppressed { - alpha.water; + grad(p_rgh); + surfaceIntegrate(phiHbyA); } fluxRequired diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution index 567f719e90fd3e57ca20a3e887b6e269ff5ddb4d..297ac5c0ba32b415c38252285f181e3c88f9c9d9 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution @@ -82,9 +82,8 @@ PIMPLE nCorrectors 2; nNonOrthogonalCorrectors 0; - ddtCorr yes; + ddtCorr yes; correctPhi no; - massFluxInterpolation no; moveMeshOuterCorrectors no; turbOnFinalIterOnly no; @@ -104,8 +103,6 @@ relaxationFactors } cache -{ - grad(U); -} +{} // ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict index bcc00296492b0159bc56e9af64c5f1f82f743283..df1c548cf307643849ff79dec7d73496a959f162 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict @@ -30,9 +30,10 @@ regions boxToCell { - box ( 0.7 0.8 -100 ) ( 100 100 0.75 ); + box ( 0.9 0.9 -100 ) ( 100 100 0.75 ); fieldValues ( volScalarFieldValue alpha.water 1 ); } + cellToCell { set c0; diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict index feffd46222bf0fe699208c5eedd8b9d4987162dd..ed9fc5390ddfb5daa04edec846daf2545d96773d 100644 --- a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict @@ -18,19 +18,19 @@ scale 1; vertices ( - (0.3 0.3 0.1) - (0.7 0.3 0.1) - (0.7 0.7 0.1) - (0.3 0.7 0.1) - (0.3 0.3 0.8) - (0.7 0.3 0.8) - (0.7 0.7 0.8) - (0.3 0.7 0.8) + (0.2 0.2 0.1) + (0.8 0.2 0.1) + (0.8 0.8 0.1) + (0.2 0.8 0.1) + (0.2 0.2 0.8) + (0.8 0.2 0.8) + (0.8 0.8 0.8) + (0.2 0.8 0.8) ); blocks ( - hex (0 1 2 3 4 5 6 7) (20 20 30) simpleGrading (1 1 1) + hex (0 1 2 3 4 5 6 7) (40 40 45) simpleGrading (1 1 1) ); edges diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/U b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..686016a479e433cf611ea29b492d314103d38fa4 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ 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 +{ + #includeEtc "caseDicts/setConstraintTypes" + + walls + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + hole + { + type movingWallVelocity; + value uniform (0 0 0); + } + + outlet + { + type uniformFixedValue; + uniformValue (0 0 0); + } + inlet + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/alpha.water b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..75f63e7fa85c15dc9713b5f7baae29ed723a03c9 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/alpha.water @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ 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 +{ + #includeEtc "caseDicts/setConstraintTypes" + + "(walls|hole|inlet|outlet)" + { + type zeroGradient; + } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/epsilon b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..983cc058b14e80463fb96c18be8f7135e5bc55e3 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/epsilon @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 0.1; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type epsilonWallFunction; + value $internalField; + } + +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/k b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/k new file mode 100644 index 0000000000000000000000000000000000000000..d186d01d4fb88d56555b43ba813a0b86650a724d --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/k @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 0.01; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type kqRWallFunction; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/nut b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/nut new file mode 100644 index 0000000000000000000000000000000000000000..fa2790c57b7b855317beaaf6ca399d662ae34c2e --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/nut @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -1 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + "(walls|hole|inlet|outlet)" + { + type nutkWallFunction; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/p b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/p new file mode 100644 index 0000000000000000000000000000000000000000..33e3ae160c49a4a471a50a530158b8d91884c47a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/p @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + "(walls|hole|outlet|inlet)" + { + type calculated; + } + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/p_rgh b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..5a48b9ede6f1059641a3c02d929e97a8d6e411e2 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/p_rgh @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + oversetPatch + { + type overset; + } + "(walls|hole|outlet|inlet)" + { + type fixedFluxPressure; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/pointDisplacement b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..f20520b4046fc013bb7f626d672731efbac9d662 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/pointDisplacement @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + ".*" + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + hole + { + type zeroGradient; + } + + overset + { + patchType overset; + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/zoneID b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..98164a63614c92098b66a8cb19e53068acf3a405 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/0.orig/zoneID @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object zoneID; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allclean b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..aab71fa2ca4ea5faeb699a7c0497ec6841e7bce5 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase0 + +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID +rm -f constant/cellInterpolationWeight + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allrun b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..10707b2f2cd6e6f7f93215994e02b164f8de426a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allrun @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions + +./Allrun.pre + +# Serial +#runApplication $(getApplication) + +# Parallel +runApplication decomposePar -cellDist +runParallel $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allrun.pre b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..abccd3163c95858a729642290f99bd730f2d248b --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/Allrun.pre @@ -0,0 +1,20 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions + +runApplication blockMesh + +# Select cellSets +runApplication -s 1 topoSet + +runApplication subsetMesh box -patch hole -overwrite + +# Select cellSets +runApplication -s 2 topoSet + +restore0Dir + +# Use cellSets to write zoneID +runApplication setFields + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/dynamicMeshDict b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..17d7917db0f73f4a6ee0c810c77c1fe4b279ae9b --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/dynamicMeshDict @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +// layerRelax 0.3; +} + +solver multiSolidBodyMotionSolver; + +multiSolidBodyMotionSolverCoeffs +{ + movingZone1 + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0.005 0.005 0.005); + axis (0 0 1); + omega 20.0; + } + } + + movingZone2 + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0.013 0.005 0.005); + axis (0 0 1); + omega -20.0; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/g b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..6df9e978d609dde378c2ee9d268c0983dde23640 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/g @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/transportProperties b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..f8f222f61ea40059e8054b833116164878cb20d2 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/transportProperties @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + 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.0; + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/turbulenceProperties b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..88f8c6831db2871b84b57edf526d2da3e79f7f1a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/constant/turbulenceProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/blockMeshDict b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..c4963583230f74658474fc423a5be74c204835fd --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/blockMeshDict @@ -0,0 +1,156 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 0.01; + +vertices +( + ( 0.00 0.0 0) + ( 2.00 0.0 0) + ( 2.00 1.0 0) + ( 0.00 1.0 0) + ( 0.00 0.0 1) + ( 2.00 0.0 1) + ( 2.00 1.0 1) + ( 0.00 1.0 1) + + // movingZone1 + ( 0.15 0.35 0) + ( 0.85 0.35 0) + ( 0.85 0.65 0) + ( 0.15 0.65 0) + ( 0.15 0.35 1) + ( 0.85 0.35 1) + ( 0.85 0.65 1) + ( 0.15 0.65 1) + + // movingZone2 + ( 1.15 0.15 0) + ( 1.45 0.15 0) + ( 1.45 0.85 0) + ( 1.15 0.85 0) + ( 1.15 0.15 1) + ( 1.45 0.15 1) + ( 1.45 0.85 1) + ( 1.15 0.85 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (140 70 1) simpleGrading (1 1 1) + + hex (8 9 10 11 12 13 14 15) movingZone1 (60 24 1) simpleGrading (1 1 1) + + hex (16 17 18 19 20 21 22 23) movingZone2 (24 60 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + overset1 + { + type overset; + faces + ( + ( 8 12 15 11) + (10 14 13 9) + (11 15 14 10) + ( 9 13 12 8) + ); + } + + overset2 + { + type overset; + faces + ( + (16 20 23 19) + (18 22 21 17) + (19 23 22 18) + (17 21 20 16) + ); + } + + walls + { + type wall; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + inlet + { + type wall; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type wall; + faces + ( + (2 6 5 1) + ); + } + + // Populated by subsetMesh + hole + { + type wall; + faces (); + } + + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } + + frontAndBack1 + { + type empty; + faces + ( + ( 8 11 10 9) + (12 13 14 15) + ); + } + + frontAndBack2 + { + type empty; + faces + ( + (16 19 18 17) + (20 21 22 23) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/controlDict b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..c9aeb4889a2ddca4c63f490d386972bfdd9d3183 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/controlDict @@ -0,0 +1,110 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("liboverset.so"); + +DebugSwitches +{ + overset 0; + dynamicOversetFvMesh 0; + cellVolumeWeight 0; +} + +application overInterDyMFoam ; + +startFrom latestTime; + +startTime 0.0; + +stopAt endTime; + +endTime 2; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.01; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 12; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 1.5; +maxAlphaCo 2.0; +maxDeltaT 1; + +functions +{ + probes + { + type probes; + libs ("libsampling.so"); + + // Name of the directory for probe data + name probes; + + // Write at same frequency as fields + writeControl timeStep; + writeInterval 1; + + // Fields to be probed + fields (p U); + + // Optional: interpolation scheme to use (default is cell) + interpolationScheme cell; + + probeLocations + ( + (0.0009999 0.0015 0.003) + ); + + } + + alphaVol + { + libs ("libutilityFunctionObjects.so"); + type coded; + name alphaVolume; + writeControl timeStep; + writeInterval 10; + + codeWrite + #{ + + const volScalarField& alpha = + mesh().lookupObject<volScalarField>("alpha.water"); + + Info<< "Alpha volume = " << alpha.weightedAverage(mesh().Vsc()) + << endl; + + #}; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/decomposeParDict b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..8fa48d97e2ba9f46244320b031c4365052bf708a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/decomposeParDict @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 3; + +method hierarchical; + +coeffs +{ + n (3 1 1); + //delta 0.001; // default=0.001 + //order xyz; // default=xzy +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/fvSchemes b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..47818fa1a48d20b7e7e99fee673d5275c155a93d --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/fvSchemes @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(T) Gauss linear; +} + +divSchemes +{ + default none; + + div(rhoPhi,U) Gauss upwind; + div(U) Gauss linear; + + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + + div(phi,alpha.water) Gauss upwind; + + div(phi,epsilon) Gauss upwind; + div(phi,k) Gauss upwind; + + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +oversetInterpolation +{ + method cellVolumeWeight; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + +oversetInterpolationSuppressed +{ + grad(p_rgh); + surfaceIntegrate(phiHbyA); +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/fvSolution b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..1a663cefa90bf37cf9dde9d80b2b7c84db352c78 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/fvSolution @@ -0,0 +1,117 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + cellDisplacement + { + solver PCG; + preconditioner DIC; + + tolerance 1e-06; + relTol 0; + maxIter 100; + } + + "alpha.water.*" + { + nAlphaCorr 3; + nAlphaSubCycles 2; + cAlpha 1; + icAlpha 0; + scAlpha 0; + + MULESCorr yes; + nLimiterIter 5; + alphaApplyPrevCorr no; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + p_rgh + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-12; + relTol 0.01; + maxIter 500; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + pcorr + { + $p; + solver PCG; + preconditioner DIC; + } + + pcorrFinal + { + $pcorr; + relTol 0; + } + + "(U|k|epsilon)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0.01; + maxIter 200; + minIter 1; + } + + "(U|k|epsilon)Final" + { + $U; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + correctPhi no; + nOuterCorrectors 2; + nCorrectors 3; + nNonOrthogonalCorrectors 0; + + ddtCorr true; + + pRefPoint (0.0002 0.0099 0.001); + pRefValue 0.0; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/setFieldsDict b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..6f4cbdbfd81e83922db8d93582ac2de975e2cae2 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/setFieldsDict @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue zoneID 123 + volScalarFieldValue alpha.water 0 +); + +regions +( + // Set cell values + // (does zerogradient on boundaries) + cellToCell + { + set c0; + + fieldValues + ( + volScalarFieldValue zoneID 0 + ); + } + + cellToCell + { + set c1; + + fieldValues + ( + volScalarFieldValue zoneID 1 + ); + } + + cellToCell + { + set c2; + + fieldValues + ( + volScalarFieldValue zoneID 2 + ); + } + + boxToCell + { + box ( -100 -100 -100 ) ( 100 0.005 100 ); + fieldValues ( volScalarFieldValue alpha.water 1 ); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/topoSetDict b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..6fb992b37a846e2dc759c741455bbc9acfdb3eaa --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/twoSimpleRotors/system/topoSetDict @@ -0,0 +1,116 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source regionsToCell; + sourceInfo + { + insidePoints ((0.001 0.001 0.001)); + } + } + + { + name c1; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c0; + } + } + + { + name c1; + type cellSet; + action invert; + } + + { + name c2; + type cellSet; + action new; + source regionsToCell; + sourceInfo + { + insidePoints ((0.0116 0.00151 0.001)); + set c1; + } + } + + { + name c1; + type cellSet; + action delete; + source cellToCell; + sourceInfo + { + set c2; + } + } + + // Select box to remove from region 1 and 2 + + { + name box; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c1; + } + } + + { + name box; + type cellSet; + action add; + source cellToCell; + sourceInfo + { + set c2; + } + } + + { + name box; + type cellSet; + action subset; + source boxToCell; + sourceInfo + { + boxes + ( + (0.0025 0.0045 -100)(0.0075 0.0055 100) + (0.0125 0.0025 -100)(0.0135 0.0075 100) + ); + } + } + + { + name box; + type cellSet; + action invert; + } +); + +// ************************************************************************* //