diff --git a/README.md b/README.md index aec529e09f0bfe6dbd3c89a9e872af9de9f05570..fed8a6e758486583291242b3e023f8d3e6b41545 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ OpenCFD Ltd grants use of the OpenFOAM trademark by Third Parties on a licence b Please [contact OpenCFD](http://www.openfoam.com/contact) if you have any questions on the use of the OpenFOAM trademark. -Violations of the Trademark are continuously monitored, and will be duly prosecuted. +Violations of the Trademark are continuously monitored, and will be duly prosecuted. # Useful Links diff --git a/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/Make/files b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..0c6257a79d716297271fc3069203c87368f76698 --- /dev/null +++ b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/Make/files @@ -0,0 +1,3 @@ +laplacianDyMFoam.C + +EXE = $(FOAM_APPBIN)/overLaplacianDyMFoam diff --git a/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/Make/options b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..149f9694b6daaa40691d95b746292c859b348034 --- /dev/null +++ b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/Make/options @@ -0,0 +1,8 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/overset/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -loverset diff --git a/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/createFields.H b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..d14935caab629c166e286d9cdbb1aed8bae50561 --- /dev/null +++ b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/createFields.H @@ -0,0 +1,53 @@ + Info<< "Reading field T\n" << endl; + + volScalarField T + ( + IOobject + ( + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + // Add overset specific interpolations + { + dictionary oversetDict; + oversetDict.add("T", true); + + const_cast<dictionary&> + ( + mesh.schemesDict() + ).add + ( + "oversetInterpolationRequired", + oversetDict, + true + ); + } + + + Info<< "Reading transportProperties\n" << endl; + + IOdictionary transportProperties + ( + IOobject + ( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + + Info<< "Reading diffusivity DT\n" << endl; + + dimensionedScalar DT + ( + transportProperties.lookup("DT") + ); diff --git a/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/laplacianDyMFoam.C b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/laplacianDyMFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..7bcd6b6cb608a2aee3b5d1b319b69ec3d5c061bb --- /dev/null +++ b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/laplacianDyMFoam.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 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/>. + +Application + laplacianFoam + +Group + grpBasicSolvers + +Description + Laplace equation solver for a scalar quantity. + + \heading Solver details + The solver is applicable to, e.g. for thermal diffusion in a solid. The + equation is given by: + + \f[ + \ddt{T} = \div \left( D_T \grad T \right) + \f] + + Where: + \vartable + T | Scalar field which is solved for, e.g. temperature + D_T | Diffusion coefficient + \endvartable + + \heading Required fields + \plaintable + T | Scalar field which is solved for, e.g. temperature + \endplaintable + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "fvOptions.H" +#include "simpleControl.H" +#include "dynamicFvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createNamedDynamicFvMesh.H" + + simpleControl simple(mesh); + + #include "createFields.H" + #include "createFvOptions.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nCalculating temperature distribution\n" << endl; + + while (simple.loop()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + mesh.update(); + + while (simple.correctNonOrthogonal()) + { + fvScalarMatrix TEqn + ( + fvm::ddt(T) - fvm::laplacian(DT, T) + == + fvOptions(T) + ); + + fvOptions.constrain(TEqn); + TEqn.solve(); + fvOptions.correct(T); + } + + #include "write.H" + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/write.H b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/write.H new file mode 100644 index 0000000000000000000000000000000000000000..47aa182c0a986f6ca07a494623e4d59ae792b6d9 --- /dev/null +++ b/applications/solvers/basic/laplacianFoam/overLaplacianDyMFoam/write.H @@ -0,0 +1,46 @@ + if (runTime.outputTime()) + { + volVectorField gradT(fvc::grad(T)); + + volScalarField gradTx + ( + IOobject + ( + "gradTx", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + gradT.component(vector::X) + ); + + volScalarField gradTy + ( + IOobject + ( + "gradTy", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + gradT.component(vector::Y) + ); + + volScalarField gradTz + ( + IOobject + ( + "gradTz", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + gradT.component(vector::Z) + ); + + + runTime.write(); + } diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/Make/files b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..3d96a548d05756a8817ee5b909ab9177a6bd597e --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/Make/files @@ -0,0 +1,3 @@ +rhoPimpleDyMFoam.C + +EXE = $(FOAM_APPBIN)/overRhoPimpleDyMFoam diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..ca5b141675bbf9556f0af66ee616e40b4b917800 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/Make/options @@ -0,0 +1,25 @@ +EXE_INC = \ + -I.. \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/overset/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +EXE_LIBS = \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lspecie \ + -lturbulenceModels \ + -lcompressibleTurbulenceModels \ + -loverset \ + -lfvOptions \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H new file mode 100644 index 0000000000000000000000000000000000000000..37072312ff88b09d5a7e600de73bcfa5b7f7f13f --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/correctPhi.H @@ -0,0 +1,11 @@ +CorrectPhi +( + U, + phi, + p, + rho, + psi, + dimensionedScalar("rAUf", dimTime, 1), + divrhoU, + pimple +); diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H new file mode 100644 index 0000000000000000000000000000000000000000..aed0e76956bb40c41b7cbf25aea54d7a77a03b67 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createControls.H @@ -0,0 +1,11 @@ +#include "createTimeControls.H" + +bool correctPhi +( + pimple.dict().lookupOrDefault<Switch>("correctPhi", true) +); + +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false) +); diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..27f568bce704ebd8484bc73f2fb3ce009e94b0e6 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H @@ -0,0 +1,117 @@ +Info<< "Reading thermophysical properties\n" << endl; + +autoPtr<psiThermo> pThermo +( + psiThermo::New(mesh) +); +psiThermo& thermo = pThermo(); +thermo.validate(args.executable(), "h", "e"); + +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); + +volScalarField rho +( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + +dimensionedScalar rhoMax +( + dimensionedScalar::lookupOrDefault + ( + "rhoMax", + pimple.dict(), + dimDensity, + GREAT + ) +); + +dimensionedScalar rhoMin +( + dimensionedScalar::lookupOrDefault + ( + "rhoMin", + pimple.dict(), + dimDensity, + 0 + ) +); + +Info<< "Creating turbulence model\n" << endl; +autoPtr<compressible::turbulenceModel> turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +mesh.setFluxRequired(p.name()); + +Info<< "Creating field dpdt\n" << endl; +volScalarField dpdt +( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) +); + +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); + + +//- 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 + ); +} + +// Mask field for zeroing out contributions on hole cells +#include "createCellMask.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..5f1fc7451c2e41d21061dba1cdeb96f2cee151d0 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H @@ -0,0 +1,123 @@ +rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); +rho.relax(); + +surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); + +volScalarField rAU(1.0/UEqn.A()); +surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU)); +volVectorField HbyA("HbyA", constrainHbyA(rAU*UEqn.H(), U, p)); +//mesh.interpolate(HbyA); + +if (pimple.nCorrPISO() <= 1) +{ + tUEqn.clear(); +} + +if (pimple.transonic()) +{ + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi) + *( + fvc::flux(HbyA) + + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho) + ) + ); + + fvc::makeRelative(phid, psi, U); + MRF.makeRelative(fvc::interpolate(psi), phid); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvm::div(phid, p) + - fvm::laplacian(rhorAUf, p) + == + fvOptions(psi, p, rho.name()) + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi == pEqn.flux(); + } + } +} +else +{ + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::flux(rho*HbyA) + + rhorAUf*fvc::ddtCorr(rho, U, 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); + + while (pimple.correctNonOrthogonal()) + { + // Pressure corrector + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvc::div(phiHbyA) + - fvm::laplacian(rhorAUf, p) + == + fvOptions(psi, p, rho.name()) + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqn.flux(); + } + } +} + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +// 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.correctBoundaryConditions(); +fvOptions.correct(U); +K = 0.5*magSqr(U); + +{ + rhoUf = fvc::interpolate(rho*U); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); +} + +if (thermo.dpdt()) +{ + dpdt = fvc::ddt(p); + + if (mesh.moving()) + { + dpdt -= fvc::div(fvc::meshPhi(rho, U), p); + } +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H new file mode 100644 index 0000000000000000000000000000000000000000..ed2db49fb4dcc9ffd3084f3beda346b118d1eaa4 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/readControls.H @@ -0,0 +1,6 @@ +#include "readTimeControls.H" + +correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true); + +checkMeshCourantNo = + pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false); diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/rhoPimpleDyMFoam.C b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/rhoPimpleDyMFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..0bbcefa14bc0781ebad06a96505e2e25d2ad7c76 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/rhoPimpleDyMFoam.C @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 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/>. + +Application + rhoPimpleFoam + +Group + grpCompressibleSolvers grpMovingMeshSolvers + +Description + Transient solver for laminar or turbulent flow of compressible fluids + for HVAC and similar applications. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient simulations. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "psiThermo.H" +#include "turbulentFluidThermoModel.H" +#include "bound.H" +#include "pimpleControl.H" +#include "CorrectPhi.H" +#include "fvOptions.H" +#include "localEulerDdtScheme.H" +#include "fvcSmooth.H" +#include "cellCellStencilObject.H" +#include "localMin.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + + pimpleControl pimple(mesh); + + #include "createRDeltaT.H" + #include "initContinuityErrs.H" + #include "createFields.H" + #include "createMRF.H" + #include "createFvOptions.H" + #include "createRhoUf.H" + #include "createControls.H" + + turbulence->validate(); + + if (!LTS) + { + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + } + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.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 + volScalarField divrhoU + ( + "divrhoU", + fvc::div(fvc::absolute(phi, rho, U)) + ); + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + } + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // Store momentum to set rhoUf for introduced faces. + volVectorField rhoU("rhoU", rho*U); + + // Do any mesh changes + mesh.update(); + + if (mesh.changing()) + { + #include "setCellMask.H" + } + + if (mesh.changing() && correctPhi) + { + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & rhoUf; + + #include "correctPhi.H" + + // Make the fluxes relative to the mesh-motion + fvc::makeRelative(phi, rho, U); + } + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + + #include "rhoEqn.H" + Info<< "rhoEqn max/min : " << max(rho).value() + << " " << min(rho).value() << endl; + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H new file mode 100644 index 0000000000000000000000000000000000000000..6353e7908fb88258cbcc2603939a1c9cab1d21e3 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 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 + CourantNo + +Description + Calculates and outputs the mean and maximum Courant Numbers. + +\*---------------------------------------------------------------------------*/ + +scalar CoNum = 0.0; +scalar meanCoNum = 0.0; + +if (mesh.nInternalFaces()) +{ + surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask)); + + scalarField sumPhi(fvc::surfaceSum(mag(phiMask*phi))().internalField()); + + CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + + meanCoNum = + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); +} + +Info<< "Courant Number mean: " << meanCoNum + << " max: " << CoNum << endl; + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..7c557aba244cd613c7df09f68373cd8d4a669628 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files @@ -0,0 +1,3 @@ +pimpleDyMFoam.C + +EXE = $(FOAM_APPBIN)/overPimpleDyMFoam diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..c538a99b574db3b5ab061afad109aa71e92ef351 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/options @@ -0,0 +1,24 @@ +EXE_INC = \ + -I.. \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/overset/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +EXE_LIBS = \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lfvOptions \ + -lsampling \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh \ + -loverset diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..aef0116f7b3c3e3e207b0b49be5115d07f7e2549 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/UEqn.H @@ -0,0 +1,24 @@ +// Solve the Momentum equation + +MRF.correctBoundaryVelocity(U); + +tmp<fvVectorMatrix> tUEqn +( + fvm::ddt(U) + fvm::div(phi, U) + + MRF.DDt(U) + + turbulence->divDevReff(U) + == + fvOptions(U) +); +fvVectorMatrix& UEqn = tUEqn.ref(); + +UEqn.relax(); + +fvOptions.constrain(UEqn); + +if (pimple.momentumPredictor()) +{ + solve(UEqn == -cellMask*fvc::grad(p)); + + fvOptions.correct(U); +} diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/continuityErrs.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/continuityErrs.H new file mode 100644 index 0000000000000000000000000000000000000000..c7870556230e049e54e727f8e26f8c68a1e810c4 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/continuityErrs.H @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 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. + +\*---------------------------------------------------------------------------*/ + +{ + volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi)); + + scalar sumLocalContErr = runTime.deltaTValue()* + mag(contErr)().weightedAverage(mesh.V()).value(); + + scalar globalContErr = runTime.deltaTValue()* + contErr.weightedAverage(mesh.V()).value(); + cumulativeContErr += globalContErr; + + Info<< "time step continuity errors : sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr + << endl; +} + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H new file mode 100644 index 0000000000000000000000000000000000000000..1951316f46ac4feeda1009c73ea90def09cb7b99 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H @@ -0,0 +1,113 @@ +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] = 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("pcorr", p.dimensions(), 0.0), + pcorrTypes + ); + +{ + dimensionedScalar rAUf("rAUf", dimTime, 1.0); + + const cellCellStencilObject& overlap = Stencil::New(mesh); + const labelList& cellTypes = overlap.cellTypes(); + const labelIOList& zoneIDs = overlap.zoneID(); + + while (pimple.correctNonOrthogonal()) + { + label nZones = gMax(zoneIDs)+1; + + //label refCellI2 = -1; + labelList refCells(nZones, -1); + labelList refZones(nZones, -1); + + forAll(zoneIDs, cellI) + { + label zoneId = zoneIDs[cellI]; + if + ( + refCells[zoneId] == -1 + && cellTypes[cellI] == cellCellStencil::CALCULATED + && refZones[zoneId] == -1 + ) + { + refCells[zoneId] = cellI; + refZones[zoneId] = zoneId; + } + } + + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(rAUf, pcorr) == fvc::div(phi) + ); + + //pcorrEqn.setReference(refCellI2, 0.0, true); + scalarList values(nZones, 0.0); + pcorrEqn.setReferences(refCells, values, true); + + const dictionary& d = mesh.solver + ( + pcorr.select + ( + pimple.finalInnerIter() + ) + ); + mesh.fvMesh::solve(pcorrEqn, d); + + if (pimple.finalNonOrthogonalIter()) + { + phi -= pcorrEqn.flux(); + } + } + + if (runTime.outputTime()) + { + volScalarField("contPhiPcorr", fvc::div(phi)).write(); + pcorr.write(); + } +} diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createControls.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createControls.H new file mode 100644 index 0000000000000000000000000000000000000000..53ed2009c74abfcc19d9fb29febb89b47aa88916 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createControls.H @@ -0,0 +1,26 @@ +#include "createTimeControls.H" + +bool correctPhi +( + pimple.dict().lookupOrDefault("correctPhi", false) +); + +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) +); + +bool massFluxInterpolation +( + pimple.dict().lookupOrDefault("massFluxInterpolation", false) +); + +bool adjustFringe +( + pimple.dict().lookupOrDefault("oversetAdjustPhi", false) +); + +bool ddtCorr +( + pimple.dict().lookupOrDefault("ddtCorr", true) +); diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..ba991bfd48441c75289d837a3274afbd1dbe9ee8 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H @@ -0,0 +1,70 @@ +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, pimple.dict(), pRefCell, pRefValue); +mesh.setFluxRequired(p.name()); + + +//- 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 + ); +} + +// Mask field for zeroing out contributions on hole cells +#include "createCellMask.H" + +// Create bool field with interpolated cells +#include "createInterpolatedCells.H" + +singlePhaseTransportModel laminarTransport(U, phi); + +autoPtr<incompressible::turbulenceModel> turbulence +( + incompressible::turbulenceModel::New(U, phi, laminarTransport) +); diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/interpolatedFaces.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/interpolatedFaces.H new file mode 100644 index 0000000000000000000000000000000000000000..e13a2cc0a7c9d0d708fa1d4764097ff1bcc3cce8 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/interpolatedFaces.H @@ -0,0 +1,269 @@ +// Interpolation used +interpolationCellPoint<vector> UInterpolator(HbyA); + +// Determine faces on outside of interpolated cells +PackedBoolList isOwnerInterpolatedFace(mesh.nInternalFaces()); +PackedBoolList isNeiInterpolatedFace(mesh.nInternalFaces()); + +// Determine donor cells +labelListList donorCell(mesh.nInternalFaces()); + +scalarListList weightCellCells(mesh.nInternalFaces()); + +// Interpolated HbyA faces +vectorField UIntFaces(mesh.nInternalFaces(), vector::zero); + +// Determine receptor neighbourd cells +labelList receptorNeigCell(mesh.nInternalFaces(), -1); + +{ + const cellCellStencilObject& overlap = Stencil::New(mesh); + const labelList& cellTypes = overlap.cellTypes(); + const labelIOList& zoneID = overlap.zoneID(); + + label nZones = gMax(zoneID)+1; + PtrList<fvMeshSubset> meshParts(nZones); + labelList nCellsPerZone(nZones, 0); + + forAll(nCellsPerZone, zoneI) + { + meshParts.set(zoneI, new fvMeshSubset(mesh)); + meshParts[zoneI].setLargeCellSubset(zoneID, zoneI); + } + + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label ownType = cellTypes[mesh.faceOwner()[faceI]]; + label neiType = cellTypes[mesh.faceNeighbour()[faceI]]; + if + ( + ownType == cellCellStencil::INTERPOLATED + && neiType == cellCellStencil::CALCULATED + ) + { + isOwnerInterpolatedFace[faceI] = true; + + const vector& fc = mesh.faceCentres()[faceI]; + + for (label zoneI = 0; zoneI < nZones; zoneI++) + { + if (zoneI != zoneID[mesh.faceOwner()[faceI]]) + { + const fvMesh& partMesh = meshParts[zoneI].subMesh(); + const labelList& cellMap = meshParts[zoneI].cellMap(); + label cellI = partMesh.findCell(fc); + + if (cellI != -1) + { + // Determine weights + labelList stencil(partMesh.cellCells()[cellI]); + + stencil.append(cellI); + + label st = stencil.size(); + + donorCell[faceI].setSize(st); + + weightCellCells[faceI].setSize(st); + + scalarField weights(st); + + forAll(stencil, i) + { + scalar d = mag + ( + partMesh.cellCentres()[stencil[i]] + - fc + ); + weights[i] = 1.0/d; + donorCell[faceI][i] = cellMap[stencil[i]]; + } + weights /= sum(weights); + + weightCellCells[faceI] = weights; + + forAll(stencil, i) + { + UIntFaces[faceI] += + weightCellCells[faceI][i] + *UInterpolator.interpolate + ( + fc, + donorCell[faceI][i] + ); + } + + break; + } + } + } + + receptorNeigCell[faceI] = mesh.faceNeighbour()[faceI]; + } + else if + ( + ownType == cellCellStencil::CALCULATED + && neiType == cellCellStencil::INTERPOLATED + ) + { + isNeiInterpolatedFace[faceI] = true; + + const vector& fc = mesh.faceCentres()[faceI]; + for (label zoneI = 0; zoneI < nZones; zoneI++) + { + if (zoneI != zoneID[mesh.faceNeighbour()[faceI]]) + { + const fvMesh& partMesh = meshParts[zoneI].subMesh(); + const labelList& cellMap = meshParts[zoneI].cellMap(); + label cellI = partMesh.findCell(fc); + + if (cellI != -1) + { + // Determine weights + labelList stencil(partMesh.cellCells()[cellI]); + + stencil.append(cellI); + + label st = stencil.size(); + + donorCell[faceI].setSize(st); + + weightCellCells[faceI].setSize(st); + + scalarField weights(st); + + forAll(stencil, i) + { + scalar d = mag + ( + partMesh.cellCentres()[stencil[i]] + - fc + ); + weights[i] = 1.0/d; + donorCell[faceI][i] = cellMap[stencil[i]]; + } + weights /= sum(weights); + + weightCellCells[faceI] = weights; + + forAll(stencil, i) + { + UIntFaces[faceI] += + weightCellCells[faceI][i] + *UInterpolator.interpolate + ( + fc, + donorCell[faceI][i] + ); + } + + break; + } + } + } + + receptorNeigCell[faceI] = mesh.faceOwner()[faceI]; + } + } +} + +// contravariant U +vectorField U1Contrav(mesh.nInternalFaces(), vector::zero); + +surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf()); + +forAll(isNeiInterpolatedFace, faceI) +{ + label cellId = -1; + if (isNeiInterpolatedFace[faceI]) + { + cellId = mesh.faceNeighbour()[faceI]; + } + else if (isOwnerInterpolatedFace[faceI]) + { + cellId = mesh.faceOwner()[faceI]; + } + + if (cellId != -1) + { + const vector& n = faceNormals[faceI]; + vector n1 = vector::zero; + // 2-D cases + if (mesh.nSolutionD() == 2) + { + for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) + { + if (mesh.geometricD()[cmpt] == -1) + { + switch (cmpt) + { + case vector::X: + { + n1 = vector(0, n.z(), -n.y()); + break; + } + + case vector::Y: + { + n1 = vector(n.z(), 0, -n.x()); + break; + } + + case vector::Z: + { + n1 = vector(n.y(), -n.x(), 0); + break; + } + } + } + } + } + else if (mesh.nSolutionD() == 3) + { + //Determine which is the primary direction + if (mag(n.x()) > mag(n.y()) && mag(n.x()) > mag(n.z())) + { + n1 = vector(n.y(), -n.x(), 0); + } + else if (mag(n.y()) > mag(n.z())) + { + n1 = vector(0, n.z(), -n.y()); + } + else + { + n1 = vector(-n.z(), 0, n.x()); + } + } + + n1 /= mag(n1); + + vector n2 = n ^ n1; + n2 /= mag(n2); + + tensor rot = + tensor + ( + n.x() ,n.y(), n.z(), + n1.x() ,n1.y(), n1.z(), + n2.x() ,n2.y(), n2.z() + ); + +// tensor rot = +// tensor +// ( +// n & x ,n & y, n & z, +// n1 & x ,n1 & y, n1 & z, +// n2 & x ,n2 & y, n2 & z +// ); + + U1Contrav[faceI].x() = + 2*transform(rot, UIntFaces[faceI]).x() + - transform(rot, HbyA[receptorNeigCell[faceI]]).x(); + + U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y(); + + U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z(); + + HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]); + } +} diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..028dfe4306b23874fa5c5c40c68ce2dbbb5ae263 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H @@ -0,0 +1,109 @@ +volScalarField rAU(1.0/UEqn.A()); + +// Option 1: interpolate rAU, do not block out rAU on blocked cells +//mesh.interpolate(rAU, false); +//surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + +// Option 2: do not interpolate rAU but block out rAU +//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU)); + + +// Option 3: do not interpolate rAU but zero out rAUf on faces on holes +// But what about: +// +// H +// H I C C C C +// H +// + +surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); +surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU)); + +volVectorField HbyA("HbyA", U); +HbyA = constrainHbyA(rAU*UEqn.H(), U, p); + +//mesh.interpolate(HbyA); +if (massFluxInterpolation) +{ + #include "interpolatedFaces.H" +} + +if (pimple.nCorrPISO() <= 1) +{ + tUEqn.clear(); +} + +surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); + +if (ddtCorr) +{ + phiHbyA += rAUf*fvc::ddtCorr(U, Uf); +} + +MRF.makeRelative(phiHbyA); + +if (p.needReference()) +{ + fvc::makeRelative(phiHbyA, U); + adjustPhi(phiHbyA, U, p); + fvc::makeAbsolute(phiHbyA, U); +} + +if (adjustFringe) +{ + fvc::makeRelative(phiHbyA, U); + oversetAdjustPhi(phiHbyA, U); + fvc::makeAbsolute(phiHbyA, U); +} + +if (runTime.outputTime()) +{ + volScalarField + ( + "div(phiHbyA)", + fvc::div(phiHbyA) + //interpolatedCells*cellMask*fvc::div(phiHbyA) + ).write(); +} + +while (pimple.correctNonOrthogonal()) +{ + fvScalarMatrix pEqn + ( + fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) + ); + + pEqn.setReference(pRefCell, pRefValue); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA - pEqn.flux(); + } +} + +#include "continuityErrs.H" + +// Explicitly relax pressure for momentum corrector +p.relax(); +volVectorField gradP(fvc::grad(p)); +//mesh.interpolate(gradP); + +// Option 1: leave velocity intact on blocked out cells +//U = HbyA - rAU*gradP; + +// Option 2: zero out velocity on blocked out cells +U = (HbyA - rAU*cellMask*gradP); +U.correctBoundaryConditions(); + +fvOptions.correct(U); + +{ + Uf = fvc::interpolate(U); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); +} + +// Make the fluxes relative to the mesh motion +fvc::makeRelative(phi, U); diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pimpleDyMFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..f3dbd6a989c0afd6c58603e87c234eca6a072d3d --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pimpleDyMFoam.C @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 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/>. + +Application + pimpleDyMFoam.C + +Group + grpIncompressibleSolvers grpMovingMeshSolvers + +Description + Transient solver for incompressible, flow of Newtonian fluids + on a moving mesh using the PIMPLE (merged PISO-SIMPLE) algorithm. + + Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "singlePhaseTransportModel.H" +#include "turbulentTransportModel.H" +#include "pimpleControl.H" +#include "fvOptions.H" + +#include "cellCellStencilObject.H" +#include "zeroGradientFvPatchFields.H" +#include "localMin.H" +#include "interpolationCellPoint.H" +#include "transform.H" +#include "fvMeshSubset.H" +#include "oversetAdjustPhi.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::addNote + ( + "Experimental version of pimpleDyMFoam with support for overset meshes" + ); + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "initContinuityErrs.H" + + pimpleControl pimple(mesh); + + #include "createFields.H" + #include "createUf.H" + #include "createMRF.H" + #include "createFvOptions.H" + #include "createControls.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" + + turbulence->validate(); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + #include "CourantNo.H" + + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + bool changed = mesh.update(); + + if (changed) + { + #include "setCellMask.H" + #include "setInterpolatedCells.H" + } + + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + + if (runTime.outputTime()) + { + volScalarField + ( + "contPhi", + interpolatedCells*cellMask*fvc::div(phi) + ).write(); + } + + if (mesh.changing() && correctPhi) + { + #include "correctPhi.H" + } + + // Make the flux relative to the mesh motion + fvc::makeRelative(phi, U); + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + laminarTransport.correct(); + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/readControls.H new file mode 100644 index 0000000000000000000000000000000000000000..0141c85225b506dc308c6f3e1c6a15d864447773 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/readControls.H @@ -0,0 +1,10 @@ +#include "readTimeControls.H" + +correctPhi = pimple.dict().lookupOrDefault("correctPhi", false); + +checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); + +massFluxInterpolation = + pimple.dict().lookupOrDefault("massFluxInterpolation", false); + +ddtCorr = pimple.dict().lookupOrDefault("ddtCorr", true); diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/Make/files b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..3294949edde8479bbb3afc19a802eee2a23c235b --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/Make/files @@ -0,0 +1,3 @@ +simpleFoam.C + +EXE = $(FOAM_APPBIN)/overSimpleFoam diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/Make/options b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..639b94132a05ab874dae5c55cedc4582fff0d9c2 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/Make/options @@ -0,0 +1,25 @@ +EXE_INC = \ + -I. \ + -I$(FOAM_SOLVERS)/incompressible/pimpleFoam/overPimpleDyMFoam \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/overset/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +EXE_LIBS = \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lfvOptions \ + -lsampling \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh \ + -loverset diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..5e9861ccc383ec482ff1e04ff06dbc461e87ebc4 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/UEqn.H @@ -0,0 +1,21 @@ + // Momentum predictor + + MRF.correctBoundaryVelocity(U); + + tmp<fvVectorMatrix> tUEqn + ( + fvm::div(phi, U) + + MRF.DDt(U) + + turbulence->divDevReff(U) + == + fvOptions(U) + ); + fvVectorMatrix& UEqn = tUEqn.ref(); + + UEqn.relax(); + + fvOptions.constrain(UEqn); + + solve(UEqn == -cellMask*fvc::grad(p)); + + fvOptions.correct(U); diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/continuityErrs.H b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/continuityErrs.H new file mode 100644 index 0000000000000000000000000000000000000000..c7870556230e049e54e727f8e26f8c68a1e810c4 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/continuityErrs.H @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 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. + +\*---------------------------------------------------------------------------*/ + +{ + volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi)); + + scalar sumLocalContErr = runTime.deltaTValue()* + mag(contErr)().weightedAverage(mesh.V()).value(); + + scalar globalContErr = runTime.deltaTValue()* + contErr.weightedAverage(mesh.V()).value(); + cumulativeContErr += globalContErr; + + Info<< "time step continuity errors : sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr + << endl; +} + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createFields.H b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..b3d40776f4f5d91425a423933cd9911c692e60f8 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createFields.H @@ -0,0 +1,47 @@ +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, simple.dict(), pRefCell, pRefValue); +mesh.setFluxRequired(p.name()); + + +singlePhaseTransportModel laminarTransport(U, phi); + +autoPtr<incompressible::turbulenceModel> turbulence +( + incompressible::turbulenceModel::New(U, phi, laminarTransport) +); + +#include "createMRF.H" + +#include "createOversetFields.H" diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createOversetFields.H b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createOversetFields.H new file mode 100644 index 0000000000000000000000000000000000000000..7eda905f50687a4f0f5b1c69bdefb00000e4a59e --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createOversetFields.H @@ -0,0 +1,34 @@ +//- 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 + ); +} + +// Mask field for zeroing out contributions on hole cells +#include "createCellMask.H" + +#include "createInterpolatedCells.H" + +bool adjustFringe +( + simple.dict().lookupOrDefault("oversetAdjustPhi", false) +); +bool massFluxInterpolation +( + simple.dict().lookupOrDefault("massFluxInterpolation", false) +); diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createUpdatedDynamicFvMesh.H b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createUpdatedDynamicFvMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..db58f9082809154eab78216183bc7d1f57120b0e --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/createUpdatedDynamicFvMesh.H @@ -0,0 +1,22 @@ + Info<< "Create dynamic mesh for time = " + << runTime.timeName() << nl << endl; + + autoPtr<dynamicFvMesh> meshPtr + ( + dynamicFvMesh::New + ( + IOobject + ( + dynamicFvMesh::defaultRegion, + runTime.timeName(), + runTime, + IOobject::MUST_READ + ) + ) + ); + + dynamicFvMesh& mesh = meshPtr(); + + // Calculate initial mesh-to-mesh mapping. Note that this should be + // done under the hood, e.g. as a MeshObject + mesh.update(); diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..c64f92e33f798c6bd762797bfd6a9118e468d838 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/pEqn.H @@ -0,0 +1,57 @@ +{ + surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); + + volScalarField rAU(1.0/UEqn.A()); + surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU)); + + volVectorField HbyA("HbyA", U); + HbyA = constrainHbyA(rAU*UEqn.H(), U, p); + + //mesh.interpolate(HbyA); + if (massFluxInterpolation) + { + #include "interpolatedFaces.H" + } + + tUEqn.clear(); + + surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); + + adjustPhi(phiHbyA, U, p); + + if (adjustFringe) + { + oversetAdjustPhi(phiHbyA, U); + } + + // Non-orthogonal pressure corrector loop + while (simple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) + ); + + pEqn.setReference(pRefCell, pRefValue); + + pEqn.solve(); + + if (simple.finalNonOrthogonalIter()) + { + phi = phiHbyA - pEqn.flux(); + } + } + + #include "continuityErrs.H" + + // Explicitly relax pressure for momentum corrector + p.relax(); + + // Momentum corrector + volVectorField gradP(fvc::grad(p)); + //mesh.interpolate(gradP); + + U = HbyA - rAU*cellMask*gradP; + U.correctBoundaryConditions(); + fvOptions.correct(U); +} diff --git a/applications/solvers/incompressible/simpleFoam/overSimpleFoam/simpleFoam.C b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/simpleFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..4a7cf1315bef8be4775c3e22a2ee9ad021826033 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/overSimpleFoam/simpleFoam.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 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/>. + +Application + simpleFoam + +Group + grpIncompressibleSolvers + +Description + Steady-state solver for incompressible flows with turbulence modelling. + + \heading Solver details + The solver uses the SIMPLE algorithm to solve the continuity equation: + + \f[ + \div \vec{U} = 0 + \f] + + and momentum equation: + + \f[ + \div \left( \vec{U} \vec{U} \right) - \div \gvec{R} + = - \grad p + \vec{S}_U + \f] + + Where: + \vartable + \vec{U} | Velocity + p | Pressure + \vec{R} | Stress tensor + \vec{S}_U | Momentum source + \endvartable + + \heading Required fields + \plaintable + U | Velocity [m/s] + p | Kinematic pressure, p/rho [m2/s2] + \<turbulence fields\> | As required by user selection + \endplaintable + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "singlePhaseTransportModel.H" +#include "turbulentTransportModel.H" +#include "simpleControl.H" +#include "fvOptions.H" + +#include "dynamicFvMesh.H" +#include "cellCellStencilObject.H" +#include "localMin.H" +#include "interpolationCellPoint.H" +#include "fvMeshSubset.H" +#include "transform.H" +#include "oversetAdjustPhi.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #define CREATE_MESH createUpdatedDynamicFvMesh.H + #include "postProcess.H" + + #include "setRootCase.H" + #include "createTime.H" + #include "createUpdatedDynamicFvMesh.H" + #include "createControl.H" + #include "createFields.H" + #include "createFvOptions.H" + #include "initContinuityErrs.H" + + turbulence->validate(); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (simple.loop()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + // --- Pressure-velocity SIMPLE corrector + { + #include "UEqn.H" + #include "pEqn.H" + } + + laminarTransport.correct(); + turbulence->correct(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/CourantNo.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/CourantNo.H new file mode 100644 index 0000000000000000000000000000000000000000..4182f4e20934d750adde8cf0107c88a803f79392 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/CourantNo.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 + CourantNo + +Description + Calculates and outputs the mean and maximum Courant Numbers. + +\*---------------------------------------------------------------------------*/ + +scalar CoNum = 0.0; +scalar meanCoNum = 0.0; + +if (mesh.nInternalFaces()) +{ + surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask)); + + scalarField sumPhi + ( + fvc::surfaceSum(mag(phiMask*phi))().internalField() + ); + + CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + + meanCoNum = + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); +} + +Info<< "Courant Number mean: " << meanCoNum + << " max: " << CoNum << endl; + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/Make/files b/applications/solvers/multiphase/interFoam/overInterDyMFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..e229fbaed0be9da346ec6546917faf706444036b --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/Make/files @@ -0,0 +1,3 @@ +interDyMFoam.C + +EXE = $(FOAM_APPBIN)/overInterDyMFoam diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/Make/options b/applications/solvers/multiphase/interFoam/overInterDyMFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..3b8ac67af5d0d74981d38b2d6124f36803f4f5e1 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/Make/options @@ -0,0 +1,31 @@ +EXE_INC = \ + -I. \ + -I.. \ + -I../../VoF \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(FOAM_SOLVERS)/incompressible/pimpleFoam/overPimpleDyMFoam \ + -I$(LIB_SRC)/overset/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +EXE_LIBS = \ + -limmiscibleIncompressibleTwoPhaseMixture \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lfiniteVolume \ + -ldynamicMesh \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -loverset \ + -lfvOptions \ + -lsampling \ + -lwaveModels diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/UEqn.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..600c94829ccad7b611afdeef7f9fc96b78d22601 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/UEqn.H @@ -0,0 +1,33 @@ + MRF.correctBoundaryVelocity(U); + + fvVectorMatrix UEqn + ( + fvm::ddt(rho, U) + fvm::div(rhoPhi, U) + + MRF.DDt(rho, U) + + turbulence->divDevRhoReff(rho, U) + == + fvOptions(rho, U) + ); + + UEqn.relax(); + + fvOptions.constrain(UEqn); + + if (pimple.momentumPredictor()) + { + solve + ( + UEqn + == + cellMask*fvc::reconstruct + ( + ( + mixture.surfaceTensionForce() + - ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) + ) * mesh.magSf() + ) + ); + + fvOptions.correct(U); + } diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/continuityErrs.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/continuityErrs.H new file mode 100644 index 0000000000000000000000000000000000000000..c7870556230e049e54e727f8e26f8c68a1e810c4 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/continuityErrs.H @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 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. + +\*---------------------------------------------------------------------------*/ + +{ + volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi)); + + scalar sumLocalContErr = runTime.deltaTValue()* + mag(contErr)().weightedAverage(mesh.V()).value(); + + scalar globalContErr = runTime.deltaTValue()* + contErr.weightedAverage(mesh.V()).value(); + cumulativeContErr += globalContErr; + + Info<< "time step continuity errors : sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr + << endl; +} + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H new file mode 100644 index 0000000000000000000000000000000000000000..81948b54da4d973217ab1c77245415503c1669d0 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H @@ -0,0 +1,125 @@ +{ + 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] = + bfld[patchi] + & mesh.Sf().boundaryField()[patchi]; + } + } + } + + wordList pcorrTypes + ( + p_rgh.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName + ); + + for (label i=0; i<p_rgh.boundaryField().size(); i++) + { + if (p_rgh.boundaryField()[i].fixesValue()) + { + pcorrTypes[i] = fixedValueFvPatchScalarField::typeName; + } + } + + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("pcorr", p_rgh.dimensions(), 0.0), + pcorrTypes + ); + + if (pcorr.needReference()) + { + fvc::makeRelative(phi, U); + adjustPhi(phi, U, pcorr); + fvc::makeAbsolute(phi, U); + } + + mesh.setFluxRequired(pcorr.name()); + + dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0); + + const cellCellStencilObject& overlap = Stencil::New(mesh); + const labelList& cellTypes = overlap.cellTypes(); + const labelIOList& zoneIDs = overlap.zoneID(); + + while (pimple.correctNonOrthogonal()) + { + label nZones = gMax(zoneIDs)+1; + //label refCellI2 = -1; + + labelList refCells(nZones, -1); + labelList refZones(nZones, -1); + + forAll(zoneIDs, cellI) + { + label zoneId = zoneIDs[cellI]; + if + ( + refCells[zoneId] == -1 + && cellTypes[cellI] == cellCellStencil::CALCULATED + && refZones[zoneId] == -1 + ) + { + refCells[zoneId] = cellI; + refZones[zoneId] = zoneId; + } + } + + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(rAUf, pcorr) == fvc::div(phi) + ); + + //pcorrEqn.setReference(refCellI2, 0, true); + scalarList values(nZones, 0.0); + pcorrEqn.setReferences(refCells, values, true); + + const dictionary& d = mesh.solver + ( + pcorr.select + ( + pimple.finalInnerIter() + ) + ); + + //Bypass virtual layer + mesh.fvMesh::solve(pcorrEqn, d); + + if (pimple.finalNonOrthogonalIter()) + { + phi -= pcorrEqn.flux(); + } + } + + if (runTime.outputTime()) + { + volScalarField("contPhiPcorr", fvc::div(phi)).write(); + pcorr.write(); + } +} diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/createDyMControls.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/createDyMControls.H new file mode 100644 index 0000000000000000000000000000000000000000..cb2dfd5ddd1e49261c47ed18216c802b08afdca0 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/createDyMControls.H @@ -0,0 +1,25 @@ +bool correctPhi +( + pimple.dict().lookupOrDefault<Switch>("correctPhi", true) +); + +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false) +); + +bool moveMeshOuterCorrectors +( + pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false) +); + + +bool massFluxInterpolation +( + pimple.dict().lookupOrDefault("massFluxInterpolation", false) +); + +bool ddtCorr +( + pimple.dict().lookupOrDefault("ddtCorr", true) +); diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..4a83ab58506bd085b1dbe351e569f63a252c5a19 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/createFields.H @@ -0,0 +1,171 @@ +#include "createRDeltaT.H" + +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + + + + //- 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" + + + +Info<< "Reading transportProperties\n" << endl; +immiscibleIncompressibleTwoPhaseMixture mixture(U, phi); + +volScalarField& alpha1(mixture.alpha1()); +volScalarField& alpha2(mixture.alpha2()); + +const dimensionedScalar& rho1 = mixture.rho1(); +const dimensionedScalar& rho2 = mixture.rho2(); + + +// Need to store rho for ddt(rho, U) +volScalarField rho +( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT + ), + alpha1*rho1 + alpha2*rho2 +); +rho.oldTime(); + + +// Mass flux +surfaceScalarField rhoPhi +( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + fvc::interpolate(rho)*phi +); + + +// Construct incompressible turbulence model +autoPtr<incompressible::turbulenceModel> turbulence +( + incompressible::turbulenceModel::New(U, phi, mixture) +); + + +#include "readGravitationalAcceleration.H" +#include "readhRef.H" +#include "gh.H" + + +volScalarField p +( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + p_rgh + rho*gh +); + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell +( + p, + p_rgh, + pimple.dict(), + pRefCell, + pRefValue +); + +if (p_rgh.needReference()) +{ + p += dimensionedScalar + ( + "p", + p.dimensions(), + pRefValue - getRefCellValue(p, pRefCell) + ); + p_rgh = p - rho*gh; +} + +mesh.setFluxRequired(p_rgh.name()); +mesh.setFluxRequired(alpha1.name()); + +// MULES compressed flux is registered in case scalarTransport FO needs it. +surfaceScalarField alphaPhiUn +( + IOobject + ( + "alphaPhiUn", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", phi.dimensions(), 0.0) +); + +#include "createMRF.H" diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/overInterDyMFoam/interDyMFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..7bb7f8af6b87112aa1b2bbc93fb68a3582f184b7 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/interDyMFoam.C @@ -0,0 +1,209 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 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/>. + +Application + overInterDyMFoam + +Group + grpMultiphaseSolvers grpMovingMeshSolvers + +Description + Solver for 2 incompressible, isothermal immiscible fluids using a VOF + (volume of fluid) phase-fraction based interface capturing approach, + with optional mesh motion and mesh topology changes including adaptive + re-meshing. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "CMULES.H" +#include "EulerDdtScheme.H" +#include "localEulerDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" +#include "subCycle.H" +#include "immiscibleIncompressibleTwoPhaseMixture.H" +#include "turbulentTransportModel.H" +#include "pimpleControl.H" +#include "fvOptions.H" +#include "CorrectPhi.H" +#include "fvcSmooth.H" +#include "cellCellStencilObject.H" +#include "localMin.H" +#include "interpolationCellPoint.H" +#include "transform.H" +#include "fvMeshSubset.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "postProcess.H" + + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "initContinuityErrs.H" + #include "createControl.H" + #include "createTimeControls.H" + #include "createDyMControls.H" + #include "createFields.H" + #include "createAlphaFluxes.H" + #include "createFvOptions.H" + + volScalarField rAU + ( + IOobject + ( + "rAU", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0) + ); + + #include "correctPhi.H" + #include "createUf.H" + + turbulence->validate(); + + if (!LTS) + { + #include "CourantNo.H" + #include "setInitialDeltaT.H" + } + + #include "setCellMask.H" + #include "setInterpolatedCells.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "CourantNo.H" + #include "alphaCourantNo.H" + #include "setDeltaT.H" + } + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + if (pimple.firstIter() || moveMeshOuterCorrectors) + { + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + mesh.update(); + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + + // Do not apply previous time-step mesh compression flux + // if the mesh topology changed + if (mesh.topoChanging()) + { + talphaPhiCorr0.clear(); + } + + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; + + // 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); + + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + + #include "correctPhi.H" + + // Make the flux relative to the mesh motion + fvc::makeRelative(phi, U); + + mixture.correct(); + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + + #include "alphaControls.H" + #include "alphaEqnSubCycle.H" + + mixture.correct(); + + #include "UEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..0a5b0296b8b14d0b5dd4d94235636202d8ee81be --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H @@ -0,0 +1,96 @@ +{ + rAU = 1.0/UEqn.A(); + surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); + + surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + + volVectorField HbyA("HbyA", U); + //HbyA = rAU*UEqn.H(); + HbyA = constrainHbyA(rAU*UEqn.H(), U, p_rgh); + + if (massFluxInterpolation) + { + #include "interpolatedFaces.H" + } + + surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); + + if (ddtCorr) + { + phiHbyA += fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf); + } + MRF.makeRelative(phiHbyA); + + if (p_rgh.needReference()) + { + fvc::makeRelative(phiHbyA, U); + adjustPhi(phiHbyA, U, p_rgh); + fvc::makeAbsolute(phiHbyA, U); + } + + surfaceScalarField phig + ( + ( + mixture.surfaceTensionForce() + - ghf*fvc::snGrad(rho) + )*faceMask*rAUf*mesh.magSf() + ); + + phiHbyA += phig; + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_rghEqn + ( + fvm::laplacian(faceMask*rAUf, p_rgh) == fvc::div(phiHbyA) + ); + + p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); + + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA - p_rghEqn.flux(); + + 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.correctBoundaryConditions(); + fvOptions.correct(U); + } + } + + #include "continuityErrs.H" + + { + Uf = fvc::interpolate(U); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); + } + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); + + p == p_rgh + rho*gh; + + if (p_rgh.needReference()) + { + p += dimensionedScalar + ( + "p", + p.dimensions(), + pRefValue - getRefCellValue(p, pRefCell) + ); + p_rgh = p - rho*gh; + } +} diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/readControls.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/readControls.H new file mode 100644 index 0000000000000000000000000000000000000000..0df2a74f3093bda327c81f9b61d83411df39ecd1 --- /dev/null +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/readControls.H @@ -0,0 +1,15 @@ +#include "readTimeControls.H" + +correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true); + +checkMeshCourantNo = + pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false); + +moveMeshOuterCorrectors = + pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false); + +massFluxInterpolation = + pimple.dict().lookupOrDefault("massFluxInterpolation", false); + +ddtCorr = + pimple.dict().lookupOrDefault("ddtCorr", true); \ No newline at end of file diff --git a/applications/test/parallelOverset/Make/files b/applications/test/parallelOverset/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..1a6be79787667f74a9a797e593ea0f2c16a7b68b --- /dev/null +++ b/applications/test/parallelOverset/Make/files @@ -0,0 +1,3 @@ +laplacianDyMFoam.C + +EXE = $(FOAM_USER_APPBIN)/correctBoundaryConditions diff --git a/applications/test/parallelOverset/Make/options b/applications/test/parallelOverset/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..0dd7b75e800bde6186f94446810ab345b67fa965 --- /dev/null +++ b/applications/test/parallelOverset/Make/options @@ -0,0 +1,12 @@ +EXE_INC = \ + -DFULLDEBUG -g -O0 \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/overset/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lsampling \ + -loverset diff --git a/applications/test/parallelOverset/createFields.H b/applications/test/parallelOverset/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..d14935caab629c166e286d9cdbb1aed8bae50561 --- /dev/null +++ b/applications/test/parallelOverset/createFields.H @@ -0,0 +1,53 @@ + Info<< "Reading field T\n" << endl; + + volScalarField T + ( + IOobject + ( + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + // Add overset specific interpolations + { + dictionary oversetDict; + oversetDict.add("T", true); + + const_cast<dictionary&> + ( + mesh.schemesDict() + ).add + ( + "oversetInterpolationRequired", + oversetDict, + true + ); + } + + + Info<< "Reading transportProperties\n" << endl; + + IOdictionary transportProperties + ( + IOobject + ( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + + Info<< "Reading diffusivity DT\n" << endl; + + dimensionedScalar DT + ( + transportProperties.lookup("DT") + ); diff --git a/applications/test/parallelOverset/heatTransfer/0.org/T b/applications/test/parallelOverset/heatTransfer/0.org/T new file mode 100644 index 0000000000000000000000000000000000000000..a60edc4bb6bfefcc2938a0f17756b834f4371dd6 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/0.org/T @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 273; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type zeroGradient; + } + + left1 + { + type fixedValue; + value uniform 300; + } + + right1 + { + type fixedValue; + value uniform 273; + } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/0.org/pointDisplacement b/applications/test/parallelOverset/heatTransfer/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..a1dda3a417590088bab115fa986572ce62d2c6e6 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/0.org/pointDisplacement @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + ".*" + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + "(free|hole)" + { + patchType overset; + type uniformFixedValue; + uniformValue (0 0 0); +// uniformValue table +// ( +// (0.0 (0 0 0)) +// (1.0 (0.31 0 0)) +// (2.0 (0 0 0)) +// ); + } +} + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/0.org/zoneID b/applications/test/parallelOverset/heatTransfer/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..1a49886c2839d838d832bbfa2067527a105d3707 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/0.org/zoneID @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev-OpenCFD.overlap | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/Allclean b/applications/test/parallelOverset/heatTransfer/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..323e09af05db0c3291e129d478f9f2e232782644 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/Allclean @@ -0,0 +1,13 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID + +rm -rf 0 + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/test/parallelOverset/heatTransfer/Allrun.pre b/applications/test/parallelOverset/heatTransfer/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..19e4417a553dbf99ed91af3793a7ce2c77a62d83 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/Allrun.pre @@ -0,0 +1,17 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +# Select cellSets +runApplication topoSet + +runApplication subsetMesh box -patch hole -overwrite + +# Select cellSets +runApplication -s zoneID topoSet + +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/applications/test/parallelOverset/heatTransfer/constant/dynamicMeshDict b/applications/test/parallelOverset/heatTransfer/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..69054196e62676174b12da0d2af53238359108be --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/constant/dynamicMeshDict @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motionSolverLibs ( "libfvMotionSolvers.so" ); + +solver displacementLaplacian; + +displacementLaplacianCoeffs +{ + diffusivity uniform 1; +} + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +// layerRelax 0.3; +} + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/constant/transportProperties b/applications/test/parallelOverset/heatTransfer/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..2c17a95828649391da9e86497b7ccfddeaece70a --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/constant/transportProperties @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DT DT [ 0 2 -1 0 0 0 0 ] 1; + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/blockMeshDict b/applications/test/parallelOverset/heatTransfer/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..c3dd3573eb77bc332d6044c680d341e20f341649 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/blockMeshDict @@ -0,0 +1,126 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.00 0.0 0) + ( 1.00 0.0 0) + ( 1.00 1.0 0) + ( 0.00 1.0 0) + ( 0.00 0.0 1) + ( 1.00 0.0 1) + ( 1.00 1.0 1) + ( 0.00 1.0 1) + +//- 0 degrees + ( 0.25 0.25 0) + ( 0.75 0.25 0) + ( 0.75 0.75 0) + ( 0.25 0.75 0) + ( 0.25 0.25 1) + ( 0.75 0.25 1) + ( 0.75 0.75 1) + ( 0.25 0.75 1) + + +//- 45 degrees rotated +// ( 0.25 0.5 0) +// ( 0.5 0.25 0) +// ( 0.75 0.5 0) +// ( 0.5 0.75 0) +// ( 0.25 0.5 1) +// ( 0.5 0.25 1) +// ( 0.75 0.5 1) +// ( 0.5 0.75 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (18 18 1) simpleGrading (1 1 1) + + hex (8 9 10 11 12 13 14 15) movingZone (30 30 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + free + { + type overset; + faces + ( + (8 12 15 11) + (10 14 13 9) + (11 15 14 10) + ( 9 13 12 8) + ); + } + + walls + { + type patch; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + // Populated by subsetMesh + hole + { + type patch; + faces (); + } + + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ( 8 11 10 9) + (12 13 14 15) + ); + } + + left1 + { + type patch; + faces + ( + (0 4 7 3) + ); + } + right1 + { + type patch; + faces + ( + (2 6 5 1) + ); + } +); + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/controlDict b/applications/test/parallelOverset/heatTransfer/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..535f677519ca350e299c63175d7cba02cdbd1efb --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/controlDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Make sure all preprocessing tools know about the 'overset' bc +libs ("liboverset.so"); + +DebugSwitches +{ + overset 1; + inverseDistance 1; +} + +application correctBoundaryConditions; //overLaplacianDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1; + +deltaT 0.1; + +writeControl timeStep; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 16; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/decomposeParDict b/applications/test/parallelOverset/heatTransfer/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..b1fa24963fa4b292c79028201044606b13beaf52 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/decomposeParDict @@ -0,0 +1,44 @@ +/*--------------------------------*- 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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + + +//constraints +//{ +// localOverset +// { +// //- Keep donor and acceptor on same processor +// type localOverset; +// } +//} + +method hierarchical; + +hierarchicalCoeffs +{ + n (1 2 1); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/fvSchemes b/applications/test/parallelOverset/heatTransfer/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..43c631a1f2967c2adf5fb4367b500f008d7e3b7f --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/fvSchemes @@ -0,0 +1,85 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(T) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss limitedLinearV 1; + div(phi,k) bounded Gauss limitedLinear 1; + div(phi,epsilon) bounded Gauss limitedLinear 1; + div(phi,R) bounded Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) bounded Gauss limitedLinear 1; + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; + laplacian(diffusivity,cellDisplacement) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + +oversetInterpolation +{ + // Interpolation scheme to use for overset calculation + method inverseDistance; + + // The inverseDistance method uses a 'voxel' like search structure. + // Optionally specify the extent and number of divisions n. + // Note that it will allocate an array of nx*ny*nz. If not specified: + // - searchBox : local mesh bounding box + // - searchBoxDivisions : root (2D) or cube-root(3D) of number of cells + searchBox (0 0 0)(1 1 1); + searchBoxDivisions (100 100 1); +} + + +oversetInterpolationRequired +{ + // Any additional fields that require overset interpolation +} + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/fvSolution b/applications/test/parallelOverset/heatTransfer/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..66c7f94747e33a6f2f1ed30f4eef3f2482308b00 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/fvSolution @@ -0,0 +1,77 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + T + { + solver PBiCGStab; + preconditioner DILU; + + //solver GAMG; + //smoother DILUGaussSeidel; + //agglomerator algebraicPair; + //processorAgglomerator none; + + tolerance 1e-10; + relTol 0; + } + + cellDisplacement + { + solver PCG; + preconditioner DIC; + + tolerance 1e-06; + relTol 0; + maxIter 100; + } + + +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; //2; +} + + +PIMPLE +{ + correctPhi yes; + nOuterCorrectors 2; + nCorrectors 1; + nNonOrthogonalCorrectors 0; +} + + +relaxationFactors +{ + fields + { + p 0.3; + } + equations + { + U 0.7; + k 0.7; + omega 0.7; + } +} + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/postProcessingDict b/applications/test/parallelOverset/heatTransfer/system/postProcessingDict new file mode 100644 index 0000000000000000000000000000000000000000..8fe6333aa0542d7c71e3e97eb31d09145642b0d9 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/postProcessingDict @@ -0,0 +1,35 @@ +/*--------------------------------*- 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 postProcessingDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +functions +{ + processorField1 + { + // Type of functionObject + type processorField; + + // Where to load it from (if not already in solver) + libs ("libfieldFunctionObjects.so"); + + // Function object enabled flag + enabled true; + + // When to output the average fields + writeControl writeTime; + } +} + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/processorField b/applications/test/parallelOverset/heatTransfer/system/processorField new file mode 100644 index 0000000000000000000000000000000000000000..6b41df60e4064f6a6388620e940b369271f8a720 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/processorField @@ -0,0 +1,32 @@ +/*--------------------------------*- 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 postProcessingDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +processorField +{ + // Type of functionObject + type processorField; + + // Where to load it from (if not already in solver) + libs ("libfieldFunctionObjects.so"); + + // Function object enabled flag + enabled true; + + // When to output the average fields + writeControl timeStep; +} + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/setFieldsDict b/applications/test/parallelOverset/heatTransfer/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..2ebc58f23ab05499d5c2aaf1453ab0fc0a4182c2 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/setFieldsDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object 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 + ); + } + +); + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/heatTransfer/system/topoSetDict b/applications/test/parallelOverset/heatTransfer/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..06a8182d40401efd63d11a3af6fbf5ad0e1f8830 --- /dev/null +++ b/applications/test/parallelOverset/heatTransfer/system/topoSetDict @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source regionToCell; + 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; + } + + + // Select box to remove from region 1 + + { + name box; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c1; + } + } + + + { + name box; + type cellSet; + action subset; + source boxToCell; + sourceInfo + { + box (0.4 0.4 -100)(0.6 0.6 100); + } + } + + { + name box; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/laplacianDyMFoam.C b/applications/test/parallelOverset/laplacianDyMFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..ea06cd7d3ac6f9e966eb7984099ad27b64a11926 --- /dev/null +++ b/applications/test/parallelOverset/laplacianDyMFoam.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 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/>. + +Application + laplacianFoam + +Group + grpBasicSolvers + +Description + Laplace equation solver for a scalar quantity. + + \heading Solver details + The solver is applicable to, e.g. for thermal diffusion in a solid. The + equation is given by: + + \f[ + \ddt{T} = \div \left( D_T \grad T \right) + \f] + + Where: + \vartable + T | Scalar field which is solved for, e.g. temperature + D_T | Diffusion coefficient + \endvartable + + \heading Required fields + \plaintable + T | Scalar field which is solved for, e.g. temperature + \endplaintable + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "simpleControl.H" +#include "dynamicFvMesh.H" +#include "dynamicOversetFvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createNamedDynamicFvMesh.H" + + simpleControl simple(mesh); + + #include "createFields.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nCorrecting boundary conditions on " << T.name() << nl << endl; + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + Info<< "Reading : ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + mesh.update(); + + Info<< "Overset calculation : ExecutionTime = " + << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + + if (false) + { + // Test correctBoundaryConditions + + // Change the internalField + component(T.ref(), mesh.C(), 0); + component(T.ref(), mesh.C(), 1); + // Interpolate + halo swap + T.correctBoundaryConditions(); + // Check halo swap + dynamicOversetFvMesh::checkCoupledBC(T); + } + if (true) + { + // Test solving + fvScalarMatrix TEqn(fvm::laplacian(DT, T)); + TEqn.solve(); + } + + runTime.write(); + + + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/parallelOverset/write.H b/applications/test/parallelOverset/write.H new file mode 100644 index 0000000000000000000000000000000000000000..47aa182c0a986f6ca07a494623e4d59ae792b6d9 --- /dev/null +++ b/applications/test/parallelOverset/write.H @@ -0,0 +1,46 @@ + if (runTime.outputTime()) + { + volVectorField gradT(fvc::grad(T)); + + volScalarField gradTx + ( + IOobject + ( + "gradTx", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + gradT.component(vector::X) + ); + + volScalarField gradTy + ( + IOobject + ( + "gradTy", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + gradT.component(vector::Y) + ); + + volScalarField gradTz + ( + IOobject + ( + "gradTz", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + gradT.component(vector::Z) + ); + + + runTime.write(); + } diff --git a/applications/test/wallDistDyM/Make/files b/applications/test/wallDistDyM/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..c84f5e72f5b6292472ce465afb9f19734f328ba0 --- /dev/null +++ b/applications/test/wallDistDyM/Make/files @@ -0,0 +1,3 @@ +Test-wallDistDyM.C + +EXE = $(FOAM_USER_APPBIN)/Test-wallDistDyM diff --git a/applications/test/wallDistDyM/Make/options b/applications/test/wallDistDyM/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..8a9d17bf25b53215c0e69dda922cf036919d3790 --- /dev/null +++ b/applications/test/wallDistDyM/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -ldynamicFvMesh diff --git a/applications/test/wallDistDyM/Test-wallDistDyM.C b/applications/test/wallDistDyM/Test-wallDistDyM.C new file mode 100644 index 0000000000000000000000000000000000000000..cfa1bbb8be96e53a2980951b42a85949860c3e73 --- /dev/null +++ b/applications/test/wallDistDyM/Test-wallDistDyM.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2017 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/>. + +Description + Calculate and write the distance-to-wall field for a moving mesh. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "dynamicFvMesh.H" +#include "wallDist.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + + Info<< "Mesh read in = " + << runTime.cpuTimeIncrement() + << " s\n" << endl << endl; + + // Calculate initial mesh-to-mesh mapping. Note that this should be + // done under the hood, e.g. as a MeshObject + mesh.update(); + + Info<< "Time now = " << runTime.timeName() << endl; + + // Wall-reflection vectors + const volVectorField& n = wallDist::New(mesh).n(); + n.write(); + + // Wall distance + const volScalarField& y = wallDist::New(mesh).y(); + y.write(); + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index 2739ecedd7d695788951fd6a9b16766236425f62..ec10dbb003f24e0b04a207d8bd850f65611f36b2 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -177,7 +177,7 @@ void insertDuplicateMerge label patchSize(const polyMesh& mesh, const labelList& patchIDs) { const polyBoundaryMesh& patches = mesh.boundaryMesh(); - + label sz = 0; forAll(patchIDs, i) { @@ -191,7 +191,7 @@ label patchSize(const polyMesh& mesh, const labelList& patchIDs) labelList patchFaces(const polyMesh& mesh, const labelList& patchIDs) { const polyBoundaryMesh& patches = mesh.boundaryMesh(); - + labelList faceIDs(patchSize(mesh, patchIDs)); label sz = 0; forAll(patchIDs, i) diff --git a/etc/caseDicts/setConstraintTypes b/etc/caseDicts/setConstraintTypes index 4fc38fabf027c85159dd69ddd7f191bf37f3f28f..2098261a27fed72f2e21687afa4df4257a83322b 100644 --- a/etc/caseDicts/setConstraintTypes +++ b/etc/caseDicts/setConstraintTypes @@ -64,5 +64,10 @@ wedge type wedge; } +overset +{ + type overset; +} + // ************************************************************************* // diff --git a/src/Allwmake b/src/Allwmake index 1e71c42e0cd8906bcb8a41cdafcc662ec055b4c8..abe861514e0e39c860313820602281b06eb3ab2a 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -54,6 +54,8 @@ wmake $targetType topoChangerFvMesh parallel/Allwmake $targetType $* randomProcesses/Allwmake $targetType $* +wmake $targetType overset + wmake $targetType ODE wmake $targetType fvMotionSolver diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H index 289649f2a9c40b2f26c622edfd79b007efe330c1..e1fd26b6c1ca7b4a11828a03ce5941b9c7350f7f 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H @@ -97,6 +97,7 @@ public: virtual void initInterfaceMatrixUpdate ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType @@ -110,6 +111,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H index f96d583b1f2abf352a54ff64f2985a98aa33a482..bcc35cc0eda20523daa6c547f1ac46f9f3dcbd92 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H @@ -617,6 +617,7 @@ public: // for matrix operations void initMatrixInterfaces ( + const bool add, const FieldField<Field, LUType>& interfaceCoeffs, const Field<Type>& psiif, Field<Type>& result @@ -625,6 +626,7 @@ public: //- Update interfaced interfaces for matrix operations void updateMatrixInterfaces ( + const bool add, const FieldField<Field, LUType>& interfaceCoeffs, const Field<Type>& psiif, Field<Type>& result diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C index 0aa6d2606376533bf82f50d605b3c94eb2d6009e..84c61a3c671421b2532a34a164b3224572cadfde 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -82,6 +82,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Amul // Initialise the update of interfaced interfaces initMatrixInterfaces ( + true, interfacesUpper_, psi, Apsi @@ -104,6 +105,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Amul // Update interface interfaces updateMatrixInterfaces ( + true, interfacesUpper_, psi, Apsi @@ -136,6 +138,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Tmul // Initialise the update of interfaced interfaces initMatrixInterfaces ( + true, interfacesLower_, psi, Tpsi @@ -157,6 +160,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Tmul // Update interface interfaces updateMatrixInterfaces ( + true, interfacesLower_, psi, Tpsi @@ -237,20 +241,11 @@ void Foam::LduMatrix<Type, DType, LUType>::residual // Note: there is a change of sign in the coupled // interface update to add the contibution to the r.h.s. - FieldField<Field, LUType> mBouCoeffs(interfacesUpper_.size()); - - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs.set(patchi, -interfacesUpper_[patchi]); - } - } - // Initialise the update of interfaced interfaces initMatrixInterfaces ( - mBouCoeffs, + false, // negate interface contributions + interfacesUpper_, psi, rA ); @@ -272,7 +267,8 @@ void Foam::LduMatrix<Type, DType, LUType>::residual // Update interface interfaces updateMatrixInterfaces ( - mBouCoeffs, + false, + interfacesUpper_, psi, rA ); diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C index 465c097bf0939ab2100cea1cd66eb4b841e6ebcb..123cc71a1035061751647dcb5d84f5c17a2b8cdb 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C @@ -31,6 +31,7 @@ License template<class Type, class DType, class LUType> void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces ( + const bool add, const FieldField<Field, LUType>& interfaceCoeffs, const Field<Type>& psiif, Field<Type>& result @@ -49,6 +50,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces interfaces_[interfacei].initInterfaceMatrixUpdate ( result, + add, psiif, interfaceCoeffs[interfacei], //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), @@ -75,6 +77,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces interfaces_[interfacei].initInterfaceMatrixUpdate ( result, + add, psiif, interfaceCoeffs[interfacei], //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), @@ -96,6 +99,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces template<class Type, class DType, class LUType> void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces ( + const bool add, const FieldField<Field, LUType>& interfaceCoeffs, const Field<Type>& psiif, Field<Type>& result @@ -121,6 +125,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces interfaces_[interfacei].updateInterfaceMatrix ( result, + add, psiif, interfaceCoeffs[interfacei], //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), @@ -145,6 +150,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces interfaces_[interfacei].initInterfaceMatrixUpdate ( result, + add, psiif, interfaceCoeffs[interfacei], //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), @@ -156,6 +162,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces interfaces_[interfacei].updateInterfaceMatrix ( result, + add, psiif, interfaceCoeffs[interfacei], //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), @@ -179,6 +186,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces interfaces_[interfacei].updateInterfaceMatrix ( result, + add, psiif, interfaceCoeffs[interfacei], //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), diff --git a/src/OpenFOAM/matrices/LduMatrix/Smoothers/GaussSeidel/TGaussSeidelSmoother.C b/src/OpenFOAM/matrices/LduMatrix/Smoothers/GaussSeidel/TGaussSeidelSmoother.C index b37ceaa5babac9f0045c02c00b0d28d98ab5c110..29cad04bb8384f626edc8a5e2e0373cffcd227e4 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Smoothers/GaussSeidel/TGaussSeidelSmoother.C +++ b/src/OpenFOAM/matrices/LduMatrix/Smoothers/GaussSeidel/TGaussSeidelSmoother.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -91,30 +91,22 @@ void Foam::TGaussSeidelSmoother<Type, DType, LUType>::smooth // Note: there is a change of sign in the coupled // interface update to add the contibution to the r.h.s. - FieldField<Field, LUType> mBouCoeffs(matrix_.interfacesUpper().size()); - - forAll(mBouCoeffs, patchi) - { - if (matrix_.interfaces().set(patchi)) - { - mBouCoeffs.set(patchi, -matrix_.interfacesUpper()[patchi]); - } - } - for (label sweep=0; sweep<nSweeps; sweep++) { bPrime = matrix_.source(); matrix_.initMatrixInterfaces ( - mBouCoeffs, + false, + matrix_.interfacesUpper(), psi, bPrime ); matrix_.updateMatrixInterfaces ( - mBouCoeffs, + false, + matrix_.interfacesUpper(), psi, bPrime ); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C index d8185f43b910e096b4be3206b4c20f6475e78df9..02bbd1a39396d771252bdfe98ca56f451fbc92a3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -215,6 +215,14 @@ const Foam::labelUList& Foam::lduAddressing::losortStartAddr() const } +void Foam::lduAddressing::clearOut() +{ + deleteDemandDrivenData(losortPtr_); + deleteDemandDrivenData(ownerStartPtr_); + deleteDemandDrivenData(losortStartPtr_); +} + + Foam::label Foam::lduAddressing::triIndex(const label a, const label b) const { label own = min(a, b); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H index b5d6f933b1328eaebb02e1b62960a4563396612f..fa405d37382f64f63105678f6271a008497cdef3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -186,6 +186,9 @@ public: // Return patch field evaluation schedule virtual const lduSchedule& patchSchedule() const = 0; + //- Clear additional addressing + void clearOut(); + //- Return losort addressing const labelUList& losortAddr() const; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H index 1fdd8f4219c00aa42dc2b6ccae0daf74b0f56892..3ce8c096d660576d0e25a41f6ddadc89e84c35fc 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H @@ -131,10 +131,12 @@ public: return true; } - //- Initialise neighbour matrix update + //- Initialise neighbour matrix update. Add + // or subtract coupled contributions to matrix virtual void initInterfaceMatrixUpdate ( scalarField&, + const bool add, const scalarField&, const scalarField&, const direction, @@ -142,15 +144,28 @@ public: ) const {} - //- Update result field based on interface functionality + //- Update result field based on interface functionality. Add + // or subtract coupled contributions to matrix virtual void updateInterfaceMatrix ( scalarField&, + const bool add, const scalarField&, const scalarField&, const direction, const Pstream::commsTypes commsType ) const = 0; + + //- Helper: add (or subtract) weighted contributions to internal + // field + template<class Type> + void addToInternalField + ( + Field<Type>& result, + const bool add, + const scalarField& coeffs, + const Field<Type>& vals + ) const; }; @@ -160,6 +175,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository + #include "lduInterfaceFieldTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceFieldTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceFieldTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..12af2788467c5a4639c2524c07f646ea26d7351c --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceFieldTemplates.C @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void Foam::lduInterfaceField::addToInternalField +( + Field<Type>& result, + const bool add, + const scalarField& coeffs, + const Field<Type>& vals +) const +{ + const labelUList& faceCells = this->interface().faceCells(); + + if (add) + { + forAll(faceCells, elemI) + { + result[faceCells[elemI]] += coeffs[elemI]*vals[elemI]; + } + } + else + { + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*vals[elemI]; + } + } +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 4ef5055cfb124246053d74a1b5f0cbcf2538e74a..38301514e981137111eee3f10358a7c3d923e813 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -672,6 +672,7 @@ public: // for matrix operations void initMatrixInterfaces ( + const bool add, const FieldField<Field, scalar>& interfaceCoeffs, const lduInterfaceFieldPtrsList& interfaces, const scalarField& psiif, @@ -682,6 +683,7 @@ public: //- Update interfaced interfaces for matrix operations void updateMatrixInterfaces ( + const bool add, const FieldField<Field, scalar>& interfaceCoeffs, const lduInterfaceFieldPtrsList& interfaces, const scalarField& psiif, diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixATmul.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixATmul.C index 715fb420bac95012c9960e1bacd2d4ff7ad3a73b..ac3404185142d22ceb13fdbee5eeb46d47ae76c8 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixATmul.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixATmul.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,6 +56,7 @@ void Foam::lduMatrix::Amul // Initialise the update of interfaced interfaces initMatrixInterfaces ( + true, interfaceBouCoeffs, interfaces, psi, @@ -81,6 +82,7 @@ void Foam::lduMatrix::Amul // Update interface interfaces updateMatrixInterfaces ( + true, interfaceBouCoeffs, interfaces, psi, @@ -117,6 +119,7 @@ void Foam::lduMatrix::Tmul // Initialise the update of interfaced interfaces initMatrixInterfaces ( + true, interfaceIntCoeffs, interfaces, psi, @@ -140,6 +143,7 @@ void Foam::lduMatrix::Tmul // Update interface interfaces updateMatrixInterfaces ( + true, interfaceIntCoeffs, interfaces, psi, @@ -233,20 +237,11 @@ void Foam::lduMatrix::residual // To compensate for this, it is necessary to turn the // sign of the contribution. - FieldField<Field, scalar> mBouCoeffs(interfaceBouCoeffs.size()); - - forAll(mBouCoeffs, patchi) - { - if (interfaces.set(patchi)) - { - mBouCoeffs.set(patchi, -interfaceBouCoeffs[patchi]); - } - } - // Initialise the update of interfaced interfaces initMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs, interfaces, psi, rA, @@ -271,7 +266,8 @@ void Foam::lduMatrix::residual // Update interface interfaces updateMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs, interfaces, psi, rA, diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C index af65e1bc68626562ed41c0573bcfbe4898147608..28dc38f75cd8639e8e3735c267c4fe6aa7021973 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C @@ -29,6 +29,7 @@ License void Foam::lduMatrix::initMatrixInterfaces ( + const bool add, const FieldField<Field, scalar>& coupleCoeffs, const lduInterfaceFieldPtrsList& interfaces, const scalarField& psiif, @@ -49,6 +50,7 @@ void Foam::lduMatrix::initMatrixInterfaces interfaces[interfacei].initInterfaceMatrixUpdate ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -75,6 +77,7 @@ void Foam::lduMatrix::initMatrixInterfaces interfaces[interfacei].initInterfaceMatrixUpdate ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -95,6 +98,7 @@ void Foam::lduMatrix::initMatrixInterfaces void Foam::lduMatrix::updateMatrixInterfaces ( + const bool add, const FieldField<Field, scalar>& coupleCoeffs, const lduInterfaceFieldPtrsList& interfaces, const scalarField& psiif, @@ -111,6 +115,7 @@ void Foam::lduMatrix::updateMatrixInterfaces interfaces[interfacei].updateInterfaceMatrix ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -139,6 +144,7 @@ void Foam::lduMatrix::updateMatrixInterfaces interfaces[interfacei].updateInterfaceMatrix ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -190,6 +196,7 @@ void Foam::lduMatrix::updateMatrixInterfaces interfaces[interfacei].updateInterfaceMatrix ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -214,6 +221,7 @@ void Foam::lduMatrix::updateMatrixInterfaces interfaces[interfacei].initInterfaceMatrixUpdate ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -225,6 +233,7 @@ void Foam::lduMatrix::updateMatrixInterfaces interfaces[interfacei].updateInterfaceMatrix ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, @@ -248,6 +257,7 @@ void Foam::lduMatrix::updateMatrixInterfaces interfaces[interfacei].updateInterfaceMatrix ( result, + add, psiif, coupleCoeffs[interfacei], cmpt, diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C index b233813d31c6ca452704a1effc64a6d439e7b070..40c5892a69e57fd609d670a668e66d7ff17c3114 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,28 +107,14 @@ void Foam::GaussSeidelSmoother::smooth // To compensate for this, it is necessary to turn the // sign of the contribution. - FieldField<Field, scalar>& mBouCoeffs = - const_cast<FieldField<Field, scalar>&> - ( - interfaceBouCoeffs_ - ); - - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs[patchi].negate(); - } - } - - for (label sweep=0; sweep<nSweeps; sweep++) { bPrime = source; matrix_.initMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs_, interfaces_, psi, bPrime, @@ -137,7 +123,8 @@ void Foam::GaussSeidelSmoother::smooth matrix_.updateMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs_, interfaces_, psi, bPrime, @@ -175,15 +162,6 @@ void Foam::GaussSeidelSmoother::smooth psiPtr[celli] = psii; } } - - // Restore interfaceBouCoeffs_ - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs[patchi].negate(); - } - } } diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C index bfae4ef0496186f529e76590d68edb8deff43acb..af6f772c21e6865ea4f283918730439263223f2c 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -134,18 +134,6 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth // To compensate for this, it is necessary to turn the // sign of the contribution. - FieldField<Field, scalar>& mBouCoeffs = - const_cast<FieldField<Field, scalar>&> - ( - interfaceBouCoeffs_ - ); - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs[patchi].negate(); - } - } for (label sweep=0; sweep<nSweeps; sweep++) { @@ -153,7 +141,8 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth matrix_.initMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs_, interfaces_, psi, bPrime, @@ -193,7 +182,8 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth matrix_.updateMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs_, interfaces_, psi, bPrime, @@ -228,15 +218,6 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth psiPtr[celli] = curPsi; } } - - // Restore interfaceBouCoeffs_ - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs[patchi].negate(); - } - } } diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C index 436b7e22f058f1bbd71676c266cc474d4ac3099f..57b27608add04304b9ef67d3fd5e6f3eb0f94800 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,28 +107,14 @@ void Foam::symGaussSeidelSmoother::smooth // To compensate for this, it is necessary to turn the // sign of the contribution. - FieldField<Field, scalar>& mBouCoeffs = - const_cast<FieldField<Field, scalar>&> - ( - interfaceBouCoeffs_ - ); - - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs[patchi].negate(); - } - } - - for (label sweep=0; sweep<nSweeps; sweep++) { bPrime = source; matrix_.initMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs_, interfaces_, psi, bPrime, @@ -137,7 +123,8 @@ void Foam::symGaussSeidelSmoother::smooth matrix_.updateMatrixInterfaces ( - mBouCoeffs, + false, + interfaceBouCoeffs_, interfaces_, psi, bPrime, @@ -204,15 +191,6 @@ void Foam::symGaussSeidelSmoother::smooth psiPtr[celli] = psii; } } - - // Restore interfaceBouCoeffs_ - forAll(mBouCoeffs, patchi) - { - if (interfaces_.set(patchi)) - { - mBouCoeffs[patchi].negate(); - } - } } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C index 6d769f4099ef0117caaedb16078b0ef4d9e0d745..af384a3158c41bc1004246dd0dc6697ae91e2b88 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C index 3896775f4353c86933e1285a44774b5496627371..6f0a17255915afcb0dba4f722efa7bd59fba5d25 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C @@ -51,6 +51,7 @@ void Foam::GAMGSolver::interpolate m.initMatrixInterfaces ( + true, interfaceBouCoeffs, interfaces, psi, @@ -67,6 +68,7 @@ void Foam::GAMGSolver::interpolate m.updateMatrixInterfaces ( + true, interfaceBouCoeffs, interfaces, psi, diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C index c4157d57f2cf205d42982d066fc77d0d183bb13a..e5332f52fe60063086ee573530495872ac8884c0 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C index 6eebf5f60911099a68ceb3e624a1ddf7ce972701..0d2b0c1d166b4c561c9e1dc149326cbf3f7f6229 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C @@ -109,6 +109,7 @@ Foam::cyclicGAMGInterfaceField::~cyclicGAMGInterfaceField() void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -123,12 +124,7 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix transformCoupleField(pnf, cmpt); - const labelUList& faceCells = cyclicInterface_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H index f9068707cae6c88761f87f7bfab95243bd407e74..6402e5efd1eb5ec5e7c5eb0bbc77766c8894bccc 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.H @@ -146,6 +146,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C index 852caef35f968ae705b246cc3425ae7056f95d20..3f77067f0673e16395158b82c6d27e6bec283676 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C @@ -93,6 +93,7 @@ Foam::processorGAMGInterfaceField::~processorGAMGInterfaceField() void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate ( scalarField&, + const bool, const scalarField& psiInternal, const scalarField&, const direction, @@ -148,6 +149,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate void Foam::processorGAMGInterfaceField::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField&, const scalarField& coeffs, const direction cmpt, @@ -162,8 +164,6 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix label oldWarn = UPstream::warnComm; UPstream::warnComm = comm(); - const labelUList& faceCells = procInterface_.faceCells(); - if ( commsType == Pstream::commsTypes::nonBlocking @@ -189,10 +189,7 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix transformCoupleField(scalarReceiveBuf_, cmpt); // Multiply the field by coefficients and add into the result - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*scalarReceiveBuf_[elemI]; - } + addToInternalField(result, !add, coeffs, scalarReceiveBuf_); } else { @@ -202,10 +199,7 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix ); transformCoupleField(pnf, cmpt); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + addToInternalField(result, !add, coeffs, pnf); } const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = true; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H index be57260c4407cfc484c1f5b6df826b0f33d0abc7..acf48e7e15ded9d0703040168a5953929f28f9a1 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H @@ -135,6 +135,7 @@ public: virtual void initInterfaceMatrixUpdate ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -145,6 +146,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H index 7561554b64be6f46323863a517428cae18647abc..3c62577e4a564852d52b3950f52364b1b2bbdb0a 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,21 +78,6 @@ class lduPrimitiveMesh //- Get size of all meshes static label totalSize(const PtrList<lduPrimitiveMesh>&); - static labelList upperTriOrder - ( - const label nCells, - const labelUList& lower, - const labelUList& upper - ); - - //- Check if in upper-triangular ordering - static void checkUpperTriangular - ( - const label size, - const labelUList& l, - const labelUList& u - ); - //- Disallow default bitwise copy construct lduPrimitiveMesh(const lduPrimitiveMesh&); @@ -261,6 +246,21 @@ public: template<class ProcPatch> static lduSchedule nonBlockingSchedule(const lduInterfacePtrsList&); + //- Calculate upper-triangular order + static labelList upperTriOrder + ( + const label nCells, + const labelUList& lower, + const labelUList& upper + ); + + //- Check if in upper-triangular ordering + static void checkUpperTriangular + ( + const label size, + const labelUList& l, + const labelUList& u + ); }; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C index 04d7e7fbdc04d5b36a0e3608a30a108078d2daa3..4f1edca365476fd50f6d2f76e68f45107e177ed8 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C @@ -311,7 +311,7 @@ Foam::labelList Foam::polyMeshTetDecomposition::findFaceBasePts { FatalErrorInFunction << "Coupled face base point exchange failure for face " - << fI + << fI << " at " << mesh.faceCentres()[fI] << abort(FatalError); } @@ -552,6 +552,7 @@ Foam::List<Foam::tetIndices> Foam::polyMeshTetDecomposition::faceTetIndices { WarningInFunction << "No base point for face " << fI << ", " << f + << ", vertices " << UIndirectList<point>(mesh.points(), f) << ", produces a valid tet decomposition." << endl; nWarnings++; @@ -616,6 +617,7 @@ Foam::tetIndices Foam::polyMeshTetDecomposition::triangleTetIndices { WarningInFunction << "No base point for face " << fI << ", " << f + << ", vertices " << UIndirectList<point>(mesh.points(), f) << ", produces a valid tet decomposition." << endl; nWarnings++; diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H.orig b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H.orig deleted file mode 100644 index 9b725409dce0b690de15d9d3d39fbf2639c845b5..0000000000000000000000000000000000000000 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H.orig +++ /dev/null @@ -1,219 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | -<<<<<<< HEAD - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd -======= - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | ->>>>>>> d2a62df7c -------------------------------------------------------------------------------- -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/>. - -Class - Foam::compressible:: - turbulentTemperatureRadCoupledMixedFvPatchScalarField - -Description - Mixed boundary condition for temperature and radiation heat transfer - to be used for in multiregion cases. Optional thin thermal layer - resistances can be specified through thicknessLayers and kappaLayers - entries. - - The thermal conductivity \c kappa can either be retrieved from various - possible sources, as detailed in the class temperatureCoupledBase. - -Usage - \table - Property | Description | Required | Default value - Tnbr | name of the field | no | T - qrNbr | name of the radiative flux in the nbr region | no | none - qr | name of the radiative flux in this region | no | none - thicknessLayers | list of thicknesses per layer [m] | no | - kappaLayers | list of thermal conductivites per layer [W/m/K] | no | - kappaMethod | inherited from temperatureCoupledBase | inherited | - kappa | inherited from temperatureCoupledBase | inherited | - thermalInertia | Add thermal inertia to wall node | no | false - \endtable - - Example of the boundary condition specification: - \verbatim - <patchName> - { - type compressible::turbulentTemperatureRadCoupledMixed; - Tnbr T; - qrNbr qr; // or none. Name of qr field on neighbour region - qr qr; // or none. Name of qr field on local region - thicknessLayers (0.1 0.2 0.3 0.4); - kappaLayers (1 2 3 4); - thermalInertia false/true; - kappaMethod lookup; - kappa kappa; - value uniform 300; - } - \endverbatim - - Needs to be on underlying mapped(Wall)FvPatch. - -See also - Foam::temperatureCoupledBase - -SourceFiles - turbulentTemperatureRadCoupledMixedFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef turbulentTemperatureRadCoupledMixedFvPatchScalarField_H -#define turbulentTemperatureRadCoupledMixedFvPatchScalarField_H - -#include "mixedFvPatchFields.H" -#include "temperatureCoupledBase.H" -#include "scalarList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class turbulentTemperatureRadCoupledMixedFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class turbulentTemperatureRadCoupledMixedFvPatchScalarField -: - public mixedFvPatchScalarField, - public temperatureCoupledBase -{ - // Private data - - //- Name of field on the neighbour region - const word TnbrName_; - - //- Name of the radiative heat flux in the neighbout region - const word qrNbrName_; - - //- Name of the radiative heat flux in local region - const word qrName_; - - //- Thickness of layers - scalarList thicknessLayers_; - - //- Conductivity of layers - scalarList kappaLayers_; - - //- Total contact resistance - scalar contactRes_; - - //- Thermal inertia term - Switch thermalInertia_; - - -public: - - //- Runtime type information - TypeName("compressible::turbulentTemperatureRadCoupledMixed"); - - - // Constructors - - //- Construct from patch and internal field - turbulentTemperatureRadCoupledMixedFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - turbulentTemperatureRadCoupledMixedFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given - // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a - // new patch - turbulentTemperatureRadCoupledMixedFvPatchScalarField - ( - const - turbulentTemperatureRadCoupledMixedFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new turbulentTemperatureRadCoupledMixedFvPatchScalarField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - turbulentTemperatureRadCoupledMixedFvPatchScalarField - ( - const turbulentTemperatureRadCoupledMixedFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new turbulentTemperatureRadCoupledMixedFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H index 2458d1d400c2affdce19c4b9a06d887b1b9c10a5..785aa25ccaf335a5c0293d53724e5d31f28fc83d 100644 --- a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H @@ -25,7 +25,7 @@ Class Foam::displacementInterpolationMotionSolver Group - grpMeshMotionSolvers + grpMeshMotionSolvers Description Mesh motion solver for an fvMesh. diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H index 07444532f4f6cbc2f6562ec64a8be3babf87ce36..4975d8c875a873c7e567132c9acf1ae3906cc32a 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H @@ -25,7 +25,7 @@ Class Foam::displacementLayeredMotionMotionSolver Group - grpMeshMotionSolvers + grpMeshMotionSolvers Description Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H index 20d87b8e86663c051ee1929e276be3ed2f702734..5523ef2eac70ad13cbe89ce8d55c5265e9102a54 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H @@ -207,6 +207,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction, @@ -217,6 +218,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index db36178e73e2ebb3430fb189f9c744fa9d1b287a..9a6dc99faace92854a90aec98263fef6dad4e7c4 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -173,6 +173,7 @@ template<class Type> void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -188,12 +189,7 @@ void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix transformCoupleField(pnf, cmpt); // Multiply the field by coefficients and add into the result - const labelUList& faceCells = cyclicPatch_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } @@ -201,6 +197,7 @@ template<class Type> void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes @@ -215,12 +212,7 @@ void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix transformCoupleField(pnf); // Multiply the field by coefficients and add into the result - const labelUList& faceCells = cyclicPatch_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H index 8122c21139033c7588fa72980d716285ee4665f7..cd2d5695a44016e0310dd4e5145c108e3cc5ae99 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H @@ -178,6 +178,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -188,6 +189,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes commsType diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C index 124c42fb87e007f2d41777650cf6b4e8f54d95e1..912c44173d70b79ba5fd22d13740df5dad6b4398 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C @@ -195,6 +195,7 @@ template<class Type> void Foam::cyclicACMIFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -213,14 +214,9 @@ void Foam::cyclicACMIFvPatchField<Type>::updateInterfaceMatrix // Transform according to the transformation tensors transformCoupleField(pnf, cmpt); - const labelUList& faceCells = cyclicACMIPatch_.faceCells(); - pnf = cyclicACMIPatch_.interpolate(pnf); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } @@ -228,6 +224,7 @@ template<class Type> void Foam::cyclicACMIFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes @@ -244,14 +241,9 @@ void Foam::cyclicACMIFvPatchField<Type>::updateInterfaceMatrix // Transform according to the transformation tensors transformCoupleField(pnf); - const labelUList& faceCells = cyclicACMIPatch_.faceCells(); - pnf = cyclicACMIPatch_.interpolate(pnf); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H index ebb2fb8cbd2eaddafc9a31b4d8bd90d84ac5b1a8..0ae3c6b0148873cdc335d2c4a606d1a4abb87ed8 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H @@ -202,6 +202,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -212,6 +213,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 50f0b5593832e021423b2443fff468d5189b379b..5bbce362be86665293e9d4a402d538108fdfc004 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -179,6 +179,7 @@ template<class Type> void Foam::cyclicAMIFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -204,12 +205,7 @@ void Foam::cyclicAMIFvPatchField<Type>::updateInterfaceMatrix } // Multiply the field by coefficients and add into the result - const labelUList& faceCells = cyclicAMIPatch_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } @@ -217,6 +213,7 @@ template<class Type> void Foam::cyclicAMIFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes @@ -241,12 +238,7 @@ void Foam::cyclicAMIFvPatchField<Type>::updateInterfaceMatrix } // Multiply the field by coefficients and add into the result - const labelUList& faceCells = cyclicAMIPatch_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H index 7ad7bddbb4019eff0e3a7b8d4c01e0e01b312915..d25f2812b2c4f81c039cb91d67599e45c5018315 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H @@ -183,6 +183,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -193,6 +194,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index 36705e2111c0b7dd19b5f4ddb71ac29fad2d4be6..577f42ee22b9c6b1d46d5764486c83565eafb5a7 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -132,6 +132,7 @@ template<class Type> void Foam::jumpCyclicFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -146,6 +147,7 @@ template<class Type> void Foam::jumpCyclicFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes @@ -183,11 +185,7 @@ void Foam::jumpCyclicFvPatchField<Type>::updateInterfaceMatrix this->transformCoupleField(pnf); // Multiply the field by coefficients and add into the result - const labelUList& faceCells = this->cyclicPatch().faceCells(); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H index 2456df9bbaa0b3af98e43b1b3c6a626f1547dfa9..36ebce0768424d576af57d5c3449f9ae527cdcb0 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H @@ -128,6 +128,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -138,6 +139,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType @@ -149,6 +151,7 @@ template<> void jumpCyclicFvPatchField<scalar>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C index fc620604db9e9382b7f9102e49806e52709faada..f4d7d53342ca4706040045783217459bb202db10 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C @@ -40,6 +40,7 @@ template<> void Foam::jumpCyclicFvPatchField<Foam::scalar>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -78,11 +79,7 @@ void Foam::jumpCyclicFvPatchField<Foam::scalar>::updateInterfaceMatrix this->transformCoupleField(pnf, cmpt); // Multiply the field by coefficients and add into the result - const labelUList& faceCells = this->cyclicPatch().faceCells(); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C index e22390f84a286746b12a1671c1c4558ea4e1b2fe..d4facb129b0fed566532e40dbb8d0f49c509b289 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C @@ -134,6 +134,7 @@ template<class Type> void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -148,6 +149,7 @@ template<class Type> void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes @@ -189,11 +191,7 @@ void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix this->transformCoupleField(pnf); // Multiply the field by coefficients and add into the result - const labelUList& faceCells = this->cyclicAMIPatch().faceCells(); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H index 0815af948f1fdcaf02865f35c72be50f761a26f2..7ea5016bf39b7d9db738b86432b234f913736f83 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H @@ -131,6 +131,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -141,6 +142,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>&, + const bool add, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType @@ -153,6 +155,7 @@ template<> void jumpCyclicAMIFvPatchField<scalar>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C index c567c4006233f5808f734bb4d9f8dcf4859f10d7..f1d54c748869c1e168eed30fb5638a4d4b3fac4a 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C @@ -42,6 +42,7 @@ template<> void Foam::jumpCyclicAMIFvPatchField<scalar>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -72,11 +73,7 @@ void Foam::jumpCyclicAMIFvPatchField<scalar>::updateInterfaceMatrix this->transformCoupleField(pnf, cmpt); // Multiply the field by coefficients and add into the result - const labelUList& faceCells = this->cyclicAMIPatch().faceCells(); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index 39b92ea77cda55e623b0b6d0104df835a20ec65c..fee3226ea83fabb51a1782cd904e60f6f37aa079 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -318,6 +318,7 @@ template<class Type> void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate ( scalarField&, + const bool add, const scalarField& psiInternal, const scalarField&, const direction, @@ -378,6 +379,7 @@ template<class Type> void Foam::processorFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField&, const scalarField& coeffs, const direction cmpt, @@ -389,8 +391,6 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix return; } - const labelUList& faceCells = this->patch().faceCells(); - if ( commsType == Pstream::commsTypes::nonBlocking @@ -416,10 +416,7 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix transformCoupleField(scalarReceiveBuf_, cmpt); // Multiply the field by coefficients and add into the result - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*scalarReceiveBuf_[elemI]; - } + this->addToInternalField(result, !add, coeffs, scalarReceiveBuf_); } else { @@ -432,10 +429,7 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix transformCoupleField(pnf, cmpt); // Multiply the field by coefficients and add into the result - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } const_cast<processorFvPatchField<Type>&>(*this).updatedMatrix() = true; @@ -446,6 +440,7 @@ template<class Type> void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate ( Field<Type>&, + const bool add, const Field<Type>& psiInternal, const scalarField&, const Pstream::commsTypes commsType @@ -505,6 +500,7 @@ template<class Type> void Foam::processorFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>&, const scalarField& coeffs, const Pstream::commsTypes commsType @@ -515,8 +511,6 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix return; } - const labelUList& faceCells = this->patch().faceCells(); - if ( commsType == Pstream::commsTypes::nonBlocking @@ -542,10 +536,7 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix transformCoupleField(receiveBuf_); // Multiply the field by coefficients and add into the result - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*receiveBuf_[elemI]; - } + this->addToInternalField(result, !add, coeffs, receiveBuf_); } else { @@ -558,10 +549,7 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix transformCoupleField(pnf); // Multiply the field by coefficients and add into the result - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } const_cast<processorFvPatchField<Type>&>(*this).updatedMatrix() = true; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index bfe1b75708a0d74486ad8ee04f296eb31576b755..11013c88245ddf9c03da11a7c04043ce1fe22935 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -209,6 +209,7 @@ public: virtual void initInterfaceMatrixUpdate ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -219,6 +220,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -229,6 +231,7 @@ public: virtual void initInterfaceMatrixUpdate ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes commsType @@ -238,6 +241,7 @@ public: virtual void updateInterfaceMatrix ( Field<Type>& result, + const bool add, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes commsType diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C index 53ebbb18e2ef9c6792971e5d9c21ac4cede4332a..85507d008041e42db5725186afb32271ceb19c77 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C @@ -36,6 +36,7 @@ template<> void processorFvPatchField<scalar>::initInterfaceMatrixUpdate ( scalarField&, + const bool add, const scalarField& psiInternal, const scalarField&, const direction, @@ -96,6 +97,7 @@ template<> void processorFvPatchField<scalar>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField&, const scalarField& coeffs, const direction, @@ -107,8 +109,6 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix return; } - const labelUList& faceCells = this->patch().faceCells(); - if ( commsType == Pstream::commsTypes::nonBlocking @@ -130,10 +130,7 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix // Consume straight from scalarReceiveBuf_ - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*scalarReceiveBuf_[elemI]; - } + this->addToInternalField(result, !add, coeffs, scalarReceiveBuf_); } else { @@ -142,10 +139,7 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix procPatch_.compressedReceive<scalar>(commsType, this->size())() ); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } const_cast<processorFvPatchField<scalar>&>(*this).updatedMatrix() = true; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.H index a8bbb24dcb5adf64d0beff05fb49cbe7f6a5ff66..0328ef2797b0f631c9cc8f31cad99e30c535de81 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.H @@ -39,6 +39,7 @@ template<> void processorFvPatchField<scalar>::initInterfaceMatrixUpdate ( scalarField&, + const bool add, const scalarField&, const scalarField&, const direction, @@ -50,6 +51,7 @@ template<> void processorFvPatchField<scalar>::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField&, const scalarField& coeffs, const direction, diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index db21f33d451d6fa4943cccbd21477e847654f434..81ff46caa2e86868abe35a1f01e754c6ecd6cd23 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -507,6 +507,32 @@ void Foam::fvMatrix<Type>::setReference } +template<class Type> +void Foam::fvMatrix<Type>::setReferences +( + const labelList& cellLabels, + const UList<Type>& values, + const bool forceReference +) +{ + bool needRef = (forceReference || psi_.needReference()); + + if (needRef) + { + forAll(cellLabels, celli) + { + label cellId = cellLabels[celli]; + if (celli >= 0) + { + source()[cellId] += diag()[cellId]*values[celli]; + diag()[cellId] += diag()[cellId]; + } + } + } +} + + + template<class Type> void Foam::fvMatrix<Type>::relax(const scalar alpha) { @@ -947,6 +973,20 @@ flux() const } +template<class Type> +const Foam::dictionary& Foam::fvMatrix<Type>::solverDict() const +{ + return psi_.mesh().solverDict + ( + psi_.select + ( + psi_.mesh().data::template lookupOrDefault<bool> + ("finalIteration", false) + ) + ); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class Type> diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H index 590c3e324e174977461ef4174c9859d284d4c835..cb843f24fd4c39ec5404a64dc1ae60c6ef19a534 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -299,6 +299,13 @@ public: return source_; } + //- fvBoundary scalar field containing pseudo-matrix coeffs + // for internal cells + const FieldField<Field, Type>& internalCoeffs() const + { + return internalCoeffs_; + } + //- fvBoundary scalar field containing pseudo-matrix coeffs // for internal cells FieldField<Field, Type>& internalCoeffs() @@ -306,6 +313,13 @@ public: return internalCoeffs_; } + //- fvBoundary scalar field containing pseudo-matrix coeffs + // for boundary cells + const FieldField<Field, Type>& boundaryCoeffs() const + { + return boundaryCoeffs_; + } + //- fvBoundary scalar field containing pseudo-matrix coeffs // for boundary cells FieldField<Field, Type>& boundaryCoeffs() @@ -351,6 +365,14 @@ public: const bool forceReference = false ); + //- Set references level for solution + void setReferences + ( + const labelList& cells, + const UList<Type>& values, + const bool forceReference = false + ); + //- Set reference level for a component of the solution // on a given patch face void setComponentReference @@ -389,7 +411,7 @@ public: //- Solve segregated or coupled returning the solution statistics. // Use the given solver controls - SolverPerformance<Type> solve(const dictionary&); + SolverPerformance<Type> solveSegregatedOrCoupled(const dictionary&); //- Solve segregated returning the solution statistics. // Use the given solver controls @@ -399,6 +421,10 @@ public: // Use the given solver controls SolverPerformance<Type> solveCoupled(const dictionary&); + //- Solve returning the solution statistics. + // Use the given solver controls + SolverPerformance<Type> solve(const dictionary&); + //- Solve returning the solution statistics. // Solver controls read from fvSolution SolverPerformance<Type> solve(); @@ -425,6 +451,9 @@ public: tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> flux() const; + //- Return the solver dictionary taking into account finalIteration + const dictionary& solverDict() const; + // Member operators diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 253d344a965861c4809359547d93187205d5fcb6..5eb6ead4498937819d66c80edacb0109ffbd0a75 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -54,7 +54,7 @@ void Foam::fvMatrix<Type>::setComponentReference template<class Type> -Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve +Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveSegregatedOrCoupled ( const dictionary& solverControls ) @@ -69,7 +69,8 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve if (debug) { Info.masterStream(this->mesh().comm()) - << "fvMatrix<Type>::solve(const dictionary& solverControls) : " + << "fvMatrix<Type>::solveSegregatedOrCoupled" + "(const dictionary& solverControls) : " "solving fvMatrix<Type>" << endl; } @@ -174,6 +175,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveSegregated // conditions initMatrixInterfaces ( + true, bouCoeffsCmpt, interfaces, psiCmpt, @@ -183,6 +185,7 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveSegregated updateMatrixInterfaces ( + true, bouCoeffsCmpt, interfaces, psiCmpt, @@ -283,55 +286,35 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveCoupled } +template<class Type> +Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve +( + const dictionary& solverControls +) +{ + return psi_.mesh().solve(*this, solverControls); +} + + template<class Type> Foam::autoPtr<typename Foam::fvMatrix<Type>::fvSolver> Foam::fvMatrix<Type>::solver() { - return solver - ( - psi_.mesh().solverDict - ( - psi_.select - ( - psi_.mesh().data::template lookupOrDefault<bool> - ("finalIteration", false) - ) - ) - ); + return solver(solverDict()); } template<class Type> Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::fvSolver::solve() { - return solve - ( - fvMat_.psi_.mesh().solverDict - ( - fvMat_.psi_.select - ( - fvMat_.psi_.mesh().data::template lookupOrDefault<bool> - ("finalIteration", false) - ) - ) - ); + return solve(fvMat_.solverDict()); } template<class Type> Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve() { - return solve - ( - psi_.mesh().solverDict - ( - psi_.select - ( - psi_.mesh().data::template lookupOrDefault<bool> - ("finalIteration", false) - ) - ) - ); + return this->solve(solverDict()); } diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 6b071d913198021a89ae1fb8662e569cc5df1857..2c667ac6195a44b37a7584a060b303cddfff1c8b 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -3,6 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +37,7 @@ License #include "fvMeshMapper.H" #include "mapClouds.H" #include "MeshObject.H" +#include "fvMatrix.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -408,6 +410,50 @@ Foam::fvMesh::~fvMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::SolverPerformance<Foam::scalar> Foam::fvMesh::solve +( + fvMatrix<scalar>& m, + const dictionary& dict +) const +{ + // Redirect to fvMatrix solver + return m.solveSegregatedOrCoupled(dict); +} + + +Foam::SolverPerformance<Foam::vector> Foam::fvMesh::solve +( + fvMatrix<vector>& m, + const dictionary& dict +) const +{ + // Redirect to fvMatrix solver + return m.solveSegregatedOrCoupled(dict); +} + + +Foam::SolverPerformance<Foam::symmTensor> Foam::fvMesh::solve +( + fvMatrix<symmTensor>& m, + const dictionary& dict +) const +{ + // Redirect to fvMatrix solver + return m.solveSegregatedOrCoupled(dict); +} + + +Foam::SolverPerformance<Foam::tensor> Foam::fvMesh::solve +( + fvMatrix<tensor>& m, + const dictionary& dict +) const +{ + // Redirect to fvMatrix solver + return m.solveSegregatedOrCoupled(dict); +} + + void Foam::fvMesh::addFvPatches ( const List<polyPatch*> & p, diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 94a6f68f21d118ba5c2a1ee744830e0948f90c85..6132523c6ce155f434d4531430301113cb793293 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,6 +62,7 @@ SourceFiles #include "slicedVolFieldsFwd.H" #include "slicedSurfaceFieldsFwd.H" #include "className.H" +#include "SolverPerformance.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,6 +71,8 @@ namespace Foam class fvMeshLduAddressing; class volMesh; +template<class Type> +class fvMatrix; /*---------------------------------------------------------------------------*\ @@ -265,16 +268,93 @@ public: return polyMesh::comm(); } - //- Internal face owner + + // Overlap + + //- Interpolate interpolationCells only + virtual void interpolate(volScalarField&) const + {} + + //- Interpolate interpolationCells only + virtual void interpolate(volVectorField&) const + {} + + //- Interpolate interpolationCells only + virtual void interpolate(volSphericalTensorField&) const + {} + + //- Interpolate interpolationCells only + virtual void interpolate(volSymmTensorField&) const + {} + + //- Interpolate interpolationCells only + virtual void interpolate(volTensorField&) const + {} + + //- Interpolate interpolationCells only. No bcs. + virtual void interpolate(scalarField&) const + {} + + //- Interpolate interpolationCells only. No bcs. + virtual void interpolate(vectorField&) const + {} + + //- Interpolate interpolationCells only. No bcs. + virtual void interpolate(sphericalTensorField&) const + {} + + //- Interpolate interpolationCells only. No bcs. + virtual void interpolate(symmTensorField&) const + {} + + //- Interpolate interpolationCells only. No bcs. + virtual void interpolate(tensorField&) const + {} + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<scalar> solve + ( + fvMatrix<scalar>&, + const dictionary& + ) const; + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<vector> solve + ( + fvMatrix<vector>&, + const dictionary& + ) const; + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<symmTensor> solve + ( + fvMatrix<symmTensor>&, + const dictionary& + ) const; + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<tensor> solve + ( + fvMatrix<tensor>&, + const dictionary& + ) const; + + + //- Internal face owner. Note bypassing virtual mechanism so + // e.g. relaxation always gets done using original addressing const labelUList& owner() const { - return lduAddr().lowerAddr(); + return fvMesh::lduAddr().lowerAddr(); } //- Internal face neighbour const labelUList& neighbour() const { - return lduAddr().upperAddr(); + return fvMesh::lduAddr().upperAddr(); } //- Return cell volumes diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C index fa3d382d66dea6b01432e2054ff9f2843f1553e8..7dd34b9343e3f0d5f5f1183115df65b2c441c7ba 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -103,6 +103,15 @@ bool Foam::patchDistMethods::Poisson::correct y = sqrt(magSqr(gradyPsi) + 2*yPsi) - magGradyPsi; + // Need to stabilise the y for overset meshes since the holed cells + // keep the initial value (0.0) so the gradient of that will be + // zero as well. Turbulence models do not like zero wall distance. + y.max(SMALL); + + // For overset: enforce smooth y field (yPsi is smooth, magGradyPsi is + // not) + mesh_.interpolate(y); + // Cache yPsi if the mesh is moving otherwise delete if (!mesh_.changing()) { @@ -118,7 +127,11 @@ bool Foam::patchDistMethods::Poisson::correct ( magGradyPsi, dimensionedScalar("smallMagGradyPsi", dimLength, SMALL) + ); + + // For overset: enforce smooth field + mesh_.interpolate(n); } return true; diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/advectionDiffusion/advectionDiffusionPatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/advectionDiffusion/advectionDiffusionPatchDistMethod.C index 9e0826340a13519d2315a1aac98a03a83510cd94..99820db026f7ad94becc3d240b3c4b925fb930bc 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/advectionDiffusion/advectionDiffusionPatchDistMethod.C +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/advectionDiffusion/advectionDiffusionPatchDistMethod.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -145,6 +145,11 @@ bool Foam::patchDistMethods::advectionDiffusion::correct } while (initialResidual > tolerance_ && ++iter < maxIter_); + // Need to stabilise the y for overset meshes since the holed cells + // keep the initial value (0.0) so the gradient of that will be + // zero as well. Turbulence models do not like zero wall distance. + y.max(SMALL); + // Only calculate n if the field is defined if (notNull(n)) { diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C index a8c37d2c3046f33619eb19ada7a12b51dbed69b2..0ac6e22f1a7396ffa9fb0927074e731f6b274aad 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -231,7 +231,9 @@ void Foam::displacementComponentLaplacianFvMotionSolver::solve() diffusivityPtr_->correct(); pointDisplacement_.boundaryFieldRef().updateCoeffs(); - Foam::solve + // We explicitly do NOT want to interpolate the motion inbetween + // different regions so bypass all the matrix manipulation. + fvScalarMatrix TEqn ( fvm::laplacian ( @@ -240,6 +242,8 @@ void Foam::displacementComponentLaplacianFvMotionSolver::solve() "laplacian(diffusivity,cellDisplacement)" ) ); + + TEqn.solveSegregatedOrCoupled(TEqn.solverDict()); } diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C index 6facb081384786e181e2949df9fbecb933e14270..3f16a8eb87e341e751c227e47c1100af1752b1d7 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -129,7 +129,9 @@ void Foam::velocityComponentLaplacianFvMotionSolver::solve() diffusivityPtr_->correct(); pointMotionU_.boundaryFieldRef().updateCoeffs(); - Foam::solve + // We explicitly do NOT want to interpolate the motion inbetween + // different regions so bypass all the matrix manipulation. + fvScalarMatrix TEqn ( fvm::laplacian ( @@ -138,6 +140,8 @@ void Foam::velocityComponentLaplacianFvMotionSolver::solve() "laplacian(diffusivity,cellMotionU)" ) ); + + TEqn.solveSegregatedOrCoupled(TEqn.solverDict()); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C index 2bed22c26cce395ca3f3199a75e2fd878ec58364..8a131674e9b520d5f008c2a65213f99a9c7b8ebd 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -186,7 +186,7 @@ void Foam::displacementSBRStressFvMotionSolver::solve() volTensorField gradCd("gradCd", fvc::grad(cellDisplacement_)); - Foam::solve + fvVectorMatrix TEqn ( fvm::laplacian ( @@ -234,6 +234,8 @@ void Foam::displacementSBRStressFvMotionSolver::solve() ) */ ); + + TEqn.solveSegregatedOrCoupled(TEqn.solverDict()); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index 85c120136485d1c1d9889d8629f8cec53de47620..fc35fa61662466d32f636d5c0db59e74be6f6b45 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -332,7 +332,9 @@ void Foam::displacementLaplacianFvMotionSolver::solve() diffusivity().correct(); pointDisplacement_.boundaryFieldRef().updateCoeffs(); - Foam::solve + // We explicitly do NOT want to interpolate the motion inbetween + // different regions so bypass all the matrix manipulation. + fvVectorMatrix TEqn ( fvm::laplacian ( @@ -341,6 +343,8 @@ void Foam::displacementLaplacianFvMotionSolver::solve() "laplacian(diffusivity,cellDisplacement)" ) ); + + TEqn.solveSegregatedOrCoupled(TEqn.solverDict()); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C index 6294da02a182061c168dc9476fcc5767ec6412b8..3c39edb7b5148c5525378b4d9493f8798745e8fc 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C @@ -409,7 +409,8 @@ void Foam::surfaceAlignedSBRStressFvMotionSolver::solve() fvc::div(sigmaD_) ); - DEqn.solve(); + // Note: solve uncoupled + DEqn.solveSegregatedOrCoupled(DEqn.solverDict()); } } diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C index 46e7f34e2d77550d88c45e18df2807c0902023d8..2a5bd14fcd0a97502008af11dc401a744e9ee251 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,7 +124,7 @@ void Foam::velocityLaplacianFvMotionSolver::solve() diffusivityPtr_->correct(); pointMotionU_.boundaryFieldRef().updateCoeffs(); - Foam::solve + fvVectorMatrix UEqn ( fvm::laplacian ( @@ -133,6 +133,8 @@ void Foam::velocityLaplacianFvMotionSolver::solve() "laplacian(diffusivity,cellMotionU)" ) ); + + UEqn.solveSegregatedOrCoupled(UEqn.solverDict()); } diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C index 4963d926cd549201a980ce57297b2d3293973700..772799af49b47c3fb31040dbdccdd60654287aaf 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C @@ -93,6 +93,7 @@ Foam::cyclicACMIGAMGInterfaceField::~cyclicACMIGAMGInterfaceField() void Foam::cyclicACMIGAMGInterfaceField::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -117,12 +118,7 @@ void Foam::cyclicACMIGAMGInterfaceField::updateInterfaceMatrix pnf = cyclicACMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf); } - const labelUList& faceCells = cyclicACMIInterface_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.H b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.H index e06d76328d983e8664e9099959b7dc4b747a3df0..a2f4dc8aec46535a1fd2f347fa668a1fa157b163 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.H @@ -120,6 +120,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C index 1cb34ad7920357871a1342ae3d0b107b0ced6bdb..7f6034a226840e5023c7f1747cd1ed1580b825ed 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C @@ -93,6 +93,7 @@ Foam::cyclicAMIGAMGInterfaceField::~cyclicAMIGAMGInterfaceField() void Foam::cyclicAMIGAMGInterfaceField::updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -117,12 +118,7 @@ void Foam::cyclicAMIGAMGInterfaceField::updateInterfaceMatrix pnf = cyclicAMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf); } - const labelUList& faceCells = cyclicAMIInterface_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + this->addToInternalField(result, !add, coeffs, pnf); } diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H index 868e2cc47b2c690f5026acfe46858f11859058f3..7f1aa72acde698720cd1ea00514ed108b5c4ffd9 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.H @@ -119,6 +119,7 @@ public: virtual void updateInterfaceMatrix ( scalarField& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, diff --git a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H index 5b26ddc2a75e1b38f44718cf8a232a9cd4eef7b9..6701e2b7bc5b4abf53a1502788053a2505a1f4d9 100644 --- a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H +++ b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.H @@ -112,6 +112,7 @@ public: virtual void updateInterfaceMatrix ( scalarField&, + const bool add, const scalarField&, const scalarField&, const direction, diff --git a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H index 8bcdd2e11477a8d67973acdc182caec0e873c958..ca8c0b9b68f94d0ff627aee2e521b95c9183ab2e 100644 --- a/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H +++ b/src/meshTools/regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.H @@ -113,6 +113,7 @@ public: virtual void updateInterfaceMatrix ( scalarField&, + const bool add, const scalarField&, const scalarField&, const direction, diff --git a/src/overset/Make/files b/src/overset/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..a285c4979cc925fc794b52b95129686c2bf1ccfa --- /dev/null +++ b/src/overset/Make/files @@ -0,0 +1,31 @@ +cellCellStencil/cellCellStencil/cellCellStencil.C +cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +cellCellStencil/cellCellStencil/cellCellStencilObject.C +cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C +cellCellStencil/inverseDistance/waveMethod.C +cellCellStencil/inverseDistance/meshToMeshData.C +cellCellStencil/trackingInverseDistance/voxelMeshSearch.C +cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C + +dynamicOversetFvMesh/dynamicOversetFvMesh.C + +fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C + +oversetPolyPatch/oversetPolyPatch.C +oversetPolyPatch/oversetLduInterface.C +oversetPolyPatch/oversetFvPatch.C +oversetPolyPatch/oversetFvPatchFields.C +oversetPolyPatch/oversetFvsPatchFields.C +oversetPolyPatch/oversetGAMGInterface.C +oversetPolyPatch/oversetGAMGInterfaceField.C +oversetPolyPatch/oversetPointPatch.C +oversetPolyPatch/oversetPointPatchFields.C + +oversetAdjustPhi/oversetAdjustPhi.C + +regionsToCell/regionsToCell.C + +lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C + + +LIB = $(FOAM_LIBBIN)/liboverset diff --git a/src/overset/Make/options b/src/overset/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..ae7529a2277818ed0369411a1480c8dac0311358 --- /dev/null +++ b/src/overset/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + /* -DFULLDEBUG -O0 -g */ \ + -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude + +LIB_LIBS = \ + -ldynamicFvMesh \ + -lsampling \ + -ldecompositionMethods diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C new file mode 100644 index 0000000000000000000000000000000000000000..9ef72576fae0b8de66f4e6218ce6716f43439f4d --- /dev/null +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C @@ -0,0 +1,276 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify i + 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellCellStencil.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "syncTools.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cellCellStencil, 0); + defineRunTimeSelectionTable(cellCellStencil, mesh); + + template<> + const char* NamedEnum + < + cellCellStencil::cellType, + 3 + >::names[] = + { + "calculated", + "interpolated", + "hole" + }; +} + +const Foam::NamedEnum<Foam::cellCellStencil::cellType, 3> +Foam::cellCellStencil::cellTypeNames_; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellCellStencil::cellCellStencil(const fvMesh& mesh) +: + mesh_(mesh) +{} + + +Foam::autoPtr<Foam::cellCellStencil> Foam::cellCellStencil::New +( + const fvMesh& mesh, + const dictionary& dict +) +{ + if (debug) + { + InfoInFunction << "Constructing cellCellStencil" << endl; + } + + word type(dict.lookup("method")); + + + meshConstructorTable::iterator cstrIter = + meshConstructorTablePtr_->find(type); + + if (cstrIter == meshConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown cellCellStencil type " + << type << nl << nl + << "Valid cellCellStencil types are" << endl + << meshConstructorTablePtr_->sortedToc() + << abort(FatalError); + } + + return autoPtr<cellCellStencil>(cstrIter()(mesh, dict, true)); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellCellStencil::~cellCellStencil() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::labelIOList& Foam::cellCellStencil::zoneID() const +{ + if (!mesh_.foundObject<labelIOList>("zoneID")) + { + labelIOList* zoneIDPtr = new labelIOList + ( + IOobject + ( + "zoneID", + mesh_.facesInstance(), + polyMesh::meshSubDir, + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_.nCells() + ); + labelIOList& zoneID = *zoneIDPtr; + + volScalarField volZoneID + ( + IOobject + ( + "zoneID", + mesh_.time().findInstance(mesh_.dbDir(), "zoneID"), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ), + mesh_ + ); + forAll(volZoneID, cellI) + { + zoneID[cellI] = label(volZoneID[cellI]); + } + + zoneIDPtr->store(); + } + return mesh_.lookupObject<labelIOList>("zoneID"); +} + + +Foam::labelList Foam::cellCellStencil::count +( + const label size, + const labelUList& lst +) +{ + labelList count(size, 0); + forAll(lst, i) + { + count[lst[i]]++; + } + Pstream::listCombineGather(count, plusEqOp<label>()); + return count; +} + + +bool Foam::cellCellStencil::localStencil(const labelUList& slots) const +{ + forAll(slots, i) + { + if (slots[i] >= mesh_.nCells()) + { + return false; + } + } + return true; +} + + +void Foam::cellCellStencil::globalCellCells +( + const globalIndex& gi, + const polyMesh& mesh, + const labelList& selectedCells, + labelListList& cellCells, + pointListList& cellCellCentres +) +{ + // For selected cells determine the face neighbours (in global numbering) + + const pointField& cellCentres = mesh.cellCentres(); + const labelList& faceOwner = mesh.faceOwner(); + const labelList& faceNeighbour = mesh.faceNeighbour(); + const cellList& cells = mesh.cells(); + + + // 1. Determine global cell number on other side of coupled patches + + labelList globalCellIDs(mesh.nCells()); + forAll(globalCellIDs, celli) + { + globalCellIDs[celli] = gi.toGlobal(celli); + } + + labelList nbrGlobalCellIDs; + syncTools::swapBoundaryCellList + ( + mesh, + globalCellIDs, + nbrGlobalCellIDs + ); + pointField nbrCellCentres; + syncTools::swapBoundaryCellList + ( + mesh, + cellCentres, + nbrCellCentres + ); + + + // 2. Collect cell and all its neighbours + + cellCells.setSize(mesh.nCells()); + cellCellCentres.setSize(cellCells.size()); + + forAll(selectedCells, i) + { + label celli = selectedCells[i]; + + const cell& cFaces = cells[celli]; + labelList& stencil = cellCells[celli]; + pointList& stencilPoints = cellCellCentres[celli]; + stencil.setSize(cFaces.size()+1); + stencilPoints.setSize(stencil.size()); + label compacti = 0; + + // First entry is cell itself + stencil[compacti] = globalCellIDs[celli]; + stencilPoints[compacti++] = cellCentres[celli]; + + // Other entries are cell neighbours + forAll(cFaces, i) + { + label facei = cFaces[i]; + label bFacei = facei-mesh.nInternalFaces(); + label own = faceOwner[facei]; + label nbrCelli; + point nbrCc; + if (bFacei >= 0) + { + nbrCelli = nbrGlobalCellIDs[bFacei]; + nbrCc = nbrCellCentres[bFacei]; + } + else + { + if (own != celli) + { + nbrCelli = gi.toGlobal(own); + nbrCc = cellCentres[own]; + } + else + { + label nei = faceNeighbour[facei]; + nbrCelli = gi.toGlobal(nei); + nbrCc = cellCentres[nei]; + } + } + + SubList<label> current(stencil, compacti); + if (findIndex(current, nbrCelli) == -1) + { + stencil[compacti] = nbrCelli; + stencilPoints[compacti++] = nbrCc; + } + } + stencil.setSize(compacti); + stencilPoints.setSize(compacti); + } +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H new file mode 100644 index 0000000000000000000000000000000000000000..327bce87cf3c1c28f0c9bd0bb6672ee8fde8735c --- /dev/null +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::cellCellStencil + +Description + Calculation of interpolation stencils. + + Looks up zoneID labelIOList to give the zoning. Wrapped in + MeshObject as cellCellStencilObject. Kept separate so meshes can + implement more clever methods (e.g. solid body motion does not require + full recalculation) + +SourceFiles + cellCellStencil.C + cellCellStencilObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellCellStencil_H +#define cellCellStencil_H + +#include "scalarList.H" +#include "mapDistribute.H" +#include "fvMesh.H" +#include "pointList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapDistribute; + +/*---------------------------------------------------------------------------*\ + Class cellCellStencil Declaration +\*---------------------------------------------------------------------------*/ + +class cellCellStencil +{ +public: + + enum patchCellType + { + OTHER = 0, // not on special patch + PATCH = 1, // next to (non-coupled) boundary + OVERSET = 2 // next to 'overset' boundary + }; + + enum cellType + { + CALCULATED = 0, // normal operation + INTERPOLATED = 1, // interpolated + HOLE = 2 // hole + }; + + +protected: + + // Protected data + + //- Mode type names + static const NamedEnum<cellType, 3> cellTypeNames_; + + //- Reference to the mesh + const fvMesh& mesh_; + + + // Protected Member Functions + + //- Count ocurrences (in parallel) + static labelList count(const label size, const labelUList& lst); + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + cellCellStencil(const cellCellStencil&); + + //- Disallow default bitwise assignment + void operator=(const cellCellStencil&); + + +public: + + //- Runtime type information + TypeName("cellCellStencil"); + + + // Declare run-time constructor selection tables + + declareRunTimeSelectionTable + ( + autoPtr, + cellCellStencil, + mesh, + ( + const fvMesh& mesh, + const dictionary& dict, + const bool update + ), + (mesh, dict, update) + ); + + + // Constructors + + //- Construct from fvMesh + cellCellStencil(const fvMesh&); + + //- New function which constructs and returns pointer to a + // cellCellStencil + static autoPtr<cellCellStencil> New + ( + const fvMesh&, + const dictionary& dict + ); + + + //- Destructor + virtual ~cellCellStencil(); + + + // Member Functions + + //- Update stencils. Return false if nothing changed. + virtual bool update() = 0; + + //- Return the cell type list + virtual const labelUList& cellTypes() const = 0; + + //- Indices of interpolated cells + virtual const labelUList& interpolationCells() const = 0; + + //- Return a communication schedule + virtual const mapDistribute& cellInterpolationMap() const = 0; + + //- Per interpolated cell the neighbour cells (in terms of slots as + // constructed by above cellInterpolationMap) to interpolate + virtual const labelListList& cellStencil() const = 0; + + //- Weights for cellStencil + virtual const List<scalarList>& cellInterpolationWeights() const = 0; + + //- Per interpolated cell the interpolation factor. (0 = use + // calculated, 1 = use interpolated) + virtual const scalarList& cellInterpolationWeight() const = 0; + + //- Helper: is stencil fully local + bool localStencil(const labelUList&) const; + + //- Helper: get reference to registered zoneID. Loads volScalarField + // if not registered. + const labelIOList& zoneID() const; + + //- Helper: create cell-cell addressing in global numbering + static void globalCellCells + ( + const globalIndex& gi, + const polyMesh& mesh, + const labelList& selectedCells, + labelListList& cellCells, + pointListList& cellCellCentres + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.C b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.C new file mode 100644 index 0000000000000000000000000000000000000000..026c4903c55ca3c8e0e103382c742ea03989a426 --- /dev/null +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.C @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellCellStencilObject.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cellCellStencilObject, 0); +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H new file mode 100644 index 0000000000000000000000000000000000000000..2a0e3ca15df14c9560d36d9f46ab1025b4b965f7 --- /dev/null +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::cellCellStencilObject + +Description + +SourceFiles + +\*---------------------------------------------------------------------------*/ + +#ifndef cellCellStencilObject_H +#define cellCellStencilObject_H + +#include "cellCellStencil.H" +#include "MeshObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class cellCellStencilObject; +typedef MeshObject +< + fvMesh, + Foam::MoveableMeshObject, + cellCellStencilObject +> Stencil; + +/*---------------------------------------------------------------------------*\ + Class cellCellStencilObject Declaration +\*---------------------------------------------------------------------------*/ + +class cellCellStencilObject +: + public MeshObject + < + fvMesh, + MoveableMeshObject, + cellCellStencilObject + >, + public cellCellStencil +{ + // Private data + + autoPtr<cellCellStencil> stencilPtr_; + + +public: + + TypeName("cellCellStencilObject"); + + // Constructors + + //- Construct with mesh + explicit cellCellStencilObject(const fvMesh& mesh) + : + MeshObject + < + fvMesh, + Foam::MoveableMeshObject, + cellCellStencilObject + >(mesh), + cellCellStencil(mesh), + stencilPtr_ + ( + cellCellStencil::New + ( + mesh, + mesh.schemesDict().subDict + ( + "oversetInterpolation" + ) + ) + ) + {} + + + //- Destructor + virtual ~cellCellStencilObject() + {} + + + // Member Functions + + //- Callback for geometry motion + virtual bool movePoints() + { + return stencilPtr_().update(); + } + + //- Update stencils. Return false if nothing changed. + virtual bool update() + { + return stencilPtr_().update(); + } + + //- Return the cell type list + virtual const labelUList& cellTypes() const + { + return stencilPtr_().cellTypes(); + } + + //- Indices of interpolated cells + virtual const labelUList& interpolationCells() const + { + return stencilPtr_().interpolationCells(); + } + + //- Return a communication schedule + virtual const mapDistribute& cellInterpolationMap() const + { + return stencilPtr_().cellInterpolationMap(); + } + + //- Per interpolated cell the neighbour cells (in terms of slots as + // constructed by above cellInterpolationMap) to interpolate + virtual const labelListList& cellStencil() const + { + return stencilPtr_().cellStencil(); + } + + //- Weights for cellStencil + virtual const List<scalarList>& cellInterpolationWeights() const + { + return stencilPtr_().cellInterpolationWeights(); + } + + //- Per interpolated cell the interpolation factor. (0 = use + // calculated, 1 = use interpolated) + virtual const scalarList& cellInterpolationWeight() const + { + return stencilPtr_().cellInterpolationWeight(); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C new file mode 100644 index 0000000000000000000000000000000000000000..9e7001454d1f7eb299c5ac75cf93302dc27f8d6a --- /dev/null +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -0,0 +1,1107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify i + 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellVolumeWeightCellCellStencil.H" +#include "addToRunTimeSelectionTable.H" +#include "OBJstream.H" +#include "Time.H" +#include "meshToMesh.H" +#include "cellVolumeWeightMethod.H" +#include "fvMeshSubset.H" +#include "regionSplit.H" +#include "globalIndex.H" +#include "oversetFvPatch.H" +#include "zeroGradientFvPatchFields.H" +#include "syncTools.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace cellCellStencils +{ + defineTypeNameAndDebug(cellVolumeWeight, 0); + addToRunTimeSelectionTable(cellCellStencil, cellVolumeWeight, mesh); +} +} + +Foam::scalar +Foam::cellCellStencils::cellVolumeWeight::defaultOverlapTolerance_ = 1e-3; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::cellCellStencils::cellVolumeWeight::walkFront +( + const scalar layerRelax, + labelList& allCellTypes, + scalarField& allWeight +) const +{ + // Current front + PackedBoolList isFront(mesh_.nFaces()); + PackedBoolList doneCell(mesh_.nCells()); + + const fvBoundaryMesh& fvm = mesh_.boundary(); + + + // 'overset' patches + + forAll(fvm, patchI) + { + if (isA<oversetFvPatch>(fvm[patchI])) + { + Pout<< "Storing faces on patch " << fvm[patchI].name() << endl; + + forAll(fvm[patchI], i) + { + isFront[fvm[patchI].start()+i] = true; + } + } + } + + + // Outside of 'hole' region + { + const labelList& own = mesh_.faceOwner(); + const labelList& nei = mesh_.faceNeighbour(); + + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + label ownType = allCellTypes[own[faceI]]; + label neiType = allCellTypes[nei[faceI]]; + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + //Pout<< "Front at face:" << faceI + // << " at:" << mesh_.faceCentres()[faceI] << endl; + isFront[faceI] = true; + } + } + + labelList nbrCellTypes; + syncTools::swapBoundaryCellList(mesh_, allCellTypes, nbrCellTypes); + + for + ( + label faceI = mesh_.nInternalFaces(); + faceI < mesh_.nFaces(); + faceI++ + ) + { + label ownType = allCellTypes[own[faceI]]; + label neiType = nbrCellTypes[faceI-mesh_.nInternalFaces()]; + + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + //Pout<< "Front at coupled face:" << faceI + // << " at:" << mesh_.faceCentres()[faceI] << endl; + isFront[faceI] = true; + } + } + } + + + + // Current interpolation fraction + scalar fraction = 1.0; + + while (fraction > SMALL && returnReduce(isFront.count(), sumOp<label>())) + { + // Interpolate cells on front + + Info<< "Front : fraction:" << fraction + << " size:" << returnReduce(isFront.count(), sumOp<label>()) + << endl; + + PackedBoolList newIsFront(mesh_.nFaces()); + forAll(isFront, faceI) + { + if (isFront[faceI]) + { + label own = mesh_.faceOwner()[faceI]; + if (allCellTypes[own] != HOLE) + { + if (allWeight[own] < fraction) + { + allWeight[own] = fraction; + + if (debug) + { + Pout<< " setting cell " + << mesh_.cellCentres()[own] + << " to " << fraction << endl; + } + allCellTypes[own] = INTERPOLATED; + newIsFront.set(mesh_.cells()[own]); + } + } + if (mesh_.isInternalFace(faceI)) + { + label nei = mesh_.faceNeighbour()[faceI]; + if (allCellTypes[nei] != HOLE) + { + if (allWeight[nei] < fraction) + { + allWeight[nei] = fraction; + + if (debug) + { + Pout<< " setting cell " + << mesh_.cellCentres()[nei] + << " to " << fraction << endl; + } + + allCellTypes[nei] = INTERPOLATED; + newIsFront.set(mesh_.cells()[nei]); + } + } + } + } + } + + syncTools::syncFaceList(mesh_, newIsFront, orEqOp<unsigned int>()); + + isFront.transfer(newIsFront); + + fraction -= layerRelax; + } +} + + +void Foam::cellCellStencils::cellVolumeWeight::findHoles +( + const globalIndex& globalCells, + const fvMesh& mesh, + const labelList& zoneID, + const labelListList& stencil, + labelList& cellTypes +) const +{ + const fvBoundaryMesh& pbm = mesh.boundary(); + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + + + // The input cellTypes will be + // - HOLE : cell part covered by other-mesh patch + // - INTERPOLATED : cell fully covered by other-mesh patch + // or next to 'overset' patch + // - CALCULATED : otherwise + // + // so we start a walk from our patches and any cell we cannot reach + // (because we walk is stopped by other-mesh patch) is a hole. + + + boolList isBlockedFace(mesh.nFaces(), false); + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label ownType = cellTypes[own[faceI]]; + label neiType = cellTypes[nei[faceI]]; + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + isBlockedFace[faceI] = true; + } + } + + labelList nbrCellTypes; + syncTools::swapBoundaryCellList(mesh, cellTypes, nbrCellTypes); + + for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) + { + label ownType = cellTypes[own[faceI]]; + label neiType = nbrCellTypes[faceI-mesh.nInternalFaces()]; + + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + isBlockedFace[faceI] = true; + } + } + + regionSplit cellRegion(mesh, isBlockedFace); + + Info<< typeName << " : detected " << cellRegion.nRegions() + << " mesh regions after overset" << nl << endl; + + + + // Now we'll have a mesh split according to where there are cells + // covered by the other-side patches. See what we can reach from our + // real patches + + // 0 : region not yet determined + // 1 : borders blockage so is not ok (but can be overriden by real + // patch) + // 2 : has real patch in it so is reachable + labelList regionType(cellRegion.nRegions(), 0); + + + // See if any regions borders blockage. Note: isBlockedFace is already + // parallel synchronised. + { + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + if (isBlockedFace[faceI]) + { + label ownRegion = cellRegion[own[faceI]]; + + if (cellTypes[own[faceI]] != HOLE) + { + if (regionType[ownRegion] == 0) + { + Pout<< "Mark region:" << ownRegion + << " on zone:" << zoneID[own[faceI]] + << " as next to blockage at:" + << mesh.faceCentres()[faceI] << endl; + + regionType[ownRegion] = 1; + } + } + + label neiRegion = cellRegion[nei[faceI]]; + + if (cellTypes[nei[faceI]] != HOLE) + { + if (regionType[neiRegion] == 0) + { + Pout<< "Mark region:" << neiRegion + << " on zone:" << zoneID[nei[faceI]] + << " as next to blockage at:" + << mesh.faceCentres()[faceI] << endl; + regionType[neiRegion] = 1; + } + } + } + } + for + ( + label faceI = mesh.nInternalFaces(); + faceI < mesh.nFaces(); + faceI++ + ) + { + if (isBlockedFace[faceI]) + { + label ownRegion = cellRegion[own[faceI]]; + + if (regionType[ownRegion] == 0) + { + Pout<< "Mark region:" << ownRegion + << " on zone:" << zoneID[own[faceI]] + << " as next to blockage at:" + << mesh.faceCentres()[faceI] << endl; + regionType[ownRegion] = 1; + } + } + } + } + + + // Override with real patches + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + + if (isA<oversetFvPatch>(fvp)) + {} + else if (!fvPatch::constraintType(fvp.type())) + { + Pout<< "Proper patch " << fvp.name() << " of type " << fvp.type() + << endl; + + const labelList& fc = fvp.faceCells(); + forAll(fc, i) + { + label regionI = cellRegion[fc[i]]; + + if (cellTypes[fc[i]] != HOLE && regionType[regionI] != 2) + { + Pout<< "reachable region : " << regionI + << " at cell " << mesh.cellCentres()[fc[i]] + << " on zone " << zoneID[fc[i]] + << endl; + regionType[regionI] = 2; + } + } + } + } + + // Now we've handled + // - cells next to blocked cells + // - coupled boundaries + // Only thing to handle is the interpolation between regions + + + labelListList compactStencil(stencil); + List<Map<label>> compactMap; + mapDistribute map(globalCells, compactStencil, compactMap); + + while (true) + { + // Synchronise region status on processors + // (could instead swap status through processor patches) + Pstream::listCombineGather(regionType, maxEqOp<label>()); + Pstream::listCombineScatter(regionType); + + // Communicate region status through interpolative cells + labelList cellRegionType(UIndirectList<label>(regionType, cellRegion)); + map.distribute(cellRegionType); + + + label nChanged = 0; + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + + if (isA<oversetFvPatch>(fvp)) + { + const labelUList& fc = fvp.faceCells(); + forAll(fc, i) + { + label cellI = fc[i]; + label regionI = cellRegion[cellI]; + + if (regionType[regionI] != 2) + { + const labelList& slots = compactStencil[cellI]; + forAll(slots, i) + { + label otherType = cellRegionType[slots[i]]; + + if (otherType == 2) + { + Pout<< "Reachable through interpolation : " + << regionI << " at cell " + << mesh.cellCentres()[cellI] + << endl; + regionType[regionI] = 2; + nChanged++; + break; + } + } + } + } + } + } + + + reduce(nChanged, sumOp<label>()); + if (nChanged == 0) + { + break; + } + } + + + // See which regions have not been visited (regionType == 1) + forAll(cellRegion, cellI) + { + label type = regionType[cellRegion[cellI]]; + if (type == 1 && cellTypes[cellI] != HOLE) + { + cellTypes[cellI] = HOLE; + } + } +} + + +void Foam::cellCellStencils::cellVolumeWeight::markPatchCells +( + const fvMesh& mesh, + const labelList& cellMap, + labelList& patchCellTypes +) const +{ + const fvBoundaryMesh& pbm = mesh.boundary(); + + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + const labelList& fc = fvp.faceCells(); + + if (isA<oversetFvPatch>(fvp)) + { + Pout<< "Marking cells on overset patch " << fvp.name() << endl; + forAll(fc, i) + { + label cellI = fc[i]; + patchCellTypes[cellMap[cellI]] = OVERSET; + } + } + else if (!fvPatch::constraintType(fvp.type())) + { + Pout<< "Marking cells on proper patch " << fvp.name() + << " with type " << fvp.type() << endl; + forAll(fc, i) + { + label cellI = fc[i]; + if (patchCellTypes[cellMap[cellI]] != OVERSET) + { + patchCellTypes[cellMap[cellI]] = PATCH; + } + } + } + } +} + + +void Foam::cellCellStencils::cellVolumeWeight::interpolatePatchTypes +( + const labelListList& addressing, + const labelList& patchTypes, + labelList& result +) const +{ + forAll(result, cellI) + { + const labelList& slots = addressing[cellI]; + forAll(slots, i) + { + label type = patchTypes[slots[i]]; + + if (type == OVERSET) + { + // 'overset' overrides anything + result[cellI] = OVERSET; + break; + } + else if (type == PATCH) + { + // 'patch' overrides -1 and 'other' + result[cellI] = PATCH; + } + else if (result[cellI] == -1) + { + // 'other' overrides -1 only + result[cellI] = OTHER; + } + } + } +} + + +void Foam::cellCellStencils::cellVolumeWeight::interpolatePatchTypes +( + const autoPtr<mapDistribute>& mapPtr, + const labelListList& addressing, + const labelList& patchTypes, + labelList& result +) const +{ + if (result.size() != addressing.size()) + { + FatalErrorInFunction << "result:" << result.size() + << " addressing:" << addressing.size() << exit(FatalError); + } + + + // Initialise to not-mapped + result = -1; + + if (mapPtr.valid()) + { + // Pull remote data into order of addressing + labelList work(patchTypes); + mapPtr().distribute(work); + + interpolatePatchTypes(addressing, work, result); + } + else + { + interpolatePatchTypes(addressing, patchTypes, result); + } +} + + +void Foam::cellCellStencils::cellVolumeWeight::combineCellTypes +( + const label subZoneID, + const fvMesh& subMesh, + const labelList& subCellMap, + + const label donorZoneID, + const labelListList& addressing, + const List<scalarList>& weights, + const labelList& otherCells, + const labelList& interpolatedOtherPatchTypes, + + labelListList& allStencil, + scalarListList& allWeights, + labelList& allCellTypes, + labelList& allDonorID +) const +{ + forAll(subCellMap, subCellI) + { + label cellI = subCellMap[subCellI]; + + bool validDonors = true; + switch (interpolatedOtherPatchTypes[subCellI]) + { + case -1: + { + validDonors = false; + } + break; + + case OTHER: + { + // No patch interaction so keep valid + } + break; + + case PATCH: + { + if (allCellTypes[cellI] != HOLE) + { + scalar overlapVol = sum(weights[subCellI]); + scalar v = mesh_.V()[cellI]; + if (overlapVol < (1.0-overlapTolerance_)*v) + { + //Pout<< "** Patch overlap:" << cellI + // << " at:" << mesh_.cellCentres()[cellI] << endl; + allCellTypes[cellI] = HOLE; + validDonors = false; + } + } + } + break; + + case OVERSET: + { + validDonors = false; + } + break; + } + + + if (validDonors) + { + // There are a few possible choices how to choose between multiple + // donor candidates: + // 1 highest overlap volume. However this is generally already + // 99.9% so you're just measuring truncation error. + // 2 smallest donors cells or most donor cells. This is quite + // often done but can cause switching of donor zone from one + // time step to the other if the donor meshes are non-uniform + // and the acceptor cells just happens to be sweeping through + // some small donor cells. + // 3 nearest zoneID. So zone 0 preferentially interpolates from + // zone 1, zone 1 preferentially from zone 2 etc. + + //- Option 1: + //scalar currentVol = sum(allWeights[cellI]); + //if (overlapVol[subCellI] > currentVol) + + //- Option 3: + label currentDiff = mag(subZoneID-allDonorID[cellI]); + label thisDiff = mag(subZoneID-donorZoneID); + + if + ( + allDonorID[cellI] == -1 + || (thisDiff < currentDiff) + || (thisDiff == currentDiff && donorZoneID > allDonorID[cellI]) + ) + { + allWeights[cellI] = weights[subCellI]; + allStencil[cellI] = + UIndirectList<label> + ( + otherCells, + addressing[subCellI] + ); + allDonorID[cellI] = donorZoneID; + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellCellStencils::cellVolumeWeight::cellVolumeWeight +( + const fvMesh& mesh, + const dictionary& dict, + const bool doUpdate +) +: + cellCellStencil(mesh), + dict_(dict), + overlapTolerance_(defaultOverlapTolerance_), + cellTypes_(labelList(mesh.nCells(), CALCULATED)), + interpolationCells_(0), + cellInterpolationMap_(), + cellStencil_(0), + cellInterpolationWeights_(0), + cellInterpolationWeight_ + ( + IOobject + ( + "cellInterpolationWeight", + mesh_.facesInstance(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ) +{ + if (doUpdate) + { + update(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellCellStencils::cellVolumeWeight::~cellVolumeWeight() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::cellCellStencils::cellVolumeWeight::update() +{ + scalar layerRelax(dict_.lookupOrDefault("layerRelax", 1.0)); + const labelIOList& zoneID = this->zoneID(); + + label nZones = gMax(zoneID)+1; + labelList nCellsPerZone(nZones, 0); + forAll(zoneID, cellI) + { + nCellsPerZone[zoneID[cellI]]++; + } + Pstream::listCombineGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineScatter(nCellsPerZone); + + + Info<< typeName << " : detected " << nZones + << " mesh regions" << nl << endl; + + + PtrList<fvMeshSubset> meshParts(nZones); + + Info<< incrIndent; + forAll(nCellsPerZone, zoneI) + { + Info<< indent<< "zone:" << zoneI << " nCells:" << nCellsPerZone[zoneI] + << endl; + meshParts.set(zoneI, new fvMeshSubset(mesh_)); + meshParts[zoneI].setLargeCellSubset(zoneID, zoneI); + } + Info<< decrIndent; + + + + // Current best guess for cells. Includes best stencil. Weights should + // add up to volume. + labelList allCellTypes(mesh_.nCells(), CALCULATED); + labelList allPatchTypes(mesh_.nCells(), OTHER); + labelListList allStencil(mesh_.nCells()); + scalarListList allWeights(mesh_.nCells()); + // zoneID of donor + labelList allDonorID(mesh_.nCells(), -1); + + + // Marking patch cells + forAll(meshParts, partI) + { + const fvMesh& partMesh = meshParts[partI].subMesh(); + const labelList& partCellMap = meshParts[partI].cellMap(); + + // Mark cells with + // - overset boundary + // - other, proper boundary + // - other cells + Info<< "Marking patch-cells on zone " << partI << endl; + markPatchCells(partMesh, partCellMap, allPatchTypes); + } + + + labelList nCells(count(3, allPatchTypes)); + Info<< nl + << "After patch analysis : nCells : " + << returnReduce(allPatchTypes.size(), sumOp<label>()) << nl + << incrIndent + << indent << "other : " << nCells[OTHER] << nl + << indent << "patch : " << nCells[PATCH] << nl + << indent << "overset: " << nCells[OVERSET] << nl + << decrIndent << endl; + + globalIndex globalCells(mesh_.nCells()); + + + for (label srcI = 0; srcI < meshParts.size()-1; srcI++) + { + const fvMesh& srcMesh = meshParts[srcI].subMesh(); + const labelList& srcCellMap = meshParts[srcI].cellMap(); + + for (label tgtI = srcI+1; tgtI < meshParts.size(); tgtI++) + { + const fvMesh& tgtMesh = meshParts[tgtI].subMesh(); + const labelList& tgtCellMap = meshParts[tgtI].cellMap(); + + meshToMesh mapper + ( + srcMesh, + tgtMesh, + meshToMesh::imCellVolumeWeight, + HashTable<word>(0), // patchMap, + wordList(0), // cuttingPatches + false // do not normalise + ); + + + { + // Get tgt patch types on src mesh + labelList interpolatedTgtPatchTypes(srcMesh.nCells(), -1); + interpolatePatchTypes + ( + mapper.tgtMap(), // How to get remote data local + mapper.srcToTgtCellAddr(), + labelList(UIndirectList<label>(allPatchTypes, tgtCellMap)), + interpolatedTgtPatchTypes + ); + + // Get target cell labels in global cell indexing (on overall + // mesh) + labelList tgtGlobalCells(tgtMesh.nCells()); + { + forAll(tgtCellMap, tgtCellI) + { + label cellI = tgtCellMap[tgtCellI]; + tgtGlobalCells[tgtCellI] = globalCells.toGlobal(cellI); + } + if (mapper.tgtMap().valid()) + { + mapper.tgtMap()().distribute(tgtGlobalCells); + } + } + combineCellTypes + ( + srcI, + srcMesh, + srcCellMap, + + tgtI, + mapper.srcToTgtCellAddr(), + mapper.srcToTgtCellWght(), + tgtGlobalCells, + interpolatedTgtPatchTypes, + + // Overall mesh data + allStencil, + allWeights, + allCellTypes, + allDonorID + ); + } + + { + // Get src patch types on tgt mesh + labelList interpolatedSrcPatchTypes(tgtMesh.nCells(), -1); + interpolatePatchTypes + ( + mapper.srcMap(), // How to get remote data local + mapper.tgtToSrcCellAddr(), + labelList(UIndirectList<label>(allPatchTypes, srcCellMap)), + interpolatedSrcPatchTypes + ); + + labelList srcGlobalCells(srcMesh.nCells()); + { + forAll(srcCellMap, srcCellI) + { + label cellI = srcCellMap[srcCellI]; + srcGlobalCells[srcCellI] = globalCells.toGlobal(cellI); + } + if (mapper.srcMap().valid()) + { + mapper.srcMap()().distribute(srcGlobalCells); + } + } + + combineCellTypes + ( + tgtI, + tgtMesh, + tgtCellMap, + + srcI, + mapper.tgtToSrcCellAddr(), + mapper.tgtToSrcCellWght(), + srcGlobalCells, + interpolatedSrcPatchTypes, + + // Overall mesh data + allStencil, + allWeights, + allCellTypes, + allDonorID + ); + } + } + } + + + // Use the patch types and weights to decide what to do + forAll(allPatchTypes, cellI) + { + if (allCellTypes[cellI] != HOLE) + { + switch (allPatchTypes[cellI]) + { + case OVERSET: + { + // Interpolate. Check if enough overlap + scalar v = mesh_.V()[cellI]; + scalar overlapVol = sum(allWeights[cellI]); + if (overlapVol > (1.0-overlapTolerance_)*v) + { + allCellTypes[cellI] = INTERPOLATED; + } + else + { + //Pout<< "Holeing interpolated cell:" << cellI + // << " at:" << mesh_.cellCentres()[cellI] << endl; + allCellTypes[cellI] = HOLE; + allWeights[cellI].clear(); + allStencil[cellI].clear(); + } + break; + } + } + } + } + + + // Knock out cell with insufficient interpolation weights + forAll(allCellTypes, cellI) + { + if (allCellTypes[cellI] == INTERPOLATED) + { + scalar v = mesh_.V()[cellI]; + scalar overlapVol = sum(allWeights[cellI]); + if (overlapVol < (1.0-overlapTolerance_)*v) + { + //Pout<< "Holeing cell:" << cellI + // << " at:" << mesh_.cellCentres()[cellI] << endl; + allCellTypes[cellI] = HOLE; + allWeights[cellI].clear(); + allStencil[cellI].clear(); + } + } + } + + + // Mark unreachable bits + findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes); + + + // Add buffer interpolation layer around holes + scalarField allWeight(mesh_.nCells(), 0.0); + walkFront(layerRelax, allCellTypes, allWeight); + + + // Normalise weights, Clear storage + forAll(allCellTypes, cellI) + { + if (allCellTypes[cellI] == INTERPOLATED) + { + if (allWeight[cellI] < SMALL || allStencil[cellI].size() == 0) + { + //Pout<< "Clearing cell:" << cellI + // << " at:" << mesh_.cellCentres()[cellI] << endl; + allWeights[cellI].clear(); + allStencil[cellI].clear(); + allWeight[cellI] = 0.0; + } + else + { + scalar s = sum(allWeights[cellI]); + forAll(allWeights[cellI], i) + { + allWeights[cellI][i] /= s; + } + } + } + else + { + allWeights[cellI].clear(); + allStencil[cellI].clear(); + } + } + + + // Write to volField for debugging + if (debug) + { + volScalarField patchTypes + ( + IOobject + ( + "patchTypes", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(patchTypes.internalField(), cellI) + { + patchTypes[cellI] = allPatchTypes[cellI]; + } + patchTypes.correctBoundaryConditions(); + patchTypes.write(); + } + if (debug) + { + volScalarField volTypes + ( + IOobject + ( + "cellTypes", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(volTypes.internalField(), cellI) + { + volTypes[cellI] = allCellTypes[cellI]; + } + volTypes.correctBoundaryConditions(); + volTypes.write(); + } + + + + cellTypes_.transfer(allCellTypes); + cellStencil_.transfer(allStencil); + cellInterpolationWeights_.transfer(allWeights); + cellInterpolationWeight_.transfer(allWeight); + cellInterpolationWeight_.correctBoundaryConditions(); + + DynamicList<label> interpolationCells; + forAll(cellStencil_, cellI) + { + if (cellStencil_[cellI].size()) + { + interpolationCells.append(cellI); + } + } + interpolationCells_.transfer(interpolationCells); + + + List<Map<label> > compactMap; + mapDistribute map(globalCells, cellStencil_, compactMap); + cellInterpolationMap_.transfer(map); + + // Dump interpolation stencil + if (debug) + { + // Dump weight + cellInterpolationWeight_.instance() = mesh_.time().timeName(); + cellInterpolationWeight_.write(); + + + mkDir(mesh_.time().timePath()); + OBJstream str(mesh_.time().timePath()/"stencil2.obj"); + Info<< typeName << " : dumping to " << str.name() << endl; + pointField cc(mesh_.cellCentres()); + cellInterpolationMap_.distribute(cc); + + forAll(interpolationCells_, compactI) + { + label cellI = interpolationCells_[compactI]; + const labelList& slots = cellStencil_[cellI]; + + Pout<< "cellI:" << cellI << " at:" + << mesh_.cellCentres()[cellI] + << " calculated from slots:" << slots + << " cc:" << UIndirectList<point>(cc, slots)() + << " weights:" << cellInterpolationWeights_[cellI] + << endl; + + forAll(slots, i) + { + const point& donorCc = cc[slots[i]]; + const point& accCc = mesh_.cellCentres()[cellI]; + + str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); + } + } + } + + + { + labelList nCells(count(3, cellTypes_)); + Info<< "Overset analysis : nCells : " + << returnReduce(cellTypes_.size(), sumOp<label>()) << nl + << incrIndent + << indent << "calculated : " << nCells[CALCULATED] << nl + << indent << "interpolated : " << nCells[INTERPOLATED] << nl + << indent << "hole : " << nCells[HOLE] << nl + << decrIndent << endl; + } + + // Tbd: detect if anything changed. Most likely it did! + return true; +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.H b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.H new file mode 100644 index 0000000000000000000000000000000000000000..4331b1421f5e4c0b82b6c10fac66492e15c319ef --- /dev/null +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.H @@ -0,0 +1,242 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::cellCellStencils::cellVolumeWeight + +Description + Volume-weighted interpolation stencil + +SourceFiles + cellVolumeWeightCellCellStencil.C + cellVolumeWeightCellCellStencilTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellCellStencils_cellVolumeWeight_H +#define cellCellStencils_cellVolumeWeight_H + +#include "cellCellStencil.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace cellCellStencils +{ + +/*---------------------------------------------------------------------------*\ + Class cellVolumeWeight Declaration +\*---------------------------------------------------------------------------*/ + +class cellVolumeWeight +: + public cellCellStencil +{ +protected: + + // Static data members + + //- Default overlap tolerance. Fraction of volume + static scalar defaultOverlapTolerance_; + + + // Protected data + + //- Dictionary of motion control parameters + const dictionary dict_; + + //- Tolerance for volume overlap. Fraction of volume + scalar overlapTolerance_; + + //- Per cell the cell type + labelList cellTypes_; + + //- Indices of interpolated cells + labelList interpolationCells_; + + //- Fetch interpolated cells + mapDistribute cellInterpolationMap_; + + //- Interpolation stencil + labelListList cellStencil_; + + //- Interpolation weights + List<scalarList> cellInterpolationWeights_; + + //- Amount of interpolation + volScalarField cellInterpolationWeight_; + + + // Protected Member Functions + + void walkFront + ( + const scalar layerRelax, + labelList& allCellTypes, + scalarField& allWeight + ) const; + + //- Find cells next to cells of type PATCH + void findHoles + ( + const globalIndex& globalCells, + const fvMesh& mesh, + const labelList& zoneID, + const labelListList& stencil, + labelList& cellTypes + ) const; + + //- according to additionalDocumentation/MEJ_oversetMesh.txt + void markPatchCells + ( + const fvMesh& mesh, + const labelList& cellMap, + labelList& patchCellTypes + ) const; + + void combineCellTypes + ( + const label subZoneID, + const fvMesh& subMesh, + const labelList& subCellMap, + + const label donorZoneID, + const labelListList& toOtherCells, + const List<scalarList>& weights, + const labelList& otherCells, + const labelList& interpolatedOtherPatchTypes, + + labelListList& allStencil, + scalarListList& allWeights, + labelList& allCellTypes, + labelList& allDonorID + ) const; + + //- interpolate (= combine) patch types + void interpolatePatchTypes + ( + const labelListList& addressing, + const labelList& patchTypes, + labelList& result + ) const; + + //- interpolate (= combine) patch types + void interpolatePatchTypes + ( + const autoPtr<mapDistribute>& mapPtr, + const labelListList& addressing, + const labelList& patchTypes, + labelList& result + ) const; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + cellVolumeWeight(const cellVolumeWeight&); + + //- Disallow default bitwise assignment + void operator=(const cellVolumeWeight&); + + +public: + + //- Runtime type information + TypeName("cellVolumeWeight"); + + + // Constructors + + //- Construct from fvMesh + cellVolumeWeight(const fvMesh&, const dictionary&, const bool doUpdate); + + + //- Destructor + virtual ~cellVolumeWeight(); + + + // Member Functions + + //- Access to volume overlap tolerance + scalar overlapTolerance() const + { + return overlapTolerance_; + } + + //- Update stencils. Return false if nothing changed. + virtual bool update(); + + //- Return the cell type list + virtual const labelUList& cellTypes() const + { + return cellTypes_; + } + + //- Indices of interpolated cells + virtual const labelUList& interpolationCells() const + { + return interpolationCells_; + } + + //- Return a communication schedule + virtual const mapDistribute& cellInterpolationMap() const + { + return cellInterpolationMap_; + } + + //- Per interpolated cell the neighbour cells (in terms of slots as + // constructed by above cellInterpolationMap) to interpolate + virtual const labelListList& cellStencil() const + { + return cellStencil_; + } + + //- Weights for cellStencil + virtual const List<scalarList>& cellInterpolationWeights() const + { + return cellInterpolationWeights_; + } + + //- Per interpolated cell the interpolation factor. (0 = use + // calculated, 1 = use interpolated) + virtual const scalarList& cellInterpolationWeight() const + { + return cellInterpolationWeight_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace cellCellStencils +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C new file mode 100644 index 0000000000000000000000000000000000000000..4a5cdbe8a2cc720a4924f1b274ee5811045b31b7 --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C @@ -0,0 +1,2059 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify i + 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "inverseDistanceCellCellStencil.H" +#include "addToRunTimeSelectionTable.H" +#include "OBJstream.H" +#include "Time.H" +#include "fvMeshSubset.H" + +#include "globalIndex.H" +#include "oversetFvPatch.H" +#include "zeroGradientFvPatchFields.H" +#include "syncTools.H" +#include "treeBoundBoxList.H" +#include "waveMethod.H" + +#include "regionSplit.H" +//#include "minData.H" +//#include "FaceCellWave.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace cellCellStencils +{ + defineTypeNameAndDebug(inverseDistance, 0); + addToRunTimeSelectionTable(cellCellStencil, inverseDistance, mesh); +} +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::label Foam::cellCellStencils::inverseDistance::index +( + const labelVector& nDivs, + const labelVector& ijk +) +{ + return (ijk[0]*nDivs[1] + ijk[1])*nDivs[2] + ijk[2]; +} + + +Foam::labelVector Foam::cellCellStencils::inverseDistance::index3 +( + const labelVector& nDivs, + const label boxI +) +{ + label ij = boxI/nDivs[2]; + label k = boxI-ij*nDivs[2]; + label i = ij/nDivs[1]; + label j = ij-i*nDivs[1]; + + return labelVector(i, j, k); +} + + +Foam::labelVector Foam::cellCellStencils::inverseDistance::index3 +( + const boundBox& bb, + const labelVector& nDivs, + const point& pt +) +{ + const vector d(bb.span()); + const point relPt(pt-bb.min()); + + return labelVector + ( + floor(relPt[0]/d[0]*nDivs[0]), + floor(relPt[1]/d[1]*nDivs[1]), + floor(relPt[2]/d[2]*nDivs[2]) + ); +} + + +Foam::point Foam::cellCellStencils::inverseDistance::position +( + const boundBox& bb, + const labelVector& nDivs, + const label boxI +) +{ + // Return midpoint of box indicated by boxI + labelVector ids(index3(nDivs, boxI)); + + const vector d(bb.span()); + const vector sz(d[0]/nDivs[0], d[1]/nDivs[1], d[2]/nDivs[2]); + + return bb.min()+0.5*sz+vector(sz[0]*ids[0], sz[1]*ids[1], sz[2]*ids[2]); +} + + +void Foam::cellCellStencils::inverseDistance::fill +( + PackedList<2>& elems, + const boundBox& bb, + const labelVector& nDivs, + const boundBox& subBb, + const unsigned int val +) +{ + labelVector minIds(index3(bb, nDivs, subBb.min())); + labelVector maxIds(index3(bb, nDivs, subBb.max())); + + for (direction cmpt = 0; cmpt < 3; cmpt++) + { + if (maxIds[cmpt] < 0 || minIds[cmpt] > nDivs[cmpt]) + { + return; + } + } + + labelVector maxIndex(labelVector(nDivs[0]-1, nDivs[1]-1, nDivs[2]-1)); + minIds = max(labelVector::zero, minIds); + maxIds = min(maxIndex, maxIds); + + for (label i = minIds[0]; i <= maxIds[0]; i++) + { + for (label j = minIds[1]; j <= maxIds[1]; j++) + { + for (label k = minIds[2]; k <= maxIds[2]; k++) + { + label i1 = index(nDivs, labelVector(i, j, k)); + elems[i1] = val; + } + } + } +} + + +void Foam::cellCellStencils::inverseDistance::markBoundaries +( + const fvMesh& mesh, + + const boundBox& bb, + const labelVector& nDivs, + PackedList<2>& patchTypes, + + const labelList& cellMap, + labelList& patchCellTypes +) +{ + // Mark all voxels that overlap the bounding box of any patch + + const fvBoundaryMesh& pbm = mesh.boundary(); + + patchTypes = patchCellType::OTHER; + + // Mark wall boundaries + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + const labelList& fc = fvp.faceCells(); + + if (!fvPatch::constraintType(fvp.type())) + { + //Info<< "Marking cells on proper patch " << fvp.name() + // << " with type " << fvp.type() << endl; + const polyPatch& pp = fvp.patch(); + forAll(pp, i) + { + // Mark in overall patch types + patchCellTypes[cellMap[fc[i]]] = patchCellType::PATCH; + + // Mark in voxel mesh + boundBox faceBb(pp.points(), pp[i], false); + if (bb.overlaps(faceBb)) + { + fill(patchTypes, bb, nDivs, faceBb, patchCellType::PATCH); + } + } + } + } + + // Override with overset boundaries + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + const labelList& fc = fvp.faceCells(); + + if (isA<oversetFvPatch>(fvp)) + { + //Info<< "Marking cells on overset patch " << fvp.name() << endl; + const polyPatch& pp = fvp.patch(); + forAll(pp, i) + { + // Mark in overall patch types + patchCellTypes[cellMap[fc[i]]] = patchCellType::OVERSET; + + // Mark in voxel mesh + boundBox faceBb(pp.points(), pp[i], false); + if (bb.overlaps(faceBb)) + { + fill(patchTypes, bb, nDivs, faceBb, patchCellType::OVERSET); + } + } + } + } +} + + +Foam::treeBoundBox Foam::cellCellStencils::inverseDistance::cellBb +( + const primitiveMesh& mesh, + const label celli +) +{ + const cellList& cells = mesh.cells(); + const faceList& faces = mesh.faces(); + const pointField& points = mesh.points(); + + treeBoundBox bb + ( + vector(GREAT, GREAT, GREAT), + vector(-GREAT, -GREAT, -GREAT) + ); + + const cell& cFaces = cells[celli]; + + forAll(cFaces, cFacei) + { + const face& f = faces[cFaces[cFacei]]; + + forAll(f, fp) + { + const point& p = points[f[fp]]; + + bb.min() = min(bb.min(), p); + bb.max() = max(bb.max(), p); + } + } + return bb; +} + + +bool Foam::cellCellStencils::inverseDistance::overlaps +( + const boundBox& bb, + const labelVector& nDivs, + const PackedList<2>& vals, + const treeBoundBox& subBb, + const unsigned int val +) +{ + // Checks if subBb overlaps any voxel set to val + + labelVector minIds(index3(bb, nDivs, subBb.min())); + labelVector maxIds(index3(bb, nDivs, subBb.max())); + + for (direction cmpt = 0; cmpt < 3; cmpt++) + { + if (maxIds[cmpt] < 0 || minIds[cmpt] > nDivs[cmpt]) + { + return false; + } + } + + labelVector maxIndex(labelVector(nDivs[0]-1, nDivs[1]-1, nDivs[2]-1)); + minIds = max(labelVector::zero, minIds); + maxIds = min(maxIndex, maxIds); + + for (label i = minIds[0]; i <= maxIds[0]; i++) + { + for (label j = minIds[1]; j <= maxIds[1]; j++) + { + for (label k = minIds[2]; k <= maxIds[2]; k++) + { + label i1 = index(nDivs, labelVector(i, j, k)); + if (vals[i1] == patchCellType::PATCH) + { + return true; + } + } + } + } + return false; +} + + +void Foam::cellCellStencils::inverseDistance::markPatchesAsHoles +( + PstreamBuffers& pBufs, + + const PtrList<fvMeshSubset>& meshParts, + + const List<treeBoundBoxList>& patchBb, + const List<labelVector>& patchDivisions, + const PtrList<PackedList<2>>& patchParts, + + const label srcI, + const label tgtI, + labelList& allCellTypes +) const +{ + const treeBoundBoxList& srcPatchBbs = patchBb[srcI]; + const treeBoundBoxList& tgtPatchBbs = patchBb[tgtI]; + const labelList& tgtCellMap = meshParts[tgtI].cellMap(); + + // 1. do processor-local src-tgt patch overlap + { + const treeBoundBox& srcPatchBb = srcPatchBbs[Pstream::myProcNo()]; + const treeBoundBox& tgtPatchBb = tgtPatchBbs[Pstream::myProcNo()]; + + if (srcPatchBb.overlaps(tgtPatchBb)) + { + const PackedList<2>& srcPatchTypes = patchParts[srcI]; + const labelVector& zoneDivs = patchDivisions[srcI]; + + forAll(tgtCellMap, tgtCelli) + { + label celli = tgtCellMap[tgtCelli]; + if + ( + overlaps + ( + srcPatchBb, + zoneDivs, + srcPatchTypes, + cellBb(mesh_, celli), + patchCellType::PATCH + ) + ) + { + allCellTypes[celli] = HOLE; + } + } + } + } + + + // 2. Send over srcMesh bits that overlap tgt and do calculation + pBufs.clear(); + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + if (procI != Pstream::myProcNo()) + { + const treeBoundBox& srcPatchBb = srcPatchBbs[Pstream::myProcNo()]; + const treeBoundBox& tgtPatchBb = tgtPatchBbs[procI]; + + if (srcPatchBb.overlaps(tgtPatchBb)) + { + // Send over complete patch voxel map. Tbd: could + // subset + UOPstream os(procI, pBufs); + os << srcPatchBb << patchDivisions[srcI] << patchParts[srcI]; + } + } + } + pBufs.finishedSends(); + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + if (procI != Pstream::myProcNo()) + { + //const treeBoundBox& srcBb = srcBbs[procI]; + const treeBoundBox& srcPatchBb = srcPatchBbs[procI]; + const treeBoundBox& tgtPatchBb = tgtPatchBbs[Pstream::myProcNo()]; + + if (srcPatchBb.overlaps(tgtPatchBb)) + { + UIPstream is(procI, pBufs); + { + treeBoundBox receivedBb(is); + if (srcPatchBb != receivedBb) + { + FatalErrorInFunction + << "proc:" << procI + << " srcPatchBb:" << srcPatchBb + << " receivedBb:" << receivedBb + << exit(FatalError); + } + } + const labelVector zoneDivs(is); + const PackedList<2> srcPatchTypes(is); + + forAll(tgtCellMap, tgtCelli) + { + label celli = tgtCellMap[tgtCelli]; + if + ( + overlaps + ( + srcPatchBb, + zoneDivs, + srcPatchTypes, + cellBb(mesh_, celli), + patchCellType::PATCH + ) + ) + { + allCellTypes[celli] = HOLE; + } + } + } + } + } +} + + +void Foam::cellCellStencils::inverseDistance::markDonors +( + const globalIndex& globalCells, + PstreamBuffers& pBufs, + const PtrList<fvMeshSubset>& meshParts, + const List<treeBoundBoxList>& meshBb, + + const label srcI, + const label tgtI, + labelListList& allStencil, + labelList& allDonor +) const +{ + const treeBoundBoxList& srcBbs = meshBb[srcI]; + const treeBoundBoxList& tgtBbs = meshBb[tgtI]; + + const fvMesh& srcMesh = meshParts[srcI].subMesh(); + const labelList& srcCellMap = meshParts[srcI].cellMap(); + const fvMesh& tgtMesh = meshParts[tgtI].subMesh(); + const pointField& tgtCc = tgtMesh.cellCentres(); + const labelList& tgtCellMap = meshParts[tgtI].cellMap(); + + // 1. do processor-local src/tgt overlap + { + labelList tgtToSrcAddr; + waveMethod::calculate(tgtMesh, srcMesh, tgtToSrcAddr); + forAll(tgtCellMap, tgtCelli) + { + label srcCelli = tgtToSrcAddr[tgtCelli]; + if (srcCelli != -1) + { + label celli = tgtCellMap[tgtCelli]; + label globalDonor = + globalCells.toGlobal(srcCellMap[srcCelli]); + allStencil[celli].setSize(1); + allStencil[celli][0] = globalDonor; + allDonor[celli] = srcI; + } + } + } + + + // 2. Send over tgtMesh bits that overlap src and do calculation on + // srcMesh. + + + // (remote) processors where the tgt overlaps my src + DynamicList<label> tgtOverlapProcs(Pstream::nProcs()); + // (remote) processors where the src overlaps my tgt + DynamicList<label> srcOverlapProcs(Pstream::nProcs()); + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + if (procI != Pstream::myProcNo()) + { + if (tgtBbs[procI].overlaps(srcBbs[Pstream::myProcNo()])) + { + tgtOverlapProcs.append(procI); + } + if (srcBbs[procI].overlaps(tgtBbs[Pstream::myProcNo()])) + { + srcOverlapProcs.append(procI); + } + } + } + + + + // Indices of tgtcells to send over to each processor + List<DynamicList<label> > tgtSendCells(Pstream::nProcs()); + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + tgtSendCells[procI].reserve(tgtMesh.nCells()/srcOverlapProcs.size()); + } + + + forAll(tgtCellMap, tgtCelli) + { + label celli = tgtCellMap[tgtCelli]; + if (allStencil[celli].empty()) + { + const treeBoundBox subBb(cellBb(mesh_, celli)); + + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + if (subBb.overlaps(srcBbs[procI])) + { + tgtSendCells[procI].append(tgtCelli); + } + } + } + } + + // Send target cell centres to overlapping processors + pBufs.clear(); + + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + const labelList& cellIDs = tgtSendCells[procI]; + + UOPstream os(procI, pBufs); + os << UIndirectList<point>(tgtCc, cellIDs); + } + pBufs.finishedSends(); + + // Receive bits of target processors; find; send back + (void)srcMesh.tetBasePtIs(); + forAll(tgtOverlapProcs, i) + { + label procI = tgtOverlapProcs[i]; + + UIPstream is(procI, pBufs); + pointList samples(is); + + labelList donors(samples.size(), -1); + forAll(samples, sampleI) + { + const point& sample = samples[sampleI]; + label srcCelli = srcMesh.findCell(sample, polyMesh::CELL_TETS); + if (srcCelli != -1) + { + donors[sampleI] = globalCells.toGlobal(srcCellMap[srcCelli]); + } + } + + // Use same pStreamBuffers to send back. + UOPstream os(procI, pBufs); + os << donors; + } + pBufs.finishedSends(); + + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + const labelList& cellIDs = tgtSendCells[procI]; + + UIPstream is(procI, pBufs); + labelList donors(is); + + if (donors.size() != cellIDs.size()) + { + FatalErrorInFunction<< "problem : cellIDs:" << cellIDs.size() + << " donors:" << donors.size() << abort(FatalError); + } + + forAll(donors, donorI) + { + label globalDonor = donors[donorI]; + + if (globalDonor != -1) + { + label celli = tgtCellMap[cellIDs[donorI]]; + + // TBD: check for multiple donors. Maybe better one? + if (allStencil[celli].empty()) + { + allStencil[celli].setSize(1); + allStencil[celli][0] = globalDonor; + allDonor[celli] = srcI; + } + } + } + } +} + + +//void Foam::cellCellStencils::inverseDistance::uncompactedRegionSplit +//( +// const fvMesh& mesh, +// const globalIndex& globalFaces, +// const label nZones, +// const labelList& zoneID, +// const labelList& cellTypes, +// const boolList& isBlockedFace, +// labelList& cellRegion +//) const +//{ +// // Pass 1: locally seed 2 cells per zone (one unblocked, one blocked). +// // This avoids excessive numbers of front +// +// // Field on cells and faces. +// List<minData> cellData(mesh.nCells()); +// List<minData> faceData(mesh.nFaces()); +// +// // Take over blockedFaces by seeding a negative number +// // (so is always less than the decomposition) +// +// forAll(isBlockedFace, facei) +// { +// if (isBlockedFace[facei]) +// { +// faceData[facei] = minData(-2); +// } +// } +// +// +// labelList seedFace(nZones, -1); +// +// const labelList& owner = mesh.faceOwner(); +// const labelList& neighbour = mesh.faceNeighbour(); +// +// forAll(owner, facei) +// { +// label own = owner[facei]; +// if (seedFace[zoneID[own]] == -1) +// { +// if (cellTypes[own] != HOLE) +// { +// const cell& cFaces = mesh.cells()[own]; +// forAll(cFaces, i) +// { +// if (!isBlockedFace[cFaces[i]]) +// { +// seedFace[zoneID[own]] = cFaces[i]; +// } +// } +// } +// } +// } +// forAll(neighbour, facei) +// { +// label nei = neighbour[facei]; +// if (seedFace[zoneID[nei]] == -1) +// { +// if (cellTypes[nei] != HOLE) +// { +// const cell& cFaces = mesh.cells()[nei]; +// forAll(cFaces, i) +// { +// if (!isBlockedFace[cFaces[i]]) +// { +// seedFace[zoneID[nei]] = cFaces[i]; +// } +// } +// } +// } +// } +// +// DynamicList<label> seedFaces(nZones); +// DynamicList<minData> seedData(seedFaces.size()); +// forAll(seedFace, zonei) +// { +// if (seedFace[zonei] != -1) +// { +// seedFaces.append(seedFace[zonei]); +// seedData.append(minData(globalFaces.toGlobal(seedFace[zonei]))); +// } +// } +// +// // Propagate information inwards +// FaceCellWave<minData> deltaCalc +// ( +// mesh, +// List<labelPair>(), +// false, // disable walking through cyclicAMI for backwards +// // compatibility +// seedFaces, +// seedData, +// faceData, +// cellData, +// mesh.globalData().nTotalCells()+1 +// ); +// +// // Extract +// cellRegion.setSize(mesh.nCells()); +// forAll(cellRegion, celli) +// { +// if (cellData[celli].valid(deltaCalc.data())) +// { +// cellRegion[celli] = cellData[celli].data(); +// } +// else +// { +// // Unvisited cell -> only possible if surrounded by blocked faces. +// // If so make up region from any of the faces +// const cell& cFaces = mesh.cells()[celli]; +// label facei = cFaces[0]; +// cellRegion[celli] = globalFaces.toGlobal(facei); +// } +// } +//} +//Foam::autoPtr<Foam::globalIndex> +//Foam::cellCellStencils::inverseDistance::compactedRegionSplit +//( +// const fvMesh& mesh, +// const globalIndex& globalRegions, +// labelList& cellRegion +//) const +//{ +// // Now our cellRegion will have +// // - non-local regions (i.e. originating from other processors) +// // - non-compact locally originating regions +// // so we'll need to compact +// +// // 4a: count per originating processor the number of regions +// labelList nOriginating(Pstream::nProcs(), 0); +// { +// labelHashSet haveRegion(mesh.nCells()/8); +// +// forAll(cellRegion, celli) +// { +// label region = cellRegion[celli]; +// +// // Count originating processor. Use isLocal as efficiency since +// // most cells are locally originating. +// if (globalRegions.isLocal(region)) +// { +// if (haveRegion.insert(region)) +// { +// nOriginating[Pstream::myProcNo()]++; +// } +// } +// else +// { +// label proci = globalRegions.whichProcID(region); +// if (haveRegion.insert(region)) +// { +// nOriginating[proci]++; +// } +// } +// } +// } +// +// if (debug) +// { +// Pout<< "Counted " << nOriginating[Pstream::myProcNo()] +// << " local regions." << endl; +// } +// +// +// // Global numbering for compacted local regions +// autoPtr<globalIndex> globalCompactPtr +// ( +// new globalIndex(nOriginating[Pstream::myProcNo()]) +// ); +// const globalIndex& globalCompact = globalCompactPtr(); +// +// +// // 4b: renumber +// // Renumber into compact indices. Note that since we've already made +// // all regions global we now need a Map to store the compacting +// // information +// // instead of a labelList - otherwise we could have used a straight +// // labelList. +// +// // Local compaction map +// Map<label> globalToCompact(2*nOriginating[Pstream::myProcNo()]); +// // Remote regions we want the compact number for +// List<labelHashSet> nonLocal(Pstream::nProcs()); +// forAll(nonLocal, proci) +// { +// if (proci != Pstream::myProcNo()) +// { +// nonLocal[proci].resize(2*nOriginating[proci]); +// } +// } +// +// forAll(cellRegion, celli) +// { +// label region = cellRegion[celli]; +// if (globalRegions.isLocal(region)) +// { +// // Insert new compact region (if not yet present) +// globalToCompact.insert +// ( +// region, +// globalCompact.toGlobal(globalToCompact.size()) +// ); +// } +// else +// { +// nonLocal[globalRegions.whichProcID(region)].insert(region); +// } +// } +// +// +// // Now we have all the local regions compacted. Now we need to get the +// // non-local ones from the processors to whom they are local. +// // Convert the nonLocal (labelHashSets) to labelLists. +// +// labelListList sendNonLocal(Pstream::nProcs()); +// forAll(sendNonLocal, proci) +// { +// sendNonLocal[proci] = nonLocal[proci].toc(); +// } +// +// if (debug) +// { +// forAll(sendNonLocal, proci) +// { +// Pout<< " from processor " << proci +// << " want " << sendNonLocal[proci].size() +// << " region numbers." << endl; +// } +// Pout<< endl; +// } +// +// +// // Get the wanted region labels into recvNonLocal +// labelListList recvNonLocal; +// Pstream::exchange<labelList, label>(sendNonLocal, recvNonLocal); +// +// // Now we have the wanted compact region labels that proci wants in +// // recvNonLocal[proci]. Construct corresponding list of compact +// // region labels to send back. +// +// labelListList sendWantedLocal(Pstream::nProcs()); +// forAll(recvNonLocal, proci) +// { +// const labelList& nonLocal = recvNonLocal[proci]; +// sendWantedLocal[proci].setSize(nonLocal.size()); +// +// forAll(nonLocal, i) +// { +// sendWantedLocal[proci][i] = globalToCompact[nonLocal[i]]; +// } +// } +// +// +// // Send back (into recvNonLocal) +// recvNonLocal.clear(); +// Pstream::exchange<labelList, label>(sendWantedLocal, recvNonLocal); +// sendWantedLocal.clear(); +// +// // Now recvNonLocal contains for every element in setNonLocal the +// // corresponding compact number. Insert these into the local compaction +// // map. +// +// forAll(recvNonLocal, proci) +// { +// const labelList& wantedRegions = sendNonLocal[proci]; +// const labelList& compactRegions = recvNonLocal[proci]; +// +// forAll(wantedRegions, i) +// { +// globalToCompact.insert(wantedRegions[i], compactRegions[i]); +// } +// } +// +// // Finally renumber the regions +// forAll(cellRegion, celli) +// { +// cellRegion[celli] = globalToCompact[cellRegion[celli]]; +// } +// +// return globalCompactPtr; +//} + + +void Foam::cellCellStencils::inverseDistance::findHoles +( + const globalIndex& globalCells, + const fvMesh& mesh, + const labelList& zoneID, + const labelListList& stencil, + labelList& cellTypes +) const +{ + const fvBoundaryMesh& pbm = mesh.boundary(); + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + + + // The input cellTypes will be + // - HOLE : cell part covered by other-mesh patch + // - INTERPOLATED : cell fully covered by other-mesh patch + // or next to 'overset' patch + // - CALCULATED : otherwise + // + // so we start a walk from our patches and any cell we cannot reach + // (because we walk is stopped by other-mesh patch) is a hole. + + + DebugInfo<< FUNCTION_NAME << " : Starting hole flood filling" << endl; + + DebugInfo<< FUNCTION_NAME << " : Starting hole cells : " + << findIndices(cellTypes, HOLE).size() << endl; + + boolList isBlockedFace(mesh.nFaces(), false); + label nBlocked = 0; + + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label ownType = cellTypes[own[faceI]]; + label neiType = cellTypes[nei[faceI]]; + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + isBlockedFace[faceI] = true; + nBlocked++; + } + } + DebugInfo<< FUNCTION_NAME << " : Marked internal hole boundaries : " + << nBlocked << endl; + + + labelList nbrCellTypes; + syncTools::swapBoundaryCellList(mesh, cellTypes, nbrCellTypes); + + for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) + { + label ownType = cellTypes[own[faceI]]; + label neiType = nbrCellTypes[faceI-mesh.nInternalFaces()]; + + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + isBlockedFace[faceI] = true; + nBlocked++; + } + } + + DebugInfo<< FUNCTION_NAME << " : Marked all hole boundaries : " + << nBlocked << endl; + + // Determine regions + regionSplit cellRegion(mesh, isBlockedFace); + const label nRegions = cellRegion.nRegions(); + + //labelList cellRegion; + //label nRegions = -1; + //{ + // const globalIndex globalFaces(mesh.nFaces()); + // uncompactedRegionSplit + // ( + // mesh, + // globalFaces, + // gMax(zoneID)+1, + // zoneID, + // cellTypes, + // isBlockedFace, + // cellRegion + // ); + // autoPtr<globalIndex> globalRegions + // ( + // compactedRegionSplit + // ( + // mesh, + // globalFaces, + // cellRegion + // ) + // ); + // nRegions = globalRegions().size(); + //} + DebugInfo<< FUNCTION_NAME << " : Determined regions : " + << nRegions << endl; + + //Info<< typeName << " : detected " << nRegions + // << " mesh regions after overset" << nl << endl; + + + + // Now we'll have a mesh split according to where there are cells + // covered by the other-side patches. See what we can reach from our + // real patches + + // 0 : region not yet determined + // 1 : borders blockage so is not ok (but can be overriden by real + // patch) + // 2 : has real patch in it so is reachable + labelList regionType(nRegions, 0); + + + // See if any regions borders blockage. Note: isBlockedFace is already + // parallel synchronised. + { + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + if (isBlockedFace[faceI]) + { + label ownRegion = cellRegion[own[faceI]]; + + if (cellTypes[own[faceI]] != HOLE) + { + if (regionType[ownRegion] == 0) + { + regionType[ownRegion] = 1; + } + } + + label neiRegion = cellRegion[nei[faceI]]; + + if (cellTypes[nei[faceI]] != HOLE) + { + if (regionType[neiRegion] == 0) + { + regionType[neiRegion] = 1; + } + } + } + } + for + ( + label faceI = mesh.nInternalFaces(); + faceI < mesh.nFaces(); + faceI++ + ) + { + if (isBlockedFace[faceI]) + { + label ownRegion = cellRegion[own[faceI]]; + + if (regionType[ownRegion] == 0) + { + regionType[ownRegion] = 1; + } + } + } + } + + + // Override with real patches + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + + if (isA<oversetFvPatch>(fvp)) + {} + else if (!fvPatch::constraintType(fvp.type())) + { + const labelList& fc = fvp.faceCells(); + forAll(fc, i) + { + label regionI = cellRegion[fc[i]]; + + if (cellTypes[fc[i]] != HOLE && regionType[regionI] != 2) + { + regionType[regionI] = 2; + } + } + } + } + + DebugInfo<< FUNCTION_NAME << " : Done local analysis" << endl; + + // Now we've handled + // - cells next to blocked cells + // - coupled boundaries + // Only thing to handle is the interpolation between regions + + + labelListList compactStencil(stencil); + List<Map<label>> compactMap; + mapDistribute map(globalCells, compactStencil, compactMap); + + DebugInfo<< FUNCTION_NAME << " : Converted stencil into compact form" + << endl; + + + while (true) + { + // Synchronise region status on processors + // (could instead swap status through processor patches) + Pstream::listCombineGather(regionType, maxEqOp<label>()); + Pstream::listCombineScatter(regionType); + + DebugInfo<< FUNCTION_NAME << " : Gathered region type" << endl; + + // Communicate region status through interpolative cells + labelList cellRegionType(UIndirectList<label>(regionType, cellRegion)); + map.distribute(cellRegionType); + + DebugInfo<< FUNCTION_NAME << " : Interpolated region type" << endl; + + + + label nChanged = 0; + forAll(pbm, patchI) + { + const fvPatch& fvp = pbm[patchI]; + + if (isA<oversetFvPatch>(fvp)) + { + const labelUList& fc = fvp.faceCells(); + forAll(fc, i) + { + label cellI = fc[i]; + label regionI = cellRegion[cellI]; + + if (regionType[regionI] != 2) + { + const labelList& slots = compactStencil[cellI]; + forAll(slots, i) + { + label otherType = cellRegionType[slots[i]]; + + if (otherType == 2) + { + //Pout<< "Reachable through interpolation : " + // << regionI << " at cell " + // << mesh.cellCentres()[cellI] << endl; + regionType[regionI] = 2; + nChanged++; + break; + } + } + } + } + } + } + + reduce(nChanged, sumOp<label>()); + DebugInfo<< FUNCTION_NAME << " : Determined regions changed : " + << nChanged << endl; + + if (nChanged == 0) + { + break; + } + } + + + // See which regions have not been visited (regionType == 1) + forAll(cellRegion, cellI) + { + label type = regionType[cellRegion[cellI]]; + if (type == 1 && cellTypes[cellI] != HOLE) + { + cellTypes[cellI] = HOLE; + } + } + DebugInfo<< FUNCTION_NAME << " : Finished hole flood filling" << endl; +} + + +void Foam::cellCellStencils::inverseDistance::seedCell +( + const label cellI, + const scalar wantedFraction, + PackedBoolList& isFront, + scalarField& fraction +) const +{ + const cell& cFaces = mesh_.cells()[cellI]; + forAll(cFaces, i) + { + label nbrFacei = cFaces[i]; + if (fraction[nbrFacei] < wantedFraction) + { + fraction[nbrFacei] = wantedFraction; + isFront.set(nbrFacei); + } + } +} + + +void Foam::cellCellStencils::inverseDistance::walkFront +( + const scalar layerRelax, + const labelListList& allStencil, + labelList& allCellTypes, + scalarField& allWeight +) const +{ + // Current front + PackedBoolList isFront(mesh_.nFaces()); + + const fvBoundaryMesh& fvm = mesh_.boundary(); + + + // 'overset' patches + + forAll(fvm, patchI) + { + if (isA<oversetFvPatch>(fvm[patchI])) + { + forAll(fvm[patchI], i) + { + isFront[fvm[patchI].start()+i] = true; + } + } + } + + + // Outside of 'hole' region + { + const labelList& own = mesh_.faceOwner(); + const labelList& nei = mesh_.faceNeighbour(); + + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + label ownType = allCellTypes[own[faceI]]; + label neiType = allCellTypes[nei[faceI]]; + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + //Pout<< "Front at face:" << faceI + // << " at:" << mesh_.faceCentres()[faceI] << endl; + isFront[faceI] = true; + } + } + + labelList nbrCellTypes; + syncTools::swapBoundaryCellList(mesh_, allCellTypes, nbrCellTypes); + + for + ( + label faceI = mesh_.nInternalFaces(); + faceI < mesh_.nFaces(); + faceI++ + ) + { + label ownType = allCellTypes[own[faceI]]; + label neiType = nbrCellTypes[faceI-mesh_.nInternalFaces()]; + + if + ( + (ownType == HOLE && neiType != HOLE) + || (ownType != HOLE && neiType == HOLE) + ) + { + //Pout<< "Front at coupled face:" << faceI + // << " at:" << mesh_.faceCentres()[faceI] << endl; + isFront[faceI] = true; + } + } + } + + + // Current interpolation fraction + scalarField fraction(mesh_.nFaces(), 0.0); + + forAll(isFront, faceI) + { + if (isFront[faceI]) + { + fraction[faceI] = 1.0; + } + } + + + while (returnReduce(isFront.count(), sumOp<label>())) + { + // Interpolate cells on front + PackedBoolList newIsFront(mesh_.nFaces()); + scalarField newFraction(fraction); + forAll(isFront, faceI) + { + if (isFront[faceI]) + { + label own = mesh_.faceOwner()[faceI]; + if (allCellTypes[own] != HOLE) + { + if (allWeight[own] < fraction[faceI]) + { + // Cell wants to become interpolated (if sufficient + // stencil, otherwise becomes hole) + if (allStencil[own].size()) + { + allWeight[own] = fraction[faceI]; + allCellTypes[own] = INTERPOLATED; + // Add faces of cell (with lower weight) as new + // front + seedCell + ( + own, + fraction[faceI]-layerRelax, + newIsFront, + newFraction + ); + } + else + { + allWeight[own] = 0.0; + allCellTypes[own] = HOLE; + // Add faces of cell as new front + seedCell + ( + own, + 1.0, + newIsFront, + newFraction + ); + } + } + } + if (mesh_.isInternalFace(faceI)) + { + label nei = mesh_.faceNeighbour()[faceI]; + if (allCellTypes[nei] != HOLE) + { + if (allWeight[nei] < fraction[faceI]) + { + if (allStencil[nei].size()) + { + allWeight[nei] = fraction[faceI]; + allCellTypes[nei] = INTERPOLATED; + seedCell + ( + nei, + fraction[faceI]-layerRelax, + newIsFront, + newFraction + ); + } + else + { + allWeight[nei] = 0.0; + allCellTypes[nei] = HOLE; + seedCell + ( + nei, + 1.0, + newIsFront, + newFraction + ); + } + } + } + } + } + } + + syncTools::syncFaceList(mesh_, newIsFront, orEqOp<unsigned int>()); + syncTools::syncFaceList(mesh_, newFraction, maxEqOp<scalar>()); + + isFront.transfer(newIsFront); + fraction.transfer(newFraction); + } +} + + +void Foam::cellCellStencils::inverseDistance::calcStencilWeights +( + const point& sample, + const pointList& donorCcs, + scalarList& weights +) +{ + // Inverse-distance weighting + + weights.setSize(donorCcs.size()); + scalar sum = 0.0; + forAll(donorCcs, i) + { + scalar d = mag(sample-donorCcs[i]); + + if (d > ROOTVSMALL) + { + weights[i] = 1.0/d; + sum += weights[i]; + } + else + { + // Short circuit + weights = 0.0; + weights[i] = 1.0; + return; + } + } + forAll(weights, i) + { + weights[i] /= sum; + } +} + + +void Foam::cellCellStencils::inverseDistance::createStencil +( + const globalIndex& globalCells +) +{ + // Send cell centre back to donor + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // The complication is that multiple acceptors need the same donor + // (but with different weights obviously) + // So we do multi-pass: + // - send over cc of acceptor for which we want stencil. + // Consistenly choose the acceptor with smallest magSqr in case of + // multiple acceptors for the containing cell/donor. + // - find the cell-cells and weights for the donor + // - send back together with the acceptor cc + // - use the acceptor cc to see if it was 'me' that sent it. If so + // mark me as complete so it doesn't get involved in the next loop. + // - loop until all resolved. + + // Special value for unused points + const vector greatPoint(GREAT, GREAT, GREAT); + + // Has acceptor been handled already? + PackedBoolList doneAcceptor(interpolationCells_.size()); + + while (true) + { + pointField samples(cellInterpolationMap_.constructSize(), greatPoint); + + // Fill remote slots (override old content). We'll find out later + // on which one has won and mark this one in doneAcceptor. + label nSamples = 0; + forAll(interpolationCells_, i) + { + if (!doneAcceptor[i]) + { + label cellI = interpolationCells_[i]; + const point& cc = mesh_.cellCentres()[cellI]; + const labelList& slots = cellStencil_[cellI]; + + if (slots.size() != 1) + { + FatalErrorInFunction<< "Problem:" << slots + << abort(FatalError); + } + + forAll(slots, slotI) + { + label elemI = slots[slotI]; + //Pout<< " acceptor:" << cellI + // << " at:" << mesh_.cellCentres()[cellI] + // << " global:" << globalCells.toGlobal(cellI) + // << " foudn in donor:" << elemI << endl; + minMagSqrEqOp<point>()(samples[elemI], cc); + } + nSamples++; + } + } + + + if (returnReduce(nSamples, sumOp<label>()) == 0) + { + break; + } + + // Send back to donor. Make sure valid point takes priority + mapDistributeBase::distribute<point, minMagSqrEqOp<point>, flipOp> + ( + Pstream::commsTypes::nonBlocking, + List<labelPair>(), + mesh_.nCells(), + cellInterpolationMap_.constructMap(), + false, + cellInterpolationMap_.subMap(), + false, + samples, + minMagSqrEqOp<point>(), + flipOp(), // negateOp + greatPoint // nullValue + ); + + // All the donor cells will now have a valid cell centre. Construct a + // stencil for these. + + DynamicList<label> donorCells(mesh_.nCells()); + forAll(samples, cellI) + { + if (samples[cellI] != greatPoint) + { + donorCells.append(cellI); + } + } + + + // Get neighbours (global cell and centre) of donorCells. + labelListList donorCellCells(mesh_.nCells()); + pointListList donorCellCentres(mesh_.nCells()); + globalCellCells + ( + globalCells, + mesh_, + donorCells, + donorCellCells, + donorCellCentres + ); + + // Determine the weights. + scalarListList donorWeights(mesh_.nCells()); + forAll(donorCells, i) + { + label cellI = donorCells[i]; + const pointList& donorCentres = donorCellCentres[cellI]; + calcStencilWeights + ( + samples[cellI], + donorCentres, + donorWeights[cellI] + ); + } + + // Transfer the information back to the acceptor: + // - donorCellCells : stencil (with first element the original donor) + // - donorWeights : weights for donorCellCells + cellInterpolationMap_.distribute(donorCellCells); + cellInterpolationMap_.distribute(donorWeights); + cellInterpolationMap_.distribute(samples); + + // Check which acceptor has won and transfer + forAll(interpolationCells_, i) + { + if (!doneAcceptor[i]) + { + label cellI = interpolationCells_[i]; + const labelList& slots = cellStencil_[cellI]; + + if (slots.size() != 1) + { + FatalErrorInFunction << "Problem:" << slots + << abort(FatalError); + } + + label slotI = slots[0]; + + // Important: check if the stencil is actually for this cell + if (samples[slotI] == mesh_.cellCentres()[cellI]) + { + cellStencil_[cellI].transfer(donorCellCells[slotI]); + cellInterpolationWeights_[cellI].transfer + ( + donorWeights[slotI] + ); + // Mark cell as being done so it does not get sent over + // again. + doneAcceptor[i] = true; + } + } + } + } + + // Re-do the mapDistribute + List<Map<label> > compactMap; + mapDistribute map(globalCells, cellStencil_, compactMap); + cellInterpolationMap_.transfer(map); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellCellStencils::inverseDistance::inverseDistance +( + const fvMesh& mesh, + const dictionary& dict, + const bool doUpdate +) +: + cellCellStencil(mesh), + dict_(dict), + cellTypes_(labelList(mesh.nCells(), CALCULATED)), + interpolationCells_(0), + cellInterpolationMap_(), + cellStencil_(0), + cellInterpolationWeights_(0), + cellInterpolationWeight_ + ( + IOobject + ( + "cellInterpolationWeight", + mesh_.facesInstance(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ) +{ + if (doUpdate) + { + update(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellCellStencils::inverseDistance::~inverseDistance() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::cellCellStencils::inverseDistance::update() +{ + scalar layerRelax(dict_.lookupOrDefault("layerRelax", 1.0)); + + const labelIOList& zoneID = this->zoneID(); + + label nZones = gMax(zoneID)+1; + labelList nCellsPerZone(nZones, 0); + forAll(zoneID, cellI) + { + nCellsPerZone[zoneID[cellI]]++; + } + Pstream::listCombineGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineScatter(nCellsPerZone); + + + const boundBox& allBb(mesh_.bounds()); + + + PtrList<fvMeshSubset> meshParts(nZones); + List<treeBoundBoxList> meshBb(nZones); + + // Determine zone meshes and bounding boxes + { + // Per processor, per zone the bounding box + List<treeBoundBoxList> procBb(Pstream::nProcs()); + procBb[Pstream::myProcNo()].setSize(nZones); + + forAll(nCellsPerZone, zoneI) + { + meshParts.set(zoneI, new fvMeshSubset(mesh_)); + meshParts[zoneI].setLargeCellSubset(zoneID, zoneI); + const fvMesh& subMesh = meshParts[zoneI].subMesh(); + + // Trigger early evaluation of mesh dimension (in case there are + // zero cells in mesh) + (void)subMesh.nGeometricD(); + + if (subMesh.nPoints()) + { + procBb[Pstream::myProcNo()][zoneI] = + treeBoundBox(subMesh.points()); + procBb[Pstream::myProcNo()][zoneI].inflate(1e-6); + } + else + { + // No part of zone on this processor. Make up bb. + procBb[Pstream::myProcNo()][zoneI] = treeBoundBox + ( + allBb.min() - 2*allBb.span(), + allBb.min() - allBb.span() + ); + procBb[Pstream::myProcNo()][zoneI].inflate(1e-6); + } + } + + Pstream::gatherList(procBb); + Pstream::scatterList(procBb); + + // Move local bounding boxes to per-mesh indexing + forAll(meshBb, zoneI) + { + treeBoundBoxList& bbs = meshBb[zoneI]; + bbs.setSize(Pstream::nProcs()); + forAll(procBb, procI) + { + bbs[procI] = procBb[procI][zoneI]; + } + } + } + + + // Determine patch bounding boxes. These are either global and provided + // by the user or processor-local as a copy of the mesh bounding box. + + List<treeBoundBoxList> patchBb(nZones); + List<labelVector> patchDivisions(nZones); + PtrList<PackedList<2>> patchParts(nZones); + labelList allPatchTypes(mesh_.nCells(), OTHER); + + { + treeBoundBox globalPatchBb; + if (dict_.readIfPresent("searchBox", globalPatchBb)) + { + // All processors, all zones have the same bounding box + patchBb = treeBoundBoxList(Pstream::nProcs(), globalPatchBb); + } + else + { + // Use the meshBb (differing per zone, per processor) + patchBb = meshBb; + } + } + + { + labelVector globalDivs; + if (dict_.readIfPresent("searchBoxDivisions", globalDivs)) + { + patchDivisions = globalDivs; + } + else + { + const labelVector& dim = mesh_.geometricD(); + label nDivs = -1; + if (mesh_.nGeometricD() == 1) + { + nDivs = mesh_.nCells(); + } + else if (mesh_.nGeometricD() == 2) + { + nDivs = label(Foam::sqrt(scalar(mesh_.nCells()))); + } + else + { + nDivs = label(Foam::cbrt(scalar(mesh_.nCells()))); + } + + labelVector v(nDivs, nDivs, nDivs); + forAll(dim, i) + { + if (dim[i] == -1) + { + v[i] = 1; + } + } + patchDivisions = v; + } + } + + forAll(patchParts, zoneI) + { + patchParts.set + ( + zoneI, + new PackedList<2> + ( + patchDivisions[zoneI][0] + *patchDivisions[zoneI][1] + *patchDivisions[zoneI][2] + ) + ); + markBoundaries + ( + meshParts[zoneI].subMesh(), + + patchBb[zoneI][Pstream::myProcNo()], + patchDivisions[zoneI], + patchParts[zoneI], + + meshParts[zoneI].cellMap(), + allPatchTypes + ); + } + + + // Print a bit + { + Info<< typeName << " : detected " << nZones + << " mesh regions" << endl; + Info<< incrIndent; + forAll(nCellsPerZone, zoneI) + { + Info<< indent<< "zone:" << zoneI + << " nCells:" << nCellsPerZone[zoneI] + << " voxels:" << patchDivisions[zoneI] + << " bb:" << patchBb[zoneI][Pstream::myProcNo()] + << endl; + } + Info<< decrIndent; + } + + + // Current best guess for cells. Includes best stencil. Weights should + // add up to volume. + labelList allCellTypes(mesh_.nCells(), CALCULATED); + labelListList allStencil(mesh_.nCells()); + // zoneID of donor + labelList allDonorID(mesh_.nCells(), -1); + + const globalIndex globalCells(mesh_.nCells()); + + PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); + + for (label srcI = 0; srcI < meshParts.size()-1; srcI++) + { + for (label tgtI = srcI+1; tgtI < meshParts.size(); tgtI++) + { + markPatchesAsHoles + ( + pBufs, + + meshParts, + + patchBb, + patchDivisions, + patchParts, + + srcI, + tgtI, + allCellTypes + ); + markPatchesAsHoles + ( + pBufs, + + meshParts, + + patchBb, + patchDivisions, + patchParts, + + tgtI, + srcI, + allCellTypes + ); + + markDonors + ( + globalCells, + pBufs, + meshParts, + meshBb, + + tgtI, + srcI, + allStencil, + allDonorID + ); + markDonors + ( + globalCells, + pBufs, + meshParts, + meshBb, + + srcI, + tgtI, + allStencil, + allDonorID + ); + } + } + + + // Use the patch types and weights to decide what to do + forAll(allPatchTypes, cellI) + { + if (allCellTypes[cellI] != HOLE) + { + switch (allPatchTypes[cellI]) + { + case OVERSET: + { + // Require interpolation. See if possible. + + if (allStencil[cellI].size()) + { + allCellTypes[cellI] = INTERPOLATED; + } + else + { + allCellTypes[cellI] = HOLE; + } + } + } + } + } + + + // Mark unreachable bits + findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes); + + + // Add buffer interpolation layer(s) around holes + scalarField allWeight(mesh_.nCells(), 0.0); + walkFront(layerRelax, allStencil, allCellTypes, allWeight); + + + // Convert cell-cell addressing to stencil in compact notation + + cellTypes_.transfer(allCellTypes); + cellStencil_.setSize(mesh_.nCells()); + cellInterpolationWeights_.setSize(mesh_.nCells()); + DynamicList<label> interpolationCells; + forAll(cellTypes_, cellI) + { + if (cellTypes_[cellI] == INTERPOLATED) + { + cellStencil_[cellI].transfer(allStencil[cellI]); + cellInterpolationWeights_[cellI].setSize(1); + cellInterpolationWeights_[cellI][0] = 1.0; + interpolationCells.append(cellI); + } + else + { + cellStencil_[cellI].clear(); + cellInterpolationWeights_[cellI].clear(); + } + } + interpolationCells_.transfer(interpolationCells); + + List<Map<label> > compactMap; + mapDistribute map(globalCells, cellStencil_, compactMap); + cellInterpolationMap_.transfer(map); + + cellInterpolationWeight_.transfer(allWeight); + cellInterpolationWeight_.correctBoundaryConditions(); + + + if (debug&2) + { + // Dump stencil + mkDir(mesh_.time().timePath()); + OBJstream str(mesh_.time().timePath()/"injectionStencil.obj"); + Pout<< typeName << " : dumping injectionStencil to " + << str.name() << endl; + pointField cc(mesh_.cellCentres()); + cellInterpolationMap_.distribute(cc); + + forAll(cellStencil_, celli) + { + const labelList& slots = cellStencil_[celli]; + if (slots.size()) + { + const point& accCc = mesh_.cellCentres()[celli]; + forAll(slots, i) + { + const point& donorCc = cc[slots[i]]; + str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); + } + } + } + } + + + // Extend stencil to get inverse distance weighted neighbours + createStencil(globalCells); + + + if (debug&2) + { + // Dump weight + cellInterpolationWeight_.instance() = mesh_.time().timeName(); + cellInterpolationWeight_.write(); + + // Dump cell types + volScalarField volTypes + ( + IOobject + ( + "cellTypes", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(volTypes.internalField(), cellI) + { + volTypes[cellI] = cellTypes_[cellI]; + } + volTypes.correctBoundaryConditions(); + volTypes.write(); + + // Dump stencil + mkDir(mesh_.time().timePath()); + OBJstream str(mesh_.time().timePath()/"stencil.obj"); + Pout<< typeName << " : dumping to " << str.name() << endl; + pointField cc(mesh_.cellCentres()); + cellInterpolationMap_.distribute(cc); + + forAll(cellStencil_, celli) + { + const labelList& slots = cellStencil_[celli]; + if (slots.size()) + { + const point& accCc = mesh_.cellCentres()[celli]; + forAll(slots, i) + { + const point& donorCc = cc[slots[i]]; + str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); + } + } + } + } + + // Print some stats + { + labelList nCells(count(3, cellTypes_)); + + label nLocal = 0; + label nMixed = 0; + label nRemote = 0; + forAll(interpolationCells_, i) + { + label celli = interpolationCells_[i]; + const labelList& slots = cellStencil_[celli]; + + bool hasLocal = false; + bool hasRemote = false; + + forAll(slots, sloti) + { + if (slots[sloti] >= mesh_.nCells()) + { + hasRemote = true; + } + else + { + hasLocal = true; + } + } + + if (hasRemote) + { + if (!hasLocal) + { + nRemote++; + } + else + { + nMixed++; + } + } + else if (hasLocal) + { + nLocal++; + } + } + reduce(nLocal, sumOp<label>()); + reduce(nMixed, sumOp<label>()); + reduce(nRemote, sumOp<label>()); + + Info<< "Overset analysis : nCells : " + << returnReduce(cellTypes_.size(), sumOp<label>()) << nl + << incrIndent + << indent << "calculated : " << nCells[CALCULATED] << nl + << indent << "interpolated : " << nCells[INTERPOLATED] + << " (interpolated from local:" << nLocal + << " mixed local/remote:" << nMixed + << " remote:" << nRemote << ")" << nl + << indent << "hole : " << nCells[HOLE] << nl + << decrIndent << endl; + } + + // Tbd: detect if anything changed. Most likely it did! + return true; +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.H b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.H new file mode 100644 index 0000000000000000000000000000000000000000..ffc9a291ef4b00cd6633f855bc57b38c62cb8b76 --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.H @@ -0,0 +1,334 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::cellCellStencils::inverseDistance + +Description + Inverse-distance-weighted interpolation stencil. + + hole finding: + - mark boundary faces on helper (voxel) mesh + - mark any cell overlaying these voxels + - use flood filling to find any unreachable cell + Alternative is to use an octree of the boundary faces and determine + directly for all cells whether we are outside. Might be slow though. + +SourceFiles + inverseDistanceCellCellStencil.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellCellStencils_inverseDistance_H +#define cellCellStencils_inverseDistance_H + +#include "cellCellStencil.H" +#include "volFields.H" +#include "labelVector.H" +#include "treeBoundBoxList.H" +#include "pointList.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMeshSubset; + +namespace cellCellStencils +{ + +/*---------------------------------------------------------------------------*\ + Class inverseDistance Declaration +\*---------------------------------------------------------------------------*/ + +class inverseDistance +: + public cellCellStencil +{ +protected: + + // Protected data + + //- Dictionary of motion control parameters + const dictionary dict_; + + //- Per cell the cell type + labelList cellTypes_; + + //- Indices of interpolated cells + labelList interpolationCells_; + + //- Fetch interpolated cells + mapDistribute cellInterpolationMap_; + + //- Interpolation stencil + labelListList cellStencil_; + + //- Interpolation weights + scalarListList cellInterpolationWeights_; + + //- Amount of interpolation + volScalarField cellInterpolationWeight_; + + + // Protected Member Functions + + // Voxel representation + + //- Convert ijk indices into single index + static label index(const labelVector& nDivs, const labelVector&); + + //- Convert single index into ijk + static labelVector index3(const labelVector& nDivs, const label); + + //- Convert coordinate into ijk + static labelVector index3 + ( + const boundBox& bb, + const labelVector& nDivs, + const point& pt + ); + + //- Convert index back into coordinate + static point position + ( + const boundBox& bb, + const labelVector& nDivs, + const label boxI + ); + + //- Fill all elements overlapping subBb with value val + static void fill + ( + PackedList<2>& elems, + const boundBox& bb, + const labelVector& nDivs, + const boundBox& subBb, + const unsigned int val + ); + + //- Is any voxel inside subBb set to val + static bool overlaps + ( + const boundBox& bb, + const labelVector& nDivs, + const PackedList<2>& voxels, + const treeBoundBox& subBb, + const unsigned int val + ); + + //- Mark voxels of patchTypes with type of patch face + static void markBoundaries + ( + const fvMesh& mesh, + const boundBox& bb, + const labelVector& nDivs, + PackedList<2>& patchTypes, + const labelList& cellMap, + labelList& patchCellTypes + ); + + //- Calculate bounding box of cell + static treeBoundBox cellBb + ( + const primitiveMesh& mesh, + const label celli + ); + + //- Mark all cells overlapping (a voxel covered by) a src patch + // with type HOLE + void markPatchesAsHoles + ( + PstreamBuffers& pBufs, + + // Mesh bb and data + const PtrList<fvMeshSubset>& meshParts, + + // Helper mesh for patches + const List<treeBoundBoxList>& patchBb, + const List<labelVector>& patchDivisions, + const PtrList<PackedList<2>>& patchParts, + + const label srcI, + const label tgtI, + labelList& allCellTypes + ) const; + + //- Determine donors for all tgt cells + void markDonors + ( + const globalIndex& globalCells, + PstreamBuffers& pBufs, + const PtrList<fvMeshSubset>& meshParts, + const List<treeBoundBoxList>& meshBb, + + const label srcI, + const label tgtI, + labelListList& allStencil, + labelList& allDonor + ) const; + + //- Replacement of regionSplit + void uncompactedRegionSplit + ( + const fvMesh& mesh, + const globalIndex& globalFaces, + const label nZones, + const labelList& zoneID, + const labelList& cellTypes, + const boolList& isBlockedFace, + labelList& cellRegion + ) const; + autoPtr<globalIndex> compactedRegionSplit + ( + const fvMesh& mesh, + const globalIndex& globalFaces, + labelList& cellRegion + ) const; + + //- Do flood filling to detect unreachable (from patches) sections + // of mesh + void findHoles + ( + const globalIndex& globalCells, + const fvMesh& mesh, + const labelList& zoneID, + const labelListList& stencil, + labelList& cellTypes + ) const; + + //- Seed faces of cell with wantedFraction (if higher than current) + void seedCell + ( + const label cellI, + const scalar wantedFraction, + PackedBoolList& isFront, + scalarField& fraction + ) const; + + //- Surround holes with layer(s) of interpolated cells + void walkFront + ( + const scalar layerRelax, + const labelListList& allStencil, + labelList& allCellTypes, + scalarField& allWeight + ) const; + + + //- Calculate inverse distance weights + static void calcStencilWeights + ( + const point& sample, + const pointList& donorCcs, + scalarList& weights + ); + + //- Create stencil starting from the donor containing the acceptor + virtual void createStencil(const globalIndex&); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + inverseDistance(const inverseDistance&); + + //- Disallow default bitwise assignment + void operator=(const inverseDistance&); + + +public: + + //- Runtime type information + TypeName("inverseDistance"); + + + // Constructors + + //- Construct from fvMesh + inverseDistance(const fvMesh&, const dictionary&, const bool); + + + //- Destructor + virtual ~inverseDistance(); + + + // Member Functions + + //- Update stencils. Return false if nothing changed. + virtual bool update(); + + //- Return the cell type list + virtual const labelUList& cellTypes() const + { + return cellTypes_; + } + + //- Indices of interpolated cells + virtual const labelUList& interpolationCells() const + { + return interpolationCells_; + } + + //- Return a communication schedule + virtual const mapDistribute& cellInterpolationMap() const + { + return cellInterpolationMap_; + } + + //- Per interpolated cell the neighbour cells (in terms of slots as + // constructed by above cellInterpolationMap) to interpolate + virtual const labelListList& cellStencil() const + { + return cellStencil_; + } + + //- Weights for cellStencil + virtual const scalarListList& cellInterpolationWeights() const + { + return cellInterpolationWeights_; + } + + //- Per interpolated cell the interpolation factor. (0 = use + // calculated, 1 = use interpolated) + virtual const scalarList& cellInterpolationWeight() const + { + return cellInterpolationWeight_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace cellCellStencils +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C new file mode 100644 index 0000000000000000000000000000000000000000..1d755ae78a529f0f4951953078d7197ef2338a4e --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "meshToMeshData.H" + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Foam::Ostream& os, + const Foam::meshToMeshData& wDist +) +{ + return os << wDist.tgtCelli_; +} + + +Foam::Istream& Foam::operator>> +( + Foam::Istream& is, + Foam::meshToMeshData& wDist +) +{ + return is >> wDist.tgtCelli_; +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H new file mode 100644 index 0000000000000000000000000000000000000000..0b252bbee05d5349217c6f18d626c3f35571471d --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H @@ -0,0 +1,248 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::meshToMeshData + +Description + Transfers refinement levels such that slow transition between levels is + maintained. Used in FaceCellWave. + +SourceFiles + meshToMeshDataI.H + meshToMeshData.C + +\*---------------------------------------------------------------------------*/ + +#ifndef meshToMeshData_H +#define meshToMeshData_H + +#include "point.H" +#include "tensor.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class polyPatch; +class polyMesh; + + +// Forward declaration of friend functions and operators + +class meshToMeshData; + +Istream& operator>>(Istream&, meshToMeshData&); +Ostream& operator<<(Ostream&, const meshToMeshData&); + + +/*---------------------------------------------------------------------------*\ + Class meshToMeshData Declaration +\*---------------------------------------------------------------------------*/ + +class meshToMeshData +{ +public: + + //- Class used to pass non-cell data to the update function + class trackData + { + public: + + const polyMesh& tgtMesh_; + + + // Constructors + + trackData(const polyMesh& tgtMesh) + : + tgtMesh_(tgtMesh) + {} + + }; + + + // Private data + + // Corresponding cell in tgtMesh + label tgtCelli_; + + +public: + + // Constructors + + //- Construct null + inline meshToMeshData(); + + //- Construct from count + inline meshToMeshData + ( + const label tgtCelli + ); + + + // Member Functions + + // Access + + inline label tgtCell() const + { + return tgtCelli_; + } + + inline label& tgtCell() + { + return tgtCelli_; + } + + + // Needed by FaceCellWave + + //- Check whether origin has been changed at all or + // still contains original (invalid) value. + template<class TrackingData> + inline bool valid(TrackingData&) const; + + //- Check for identical geometrical data. Used for cyclics checking. + template<class TrackingData> + inline bool sameGeometry + ( + const polyMesh&, + const meshToMeshData&, + const scalar, + TrackingData& + ) const; + + //- Convert any absolute coordinates into relative to (patch)face + // centre + template<class TrackingData> + inline void leaveDomain + ( + const polyMesh&, + const polyPatch&, + const label patchFacei, + const point& faceCentre, + TrackingData& + ); + + //- Reverse of leaveDomain + template<class TrackingData> + inline void enterDomain + ( + const polyMesh&, + const polyPatch&, + const label patchFacei, + const point& faceCentre, + TrackingData& + ); + + //- Apply rotation matrix to any coordinates + template<class TrackingData> + inline void transform + ( + const polyMesh&, + const tensor&, + TrackingData& + ); + + //- Influence of neighbouring face. + template<class TrackingData> + inline bool updateCell + ( + const polyMesh&, + const label thisCelli, + const label neighbourFacei, + const meshToMeshData& neighbourInfo, + const scalar tol, + TrackingData& + ); + + //- Influence of neighbouring cell. + template<class TrackingData> + inline bool updateFace + ( + const polyMesh&, + const label thisFacei, + const label neighbourCelli, + const meshToMeshData& neighbourInfo, + const scalar tol, + TrackingData& + ); + + //- Influence of different value on same face. + template<class TrackingData> + inline bool updateFace + ( + const polyMesh&, + const label thisFacei, + const meshToMeshData& neighbourInfo, + const scalar tol, + TrackingData& + ); + + //- Same (like operator==) + template<class TrackingData> + inline bool equal + ( + const meshToMeshData&, + TrackingData& + ) const; + + // Member Operators + + // Needed for List IO + inline bool operator==(const meshToMeshData&) const; + + inline bool operator!=(const meshToMeshData&) const; + + + // IOstream Operators + + friend Ostream& operator<<(Ostream&, const meshToMeshData&); + friend Istream& operator>>(Istream&, meshToMeshData&); +}; + + +//- Data associated with meshToMeshData type are contiguous +template<> +inline bool contiguous<meshToMeshData>() +{ + return true; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "meshToMeshDataI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H b/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H new file mode 100644 index 0000000000000000000000000000000000000000..5bc0923fdf6d03e4601f5ea91e2e3339765a4823 --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H @@ -0,0 +1,242 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "polyMesh.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Null constructor +inline Foam::meshToMeshData::meshToMeshData() +: + tgtCelli_(-2) +{} + + +// Construct from components +inline Foam::meshToMeshData::meshToMeshData(const label tgtCelli) +: + tgtCelli_(tgtCelli) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class TrackingData> +inline bool Foam::meshToMeshData::valid(TrackingData& td) const +{ + return tgtCelli_ != -2; +} + + +// No geometric data so never any problem on cyclics +template<class TrackingData> +inline bool Foam::meshToMeshData::sameGeometry +( + const polyMesh&, + const meshToMeshData&, + const scalar, + TrackingData& td +) const +{ + return true; +} + + +template<class TrackingData> +inline void Foam::meshToMeshData::leaveDomain +( + const polyMesh&, + const polyPatch& patch, + const label patchFacei, + const point& faceCentre, + TrackingData& td +) +{} + + +template<class TrackingData> +inline void Foam::meshToMeshData::transform +( + const polyMesh&, + const tensor& rotTensor, + TrackingData& td +) +{} + + +// Update absolute geometric quantities. +template<class TrackingData> +inline void Foam::meshToMeshData::enterDomain +( + const polyMesh&, + const polyPatch& patch, + const label patchFacei, + const point& faceCentre, + TrackingData& td +) +{} + + +// Update cell with neighbouring face information +template<class TrackingData> +inline bool Foam::meshToMeshData::updateCell +( + const polyMesh& mesh, + const label thisCelli, + const label neighbourFacei, + const meshToMeshData& neighbourInfo, + const scalar tol, + TrackingData& td +) +{ + if (!valid(td)) + { + const point& cc = mesh.cellCentres()[thisCelli]; + + // See if we are in the neighbour + label tgti = neighbourInfo.tgtCelli_; + + // Try match of neighbour + if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS)) + { + tgtCelli_ = tgti; + return true; + } + + // Try match of neighbour's neighbours + const labelList& tgtNbrs = td.tgtMesh_.cellCells(tgti); + forAll(tgtNbrs, i) + { + label tgti = tgtNbrs[i]; + + // Try match of neighbour + if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS)) + { + tgtCelli_ = tgti; + return true; + } + } + + // Leave unmatched cell for visit from different face + } + return false; +} + + +// Update face with neighbouring cell information +template<class TrackingData> +inline bool Foam::meshToMeshData::updateFace +( + const polyMesh& mesh, + const label thisFacei, + const label neighbourCelli, + const meshToMeshData& neighbourInfo, + const scalar tol, + TrackingData& td +) +{ + if (!valid(td)) + { + tgtCelli_ = neighbourInfo.tgtCelli_; + return true; + } + else + { + return false; + } +} + + +// Update face with coupled face information +template<class TrackingData> +inline bool Foam::meshToMeshData::updateFace +( + const polyMesh& mesh, + const label thisFacei, + const meshToMeshData& neighbourInfo, + const scalar tol, + TrackingData& td +) +{ + if (!valid(td)) + { + tgtCelli_ = neighbourInfo.tgtCelli_; + return true; + } + else + { + return false; + } +} + + +template<class TrackingData> +inline bool Foam::meshToMeshData::equal +( + const meshToMeshData& rhs, + TrackingData& td +) const +{ + if (!valid(td)) + { + if (!rhs.valid(td)) + { + return true; + } + else + { + return false; + } + } + else + { + return operator==(rhs); + } +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +inline bool Foam::meshToMeshData::operator== +( + const Foam::meshToMeshData& rhs +) + const +{ + return tgtCelli_ == rhs.tgtCelli_; +} + + +inline bool Foam::meshToMeshData::operator!= +( + const Foam::meshToMeshData& rhs +) + const +{ + return !(*this == rhs); +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/waveMethod.C b/src/overset/cellCellStencil/inverseDistance/waveMethod.C new file mode 100644 index 0000000000000000000000000000000000000000..e8ca6715c92f5fa1e194d266992491267c9c41fe --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/waveMethod.C @@ -0,0 +1,215 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "waveMethod.H" +#include "meshToMeshData.H" +#include "FaceCellWave.H" +#include "addToRunTimeSelectionTable.H" +#include "treeDataCell.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(waveMethod, 0); + addToRunTimeSelectionTable(meshToMeshMethod, waveMethod, components); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::waveMethod::calculate +( + const polyMesh& src, + const polyMesh& tgt, + labelList& srcToTgtAddr +) +{ + // If parallel running a local domain might have zero cells thus never + // constructing the face-diagonal decomposition which uses parallel + // transfers. + (void)tgt.tetBasePtIs(); + + // The actual matching is only w.r.t local cells so cannot be run in + // parallel. + const bool oldParRun = Pstream::parRun(); + Pstream::parRun() = false; + + label nSeeds = 0; + + if (tgt.nCells() == 0) + { + srcToTgtAddr.setSize(src.nCells()); + srcToTgtAddr = -1; + } + else + { + const treeBoundBox& tgtBb = tgt.cellTree().bb(); + + DynamicList<label> changedFaces(src.nFaces()/100 + 100); + DynamicList<meshToMeshData> changedFacesInfo(changedFaces.size()); + + List<meshToMeshData> cellData(src.nCells()); + List<meshToMeshData> faceData(src.nFaces()); + + meshToMeshData::trackData td(tgt); + + label startCelli = 0; + + while (true) + { + changedFaces.clear(); + changedFacesInfo.clear(); + + // Search for starting seed + for (; startCelli < src.nCells(); startCelli++) + { + if (!cellData[startCelli].valid(td)) + { + nSeeds++; + const point& cc = src.cellCentres()[startCelli]; + + if (!tgtBb.contains(cc)) + { + // Point outside local bb of tgt mesh. No need to + // search. Register as no correspondence + cellData[startCelli] = meshToMeshData(-1); + } + else + { + label tgtCelli = tgt.findCell(cc, polyMesh::CELL_TETS); + if (tgtCelli != -1) + { + // Insert any face of cell + label facei = src.cells()[startCelli][0]; + changedFaces.append(facei); + changedFacesInfo.append(meshToMeshData(tgtCelli)); + break; + } + else + { + // Register as no correspondence + cellData[startCelli] = meshToMeshData(-1); + } + } + } + } + + if (returnReduce(changedFaces.empty(), andOp<bool>())) + { + break; + } + + FaceCellWave<meshToMeshData, meshToMeshData::trackData> calc + ( + src, + changedFaces, + changedFacesInfo, + faceData, + cellData, + src.globalData().nTotalCells(), // max iterations + td + ); + } + + // Copy into srcToTgt + srcToTgtAddr.setSize(src.nCells()); + + forAll(cellData, celli) + { + srcToTgtAddr[celli] = cellData[celli].tgtCelli_; + } + } + + Pstream::parRun() = oldParRun; + + if (debug) + { + Pout<< "nSeeds:" << returnReduce(nSeeds, sumOp<label>()) + << " out of nCells:" << returnReduce(src.nCells(), sumOp<label>()) + << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveMethod::waveMethod +( + const polyMesh& src, + const polyMesh& tgt +) +: + meshToMeshMethod(src, tgt) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveMethod::~waveMethod() +{} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::waveMethod::calculate +( + labelListList& srcToTgtAddr, + scalarListList& srcToTgtWght, + pointListList& srcToTgtVec, + labelListList& tgtToSrcAddr, + scalarListList& tgtToSrcWght, + pointListList& tgtToSrcVec +) +{ + { + labelList srcToTgt(src_.nCells()); + calculate(src_, tgt_, srcToTgt); + srcToTgtAddr.setSize(srcToTgt.size()); + srcToTgtWght.setSize(srcToTgt.size()); + forAll(srcToTgtAddr, celli) + { + srcToTgtAddr[celli].setSize(1); + srcToTgtAddr[celli][0] = srcToTgt[celli]; + srcToTgtWght[celli].setSize(1); + srcToTgtWght[celli][0] = src_.cellVolumes()[celli]; + } + } + + { + labelList tgtToSrc(tgt_.nCells()); + calculate(tgt_, src_, tgtToSrc); + tgtToSrcAddr.setSize(tgtToSrc.size()); + tgtToSrcWght.setSize(tgtToSrc.size()); + forAll(tgtToSrcAddr, celli) + { + tgtToSrcAddr[celli].setSize(1); + tgtToSrcAddr[celli][0] = tgtToSrc[celli]; + tgtToSrcWght[celli].setSize(1); + tgtToSrcWght[celli][0] = tgt_.cellVolumes()[celli]; + } + } +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/inverseDistance/waveMethod.H b/src/overset/cellCellStencil/inverseDistance/waveMethod.H new file mode 100644 index 0000000000000000000000000000000000000000..9ab9635bcfe82018adea35476cc3259d305469c1 --- /dev/null +++ b/src/overset/cellCellStencil/inverseDistance/waveMethod.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::waveMethod + +Description + Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class + +SourceFiles + waveMethod.C + +\*---------------------------------------------------------------------------*/ + +#ifndef waveMethod_H +#define waveMethod_H + +#include "meshToMeshMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class waveMethod Declaration +\*---------------------------------------------------------------------------*/ + +class waveMethod +: + public meshToMeshMethod +{ + // Private member functions + + //- Disallow default bitwise copy construct + waveMethod(const waveMethod&); + + //- Disallow default bitwise assignment + void operator=(const waveMethod&); + + +public: + + //- Run-time type information + TypeName("wave"); + + //- Construct from source and target meshes + waveMethod(const polyMesh& src, const polyMesh& tgt); + + //- Destructor + virtual ~waveMethod(); + + + // Member Functions + + // Evaluate + + //- Calculate addressing + static void calculate + ( + const polyMesh& src, + const polyMesh& tgt, + labelList& srcToTgtAddr + ); + + //- Calculate addressing and weights and optionally offset vectors + virtual void calculate + ( + labelListList& srcToTgtAddr, + scalarListList& srcToTgtWght, + pointListList& srcToTgtVec, + labelListList& tgtToSrcAddr, + scalarListList& tgtToSrcWght, + pointListList& tgtToSrcVec + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C new file mode 100644 index 0000000000000000000000000000000000000000..ed4e2e251ee1e646fede53080905f16a168d89ce --- /dev/null +++ b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C @@ -0,0 +1,930 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify i + 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "trackingInverseDistanceCellCellStencil.H" +#include "addToRunTimeSelectionTable.H" +#include "OBJstream.H" +#include "Time.H" +#include "fvMeshSubset.H" +#include "globalIndex.H" +#include "oversetFvPatch.H" +#include "zeroGradientFvPatchFields.H" +#include "syncTools.H" +#include "treeBoundBoxList.H" +#include "voxelMeshSearch.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace cellCellStencils +{ + defineTypeNameAndDebug(trackingInverseDistance, 0); + addToRunTimeSelectionTable(cellCellStencil, trackingInverseDistance, mesh); +} +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::cellCellStencils::trackingInverseDistance::markBoundaries +( + const fvMesh& mesh, + + const boundBox& bb, + const labelVector& nDivs, + PackedList<2>& patchTypes, + + const labelList& cellMap, + labelList& patchCellTypes +) +{ + // Mark all voxels that overlap the bounding box of any patch + + const fvBoundaryMesh& pbm = mesh.boundary(); + + patchTypes = patchCellType::OTHER; + + // Mark wall boundaries + forAll(pbm, patchi) + { + const fvPatch& fvp = pbm[patchi]; + const labelList& fc = fvp.faceCells(); + + if (!fvPatch::constraintType(fvp.type())) + { + //Info<< "Marking cells on proper patch " << fvp.name() + // << " with type " << fvp.type() << endl; + const polyPatch& pp = fvp.patch(); + forAll(pp, i) + { + // Mark in overall patch types + patchCellTypes[cellMap[fc[i]]] = patchCellType::PATCH; + + // Mark in voxel mesh + boundBox faceBb(pp.points(), pp[i], false); + if (bb.overlaps(faceBb)) + { + voxelMeshSearch::fill + ( + patchTypes, + bb, + nDivs, + faceBb, + patchCellType::PATCH + ); + } + } + } + } + + // Override with overset boundaries + forAll(pbm, patchi) + { + const fvPatch& fvp = pbm[patchi]; + const labelList& fc = fvp.faceCells(); + + if (isA<oversetFvPatch>(fvp)) + { + //Info<< "Marking cells on overset patch " << fvp.name() << endl; + const polyPatch& pp = fvp.patch(); + forAll(pp, i) + { + // Mark in overall patch types + patchCellTypes[cellMap[fc[i]]] = patchCellType::OVERSET; + + // Mark in voxel mesh + boundBox faceBb(pp.points(), pp[i], false); + if (bb.overlaps(faceBb)) + { + voxelMeshSearch::fill + ( + patchTypes, + bb, + nDivs, + faceBb, + patchCellType::OVERSET + ); + } + } + } + } +} + + +void Foam::cellCellStencils::trackingInverseDistance::markPatchesAsHoles +( + PstreamBuffers& pBufs, + const List<treeBoundBoxList>& patchBb, + const List<labelVector>& patchDivisions, + const PtrList<PackedList<2>>& patchParts, + + const label srcI, + const label tgtI, + labelList& allCellTypes +) const +{ + const pointField& allPoints = mesh_.points(); + const labelListList& allCellPoints = mesh_.cellPoints(); + + const treeBoundBoxList& srcPatchBbs = patchBb[srcI]; + const treeBoundBoxList& tgtPatchBbs = patchBb[tgtI]; + const labelList& tgtCellMap = meshParts_[tgtI].cellMap(); + + // 1. do processor-local src-tgt patch overlap + { + const treeBoundBox& srcPatchBb = srcPatchBbs[Pstream::myProcNo()]; + const treeBoundBox& tgtPatchBb = tgtPatchBbs[Pstream::myProcNo()]; + + if (srcPatchBb.overlaps(tgtPatchBb)) + { + const PackedList<2>& srcPatchTypes = patchParts[srcI]; + const labelVector& srcDivs = patchDivisions[srcI]; + + forAll(tgtCellMap, tgtCelli) + { + label celli = tgtCellMap[tgtCelli]; + + if + ( + voxelMeshSearch::overlaps + ( + srcPatchBb, + srcDivs, + boundBox(allPoints, allCellPoints[celli], false), + srcPatchTypes, + static_cast<unsigned int>(patchCellType::PATCH) + ) + ) + { + allCellTypes[celli] = HOLE; + } + } + } + } + + + // 2. Send over srcMesh bits that overlap tgt and do calculation + pBufs.clear(); + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + if (procI != Pstream::myProcNo()) + { + const treeBoundBox& srcPatchBb = srcPatchBbs[Pstream::myProcNo()]; + const treeBoundBox& tgtPatchBb = tgtPatchBbs[procI]; + + if (srcPatchBb.overlaps(tgtPatchBb)) + { + // Send over complete patch voxel map. Tbd: could + // subset + UOPstream os(procI, pBufs); + os << srcPatchBb << patchDivisions[srcI] << patchParts[srcI]; + } + } + } + pBufs.finishedSends(); + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + if (procI != Pstream::myProcNo()) + { + const treeBoundBox& srcPatchBb = srcPatchBbs[procI]; + const treeBoundBox& tgtPatchBb = tgtPatchBbs[Pstream::myProcNo()]; + + if (srcPatchBb.overlaps(tgtPatchBb)) + { + UIPstream is(procI, pBufs); + { + treeBoundBox receivedBb(is); + if (srcPatchBb != receivedBb) + { + FatalErrorInFunction + << "proc:" << procI + << " srcPatchBb:" << srcPatchBb + << " receivedBb:" << receivedBb + << exit(FatalError); + } + } + const labelVector srcDivs(is); + const PackedList<2> srcPatchTypes(is); + + forAll(tgtCellMap, tgtCelli) + { + label celli = tgtCellMap[tgtCelli]; + if + ( + voxelMeshSearch::overlaps + ( + srcPatchBb, + srcDivs, + boundBox(allPoints, allCellPoints[celli], false), + srcPatchTypes, + static_cast<unsigned int>(patchCellType::PATCH) + ) + ) + { + allCellTypes[celli] = HOLE; + } + } + } + } + } +} + + +void Foam::cellCellStencils::trackingInverseDistance::markDonors +( + PstreamBuffers& pBufs, + const List<treeBoundBoxList>& meshBb, + const PtrList<voxelMeshSearch>& meshSearches, + + const label srcI, + const label tgtI, + labelListList& allStencil, + labelList& allDonor +) const +{ + const treeBoundBoxList& srcBbs = meshBb[srcI]; + const treeBoundBoxList& tgtBbs = meshBb[tgtI]; + + const fvMesh& srcMesh = meshParts_[srcI].subMesh(); + const labelList& srcCellMap = meshParts_[srcI].cellMap(); + const voxelMeshSearch& meshSearch = meshSearches[srcI]; + const fvMesh& tgtMesh = meshParts_[tgtI].subMesh(); + const pointField& tgtCc = tgtMesh.cellCentres(); + const labelList& tgtCellMap = meshParts_[tgtI].cellMap(); + + // 1. do processor-local src/tgt overlap + { + forAll(tgtCellMap, tgtCelli) + { + label srcCelli = meshSearch.findCell(tgtCc[tgtCelli]); + if (srcCelli != -1) + { + label globalDonor = globalCells_.toGlobal(srcCellMap[srcCelli]); + label celli = tgtCellMap[tgtCelli]; + allStencil[celli].setSize(1); + allStencil[celli][0] = globalDonor; + allDonor[celli] = srcI; + } + } + } + + + // 2. Send over tgtMesh bits that overlap src and do calculation on + // srcMesh. + + + // (remote) processors where the tgt overlaps my src + DynamicList<label> tgtOverlapProcs(Pstream::nProcs()); + // (remote) processors where the src overlaps my tgt + DynamicList<label> srcOverlapProcs(Pstream::nProcs()); + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + if (procI != Pstream::myProcNo()) + { + if (tgtBbs[procI].overlaps(srcBbs[Pstream::myProcNo()])) + { + tgtOverlapProcs.append(procI); + } + if (srcBbs[procI].overlaps(tgtBbs[Pstream::myProcNo()])) + { + srcOverlapProcs.append(procI); + } + } + } + + + + // Indices of tgtcells to send over to each processor + List<DynamicList<label> > tgtSendCells(Pstream::nProcs()); + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + tgtSendCells[procI].reserve(tgtMesh.nCells()/srcOverlapProcs.size()); + } + + + forAll(tgtCellMap, tgtCelli) + { + label celli = tgtCellMap[tgtCelli]; + if (allStencil[celli].empty()) + { + const treeBoundBox subBb(cellBb(mesh_, celli)); + + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + if (subBb.overlaps(srcBbs[procI])) + { + tgtSendCells[procI].append(tgtCelli); + } + } + } + } + + // Send target cell centres to overlapping processors + pBufs.clear(); + + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + const labelList& cellIDs = tgtSendCells[procI]; + + UOPstream os(procI, pBufs); + os << UIndirectList<point>(tgtCc, cellIDs); + } + pBufs.finishedSends(); + + // Receive bits of target processors; find; send back + (void)srcMesh.tetBasePtIs(); + forAll(tgtOverlapProcs, i) + { + label procI = tgtOverlapProcs[i]; + + UIPstream is(procI, pBufs); + pointList samples(is); + + labelList donors(samples.size(), -1); + forAll(samples, sampleI) + { + label srcCelli = meshSearch.findCell(samples[sampleI]); + if (srcCelli != -1) + { + donors[sampleI] = globalCells_.toGlobal(srcCellMap[srcCelli]); + } + } + + // Use same pStreamBuffers to send back. + UOPstream os(procI, pBufs); + os << donors; + } + pBufs.finishedSends(); + + forAll(srcOverlapProcs, i) + { + label procI = srcOverlapProcs[i]; + const labelList& cellIDs = tgtSendCells[procI]; + + UIPstream is(procI, pBufs); + labelList donors(is); + + if (donors.size() != cellIDs.size()) + { + FatalErrorInFunction<< "problem : cellIDs:" << cellIDs.size() + << " donors:" << donors.size() << abort(FatalError); + } + + forAll(donors, donorI) + { + label globalDonor = donors[donorI]; + + if (globalDonor != -1) + { + label celli = tgtCellMap[cellIDs[donorI]]; + + // TBD: check for multiple donors. Maybe better one? + if (allStencil[celli].empty()) + { + allStencil[celli].setSize(1); + allStencil[celli][0] = globalDonor; + allDonor[celli] = srcI; + } + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellCellStencils::trackingInverseDistance::trackingInverseDistance +( + const fvMesh& mesh, + const dictionary& dict, + const bool doUpdate +) +: + inverseDistance(mesh, dict, false), + globalCells_(mesh_.nCells()) +{ + if (doUpdate) + { + // Initialise donor cell + globalDonor_.setSize(mesh_.nCells()); + globalDonor_ = -1; + + // Initialise mesh partitions + const labelIOList& zoneID = this->zoneID(); + label nZones = gMax(zoneID)+1; + + labelList nCellsPerZone(nZones, 0); + forAll(zoneID, celli) + { + nCellsPerZone[zoneID[celli]]++; + } + Pstream::listCombineGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineScatter(nCellsPerZone); + + meshParts_.setSize(nZones); + forAll(meshParts_, zonei) + { + meshParts_.set(zonei, new fvMeshSubset(mesh_)); + meshParts_[zonei].setLargeCellSubset(zoneID, zonei); + // Trigger early evaluation of mesh dimension (in case there are + // locally zero cells in mesh) + (void)meshParts_[zonei].subMesh().nGeometricD(); + } + + + // Print a bit + { + Info<< typeName << " : detected " << nZones + << " mesh regions" << endl; + Info<< incrIndent; + forAll(nCellsPerZone, zonei) + { + Info<< indent<< "zone:" << zonei + << " nCells:" << nCellsPerZone[zonei] + << endl; + } + Info<< decrIndent; + } + + + // Do geometry update + update(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellCellStencils::trackingInverseDistance::~trackingInverseDistance() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::cellCellStencils::trackingInverseDistance::update() +{ + DebugInfo<< FUNCTION_NAME << " : Start of analysis" << endl; + + scalar layerRelax(dict_.lookupOrDefault("layerRelax", 1.0)); + const labelIOList& zoneID = this->zoneID(); + label nZones = meshParts_.size(); + + // Update stored mesh partitions for geometry changes + forAll(meshParts_, zonei) + { + pointField subPoints(mesh_.points(), meshParts_[zonei].pointMap()); + + fvMesh& subMesh = meshParts_[zonei].subMesh(); + subMesh.movePoints(subPoints); + } + + DebugInfo<< FUNCTION_NAME << " : Moved zone sub-meshes" << endl; + + + // Calculate fast search structure for each zone + PtrList<voxelMeshSearch> meshSearches(nZones); + + List<labelVector> searchBoxDivisions; + if (dict_.readIfPresent("searchBoxDivisions", searchBoxDivisions)) + { + forAll(meshParts_, zonei) + { + meshSearches.set + ( + zonei, + new voxelMeshSearch + ( + meshParts_[zonei].subMesh(), + searchBoxDivisions[zonei], + true + ) + ); + } + } + else + { + forAll(meshParts_, zonei) + { + meshSearches.set + ( + zonei, + new voxelMeshSearch(meshParts_[zonei].subMesh(), true) + ); + } + } + DebugInfo<< FUNCTION_NAME << " : Constructed cell voxel meshes" << endl; + + + const boundBox& allBb(mesh_.bounds()); + + List<treeBoundBoxList> meshBb(nZones); + + // Determine zone meshes and bounding boxes + { + // Per processor, per zone the bounding box + List<treeBoundBoxList> procBb(Pstream::nProcs()); + procBb[Pstream::myProcNo()].setSize(nZones); + + forAll(meshParts_, zonei) + { + const fvMesh& subMesh = meshParts_[zonei].subMesh(); + + if (subMesh.nPoints()) + { + procBb[Pstream::myProcNo()][zonei] = + treeBoundBox(subMesh.points()); + procBb[Pstream::myProcNo()][zonei].inflate(1e-6); + } + else + { + // No part of zone on this processor. Make up bb. + procBb[Pstream::myProcNo()][zonei] = treeBoundBox + ( + allBb.min() - 2*allBb.span(), + allBb.min() - allBb.span() + ); + procBb[Pstream::myProcNo()][zonei].inflate(1e-6); + } + } + + Pstream::gatherList(procBb); + Pstream::scatterList(procBb); + + // Move local bounding boxes to per-mesh indexing + forAll(meshBb, zonei) + { + treeBoundBoxList& bbs = meshBb[zonei]; + bbs.setSize(Pstream::nProcs()); + forAll(procBb, proci) + { + bbs[proci] = procBb[proci][zonei]; + } + } + } + + DebugInfo<< FUNCTION_NAME << " : Calculated bounding boxes" << endl; + + + // Determine patch bounding boxes. These are either global and provided + // by the user or processor-local as a copy of the mesh bounding box. + + List<treeBoundBoxList> patchBb(nZones); + List<labelVector> patchDivisions(searchBoxDivisions); + PtrList<PackedList<2>> patchParts(nZones); + labelList allPatchTypes(mesh_.nCells(), OTHER); + + { + treeBoundBox globalPatchBb; + if (dict_.readIfPresent("searchBox", globalPatchBb)) + { + // All processors, all zones have the same bounding box + patchBb = treeBoundBoxList(Pstream::nProcs(), globalPatchBb); + } + else + { + // Use the meshBb (differing per zone, per processor) + patchBb = meshBb; + } + } + if (patchDivisions.empty()) + { + patchDivisions.setSize(nZones); + forAll(patchDivisions, zonei) + { + patchDivisions[zonei] = meshSearches[zonei].nDivs(); + } + } + + forAll(patchParts, zonei) + { + const labelVector& g = patchDivisions[zonei]; + patchParts.set(zonei, new PackedList<2>(cmptProduct(g))); + + markBoundaries + ( + meshParts_[zonei].subMesh(), + + patchBb[zonei][Pstream::myProcNo()], + patchDivisions[zonei], + patchParts[zonei], + + meshParts_[zonei].cellMap(), + allPatchTypes + ); + } + DebugInfo<< FUNCTION_NAME << " : Calculated boundary voxel meshes" << endl; + + + // Current best guess for cells + labelList allCellTypes(mesh_.nCells(), CALCULATED); + labelListList allStencil(mesh_.nCells()); + // zoneID of donor + labelList allDonorID(mesh_.nCells(), -1); + + const globalIndex globalCells(mesh_.nCells()); + + PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); + + DebugInfo<< FUNCTION_NAME << " : Allocated donor-cell structures" << endl; + + for (label srci = 0; srci < meshParts_.size()-1; srci++) + { + for (label tgti = srci+1; tgti < meshParts_.size(); tgti++) + { + markPatchesAsHoles + ( + pBufs, + + patchBb, + patchDivisions, + patchParts, + + srci, + tgti, + allCellTypes + ); + markPatchesAsHoles + ( + pBufs, + + patchBb, + patchDivisions, + patchParts, + + tgti, + srci, + allCellTypes + ); + + markDonors + ( + pBufs, + meshBb, + meshSearches, + + tgti, + srci, + allStencil, + allDonorID + ); + markDonors + ( + pBufs, + meshBb, + meshSearches, + + srci, + tgti, + allStencil, + allDonorID + ); + } + } + + DebugInfo<< FUNCTION_NAME << " : Determined holes and donor-acceptors" + << endl; + + + // Use the patch types and weights to decide what to do + forAll(allPatchTypes, celli) + { + if (allCellTypes[celli] != HOLE) + { + switch (allPatchTypes[celli]) + { + case OVERSET: + { + // Require interpolation. See if possible. + + if (allStencil[celli].size()) + { + allCellTypes[celli] = INTERPOLATED; + } + else + { + allCellTypes[celli] = HOLE; + } + } + } + } + } + DebugInfo<< FUNCTION_NAME << " : Removed bad donors" << endl; + + // Mark unreachable bits + findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes); + DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl; + + // Add buffer interpolation layer(s) around holes + scalarField allWeight(mesh_.nCells(), 0.0); + walkFront(layerRelax, allStencil, allCellTypes, allWeight); + DebugInfo<< FUNCTION_NAME << " : Implemented layer relaxation" << endl; + + + // Convert cell-cell addressing to stencil in compact notation + + cellTypes_.transfer(allCellTypes); + cellStencil_.setSize(mesh_.nCells()); + cellInterpolationWeights_.setSize(mesh_.nCells()); + DynamicList<label> interpolationCells; + forAll(cellTypes_, celli) + { + if (cellTypes_[celli] == INTERPOLATED) + { + cellStencil_[celli].transfer(allStencil[celli]); + cellInterpolationWeights_[celli].setSize(1); + cellInterpolationWeights_[celli][0] = 1.0; + interpolationCells.append(celli); + } + else + { + cellStencil_[celli].clear(); + cellInterpolationWeights_[celli].clear(); + } + } + interpolationCells_.transfer(interpolationCells); + + List<Map<label> > compactMap; + mapDistribute map(globalCells, cellStencil_, compactMap); + cellInterpolationMap_.transfer(map); + + cellInterpolationWeight_.transfer(allWeight); + cellInterpolationWeight_.correctBoundaryConditions(); + + + if (debug & 2) + { + // Dump stencil + mkDir(mesh_.time().timePath()); + OBJstream str(mesh_.time().timePath()/"injectionStencil.obj"); + Pout<< typeName << " : dumping injectionStencil to " + << str.name() << endl; + pointField cc(mesh_.cellCentres()); + cellInterpolationMap_.distribute(cc); + + forAll(cellStencil_, celli) + { + const labelList& slots = cellStencil_[celli]; + if (slots.size()) + { + const point& accCc = mesh_.cellCentres()[celli]; + forAll(slots, i) + { + const point& donorCc = cc[slots[i]]; + str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); + } + } + } + } + + DebugInfo<< FUNCTION_NAME << " : Transferred donor to stencil" << endl; + + + // Extend stencil to get inverse distance weighted neighbours + createStencil(globalCells); + DebugInfo<< FUNCTION_NAME << " : Extended stencil" << endl; + + + if (debug & 2) + { + // Dump weight + cellInterpolationWeight_.instance() = mesh_.time().timeName(); + cellInterpolationWeight_.write(); + + // Dump cell types + volScalarField volTypes + ( + IOobject + ( + "cellTypes", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(volTypes.internalField(), celli) + { + volTypes[celli] = cellTypes_[celli]; + } + volTypes.correctBoundaryConditions(); + volTypes.write(); + + // Dump stencil + mkDir(mesh_.time().timePath()); + OBJstream str(mesh_.time().timePath()/"stencil.obj"); + Pout<< typeName << " : dumping to " << str.name() << endl; + pointField cc(mesh_.cellCentres()); + cellInterpolationMap_.distribute(cc); + + forAll(cellStencil_, celli) + { + const labelList& slots = cellStencil_[celli]; + if (slots.size()) + { + const point& accCc = mesh_.cellCentres()[celli]; + forAll(slots, i) + { + const point& donorCc = cc[slots[i]]; + str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); + } + } + } + } + + + // Print some stats + { + labelList nCells(count(3, cellTypes_)); + + label nLocal = 0; + label nMixed = 0; + label nRemote = 0; + forAll(interpolationCells_, i) + { + label celli = interpolationCells_[i]; + const labelList& slots = cellStencil_[celli]; + + bool hasLocal = false; + bool hasRemote = false; + + forAll(slots, sloti) + { + if (slots[sloti] >= mesh_.nCells()) + { + hasRemote = true; + } + else + { + hasLocal = true; + } + } + + if (hasRemote) + { + if (!hasLocal) + { + nRemote++; + } + else + { + nMixed++; + } + } + else if (hasLocal) + { + nLocal++; + } + } + reduce(nLocal, sumOp<label>()); + reduce(nMixed, sumOp<label>()); + reduce(nRemote, sumOp<label>()); + + Info<< "Overset analysis : nCells : " + << returnReduce(cellTypes_.size(), sumOp<label>()) << nl + << incrIndent + << indent << "calculated : " << nCells[CALCULATED] << nl + << indent << "interpolated : " << nCells[INTERPOLATED] + << " (interpolated from local:" << nLocal + << " mixed local/remote:" << nMixed + << " remote:" << nRemote << ")" << nl + << indent << "hole : " << nCells[HOLE] << nl + << decrIndent << endl; + } + DebugInfo<< FUNCTION_NAME << " : Finished analysis" << endl; + + // Tbd: detect if anything changed. Most likely it did! + return true; +} + + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.H b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.H new file mode 100644 index 0000000000000000000000000000000000000000..f0cafa3521c7fa1ad541d4ff2fe54ab50710407b --- /dev/null +++ b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.H @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::cellCellStencils::trackingInverseDistance + +Description + Inverse-distance-weighted interpolation stencil. + +SourceFiles + trackingInverseDistanceCellCellStencil.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellCellStencils_trackingInverseDistance_H +#define cellCellStencils_trackingInverseDistance_H + +#include "inverseDistanceCellCellStencil.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class voxelMeshSearch; + +namespace cellCellStencils +{ + +/*---------------------------------------------------------------------------*\ + Class trackingInverseDistance Declaration +\*---------------------------------------------------------------------------*/ + +class trackingInverseDistance +: + public inverseDistance +{ +protected: + + // Protected data + + //- Global indexing for cells + globalIndex globalCells_; + + //- Current (global) donor cell + labelList globalDonor_; + + //- Subset according to zone + PtrList<fvMeshSubset> meshParts_; + + + + // Protected Member Functions + + //- Mark voxels of patchTypes with type of patch face + static void markBoundaries + ( + const fvMesh& mesh, + + const boundBox& bb, + const labelVector& nDivs, + PackedList<2>& patchTypes, + + const labelList& cellMap, + labelList& patchCellTypes + ); + + //- Mark all cells overlapping (a voxel covered by) a src patch + // with type HOLE + void markPatchesAsHoles + ( + PstreamBuffers& pBufs, + + // Voxel mesh for patches + const List<treeBoundBoxList>& patchBb, + const List<labelVector>& patchDivisions, + const PtrList<PackedList<2>>& patchParts, + + const label srcI, + const label tgtI, + labelList& allCellTypes + ) const; + + void markDonors + ( + PstreamBuffers& pBufs, + const List<treeBoundBoxList>& meshBb, + const PtrList<voxelMeshSearch>& meshSearches, + + const label srcI, + const label tgtI, + labelListList& allStencil, + labelList& allDonor + ) const; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + trackingInverseDistance(const trackingInverseDistance&); + + //- Disallow default bitwise assignment + void operator=(const trackingInverseDistance&); + + +public: + + //- Runtime type information + TypeName("trackingInverseDistance"); + + + // Constructors + + //- Construct from fvMesh + trackingInverseDistance(const fvMesh&, const dictionary&, const bool); + + + //- Destructor + virtual ~trackingInverseDistance(); + + + // Member Functions + + //- Update stencils. Return false if nothing changed. + virtual bool update(); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace cellCellStencils +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C new file mode 100644 index 0000000000000000000000000000000000000000..720b25d7610d55a5df8af4811c9a7379715e4039 --- /dev/null +++ b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C @@ -0,0 +1,432 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "voxelMeshSearch.H" +#include "polyMesh.H" +#include "processorPolyPatch.H" + + +/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(voxelMeshSearch, 0); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::labelVector Foam::voxelMeshSearch::index3 +( + const boundBox& bb, + const labelVector& g, + const point& pt +) +{ + const vector s(cmptDivide(bb.span(), vector(g.x(), g.y(), g.z()))); + + labelVector v + ( + floor((pt.x()-bb.min().x())/s.x()), + floor((pt.y()-bb.min().y())/s.y()), + floor((pt.z()-bb.min().z())/s.z()) + ); + + return v; +} + + +Foam::label Foam::voxelMeshSearch::index +( + const boundBox& bb, + const labelVector& g, + const point& pt, + const bool clip +) +{ + const vector s(cmptDivide(bb.span(), vector(g.x(), g.y(), g.z()))); + + labelVector v + ( + floor((pt.x()-bb.min().x())/s.x()), + floor((pt.y()-bb.min().y())/s.y()), + floor((pt.z()-bb.min().z())/s.z()) + ); + + if (clip) + { + v[0] = max(0, min(g[0]-1, v[0])); + v[1] = max(0, min(g[1]-1, v[1])); + v[2] = max(0, min(g[2]-1, v[2])); + } + else if + ( + v[0] < 0 + || v[1] < 0 + || v[2] < 0 + || v[0] >= g[0] + || v[1] >= g[1] + || v[2] >= g[2] + ) + { + return -1; + } + + return v[0] + g[0]*v[1] + g[1]*g.y()*v[2]; +} + + +Foam::point Foam::voxelMeshSearch::centre +( + const boundBox& bb, + const labelVector& g, + const labelVector& voxel +) +{ + const vector s(cmptDivide(bb.span(), vector(g.x(), g.y(), g.z()))); + + return bb.min()+0.5*s+point(voxel[0]*s[0], voxel[1]*s[1], voxel[2]*s[2]); +} + + +void Foam::voxelMeshSearch::writeGrid +( + OBJstream& os, + const boundBox& bb, + const labelVector& g +) +{ + const vector s(cmptDivide(bb.span(), vector(g.x(), g.y(), g.z()))); + + for (label i = 1; i < g[0]; i++) + { + for (label j = 0; j < g[1]; j++) + { + for (label k = 0; k < g[2]; k++) + { + point p1(bb.min()+point((i-1)*s[0], j*s[1], k*s[2])); + point p2(bb.min()+point(i*s[0], j*s[1], k*s[2])); + os.write(linePointRef(p1, p2)); + } + } + } + for (label i = 0; i < g[0]; i++) + { + for (label j = 1; j < g[1]; j++) + { + for (label k = 0; k < g[2]; k++) + { + point p1(bb.min()+point(i*s[0], (j-1)*s[1], k*s[2])); + point p2(bb.min()+point(i*s[0], j*s[1], k*s[2])); + os.write(linePointRef(p1, p2)); + } + } + } + for (label i = 0; i < g[0]; i++) + { + for (label j = 0; j < g[1]; j++) + { + for (label k = 1; k < g[2]; k++) + { + point p1(bb.min()+point(i*s[0], j*s[1], (k-1)*s[2])); + point p2(bb.min()+point(i*s[0], j*s[1], k*s[2])); + os.write(linePointRef(p1, p2)); + } + } + } +} + + +Foam::label Foam::voxelMeshSearch::searchProcPatch +( + const label faceID, + const point& searchPoint +) const +{ + const pointField& cellCentres = mesh_.cellCentres(); + const polyBoundaryMesh& bMeshes = mesh_.boundaryMesh(); + + label patchi = bMeshes.patchID()[faceID-mesh_.nInternalFaces()]; + const polyPatch& bMeshPatch = bMeshes[patchi]; + + if (!isA<processorPolyPatch>(bMeshPatch)) + { + return -1; + } + else + { + // Find nearest cell. Linear search since cheaper than constructing + // tree? + const labelUList& faceCells = bMeshPatch.faceCells(); + scalar minProximity = GREAT; + + label nearestCellI = -1; + forAll(faceCells, i) + { + const point& cc = cellCentres[faceCells[i]]; + scalar proximity = magSqr(cc-searchPoint); + if (proximity < minProximity) + { + minProximity = proximity; + nearestCellI = faceCells[i]; + } + } + return nearestCellI; + } +} + + +Foam::label Foam::voxelMeshSearch::findIntersectedFace +( + const label cellI, + const point& p +) const +{ + // Return -1 or the label of the face intersected when tracking from + // p to centre of cellI + + const faceList& faces = mesh_.faces(); + const pointField& faceCentres = mesh_.faceCentres(); + const pointField& points = mesh_.points(); + + const point& cc = mesh_.cellCentres()[cellI]; + const labelList& cFaces = mesh_.cells()[cellI]; + + const vector q(cc-p); + + forAll(cFaces, cFacei) + { + label facei = cFaces[cFacei]; + + pointHit hitInfo = faces[facei].intersection + ( + p, + q, + faceCentres[facei], + points, + intersection::HALF_RAY + ); + + if (hitInfo.hit() && (hitInfo.distance() < 1)) + { + return facei; + } + } + return -1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::voxelMeshSearch::voxelMeshSearch +( + const polyMesh& mesh, + const bool doUpdate +) +: + mesh_(mesh) +{ + // Determine number of voxels from number of cells in mesh + const labelVector& dim = mesh_.geometricD(); + + // Guarantee at least one voxel + label nCells = max(1, mesh_.nCells()); + + label nDivs = -1; + if (mesh_.nGeometricD() == 1) + { + nDivs = nCells; + } + else if (mesh_.nGeometricD() == 2) + { + nDivs = label(Foam::sqrt(scalar(nCells))); + } + else + { + nDivs = label(Foam::cbrt(scalar(nCells))); + } + + nDivs_ = labelVector(nDivs, nDivs, nDivs); + forAll(dim, i) + { + if (dim[i] == -1) + { + nDivs_[i] = 1; + } + } + + if (debug) + { + Pout<< "voxelMeshSearch : mesh:" << mesh_.name() + << " nDivs:" << nDivs_ << endl; + } + + if (doUpdate) + { + update(); + } +} + + +Foam::voxelMeshSearch::voxelMeshSearch +( + const polyMesh& mesh, + const labelVector& nDivs, + const bool doUpdate +) +: + mesh_(mesh), + nDivs_(nDivs) +{ + if (doUpdate) + { + update(); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::voxelMeshSearch::update() +{ + // Redo the local bounding box + localBb_ = boundBox(mesh_.points(), false); + + const point eps(1e-10, 1e-10, 1e-10); + + localBb_.min() = localBb_.min()-eps; + localBb_.max() = localBb_.max()+eps; + + // Initialise seed cell array + + seedCell_.setSize(cmptProduct(nDivs_)); + seedCell_ = -1; + + + // Find seed cells + const pointField& points = mesh_.points(); + const labelListList& cellPoints = mesh_.cellPoints(); + + forAll(cellPoints, celli) + { + const labelList& cPoints = cellPoints[celli]; + + // Get cell bounding box + boundBox bb(points, cPoints, false); + + fill(seedCell_, localBb_, nDivs_, bb, celli); + } + + + //// Small optimisation: make sure the cell centre at least always + //// returns the cell itself + //const pointField& cellCentres = mesh_.cellCentres(); + //forAll(cellCentres, celli) + //{ + // label voxeli = index(cellCentres[celli]); + // seedCell_[voxeli] = celli; + //} + + return true; +} + + +Foam::label Foam::voxelMeshSearch::findCell(const point& p) const +{ + // First check if the point is contained in the bounding box, else exit + if (!localBb_.contains(p)) + { + return -1; + } + + // Locate the voxel index for this point. Do not clip. + label voxeli = index(localBb_, nDivs_, p, false); + + // The point may still be inside the bb but outside the actual domain. + if (voxeli < 0) + { + return -1; + } + else + { + // Inverse map to compute the seed cell. + label celli = seedCell_[voxeli]; + + if (celli < 0) + { + return -1; + } + else + { + // Simplified, non-parallel tracking from cell centre of + // celli to wanted location p. Note that the cell thus + // found does not have to be the absolute 'correct' one as + // long as at least one of the processors finds a cell. + + label nextCellOld = -1; + + while (true) + { + // I am in celli now. How many faces do I have ? + label facei = findIntersectedFace(celli, p); + + if (facei == -1) + { + return celli; + } + + + label nextCell; + if (mesh_.isInternalFace(facei)) + { + label own = mesh_.faceOwner()[facei]; + label nei = mesh_.faceNeighbour()[facei]; + nextCell = (own == celli ? nei : own); + } + else + { + nextCell = searchProcPatch(facei, p); + + if (nextCell == nextCellOld) + { + return -1; // point is really out + } + + if (nextCell == -1 || nextCell == celli) + { + return nextCell; + } + nextCellOld = nextCell; + } + + celli = nextCell; + } + return -1; + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.H b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.H new file mode 100644 index 0000000000000000000000000000000000000000..3f8bd0443489762a351fb6918974ca5743fc94f9 --- /dev/null +++ b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.H @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::voxelMeshSearch + +Description + Fast, non-parallel searching in mesh without use of octree. + +SourceFiles + voxelMeshSearch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef voxelMeshSearch_H +#define voxelMeshSearch_H + +#include "boundBox.H" +#include "labelVector.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators +class polyMesh; +class OBJstream; + +/*---------------------------------------------------------------------------*\ + Class voxelMeshSearch Declaration +\*---------------------------------------------------------------------------*/ + +class voxelMeshSearch +{ + // Private data + + const polyMesh& mesh_; + + //- Local mesh bounding box + boundBox localBb_; + + //- Number of points in all directions (for local mesh only) + labelVector nDivs_; + + //- Voxel to seed cell + labelList seedCell_; + + + // Private Member Functions + + //- Find nearest cell (on same processor patch as seed face) + label searchProcPatch(const label seedFacei, const point&) const; + + //- Find the face on the cell that gets intersected + label findIntersectedFace(const label celli, const point&) const; + + +public: + + // Declare name of the class and its debug switch + ClassName("voxelMeshSearch"); + + + // Constructors + + //- Construct from mesh; voxels estimated from local number of cells + voxelMeshSearch(const polyMesh&, const bool doUpdate = true); + + //- Construct from mesh and voxel discretisation + voxelMeshSearch + ( + const polyMesh&, + const labelVector&, + const bool doUpdate = true + ); + + + // Member functions + + //- Number of voxels for local mesh + const labelVector& nDivs() const + { + return nDivs_; + } + + //- Update lookup tables for geometry changes + bool update(); + + //- Find a cell + label findCell(const point&) const; + + //- Find cells. Returns number of cells found + //label findCells(const UList<point>&, labelList&) const; + + + //Voxel helper functions + + //- Coordinate to voxel indices + static labelVector index3 + ( + const boundBox& bb, + const labelVector& nDivs, + const point& p + ); + + //- Coordinate to combined voxel index. If clip makes sure + // components are all inside. If not clip returns -1 if outside bb. + static label index + ( + const boundBox& bb, + const labelVector& nDivs, + const point& p, + const bool clip + ); + + //- Voxel index to voxel centre + static point centre + ( + const boundBox& bb, + const labelVector& nDivs, + const labelVector& voxel + ); + + //- Fill voxels indicated by bounding box + template<class Container, class Type> + static void fill + ( + Container& elems, + const boundBox& bb, + const labelVector& nDivs, + const boundBox& subBb, + const Type val + ); + + //- Check if any voxel inside bounding box is set to val or + // not set to val (isNot = true) + template<class Container, class Type> + static bool overlaps + ( + const boundBox& bb, + const labelVector& nDivs, + const boundBox& subBb, + const Container& elems, + const Type val, + const bool isNot = false + ); + + //- Debug: write points for every set element + template<class Container, class Type> + static void write + ( + OBJstream&, + const boundBox& bb, + const labelVector& nDivs, + const Container& elems, + const Type val, + const bool isNot = false + ); + + //- Debug: write all edges + static void writeGrid + ( + OBJstream&, + const boundBox&, + const labelVector& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "voxelMeshSearchTemplates.C" +#endif + +#endif + +// ************************************************************************* // diff --git a/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearchTemplates.C b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearchTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..e748d23281d415c0a2cb14ccbed44dd2deb55b3f --- /dev/null +++ b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearchTemplates.C @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "voxelMeshSearch.H" +#include "OBJstream.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class Container, class Type> +void Foam::voxelMeshSearch::fill +( + Container& elems, + const boundBox& bb, + const labelVector& nDivs, + const boundBox& subBb, + const Type val +) +{ + labelVector minIds(index3(bb, nDivs, subBb.min())); + labelVector maxIds(index3(bb, nDivs, subBb.max())); + + for (direction cmpt = 0; cmpt < 3; cmpt++) + { + if (maxIds[cmpt] < 0 || minIds[cmpt] >= nDivs[cmpt]) + { + return; + } + // Clip + maxIds[cmpt] = min(maxIds[cmpt], nDivs[cmpt]-1); + minIds[cmpt] = max(minIds[cmpt], 0); + } + + for (label i = minIds[0]; i <= maxIds[0]; i++) + { + for (label j = minIds[1]; j <= maxIds[1]; j++) + { + for (label k = minIds[2]; k <= maxIds[2]; k++) + { + elems[i+j*nDivs.x()+k*nDivs.x()*nDivs.y()] = val; + } + } + } +} + + +template<class Container, class Type> +bool Foam::voxelMeshSearch::overlaps +( + const boundBox& bb, + const labelVector& nDivs, + const boundBox& subBb, + const Container& elems, + const Type val, + const bool isNot +) +{ + // Checks if subBb overlaps any voxel set to val + + labelVector minIds(index3(bb, nDivs, subBb.min())); + labelVector maxIds(index3(bb, nDivs, subBb.max())); + + for (direction cmpt = 0; cmpt < 3; cmpt++) + { + if (maxIds[cmpt] < 0 || minIds[cmpt] >= nDivs[cmpt]) + { + return false; + } + // Clip + maxIds[cmpt] = min(maxIds[cmpt], nDivs[cmpt]-1); + minIds[cmpt] = max(minIds[cmpt], 0); + } + + if (elems.size() != cmptProduct(nDivs)) + { + FatalErrorInFunction + << "sizes:" << elems.size() << " and " << nDivs + << exit(FatalError); + } + + + for (label i = minIds[0]; i <= maxIds[0]; i++) + { + for (label j = minIds[1]; j <= maxIds[1]; j++) + { + for (label k = minIds[2]; k <= maxIds[2]; k++) + { + const Type elemVal = elems[i+j*nDivs.x()+k*nDivs.x()*nDivs.y()]; + if (isNot != (elemVal == val)) + { + return true; + } + } + } + } + return false; +} + + +template<class Container, class Type> +void Foam::voxelMeshSearch::write +( + OBJstream& os, + const boundBox& bb, + const labelVector& nDivs, + const Container& elems, + const Type val, + const bool isNot +) +{ + if (elems.size() != cmptProduct(nDivs)) + { + FatalErrorInFunction + << "sizes:" << elems.size() << " and " << nDivs + << exit(FatalError); + } + + for (label i = 0; i < nDivs[0]; i++) + { + for (label j = 0; j < nDivs[1]; j++) + { + for (label k = 0; k < nDivs[2]; k++) + { + const Type elemVal = elems[i+j*nDivs.x()+k*nDivs.x()*nDivs.y()]; + if (isNot != (elemVal == val)) + { + os.write(centre(bb, nDivs, labelVector(i, j, k))); + } + } + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C new file mode 100644 index 0000000000000000000000000000000000000000..7e5e3584a8c86b0af186530fbcd856309f55dc23 --- /dev/null +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C @@ -0,0 +1,354 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify i + 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "dynamicOversetFvMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "cellCellStencilObject.H" +#include "zeroGradientFvPatchFields.H" +#include "lduPrimitiveProcessorInterface.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(dynamicOversetFvMesh, 0); + addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, IOobject); +} + + +// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // + +bool Foam::dynamicOversetFvMesh::updateAddressing() const +{ + const cellCellStencilObject& overlap = Stencil::New(*this); + + // The (processor-local part of the) stencil determines the local + // faces to add to the matrix. tbd: parallel + const labelListList& stencil = overlap.cellStencil(); + + // Get the base addressing + const lduAddressing& baseAddr = dynamicMotionSolverFvMesh::lduAddr(); + + // Add to the base addressing + labelList lowerAddr; + labelList upperAddr; + label nExtraFaces; + + const globalIndex globalNumbering(baseAddr.size()); + labelListList localFaceCells; + labelListList remoteFaceCells; + + labelList globalCellIDs(overlap.cellInterpolationMap().constructSize()); + forAll(baseAddr, cellI) + { + globalCellIDs[cellI] = globalNumbering.toGlobal(cellI); + } + overlap.cellInterpolationMap().distribute(globalCellIDs); + + + reverseFaceMap_ = fvMeshPrimitiveLduAddressing::addAddressing + ( + baseAddr, + stencil, + nExtraFaces, + lowerAddr, + upperAddr, + stencilFaces_, + globalNumbering, + globalCellIDs, + localFaceCells, + remoteFaceCells + ); + + if (debug) + { + Pout<< "dynamicOversetFvMesh::update() : extended addresssing from" + << " nFaces:" << baseAddr.lowerAddr().size() + << " to nFaces:" << lowerAddr.size() + << " nExtraFaces:" << nExtraFaces << endl; + } + + // Send across wanted cells + labelListList sendCells; + Pstream::exchange<labelList, label>(remoteFaceCells, sendCells); + + // Extract relevant remote processors + labelList nbrProcs(localFaceCells.size()); + { + label nbrI = 0; + forAll(localFaceCells, procI) + { + if (localFaceCells[procI].size()) + { + //Pout<< " from proc:" << procI + // << " want its local cells " << remoteFaceCells[procI] + // << " to add to my local cells:" << localFaceCells[procI] + // << endl; + nbrProcs[nbrI++] = procI; + } + } + nbrProcs.setSize(nbrI); + } + + // Construct interfaces + remoteStencilInterfaces_.setSize(nbrProcs.size()); + forAll(nbrProcs, i) + { + label procI = nbrProcs[i]; + remoteStencilInterfaces_.set + ( + i, + new lduPrimitiveProcessorInterface + ( + localFaceCells[procI], + Pstream::myProcNo(), + procI, + tensorField(0), + Pstream::msgType() + ) + ); + } + + + // Get addressing and interfaces of all interfaces + + + List<const labelUList*> patchAddr; + { + const fvBoundaryMesh& fvp = boundary(); + + patchAddr.setSize(fvp.size() + remoteStencilInterfaces_.size()); + + allInterfaces_ = dynamicMotionSolverFvMesh::interfaces(); + allInterfaces_.setSize(patchAddr.size()); + + forAll(fvp, patchI) + { + patchAddr[patchI] = &fvp[patchI].faceCells(); + } + forAll(remoteStencilInterfaces_, i) + { + label patchI = fvp.size()+i; + const lduPrimitiveProcessorInterface& pp = + remoteStencilInterfaces_[i]; + + //Pout<< "at patch:" << patchI + // << " have procPatch:" << pp.type() + // << " from:" << pp.myProcNo() + // << " to:" << pp.neighbProcNo() + // << " with fc:" << pp.faceCells().size() << endl; + + patchAddr[patchI] = &pp.faceCells(); + allInterfaces_.set(patchI, &pp); + } + } + const lduSchedule ps + ( + lduPrimitiveMesh::nonBlockingSchedule<processorLduInterface> + ( + allInterfaces_ + ) + ); + + lduPtr_.reset + ( + new fvMeshPrimitiveLduAddressing + ( + nCells(), + lowerAddr.xfer(), + upperAddr.xfer(), + patchAddr, + ps + ) + ); + + + // Check + if (debug) + { + const lduAddressing& addr = lduPtr_(); //this->lduAddr(); + + Pout<< "Adapted addressing:" + << " lower:" << addr.lowerAddr().size() + << " upper:" << addr.upperAddr().size() << endl; + + lduInterfacePtrsList iFaces = this->interfaces(); + // Using lduAddressing::patch + forAll(patchAddr, patchI) + { + Pout<< " " << patchI << "\tpatchAddr:" + << addr.patchAddr(patchI).size() + << endl; + } + + // Using interfaces + Pout<< "iFaces:" << iFaces.size() << endl; + forAll(iFaces, patchI) + { + if (iFaces.set(patchI)) + { + Pout<< " " << patchI << "\tiFace:" << iFaces[patchI].type() + << endl; + } + } + + Pout<< "end of printing." << endl; + } + + return true; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dynamicOversetFvMesh::dynamicOversetFvMesh(const IOobject& io) +: + dynamicMotionSolverFvMesh(io), + active_(false) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dynamicOversetFvMesh::~dynamicOversetFvMesh() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::lduAddressing& Foam::dynamicOversetFvMesh::lduAddr() const +{ + if (!active_) + { + return dynamicMotionSolverFvMesh::lduAddr(); + } + if (lduPtr_.empty()) + { + // Build extended addressing + updateAddressing(); + } + return lduPtr_(); +} + + +const Foam::fvMeshPrimitiveLduAddressing& +Foam::dynamicOversetFvMesh::primitiveLduAddr() const +{ + if (lduPtr_.empty()) + { + FatalErrorInFunction + << "Extended addressing not allocated" << abort(FatalError); + } + + return lduPtr_(); +} + + +bool Foam::dynamicOversetFvMesh::update() +{ + if (dynamicMotionSolverFvMesh::update()) + { + // Calculate the local extra faces for the interpolation. Note: could + // let demand-driven lduAddr() trigger it but just to make sure. + updateAddressing(); + + return true; + } + + return false; +} + + +bool Foam::dynamicOversetFvMesh::writeObject +( + IOstream::streamFormat fmt, + IOstream::versionNumber ver, + IOstream::compressionType cmp +) const +{ + bool ok = dynamicMotionSolverFvMesh::writeObject(fmt, ver, cmp); + + // For postprocessing : write cellTypes and zoneID + { + const cellCellStencilObject& overlap = Stencil::New(*this); + + const labelUList& cellTypes = overlap.cellTypes(); + + volScalarField volTypes + ( + IOobject + ( + "cellTypes", + this->time().timeName(), + *this, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + *this, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(volTypes.internalField(), cellI) + { + volTypes[cellI] = cellTypes[cellI]; + } + volTypes.correctBoundaryConditions(); + volTypes.writeObject(fmt, ver, cmp); + } + { + volScalarField volZoneID + ( + IOobject + ( + "zoneID", + this->time().timeName(), + *this, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + *this, + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ); + + const cellCellStencilObject& overlap = Stencil::New(*this); + const labelIOList& zoneID = overlap.zoneID(); + + forAll(zoneID, cellI) + { + volZoneID[cellI] = zoneID[cellI]; + } + volZoneID.correctBoundaryConditions(); + volZoneID.writeObject(fmt, ver, cmp); + } + return ok; +} + + +// ************************************************************************* // diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..2be46218a3ed1fc751cb1ace9942277cc81fdf8e --- /dev/null +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H @@ -0,0 +1,314 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::dynamicOversetFvMesh + +Description + dynamicFvMesh with support for overset meshes. + +SourceFiles + dynamicOversetFvMesh.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dynamicOversetFvMesh_H +#define dynamicOversetFvMesh_H + +#include "dynamicMotionSolverFvMesh.H" +#include "labelIOList.H" +#include "fvMeshPrimitiveLduAddressing.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapDistribute; +class lduPrimitiveProcessorInterface; + +/*---------------------------------------------------------------------------*\ + Class dynamicOversetFvMesh Declaration +\*---------------------------------------------------------------------------*/ + +class dynamicOversetFvMesh +: + public dynamicMotionSolverFvMesh +{ +protected: + + // Protected data + + //- Select base addressing (false) or locally stored extended + // lduAddressing (true) + mutable bool active_; + + //- Extended addressing (extended with local interpolation stencils) + mutable autoPtr<fvMeshPrimitiveLduAddressing> lduPtr_; + + //- Added (processor)lduInterfaces for remote bits of stencil. + //PtrList<const lduInterface> remoteStencilInterfaces_; + mutable PtrList<const lduPrimitiveProcessorInterface> + remoteStencilInterfaces_; + + //- Interfaces for above mesh. Contains both original and + // above added processorLduInterfaces + mutable lduInterfacePtrsList allInterfaces_; + + //- Corresponding faces (in above lduPtr) to the stencil + mutable labelListList stencilFaces_; + + //- From old to new face labels + mutable labelList reverseFaceMap_; + + + // Protected Member Functions + + //- Calculate the extended lduAddressing + virtual bool updateAddressing() const; + + //- Debug: print matrix + template<class Type> + void write(Ostream&, const fvMatrix<Type>&, const lduAddressing&) const; + + //- Explicit interpolation of acceptor cells from donor cells + template<class T> + void interpolate(Field<T>& psi) const; + + //- Explicit interpolation of acceptor cells from donor cells with + // boundary condition handling + template<class GeoField> + void interpolate(GeoField& psi) const; + + //- Add interpolation to matrix (coefficients) + template<class Type> + void addInterpolation(fvMatrix<Type>&) const; + + //- Solve given dictionary with settings + template<class Type> + SolverPerformance<Type> solve(fvMatrix<Type>&, const dictionary&) const; + + //- Debug: correct coupled bc + template<class GeoField> + static void correctCoupledBoundaryConditions(GeoField& fld); + + //- Use extended addressing + void active(const bool f) const + { + active_ = f; + + if (active_) + { + DebugInfo<< "Switching to extended addressing with nFaces:" + << primitiveLduAddr().lowerAddr().size() + << endl; + } + else + { + DebugInfo<< "Switching to base addressing with nFaces:" + << fvMesh::lduAddr().lowerAddr().size() + << endl; + } + } + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + dynamicOversetFvMesh(const dynamicOversetFvMesh&); + + //- Disallow default bitwise assignment + void operator=(const dynamicOversetFvMesh&); + + +public: + + //- Runtime type information + TypeName("dynamicOversetFvMesh"); + + + // Constructors + + //- Construct from IOobject + dynamicOversetFvMesh(const IOobject& io); + + + //- Destructor + virtual ~dynamicOversetFvMesh(); + + + // Member Functions + + + // Extended addressing + + //- Use extended addressing + bool active() const + { + return active_; + } + + //- Return extended ldu addressing + const fvMeshPrimitiveLduAddressing& primitiveLduAddr() const; + + //- Return ldu addressing. If active: is (extended) + // primitiveLduAddr + virtual const lduAddressing& lduAddr() const; + + + // Overset + + // Explicit interpolation + + virtual void interpolate(scalarField& psi) const + { + interpolate<scalar>(psi); + } + + virtual void interpolate(vectorField& psi) const + { + interpolate<vector>(psi); + } + + virtual void interpolate(sphericalTensorField& psi) const + { + interpolate<sphericalTensor>(psi); + } + + virtual void interpolate(symmTensorField& psi) const + { + interpolate<symmTensor>(psi); + } + + virtual void interpolate(tensorField& psi) const + { + interpolate<tensor>(psi); + } + + virtual void interpolate(volScalarField& psi) const + { + interpolate<volScalarField>(psi); + } + + virtual void interpolate(volVectorField& psi) const + { + interpolate<volVectorField>(psi); + } + + virtual void interpolate(volSphericalTensorField& psi) const + { + interpolate<volSphericalTensorField>(psi); + } + + virtual void interpolate(volSymmTensorField& psi) const + { + interpolate<volSymmTensorField>(psi); + } + + virtual void interpolate(volTensorField& psi) const + { + interpolate<volTensorField>(psi); + } + + + // Implicit interpolation (matrix manipulation) + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<scalar> solve + ( + fvMatrix<scalar>& m, + const dictionary& dict + ) const + { + return solve<scalar>(m, dict); + } + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<vector> solve + ( + fvMatrix<vector>& m, + const dictionary& dict + ) const + { + return solve<vector>(m, dict); + } + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<symmTensor> solve + ( + fvMatrix<symmTensor>& m, + const dictionary& dict + ) const + { + return solve<symmTensor>(m, dict); + } + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance<tensor> solve + ( + fvMatrix<tensor>& m, + const dictionary& dict + ) const + { + return solve<tensor>(m, dict); + } + + + //- Update the mesh for both mesh motion and topology change + virtual bool update(); + + //- Write using given format, version and compression + virtual bool writeObject + ( + IOstream::streamFormat, + IOstream::versionNumber, + IOstream::compressionType + ) const; + + //- Debug: check halo swap is ok + template<class GeoField> + static void checkCoupledBC(const GeoField& fld); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "dynamicOversetFvMeshTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..dce8e9cd7a86c4d0848476f47db121147b6d4319 --- /dev/null +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C @@ -0,0 +1,506 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "volFields.H" +#include "fvMatrix.H" +#include "cellCellStencilObject.H" + +// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // + +template<class T> +void Foam::dynamicOversetFvMesh::interpolate(Field<T>& psi) const +{ + const cellCellStencil& overlap = Stencil::New(*this); + const labelListList& stencil = overlap.cellStencil(); + + if (stencil.size() != nCells()) + { + return; + } + + const mapDistribute& map = overlap.cellInterpolationMap(); + const List<scalarList>& wghts = overlap.cellInterpolationWeights(); + const labelList& cellIDs = overlap.interpolationCells(); + const scalarList& factor = overlap.cellInterpolationWeight(); + + Field<T> work(psi); + map.mapDistributeBase::distribute(work, UPstream::msgType()+1); + + forAll(cellIDs, i) + { + label celli = cellIDs[i]; + + const scalarList& w = wghts[celli]; + const labelList& nbrs = stencil[celli]; + const scalar f = factor[celli]; + + T s(pTraits<T>::zero); + forAll(nbrs, nbrI) + { + s += w[nbrI]*work[nbrs[nbrI]]; + } + //Pout<< "Interpolated value:" << s << endl; + //T oldPsi = psi[celli]; + psi[celli] = (1.0-f)*psi[celli] + f*s; + //Pout<< "psi was:" << oldPsi << " now:" << psi[celli] << endl; + } +} + + +template<class GeoField> +void Foam::dynamicOversetFvMesh::interpolate(GeoField& psi) const +{ + interpolate(psi.primitiveFieldRef()); + psi.correctBoundaryConditions(); +} + + +//template<class T> +//void Foam::dynamicOversetFvMesh::setReference(fvMatrix<T>& m) const +//{ +// const mapDistribute& map = cellInterpolationMap(); +// const List<scalarList>& wghts = cellInterpolationWeights(); +// const labelListList& stencil = cellStencil(); +// const labelList& cellIDs = interpolationCells(); +// const scalarList& factor = cellInterpolationWeight(); +// +// Field<T> work(m.psi()); +// map.mapDistributeBase::distribute(work, UPstream::msgType()+1); +// +// forAll(cellIDs, i) +// { +// label celli = cellIDs[i]; +// +// const scalarList& w = wghts[celli]; +// const labelList& nbrs = stencil[celli]; +// const scalar f = factor[celli]; +// +// //Pout<< "Interpolating " << celli << " from values:" << endl; +// T s(pTraits<T>::zero); +// forAll(nbrs, nbrI) +// { +// //Pout<< " " << work[nbrs[nbrI]] +// // << " from slot " << nbrs[nbrI] << endl; +// s += w[nbrI]*work[nbrs[nbrI]]; +// } +// //Pout<< "Interpolated value:" << s << endl; +// const T oldPsi = m.psi()[celli]; +// m.setReference(celli, (1.0-f)*oldPsi + f*s, true); +// Pout<< "psi was:" << oldPsi << " now forcing to:" +// << (1.0-f)*oldPsi + f*s << endl; +// } +//} + + +template<class Type> +void Foam::dynamicOversetFvMesh::addInterpolation(fvMatrix<Type>& m) const +{ + const cellCellStencilObject& overlap = Stencil::New(*this); + const List<scalarList>& wghts = overlap.cellInterpolationWeights(); + const labelListList& stencil = overlap.cellStencil(); + const labelList& cellIDs = overlap.interpolationCells(); + const scalarList& factor = overlap.cellInterpolationWeight(); + const labelUList& types = overlap.cellTypes(); + + + // Force asymmetric matrix (if it wasn't already) + scalarField& lower = m.lower(); + scalarField& upper = m.upper(); + Field<Type>& source = m.source(); + scalarField& diag = m.diag(); + + + // Get the addressing. Note that the addressing is now extended with + // any interpolation faces. + const lduAddressing& addr = lduAddr(); + const labelUList& upperAddr = addr.upperAddr(); + const labelUList& lowerAddr = addr.lowerAddr(); + const labelUList& ownerStartAddr = addr.ownerStartAddr(); + const labelUList& losortAddr = addr.losortAddr(); + + + if (!isA<fvMeshPrimitiveLduAddressing>(addr)) + { + FatalErrorInFunction + << "Problem : addressing is not fvMeshPrimitiveLduAddressing" + << exit(FatalError); + } + + + + // 1. Adapt lduMatrix for additional faces and new ordering + upper.setSize(upperAddr.size(), 0.0); + inplaceReorder(reverseFaceMap_, upper); + lower.setSize(lowerAddr.size(), 0.0); + inplaceReorder(reverseFaceMap_, lower); + + + // 2. Adapt fvMatrix level: faceFluxCorrectionPtr + // Question: do we need to do this? + // This seems to be set/used only by the gaussLaplacianScheme and + // fvMatrix:correction, both of which are outside the linear solver. + + + + // Clear out existing connections on cells to be interpolated + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Note: could avoid doing the zeroing of the new faces since these + // are set to zero anyway. + + forAll(upperAddr, facei) + { + if (types[upperAddr[facei]] == cellCellStencil::INTERPOLATED) + { + // Disconnect upper from lower + label celli = upperAddr[facei]; + lower[facei] *= 1.0-factor[celli]; + } + if (types[lowerAddr[facei]] == cellCellStencil::INTERPOLATED) + { + // Disconnect lower from upper + label celli = lowerAddr[facei]; + upper[facei] *= 1.0-factor[celli]; + } + } + + forAll(m.internalCoeffs(), patchI) + { + const labelUList& fc = addr.patchAddr(patchI); + Field<Type>& intCoeffs = m.internalCoeffs()[patchI]; + Field<Type>& bouCoeffs = m.boundaryCoeffs()[patchI]; + forAll(fc, i) + { + label celli = fc[i]; + { + if (types[celli] == cellCellStencil::INTERPOLATED) + { + scalar f = factor[celli]; + intCoeffs[i] *= 1.0-f; + bouCoeffs[i] *= 1.0-f; + } + else if (types[celli] == cellCellStencil::HOLE) + { + intCoeffs[i] = pTraits<Type>::zero; + bouCoeffs[i] = pTraits<Type>::zero; + } + } + } + } + + + + // Modify matrix + // ~~~~~~~~~~~~~ + + + + // Do hole cells. Note: maybe put into interpolationCells() loop above? + forAll(types, celli) + { + if (types[celli] == cellCellStencil::HOLE) + { + //Pout<< "Found hole cell:" << celli + // << " at:" << C()[celli] + // << " ; setting value" << endl; + + label startLabel = ownerStartAddr[celli]; + label endLabel = ownerStartAddr[celli + 1]; + + for (label facei = startLabel; facei < endLabel; facei++) + { + upper[facei] = 0.0; + } + + startLabel = addr.losortStartAddr()[celli]; + endLabel = addr.losortStartAddr()[celli + 1]; + + for (label i = startLabel; i < endLabel; i++) + { + label facei = losortAddr[i]; + lower[facei] = 0.0; + } + + const scalar normalisation = V()[celli]; + diag[celli] = normalisation; + source[celli] = normalisation*m.psi()[celli]; + } + } + + + forAll(cellIDs, i) + { + label celli = cellIDs[i]; + + const scalar f = factor[celli]; + const scalarList& w = wghts[celli]; + const labelList& nbrs = stencil[celli]; + const labelList& nbrFaces = stencilFaces_[celli]; + + const scalar normalisation = V()[celli]; + + if (types[celli] == cellCellStencil::HOLE) + { + FatalErrorInFunction << "Found HOLE cell " << celli + << " at:" << C()[celli] + << " . Should this be in interpolationCells()????" + << abort(FatalError); + } + else + { + // Create interpolation stencil. Leave any non-local contributions + // to be done by oversetFvPatchField updateMatrixInterface + + diag[celli] *= (1.0-f); + diag[celli] += normalisation*f; + + source[celli] *= (1.0-f); + source[celli] += normalisation*f*pTraits<Type>::zero; // dummy + + //Pout<< "Interpolating " << celli << " with factor:" << f + // << " new diag:" << diag[celli] + // << " new source:" << source[celli] + // << " volume:" << V()[celli] << endl; + + forAll(nbrs, nbri) + { + label facei = nbrFaces[nbri]; + + if (facei != -1) + { + label nbrCelli = nbrs[nbri]; + + // Add the coefficients + + scalar& u = upper[facei]; + scalar& l = lower[facei]; + if (celli < nbrCelli) + { + u += -normalisation*f*w[nbri]; + } + else + { + l += -normalisation*f*w[nbri]; + } + } + //else + //{ + // Pout<< "addItnerpolation of " << celli + // << " at:" << this->cellCentres()[celli] + // << " zone:" << this->zoneID()[celli] + // << " diag:" << diag[celli] + // << " source:" << source[celli] + // <<" : skipping remote cell:" << nbrs[nbri] + // << " with weight:" << w[nbri] + // << endl; + //} + } + } + } +} + + +template<class Type> +Foam::SolverPerformance<Type> Foam::dynamicOversetFvMesh::solve +( + fvMatrix<Type>& m, + const dictionary& dict +) const +{ + // Switch to extended addressing (requires mesh::update() having been + // called) + active(true); + + // Adapt matrix + scalarField oldUpper(m.upper()); + scalarField oldLower(m.lower()); + FieldField<Field, Type> oldInt(m.internalCoeffs()); + FieldField<Field, Type> oldBou(m.boundaryCoeffs()); + + addInterpolation(m); + + // Print a bit + //write(Pout, m, lduAddr()); + + // Use lower level solver + SolverPerformance<Type> s(dynamicMotionSolverFvMesh::solve(m, dict)); + + // Reset matrix (shuffle faces into original order) + //resetMatrix(m); + m.upper().transfer(oldUpper); + m.lower().transfer(oldLower); + m.internalCoeffs().transfer(oldInt); + m.boundaryCoeffs().transfer(oldBou); + + // Switch to original addressing + active(false); + + return s; +} + + +template<class Type> +void Foam::dynamicOversetFvMesh::write +( + Ostream& os, + const fvMatrix<Type>& m, + const lduAddressing& addr +) const +{ + os << "** Matrix **" << endl; + const labelUList& upperAddr = addr.upperAddr(); + const labelUList& lowerAddr = addr.lowerAddr(); + const labelUList& ownerStartAddr = addr.ownerStartAddr(); + const labelUList& losortAddr = addr.losortAddr(); + + const scalarField& lower = m.lower(); + const scalarField& upper = m.upper(); + const Field<Type>& source = m.source(); + const scalarField& diag = m.diag(); + + forAll(source, celli) + { + os << "cell:" << celli << " diag:" << diag[celli] + << " source:" << source[celli] << endl; + + label startLabel = ownerStartAddr[celli]; + label endLabel = ownerStartAddr[celli + 1]; + + for (label facei = startLabel; facei < endLabel; facei++) + { + os << " face:" << facei + << " nbr:" << upperAddr[facei] << " coeff:" << upper[facei] + << endl; + } + + startLabel = addr.losortStartAddr()[celli]; + endLabel = addr.losortStartAddr()[celli + 1]; + + for (label i = startLabel; i < endLabel; i++) + { + label facei = losortAddr[i]; + os << " face:" << facei + << " nbr:" << lowerAddr[facei] << " coeff:" << lower[facei] + << endl; + } + } + forAll(m.internalCoeffs(), patchi) + { + if (m.internalCoeffs().set(patchi)) + { + const labelUList& fc = addr.patchAddr(patchi); + + os << "patch:" << patchi << " size:" << fc.size() << endl; + forAll(fc, i) + { + os << " cell:" << fc[i] + << " int:" << m.internalCoeffs()[patchi][i] + << " boun:" << m.boundaryCoeffs()[patchi][i] + << endl; + } + } + } + + + lduInterfaceFieldPtrsList interfaces = + m.psi().boundaryField().scalarInterfaces(); + forAll(interfaces, inti) + { + if (interfaces.set(inti)) + { + os << "interface:" << inti + << " if type:" << interfaces[inti].interface().type() + << " fld type:" << interfaces[inti].type() << endl; + } + } + + os << "** End of Matrix **" << endl; +} + + +template<class GeoField> +void Foam::dynamicOversetFvMesh::correctCoupledBoundaryConditions(GeoField& fld) +{ + typename GeoField::Boundary& bfld = fld.boundaryFieldRef(); + + label nReq = Pstream::nRequests(); + + forAll(bfld, patchi) + { + if (bfld[patchi].coupled()) + { + Pout<< "initEval of " << bfld[patchi].patch().name() << endl; + bfld[patchi].initEvaluate(Pstream::defaultCommsType); + } + } + + // Block for any outstanding requests + if (Pstream::parRun()) + { + Pstream::waitRequests(nReq); + } + + forAll(bfld, patchi) + { + if (bfld[patchi].coupled()) + { + Pout<< "eval of " << bfld[patchi].patch().name() << endl; + bfld[patchi].evaluate(Pstream::defaultCommsType); + } + } +} + + +template<class GeoField> +void Foam::dynamicOversetFvMesh::checkCoupledBC(const GeoField& fld) +{ + Pout<< "** starting checking of " << fld.name() << endl; + + GeoField fldCorr(fld.name()+"_correct", fld); + correctCoupledBoundaryConditions(fldCorr); + + const typename GeoField::Boundary& bfld = fld.boundaryField(); + const typename GeoField::Boundary& bfldCorr = fldCorr.boundaryField(); + + forAll(bfld, patchi) + { + const typename GeoField::Patch& pfld = bfld[patchi]; + const typename GeoField::Patch& pfldCorr = bfldCorr[patchi]; + + Pout<< "Patch:" << pfld.patch().name() << endl; + + forAll(pfld, i) + { + if (pfld[i] != pfldCorr[i]) + { + Pout<< " " << i << " orig:" << pfld[i] + << " corrected:" << pfldCorr[i] << endl; + } + } + } + Pout<< "** end of " << fld.name() << endl; +} + + +// ************************************************************************* // diff --git a/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C new file mode 100644 index 0000000000000000000000000000000000000000..d779b59de64ba491065e1cd6cd24c82af68d3f83 --- /dev/null +++ b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C @@ -0,0 +1,267 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshPrimitiveLduAddressing.H" +#include "lduPrimitiveMesh.H" +#include "processorLduInterface.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +Foam::fvMeshPrimitiveLduAddressing::fvMeshPrimitiveLduAddressing +( + const fvMesh& mesh +) +: + lduAddressing(mesh.nCells()), + lowerAddr_ + ( + labelList::subList + ( + mesh.faceOwner(), + mesh.nInternalFaces() + ) + ), + upperAddr_(mesh.faceNeighbour()), + patchAddr_(mesh.boundary().size()), + patchSchedule_(mesh.globalData().patchSchedule()) +{ + forAll(mesh.boundary(), patchI) + { + patchAddr_[patchI] = &mesh.boundary()[patchI].faceCells(); + } +} + + +Foam::fvMeshPrimitiveLduAddressing::fvMeshPrimitiveLduAddressing +( + const label nCells, + const Xfer<labelList>& lowerAddr, + const Xfer<labelList>& upperAddr, + const List<const labelUList*>& patchAddr, + const lduSchedule& ps +) +: + lduAddressing(nCells), + lowerAddr_(lowerAddr), + upperAddr_(upperAddr), + patchAddr_(patchAddr), + patchSchedule_(ps) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::label Foam::fvMeshPrimitiveLduAddressing::triIndex +( + const lduAddressing& addr, + const label a, + const label b +) +{ + label own = min(a, b); + + label nbr = max(a, b); + + label startLabel = addr.ownerStartAddr()[own]; + + label endLabel = addr.ownerStartAddr()[own + 1]; + + const labelUList& neighbour = addr.upperAddr(); + + for (label i = startLabel; i < endLabel; i++) + { + if (neighbour[i] == nbr) + { + return i; + } + } + return -1; +} + + +Foam::labelList Foam::fvMeshPrimitiveLduAddressing::addAddressing +( + const lduAddressing& addr, + const labelListList& nbrCells, + label& nExtraFaces, + labelList& newLowerAddr, + labelList& newUpperAddr, + labelListList& nbrCellFaces, + const globalIndex& globalNumbering, + const labelList& globalCellIDs, + labelListList& localFaceCells, + labelListList& remoteFaceCells +) +{ + label nCells = addr.size(); + label nFaces = addr.upperAddr().size(); + labelList nProcFaces(Pstream::nProcs(), 0); + + // Count additional faces + nExtraFaces = 0; + forAll(nbrCells, cellI) + { + const labelList& nbrs = nbrCells[cellI]; + forAll(nbrs, nbrI) + { + if (nbrs[nbrI] < nCells) + { + // Local cell + if (triIndex(addr, cellI, nbrs[nbrI]) == -1) + { + nExtraFaces++; + } + } + else + { + label globalNbr = globalCellIDs[nbrs[nbrI]]; + label procI = globalNumbering.whichProcID(globalNbr); + nProcFaces[procI]++; + } + } + } + + // Create space for extra addressing + newLowerAddr.setSize(nFaces + nExtraFaces); + newUpperAddr.setSize(nFaces + nExtraFaces); + + // Copy existing addressing + SubList<label>(newLowerAddr, nFaces) = addr.lowerAddr(); + SubList<label>(newUpperAddr, nFaces) = addr.upperAddr(); + + + // Per processor its local cells we want + localFaceCells.setSize(Pstream::nProcs()); + remoteFaceCells.setSize(Pstream::nProcs()); + forAll(nProcFaces, procI) + { + localFaceCells[procI].setSize(nProcFaces[procI]); + remoteFaceCells[procI].setSize(nProcFaces[procI]); + } + nProcFaces = 0; + + nbrCellFaces.setSize(nbrCells.size()); + forAll(nbrCells, cellI) + { + const labelList& nbrs = nbrCells[cellI]; + labelList& faces = nbrCellFaces[cellI]; + faces.setSize(nbrs.size()); + + forAll(nbrs, nbrI) + { + label nbrCellI = nbrs[nbrI]; + + if (nbrCellI < nCells) + { + // Find neighbour cell in owner list + label faceI = triIndex(addr, cellI, nbrCellI); + if (faceI == -1) + { + faceI = nFaces++; + newLowerAddr[faceI] = min(cellI, nbrCellI); + newUpperAddr[faceI] = max(cellI, nbrCellI); + } + faces[nbrI] = faceI; + } + else + { + // Remote cell + faces[nbrI] = -1; + + label globalNbr = globalCellIDs[nbrs[nbrI]]; + label procI = globalNumbering.whichProcID(globalNbr); + label remoteCellI = globalNumbering.toLocal(procI, globalNbr); + + label procFaceI = nProcFaces[procI]++; + localFaceCells[procI][procFaceI] = cellI; + remoteFaceCells[procI][procFaceI] = remoteCellI; + } + } + } + + // Reorder upper-triangular + labelList oldToNew + ( + lduPrimitiveMesh::upperTriOrder + ( + addr.size(), + newLowerAddr, + newUpperAddr + ) + ); + + // Shuffle face-to-cell addressing + inplaceReorder(oldToNew, newLowerAddr); + inplaceReorder(oldToNew, newUpperAddr); + // Update cell-to-face addressing + forAll(nbrCellFaces, cellI) + { + inplaceRenumber(oldToNew, nbrCellFaces[cellI]); + } + + //if (debug) + //{ + // for + // ( + // label i = addr.upperAddr().size(); + // i < oldToNew.size(); + // i++ + // ) + // { + // label faceI = oldToNew[i]; + // Pout<< "new face:" << faceI << endl + // << " owner:" << newLowerAddr[faceI] + // << " neighbour:" << newUpperAddr[faceI] + // << endl; + // } + // + // forAll(nbrCellFaces, cellI) + // { + // const labelList& nbrs = nbrCells[cellI]; + // const labelList& nbrFaces = nbrCellFaces[cellI]; + // if (nbrs.size()) + // { + // Pout<< "cell:" << cellI << " has additional neighbours:" + // << endl; + // forAll(nbrs, i) + // { + // label faceI = nbrFaces[i]; + // Pout<< " nbr:" << nbrs[i] + // << " through face:" << faceI + // << " with own:" << newLowerAddr[faceI] + // << " with nei:" << newUpperAddr[faceI] + // << endl; + // } + // } + // } + //} + + return oldToNew; +} + + +// ************************************************************************* // diff --git a/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H new file mode 100644 index 0000000000000000000000000000000000000000..097a4308125e1974ffa01153ce9ed3125156c869 --- /dev/null +++ b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::fvMeshPrimitiveLduAddressing + +Description + Variant of fvMeshLduAddressing that contains addressing instead of + slices. + + Alternatively use lduPrimitiveMesh but that assumes there are only + lduInterfaces and not also generic patches. + +SourceFiles + fvMeshPrimitiveLduAddressing.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvMeshPrimitiveLduAddressing_H +#define fvMeshPrimitiveLduAddressing_H + +#include "lduPrimitiveMesh.H" +#include "lduAddressing.H" +#include "fvMesh.H" +#include "globalMeshData.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fvMeshPrimitiveLduAddressing Declaration +\*---------------------------------------------------------------------------*/ + +class fvMeshPrimitiveLduAddressing +: + public lduAddressing +{ + // Private data + + //- Lower (face to owner addressing) + labelList lowerAddr_; + + //- Upper (face to neighbour addressing) + labelList upperAddr_; + + //- Patch addressing as a list of sublists + List<const labelUList*> patchAddr_; + + //- Patch field evaluation schedule + const lduSchedule& patchSchedule_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + fvMeshPrimitiveLduAddressing(const fvMeshPrimitiveLduAddressing&); + + //- Disallow default bitwise assignment + void operator=(const fvMeshPrimitiveLduAddressing&); + + +public: + + // Constructors + + //- Construct from mesh + fvMeshPrimitiveLduAddressing(const fvMesh& mesh); + + //- Construct from components + fvMeshPrimitiveLduAddressing + ( + const label nCells, + const Xfer<labelList>& lowerAddr, + const Xfer<labelList>& upperAddr, + const List<const labelUList*>& interfaces, + const lduSchedule& ps + ); + + + //- Destructor + virtual ~fvMeshPrimitiveLduAddressing() + {} + + + // Member Functions + + //- Return lower addressing (i.e. lower label = upper triangle) + virtual const labelUList& lowerAddr() const + { + return lowerAddr_; + } + + //- Return upper addressing (i.e. upper label) + virtual const labelUList& upperAddr() const + { + return upperAddr_; + } + + //- Return patch addressing + virtual const labelUList& patchAddr(const label i) const + { + return *patchAddr_[i]; + } + + // Return patch field evaluation schedule + virtual const lduSchedule& patchSchedule() const + { + return patchSchedule_; + } + + //- Given additional addressing (in the form of additional neighbour + // cells, i.e. like cellCells) + // - add any additional faces + // - sort in upper-triangular order + // - construct cell-faces equivalent of given nbrCells + // (so e.g. nbrCellFaces[cellI][0] is the face corresponding to + // the cell nbrCells[cellI][0]) + // (note: face in nbrCellFaces is -1 if the nbrCell is not local) + // - construct additional processor interface addressing: + // per processor the local and the remote cell. + // - return old-to-new face mapping + static labelList addAddressing + ( + const lduAddressing& addr, + const labelListList& nbrCells, + label& nExtraFaces, + labelList& lower, + labelList& upper, + labelListList& nbrCellFaces, + const globalIndex&, + const labelList& globalCellIDs, + labelListList& localFaceCells, + labelListList& remoteFaceCells + ); + + //- Return off-diagonal index given owner and neighbour label. Return + // -1 if not found + static label triIndex(const lduAddressing&, const label, const label); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/include/createCellMask.H b/src/overset/include/createCellMask.H new file mode 100644 index 0000000000000000000000000000000000000000..61de106885834a568a3d5f745ae1dacb9e53c15e --- /dev/null +++ b/src/overset/include/createCellMask.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 + blockedCellMask + +Description + Creates mask for blocked out cells + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Info<< "Creating cellMask field to block out hole cells\n" << endl; + +volScalarField cellMask +( + IOobject + ( + "cellMask", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("cellMask", dimless, 1.0), + zeroGradientFvPatchScalarField::typeName +); + +#include "setCellMask.H" + +// ************************************************************************* // diff --git a/src/overset/include/createInterpolatedCells.H b/src/overset/include/createInterpolatedCells.H new file mode 100644 index 0000000000000000000000000000000000000000..87b8ebbb4a0893848f93f9fcf7193d9a2e3cc7ea --- /dev/null +++ b/src/overset/include/createInterpolatedCells.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 + interpolatedCells + +Description + Creates mask for interpolated cells + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Info<< "Creating interpolatedCells field \n" << endl; + +volScalarField interpolatedCells +( + IOobject + ( + "interpolatedCells", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("interpolatedCells", dimless, 1.0), + zeroGradientFvPatchScalarField::typeName +); + +#include "setInterpolatedCells.H" + +// ************************************************************************* // diff --git a/src/overset/include/setCellMask.H b/src/overset/include/setCellMask.H new file mode 100644 index 0000000000000000000000000000000000000000..92e187ee596f479ba49351ddd8cbad4eb4f97de7 --- /dev/null +++ b/src/overset/include/setCellMask.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + +Description + Sets blocked cells mask field + +SourceFiles + +\*---------------------------------------------------------------------------*/ + +{ + const cellCellStencilObject& overlap = Stencil::New(mesh); + const labelList& cellTypes = overlap.cellTypes(); + + //label nHoles = 0; + + cellMask.primitiveFieldRef() = 1.0; + forAll(cellMask, cellI) + { + if (cellTypes[cellI] == cellCellStencil::HOLE) + { + cellMask[cellI] = 0.0; + //nHoles++; + } + } + cellMask.correctBoundaryConditions(); +} + +// ************************************************************************* // diff --git a/src/overset/include/setInterpolatedCells.H b/src/overset/include/setInterpolatedCells.H new file mode 100644 index 0000000000000000000000000000000000000000..6b3cac9e85429103105673de250153f7285bbe8d --- /dev/null +++ b/src/overset/include/setInterpolatedCells.H @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + +Description + Sets blocked cells mask field + +SourceFiles + +\*---------------------------------------------------------------------------*/ + +{ + const cellCellStencilObject& overlap = Stencil::New(mesh); + const labelList& cellTypes = overlap.cellTypes(); + + interpolatedCells.primitiveFieldRef() = 1.0; + forAll(cellMask, cellI) + { + if (cellTypes[cellI] == cellCellStencil::INTERPOLATED) + { + interpolatedCells[cellI] = 0.0; + } + } + interpolatedCells.correctBoundaryConditions(); +} + +// ************************************************************************* // diff --git a/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C b/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..c12dc99f90ff84b759c000ec9e4303f5b216a0e9 --- /dev/null +++ b/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "lduPrimitiveProcessorInterface.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(lduPrimitiveProcessorInterface, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::lduPrimitiveProcessorInterface::lduPrimitiveProcessorInterface +( + const labelUList& faceCells, + const label myProcNo, + const label neighbProcNo, + const tensorField& forwardT, + const int tag, + const label comm +) +: + faceCells_(faceCells), + myProcNo_(myProcNo), + neighbProcNo_(neighbProcNo), + forwardT_(forwardT), + tag_(tag), + comm_(comm) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp<Foam::labelField> +Foam::lduPrimitiveProcessorInterface::interfaceInternalField +( + const labelUList& internalData +) const +{ + tmp<labelField> tfld(new labelField(faceCells_.size())); + labelField& fld = tfld.ref(); + forAll(faceCells_, i) + { + fld[i] = internalData[faceCells_[i]]; + } + return tfld; +} + + +void Foam::lduPrimitiveProcessorInterface::initInternalFieldTransfer +( + const Pstream::commsTypes commsType, + const labelUList& iF +) const +{ + processorLduInterface::send(commsType, interfaceInternalField(iF)()); +} + + +Foam::tmp<Foam::labelField> +Foam::lduPrimitiveProcessorInterface::internalFieldTransfer +( + const Pstream::commsTypes commsType, + const labelUList& +) const +{ + return processorLduInterface::receive<label>(commsType, faceCells_.size()); +} + + +// ************************************************************************* // diff --git a/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.H b/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..2f1777008f91cbb76c69f8d30d065110aeeba093 --- /dev/null +++ b/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.H @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::lduPrimitiveProcessorInterface + +Description + Concrete implementation of processor interface. Used to temporarily store + settings. + +SourceFiles + lduPrimitiveProcessorInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef lduPrimitiveProcessorInterface_H +#define lduPrimitiveProcessorInterface_H + +#include "GAMGInterface.H" +#include "processorLduInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class lduPrimitiveProcessorInterface Declaration +\*---------------------------------------------------------------------------*/ + +class lduPrimitiveProcessorInterface +: + public lduInterface, + public processorLduInterface +{ + // Private data + + const labelList faceCells_; + + //- My processor rank in communicator + label myProcNo_; + + //- Neighbouring processor rank in communicator + label neighbProcNo_; + + //- Transformation tensor + tensorField forwardT_; + + //- Message tag used for sending + int tag_; + + //- Communicator to use for parallel communication + const label comm_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + lduPrimitiveProcessorInterface(const lduPrimitiveProcessorInterface&); + + //- Disallow default bitwise assignment + void operator=(const lduPrimitiveProcessorInterface&); + + +public: + + //- Runtime type information + TypeName("primitiveProcessor"); + + + // Constructors + + //- Construct from components + lduPrimitiveProcessorInterface + ( + const labelUList& faceCells, + const label myProcNo, + const label neighbProcNo, + const tensorField& forwardT, + const int tag, + const label comm = UPstream::worldComm + ); + + + //- Destructor + virtual ~lduPrimitiveProcessorInterface() + {} + + + // Member Functions + + // Access + + //- Return faceCell addressing + virtual const labelUList& faceCells() const + { + return faceCells_; + } + + + // Interface transfer functions + + //- Return the values of the given internal data adjacent to + // the interface as a field + virtual tmp<labelField> interfaceInternalField + ( + const labelUList& internalData + ) const; + + //- Initialise neighbour field transfer + virtual void initInternalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF + ) const; + + //- Transfer and return internal field adjacent to the interface + virtual tmp<labelField> internalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF + ) const; + + + //- Processor interface functions + + //- Return communicator used for sending + virtual label comm() const + { + return comm_; + } + + //- Return processor number (rank in communicator) + virtual int myProcNo() const + { + return myProcNo_; + } + + //- Return neigbour processor number (rank in communicator) + virtual int neighbProcNo() const + { + return neighbProcNo_; + } + + //- Return face transformation tensor + virtual const tensorField& forwardT() const + { + return forwardT_; + } + + //- Return message tag used for sending + virtual int tag() const + { + return tag_; + } + + +// // I/O +// +// //- Write to stream +// virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetAdjustPhi/oversetAdjustPhi.C b/src/overset/oversetAdjustPhi/oversetAdjustPhi.C new file mode 100644 index 0000000000000000000000000000000000000000..b6eb644b5502d8841ea896559eb4a116abff4933 --- /dev/null +++ b/src/overset/oversetAdjustPhi/oversetAdjustPhi.C @@ -0,0 +1,291 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetAdjustPhi.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "cellCellStencilObject.H" +#include "syncTools.H" +#include "fv.H" + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +bool Foam::oversetAdjustPhi +( + surfaceScalarField& phi, + const volVectorField& U +) +{ + const fvMesh& mesh = U.mesh(); + + const cellCellStencilObject& overlap = Stencil::New(mesh); + const labelList& cellTypes = overlap.cellTypes(); + const labelList& zoneID = overlap.zoneID(); + label nZones = gMax(zoneID)+1; + + + + // Pass1: accumulate all fluxes, calculate correction factor + + scalarField massIn(nZones, 0.0); + scalarField adjustableMassOut(nZones, 0.0); + + surfaceScalarField::Boundary& bphi = + phi.boundaryFieldRef(); + + + // Check all faces on the outside of interpolated cells + const labelUList& own = mesh.owner(); + const labelUList& nei = mesh.neighbour(); + { + forAll(own, facei) + { + label zonei = zoneID[own[facei]]; // note:own and nei in same zone + + label ownType = cellTypes[own[facei]]; + label neiType = cellTypes[nei[facei]]; + + bool ownCalc = + (ownType == cellCellStencil::CALCULATED) + && (neiType == cellCellStencil::INTERPOLATED); + + bool neiCalc = + (ownType == cellCellStencil::INTERPOLATED) + && (neiType == cellCellStencil::CALCULATED); + + + if (ownCalc || neiCalc) + { + // Calculate flux w.r.t. calculated cell + scalar flux = phi[facei]; + if (neiCalc) + { + flux = -flux; + } + + if (flux < 0.0) + { + massIn[zonei] -= flux; + } + else + { + adjustableMassOut[zonei] += flux; + } + } + } + } + + + // Check all coupled faces on the outside of interpolated cells + labelList neiCellTypes; + syncTools::swapBoundaryCellList(mesh, cellTypes, neiCellTypes); + { + forAll(bphi, patchi) + { + const fvPatchVectorField& Up = U.boundaryField()[patchi]; + const fvsPatchScalarField& phip = bphi[patchi]; + const labelUList& fc = Up.patch().faceCells(); + + label start = Up.patch().start(); + + forAll(fc, i) + { + label facei = start+i; + label celli = fc[i]; + label ownType = cellTypes[celli]; + label neiType = neiCellTypes[facei-mesh.nInternalFaces()]; + + bool ownCalc = + (ownType == cellCellStencil::CALCULATED) + && (neiType == cellCellStencil::INTERPOLATED); + + bool neiCalc = + (ownType == cellCellStencil::INTERPOLATED) + && (neiType == cellCellStencil::CALCULATED); + + + if (ownCalc || neiCalc) + { + // Calculate flux w.r.t. calculated cell + scalar flux = phip[i]; + if (neiCalc) + { + flux = -flux; + } + + if (flux < 0.0) + { + massIn[zoneID[celli]] -= flux; + } + else + { + adjustableMassOut[zoneID[celli]] += flux; + } + } + } + } + } + + // Calculate the total flux in the domain, used for normalisation + scalar totalFlux = VSMALL + sum(mag(phi)).value(); + + forAll(massIn, zonei) + { + reduce(massIn[zonei], sumOp<scalar>()); + reduce(adjustableMassOut[zonei], sumOp<scalar>()); + } + + + scalarField massCorr(nZones, 1.0); + + forAll(massIn, zonei) + { + scalar magAdjustableMassOut = mag(adjustableMassOut[zonei]); + + if + ( + magAdjustableMassOut > VSMALL + && magAdjustableMassOut/totalFlux > SMALL + ) + { + massCorr[zonei] = massIn[zonei]/adjustableMassOut[zonei]; + } + else if (mag(massIn[zonei])/totalFlux > 1e-8) + { + WarningInFunction + << "Continuity error cannot be removed by adjusting the" + " flow at fringe faces.\n Please check the cell types" + << " from the overset analysis." + << nl + << "Zone : " << zonei << nl + << "Total flux : " << totalFlux << nl + << "Specified mass inflow : " << massIn[zonei] << nl + << "Adjustable mass outflow : " << adjustableMassOut[zonei] + << nl << endl; + } + + + if (fv::debug) + { + Info<< "Zone : " << zonei << nl + << "Total flux : " << totalFlux << nl + << "Specified mass inflow : " << massIn[zonei] << nl + << "Adjustable mass outflow : " << adjustableMassOut[zonei] + << nl + << "Correction factor : " << massCorr[zonei] << nl + << endl; + } + } + + + + // Pass2: adjust fluxes + + forAll(own, facei) + { + label zonei = zoneID[own[facei]]; // note:own and nei in same zone + + label ownType = cellTypes[own[facei]]; + label neiType = cellTypes[nei[facei]]; + + bool ownCalc = + (ownType == cellCellStencil::CALCULATED) + && (neiType == cellCellStencil::INTERPOLATED); + + bool neiCalc = + (ownType == cellCellStencil::INTERPOLATED) + && (neiType == cellCellStencil::CALCULATED); + + if (ownCalc || neiCalc) + { + // Calculate flux w.r.t. calculated cell + scalar flux = phi[facei]; + if (neiCalc) + { + flux = -flux; + } + + if (flux < 0.0) + { + phi[facei] /= Foam::sqrt(massCorr[zonei]); + } + else + { + phi[facei] *= Foam::sqrt(massCorr[zonei]); + } + } + } + + forAll(bphi, patchi) + { + const fvPatchVectorField& Up = U.boundaryField()[patchi]; + fvsPatchScalarField& phip = bphi[patchi]; + const labelUList& fc = Up.patch().faceCells(); + + label start = Up.patch().start(); + + forAll(fc, i) + { + label facei = start+i; + label celli = fc[i]; + label zonei = zoneID[celli]; // note:own and nei in same zone + label ownType = cellTypes[celli]; + label neiType = neiCellTypes[facei-mesh.nInternalFaces()]; + + bool ownCalc = + (ownType == cellCellStencil::CALCULATED) + && (neiType == cellCellStencil::INTERPOLATED); + + bool neiCalc = + (ownType == cellCellStencil::INTERPOLATED) + && (neiType == cellCellStencil::CALCULATED); + + if (ownCalc || neiCalc) + { + // Calculate flux w.r.t. calculated cell + scalar flux = phip[i]; + if (neiCalc) + { + flux = -flux; + } + + if (flux < 0.0) + { + phip[i] /= Foam::sqrt(massCorr[zonei]); + } + else + { + phip[i] *= Foam::sqrt(massCorr[zonei]); + } + } + } + } + + return sum(mag(massIn))/totalFlux < SMALL + && sum(mag(adjustableMassOut))/totalFlux < SMALL; +} + + +// ************************************************************************* // diff --git a/src/overset/oversetAdjustPhi/oversetAdjustPhi.H b/src/overset/oversetAdjustPhi/oversetAdjustPhi.H new file mode 100644 index 0000000000000000000000000000000000000000..1adfea339a60837eb00892581c255b07244ea381 --- /dev/null +++ b/src/overset/oversetAdjustPhi/oversetAdjustPhi.H @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +InNamespace + Foam + +Description + Adjust the balance of fluxes on the faces between interpolated + and calculated to obey continuity. + +SourceFiles + oversetAdjustPhi.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetAdjustPhi_H +#define oversetAdjustPhi_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +//- Adjust the balance of fluxes to obey continuity. +// Return true if no flux was adjusted. +bool oversetAdjustPhi +( + surfaceScalarField& phi, + const volVectorField& U +); + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatch.C b/src/overset/oversetPolyPatch/oversetFvPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..1be8d160cb3d00fe58aafe95f3271f6c0683ddd2 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvPatch.C @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetFvPatch.H" +#include "addToRunTimeSelectionTable.H" +#include "fvMesh.H" +#include "transform.H" +#include "cellCellStencilObject.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(oversetFvPatch, 0); + addToRunTimeSelectionTable(fvPatch, oversetFvPatch, polyPatch); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::labelField> Foam::oversetFvPatch::interfaceInternalField +( + const labelUList& internalData +) const +{ + return patchInternalField(internalData); +} + + +Foam::tmp<Foam::labelField> Foam::oversetFvPatch::internalFieldTransfer +( + const Pstream::commsTypes commsType, + const labelUList& restrictMap +) const +{ + // Store the restrictMap. This routine gets used for + // - GAMGAgglomeration : this is the use we want to intercept. + // - GAMGProcAgglomeration : to find out the cell number on the other side + // - MGridGenGAMGAgglomeration: same + if (master()) + { + restrictMap_ = restrictMap; + } + + return patchInternalField(restrictMap); +} + + +const Foam::labelListList& Foam::oversetFvPatch::stencil() const +{ + const cellCellStencilObject& overlap = Stencil::New(boundaryMesh().mesh()); + + return overlap.cellStencil(); +} + + +const Foam::mapDistribute& Foam::oversetFvPatch::cellInterpolationMap() const +{ + const cellCellStencilObject& overlap = Stencil::New(boundaryMesh().mesh()); + return overlap.cellInterpolationMap(); +} + + +const Foam::List<Foam::scalarList>& +Foam::oversetFvPatch::cellInterpolationWeights() const +{ + const cellCellStencilObject& overlap = Stencil::New(boundaryMesh().mesh()); + return overlap.cellInterpolationWeights(); +} + + +const Foam::scalarField& Foam::oversetFvPatch::normalisation() const +{ + return boundaryMesh().mesh().V().field(); +} + + +const Foam::labelList& Foam::oversetFvPatch::interpolationCells() const +{ + const cellCellStencilObject& overlap = Stencil::New(boundaryMesh().mesh()); + return overlap.interpolationCells(); +} + + +const Foam::scalarList& Foam::oversetFvPatch::cellInterpolationWeight() const +{ + const cellCellStencilObject& overlap = Stencil::New(boundaryMesh().mesh()); + return overlap.cellInterpolationWeight(); +} + + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatch.H b/src/overset/oversetPolyPatch/oversetFvPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..eaf4e4289a4fc68e51ae3b18fc43edfaf714b9e4 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvPatch.H @@ -0,0 +1,169 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::oversetFvPatch + +Description + Patch for indicating interpolated boundaries (in overset meshes). + +SourceFiles + oversetFvPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetFvPatch_H +#define oversetFvPatch_H + +#include "fvPatch.H" +#include "oversetPolyPatch.H" +#include "fvBoundaryMesh.H" +#include "lduInterface.H" +#include "oversetLduInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class oversetFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class oversetFvPatch +: + public lduInterface, + public oversetLduInterface, + public fvPatch +{ + // Private data + + const oversetPolyPatch& oversetPolyPatch_; + + //- Temporary copy of the fine level restrict map. Cleared upon + // calculating stencils below + mutable labelList restrictMap_; + + +public: + + //- Runtime type information + TypeName(oversetPolyPatch::typeName_()); + + + // Constructors + + //- Construct from polyPatch + oversetFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm) + : + fvPatch(patch, bm), + oversetPolyPatch_(refCast<const oversetPolyPatch>(patch)) + {} + + + // Member functions + + // Access + + //- Return local reference cast into the overset patch + const oversetPolyPatch& oversetPatch() const + { + return oversetPolyPatch_; + } + + + // Access + + //- Return faceCell addressing + virtual const labelUList& faceCells() const + { + return oversetPolyPatch_.faceCells(); + } + + + // Interface transfer functions + + //- Return the values of the given internal data adjacent to + // the interface as a field + virtual tmp<labelField> interfaceInternalField + ( + const labelUList& internalData + ) const; + + //- Return neighbour field + virtual tmp<labelField> internalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& internalData + ) const; + + + //- Overset interface functions + + //- Name of interface (for debugging) + virtual const word& name() const + { + return oversetPolyPatch_.name(); + } + + //- Am I the master interface + virtual bool master() const + { + return oversetPolyPatch_.master(); + } + + //- GAMG restriction (fine-to-coarse) + virtual const labelList& restrictMap() const + { + return restrictMap_; + } + + //- Donor stencil + virtual const labelListList& stencil() const; + + //- Map for obtaining data in stencil order + virtual const mapDistribute& cellInterpolationMap() const; + + //- Weights in stencil order + virtual const List<scalarList>& cellInterpolationWeights() const; + + //- Normalisation of matrix; for explicit contributions + virtual const scalarField& normalisation() const; + + //- Acceptor cells + virtual const labelList& interpolationCells() const; + + //- Underrelaxation for acceptor cells + virtual const scalarList& cellInterpolationWeight() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..0d38b83514c41bf607102da73ec12ee8a52374bb --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -0,0 +1,354 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "volFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::oversetFvPatchField<Type>::oversetFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + LduInterfaceField<Type>(refCast<const oversetFvPatch>(p)), + zeroGradientFvPatchField<Type>(p, iF), + oversetPatch_(refCast<const oversetFvPatch>(p)) +{} + + +template<class Type> +Foam::oversetFvPatchField<Type>::oversetFvPatchField +( + const oversetFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + LduInterfaceField<Type>(refCast<const oversetFvPatch>(p)), + zeroGradientFvPatchField<Type>(ptf, p, iF, mapper), + oversetPatch_(refCast<const oversetFvPatch>(p)) +{ + if (!isA<oversetFvPatch>(this->patch())) + { + FatalErrorInFunction + << " patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << exit(FatalIOError); + } +} + + +template<class Type> +Foam::oversetFvPatchField<Type>::oversetFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + LduInterfaceField<Type>(refCast<const oversetFvPatch>(p)), + zeroGradientFvPatchField<Type>(p, iF, dict), + oversetPatch_(refCast<const oversetFvPatch>(p)) +{ + if (!isA<oversetFvPatch>(p)) + { + FatalIOErrorIn + ( + "oversetFvPatchField<Type>::oversetFvPatchField" + "(" + "const fvPatch&, " + "const DimensionedField<Type, volMesh>&, " + "const dictionary&" + ")", + dict + ) << " patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << exit(FatalIOError); + } + + if (!dict.found("value") && this->coupled()) + { + this->evaluate(Pstream::commsTypes::blocking); + } +} + + +template<class Type> +Foam::oversetFvPatchField<Type>::oversetFvPatchField +( + const oversetFvPatchField<Type>& ptf +) +: + LduInterfaceField<Type>(ptf.oversetPatch_), + zeroGradientFvPatchField<Type>(ptf), + oversetPatch_(ptf.oversetPatch_) +{} + + +template<class Type> +Foam::oversetFvPatchField<Type>::oversetFvPatchField +( + const oversetFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + LduInterfaceField<Type>(ptf.oversetPatch_), + zeroGradientFvPatchField<Type>(ptf, iF), + oversetPatch_(ptf.oversetPatch_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +template<class Type> +void Foam::oversetFvPatchField<Type>::initEvaluate +( + const Pstream::commsTypes commsType +) +{ + if (oversetPatch_.master()) + { + // Trigger interpolation + const fvMesh& mesh = this->internalField().mesh(); + const dictionary& fvSchemes = mesh.schemesDict(); + const word& fldName = this->internalField().name(); + + if (&mesh.lduAddr() != &mesh.fvMesh::lduAddr()) + { + // Running extended addressing. Interpolate always. + if (debug) + { + Info<< "Interpolating solved-for field " << fldName << endl; + } + + // Interpolate without bc update (since would trigger infinite + // recursion back to oversetFvPatchField<Type>::evaluate) + // The only problem is bcs that use the new cell values + // (e.g. zeroGradient, processor). These need to appear -after- + // the 'overset' bc. + mesh.interpolate + ( + const_cast<Field<Type>&> + ( + this->primitiveField() + ) + ); + } + else if + ( + !fvSchemes.found("oversetInterpolation") + || !fvSchemes.found("oversetInterpolationRequired") + ) + { + IOWarningInFunction(fvSchemes) + << "Missing required dictionary entries" + << " 'oversetInterpolation' and 'oversetInterpolationRequired'" + << ". Skipping overset interpolation for field " + << fldName << endl; + } + else + { + const dictionary& intDict = fvSchemes.subDict + ( + "oversetInterpolationRequired" + ); + if (intDict.found(fldName)) + { + if (debug) + { + Info<< "Interpolating field " << fldName << endl; + } + + // Interpolate without bc update (since would trigger infinite + // recursion back to oversetFvPatchField<Type>::evaluate) + // The only problem is bcs that use the new cell values + // (e.g. zeroGradient, processor). These need to appear -after- + // the 'overset' bc. + mesh.interpolate + ( + const_cast<Field<Type>&> + ( + this->primitiveField() + ) + ); + } + else if (debug) + { + Info<< "Skipping overset interpolation for field " + << fldName << endl; + } + } + } +} + + +template<class Type> +void Foam::oversetFvPatchField<Type>::evaluate(const Pstream::commsTypes) +{ + if (!this->updated()) + { + this->updateCoeffs(); + } + + zeroGradientFvPatchField<Type>::evaluate(); +} + + +template<class Type> +void Foam::oversetFvPatchField<Type>::initInterfaceMatrixUpdate +( + scalarField& result, + const bool add, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType +) const +{} + + +template<class Type> +void Foam::oversetFvPatchField<Type>::updateInterfaceMatrix +( + scalarField& result, + const bool add, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes +) const +{ + // Add remote values + if (oversetPatch_.master()) + { + const fvMesh& mesh = this->patch().boundaryMesh().mesh(); + + // Try to find out if the solve routine comes from the mesh + // TBD. This should be cleaner. + if (&mesh.lduAddr() == &mesh.fvMesh::lduAddr()) + { + //Pout<< "** not running extended addressing..." << endl; + return; + } + + const labelListList& stencil = oversetPatch_.stencil(); + + if (stencil.size() != psiInternal.size()) + { + FatalErrorInFunction << "psiInternal:" << psiInternal.size() + << " stencil:" << stencil.size() << exit(FatalError); + } + + const mapDistribute& map = oversetPatch_.cellInterpolationMap(); + const List<scalarList>& wghts = + oversetPatch_.cellInterpolationWeights(); + const labelList& cellIDs = oversetPatch_.interpolationCells(); + const scalarList& factor = oversetPatch_.cellInterpolationWeight(); + const scalarField& normalisation = oversetPatch_.normalisation(); + + + // Since we're inside initEvaluate/evaluate there might be processor + // comms underway. Change the tag we use. + scalarField work(psiInternal); + map.mapDistributeBase::distribute(work, UPstream::msgType()+1); + + forAll(cellIDs, i) + { + label celli = cellIDs[i]; + + const scalarList& w = wghts[celli]; + const labelList& nbrs = stencil[celli]; + scalar f = factor[celli]; + const scalar norm = normalisation[celli]; + + // Add the non-local matrix contribution to psi. Note that the + // matrix coefficients are -weights + + if (add) + { + f = -1.0*f; + } + + forAll(nbrs, nbrI) + { + label slotI = nbrs[nbrI]; + if (slotI >= psiInternal.size()) + { + result[celli] += f*norm*w[nbrI]*work[slotI]; + } + } + } + } +} + + +template<class Type> +void Foam::oversetFvPatchField<Type>::initInterfaceMatrixUpdate +( + Field<Type>&, + const bool add, + const Field<Type>&, + const scalarField&, + const Pstream::commsTypes commsType +) const +{ + NotImplemented; +} + + +template<class Type> +void Foam::oversetFvPatchField<Type>::updateInterfaceMatrix +( + Field<Type>& result, + const bool add, + const Field<Type>& psiInternal, + const scalarField&, + const Pstream::commsTypes +) const +{ + NotImplemented; +} + + +template<class Type> +void Foam::oversetFvPatchField<Type>::write(Ostream& os) const +{ + zeroGradientFvPatchField<Type>::write(os); + // Make sure to write the value for ease of postprocessing. + this->writeEntry("value", os); +} + + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.H b/src/overset/oversetPolyPatch/oversetFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..3a337996ee6be82c5d9ccd5b38203f0211c70d1e --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.H @@ -0,0 +1,217 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::oversetFvPatchField + +Group + grpCoupledBoundaryConditions + +Description + +SeeAlso + +SourceFiles + oversetFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetFvPatchField_H +#define oversetFvPatchField_H + +#include "oversetFvPatch.H" +#include "zeroGradientFvPatchField.H" +#include "LduInterfaceField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class oversetFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class oversetFvPatchField +: + public LduInterfaceField<Type>, + public zeroGradientFvPatchField<Type> +{ + // Private data + + //- Local reference cast into the overset patch + const oversetFvPatch& oversetPatch_; + + //- Master patch ID + mutable label masterPatchID_; + + +public: + + //- Runtime type information + TypeName(oversetFvPatch::typeName_()); + + + // Constructors + + //- Construct from patch and internal field + oversetFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + oversetFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given oversetFvPatchField onto a new patch + oversetFvPatchField + ( + const oversetFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + oversetFvPatchField(const oversetFvPatchField<Type>&); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new oversetFvPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + oversetFvPatchField + ( + const oversetFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new oversetFvPatchField<Type>(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return local reference cast into the cyclic AMI patch + const oversetFvPatch& oversetPatch() const + { + return oversetPatch_; + } + + + // Evaluation functions + + //- Initialise the evaluation of the patch field + virtual void initEvaluate(const Pstream::commsTypes commsType); + + //- Evaluate the patch field + virtual void evaluate(const Pstream::commsTypes commsType); + + //- Initialise neighbour matrix update + virtual void initInterfaceMatrixUpdate + ( + scalarField&, + const bool add, + const scalarField&, + const scalarField&, + const direction, + const Pstream::commsTypes commsType + ) const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + scalarField& result, + const bool add, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; + + //- Initialise neighbour matrix update + virtual void initInterfaceMatrixUpdate + ( + Field<Type>&, + const bool add, + const Field<Type>&, + const scalarField&, + const Pstream::commsTypes commsType + ) const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + Field<Type>&, + const bool add, + const Field<Type>&, + const scalarField&, + const Pstream::commsTypes commsType + ) const; + + + // I-O + + //- Write + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "oversetFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatchFields.C b/src/overset/oversetPolyPatch/oversetFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..27f04e81b9817e3f3df3672f2a04deb03aec712c --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(overset); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvPatchFields.H b/src/overset/oversetPolyPatch/oversetFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..7c1dde9fbb4c7e97ceba9946ee6786eede9ecbb2 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetFvPatchFields_H +#define oversetFvPatchFields_H + +#include "oversetFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(overset); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetFvsPatchFields.C b/src/overset/oversetPolyPatch/oversetFvsPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..4c58c31519339f190c430df59c9824a37f056001 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetFvsPatchFields.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetFvPatchField.H" +#include "calculatedFvsPatchFields.H" +#include "fvsPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +addNamedToRunTimeSelectionTable +( + fvsPatchScalarField, + calculatedFvsPatchScalarField, + patch, + overset +); +addNamedToRunTimeSelectionTable +( + fvsPatchVectorField, + calculatedFvsPatchVectorField, + patch, + overset +); +addNamedToRunTimeSelectionTable +( + fvsPatchSphericalTensorField, + calculatedFvsPatchSphericalTensorField, + patch, + overset +); +addNamedToRunTimeSelectionTable +( + fvsPatchSymmTensorField, + calculatedFvsPatchSymmTensorField, + patch, + overset +); +addNamedToRunTimeSelectionTable +( + fvsPatchTensorField, + calculatedFvsPatchTensorField, + patch, + overset +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetGAMGInterface.C b/src/overset/oversetPolyPatch/oversetGAMGInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..e4155338355d434b00f7517e9f023ae57436d132 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetGAMGInterface.C @@ -0,0 +1,264 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetGAMGInterface.H" +#include "addToRunTimeSelectionTable.H" +#include "Map.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(oversetGAMGInterface, 0); + addToRunTimeSelectionTable + ( + GAMGInterface, + oversetGAMGInterface, + lduInterface + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::oversetGAMGInterface::oversetGAMGInterface +( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex, + const label coarseComm +) +: + GAMGInterface(index, coarseInterfaces), + fineOversetInterface_ + ( + refCast<const oversetLduInterface>(fineInterface) + ) +{ + //Pout<< "Constructing oversetGAMGInterface index:" << index + // << " from:" << fineOversetInterface_.name() + // << " size:" << localRestrictAddressing.size() + // << endl; + + // From coarse face to coarse cell + DynamicList<label> dynFaceCells(localRestrictAddressing.size()); + // From fine face to coarse face + DynamicList<label> dynFaceRestrictAddressing(dynFaceCells.size()); + + + // From coarse cell to coarse face + Map<label> cellToCoarseFace(dynFaceCells.size()); + + // Construct face agglomeration from cell agglomeration + forAll(localRestrictAddressing, ffi) + { + // Get coarse cell + label coarseCelli = localRestrictAddressing[ffi]; + + // Do we have coarse face for it? + Map<label>::iterator iter = cellToCoarseFace.find(coarseCelli); + if (iter == cellToCoarseFace.end()) + { + label coarseFacei = dynFaceCells.size(); + cellToCoarseFace.insert(coarseCelli, coarseFacei); + dynFaceCells.append(coarseCelli); + dynFaceRestrictAddressing.append(coarseFacei); + } + else + { + dynFaceRestrictAddressing.append(iter()); + } + } + + faceCells_.transfer(dynFaceCells); + faceRestrictAddressing_.transfer(dynFaceRestrictAddressing); + + //Pout<< "** Constructed interface:" << name() + // << " of size:" << size() << endl; + + + // Determine this level's stencil from the fine stencil + if (master()) + { + const mapDistribute& fineMap = + fineOversetInterface_.cellInterpolationMap(); + const List<scalarList>& fineWghts = + fineOversetInterface_.cellInterpolationWeights(); + const labelListList& fineStencil = fineOversetInterface_.stencil(); + const labelList& fineCellIDs = + fineOversetInterface_.interpolationCells(); + const scalarList& fineFactor = + fineOversetInterface_.cellInterpolationWeight(); + const scalarField& fineNorm = fineOversetInterface_.normalisation(); + const labelList& restrictMap = fineOversetInterface_.restrictMap(); + + + if (localRestrictAddressing.size() && restrictMap.empty()) + { + FatalErrorInFunction + << "The restrict addressing has not been saved on interface " + << this->name() + << ". This gets stored when running internalFieldTransfer" + << exit(FatalError); + } + + + // 'Interpolate' the restrict map so locally we know what the remote + // cells are going to be. + + label nCoarseCells = max(restrictMap)+1; + globalIndex globalNumbering(nCoarseCells); + + labelList globalCoarseIDs(restrictMap.size()); + forAll(restrictMap, fineCelli) + { + globalCoarseIDs[fineCelli] = + globalNumbering.toGlobal(restrictMap[fineCelli]); + } + fineMap.distribute(globalCoarseIDs); + + //Pout<< this->name() + // << " index:" << index + // << " size:" << this->size() + // << " restrictMap:" << restrictMap.size() + // << " fineNumInterpolate:" << fineCellIDs.size() + // << " nCoarseCells:" << nCoarseCells + // << endl; + + + + // Accumulate the coarse level stencil + + // Number of fine cells contributing to the coarse cell + labelList nFineCells(nCoarseCells, 0); + + stencil_.setSize(nCoarseCells); + cellInterpolationWeights_.setSize(nCoarseCells); + cellInterpolationWeight_.setSize(nCoarseCells, 0.0); + normalisation_.setSize(nCoarseCells, 0.0); + + forAll(fineCellIDs, i) + { + label fineCelli = fineCellIDs[i]; + label coarseCelli = restrictMap[fineCelli]; + + const scalarList& w = fineWghts[fineCelli]; + const labelList& nbrs = fineStencil[fineCelli]; + + // Accumulate stencil + + labelList& coarseStencil = stencil_[coarseCelli]; + scalarList& coarseWghts = cellInterpolationWeights_[coarseCelli]; + + label sz = coarseStencil.size(); + coarseStencil.setSize(sz+nbrs.size()); + coarseWghts.setSize(coarseStencil.size()); + + forAll(nbrs, i) + { + coarseStencil[sz] = globalCoarseIDs[nbrs[i]]; + coarseWghts[sz] = w[i]; + sz++; + } + + // Accumulate weight + cellInterpolationWeight_[coarseCelli] += fineFactor[fineCelli]; + normalisation_[coarseCelli] += fineNorm[fineCelli]; + nFineCells[coarseCelli]++; + } + + // Normalise weight (0 .. 1). Take average? Volume average? Min? Max? + forAll(nFineCells, coarseCelli) + { + label nAvg = nFineCells[coarseCelli]; + if (nAvg > 0) + { + cellInterpolationWeight_[coarseCelli] /= nAvg; + } + } + + + // Work the stencil back from global cells into a mapDistribute + // + slots + List<Map<label>> compactMap; + mapPtr_.reset(new mapDistribute(globalNumbering, stencil_, compactMap)); + + + // Determine the interpolationCells + label nInterpolate = 0; + forAll(stencil_, coarseCelli) + { + if (stencil_[coarseCelli].size()) + { + nInterpolate++; + } + } + + //Pout<< this->name() << " nInterpolate:" << nInterpolate << endl; + + interpolationCells_.setSize(nInterpolate); + nInterpolate = 0; + forAll(stencil_, coarseCelli) + { + if (stencil_[coarseCelli].size()) + { + interpolationCells_[nInterpolate++] = coarseCelli; + } + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::oversetGAMGInterface::~oversetGAMGInterface() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::labelField> Foam::oversetGAMGInterface::internalFieldTransfer +( + const Pstream::commsTypes, + const labelUList& restrictMap +) const +{ + // Store the restrictMap. This routine gets used for + // - GAMGAgglomeration : this is the use we want to intercept. + // - GAMGProcAgglomeration : to find out the cell number on the other side + // - MGridGenGAMGAgglomeration: same + if (master()) + { + restrictMap_ = restrictMap; + } + + return tmp<labelField>(new labelField(restrictMap, faceCells())); +} + + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetGAMGInterface.H b/src/overset/oversetPolyPatch/oversetGAMGInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..3f9105b612ea04e53d4a575f5409a8bea0c7d9f8 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetGAMGInterface.H @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::oversetGAMGInterface + +Description + GAMG agglomerated overset interface. + +SourceFiles + oversetGAMGInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetGAMGInterface_H +#define oversetGAMGInterface_H + +#include "GAMGInterface.H" +#include "oversetLduInterface.H" +#include "mapDistribute.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class oversetGAMGInterface Declaration +\*---------------------------------------------------------------------------*/ + +class oversetGAMGInterface +: + public GAMGInterface, + virtual public oversetLduInterface +{ + // Private data + + //- Reference for the oversetLduInterface from which this is + // agglomerated + const oversetLduInterface& fineOversetInterface_; + + //- Temporary copy of the fine level restrict map. Cleared upon + // calculating stencils below + mutable labelList restrictMap_; + + labelListList stencil_; + + autoPtr<mapDistribute> mapPtr_; + + List<scalarList> cellInterpolationWeights_; + + scalarField normalisation_; + + labelList interpolationCells_; + + scalarList cellInterpolationWeight_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + oversetGAMGInterface(const oversetGAMGInterface&); + + //- Disallow default bitwise assignment + void operator=(const oversetGAMGInterface&); + + +public: + + //- Runtime type information + TypeName("overset"); + + + // Constructors + + //- Construct from fine level interface, + // local and neighbour restrict addressing + oversetGAMGInterface + ( + const label index, + const lduInterfacePtrsList& coarseInterfaces, + const lduInterface& fineInterface, + const labelField& localRestrictAddressing, + const labelField& neighbourRestrictAddressing, + const label fineLevelIndex, + const label coarseComm + ); + + + //- Destructor + virtual ~oversetGAMGInterface(); + + + // Member Functions + + // Interface transfer functions + + //- Transfer and return internal field adjacent to the interface + virtual tmp<labelField> internalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF + ) const; + + + //- Overset interface functions + + //- Name of lduInterface + virtual const word& name() const + { + return fineOversetInterface_.name(); + } + + //- Am I the master interface + virtual bool master() const + { + return fineOversetInterface_.master(); + } + + //- GAMG restriction (fine-to-coarse) + virtual const labelList& restrictMap() const + { + return restrictMap_; + } + + //- Donor stencil + virtual const labelListList& stencil() const + { + return stencil_; + } + + //- Map for obtaining data in stencil order + virtual const mapDistribute& cellInterpolationMap() const + { + return mapPtr_(); + } + + //- Weights in stencil order + virtual const List<scalarList>& cellInterpolationWeights() const + { + return cellInterpolationWeights_; + } + + //- Normalisation ot matrix; for explicit contributions + virtual const scalarField& normalisation() const + { + return normalisation_; + } + + //- Acceptor cells + virtual const labelList& interpolationCells() const + { + return interpolationCells_; + } + + //- Underrelaxation for acceptor cells + virtual const scalarList& cellInterpolationWeight() const + { + return cellInterpolationWeight_; + } + + + // I/O + + //- Write to stream + virtual void write(Ostream&) const + { + //TBD. + NotImplemented; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetGAMGInterfaceField.C b/src/overset/oversetPolyPatch/oversetGAMGInterfaceField.C new file mode 100644 index 0000000000000000000000000000000000000000..b3c33752098ade9b5ad3a56b03375ceb28387894 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetGAMGInterfaceField.C @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetGAMGInterfaceField.H" +#include "addToRunTimeSelectionTable.H" +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(oversetGAMGInterfaceField, 0); + addToRunTimeSelectionTable + ( + GAMGInterfaceField, + oversetGAMGInterfaceField, + lduInterfaceField + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::oversetGAMGInterfaceField::oversetGAMGInterfaceField +( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterface +) +: + GAMGInterfaceField(GAMGCp, fineInterface), + oversetInterface_(refCast<const oversetGAMGInterface>(GAMGCp)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::oversetGAMGInterfaceField::~oversetGAMGInterfaceField() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::oversetGAMGInterfaceField::updateInterfaceMatrix +( + scalarField& result, + const bool add, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType +) const +{ + //Pout<< "oversetGAMGInterfaceField::updateInterfaceMatrix: at:" + // << oversetInterface_.name() + // << " nCells:" << result.size() << endl; + // + // Add remote values + if (oversetInterface_.master()) + { + const labelListList& stencil = oversetInterface_.stencil(); + + if (stencil.size() != psiInternal.size()) + { + FatalErrorInFunction << "psiInternal:" << psiInternal.size() + << " stencil:" << stencil.size() << exit(FatalError); + } + + const mapDistribute& map = oversetInterface_.cellInterpolationMap(); + const List<scalarList>& wghts = + oversetInterface_.cellInterpolationWeights(); + const labelList& cellIDs = oversetInterface_.interpolationCells(); + const scalarList& factor = oversetInterface_.cellInterpolationWeight(); + const scalarField& normalisation = oversetInterface_.normalisation(); + + scalarField work(psiInternal); + map.mapDistributeBase::distribute(work, UPstream::msgType()+1); + + forAll(cellIDs, i) + { + label celli = cellIDs[i]; + + const scalarList& w = wghts[celli]; + const labelList& nbrs = stencil[celli]; + const scalar f = factor[celli]; + + bool hasRemote = false; + forAll(nbrs, nbrI) + { + label slotI = nbrs[nbrI]; + if (slotI >= psiInternal.size()) + { + hasRemote = true; + break; + } + } + + if (hasRemote) + { + //Pout<< "oversetGAMGInterfaceField : Interpolating " << celli + // << " from remote values (if any):" << endl; + scalar s(0.0); + forAll(nbrs, nbrI) + { + label slotI = nbrs[nbrI]; + if (slotI >= psiInternal.size()) + { + //Pout<< " remote value " << work[slotI] + // << " from slot " << slotI << " with w:" << w[nbrI] + // << endl; + s += w[nbrI]*work[slotI]; + } + } + //Pout<< "oversetGAMGInterfaceField : Interpolated value:" + // << s << endl; + //scalar oldPsi = result[celli]; + if (add) + { + s = -1.0*s; + } + + result[celli] += normalisation[celli]*f*s; + //Pout<< "oversetGAMGInterfaceField : result was:" << oldPsi + // << " now:" << result[celli] << endl; + } + } + } +} + + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetGAMGInterfaceField.H b/src/overset/oversetPolyPatch/oversetGAMGInterfaceField.H new file mode 100644 index 0000000000000000000000000000000000000000..3cd44fa3dba456cfa1505ef2f15d73b924a19020 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetGAMGInterfaceField.H @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::oversetGAMGInterfaceField + +Description + GAMG agglomerated processor interface field. + +SourceFiles + processorGAMGInterfaceField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetGAMGInterfaceField_H +#define oversetGAMGInterfaceField_H + +#include "GAMGInterfaceField.H" +#include "oversetGAMGInterface.H" +#include "processorLduInterfaceField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class oversetGAMGInterfaceField Declaration +\*---------------------------------------------------------------------------*/ + +class oversetGAMGInterfaceField +: + public GAMGInterfaceField +{ + // Private data + + //- Local reference cast into the interface + const oversetGAMGInterface& oversetInterface_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + oversetGAMGInterfaceField(const oversetGAMGInterfaceField&); + + //- Disallow default bitwise assignment + void operator=(const oversetGAMGInterfaceField&); + + +public: + + //- Runtime type information + TypeName("overset"); + + + // Constructors + + //- Construct from GAMG interface and fine level interface field + oversetGAMGInterfaceField + ( + const GAMGInterface& GAMGCp, + const lduInterfaceField& fineInterface + ); + + + //- Destructor + virtual ~oversetGAMGInterfaceField(); + + + // Member Functions + + // Access + + //- Return size + label size() const + { + return oversetInterface_.size(); + } + + + // Interface matrix update + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + scalarField& result, + const bool add, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetLduInterface.C b/src/overset/oversetPolyPatch/oversetLduInterface.C new file mode 100644 index 0000000000000000000000000000000000000000..ec04070196a1ac583f9ab38daf26206a49b63c61 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetLduInterface.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetLduInterface.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(oversetLduInterface, 0); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::oversetLduInterface::~oversetLduInterface() +{} + + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetLduInterface.H b/src/overset/oversetPolyPatch/oversetLduInterface.H new file mode 100644 index 0000000000000000000000000000000000000000..537def21642d0195763ec0a05b55a37e4b5be3b4 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetLduInterface.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::oversetLduInterface + +Description + An abstract base class for overset coupled interfaces + +SourceFiles + oversetLduInterface.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetLduInterface_H +#define oversetLduInterface_H + +#include "mapDistribute.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class oversetLduInterface Declaration +\*---------------------------------------------------------------------------*/ + +class oversetLduInterface +{ + +public: + + //- Runtime type information + TypeName("oversetLduInterface"); + + + // Constructors + + //- Construct null + oversetLduInterface() + {} + + + //- Destructor + virtual ~oversetLduInterface(); + + + // Member Functions + + // Access + + //- Name of interface (for debugging) + virtual const word& name() const = 0; + + //- Am I the master interface + virtual bool master() const = 0; + + //- GAMG restriction (fine-to-coarse) + virtual const labelList& restrictMap() const = 0; + + //- Donor stencil + virtual const labelListList& stencil() const = 0; + + //- Map for obtaining data in stencil order + virtual const mapDistribute& cellInterpolationMap() const = 0; + + //- Weights in stencil order + virtual const List<scalarList>& + cellInterpolationWeights() const = 0; + + //- Normalisation of matrix; for explicit contributions + virtual const scalarField& normalisation() const = 0; + + //- Acceptor cells + virtual const labelList& interpolationCells() const = 0; + + //- Underrelaxation for acceptor cells + virtual const scalarList& cellInterpolationWeight() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetPointPatch.C b/src/overset/oversetPolyPatch/oversetPointPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..15f4a37e0c7124afe615dc743ee40c64e81e57a9 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetPointPatch.C @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "facePointPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +addNamedToRunTimeSelectionTable +( + facePointPatch, + facePointPatch, + polyPatch, + overset +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetPointPatchFields.C b/src/overset/oversetPolyPatch/oversetPointPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..c8c0168df34b15f3f4336fce34572b90d8c0cbae --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetPointPatchFields.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "slipPointPatchFields.H" +#include "pointPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +addNamedToRunTimeSelectionTable +( + pointPatchScalarField, + slipPointPatchScalarField, + pointPatch, + overset +); +addNamedToRunTimeSelectionTable +( + pointPatchVectorField, + slipPointPatchVectorField, + pointPatch, + overset +); +addNamedToRunTimeSelectionTable +( + pointPatchSphericalTensorField, + slipPointPatchSphericalTensorField, + pointPatch, + overset +); +addNamedToRunTimeSelectionTable +( + pointPatchSymmTensorField, + slipPointPatchSymmTensorField, + pointPatch, + overset +); +addNamedToRunTimeSelectionTable +( + pointPatchTensorField, + slipPointPatchTensorField, + pointPatch, + overset +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetPolyPatch.C b/src/overset/oversetPolyPatch/oversetPolyPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..ddce16ae7c6da92d6376496a64b22beab877f919 --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetPolyPatch.C @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "oversetPolyPatch.H" +#include "addToRunTimeSelectionTable.H" +#include "polyBoundaryMesh.H" +#include "processorPolyPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(oversetPolyPatch, 0); + + addToRunTimeSelectionTable(polyPatch, oversetPolyPatch, word); + addToRunTimeSelectionTable(polyPatch, oversetPolyPatch, dictionary); +} + +// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // + +Foam::oversetPolyPatch::oversetPolyPatch +( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& patchType +) +: + polyPatch(name, size, start, index, bm, patchType), + masterPatchID_(-1) +{ + // 'overset' is not constraint type so add to group explicitly + if (findIndex(inGroups(), typeName) == -1) + { + inGroups().append(typeName); + } +} + + +Foam::oversetPolyPatch::oversetPolyPatch +( + const word& name, + const dictionary& dict, + const label index, + const polyBoundaryMesh& bm, + const word& patchType +) +: + polyPatch(name, dict, index, bm, patchType), + masterPatchID_(-1) +{ + // 'overset' is not constraint type so add to group explicitly + if (findIndex(inGroups(), typeName) == -1) + { + inGroups().append(typeName); + } +} + + +Foam::oversetPolyPatch::oversetPolyPatch +( + const oversetPolyPatch& pp, + const polyBoundaryMesh& bm +) +: + polyPatch(pp, bm), + masterPatchID_(-1) +{} + + +Foam::oversetPolyPatch::oversetPolyPatch +( + const oversetPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart +) +: + polyPatch(pp, bm, index, newSize, newStart), + masterPatchID_(-1) +{} + + +Foam::oversetPolyPatch::oversetPolyPatch +( + const oversetPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart +) +: + polyPatch(pp, bm, index, mapAddressing, newStart), + masterPatchID_(-1) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::oversetPolyPatch::~oversetPolyPatch() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::oversetPolyPatch::master() const +{ + if (masterPatchID_ == -1) + { + // Find lowest numbered overset patch + const polyBoundaryMesh& pbm = boundaryMesh(); + + forAll(pbm, patchi) + { + if (isA<oversetPolyPatch>(pbm[patchi])) + { + masterPatchID_ = patchi; + break; + } + } + + if (masterPatchID_ != -1 && masterPatchID_ > 0) + { + WarningInFunction<< "The master overset patch is not the" + << " first patch. Generally the first patch should be an" + << " overset patch to guarantee consistent operation." << endl; + } + } + + return index() == masterPatchID_; +} + + +// ************************************************************************* // diff --git a/src/overset/oversetPolyPatch/oversetPolyPatch.H b/src/overset/oversetPolyPatch/oversetPolyPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..52eba954f2d6cc21af5e86be9243d9e4629c78dc --- /dev/null +++ b/src/overset/oversetPolyPatch/oversetPolyPatch.H @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::oversetPolyPatch + +Description + Patch for indicating interpolated boundaries (in overset meshes). + +SourceFiles + oversetPolyPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oversetPolyPatch_H +#define oversetPolyPatch_H + +#include "polyPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class polyMesh; + +/*---------------------------------------------------------------------------*\ + Class oversetPolyPatch Declaration +\*---------------------------------------------------------------------------*/ + +class oversetPolyPatch +: + public polyPatch +{ + // Private data + + //- Master patch ID + mutable label masterPatchID_; + + +public: + + //- Runtime type information + TypeName("overset"); + + + // Constructors + + //- Construct from components + oversetPolyPatch + ( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& patchType + ); + + //- Construct from dictionary + oversetPolyPatch + ( + const word& name, + const dictionary& dict, + const label index, + const polyBoundaryMesh& bm, + const word& patchType + ); + + + //- Construct as copy, resetting the boundary mesh + oversetPolyPatch + ( + const oversetPolyPatch& pp, + const polyBoundaryMesh& bm + ); + + //- Construct given the original patch and resetting the + // face list and boundary mesh information + oversetPolyPatch + ( + const oversetPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart + ); + + //- Construct given the original patch and a map + oversetPolyPatch + ( + const oversetPolyPatch& pp, + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart + ); + + //- Construct and return a clone, resetting the boundary mesh + virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const + { + return autoPtr<polyPatch>(new oversetPolyPatch(*this, bm)); + } + + //- Construct and return a clone, resetting the face list + // and boundary mesh + virtual autoPtr<polyPatch> clone + ( + const polyBoundaryMesh& bm, + const label index, + const label newSize, + const label newStart + ) const + { + return autoPtr<polyPatch> + ( + new oversetPolyPatch(*this, bm, index, newSize, newStart) + ); + } + + //- Construct and return a clone, resetting the face list + // and boundary mesh + virtual autoPtr<polyPatch> clone + ( + const polyBoundaryMesh& bm, + const label index, + const labelUList& mapAddressing, + const label newStart + ) const + { + return autoPtr<polyPatch> + ( + new oversetPolyPatch + ( + *this, + bm, + index, + mapAddressing, + newStart + ) + ); + } + + + //- Destructor + virtual ~oversetPolyPatch(); + + + // Member functions + + //- Am I master patch? The master is responsible for doing all + // interpolation. + bool master() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/regionsToCell/findRefCells.C b/src/overset/regionsToCell/findRefCells.C new file mode 100644 index 0000000000000000000000000000000000000000..289bb1959b535381f6d63056e027660dcadb46d6 --- /dev/null +++ b/src/overset/regionsToCell/findRefCells.C @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "findRefCell.H" +#include "regionSplit.H" + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +void Foam::setRefCells +( + const volScalarField& field, + const volScalarField& fieldRef, + const dictionary& dict, + boolList& regionNeedReference, + labelList& regionRefCells, + scalarField& regionRefValues, + const bool forceReference +) +{ + const regionSplit& regions = regionSplit::New(field.mesh()); + + regionNeedReference.setSize(regions.nRegions(), true); + regionRefCells.setSize(regions.nRegions(), -1); + regionRefValues.setSize(regions.nRegions(), 0); + + if (!forceReference) + { + const volScalarField::GeometricBoundaryField& bfld = + fieldRef.boundaryField(); + + forAll(bfld, patchI) + { + if (bfld[patchI].fixesValue()) + { + // Unmark all regions + + const labelUList& fc = bfld[patchI].patch().patch().faceCells(); + + forAll(fc, faceI) + { + regionNeedReference[regions[fc[faceI]]] = false; + } + } + } + + Pstream::listCombineGather(regionNeedReference, orEqOp<bool>()); + Pstream::listCombineScatter(regionNeedReference); + } + + + label nRefs = 0; + forAll(regionNeedReference, regionI) + { + if (regionNeedReference[regionI]) + { + nRefs++; + } + } + + if (nRefs == 0) + { + return; + } + + // Get the reference cells for all the regions + + word refCellName = field.name() + "RefCells"; + word refPointName = field.name() + "RefPoints"; + word refValueName = field.name() + "RefValues"; + + + // (per region!) does region have reference cell? + labelList hasRef(regionNeedReference.size(), 0); + + + const labelList refValues(dict.lookup(refValueName)); + + + if (dict.found(refCellName)) + { + // Have specified reference cells (on master!) + + if (Pstream::master()) + { + labelList refCells(dict.lookup(refCellName)); + + if (refCells.size() != regionNeedReference.size()) + { + FatalIOErrorIn + ( + "setRefCell\n" + "(\n" + " const volScalarField&,\n" + " const volScalarField&,\n" + " const dictionary&,\n" + " labelList&,\n" + " scalarField&,\n" + " const bool\n" + ")\n", + dict + ) << "Number of refCells " << refCells.size() + << " does not correspond to number of regions " + << regionNeedReference.size() + << exit(FatalIOError); + } + + forAll(refCells, i) + { + label regionI = regions[refCells[i]]; + + if (regionNeedReference[regionI]) + { + regionRefCells[regionI] = refCells[i]; + regionRefValues[regionI] = refValues[i]; + } + } + + + forAll(regionNeedReference, regionI) + { + if + ( + regionNeedReference[regionI] + && regionRefCells[regionI] == -1 + ) + { + FatalIOErrorIn + ( + "setRefCell\n" + "(\n" + " const volScalarField&,\n" + " const volScalarField&,\n" + " const dictionary&,\n" + " labelList&,\n" + " scalarField&,\n" + " const bool\n" + ")\n", + dict + ) << "Have no reference cell for region " << regionI + << nl + << "Overall per-region reference cells " + << regionRefCells + << exit(FatalIOError); + } + } + } + } + else if (dict.found(refPointName)) + { + pointField refPoints(dict.lookup(refPointName)); + + if (refPoints.size() != regionNeedReference.size()) + { + FatalIOErrorIn + ( + "setRefCell\n" + "(\n" + " const volScalarField&,\n" + " const volScalarField&,\n" + " const dictionary&,\n" + " labelList&,\n" + " scalarField&,\n" + " const bool\n" + ")\n", + dict + ) << "Number of refPoints " << refPoints.size() + << " does not correspond to number of regions " + << regionNeedReference.size() + << exit(FatalIOError); + } + + labelList hasRef(refPoints.size(), 0); + + forAll(refPoints, i) + { + // Note: find reference cell using facePlanes to avoid constructing + // face decomposition structure. Most likely the reference + // cell is an undistorted one so this should not be a + // problem. + + label celli = field.mesh().findCell + ( + refPoints[i], + polyMesh::FACEPLANES + ); + + if (celli >= 0) + { + Pout<< "Found point " << refPoints[i] + << " in reference cell " << celli + << " at " << field.mesh().cellCentres()[celli] + << " for region " << regions[celli] + << endl; + + regionRefCells[regions[celli]] = celli; + hasRef[regions[celli]] = 1; + } + } + + Pstream::listCombineGather(hasRef, plusEqOp<label>()); + Pstream::listCombineScatter(hasRef); + + forAll(hasRef, regionI) + { + if (hasRef[regionI] != 1) + { + FatalIOErrorIn + ( + "setRefCell\n" + "(\n" + " const volScalarField&,\n" + " const volScalarField&,\n" + " const dictionary&,\n" + " labelList&,\n" + " scalarField&,\n" + " const bool\n" + ")\n", + dict + ) << "Unable to set reference cell for field " << field.name() + << nl + << " Reference points " << refPointName + << " " << refPoints + << nl << " For region " << regionI + << " found on " << hasRef[regionI] + << " domains (should be one)" + << nl << exit(FatalIOError); + } + } + } + else + { + FatalIOErrorIn + ( + "setRefCell\n" + "(\n" + " const volScalarField&,\n" + " const volScalarField&,\n" + " const dictionary&,\n" + " labelList&,\n" + " scalarField&,\n" + " const bool\n" + ")\n", + dict + ) << "Unable to set reference cell for field " << field.name() + << nl + << " Please supply either " << refCellName + << " or " << refPointName << nl << exit(FatalIOError); + } +} + + +// ************************************************************************* // diff --git a/src/overset/regionsToCell/findRefCells.H b/src/overset/regionsToCell/findRefCells.H new file mode 100644 index 0000000000000000000000000000000000000000..4812750c6082e4bebe485149cd89a433ffe5ab61 --- /dev/null +++ b/src/overset/regionsToCell/findRefCells.H @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 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/>. + +InNamespace + Foam + +Description + Find the reference cells per region. Regions given as cellSet names. + +SourceFiles + findRefCell.C + +SeeAlso + Foam::regionSplit + +\*---------------------------------------------------------------------------*/ + +#ifndef findRefCell_H +#define findRefCell_H + +#include "label.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +//- Set reference cells for multi-region domains. Returns per region: +// - whether a reference is needed +// - if so a reference cell (or -1) +// - and a reference value +void setRefCells +( + const volScalarField& field, + const volScalarField& fieldRef, + const dictionary& dict, + + const label refCelli, + const scalar refValue, + + boolList& needReference, + labelList& refCells, + scalarField& refValues, + const bool forceReference = false +); + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/regionsToCell/regionsToCell.C b/src/overset/regionsToCell/regionsToCell.C new file mode 100644 index 0000000000000000000000000000000000000000..2cb3419a4f489523762fe7654ade57c7d7f5fcdb --- /dev/null +++ b/src/overset/regionsToCell/regionsToCell.C @@ -0,0 +1,484 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionsToCell.H" +#include "regionSplit.H" +#include "emptyPolyPatch.H" +#include "cellSet.H" +#include "syncTools.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(regionsToCell, 0); + +addToRunTimeSelectionTable(topoSetSource, regionsToCell, word); + +addToRunTimeSelectionTable(topoSetSource, regionsToCell, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::regionsToCell::usage_ +( + regionsToCell::typeName, + "\n Usage: regionsToCell subCellSet (pt0 .. ptn) nErode\n\n" + " Select all cells in the connected region containing" + " points (pt0..ptn).\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::regionsToCell::markRegionFaces +( + const boolList& selectedCell, + boolList& regionFace +) const +{ + // Internal faces + const labelList& faceOwner = mesh_.faceOwner(); + const labelList& faceNeighbour = mesh_.faceNeighbour(); + forAll(faceNeighbour, faceI) + { + if + ( + selectedCell[faceOwner[faceI]] + != selectedCell[faceNeighbour[faceI]] + ) + { + regionFace[faceI] = true; + } + } + + // Swap neighbour selectedCell state + boolList nbrSelected; + syncTools::swapBoundaryCellList(mesh_, selectedCell, nbrSelected); + + // Boundary faces + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + const labelUList& faceCells = pp.faceCells(); + forAll(faceCells, i) + { + label faceI = pp.start()+i; + label bFaceI = faceI-mesh_.nInternalFaces(); + if + ( + selectedCell[faceCells[i]] + != selectedCell[nbrSelected[bFaceI]] + ) + { + regionFace[faceI] = true; + } + } + } +} + + +Foam::boolList Foam::regionsToCell::findRegions +( + const bool verbose, + const boolList& selectedCell, + const regionSplit& cellRegion +) const +{ + boolList keepRegion(cellRegion.nRegions(), false); + + forAll(insidePoints_, i) + { + // Find the region containing the insidePoint + + const point& insidePt = insidePoints_[i]; + + //label cellI = mesh_.findCell(insidePt); + label cellI = -1; + forAll(selectedCell, index) + { + if + ( + selectedCell[index] + && mesh_.pointInCell(insidePt, index, polyMesh::CELL_TETS) + ) + { + cellI = index; + break; + } + } + + label keepRegionI = -1; + label keepProcI = -1; + if (cellI != -1) + { + keepRegionI = cellRegion[cellI]; + keepProcI = Pstream::myProcNo(); + } + reduce(keepRegionI, maxOp<label>()); + keepRegion[keepRegionI] = true; + + reduce(keepProcI, maxOp<label>()); + + if (keepProcI == -1) + { + FatalErrorInFunction + << "Did not find " << insidePt + << " in mesh." << " Mesh bounds are " << mesh_.bounds() + << exit(FatalError); + } + + if (verbose) + { + Info<< " Found location " << insidePt + << " in cell " << cellI << " on processor " << keepProcI + << " in global region " << keepRegionI + << " out of " << cellRegion.nRegions() << " regions." << endl; + } + } + + return keepRegion; +} + + +void Foam::regionsToCell::unselectOutsideRegions +( + boolList& selectedCell +) const +{ + // Determine faces on the edge of selectedCell + boolList blockedFace(mesh_.nFaces(), false); + markRegionFaces(selectedCell, blockedFace); + + // Determine regions + regionSplit cellRegion(mesh_, blockedFace); + + // Determine regions containing insidePoints_ + boolList keepRegion(findRegions(true, selectedCell, cellRegion)); + + // Go back to bool per cell + forAll(cellRegion, cellI) + { + if (!keepRegion[cellRegion[cellI]]) + { + selectedCell[cellI] = false; + } + } +} + + +void Foam::regionsToCell::shrinkRegions +( + boolList& selectedCell +) const +{ + // Select points on unselected cells and boundary + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + boolList boundaryPoint(mesh_.nPoints(), false); + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (!pp.coupled() && !isA<emptyPolyPatch>(pp)) + { + forAll(pp, i) + { + const face& f = pp[i]; + forAll(f, fp) + { + boundaryPoint[f[fp]] = true; + } + } + } + } + + forAll(selectedCell, cellI) + { + if (!selectedCell[cellI]) + { + const labelList& cPoints = mesh_.cellPoints(cellI); + forAll(cPoints, i) + { + boundaryPoint[cPoints[i]] = true; + } + } + } + + syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false); + + + // Select all cells using these points + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + label nChanged = 0; + forAll(boundaryPoint, pointI) + { + if (boundaryPoint[pointI]) + { + const labelList& pCells = mesh_.pointCells(pointI); + forAll(pCells, i) + { + label cellI = pCells[i]; + if (selectedCell[cellI]) + { + selectedCell[cellI] = false; + nChanged++; + } + } + } + } + Info<< " Eroded " << returnReduce(nChanged, sumOp<label>()) + << " cells." << endl; +} + + +void Foam::regionsToCell::erode +( + boolList& selectedCell +) const +{ + //Info<< "Entering shrinkRegions:" << count(selectedCell) << endl; + //generateField("selectedCell_before", selectedCell)().write(); + + // Now erode and see which regions get disconnected + boolList shrunkSelectedCell(selectedCell); + + for (label iter = 0; iter < nErode_; iter++) + { + shrinkRegions(shrunkSelectedCell); + } + + //Info<< "After shrinking:" << count(shrunkSelectedCell) << endl; + //generateField("shrunkSelectedCell", shrunkSelectedCell)().write(); + + + + // Determine faces on the edge of shrunkSelectedCell + boolList blockedFace(mesh_.nFaces(), false); + markRegionFaces(shrunkSelectedCell, blockedFace); + + // Find disconnected regions + regionSplit cellRegion(mesh_, blockedFace); + + // Determine regions containing insidePoints + boolList keepRegion(findRegions(true, shrunkSelectedCell, cellRegion)); + + + // Extract cells in regions that are not to be kept. + boolList removeCell(mesh_.nCells(), false); + forAll(cellRegion, cellI) + { + if (shrunkSelectedCell[cellI] && !keepRegion[cellRegion[cellI]]) + { + removeCell[cellI] = true; + } + } + + //Info<< "removeCell before:" << count(removeCell) << endl; + //generateField("removeCell_before", removeCell)().write(); + + + + // Grow removeCell + for (label iter = 0; iter < nErode_; iter++) + { + // Grow selected cell in regions that are not for keeping + boolList boundaryPoint(mesh_.nPoints(), false); + forAll(removeCell, cellI) + { + if (removeCell[cellI]) + { + const labelList& cPoints = mesh_.cellPoints(cellI); + forAll(cPoints, i) + { + boundaryPoint[cPoints[i]] = true; + } + } + } + syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false); + + // Select all cells using these points + + label nChanged = 0; + forAll(boundaryPoint, pointI) + { + if (boundaryPoint[pointI]) + { + const labelList& pCells = mesh_.pointCells(pointI); + forAll(pCells, i) + { + label cellI = pCells[i]; + if (!removeCell[cellI]) + { + removeCell[cellI] = true; + nChanged++; + } + } + } + } + } + + //Info<< "removeCell after:" << count(removeCell) << endl; + //generateField("removeCell_after", removeCell)().write(); + + + // Unmark removeCell + forAll(removeCell, cellI) + { + if (removeCell[cellI]) + { + selectedCell[cellI] = false; + } + } +} + + +void Foam::regionsToCell::combine(topoSet& set, const bool add) const +{ + // Note: wip. Select cells first + boolList selectedCell(mesh_.nCells(), true); + + if (setName_.size() && setName_ != "none") + { + Info<< " Loading subset " << setName_ << " to delimit search region." + << endl; + cellSet subSet(mesh_, setName_); + + selectedCell = false; + forAllConstIter(cellSet, subSet, iter) + { + selectedCell[iter.key()] = true; + } + } + + + unselectOutsideRegions(selectedCell); + + if (nErode_ > 0) + { + erode(selectedCell); + } + + + forAll(selectedCell, cellI) + { + if (selectedCell[cellI]) + { + addOrDelete(set, cellI, add); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::regionsToCell::regionsToCell +( + const polyMesh& mesh, + const word& setName, + const pointField& insidePoints, + const label nErode +) +: + topoSetSource(mesh), + setName_(setName), + insidePoints_(insidePoints), + nErode_(nErode) +{} + + +// Construct from dictionary +Foam::regionsToCell::regionsToCell +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + setName_(dict.lookupOrDefault<word>("set", "none")), + insidePoints_ + ( + dict.found("insidePoints") + ? dict.lookup("insidePoints") + : dict.lookup("insidePoint") + ), + nErode_(dict.lookupOrDefault("nErode", 0)) +{} + + +// Construct from Istream +Foam::regionsToCell::regionsToCell +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + setName_(checkIs(is)), + insidePoints_(checkIs(is)), + nErode_(readLabel(checkIs(is))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionsToCell::~regionsToCell() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionsToCell::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding all cells of connected region containing points " + << insidePoints_ << " ..." << endl; + + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing all cells of connected region containing points " + << insidePoints_ << " ..." << endl; + + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/overset/regionsToCell/regionsToCell.H b/src/overset/regionsToCell/regionsToCell.H new file mode 100644 index 0000000000000000000000000000000000000000..1f7c54457468a184749e46a83a10ddd5db8cdcf9 --- /dev/null +++ b/src/overset/regionsToCell/regionsToCell.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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/>. + +Class + Foam::regionsToCell + +Description + TopoSetSource. Select cells belonging to topological connected region + (that contains given points) + + In dictionary input: + + // optional name of cellSet delimiting search + set c0; + + //- Number of cell layers to erode mesh to detect holes in the mesh + // Set to 0 if not used. + nErode 3; + + // points inside region to select + insidePoints ((1 2 3)); + + +SourceFiles + regionsToCell.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionsToCell_H +#define regionsToCell_H + +#include "topoSetSource.H" +#include "boolList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class regionSplit; + +/*---------------------------------------------------------------------------*\ + Class regionsToCell Declaration +\*---------------------------------------------------------------------------*/ + +class regionsToCell +: + public topoSetSource +{ + + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Name of cellSet to keep to + const word setName_; + + //- Coordinate(s) that is inside connected region + const pointField insidePoints_; + + //- Number of layers to erode + const label nErode_; + + + // Private Member Functions + + //- Mark faces inbetween selected and unselected elements + void markRegionFaces + ( + const boolList& selectedCell, + boolList& regionFace + ) const; + + //- Determine for every disconnected region in the mesh whether + // it contains a locationInMesh + boolList findRegions + ( + const bool verbose, + const boolList& selectedCell, + const regionSplit& + ) const; + + //- Unselect regions not containing a locationInMesh + void unselectOutsideRegions(boolList& selectedCell) const; + + //- Unselect one layer of cells from selectedCell + void shrinkRegions(boolList& selectedCell) const; + + //- Erode a given number of layers from selectedCell. Remove any + // region that gets disconnected that way. + void erode(boolList& selectedCell) const; + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("regionsToCell"); + + // Constructors + + //- Construct from components + regionsToCell + ( + const polyMesh& mesh, + const word& setName, + const pointField& insidePoints, + const label nErode + ); + + //- Construct from dictionary + regionsToCell + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + regionsToCell + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~regionsToCell(); + + + // Member Functions + + virtual sourceType setType() const + { + return CELLSETSOURCE; + } + + virtual void applyToSet(const topoSetSource::setAction action, topoSet&) + const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C index 72afb55582a16c9d6325c225bb11530ed2d297ee..1fcabf5243a53f4b51ee64908704ddc8bbad97ce 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C @@ -406,6 +406,7 @@ patchInternalTemperatureField() const void Foam::energyRegionCoupledFvPatchScalarField::updateInterfaceMatrix ( Field<scalar>& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -435,18 +436,14 @@ void Foam::energyRegionCoupledFvPatchScalarField::updateInterfaceMatrix } // Multiply the field by coefficients and add into the result - const labelUList& faceCells = regionCoupledPatch_.faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*myHE[elemI]; - } + this->addToInternalField(result, !add, coeffs, myHE); } void Foam::energyRegionCoupledFvPatchScalarField::updateInterfaceMatrix ( Field<scalar>& result, + const bool add, const Field<scalar>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H index df8a2c8fd83fc090f5a413c93dc649dc8e1fa847..877d40583de06fc6aaf575a005f3abb42273a753 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H @@ -221,6 +221,7 @@ public: virtual void updateInterfaceMatrix ( Field<scalar>& result, + const bool add, const scalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -231,6 +232,7 @@ public: virtual void updateInterfaceMatrix ( Field<scalar>&, + const bool, const Field<scalar>&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 57b290851c8a291d1c3c4b23528a94d15adb4c09..3ac9607fff03b38202aead924dc51e40be570894 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -420,7 +420,7 @@ void Foam::meshToMesh::calcAddressing } -void Foam::meshToMesh::calculate(const word& methodName) +void Foam::meshToMesh::calculate(const word& methodName, const bool normalise) { Info<< "Creating mesh-to-mesh addressing for " << srcRegion_.name() << " and " << tgtRegion_.name() << " regions using " @@ -566,19 +566,22 @@ void Foam::meshToMesh::calculate(const word& methodName) ); // weights normalisation - normaliseWeights - ( - "source", - srcToTgtCellAddr_, - srcToTgtCellWght_ - ); + if (normalise) + { + normaliseWeights + ( + "source", + srcToTgtCellAddr_, + srcToTgtCellWght_ + ); - normaliseWeights - ( - "target", - tgtToSrcCellAddr_, - tgtToSrcCellWght_ - ); + normaliseWeights + ( + "target", + tgtToSrcCellAddr_, + tgtToSrcCellWght_ + ); + } // cache maps and reset addresses List<Map<label>> cMap; @@ -598,19 +601,22 @@ void Foam::meshToMesh::calculate(const word& methodName) { calcAddressing(methodName, srcRegion_, tgtRegion_); - normaliseWeights - ( - "source", - srcToTgtCellAddr_, - srcToTgtCellWght_ - ); + if (normalise) + { + normaliseWeights + ( + "source", + srcToTgtCellAddr_, + srcToTgtCellWght_ + ); - normaliseWeights - ( - "target", - tgtToSrcCellAddr_, - tgtToSrcCellWght_ - ); + normaliseWeights + ( + "target", + tgtToSrcCellAddr_, + tgtToSrcCellWght_ + ); + } } Info<< " Overlap volume: " << V_ << endl; @@ -743,7 +749,7 @@ void Foam::meshToMesh::constructNoCuttingPatches } // calculate volume addressing and weights - calculate(methodName); + calculate(methodName, true); // calculate patch addressing and weights calculatePatchAMIs(AMIMethodName); @@ -755,7 +761,8 @@ void Foam::meshToMesh::constructFromCuttingPatches const word& methodName, const word& AMIMethodName, const HashTable<word>& patchMap, - const wordList& cuttingPatches + const wordList& cuttingPatches, + const bool normalise ) { const polyBoundaryMesh& srcBm = srcRegion_.boundaryMesh(); @@ -806,7 +813,7 @@ void Foam::meshToMesh::constructFromCuttingPatches tgtPatchID_.transfer(tgtIDs); // calculate volume addressing and weights - calculate(methodName); + calculate(methodName, normalise); // calculate patch addressing and weights calculatePatchAMIs(AMIMethodName); @@ -888,7 +895,8 @@ Foam::meshToMesh::meshToMesh const polyMesh& tgt, const interpolationMethod& method, const HashTable<word>& patchMap, - const wordList& cuttingPatches + const wordList& cuttingPatches, + const bool normalise ) : srcRegion_(src), @@ -914,7 +922,8 @@ Foam::meshToMesh::meshToMesh interpolationMethodAMI(method) ), patchMap, - cuttingPatches + cuttingPatches, + normalise ); } @@ -926,7 +935,8 @@ Foam::meshToMesh::meshToMesh const word& methodName, // internal mapping const word& AMIMethodName, // boundary mapping const HashTable<word>& patchMap, - const wordList& cuttingPatches + const wordList& cuttingPatches, + const bool normalise ) : srcRegion_(src), @@ -949,7 +959,8 @@ Foam::meshToMesh::meshToMesh methodName, AMIMethodName, patchMap, - cuttingPatches + cuttingPatches, + normalise ); } diff --git a/src/sampling/meshToMesh/meshToMesh.H b/src/sampling/meshToMesh/meshToMesh.H index 26227235db0f7244c8925308468da7e252ad4e10..62b5781979ac1f27135f4dd589630fdd015e4958 100644 --- a/src/sampling/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMesh/meshToMesh.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -205,7 +205,7 @@ private: ); //- Calculate - main driver function - void calculate(const word& methodName); + void calculate(const word& methodName, const bool normalise); //- Calculate patch overlap void calculatePatchAMIs(const word& amiMethodName); @@ -224,7 +224,8 @@ private: const word& methodName, const word& AMIMethodName, const HashTable<word>& patchMap, - const wordList& cuttingPatches + const wordList& cuttingPatches, + const bool normalise ); // Parallel operations @@ -320,7 +321,8 @@ public: const polyMesh& tgt, const interpolationMethod& method, const HashTable<word>& patchMap, - const wordList& cuttingPatches + const wordList& cuttingPatches, + const bool normalise = true ); @@ -332,7 +334,8 @@ public: const word& methodName, // internal mapping const word& AMIMethodName, // boundary mapping const HashTable<word>& patchMap, - const wordList& cuttingPatches + const wordList& cuttingPatches, + const bool normalise = true ); @@ -383,6 +386,15 @@ public: patchAMIs() const; + // Explicit access. Can probably be done with combine operator. + + //- Source map pointer - valid if no singleMeshProc + inline const autoPtr<mapDistribute>& srcMap() const; + + //- Target map pointer - valid if no singleMeshProc + inline const autoPtr<mapDistribute>& tgtMap() const; + + // Evaluation // Source-to-target field mapping diff --git a/src/sampling/meshToMesh/meshToMeshI.H b/src/sampling/meshToMesh/meshToMeshI.H index a00d37a62e8b6b7ac311488d613fb1440845db7d..bd62cdb004e58e6f6f62ea055e881405a993f01a 100644 --- a/src/sampling/meshToMesh/meshToMeshI.H +++ b/src/sampling/meshToMesh/meshToMeshI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -81,6 +81,20 @@ inline Foam::scalar Foam::meshToMesh::V() const } +inline const Foam::autoPtr<Foam::mapDistribute>& +Foam::meshToMesh::srcMap() const +{ + return srcMapPtr_; +} + + +inline const Foam::autoPtr<Foam::mapDistribute>& +Foam::meshToMesh::tgtMap() const +{ + return tgtMapPtr_; +} + + inline const Foam::PtrList<Foam::AMIPatchToPatchInterpolation>& Foam::meshToMesh::patchAMIs() const { diff --git a/src/waveModels/waveModel/waveModel.C b/src/waveModels/waveModel/waveModel.C index 484aac3f6dca40666680eae38526950a154a7389..ed7e3e1ba326464cc9a3440dba841d364b1a5e3d 100644 --- a/src/waveModels/waveModel/waveModel.C +++ b/src/waveModels/waveModel/waveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/T b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/T new file mode 100644 index 0000000000000000000000000000000000000000..a60edc4bb6bfefcc2938a0f17756b834f4371dd6 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/T @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 273; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type zeroGradient; + } + + left1 + { + type fixedValue; + value uniform 300; + } + + right1 + { + type fixedValue; + value uniform 273; + } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/pointDisplacement b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..dcf1467e615c24a22cdc7f03ad8efa1b9bc85641 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/pointDisplacement @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + ".*" + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + "(free|hole)" + { + patchType overset; + type uniformFixedValue; + uniformValue table + ( + (0.0 (0 0 0)) + (1.0 (0.31 0 0)) + (2.0 (0 0 0)) + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/zoneID b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..1a49886c2839d838d832bbfa2067527a105d3707 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/0.org/zoneID @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev-OpenCFD.overlap | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allclean b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..323e09af05db0c3291e129d478f9f2e232782644 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allclean @@ -0,0 +1,13 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID + +rm -rf 0 + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..a7602c7dea15e1f7b5a1be2ced10c97a7673a249 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun @@ -0,0 +1,13 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +# Run it for a bit + +# Serial +#runApplication `getApplication` + +# Parallel +runApplication decomposePar -cellDist +runParallel `getApplication` diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun.pre b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..19e4417a553dbf99ed91af3793a7ce2c77a62d83 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun.pre @@ -0,0 +1,17 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +# Select cellSets +runApplication topoSet + +runApplication subsetMesh box -patch hole -overwrite + +# Select cellSets +runApplication -s zoneID topoSet + +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/README.txt b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b8ef391a71331e715cdf081f695a48fd35dbe16 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/README.txt @@ -0,0 +1,4 @@ +Transient, moving mesh +---------------------- + +Simple testcase for testing mesh motion diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/constant/dynamicMeshDict b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..69054196e62676174b12da0d2af53238359108be --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/constant/dynamicMeshDict @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motionSolverLibs ( "libfvMotionSolvers.so" ); + +solver displacementLaplacian; + +displacementLaplacianCoeffs +{ + diffusivity uniform 1; +} + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +// layerRelax 0.3; +} + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/constant/transportProperties b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..2c17a95828649391da9e86497b7ccfddeaece70a --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/constant/transportProperties @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DT DT [ 0 2 -1 0 0 0 0 ] 1; + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/blockMeshDict b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..a5fafc3ec1322d53a2913d0511d3c1dfa7293b64 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/blockMeshDict @@ -0,0 +1,126 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0.00 0.0 0) + ( 1.00 0.0 0) + ( 1.00 1.0 0) + ( 0.00 1.0 0) + ( 0.00 0.0 1) + ( 1.00 0.0 1) + ( 1.00 1.0 1) + ( 0.00 1.0 1) + +//- 0 degrees + ( 0.25 0.25 0) + ( 0.75 0.25 0) + ( 0.75 0.75 0) + ( 0.25 0.75 0) + ( 0.25 0.25 1) + ( 0.75 0.25 1) + ( 0.75 0.75 1) + ( 0.25 0.75 1) + + +//- 45 degrees rotated +// ( 0.25 0.5 0) +// ( 0.5 0.25 0) +// ( 0.75 0.5 0) +// ( 0.5 0.75 0) +// ( 0.25 0.5 1) +// ( 0.5 0.25 1) +// ( 0.75 0.5 1) +// ( 0.5 0.75 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (18 18 1) simpleGrading (1 1 1) + + hex (8 9 10 11 12 13 14 15) movingZone (20 20 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + free + { + type overset; + faces + ( + (8 12 15 11) + (10 14 13 9) + (11 15 14 10) + ( 9 13 12 8) + ); + } + + walls + { + type patch; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + // Populated by subsetMesh + hole + { + type patch; + faces (); + } + + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ( 8 11 10 9) + (12 13 14 15) + ); + } + + left1 + { + type patch; + faces + ( + (0 4 7 3) + ); + } + right1 + { + type patch; + faces + ( + (2 6 5 1) + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/controlDict b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..52e7cf888d493019b6a64f81b6a60bbb2bf4f9de --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/controlDict @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Make sure all preprocessing tools know about the 'overset' bc +libs ("liboverset.so"); + +application overLaplacianDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1; + +deltaT 0.1; + +writeControl timeStep; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/decomposeParDict b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..138625c7da8204f29c3935cef7554223317a03c3 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/decomposeParDict @@ -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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/fvSchemes b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..54af0223a5b729347b19ac290dac14c1e335f103 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/fvSchemes @@ -0,0 +1,85 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; //steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(T) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss limitedLinearV 1; + div(phi,k) bounded Gauss limitedLinear 1; + div(phi,epsilon) bounded Gauss limitedLinear 1; + div(phi,R) bounded Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) bounded Gauss limitedLinear 1; + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; + laplacian(diffusivity,cellDisplacement) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + +oversetInterpolation +{ + // Interpolation scheme to use for overset calculation + method inverseDistance; + + // The inverseDistance method uses a 'voxel' like search structure. + // Optionally specify the extent and number of divisions n. + // Note that it will allocate an array of nx*ny*nz. If not specified: + // - searchBox : local mesh bounding box + // - searchBoxDivisions : root (2D) or cube-root(3D) of number of cells + //searchBox (0 0 0)(1 1 1); + //searchBoxDivisions (100 100 1); +} + + +oversetInterpolationRequired +{ + // Any additional fields that require overset interpolation +} + + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/fvSolution b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..66c7f94747e33a6f2f1ed30f4eef3f2482308b00 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/fvSolution @@ -0,0 +1,77 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + T + { + solver PBiCGStab; + preconditioner DILU; + + //solver GAMG; + //smoother DILUGaussSeidel; + //agglomerator algebraicPair; + //processorAgglomerator none; + + tolerance 1e-10; + relTol 0; + } + + cellDisplacement + { + solver PCG; + preconditioner DIC; + + tolerance 1e-06; + relTol 0; + maxIter 100; + } + + +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; //2; +} + + +PIMPLE +{ + correctPhi yes; + nOuterCorrectors 2; + nCorrectors 1; + nNonOrthogonalCorrectors 0; +} + + +relaxationFactors +{ + fields + { + p 0.3; + } + equations + { + U 0.7; + k 0.7; + omega 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/setFieldsDict b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..2ebc58f23ab05499d5c2aaf1453ab0fc0a4182c2 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/setFieldsDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object 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 + ); + } + +); + +// ************************************************************************* // diff --git a/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/topoSetDict b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..06a8182d40401efd63d11a3af6fbf5ad0e1f8830 --- /dev/null +++ b/tutorials/basic/overLaplacianDyMFoam/heatTransfer/system/topoSetDict @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source regionToCell; + 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; + } + + + // Select box to remove from region 1 + + { + name box; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c1; + } + } + + + { + name box; + type cellSet; + action subset; + source boxToCell; + sourceInfo + { + box (0.4 0.4 -100)(0.6 0.6 100); + } + } + + { + name box; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..862ed262d87e660157ae5c8802d3e9dc742b91c5 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Extrude mesh around cylinder +(cd cylinderAndBackground && ./Allclean) + +# Add background mesh +(cd cylinderMesh && foamCleanTutorials) + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..7604f9ad35a006852330ed91538222f0bd42f49b --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun @@ -0,0 +1,8 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Extrude mesh around cylinder +(cd cylinderMesh && ./Allrun.pre) + +# Add background mesh +(cd cylinderAndBackground && ./Allrun) diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun.pre b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..788e9474864bfb14f862151162d52c799047bfb7 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/Allrun.pre @@ -0,0 +1,8 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Extrude mesh around cylinder +(cd cylinderMesh && ./Allrun.pre) + +# Add background mesh +(cd cylinderAndBackground && ./Allrun.pre) diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/README.txt b/tutorials/incompressible/overPimpleDyMFoam/cylinder/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..172ae4285f8e6084c69fd9838b68826e8f2a0ff0 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/README.txt @@ -0,0 +1,8 @@ +Transient, steady mesh +----------------------- + +cylinderMesh/ + For generating (2D) mesh cylinder mesh + +cylinderAndBackground/ + BlockMesh for background and running diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/U b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..58e5de004b0e77ace8e864d858cb648645e89a97 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/U @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform $flowVelocity; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + walls + { + type movingWallVelocity; + value uniform (0 0 0); + } + + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue uniform (0 0 0); + value $internalField; + } + + topAndBottom + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/epsilon b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..e84ad141fd485702aa954f0d2fb933f9bcf3c2d3 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/epsilon @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform $turbulentEpsilon; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + wall + { + type epsilonWallFunction; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + inlet + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.01; // 1cm - half channel height + value $internalField; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/include/fixedInlet b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/include/fixedInlet new file mode 100644 index 0000000000000000000000000000000000000000..f765e838505d9b7fb381664c3cda5a4ea3eead6d --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/include/fixedInlet @@ -0,0 +1,15 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +inlet +{ + type fixedValue; + value $internalField; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/include/initialConditions b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/include/initialConditions new file mode 100644 index 0000000000000000000000000000000000000000..aaa6bd1c6ff32eaff7dcb39edfae03322f94992f --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/include/initialConditions @@ -0,0 +1,15 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +flowVelocity (10 0 0); +pressure 0; +turbulentKE 1.5; +turbulentEpsilon 0.88; +#inputMode merge + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/k b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/k new file mode 100644 index 0000000000000000000000000000000000000000..abe940934145997302ddc6287fa764502b489996 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/k @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform $turbulentKE; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + #include "include/fixedInlet" + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + wall + { + type kqRWallFunction; + value $internalField; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/nut b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/nut new file mode 100644 index 0000000000000000000000000000000000000000..cc655b9cc590db9b4bd7bb3fe08019dc92e70430 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/nut @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + wall + { + type nutkWallFunction; + value uniform 0; + } + + ".*" + { + type calculated; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/p b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/p new file mode 100644 index 0000000000000000000000000000000000000000..e7f065b3bd8ac27bc4cafef3158e3158da3fd30b --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/p @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform $pressure; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + wall + { + type zeroGradient; + } + + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; //calculated; + value $internalField; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/pointDisplacement b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..0bcc4e3481f8abf7a83b9cff09d6b3abb40a45c1 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/pointDisplacement @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + overset + { + patchType overset; + type zeroGradient; + } + + walls + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + ".*" + { + type uniformFixedValue; + uniformValue (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/zoneID b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..b1cdf0478edf426f139d3787f383622392116388 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/0.org/zoneID @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allclean b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..5d96ca404a377af449d1ab8d37d88228ed684c37 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allclean @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID +rm -f constant/cellInterpolationWeight + +rm -rf 0 + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allrun b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..b3d5b3a8dea0a28e9847d9127359a04d4e281fe8 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allrun @@ -0,0 +1,7 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +# Run it for a bit +runApplication `getApplication` diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allrun.pre b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..5e8d5fb08da825d4b6086b781e99f69d6b36ec61 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/Allrun.pre @@ -0,0 +1,20 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Create background mesh +runApplication blockMesh + +# Add the cylinder mesh +runApplication mergeMeshes . ../cylinderMesh -overwrite + +## Make it a bit smaller to keep it laminar +#runApplication transformPoints -scale '(0.001 0.001 0.001)' + +# Select cellSets for the different zones +runApplication topoSet + +# Copy standard fields +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/dynamicMeshDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..799c4a059b79ae99d6ca60456cdc817429864de3 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/dynamicMeshDict @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motionSolverLibs ( "libfvMotionSolvers.so" ); + +solver displacementLaplacian; + +displacementLaplacianCoeffs +{ + diffusivity uniform 1; +} + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +// layerRelax 0.3; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/transportProperties b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..4efbc8b932532edc97f57592c725b47fc68e60dc --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/transportProperties @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DT DT [ 0 2 -1 0 0 0 0 ] 1; //4e-05; + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/turbulenceProperties b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..8fe9b5ed38d3ed562c1cdf8fcc71b0a6ce10c8bc --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/constant/turbulenceProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- 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; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/blockMeshDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..b2e40c26c83362217ad96a8ac891ceb94ca3c797 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/blockMeshDict @@ -0,0 +1,83 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-5 -0.05 -4.0) + ( 9 -0.05 -4.0) + ( 9 0.05 -4.0) + (-5 0.05 -4.0) + (-5 -0.05 4.0) + ( 9 -0.05 4.0) + ( 9 0.05 4.0) + (-5 0.05 4.0) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (120 1 60) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + topAndBottom + { + type patch; + faces + ( + (4 5 6 7) + (0 3 2 1) + ); + } + + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type patch; + faces + ( + (2 6 5 1) + ); + } + + frontAndBack + { + type empty; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/controlDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..cc974a94e6916488d75b63a4e0031ee70ab6d7c0 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/controlDict @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +libs ("liboverset.so"); + +application overPimpleDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 2.0; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 10; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/decomposeParDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..29610a20d888080443c389945459a889bb0985ea --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/decomposeParDict @@ -0,0 +1,30 @@ +/*--------------------------------*- 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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 2 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/fvSchemes b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..a8031a5b63aa9aa9539561fb977bbcebfd6e2f32 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/fvSchemes @@ -0,0 +1,72 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1;; + div(phi,epsilon) Gauss limitedLinear 1;; + div(phi,R) Gauss limitedLinear 1;; + div(R) Gauss limitedLinear 1;; + div(phi,omega) Gauss limitedLinear 1; + div(phid,p) Gauss limitedLinear 1; + div(phi,K) Gauss limitedLinear 1; + div(phi,e) Gauss limitedLinear 1; + 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 inverseDistance; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/fvSolution b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..889491adf98fd9bf1e15d3a6af349d6dcfc3f624 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/fvSolution @@ -0,0 +1,100 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + cellDisplacement + { + solver PCG; + preconditioner DIC; + + tolerance 1e-06; + relTol 0; + maxIter 100; + } + + p + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } + + + pFinal + { + $p; + relTol 0; + } + + pcorr + { + $pFinal; + solver PCG; + preconditioner DIC; + } + + pcorrFinal + { + $pcorr; + relTol 0; + } + + "(U|k|epsilon|omega)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0; + } + + "(U|k|epsilon|omega)Final" + { + $U; + tolerance 1e-6; + relTol 0; + } +} + + +PIMPLE +{ + momentumPredictor false; + correctPhi false; //true; + oversetAdjustPhi true; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + + ddtCorr true; + +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/setFieldsDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..21c7adb08ee536245f8181d5e0c3ea4a1c69ef4b --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/setFieldsDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 + ); + } + +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/topoSetDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..9c6d97678240cf11709cf4be9ff72e4987055c8f --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderAndBackground/system/topoSetDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 regionToCell; + sourceInfo + { + insidePoints ((-4.999 0 -3.999)); + } + } + + { + name c1; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c0; + } + } + + { + name c1; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/Allrun.pre b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..ad0801bbb900fe1a425cb5941eb3778df1ec2056 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/Allrun.pre @@ -0,0 +1,8 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Generate mesh from surface (in constant/triSurface) +runApplication extrudeMesh + +# Make front and back type empty +runApplication createPatch -overwrite diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/constant/triSurface/cylinder.vtk b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/constant/triSurface/cylinder.vtk new file mode 100644 index 0000000000000000000000000000000000000000..6a99fb9b6fa70d14ce544bacd1b185247667cc9c --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/constant/triSurface/cylinder.vtk @@ -0,0 +1,221 @@ +# vtk DataFile Version 4.0 +vtk output +ASCII +DATASET POLYDATA +POINTS 150 float +0.5 0.05 0 0.5 -0.05 0 0.498246 0.05 -0.0418389 +0.498246 -0.05 -0.0418389 0.492998 0.05 -0.0833844 0.492998 -0.05 -0.0833844 +0.484292 0.05 -0.124345 0.484292 -0.05 -0.124345 0.472188 0.05 -0.164433 +0.472188 -0.05 -0.164433 0.456773 0.05 -0.203368 0.456773 -0.05 -0.203368 +0.438153 0.05 -0.240877 0.438153 -0.05 -0.240877 0.416461 0.05 -0.276696 +0.416461 -0.05 -0.276696 0.391847 0.05 -0.310574 0.391847 -0.05 -0.310574 +0.364484 0.05 -0.342274 0.364484 -0.05 -0.342274 0.334565 0.05 -0.371572 +0.334565 -0.05 -0.371572 0.3023 0.05 -0.398265 0.3023 -0.05 -0.398265 +0.267913 0.05 -0.422164 0.267913 -0.05 -0.422164 0.231648 0.05 -0.443102 +0.231648 -0.05 -0.443102 0.193758 0.05 -0.460932 0.193758 -0.05 -0.460932 +0.154509 0.05 -0.475528 0.154509 -0.05 -0.475528 0.114175 0.05 -0.486789 +0.114175 -0.05 -0.486789 0.0730415 0.05 -0.494636 0.0730415 -0.05 -0.494636 +0.0313953 0.05 -0.499013 0.0313953 -0.05 -0.499013 -0.0104712 0.05 -0.49989 +-0.0104712 -0.05 -0.49989 -0.0522642 0.05 -0.497261 -0.0522642 -0.05 -0.497261 +-0.0936907 0.05 -0.491144 -0.0936907 -0.05 -0.491144 -0.13446 0.05 -0.481581 +-0.13446 -0.05 -0.481581 -0.174286 0.05 -0.468641 -0.174286 -0.05 -0.468641 +-0.21289 0.05 -0.452414 -0.21289 -0.05 -0.452414 -0.25 0.05 -0.433013 +-0.25 -0.05 -0.433013 -0.285357 0.05 -0.410575 -0.285357 -0.05 -0.410575 +-0.318712 0.05 -0.385257 -0.318712 -0.05 -0.385257 -0.349832 0.05 -0.357236 +-0.349832 -0.05 -0.357236 -0.378498 0.05 -0.32671 -0.378498 -0.05 -0.32671 +-0.404509 0.05 -0.293893 -0.404509 -0.05 -0.293893 -0.427682 0.05 -0.259014 +-0.427682 -0.05 -0.259014 -0.447856 0.05 -0.222318 -0.447856 -0.05 -0.222318 +-0.464888 0.05 -0.184062 -0.464888 -0.05 -0.184062 -0.47866 0.05 -0.144516 +-0.47866 -0.05 -0.144516 -0.489074 0.05 -0.103956 -0.489074 -0.05 -0.103956 +-0.496057 0.05 -0.0626666 -0.496057 -0.05 -0.0626666 -0.499561 0.05 -0.0209378 +-0.499561 -0.05 -0.0209378 -0.499561 0.05 0.0209378 -0.499561 -0.05 0.0209378 +-0.496057 0.05 0.0626666 -0.496057 -0.05 0.0626666 -0.489074 0.05 0.103956 +-0.489074 -0.05 0.103956 -0.47866 0.05 0.144516 -0.47866 -0.05 0.144516 +-0.464888 0.05 0.184062 -0.464888 -0.05 0.184062 -0.447856 0.05 0.222318 +-0.447856 -0.05 0.222318 -0.427682 0.05 0.259014 -0.427682 -0.05 0.259014 +-0.404509 0.05 0.293893 -0.404509 -0.05 0.293893 -0.378498 0.05 0.32671 +-0.378498 -0.05 0.32671 -0.349832 0.05 0.357236 -0.349832 -0.05 0.357236 +-0.318712 0.05 0.385257 -0.318712 -0.05 0.385257 -0.285357 0.05 0.410575 +-0.285357 -0.05 0.410575 -0.25 0.05 0.433013 -0.25 -0.05 0.433013 +-0.21289 0.05 0.452414 -0.21289 -0.05 0.452414 -0.174286 0.05 0.468641 +-0.174286 -0.05 0.468641 -0.13446 0.05 0.481581 -0.13446 -0.05 0.481581 +-0.0936907 0.05 0.491144 -0.0936907 -0.05 0.491144 -0.0522642 0.05 0.497261 +-0.0522642 -0.05 0.497261 -0.0104712 0.05 0.49989 -0.0104712 -0.05 0.49989 +0.0313953 0.05 0.499013 0.0313953 -0.05 0.499013 0.0730415 0.05 0.494636 +0.0730415 -0.05 0.494636 0.114175 0.05 0.486789 0.114175 -0.05 0.486789 +0.154509 0.05 0.475528 0.154509 -0.05 0.475528 0.193758 0.05 0.460932 +0.193758 -0.05 0.460932 0.231648 0.05 0.443102 0.231648 -0.05 0.443102 +0.267913 0.05 0.422164 0.267913 -0.05 0.422164 0.3023 0.05 0.398265 +0.3023 -0.05 0.398265 0.334565 0.05 0.371572 0.334565 -0.05 0.371572 +0.364484 0.05 0.342274 0.364484 -0.05 0.342274 0.391847 0.05 0.310574 +0.391847 -0.05 0.310574 0.416461 0.05 0.276696 0.416461 -0.05 0.276696 +0.438153 0.05 0.240877 0.438153 -0.05 0.240877 0.456773 0.05 0.203368 +0.456773 -0.05 0.203368 0.472188 0.05 0.164433 0.472188 -0.05 0.164433 +0.484292 0.05 0.124345 0.484292 -0.05 0.124345 0.492998 0.05 0.0833844 +0.492998 -0.05 0.0833844 0.498246 0.05 0.0418389 0.498246 -0.05 0.0418389 + +POLYGONS 75 375 +4 0 1 3 2 +4 2 3 5 4 +4 4 5 7 6 +4 6 7 9 8 +4 8 9 11 10 +4 10 11 13 12 +4 12 13 15 14 +4 14 15 17 16 +4 16 17 19 18 +4 18 19 21 20 +4 20 21 23 22 +4 22 23 25 24 +4 24 25 27 26 +4 26 27 29 28 +4 28 29 31 30 +4 30 31 33 32 +4 32 33 35 34 +4 34 35 37 36 +4 36 37 39 38 +4 38 39 41 40 +4 40 41 43 42 +4 42 43 45 44 +4 44 45 47 46 +4 46 47 49 48 +4 48 49 51 50 +4 50 51 53 52 +4 52 53 55 54 +4 54 55 57 56 +4 56 57 59 58 +4 58 59 61 60 +4 60 61 63 62 +4 62 63 65 64 +4 64 65 67 66 +4 66 67 69 68 +4 68 69 71 70 +4 70 71 73 72 +4 72 73 75 74 +4 74 75 77 76 +4 76 77 79 78 +4 78 79 81 80 +4 80 81 83 82 +4 82 83 85 84 +4 84 85 87 86 +4 86 87 89 88 +4 88 89 91 90 +4 90 91 93 92 +4 92 93 95 94 +4 94 95 97 96 +4 96 97 99 98 +4 98 99 101 100 +4 100 101 103 102 +4 102 103 105 104 +4 104 105 107 106 +4 106 107 109 108 +4 108 109 111 110 +4 110 111 113 112 +4 112 113 115 114 +4 114 115 117 116 +4 116 117 119 118 +4 118 119 121 120 +4 120 121 123 122 +4 122 123 125 124 +4 124 125 127 126 +4 126 127 129 128 +4 128 129 131 130 +4 130 131 133 132 +4 132 133 135 134 +4 134 135 137 136 +4 136 137 139 138 +4 138 139 141 140 +4 140 141 143 142 +4 142 143 145 144 +4 144 145 147 146 +4 146 147 149 148 +4 148 149 1 0 + +POINT_DATA 150 +NORMALS Normals float +1 0 -0 1 0 -0 0.996493 0 -0.0836778 +0.996493 0 -0.0836778 0.985996 0 -0.166769 0.985996 0 -0.166769 +0.968583 0 -0.24869 0.968583 0 -0.24869 0.944376 0 -0.328867 +0.944376 0 -0.328867 0.913545 0 -0.406737 0.913545 0 -0.406737 +0.876307 0 -0.481754 0.876307 0 -0.481754 0.832921 0 -0.553392 +0.832921 0 -0.553392 0.783693 0 -0.621148 0.783693 0 -0.621148 +0.728969 0 -0.684547 0.728969 0 -0.684547 0.669131 0 -0.743145 +0.669131 0 -0.743145 0.604599 0 -0.79653 0.604599 0 -0.79653 +0.535827 0 -0.844328 0.535827 0 -0.844328 0.463296 0 -0.886204 +0.463296 0 -0.886204 0.387516 0 -0.921863 0.387516 0 -0.921863 +0.309017 0 -0.951057 0.309017 0 -0.951057 0.228351 0 -0.973579 +0.228351 0 -0.973579 0.146083 0 -0.989272 0.146083 0 -0.989272 +0.0627905 0 -0.998027 0.0627905 0 -0.998027 -0.0209424 0 -0.999781 +-0.0209424 0 -0.999781 -0.104528 0 -0.994522 -0.104528 0 -0.994522 +-0.187381 0 -0.982287 -0.187381 0 -0.982287 -0.26892 0 -0.963163 +-0.26892 0 -0.963163 -0.348572 0 -0.937282 -0.348572 0 -0.937282 +-0.425779 0 -0.904827 -0.425779 0 -0.904827 -0.5 0 -0.866025 +-0.5 0 -0.866025 -0.570714 0 -0.821149 -0.570714 0 -0.821149 +-0.637424 0 -0.770513 -0.637424 0 -0.770513 -0.699663 0 -0.714473 +-0.699663 0 -0.714473 -0.756995 0 -0.653421 -0.756995 0 -0.653421 +-0.809017 0 -0.587785 -0.809017 0 -0.587785 -0.855364 0 -0.518027 +-0.855364 0 -0.518027 -0.895712 0 -0.444635 -0.895712 0 -0.444635 +-0.929776 0 -0.368125 -0.929776 0 -0.368125 -0.957319 0 -0.289032 +-0.957319 0 -0.289032 -0.978148 0 -0.207912 -0.978148 0 -0.207912 +-0.992115 0 -0.125333 -0.992115 0 -0.125333 -0.999123 0 -0.0418757 +-0.999123 0 -0.0418757 -0.999123 0 0.0418757 -0.999123 0 0.0418757 +-0.992115 0 0.125333 -0.992115 0 0.125333 -0.978148 0 0.207912 +-0.978148 0 0.207912 -0.957319 0 0.289032 -0.957319 0 0.289032 +-0.929776 0 0.368125 -0.929776 0 0.368125 -0.895712 0 0.444635 +-0.895712 0 0.444635 -0.855364 0 0.518027 -0.855364 0 0.518027 +-0.809017 0 0.587785 -0.809017 0 0.587785 -0.756995 0 0.653421 +-0.756995 0 0.653421 -0.699663 0 0.714473 -0.699663 0 0.714473 +-0.637424 0 0.770513 -0.637424 0 0.770513 -0.570714 0 0.821149 +-0.570714 0 0.821149 -0.5 0 0.866025 -0.5 0 0.866025 +-0.425779 0 0.904827 -0.425779 0 0.904827 -0.348572 0 0.937282 +-0.348572 0 0.937282 -0.26892 0 0.963163 -0.26892 0 0.963163 +-0.187381 0 0.982287 -0.187381 0 0.982287 -0.104528 0 0.994522 +-0.104528 0 0.994522 -0.0209424 0 0.999781 -0.0209424 0 0.999781 +0.0627905 0 0.998027 0.0627905 0 0.998027 0.146083 0 0.989272 +0.146083 0 0.989272 0.228351 0 0.973579 0.228351 0 0.973579 +0.309017 0 0.951057 0.309017 0 0.951057 0.387516 0 0.921863 +0.387516 0 0.921863 0.463296 0 0.886204 0.463296 0 0.886204 +0.535827 0 0.844328 0.535827 0 0.844328 0.604599 0 0.79653 +0.604599 0 0.79653 0.669131 0 0.743145 0.669131 0 0.743145 +0.728969 0 0.684547 0.728969 0 0.684547 0.783693 0 0.621148 +0.783693 0 0.621148 0.832921 0 0.553392 0.832921 0 0.553392 +0.876307 0 0.481754 0.876307 0 0.481754 0.913545 0 0.406737 +0.913545 0 0.406737 0.944376 0 0.328867 0.944376 0 0.328867 +0.968583 0 0.24869 0.968583 0 0.24869 0.985996 0 0.166769 +0.985996 0 0.166769 0.996493 0 0.0836778 0.996493 0 0.0836778 + +TEXTURE_COORDINATES TCoords 2 float +1 0 1 1 0.973333 0 0.973333 1 0.946667 +0 0.946667 1 0.92 0 0.92 1 0.893333 0 +0.893333 1 0.866667 0 0.866667 1 0.84 0 0.84 +1 0.813333 0 0.813333 1 0.786667 0 0.786667 1 +0.76 0 0.76 1 0.733333 0 0.733333 1 0.706667 +0 0.706667 1 0.68 0 0.68 1 0.653333 0 +0.653333 1 0.626667 0 0.626667 1 0.6 0 0.6 +1 0.573333 0 0.573333 1 0.546667 0 0.546667 1 +0.52 0 0.52 1 0.493333 0 0.493333 1 0.466667 +0 0.466667 1 0.44 0 0.44 1 0.413333 0 +0.413333 1 0.386667 0 0.386667 1 0.36 0 0.36 +1 0.333333 0 0.333333 1 0.306667 0 0.306667 1 +0.28 0 0.28 1 0.253333 0 0.253333 1 0.226667 +0 0.226667 1 0.2 0 0.2 1 0.173333 0 +0.173333 1 0.146667 0 0.146667 1 0.12 0 0.12 +1 0.0933333 0 0.0933333 1 0.0666667 0 0.0666667 1 +0.04 0 0.04 1 0.0133333 0 0.0133333 1 0.0133333 +0 0.0133333 1 0.04 0 0.04 1 0.0666667 0 +0.0666667 1 0.0933333 0 0.0933333 1 0.12 0 0.12 +1 0.146667 0 0.146667 1 0.173333 0 0.173333 1 +0.2 0 0.2 1 0.226667 0 0.226667 1 0.253333 +0 0.253333 1 0.28 0 0.28 1 0.306667 0 +0.306667 1 0.333333 0 0.333333 1 0.36 0 0.36 +1 0.386667 0 0.386667 1 0.413333 0 0.413333 1 +0.44 0 0.44 1 0.466667 0 0.466667 1 0.493333 +0 0.493333 1 0.52 0 0.52 1 0.546667 0 +0.546667 1 0.573333 0 0.573333 1 0.6 0 0.6 +1 0.626667 0 0.626667 1 0.653333 0 0.653333 1 +0.68 0 0.68 1 0.706667 0 0.706667 1 0.733333 +0 0.733333 1 0.76 0 0.76 1 0.786667 0 +0.786667 1 0.813333 0 0.813333 1 0.84 0 0.84 +1 0.866667 0 0.866667 1 0.893333 0 0.893333 1 +0.92 0 0.92 1 0.946667 0 0.946667 1 0.973333 +0 0.973333 1 diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/controlDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..933969693bd640b85f19fe19ec1d31dbb8976c12 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/controlDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application snappyHexMesh; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 100; + +deltaT 1; + +writeControl runTime; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/createPatchDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/createPatchDict new file mode 100644 index 0000000000000000000000000000000000000000..74214eea8634d7de03bbbfcf250bc67b3c28c173 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/createPatchDict @@ -0,0 +1,112 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// This application/dictionary controls: +// - optional: create new patches from boundary faces (either given as +// a set of patches or as a faceSet) +// - always: order faces on coupled patches such that they are opposite. This +// is done for all coupled faces, not just for any patches created. +// - optional: synchronise points on coupled patches. +// - always: remove zero-sized (non-coupled) patches (that were not added) + +// 1. Create cyclic: +// - specify where the faces should come from +// - specify the type of cyclic. If a rotational specify the rotationAxis +// and centre to make matching easier +// - always create both halves in one invocation with correct 'neighbourPatch' +// setting. +// - optionally pointSync true to guarantee points to line up. + +// 2. Correct incorrect cyclic: +// This will usually fail upon loading: +// "face 0 area does not match neighbour 2 by 0.0100005%" +// " -- possible face ordering problem." +// - in polyMesh/boundary file: +// - loosen matchTolerance of all cyclics to get case to load +// - or change patch type from 'cyclic' to 'patch' +// and regenerate cyclic as above + +// Do a synchronisation of coupled points after creation of any patches. +// Note: this does not work with points that are on multiple coupled patches +// with transformations (i.e. cyclics). +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name oversetPatch; + + // Dictionary to construct new patch from + patchInfo + { + type overset; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (otherSide); + + // If constructFrom = set : name of faceSet + set f0; + } + + { + // Name of new patch + name walls; + + // Dictionary to construct new patch from + patchInfo + { + type wall; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (originalPatch); + + // If constructFrom = set : name of faceSet + set f0; + } + + { + // Name of new patch + name frontAndBack; + + // Dictionary to construct new patch from + patchInfo + { + type empty; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (sides); + + // If constructFrom = set : name of faceSet + set f0; + } + +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/extrudeMeshDict b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/extrudeMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..56563f90d3c64d844d711006d571ea548e6cb2ed --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/extrudeMeshDict @@ -0,0 +1,136 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object extrudeMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// What to extrude: +// patch : from patch of another case ('sourceCase') +// mesh : as above but with original case included +// surface : from externally read surface + +//constructFrom mesh; +//constructFrom patch; +constructFrom surface; + +// If construct from patch/mesh: +sourceCase "../cavity"; +sourcePatches (movingWall); + +// If construct from patch: patch to use for back (can be same as sourcePatch) +exposedPatchName movingWall; + +// If construct from surface: +surface "constant/triSurface/cylinder.vtk"; + +// Flip surface normals before usage. Valid only for extrude from surface or +// patch. +flipNormals false; + +//- Linear extrusion in point-normal direction +extrudeModel linearNormal; + +//- Single layer linear extrusion in point-normal direction +// with empty patches on front and back +//extrudeModel plane; + +//- Linear extrusion in specified direction +//extrudeModel linearDirection; + +//- Sector extrusion +//extrudeModel sector; + +//- Wedge extrusion of a single layer +// with wedge patches on front and back +//extrudeModel wedge; + +//- Extrudes into sphere around (0 0 0) +//extrudeModel linearRadial; + +//- Extrudes into sphere around (0 0 0) with specified radii +//extrudeModel radial; + +//- Extrudes into sphere with grading according to pressure (atmospherics) +//extrudeModel sigmaRadial; + +//- Extrudes by interpolating along path inbetween two (topologically identical) +// surfaces (e.g. one is an offsetted version of the other) +//extrudeModel offsetSurface; + +nLayers 10; + +expansionRatio 1.02; + +sectorCoeffs +{ + axisPt (0 0.1 -0.05); + axis (-1 0 0); + angle 360; // For nLayers=1 assume symmetry so angle/2 on each side +} + +linearNormalCoeffs +{ + thickness 0.7; +} + +planeCoeffs +{ +// thickness 0.1; + nLayers 4; +} + +linearDirectionCoeffs +{ + direction (0 1 0); + thickness 0.5; +} + +linearRadialCoeffs +{ + R 0.1; + // Optional inner radius + Rsurface 0.01; +} + +radialCoeffs +{ + // Radii specified through interpolation table + R table ((0 0.01)(3 0.03)(10 0.1)); +} + +sigmaRadialCoeffs +{ + RTbyg 1; + pRef 1; + pStrat 1; +} + +offsetSurfaceCoeffs +{ + // Surface that mesh has been meshed to + baseSurface "$FOAM_CASE/constant/triSurface/DTC-scaled-inflated.obj"; + + // Surface to fill in to + offsetSurface "$FOAM_CASE/constant/triSurface/DTC-scaled.obj"; +} + + +// Do front and back need to be merged? Usually only makes sense for 360 +// degree wedges. +mergeFaces false; + +// Merge small edges. Fraction of bounding box. +mergeTol 0; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/fvSchemes b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..471fef01438ff765e80edd28a33ca36257326dea --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/fvSchemes @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phid,p) Gauss limitedLinear 1; + div(phi,K) Gauss limitedLinear 1; + div(phi,e) Gauss limitedLinear 1; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited corrected 0.5; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/fvSolution b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..852422eb082611e0eff07e48c886b041f90ec37f --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/cylinder/cylinderMesh/system/fvSolution @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v3.0+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-12; + relTol 0; + } + + rho + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0; + } + + "(U|e|k|epsilon|R)" + { + $p; + tolerance 1e-08; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 2; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/U b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..b1fc09c1253446030b3d494d6cac8e7587df6b06 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/U @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + walls + { + //type slip; + type uniformFixedValue; + uniformValue (0 0 0); + } + + hole + { + type movingWallVelocity; + value uniform (0 0 0); + } + +// left1 +// { +// type pressureInletOutletVelocity; +// value uniform (0 0 0); +// } +// left1 +// { +// type fixedValue; +// value $internalField; +// } +// +// right1 +// { +// type zeroGradient; //calculated; +// value $internalField; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/epsilon b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..ca86c9f6e5f794bce43bb0f620ddf2c8a0757a57 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/epsilon @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 200; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type epsilonWallFunction; + value $internalField; + } + +// left1 +// { +// type turbulentMixingLengthDissipationRateInlet; +// mixingLength 0.01; // 1cm - half channel height +// value $internalField; +// } +// +// right1 +// { +// type calculated; +// value $internalField; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/k b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/k new file mode 100644 index 0000000000000000000000000000000000000000..b74e3daf9204195f74070aff7e01c4e9b82c2666 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/k @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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.2; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type kqRWallFunction; + value uniform 0; + } + +// left1 +// { +// type turbulentIntensityKineticEnergyInlet; +// intensity 0.05; // 5% turbulent intensity +// value $internalField; +// } +// +// right1 +// { +// type calculated; +// value $internalField; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/nuTilda b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/nuTilda new file mode 100644 index 0000000000000000000000000000000000000000..11af85939e95ae19c4ff70184c6d0a0bf1592ea2 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/nuTilda @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/nut b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/nut new file mode 100644 index 0000000000000000000000000000000000000000..f7c72d5ce2a237bca73e6baa27fb0137299e6f90 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/nut @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type nutkWallFunction; + value uniform 0; + } + +// left1 +// { +// type calculated; +// value uniform 0; +// } +// +// right1 +// { +// type calculated; +// value uniform 0; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/p b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/p new file mode 100644 index 0000000000000000000000000000000000000000..55e4c8b692e70fd3704ce613937696f668dd05aa --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/p @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type zeroGradient; + } + +// left1 +// { +// type uniformTotalPressure; +// pressure table +// ( +// (0 10) +// (1 40) +// ); +// p0 40; // only used for restarts +// U U; +// phi phi; +// rho none; +// psi none; +// gamma 1; +// value uniform 40; +// } +// left1 +// { +// type zeroGradient; +// } +// +// right1 +// { +// type fixedValue; //calculated; +// value $internalField; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/pointDisplacement b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..fe072121d3596a6fdafc874ab5d3b0602cb2b812 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/pointDisplacement @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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); + } + + overset + { + patchType overset; + type zeroGradient; + } + + hole + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/zoneID b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..acef7b1a3df189cfd99864270c1d8c2ebaf23b7e --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/0.org/zoneID @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + ".*" + { + type zeroGradient; + } + + overset + { + type overset; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allclean b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..5d96ca404a377af449d1ab8d37d88228ed684c37 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allclean @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID +rm -f constant/cellInterpolationWeight + +rm -rf 0 + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allrun b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9edfe26c89a981968bfd62c943c0e6101c8f84df --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allrun @@ -0,0 +1,6 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +runApplication overPimpleDyMFoam diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allrun.pre b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..a6ddc21dbe92a81870789d392a5eb867dd225484 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/Allrun.pre @@ -0,0 +1,19 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +# Select cellSets +runApplication topoSet + +runApplication subsetMesh box -patch hole -overwrite + +# Select cellSets +rm log.topoSet + +runApplication topoSet + +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/RASProperties b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..ec34b4c47c9337ec43bf17be3ed09869d5783bbb --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/RASProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel laminar; //kEpsilon; + +turbulence off; //on; + +printCoeffs off; //on; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/dynamicMeshDict b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..951bd08dae553adda1bbe65b1f91e5c0dc0f9a2e --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/dynamicMeshDict @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +// layerRelax 0.3; +} + +//motionSolverLibs ( "libfvMotionSolvers.so" ); +// +//solver displacementLaplacian; +// +//displacementLaplacianCoeffs +//{ +// diffusivity uniform 1; +//} + +solver multiSolidBodyMotionSolver; + +multiSolidBodyMotionSolverCoeffs +{ + movingZone + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0.005 0.005 0.005); + axis (0 0 1); + omega 100.0; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/transportProperties b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..4efbc8b932532edc97f57592c725b47fc68e60dc --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/transportProperties @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DT DT [ 0 2 -1 0 0 0 0 ] 1; //4e-05; + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/turbulenceProperties b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..c1f1b1a8341789b7a044cd077a981fcb02388fb9 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/constant/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; //RASModel; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/blockMeshDict b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..7e5a21da5f53e67d393bb9c85279dc96e0fbfb36 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/blockMeshDict @@ -0,0 +1,97 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.01; + +vertices +( + ( 0.00 0.0 0) + ( 1.00 0.0 0) + ( 1.00 1.0 0) + ( 0.00 1.0 0) + ( 0.00 0.0 1) + ( 1.00 0.0 1) + ( 1.00 1.0 1) + ( 0.00 1.0 1) + + ( 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) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (36 36 1) simpleGrading (1 1 1) + + hex (8 9 10 11 12 13 14 15) movingZone (28 12 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + overset2 + { + type overset; + faces + ( + ( 8 12 15 11) + (10 14 13 9) + (11 15 14 10) + ( 9 13 12 8) + ); + } + + walls + { + type wall; + faces + ( + (3 7 6 2) + (1 5 4 0) + (0 4 7 3) + (2 6 5 1) + ); + } + + // Populated by subsetMesh + hole + { + type wall; + faces (); + } + + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ( 8 11 10 9) + (12 13 14 15) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/controlDict b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..d9178735a16b72c85c2f437093ffdd7b46528ffa --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/controlDict @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("liboverset.so"); + +application overPimpleDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.1; + +deltaT 0.00025; + +//writeControl timeStep; +//writeInterval 10; + +writeControl adjustableRunTime; +writeInterval 0.01; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 1; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/decomposeParDict b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..805c936e8773880bddf85bd0205c77016d84652e --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/decomposeParDict @@ -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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 3; + +method hierarchical; + +hierarchicalCoeffs +{ + n (3 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/fvSchemes b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..067d2aa43b653b92e6a3b56a71762fdf2ead6125 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/fvSchemes @@ -0,0 +1,69 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,R) Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) Gauss limitedLinear 1; + div((nuEff*dev(T(grad(U))))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; + laplacian(diffusivity,cellDisplacement) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +oversetInterpolation +{ + method inverseDistance; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/fvSolution b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..464100d29a48d92aebc667015044d10bb5012800 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/fvSolution @@ -0,0 +1,96 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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; + } + + p + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } + + pFinal + { + $p; + } + + pcorr + { + $p; + solver PCG; + preconditioner DIC; + } + + 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 no; + correctPhi no; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + + ddtCorr false; + + pRefPoint (0.0001 0.0001 0.001); + pRefValue 0.0; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/setFieldsDict b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..21c7adb08ee536245f8181d5e0c3ea4a1c69ef4b --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/setFieldsDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 + ); + } + +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/topoSetDict b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..4b0957e28897ff620f21d7de94d7806bf6cc1930 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/simpleRotor/system/topoSetDict @@ -0,0 +1,78 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 regionToCell; + 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; + } + + // Select box to remove from region 1 + + { + name box; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c1; + } + } + + { + name box; + type cellSet; + action subset; + source boxToCell; + sourceInfo + { + box (0.0025 0.0045 -100)(0.0075 0.0055 100); + } + } + + { + name box; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/U b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..b1fc09c1253446030b3d494d6cac8e7587df6b06 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/U @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + walls + { + //type slip; + type uniformFixedValue; + uniformValue (0 0 0); + } + + hole + { + type movingWallVelocity; + value uniform (0 0 0); + } + +// left1 +// { +// type pressureInletOutletVelocity; +// value uniform (0 0 0); +// } +// left1 +// { +// type fixedValue; +// value $internalField; +// } +// +// right1 +// { +// type zeroGradient; //calculated; +// value $internalField; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/p b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/p new file mode 100644 index 0000000000000000000000000000000000000000..55e4c8b692e70fd3704ce613937696f668dd05aa --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/p @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + "(walls|hole)" + { + type zeroGradient; + } + +// left1 +// { +// type uniformTotalPressure; +// pressure table +// ( +// (0 10) +// (1 40) +// ); +// p0 40; // only used for restarts +// U U; +// phi phi; +// rho none; +// psi none; +// gamma 1; +// value uniform 40; +// } +// left1 +// { +// type zeroGradient; +// } +// +// right1 +// { +// type fixedValue; //calculated; +// value $internalField; +// } + + overset + { + type overset; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/pointDisplacement b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..b218758016cb03dcd23b9ff48dd3a1083382fe09 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/pointDisplacement @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/zoneID b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..b1cdf0478edf426f139d3787f383622392116388 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/0.org/zoneID @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + overset + { + type overset; + } + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allclean b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..5d96ca404a377af449d1ab8d37d88228ed684c37 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allclean @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID +rm -f constant/cellInterpolationWeight + +rm -rf 0 + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allrun b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..ea6d08a994b481478dbd721befd3c74248a2e517 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allrun @@ -0,0 +1,14 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +# Get application directory +application=`getApplication` + +# Serial +#runApplication $application + +# Parallel +runApplication decomposePar -cellDist +runParallel $application diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allrun.pre b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..19f634cd43d762e8b646823709e508bdf74e0254 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/Allrun.pre @@ -0,0 +1,17 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +# Select cellSets +runApplication -s 1 topoSet + +runApplication subsetMesh box -patch hole -overwrite + +# Select cellSets +runApplication -s 2 topoSet + +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/README.txt b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb98b26f8d7b0f7275069a25a70ad38373c539e0 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/README.txt @@ -0,0 +1,3 @@ +Transient, moving mesh +---------------------- +Two turning rotors diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/dynamicMeshDict b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..391eb516eadea7f512c1d2ac86cbd08d32610f02 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/dynamicMeshDict @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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 100.0; + } + } + + movingZone2 + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0.009 0.005 0.005); + axis (0 0 1); + omega -100.0; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/transportProperties b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..ab4d80f3308998e0e117975999c9c099ea329ee3 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/transportProperties @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/turbulenceProperties b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..9abf14eeecd195a74b7b95b2cb31c43de9be98fd --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/constant/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/blockMeshDict b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..5456fdbf9c0fc16d1c93c234c526060952e4a4d1 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/blockMeshDict @@ -0,0 +1,140 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 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 + ( 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) (73 37 1) simpleGrading (1 1 1) + + hex (8 9 10 11 12 13 14 15) movingZone1 (28 12 1) simpleGrading (1 1 1) + + hex (16 17 18 19 20 21 22 23) movingZone2 (12 28 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) + (0 4 7 3) + (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/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/controlDict b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..591998cc3f6efb23ec6dcde048b8ae6a763428ee --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/controlDict @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("liboverset.so"); + +application overPimpleDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.06; + +deltaT 0.00025; + +writeControl adjustableRunTime; + +writeInterval 0.005; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 1; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/decomposeParDict b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..2e73b80199c46efa6acc5a8a33e9c5fbb6c397b8 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/decomposeParDict @@ -0,0 +1,30 @@ +/*--------------------------------*- 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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 3; + + +method hierarchical; + +hierarchicalCoeffs +{ + n (3 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/fvSchemes b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..4e18294c71a39b32cbddff48c54b33a2be3668d7 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/fvSchemes @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,R) Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) Gauss limitedLinear 1; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; + laplacian(diffusivity,cellDisplacement) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +oversetInterpolation +{ + method inverseDistance; +} + +fluxRequired +{ + default no; + pcorr ; + p ; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/fvSolution b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..464100d29a48d92aebc667015044d10bb5012800 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/fvSolution @@ -0,0 +1,96 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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; + } + + p + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } + + pFinal + { + $p; + } + + pcorr + { + $p; + solver PCG; + preconditioner DIC; + } + + 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 no; + correctPhi no; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + + ddtCorr false; + + pRefPoint (0.0001 0.0001 0.001); + pRefValue 0.0; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/setFieldsDict b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..b3f3729fe8b33e85c96623b48846321965e8a632 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/setFieldsDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/topoSetDict b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..db08fe53b5dcdc5046c157b5bebef64f2f00c6e4 --- /dev/null +++ b/tutorials/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/topoSetDict @@ -0,0 +1,116 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / 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.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) + ); + } + } + + { + name box; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/Allclean b/tutorials/incompressible/overSimpleFoam/aeroFoil/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..10394c3ebe5c48d5d04b411bc73f36a004e457d8 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/Allclean @@ -0,0 +1,20 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cd aeroFoil_snappyHexMesh +cleanCase + +cd ../aeroFoil_overset +cleanCase +rm -rf 0 + +cd ../background_snappyHexMesh +cleanCase + + +cd ../background_overset +cleanCase +./Allclean diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/Allrun b/tutorials/incompressible/overSimpleFoam/aeroFoil/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..728e17019da744562ece4cd5457526eb14e05a03 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/Allrun @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + + +./Allrun.pre +cd background_overset +./Allrun diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/Allrun.pre b/tutorials/incompressible/overSimpleFoam/aeroFoil/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..6b300fc25ac75e76329f4f5920b0ef8899f64393 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/Allrun.pre @@ -0,0 +1,12 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# create aeroFoil mesh using snappyHexMesh +(cd aeroFoil_snappyHexMesh && ./Allrun.pre) + +# Extrude mesh +(cd aeroFoil_overset && ./Allrun.pre) + +(cd background_snappyHexMesh && ./Allrun.pre) + +(cd background_overset && ./Allrun.pre) diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/README.txt b/tutorials/incompressible/overSimpleFoam/aeroFoil/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..c77aeeff8ac5291875c5b06179d53b4fa4fc05dd --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/README.txt @@ -0,0 +1,14 @@ +Steady state, steady mesh +------------------------- + +aeroFoil_snappyHexMesh/ + For generating (3D) mesh for background + +aeroFoil_overset/ + Extruding into 2D + +background_snappyHexMesh/ + For generating (3D) mesh for background + +background_overset/ + Combined mesh for running diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/Allrun.pre b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..98a5ce71db08425b6cbc48f990bc0ddb6396ac82 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/Allrun.pre @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + + +# Make a 2D mesh by extruding a patch and solve to steady state. +runApplication extrudeMesh +runApplication createPatch -overwrite diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/constant/transportProperties b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..9531534e980a766766f8423e71c23eda5857bc93 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/constant/transportProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- 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 transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu [0 2 -1 0 0 0 0] 1e-05; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/constant/turbulenceProperties b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..7b102c0acca6d60d8a3472caab1249d8043034c8 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/constant/turbulenceProperties @@ -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 turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kOmegaSST; + + turbulence on; + + printCoeffs on; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/controlDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..6e5ca5c1c57a348167f7335fb4a53bae065a87a8 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/controlDict @@ -0,0 +1,65 @@ +/*--------------------------------*- 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 controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 3000; + +deltaT 1; + +writeControl runTime; + +writeInterval 100; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +functions +{ + forces + { + type forces; + functionObjectLibs ( "libforces.so" ); + outputControl timeStep; + outputInterval 10; + patches (wing); + pName p; + UName U; + rhoName rhoInf; + log true; + rhoInf 1; + CofR (0.4974612746 -0.01671895744 0.125); + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/createPatchDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/createPatchDict new file mode 100644 index 0000000000000000000000000000000000000000..89853b13d6e1a369ae906df47570e9d1c9882998 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/createPatchDict @@ -0,0 +1,86 @@ +/*--------------------------------*- 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 createPatchDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Do a synchronisation of coupled points after creation of any patches. +// Note: this does not work with points that are on multiple coupled patches +// with transformations (i.e. cyclics). +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name oversetPatch; + + // Dictionary to construct new patch from + patchInfo + { + type overset; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (inlet outlet topAndBottom); + + // If constructFrom = set : name of faceSet + set f0; + } + + { + // Name of new patch + name walls; + + // Dictionary to construct new patch from + patchInfo + { + type wall; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (wing); + + // If constructFrom = set : name of faceSet + set f0; + } + { + // Name of new patch + name frontAndBack; + + // Dictionary to construct new patch from + patchInfo + { + type empty; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (symFront symBack); + + // If constructFrom = set : name of faceSet + set f0; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/extrudeMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/extrudeMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..2e735d7479822c45a5589ae2a11ca6d708550533 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/extrudeMeshDict @@ -0,0 +1,52 @@ +/*--------------------------------*- 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 extrudeMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// What to extrude: +// patch : from patch of another case ('sourceCase') +// mesh : as above but with original case included +// surface : from externally read surface + +constructFrom patch; +sourceCase "../aeroFoil_snappyHexMesh"; +sourcePatches (symFront); + +// If construct from patch: patch to use for back (can be same as sourcePatch) +exposedPatchName symBack; + +// Flip surface normals before usage. Valid only for extrude from surface or +// patch. +flipNormals false; + +//- Linear extrusion in point-normal direction +extrudeModel linearNormal; + +nLayers 1; + +expansionRatio 1.0; + +linearNormalCoeffs +{ + thickness 0.05; +} + +// Do front and back need to be merged? Usually only makes sense for 360 +// degree wedges. +mergeFaces false; //true; + +// Merge small edges. Fraction of bounding box. +mergeTol 0; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/fvSchemes b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..089b2c5116d8594c572369088e4ff94862de346e --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/fvSchemes @@ -0,0 +1,58 @@ +/*--------------------------------*- 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 steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; + grad(U) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss linearUpwind grad(U); + div(phi,k) bounded Gauss upwind; + div(phi,omega) bounded Gauss upwind; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +wallDist +{ + method meshWave; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/fvSolution b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..015f39e4ade355dbcfd904129f2c79c69e2e5980 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_overset/system/fvSolution @@ -0,0 +1,77 @@ +/*--------------------------------*- 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 +{ + p + { + solver PBiCGStab; + preconditioner DILU; + relTol 0.1; + } + + U + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0.1; + nSweeps 1; + } + + k + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0.1; + nSweeps 1; + } + + omega + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0.1; + nSweeps 1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + fields + { + p 0.3; + } + equations + { + "(U|k|omega)" 0.7; + "(U|k|omega)Final" 1.0; + } +} + +cache +{ + grad(U); +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/Allrun.pre b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..fdfb7e78d160a43240dc6c41147c4f384d6d1167 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/Allrun.pre @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Make 3D mesh in slab of cells. +runApplication blockMesh +runApplication snappyHexMesh -overwrite diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/constant/triSurface/wing_5degrees.obj b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/constant/triSurface/wing_5degrees.obj new file mode 100644 index 0000000000000000000000000000000000000000..4be2aac5f2f0b963d2ec6208458908df4fd04c50 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/constant/triSurface/wing_5degrees.obj @@ -0,0 +1,1054 @@ +# Wavefront OBJ file written 2010-05-13T09:12:43 +o wing_5degrees + +# points : 520 +# faces : 520 +# zones : 1 +# 0 WALL10 (nFaces: 520) + +# <points count="520"> +v 1.00488 -0.0890722 -0.5 +v 1.00488 -0.0890722 0.5 +v 0.999453 -0.0870827 0.5 +v 0.999453 -0.0870827 -0.5 +v 0.993747 -0.0849908 0.5 +v 0.993747 -0.0849908 -0.5 +v 0.98776 -0.0827959 0.5 +v 0.98776 -0.0827959 -0.5 +v 0.981475 -0.0804834 0.5 +v 0.981475 -0.0804834 -0.5 +v 0.974878 -0.0780483 0.5 +v 0.974878 -0.0780483 -0.5 +v 0.967936 -0.075535 0.5 +v 0.967936 -0.075535 -0.5 +v 0.960671 -0.0728297 0.5 +v 0.960671 -0.0728297 -0.5 +v 0.952986 -0.070149 0.5 +v 0.952986 -0.070149 -0.5 +v 0.944915 -0.067332 0.5 +v 0.944915 -0.067332 -0.5 +v 0.936442 -0.064377 0.5 +v 0.936442 -0.064377 -0.5 +v 0.927543 -0.0612777 0.5 +v 0.927543 -0.0612777 -0.5 +v 0.918171 -0.0581074 0.5 +v 0.918171 -0.0581074 -0.5 +v 0.908345 -0.0547308 0.5 +v 0.908345 -0.0547308 -0.5 +v 0.897978 -0.0513371 0.5 +v 0.897978 -0.0513371 -0.5 +v 0.887113 -0.0477115 0.5 +v 0.887113 -0.0477115 -0.5 +v 0.875671 -0.0440076 0.5 +v 0.875671 -0.0440076 -0.5 +v 0.863634 -0.0401898 0.5 +v 0.863634 -0.0401898 -0.5 +v 0.850988 -0.0362043 0.5 +v 0.850988 -0.0362043 -0.5 +v 0.837677 -0.0321259 0.5 +v 0.837677 -0.0321259 -0.5 +v 0.8237 -0.0278406 0.5 +v 0.8237 -0.0278406 -0.5 +v 0.808997 -0.0234314 0.5 +v 0.808997 -0.0234314 -0.5 +v 0.793536 -0.0188824 0.5 +v 0.793536 -0.0188824 -0.5 +v 0.777248 -0.0142896 0.5 +v 0.777248 -0.0142896 -0.5 +v 0.760144 -0.00947585 0.5 +v 0.760144 -0.00947585 -0.5 +v 0.742148 -0.0045544 0.5 +v 0.742148 -0.0045544 -0.5 +v 0.723207 0.000449948 0.5 +v 0.723207 0.000449948 -0.5 +v 0.703296 0.00561154 0.5 +v 0.703296 0.00561154 -0.5 +v 0.682345 0.010854 0.5 +v 0.682345 0.010854 -0.5 +v 0.660295 0.0161554 0.5 +v 0.660295 0.0161554 -0.5 +v 0.637103 0.0215548 0.5 +v 0.637103 0.0215548 -0.5 +v 0.606829 0.0282606 0.5 +v 0.606829 0.0282606 -0.5 +v 0.578018 0.0343978 0.5 +v 0.578018 0.0343978 -0.5 +v 0.550557 0.0397874 0.5 +v 0.550557 0.0397874 -0.5 +v 0.524436 0.0447356 0.5 +v 0.524436 0.0447356 -0.5 +v 0.499549 0.0490421 0.5 +v 0.499549 0.0490421 -0.5 +v 0.475869 0.05291 0.5 +v 0.475869 0.05291 -0.5 +v 0.45334 0.0563729 0.5 +v 0.45334 0.0563729 -0.5 +v 0.431911 0.059484 0.5 +v 0.431911 0.059484 -0.5 +v 0.411518 0.0621876 0.5 +v 0.411518 0.0621876 -0.5 +v 0.392118 0.0645445 0.5 +v 0.392118 0.0645445 -0.5 +v 0.373644 0.0664046 0.5 +v 0.373644 0.0664046 -0.5 +v 0.356081 0.0680196 0.5 +v 0.356081 0.0680196 -0.5 +v 0.339375 0.0692961 0.5 +v 0.339375 0.0692961 -0.5 +v 0.323487 0.0702815 0.5 +v 0.323487 0.0702815 -0.5 +v 0.308383 0.0710035 0.5 +v 0.308383 0.0710035 -0.5 +v 0.294024 0.0714698 0.5 +v 0.294024 0.0714698 -0.5 +v 0.28038 0.0717809 0.5 +v 0.28038 0.0717809 -0.5 +v 0.267416 0.0719191 0.5 +v 0.267416 0.0719191 -0.5 +v 0.255099 0.0718222 0.5 +v 0.255099 0.0718222 -0.5 +v 0.243399 0.0716511 0.5 +v 0.243399 0.0716511 -0.5 +v 0.232288 0.0713208 0.5 +v 0.232288 0.0713208 -0.5 +v 0.221735 0.0709249 0.5 +v 0.221735 0.0709249 -0.5 +v 0.211715 0.0704338 0.5 +v 0.211715 0.0704338 -0.5 +v 0.202202 0.0698513 0.5 +v 0.202202 0.0698513 -0.5 +v 0.19317 0.0692271 0.5 +v 0.19317 0.0692271 -0.5 +v 0.184599 0.0685108 0.5 +v 0.184599 0.0685108 -0.5 +v 0.176464 0.0677409 0.5 +v 0.176464 0.0677409 -0.5 +v 0.168741 0.0669472 0.5 +v 0.168741 0.0669472 -0.5 +v 0.161418 0.0660755 0.5 +v 0.161418 0.0660755 -0.5 +v 0.154469 0.0651852 0.5 +v 0.154469 0.0651852 -0.5 +v 0.145493 0.0640314 0.5 +v 0.145493 0.0640314 -0.5 +v 0.136995 0.0627463 0.5 +v 0.136995 0.0627463 -0.5 +v 0.128932 0.0614383 0.5 +v 0.128932 0.0614383 -0.5 +v 0.121282 0.0601525 0.5 +v 0.121282 0.0601525 -0.5 +v 0.114049 0.0587416 0.5 +v 0.114049 0.0587416 -0.5 +v 0.107186 0.0573482 0.5 +v 0.107186 0.0573482 -0.5 +v 0.100675 0.0559871 0.5 +v 0.100675 0.0559871 -0.5 +v 0.0945147 0.0545794 0.5 +v 0.0945147 0.0545794 -0.5 +v 0.0886858 0.0531426 0.5 +v 0.0886858 0.0531426 -0.5 +v 0.0831659 0.0517083 0.5 +v 0.0831659 0.0517083 -0.5 +v 0.0779342 0.0503006 0.5 +v 0.0779342 0.0503006 -0.5 +v 0.072975 0.0489224 0.5 +v 0.072975 0.0489224 -0.5 +v 0.0682798 0.0475559 0.5 +v 0.0682798 0.0475559 -0.5 +v 0.0638499 0.0461601 0.5 +v 0.0638499 0.0461601 -0.5 +v 0.0596656 0.0447577 0.5 +v 0.0596656 0.0447577 -0.5 +v 0.055694 0.0434126 0.5 +v 0.055694 0.0434126 -0.5 +v 0.0519364 0.0420932 0.5 +v 0.0519364 0.0420932 -0.5 +v 0.0484053 0.0407363 0.5 +v 0.0484053 0.0407363 -0.5 +v 0.0450779 0.0393756 0.5 +v 0.0450779 0.0393756 -0.5 +v 0.0419215 0.0380722 0.5 +v 0.0419215 0.0380722 -0.5 +v 0.0389288 0.0368211 0.5 +v 0.0389288 0.0368211 -0.5 +v 0.036102 0.0355928 0.5 +v 0.036102 0.0355928 -0.5 +v 0.0334425 0.034368 0.5 +v 0.0334425 0.034368 -0.5 +v 0.0309496 0.0331356 0.5 +v 0.0309496 0.0331356 -0.5 +v 0.0286117 0.0319047 0.5 +v 0.0286117 0.0319047 -0.5 +v 0.0264077 0.0307022 0.5 +v 0.0264077 0.0307022 -0.5 +v 0.0243248 0.02954 0.5 +v 0.0243248 0.02954 -0.5 +v 0.0223665 0.0284014 0.5 +v 0.0223665 0.0284014 -0.5 +v 0.0205353 0.0272716 0.5 +v 0.0205353 0.0272716 -0.5 +v 0.0188204 0.0261581 0.5 +v 0.0188204 0.0261581 -0.5 +v 0.0172057 0.0250781 0.5 +v 0.0172057 0.0250781 -0.5 +v 0.015681 0.0240389 0.5 +v 0.015681 0.0240389 -0.5 +v 0.0142472 0.0230307 0.5 +v 0.0142472 0.0230307 -0.5 +v 0.0129051 0.0220434 0.5 +v 0.0129051 0.0220434 -0.5 +v 0.0116567 0.0210699 0.5 +v 0.0116567 0.0210699 -0.5 +v 0.0105044 0.0201047 0.5 +v 0.0105044 0.0201047 -0.5 +v 0.00944864 0.0191444 0.5 +v 0.00944864 0.0191444 -0.5 +v 0.00847997 0.0181956 0.5 +v 0.00847997 0.0181956 -0.5 +v 0.00758214 0.0172702 0.5 +v 0.00758214 0.0172702 -0.5 +v 0.00674204 0.0163779 0.5 +v 0.00674204 0.0163779 -0.5 +v 0.00595671 0.0155186 0.5 +v 0.00595671 0.0155186 -0.5 +v 0.00523198 0.0146848 0.5 +v 0.00523198 0.0146848 -0.5 +v 0.00457157 0.0138701 0.5 +v 0.00457157 0.0138701 -0.5 +v 0.00397503 0.0130721 0.5 +v 0.00397503 0.0130721 -0.5 +v 0.00343506 0.0122936 0.5 +v 0.00343506 0.0122936 -0.5 +v 0.0029443 0.0115379 0.5 +v 0.0029443 0.0115379 -0.5 +v 0.0024965 0.010807 0.5 +v 0.0024965 0.010807 -0.5 +v 0.00209053 0.0101012 0.5 +v 0.00209053 0.0101012 -0.5 +v 0.00172938 0.00941821 0.5 +v 0.00172938 0.00941821 -0.5 +v 0.00141481 0.00875662 0.5 +v 0.00141481 0.00875662 -0.5 +v 0.00114703 0.00811509 0.5 +v 0.00114703 0.00811509 -0.5 +v 0.000922634 0.00749375 0.5 +v 0.000922634 0.00749375 -0.5 +v 0.00073432 0.00689421 0.5 +v 0.00073432 0.00689421 -0.5 +v 0.000575606 0.00631745 0.5 +v 0.000575606 0.00631745 -0.5 +v 0.000441178 0.00576428 0.5 +v 0.000441178 0.00576428 -0.5 +v 0.000326628 0.00523494 0.5 +v 0.000326628 0.00523494 -0.5 +v 0.000229331 0.00472926 0.5 +v 0.000229331 0.00472926 -0.5 +v 0.000147968 0.00424663 0.5 +v 0.000147968 0.00424663 -0.5 +v 8.13071e-05 0.00378656 0.5 +v 8.13071e-05 0.00378656 -0.5 +v 2.81186e-05 0.00334838 0.5 +v 2.81186e-05 0.00334838 -0.5 +v -1.28053e-05 0.00293132 0.5 +v -1.28053e-05 0.00293132 -0.5 +v -4.26138e-05 0.00253464 0.5 +v -4.26138e-05 0.00253464 -0.5 +v -6.24104e-05 0.00215753 0.5 +v -6.24104e-05 0.00215753 -0.5 +v -7.32354e-05 0.00179922 0.5 +v -7.32354e-05 0.00179922 -0.5 +v -7.6066e-05 0.00145891 0.5 +v -7.6066e-05 0.00145891 -0.5 +v -7.18149e-05 0.00113574 0.5 +v -7.18149e-05 0.00113574 -0.5 +v -6.13265e-05 0.000828962 0.5 +v -6.13265e-05 0.000828962 -0.5 +v -4.5388e-05 0.000537894 0.5 +v -4.5388e-05 0.000537894 -0.5 +v -2.47174e-05 0.000261729 0.5 +v -2.47174e-05 0.000261729 -0.5 +v 0.999428 -0.0886333 -0.5 +v 0.999428 -0.0886333 0.5 +v 0 0 0.5 +v 0 0 -0.5 +v 3.07731e-05 -0.000269468 0.5 +v 3.07731e-05 -0.000269468 -0.5 +v 6.87839e-05 -0.000551758 0.5 +v 6.87839e-05 -0.000551758 -0.5 +v 0.00011487 -0.000847395 0.5 +v 0.00011487 -0.000847395 -0.5 +v 0.000169958 -0.00115699 0.5 +v 0.000169958 -0.00115699 -0.5 +v 0.000235006 -0.00148084 0.5 +v 0.000235006 -0.00148084 -0.5 +v 0.000311085 -0.00181947 0.5 +v 0.000311085 -0.00181947 -0.5 +v 0.000399343 -0.00217329 0.5 +v 0.000399343 -0.00217329 -0.5 +v 0.000501006 -0.00254265 0.5 +v 0.000501006 -0.00254265 -0.5 +v 0.000617405 -0.00292793 0.5 +v 0.000617405 -0.00292793 -0.5 +v 0.000749918 -0.00332928 0.5 +v 0.000749918 -0.00332928 -0.5 +v 0.000900098 -0.00374706 0.5 +v 0.000900098 -0.00374706 -0.5 +v 0.00106951 -0.00418123 0.5 +v 0.00106951 -0.00418123 -0.5 +v 0.00125981 -0.00463173 0.5 +v 0.00125981 -0.00463173 -0.5 +v 0.00147278 -0.00509836 0.5 +v 0.00147278 -0.00509836 -0.5 +v 0.00171023 -0.00558073 0.5 +v 0.00171023 -0.00558073 -0.5 +v 0.0019741 -0.00607866 0.5 +v 0.0019741 -0.00607866 -0.5 +v 0.00226657 -0.00659235 0.5 +v 0.00226657 -0.00659235 -0.5 +v 0.00258985 -0.00712192 0.5 +v 0.00258985 -0.00712192 -0.5 +v 0.00294625 -0.00766749 0.5 +v 0.00294625 -0.00766749 -0.5 +v 0.0033381 -0.00822888 0.5 +v 0.0033381 -0.00822888 -0.5 +v 0.00376858 -0.00880495 0.5 +v 0.00376858 -0.00880495 -0.5 +v 0.00424144 -0.00939356 0.5 +v 0.00424144 -0.00939356 -0.5 +v 0.0047608 -0.00999197 0.5 +v 0.0047608 -0.00999197 -0.5 +v 0.00533108 -0.0105969 0.5 +v 0.00533108 -0.0105969 -0.5 +v 0.00595465 -0.0112076 0.5 +v 0.00595465 -0.0112076 -0.5 +v 0.00663108 -0.0118268 0.5 +v 0.00663108 -0.0118268 -0.5 +v 0.00735864 -0.0124589 0.5 +v 0.00735864 -0.0124589 -0.5 +v 0.00813479 -0.0131082 0.5 +v 0.00813479 -0.0131082 -0.5 +v 0.00896315 -0.0137726 0.5 +v 0.00896315 -0.0137726 -0.5 +v 0.00985143 -0.0144449 0.5 +v 0.00985143 -0.0144449 -0.5 +v 0.0108089 -0.0151156 0.5 +v 0.0108089 -0.0151156 -0.5 +v 0.0118417 -0.0157801 0.5 +v 0.0118417 -0.0157801 -0.5 +v 0.0129485 -0.0164439 0.5 +v 0.0129485 -0.0164439 -0.5 +v 0.0141258 -0.0171158 0.5 +v 0.0141258 -0.0171158 -0.5 +v 0.0153717 -0.0178024 0.5 +v 0.0153717 -0.0178024 -0.5 +v 0.0166914 -0.0185005 0.5 +v 0.0166914 -0.0185005 -0.5 +v 0.0180921 -0.0192037 0.5 +v 0.0180921 -0.0192037 -0.5 +v 0.01958 -0.019908 0.5 +v 0.01958 -0.019908 -0.5 +v 0.0211576 -0.0206151 0.5 +v 0.0211576 -0.0206151 -0.5 +v 0.0228265 -0.0213288 0.5 +v 0.0228265 -0.0213288 -0.5 +v 0.0245895 -0.0220523 0.5 +v 0.0245895 -0.0220523 -0.5 +v 0.0264506 -0.0227868 0.5 +v 0.0264506 -0.0227868 -0.5 +v 0.028415 -0.0235332 0.5 +v 0.028415 -0.0235332 -0.5 +v 0.0304905 -0.0242814 0.5 +v 0.0304905 -0.0242814 -0.5 +v 0.0326872 -0.0250146 0.5 +v 0.0326872 -0.0250146 -0.5 +v 0.0350128 -0.0257258 0.5 +v 0.0350128 -0.0257258 -0.5 +v 0.0374672 -0.0264333 0.5 +v 0.0374672 -0.0264333 -0.5 +v 0.0400497 -0.0271566 0.5 +v 0.0400497 -0.0271566 -0.5 +v 0.0427704 -0.0278802 0.5 +v 0.0427704 -0.0278802 -0.5 +v 0.0456434 -0.0285739 0.5 +v 0.0456434 -0.0285739 -0.5 +v 0.0486731 -0.0292495 0.5 +v 0.0486731 -0.0292495 -0.5 +v 0.0518554 -0.0299566 0.5 +v 0.0518554 -0.0299566 -0.5 +v 0.0551966 -0.030697 0.5 +v 0.0551966 -0.030697 -0.5 +v 0.0587179 -0.0314085 0.5 +v 0.0587179 -0.0314085 -0.5 +v 0.062431 -0.032078 0.5 +v 0.062431 -0.032078 -0.5 +v 0.0663314 -0.0327743 0.5 +v 0.0663314 -0.0327743 -0.5 +v 0.0704248 -0.033514 0.5 +v 0.0704248 -0.033514 -0.5 +v 0.0747335 -0.0342256 0.5 +v 0.0747335 -0.0342256 -0.5 +v 0.0792714 -0.0348902 0.5 +v 0.0792714 -0.0348902 -0.5 +v 0.0840416 -0.0355492 0.5 +v 0.0840416 -0.0355492 -0.5 +v 0.089054 -0.0362103 0.5 +v 0.089054 -0.0362103 -0.5 +v 0.0943226 -0.0368627 0.5 +v 0.0943226 -0.0368627 -0.5 +v 0.0998603 -0.0375041 0.5 +v 0.0998603 -0.0375041 -0.5 +v 0.105679 -0.0381355 0.5 +v 0.105679 -0.0381355 -0.5 +v 0.111793 -0.0387575 0.5 +v 0.111793 -0.0387575 -0.5 +v 0.118218 -0.0393567 0.5 +v 0.118218 -0.0393567 -0.5 +v 0.124968 -0.0399429 0.5 +v 0.124968 -0.0399429 -0.5 +v 0.132055 -0.0405782 0.5 +v 0.132055 -0.0405782 -0.5 +v 0.1395 -0.0411771 0.5 +v 0.1395 -0.0411771 -0.5 +v 0.147326 -0.041699 0.5 +v 0.147326 -0.041699 -0.5 +v 0.15451 -0.0421969 0.5 +v 0.15451 -0.0421969 -0.5 +v 0.162054 -0.042698 0.5 +v 0.162054 -0.042698 -0.5 +v 0.16998 -0.0431596 0.5 +v 0.16998 -0.0431596 -0.5 +v 0.178305 -0.0435984 0.5 +v 0.178305 -0.0435984 -0.5 +v 0.187045 -0.0440696 0.5 +v 0.187045 -0.0440696 -0.5 +v 0.196223 -0.0445349 0.5 +v 0.196223 -0.0445349 -0.5 +v 0.205864 -0.0449725 0.5 +v 0.205864 -0.0449725 -0.5 +v 0.215985 -0.045448 0.5 +v 0.215985 -0.045448 -0.5 +v 0.226615 -0.0458797 0.5 +v 0.226615 -0.0458797 -0.5 +v 0.237778 -0.0463184 0.5 +v 0.237778 -0.0463184 -0.5 +v 0.249497 -0.0468156 0.5 +v 0.249497 -0.0468156 -0.5 +v 0.261804 -0.0472732 0.5 +v 0.261804 -0.0472732 -0.5 +v 0.274727 -0.0477637 0.5 +v 0.274727 -0.0477637 -0.5 +v 0.288294 -0.0483182 0.5 +v 0.288294 -0.0483182 -0.5 +v 0.302542 -0.0488257 0.5 +v 0.302542 -0.0488257 -0.5 +v 0.317502 -0.0493844 0.5 +v 0.317502 -0.0493844 -0.5 +v 0.33321 -0.0499788 0.5 +v 0.33321 -0.0499788 -0.5 +v 0.349702 -0.0506056 0.5 +v 0.349702 -0.0506056 -0.5 +v 0.367015 -0.0513872 0.5 +v 0.367015 -0.0513872 -0.5 +v 0.385192 -0.0522281 0.5 +v 0.385192 -0.0522281 -0.5 +v 0.404277 -0.0531254 0.5 +v 0.404277 -0.0531254 -0.5 +v 0.424316 -0.0540817 0.5 +v 0.424316 -0.0540817 -0.5 +v 0.445357 -0.0550979 0.5 +v 0.445357 -0.0550979 -0.5 +v 0.467451 -0.0560874 0.5 +v 0.467451 -0.0560874 -0.5 +v 0.490649 -0.0571824 0.5 +v 0.490649 -0.0571824 -0.5 +v 0.51501 -0.0582757 0.5 +v 0.51501 -0.0582757 -0.5 +v 0.540585 -0.0594903 0.5 +v 0.540585 -0.0594903 -0.5 +v 0.567439 -0.0607815 0.5 +v 0.567439 -0.0607815 -0.5 +v 0.595635 -0.0621304 0.5 +v 0.595635 -0.0621304 -0.5 +v 0.625242 -0.0635352 0.5 +v 0.625242 -0.0635352 -0.5 +v 0.649433 -0.0648334 0.5 +v 0.649433 -0.0648334 -0.5 +v 0.672415 -0.0660494 0.5 +v 0.672415 -0.0660494 -0.5 +v 0.694245 -0.0672674 0.5 +v 0.694245 -0.0672674 -0.5 +v 0.714979 -0.0684936 0.5 +v 0.714979 -0.0684936 -0.5 +v 0.734678 -0.0696472 0.5 +v 0.734678 -0.0696472 -0.5 +v 0.753392 -0.070724 0.5 +v 0.753392 -0.070724 -0.5 +v 0.771162 -0.0718742 0.5 +v 0.771162 -0.0718742 -0.5 +v 0.788046 -0.0729552 0.5 +v 0.788046 -0.0729552 -0.5 +v 0.804086 -0.0739668 0.5 +v 0.804086 -0.0739668 -0.5 +v 0.819316 -0.0750462 0.5 +v 0.819316 -0.0750462 -0.5 +v 0.833785 -0.076061 0.5 +v 0.833785 -0.076061 -0.5 +v 0.847532 -0.0770175 0.5 +v 0.847532 -0.0770175 -0.5 +v 0.86059 -0.0779215 0.5 +v 0.86059 -0.0779215 -0.5 +v 0.872998 -0.0787716 0.5 +v 0.872998 -0.0787716 -0.5 +v 0.884776 -0.079698 0.5 +v 0.884776 -0.079698 -0.5 +v 0.89597 -0.0805061 0.5 +v 0.89597 -0.0805061 -0.5 +v 0.906605 -0.0812554 0.5 +v 0.906605 -0.0812554 -0.5 +v 0.916704 -0.0820352 0.5 +v 0.916704 -0.0820352 -0.5 +v 0.926301 -0.0827494 0.5 +v 0.926301 -0.0827494 -0.5 +v 0.935409 -0.0835384 0.5 +v 0.935409 -0.0835384 -0.5 +v 0.944071 -0.0841575 0.5 +v 0.944071 -0.0841575 -0.5 +v 0.952294 -0.0848264 0.5 +v 0.952294 -0.0848264 -0.5 +v 0.960109 -0.0854166 0.5 +v 0.960109 -0.0854166 -0.5 +v 0.967527 -0.0860602 0.5 +v 0.967527 -0.0860602 -0.5 +v 0.97458 -0.0865997 0.5 +v 0.97458 -0.0865997 -0.5 +v 0.981277 -0.0871547 0.5 +v 0.981277 -0.0871547 -0.5 +v 0.987637 -0.0876912 0.5 +v 0.987637 -0.0876912 -0.5 +v 0.993684 -0.0881407 0.5 +v 0.993684 -0.0881407 -0.5 +# </points> + +# <faces count="520"> +g WALL10 +f 1 2 3 +f 3 4 1 +f 4 3 5 +f 5 6 4 +f 6 5 7 +f 7 8 6 +f 8 7 9 +f 9 10 8 +f 10 9 11 +f 11 12 10 +f 12 11 13 +f 13 14 12 +f 14 13 15 +f 15 16 14 +f 16 15 17 +f 17 18 16 +f 18 17 19 +f 19 20 18 +f 20 19 21 +f 21 22 20 +f 22 21 23 +f 23 24 22 +f 24 23 25 +f 25 26 24 +f 26 25 27 +f 27 28 26 +f 28 27 29 +f 29 30 28 +f 30 29 31 +f 31 32 30 +f 32 31 33 +f 33 34 32 +f 34 33 35 +f 35 36 34 +f 36 35 37 +f 37 38 36 +f 38 37 39 +f 39 40 38 +f 40 39 41 +f 41 42 40 +f 42 41 43 +f 43 44 42 +f 44 43 45 +f 45 46 44 +f 46 45 47 +f 47 48 46 +f 48 47 49 +f 49 50 48 +f 50 49 51 +f 51 52 50 +f 52 51 53 +f 53 54 52 +f 54 53 55 +f 55 56 54 +f 56 55 57 +f 57 58 56 +f 58 57 59 +f 59 60 58 +f 60 59 61 +f 61 62 60 +f 62 61 63 +f 63 64 62 +f 64 63 65 +f 65 66 64 +f 66 65 67 +f 67 68 66 +f 68 67 69 +f 69 70 68 +f 70 69 71 +f 71 72 70 +f 72 71 73 +f 73 74 72 +f 74 73 75 +f 75 76 74 +f 76 75 77 +f 77 78 76 +f 78 77 79 +f 79 80 78 +f 80 79 81 +f 81 82 80 +f 82 81 83 +f 83 84 82 +f 84 83 85 +f 85 86 84 +f 86 85 87 +f 87 88 86 +f 88 87 89 +f 89 90 88 +f 90 89 91 +f 91 92 90 +f 92 91 93 +f 93 94 92 +f 94 93 95 +f 95 96 94 +f 96 95 97 +f 97 98 96 +f 98 97 99 +f 99 100 98 +f 100 99 101 +f 101 102 100 +f 102 101 103 +f 103 104 102 +f 104 103 105 +f 105 106 104 +f 106 105 107 +f 107 108 106 +f 108 107 109 +f 109 110 108 +f 110 109 111 +f 111 112 110 +f 112 111 113 +f 113 114 112 +f 114 113 115 +f 115 116 114 +f 116 115 117 +f 117 118 116 +f 118 117 119 +f 119 120 118 +f 120 119 121 +f 121 122 120 +f 122 121 123 +f 123 124 122 +f 124 123 125 +f 125 126 124 +f 126 125 127 +f 127 128 126 +f 128 127 129 +f 129 130 128 +f 130 129 131 +f 131 132 130 +f 132 131 133 +f 133 134 132 +f 134 133 135 +f 135 136 134 +f 136 135 137 +f 137 138 136 +f 138 137 139 +f 139 140 138 +f 140 139 141 +f 141 142 140 +f 142 141 143 +f 143 144 142 +f 144 143 145 +f 145 146 144 +f 146 145 147 +f 147 148 146 +f 148 147 149 +f 149 150 148 +f 150 149 151 +f 151 152 150 +f 152 151 153 +f 153 154 152 +f 154 153 155 +f 155 156 154 +f 156 155 157 +f 157 158 156 +f 158 157 159 +f 159 160 158 +f 160 159 161 +f 161 162 160 +f 162 161 163 +f 163 164 162 +f 164 163 165 +f 165 166 164 +f 166 165 167 +f 167 168 166 +f 168 167 169 +f 169 170 168 +f 170 169 171 +f 171 172 170 +f 172 171 173 +f 173 174 172 +f 174 173 175 +f 175 176 174 +f 176 175 177 +f 177 178 176 +f 178 177 179 +f 179 180 178 +f 180 179 181 +f 181 182 180 +f 182 181 183 +f 183 184 182 +f 184 183 185 +f 185 186 184 +f 186 185 187 +f 187 188 186 +f 188 187 189 +f 189 190 188 +f 190 189 191 +f 191 192 190 +f 192 191 193 +f 193 194 192 +f 194 193 195 +f 195 196 194 +f 196 195 197 +f 197 198 196 +f 198 197 199 +f 199 200 198 +f 200 199 201 +f 201 202 200 +f 202 201 203 +f 203 204 202 +f 204 203 205 +f 205 206 204 +f 206 205 207 +f 207 208 206 +f 208 207 209 +f 209 210 208 +f 210 209 211 +f 211 212 210 +f 212 211 213 +f 213 214 212 +f 214 213 215 +f 215 216 214 +f 216 215 217 +f 217 218 216 +f 218 217 219 +f 219 220 218 +f 220 219 221 +f 221 222 220 +f 222 221 223 +f 223 224 222 +f 224 223 225 +f 225 226 224 +f 226 225 227 +f 227 228 226 +f 228 227 229 +f 229 230 228 +f 230 229 231 +f 231 232 230 +f 232 231 233 +f 233 234 232 +f 234 233 235 +f 235 236 234 +f 236 235 237 +f 237 238 236 +f 238 237 239 +f 239 240 238 +f 240 239 241 +f 241 242 240 +f 242 241 243 +f 243 244 242 +f 244 243 245 +f 245 246 244 +f 246 245 247 +f 247 248 246 +f 248 247 249 +f 249 250 248 +f 250 249 251 +f 251 252 250 +f 252 251 253 +f 253 254 252 +f 254 253 255 +f 255 256 254 +f 256 255 257 +f 257 258 256 +f 258 257 259 +f 259 260 258 +f 261 262 2 +f 2 1 261 +f 260 259 263 +f 263 264 260 +f 264 263 265 +f 265 266 264 +f 266 265 267 +f 267 268 266 +f 268 267 269 +f 269 270 268 +f 270 269 271 +f 271 272 270 +f 272 271 273 +f 273 274 272 +f 274 273 275 +f 275 276 274 +f 276 275 277 +f 277 278 276 +f 278 277 279 +f 279 280 278 +f 280 279 281 +f 281 282 280 +f 282 281 283 +f 283 284 282 +f 284 283 285 +f 285 286 284 +f 286 285 287 +f 287 288 286 +f 288 287 289 +f 289 290 288 +f 290 289 291 +f 291 292 290 +f 292 291 293 +f 293 294 292 +f 294 293 295 +f 295 296 294 +f 296 295 297 +f 297 298 296 +f 298 297 299 +f 299 300 298 +f 300 299 301 +f 301 302 300 +f 302 301 303 +f 303 304 302 +f 304 303 305 +f 305 306 304 +f 306 305 307 +f 307 308 306 +f 308 307 309 +f 309 310 308 +f 310 309 311 +f 311 312 310 +f 312 311 313 +f 313 314 312 +f 314 313 315 +f 315 316 314 +f 316 315 317 +f 317 318 316 +f 318 317 319 +f 319 320 318 +f 320 319 321 +f 321 322 320 +f 322 321 323 +f 323 324 322 +f 324 323 325 +f 325 326 324 +f 326 325 327 +f 327 328 326 +f 328 327 329 +f 329 330 328 +f 330 329 331 +f 331 332 330 +f 332 331 333 +f 333 334 332 +f 334 333 335 +f 335 336 334 +f 336 335 337 +f 337 338 336 +f 338 337 339 +f 339 340 338 +f 340 339 341 +f 341 342 340 +f 342 341 343 +f 343 344 342 +f 344 343 345 +f 345 346 344 +f 346 345 347 +f 347 348 346 +f 348 347 349 +f 349 350 348 +f 350 349 351 +f 351 352 350 +f 352 351 353 +f 353 354 352 +f 354 353 355 +f 355 356 354 +f 356 355 357 +f 357 358 356 +f 358 357 359 +f 359 360 358 +f 360 359 361 +f 361 362 360 +f 362 361 363 +f 363 364 362 +f 364 363 365 +f 365 366 364 +f 366 365 367 +f 367 368 366 +f 368 367 369 +f 369 370 368 +f 370 369 371 +f 371 372 370 +f 372 371 373 +f 373 374 372 +f 374 373 375 +f 375 376 374 +f 376 375 377 +f 377 378 376 +f 378 377 379 +f 379 380 378 +f 380 379 381 +f 381 382 380 +f 382 381 383 +f 383 384 382 +f 384 383 385 +f 385 386 384 +f 386 385 387 +f 387 388 386 +f 388 387 389 +f 389 390 388 +f 390 389 391 +f 391 392 390 +f 392 391 393 +f 393 394 392 +f 394 393 395 +f 395 396 394 +f 396 395 397 +f 397 398 396 +f 398 397 399 +f 399 400 398 +f 400 399 401 +f 401 402 400 +f 402 401 403 +f 403 404 402 +f 404 403 405 +f 405 406 404 +f 406 405 407 +f 407 408 406 +f 408 407 409 +f 409 410 408 +f 410 409 411 +f 411 412 410 +f 412 411 413 +f 413 414 412 +f 414 413 415 +f 415 416 414 +f 416 415 417 +f 417 418 416 +f 418 417 419 +f 419 420 418 +f 420 419 421 +f 421 422 420 +f 422 421 423 +f 423 424 422 +f 424 423 425 +f 425 426 424 +f 426 425 427 +f 427 428 426 +f 428 427 429 +f 429 430 428 +f 430 429 431 +f 431 432 430 +f 432 431 433 +f 433 434 432 +f 434 433 435 +f 435 436 434 +f 436 435 437 +f 437 438 436 +f 438 437 439 +f 439 440 438 +f 440 439 441 +f 441 442 440 +f 442 441 443 +f 443 444 442 +f 444 443 445 +f 445 446 444 +f 446 445 447 +f 447 448 446 +f 448 447 449 +f 449 450 448 +f 450 449 451 +f 451 452 450 +f 452 451 453 +f 453 454 452 +f 454 453 455 +f 455 456 454 +f 456 455 457 +f 457 458 456 +f 458 457 459 +f 459 460 458 +f 460 459 461 +f 461 462 460 +f 462 461 463 +f 463 464 462 +f 464 463 465 +f 465 466 464 +f 466 465 467 +f 467 468 466 +f 468 467 469 +f 469 470 468 +f 470 469 471 +f 471 472 470 +f 472 471 473 +f 473 474 472 +f 474 473 475 +f 475 476 474 +f 476 475 477 +f 477 478 476 +f 478 477 479 +f 479 480 478 +f 480 479 481 +f 481 482 480 +f 482 481 483 +f 483 484 482 +f 484 483 485 +f 485 486 484 +f 486 485 487 +f 487 488 486 +f 488 487 489 +f 489 490 488 +f 490 489 491 +f 491 492 490 +f 492 491 493 +f 493 494 492 +f 494 493 495 +f 495 496 494 +f 496 495 497 +f 497 498 496 +f 498 497 499 +f 499 500 498 +f 500 499 501 +f 501 502 500 +f 502 501 503 +f 503 504 502 +f 504 503 505 +f 505 506 504 +f 506 505 507 +f 507 508 506 +f 508 507 509 +f 509 510 508 +f 510 509 511 +f 511 512 510 +f 512 511 513 +f 513 514 512 +f 514 513 515 +f 515 516 514 +f 516 515 517 +f 517 518 516 +f 518 517 519 +f 519 520 518 +f 520 519 262 +f 262 261 520 +# </faces> diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/blockMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..f539f6c928209ce89c02cae600f6010f1f7e601d --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/blockMeshDict @@ -0,0 +1,89 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-0.5 -0.5 -0.1) + ( 2.0 -0.5 -0.1) + ( 2.0 0.5 -0.1) + (-0.5 0.5 -0.1) + (-0.5 -0.5 0.1) + ( 2.0 -0.5 0.1) + ( 2.0 0.5 0.1) + (-0.5 0.5 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (12 7 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + topAndBottom + { + type patch; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type patch; + faces + ( + (2 6 5 1) + ); + } + + symFront + { + type symmetryPlane; + faces + ( + (4 5 6 7) + ); + } + + symBack + { + type symmetryPlane; + faces + ( + (0 3 2 1) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/controlDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..28130318d743dd4236bf0f2ae3226e1925750e95 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application snappyHexMesh; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 100; + +deltaT 1; + +writeControl runTime; + +writeInterval 1; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/decomposeParDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..f70b376fabb6dec49a7ec5c0e536446952692f16 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/decomposeParDict @@ -0,0 +1,39 @@ +/*--------------------------------*- 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 simple; + +simpleCoeffs +{ + n (1 3 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (3 2 1); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile "cellDecomposition"; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/fvSchemes b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..52f9f1efc28040d10b13f2a2ac6e8c16587e7804 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/fvSchemes @@ -0,0 +1,56 @@ +/*--------------------------------*- 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; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phid,p) Gauss limitedLinear 1; + div(phi,K) Gauss limitedLinear 1; + div(phi,e) Gauss limitedLinear 1; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited corrected 0.5; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/fvSolution b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..04a2dd4fdbe390b7872f54c8a0a587e53fd86c0b --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/fvSolution @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 +{ + p + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-12; + relTol 0; + } + + rho + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0; + } + + "(U|e|k|epsilon|R)" + { + $p; + tolerance 1e-08; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 2; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/snappyHexMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/snappyHexMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..5ad22a55c0786c3934b9341ad393ee2707035482 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/aeroFoil_snappyHexMesh/system/snappyHexMeshDict @@ -0,0 +1,300 @@ +/*--------------------------------*- 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 snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap true; +addLayers true; + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + wing_5degrees.obj + { + type triSurfaceMesh; + name wing; + } + + refinementBox + { + type searchableBox; + min (-1 -1 -1); + max ( 5 1 1); + } +}; + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 100000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just + // a few cells. This setting will cause refinement to stop if <= + // minimumRefine are selected for refinement. Note: it will at least do one + // iteration (unless the number of cells to refine is 0) + minRefinementCells 100; + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 6; + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + features (); + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + refinementSurfaces + { + wing + { + // Surface-wise min and max refinement level + level (5 5); + } + } + + // Resolve sharp angles on fridges + resolveFeatureAngle 30; + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + refinementBox + { + mode inside; + levels ((1e15 2)); + } + } + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (0.5 0.22 0); + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces true; +} + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 4.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 30; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; +} + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + wing + { + nSurfaceLayers 3; + } + } + + // Expansion factor for layer mesh + expansionRatio 1.3; + + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + finalLayerThickness 0.7; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + minThickness 0.25; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 60; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 16x! 90 degrees corresponds to 130 in 16x. + minMedianAxisAngle 90; + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 65; + + //- Max skewness allowed. Set to <0 to disable. + maxBoundarySkewness 20; + maxInternalSkewness 4; + + //- Max concaveness allowed. Is angle (in degrees) below which concavity + // is allowed. 0 is straight face, <0 would be convex face. + // Set to 180 to disable. + maxConcave 80; + + //- Minimum pyramid volume. Is absolute volume of cell pyramid. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. + minVol 1e-13; + + //- Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet + minTetQuality 1e-30; + + //- Minimum face area. Set to <0 to disable. + minArea -1; + + //- Minimum face twist. Set to <-1 to disable. dot product of face normal + // and face centre triangles normal + minTwist 0.05; + + //- Minimum normalised cell determinant + // 1 = hex, <= 0 = folded or flattened illegal cell + minDeterminant 0.001; + + //- minFaceWeight (0 -> 0.5) + minFaceWeight 0.05; + + //- minVolRatio (0 -> 1) + minVolRatio 0.01; + + //must be >0 for Fluent compatibility + minTriangleTwist -1; + + // Advanced + + //- Number of error distribution iterations + nSmoothScale 4; + //- Amount to scale back displacement at error points + errorReduction 0.75; +} + +// Advanced + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/U b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..39534ce7d674c6f4aff1c7e9de2fe3b6f85b4bd1 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/U @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform $flowVelocity; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + walls + { + type movingWallVelocity; + value uniform (0 0 0); + } + + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type zeroGradient; //calculated; + value $internalField; + } + + #include "include/frontBackTopBottomfreePatches" +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/epsilon b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..73ef242b33e2977641c8599af4e1d2bf2b938d75 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/epsilon @@ -0,0 +1,50 @@ +/*--------------------------------*- 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 volScalarField; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform $turbulentEpsilon; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type epsilonWallFunction; + value $internalField; + } + + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + #include "include/frontBackTopBottomfreePatches" +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/include/frontBackTopBottomfreePatches b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/include/frontBackTopBottomfreePatches new file mode 100644 index 0000000000000000000000000000000000000000..04f861bd8e00efd793de95f796433915399e0c32 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/include/frontBackTopBottomfreePatches @@ -0,0 +1,14 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +topAndBottom +{ + type slip; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/include/initialConditions b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/include/initialConditions new file mode 100644 index 0000000000000000000000000000000000000000..f9af913104d39bc1e4af6a479bb22b1a1d2d4ac0 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/include/initialConditions @@ -0,0 +1,16 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +flowVelocity (10 0 0); +pressure 0; +turbulentKE 0.375; +turbulentOmega 3.6; +turbulentEpsilon 0.12; +#inputMode merge + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/k b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/k new file mode 100644 index 0000000000000000000000000000000000000000..6f9c85a404bd9a8df0273fd1e9d47798209ce7c0 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/k @@ -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 volScalarField; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform $turbulentKE; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type kqRWallFunction; + value uniform 0; + } + + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; // 5% turbulent intensity + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + #include "include/frontBackTopBottomfreePatches" +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/nuTilda b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/nuTilda new file mode 100644 index 0000000000000000000000000000000000000000..2787701e9bde33c02c204131a2b5b416a16a6a62 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/nuTilda @@ -0,0 +1,32 @@ +/*--------------------------------*- 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 volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/nut b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/nut new file mode 100644 index 0000000000000000000000000000000000000000..e6cf3ba42decccee875a2a7ed77987f5c2305753 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/nut @@ -0,0 +1,40 @@ +/*--------------------------------*- 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 volScalarField; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -1 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type nutkWallFunction; + value uniform 0; + } + + #include "include/frontBackTopBottomfreePatches" + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/omega b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/omega new file mode 100644 index 0000000000000000000000000000000000000000..6d5097ae582e2b9c95ce447c37040939724c82f3 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/omega @@ -0,0 +1,50 @@ +/*--------------------------------*- 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 volScalarField; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform $turbulentOmega; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type omegaWallFunction; + value $internalField; + } + + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + #include "include/frontBackTopBottomfreePatches" +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/p b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/p new file mode 100644 index 0000000000000000000000000000000000000000..c5b82e301cca19556685fd5c43ad6e935df57c9f --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/p @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +#include "include/initialConditions" + +internalField uniform $pressure; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type zeroGradient; + } + + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + inletValue $internalField; + value $internalField; + } + + #include "include/frontBackTopBottomfreePatches" +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/pointDisplacement b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..74fc54dc74b29499b3cc82d11ee95c166aa6eda4 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/pointDisplacement @@ -0,0 +1,36 @@ +/*--------------------------------*- 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 pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + "(walls|overset)" + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + ".*" + { + type uniformFixedValue; + uniformValue (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/zoneID b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..03c62b538585a0433bd231405e6ce062eae1441b --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/0.org/zoneID @@ -0,0 +1,32 @@ +/*--------------------------------*- 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 volScalarField; + object zoneID; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + ".*" + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allclean b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..5d96ca404a377af449d1ab8d37d88228ed684c37 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allclean @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm -f constant/polyMesh/boundary +rm -f constant/polyMesh/zoneID +rm -f constant/cellInterpolationWeight + +rm -rf 0 + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allrun b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..35c77b0187744327e6f2b7aeea3e6607778ad315 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allrun @@ -0,0 +1,11 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Serial +#runApplication $(getApplication) + +# Parallel +runApplication decomposePar -cellDist +runParallel $application diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allrun.pre b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..d45f7bfe12eb868bb804155e64565fc6a4a99d11 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/Allrun.pre @@ -0,0 +1,15 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication extrudeMesh +runApplication createPatch -overwrite +mergeMeshes . ../aeroFoil_overset -overwrite +runApplication topoSet + +# Copy standard fields +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/RASProperties b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..a4d5a1a869f7d5a03f47c9b9a8c7b55684df14f4 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/RASProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- 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 RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kOmegaSST; + +turbulence on; + +printCoeffs on; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/dynamicMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..9f766ac272528f245b086c89fda9a36c82c09d6f --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/dynamicMeshDict @@ -0,0 +1,33 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motionSolverLibs ( "libfvMotionSolvers.so" ); + +solver displacementLaplacian; + +displacementLaplacianCoeffs +{ + diffusivity uniform 1; +} + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +// layerRelax 0.3; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/transportProperties b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..312de2197d3c846fdf304843b8ee8eca43c3deef --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/transportProperties @@ -0,0 +1,39 @@ +/*--------------------------------*- 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 transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DT DT [ 0 2 -1 0 0 0 0 ] 1; //4e-05; + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/triSurface/wing_5degrees.obj b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/triSurface/wing_5degrees.obj new file mode 100644 index 0000000000000000000000000000000000000000..4be2aac5f2f0b963d2ec6208458908df4fd04c50 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/triSurface/wing_5degrees.obj @@ -0,0 +1,1054 @@ +# Wavefront OBJ file written 2010-05-13T09:12:43 +o wing_5degrees + +# points : 520 +# faces : 520 +# zones : 1 +# 0 WALL10 (nFaces: 520) + +# <points count="520"> +v 1.00488 -0.0890722 -0.5 +v 1.00488 -0.0890722 0.5 +v 0.999453 -0.0870827 0.5 +v 0.999453 -0.0870827 -0.5 +v 0.993747 -0.0849908 0.5 +v 0.993747 -0.0849908 -0.5 +v 0.98776 -0.0827959 0.5 +v 0.98776 -0.0827959 -0.5 +v 0.981475 -0.0804834 0.5 +v 0.981475 -0.0804834 -0.5 +v 0.974878 -0.0780483 0.5 +v 0.974878 -0.0780483 -0.5 +v 0.967936 -0.075535 0.5 +v 0.967936 -0.075535 -0.5 +v 0.960671 -0.0728297 0.5 +v 0.960671 -0.0728297 -0.5 +v 0.952986 -0.070149 0.5 +v 0.952986 -0.070149 -0.5 +v 0.944915 -0.067332 0.5 +v 0.944915 -0.067332 -0.5 +v 0.936442 -0.064377 0.5 +v 0.936442 -0.064377 -0.5 +v 0.927543 -0.0612777 0.5 +v 0.927543 -0.0612777 -0.5 +v 0.918171 -0.0581074 0.5 +v 0.918171 -0.0581074 -0.5 +v 0.908345 -0.0547308 0.5 +v 0.908345 -0.0547308 -0.5 +v 0.897978 -0.0513371 0.5 +v 0.897978 -0.0513371 -0.5 +v 0.887113 -0.0477115 0.5 +v 0.887113 -0.0477115 -0.5 +v 0.875671 -0.0440076 0.5 +v 0.875671 -0.0440076 -0.5 +v 0.863634 -0.0401898 0.5 +v 0.863634 -0.0401898 -0.5 +v 0.850988 -0.0362043 0.5 +v 0.850988 -0.0362043 -0.5 +v 0.837677 -0.0321259 0.5 +v 0.837677 -0.0321259 -0.5 +v 0.8237 -0.0278406 0.5 +v 0.8237 -0.0278406 -0.5 +v 0.808997 -0.0234314 0.5 +v 0.808997 -0.0234314 -0.5 +v 0.793536 -0.0188824 0.5 +v 0.793536 -0.0188824 -0.5 +v 0.777248 -0.0142896 0.5 +v 0.777248 -0.0142896 -0.5 +v 0.760144 -0.00947585 0.5 +v 0.760144 -0.00947585 -0.5 +v 0.742148 -0.0045544 0.5 +v 0.742148 -0.0045544 -0.5 +v 0.723207 0.000449948 0.5 +v 0.723207 0.000449948 -0.5 +v 0.703296 0.00561154 0.5 +v 0.703296 0.00561154 -0.5 +v 0.682345 0.010854 0.5 +v 0.682345 0.010854 -0.5 +v 0.660295 0.0161554 0.5 +v 0.660295 0.0161554 -0.5 +v 0.637103 0.0215548 0.5 +v 0.637103 0.0215548 -0.5 +v 0.606829 0.0282606 0.5 +v 0.606829 0.0282606 -0.5 +v 0.578018 0.0343978 0.5 +v 0.578018 0.0343978 -0.5 +v 0.550557 0.0397874 0.5 +v 0.550557 0.0397874 -0.5 +v 0.524436 0.0447356 0.5 +v 0.524436 0.0447356 -0.5 +v 0.499549 0.0490421 0.5 +v 0.499549 0.0490421 -0.5 +v 0.475869 0.05291 0.5 +v 0.475869 0.05291 -0.5 +v 0.45334 0.0563729 0.5 +v 0.45334 0.0563729 -0.5 +v 0.431911 0.059484 0.5 +v 0.431911 0.059484 -0.5 +v 0.411518 0.0621876 0.5 +v 0.411518 0.0621876 -0.5 +v 0.392118 0.0645445 0.5 +v 0.392118 0.0645445 -0.5 +v 0.373644 0.0664046 0.5 +v 0.373644 0.0664046 -0.5 +v 0.356081 0.0680196 0.5 +v 0.356081 0.0680196 -0.5 +v 0.339375 0.0692961 0.5 +v 0.339375 0.0692961 -0.5 +v 0.323487 0.0702815 0.5 +v 0.323487 0.0702815 -0.5 +v 0.308383 0.0710035 0.5 +v 0.308383 0.0710035 -0.5 +v 0.294024 0.0714698 0.5 +v 0.294024 0.0714698 -0.5 +v 0.28038 0.0717809 0.5 +v 0.28038 0.0717809 -0.5 +v 0.267416 0.0719191 0.5 +v 0.267416 0.0719191 -0.5 +v 0.255099 0.0718222 0.5 +v 0.255099 0.0718222 -0.5 +v 0.243399 0.0716511 0.5 +v 0.243399 0.0716511 -0.5 +v 0.232288 0.0713208 0.5 +v 0.232288 0.0713208 -0.5 +v 0.221735 0.0709249 0.5 +v 0.221735 0.0709249 -0.5 +v 0.211715 0.0704338 0.5 +v 0.211715 0.0704338 -0.5 +v 0.202202 0.0698513 0.5 +v 0.202202 0.0698513 -0.5 +v 0.19317 0.0692271 0.5 +v 0.19317 0.0692271 -0.5 +v 0.184599 0.0685108 0.5 +v 0.184599 0.0685108 -0.5 +v 0.176464 0.0677409 0.5 +v 0.176464 0.0677409 -0.5 +v 0.168741 0.0669472 0.5 +v 0.168741 0.0669472 -0.5 +v 0.161418 0.0660755 0.5 +v 0.161418 0.0660755 -0.5 +v 0.154469 0.0651852 0.5 +v 0.154469 0.0651852 -0.5 +v 0.145493 0.0640314 0.5 +v 0.145493 0.0640314 -0.5 +v 0.136995 0.0627463 0.5 +v 0.136995 0.0627463 -0.5 +v 0.128932 0.0614383 0.5 +v 0.128932 0.0614383 -0.5 +v 0.121282 0.0601525 0.5 +v 0.121282 0.0601525 -0.5 +v 0.114049 0.0587416 0.5 +v 0.114049 0.0587416 -0.5 +v 0.107186 0.0573482 0.5 +v 0.107186 0.0573482 -0.5 +v 0.100675 0.0559871 0.5 +v 0.100675 0.0559871 -0.5 +v 0.0945147 0.0545794 0.5 +v 0.0945147 0.0545794 -0.5 +v 0.0886858 0.0531426 0.5 +v 0.0886858 0.0531426 -0.5 +v 0.0831659 0.0517083 0.5 +v 0.0831659 0.0517083 -0.5 +v 0.0779342 0.0503006 0.5 +v 0.0779342 0.0503006 -0.5 +v 0.072975 0.0489224 0.5 +v 0.072975 0.0489224 -0.5 +v 0.0682798 0.0475559 0.5 +v 0.0682798 0.0475559 -0.5 +v 0.0638499 0.0461601 0.5 +v 0.0638499 0.0461601 -0.5 +v 0.0596656 0.0447577 0.5 +v 0.0596656 0.0447577 -0.5 +v 0.055694 0.0434126 0.5 +v 0.055694 0.0434126 -0.5 +v 0.0519364 0.0420932 0.5 +v 0.0519364 0.0420932 -0.5 +v 0.0484053 0.0407363 0.5 +v 0.0484053 0.0407363 -0.5 +v 0.0450779 0.0393756 0.5 +v 0.0450779 0.0393756 -0.5 +v 0.0419215 0.0380722 0.5 +v 0.0419215 0.0380722 -0.5 +v 0.0389288 0.0368211 0.5 +v 0.0389288 0.0368211 -0.5 +v 0.036102 0.0355928 0.5 +v 0.036102 0.0355928 -0.5 +v 0.0334425 0.034368 0.5 +v 0.0334425 0.034368 -0.5 +v 0.0309496 0.0331356 0.5 +v 0.0309496 0.0331356 -0.5 +v 0.0286117 0.0319047 0.5 +v 0.0286117 0.0319047 -0.5 +v 0.0264077 0.0307022 0.5 +v 0.0264077 0.0307022 -0.5 +v 0.0243248 0.02954 0.5 +v 0.0243248 0.02954 -0.5 +v 0.0223665 0.0284014 0.5 +v 0.0223665 0.0284014 -0.5 +v 0.0205353 0.0272716 0.5 +v 0.0205353 0.0272716 -0.5 +v 0.0188204 0.0261581 0.5 +v 0.0188204 0.0261581 -0.5 +v 0.0172057 0.0250781 0.5 +v 0.0172057 0.0250781 -0.5 +v 0.015681 0.0240389 0.5 +v 0.015681 0.0240389 -0.5 +v 0.0142472 0.0230307 0.5 +v 0.0142472 0.0230307 -0.5 +v 0.0129051 0.0220434 0.5 +v 0.0129051 0.0220434 -0.5 +v 0.0116567 0.0210699 0.5 +v 0.0116567 0.0210699 -0.5 +v 0.0105044 0.0201047 0.5 +v 0.0105044 0.0201047 -0.5 +v 0.00944864 0.0191444 0.5 +v 0.00944864 0.0191444 -0.5 +v 0.00847997 0.0181956 0.5 +v 0.00847997 0.0181956 -0.5 +v 0.00758214 0.0172702 0.5 +v 0.00758214 0.0172702 -0.5 +v 0.00674204 0.0163779 0.5 +v 0.00674204 0.0163779 -0.5 +v 0.00595671 0.0155186 0.5 +v 0.00595671 0.0155186 -0.5 +v 0.00523198 0.0146848 0.5 +v 0.00523198 0.0146848 -0.5 +v 0.00457157 0.0138701 0.5 +v 0.00457157 0.0138701 -0.5 +v 0.00397503 0.0130721 0.5 +v 0.00397503 0.0130721 -0.5 +v 0.00343506 0.0122936 0.5 +v 0.00343506 0.0122936 -0.5 +v 0.0029443 0.0115379 0.5 +v 0.0029443 0.0115379 -0.5 +v 0.0024965 0.010807 0.5 +v 0.0024965 0.010807 -0.5 +v 0.00209053 0.0101012 0.5 +v 0.00209053 0.0101012 -0.5 +v 0.00172938 0.00941821 0.5 +v 0.00172938 0.00941821 -0.5 +v 0.00141481 0.00875662 0.5 +v 0.00141481 0.00875662 -0.5 +v 0.00114703 0.00811509 0.5 +v 0.00114703 0.00811509 -0.5 +v 0.000922634 0.00749375 0.5 +v 0.000922634 0.00749375 -0.5 +v 0.00073432 0.00689421 0.5 +v 0.00073432 0.00689421 -0.5 +v 0.000575606 0.00631745 0.5 +v 0.000575606 0.00631745 -0.5 +v 0.000441178 0.00576428 0.5 +v 0.000441178 0.00576428 -0.5 +v 0.000326628 0.00523494 0.5 +v 0.000326628 0.00523494 -0.5 +v 0.000229331 0.00472926 0.5 +v 0.000229331 0.00472926 -0.5 +v 0.000147968 0.00424663 0.5 +v 0.000147968 0.00424663 -0.5 +v 8.13071e-05 0.00378656 0.5 +v 8.13071e-05 0.00378656 -0.5 +v 2.81186e-05 0.00334838 0.5 +v 2.81186e-05 0.00334838 -0.5 +v -1.28053e-05 0.00293132 0.5 +v -1.28053e-05 0.00293132 -0.5 +v -4.26138e-05 0.00253464 0.5 +v -4.26138e-05 0.00253464 -0.5 +v -6.24104e-05 0.00215753 0.5 +v -6.24104e-05 0.00215753 -0.5 +v -7.32354e-05 0.00179922 0.5 +v -7.32354e-05 0.00179922 -0.5 +v -7.6066e-05 0.00145891 0.5 +v -7.6066e-05 0.00145891 -0.5 +v -7.18149e-05 0.00113574 0.5 +v -7.18149e-05 0.00113574 -0.5 +v -6.13265e-05 0.000828962 0.5 +v -6.13265e-05 0.000828962 -0.5 +v -4.5388e-05 0.000537894 0.5 +v -4.5388e-05 0.000537894 -0.5 +v -2.47174e-05 0.000261729 0.5 +v -2.47174e-05 0.000261729 -0.5 +v 0.999428 -0.0886333 -0.5 +v 0.999428 -0.0886333 0.5 +v 0 0 0.5 +v 0 0 -0.5 +v 3.07731e-05 -0.000269468 0.5 +v 3.07731e-05 -0.000269468 -0.5 +v 6.87839e-05 -0.000551758 0.5 +v 6.87839e-05 -0.000551758 -0.5 +v 0.00011487 -0.000847395 0.5 +v 0.00011487 -0.000847395 -0.5 +v 0.000169958 -0.00115699 0.5 +v 0.000169958 -0.00115699 -0.5 +v 0.000235006 -0.00148084 0.5 +v 0.000235006 -0.00148084 -0.5 +v 0.000311085 -0.00181947 0.5 +v 0.000311085 -0.00181947 -0.5 +v 0.000399343 -0.00217329 0.5 +v 0.000399343 -0.00217329 -0.5 +v 0.000501006 -0.00254265 0.5 +v 0.000501006 -0.00254265 -0.5 +v 0.000617405 -0.00292793 0.5 +v 0.000617405 -0.00292793 -0.5 +v 0.000749918 -0.00332928 0.5 +v 0.000749918 -0.00332928 -0.5 +v 0.000900098 -0.00374706 0.5 +v 0.000900098 -0.00374706 -0.5 +v 0.00106951 -0.00418123 0.5 +v 0.00106951 -0.00418123 -0.5 +v 0.00125981 -0.00463173 0.5 +v 0.00125981 -0.00463173 -0.5 +v 0.00147278 -0.00509836 0.5 +v 0.00147278 -0.00509836 -0.5 +v 0.00171023 -0.00558073 0.5 +v 0.00171023 -0.00558073 -0.5 +v 0.0019741 -0.00607866 0.5 +v 0.0019741 -0.00607866 -0.5 +v 0.00226657 -0.00659235 0.5 +v 0.00226657 -0.00659235 -0.5 +v 0.00258985 -0.00712192 0.5 +v 0.00258985 -0.00712192 -0.5 +v 0.00294625 -0.00766749 0.5 +v 0.00294625 -0.00766749 -0.5 +v 0.0033381 -0.00822888 0.5 +v 0.0033381 -0.00822888 -0.5 +v 0.00376858 -0.00880495 0.5 +v 0.00376858 -0.00880495 -0.5 +v 0.00424144 -0.00939356 0.5 +v 0.00424144 -0.00939356 -0.5 +v 0.0047608 -0.00999197 0.5 +v 0.0047608 -0.00999197 -0.5 +v 0.00533108 -0.0105969 0.5 +v 0.00533108 -0.0105969 -0.5 +v 0.00595465 -0.0112076 0.5 +v 0.00595465 -0.0112076 -0.5 +v 0.00663108 -0.0118268 0.5 +v 0.00663108 -0.0118268 -0.5 +v 0.00735864 -0.0124589 0.5 +v 0.00735864 -0.0124589 -0.5 +v 0.00813479 -0.0131082 0.5 +v 0.00813479 -0.0131082 -0.5 +v 0.00896315 -0.0137726 0.5 +v 0.00896315 -0.0137726 -0.5 +v 0.00985143 -0.0144449 0.5 +v 0.00985143 -0.0144449 -0.5 +v 0.0108089 -0.0151156 0.5 +v 0.0108089 -0.0151156 -0.5 +v 0.0118417 -0.0157801 0.5 +v 0.0118417 -0.0157801 -0.5 +v 0.0129485 -0.0164439 0.5 +v 0.0129485 -0.0164439 -0.5 +v 0.0141258 -0.0171158 0.5 +v 0.0141258 -0.0171158 -0.5 +v 0.0153717 -0.0178024 0.5 +v 0.0153717 -0.0178024 -0.5 +v 0.0166914 -0.0185005 0.5 +v 0.0166914 -0.0185005 -0.5 +v 0.0180921 -0.0192037 0.5 +v 0.0180921 -0.0192037 -0.5 +v 0.01958 -0.019908 0.5 +v 0.01958 -0.019908 -0.5 +v 0.0211576 -0.0206151 0.5 +v 0.0211576 -0.0206151 -0.5 +v 0.0228265 -0.0213288 0.5 +v 0.0228265 -0.0213288 -0.5 +v 0.0245895 -0.0220523 0.5 +v 0.0245895 -0.0220523 -0.5 +v 0.0264506 -0.0227868 0.5 +v 0.0264506 -0.0227868 -0.5 +v 0.028415 -0.0235332 0.5 +v 0.028415 -0.0235332 -0.5 +v 0.0304905 -0.0242814 0.5 +v 0.0304905 -0.0242814 -0.5 +v 0.0326872 -0.0250146 0.5 +v 0.0326872 -0.0250146 -0.5 +v 0.0350128 -0.0257258 0.5 +v 0.0350128 -0.0257258 -0.5 +v 0.0374672 -0.0264333 0.5 +v 0.0374672 -0.0264333 -0.5 +v 0.0400497 -0.0271566 0.5 +v 0.0400497 -0.0271566 -0.5 +v 0.0427704 -0.0278802 0.5 +v 0.0427704 -0.0278802 -0.5 +v 0.0456434 -0.0285739 0.5 +v 0.0456434 -0.0285739 -0.5 +v 0.0486731 -0.0292495 0.5 +v 0.0486731 -0.0292495 -0.5 +v 0.0518554 -0.0299566 0.5 +v 0.0518554 -0.0299566 -0.5 +v 0.0551966 -0.030697 0.5 +v 0.0551966 -0.030697 -0.5 +v 0.0587179 -0.0314085 0.5 +v 0.0587179 -0.0314085 -0.5 +v 0.062431 -0.032078 0.5 +v 0.062431 -0.032078 -0.5 +v 0.0663314 -0.0327743 0.5 +v 0.0663314 -0.0327743 -0.5 +v 0.0704248 -0.033514 0.5 +v 0.0704248 -0.033514 -0.5 +v 0.0747335 -0.0342256 0.5 +v 0.0747335 -0.0342256 -0.5 +v 0.0792714 -0.0348902 0.5 +v 0.0792714 -0.0348902 -0.5 +v 0.0840416 -0.0355492 0.5 +v 0.0840416 -0.0355492 -0.5 +v 0.089054 -0.0362103 0.5 +v 0.089054 -0.0362103 -0.5 +v 0.0943226 -0.0368627 0.5 +v 0.0943226 -0.0368627 -0.5 +v 0.0998603 -0.0375041 0.5 +v 0.0998603 -0.0375041 -0.5 +v 0.105679 -0.0381355 0.5 +v 0.105679 -0.0381355 -0.5 +v 0.111793 -0.0387575 0.5 +v 0.111793 -0.0387575 -0.5 +v 0.118218 -0.0393567 0.5 +v 0.118218 -0.0393567 -0.5 +v 0.124968 -0.0399429 0.5 +v 0.124968 -0.0399429 -0.5 +v 0.132055 -0.0405782 0.5 +v 0.132055 -0.0405782 -0.5 +v 0.1395 -0.0411771 0.5 +v 0.1395 -0.0411771 -0.5 +v 0.147326 -0.041699 0.5 +v 0.147326 -0.041699 -0.5 +v 0.15451 -0.0421969 0.5 +v 0.15451 -0.0421969 -0.5 +v 0.162054 -0.042698 0.5 +v 0.162054 -0.042698 -0.5 +v 0.16998 -0.0431596 0.5 +v 0.16998 -0.0431596 -0.5 +v 0.178305 -0.0435984 0.5 +v 0.178305 -0.0435984 -0.5 +v 0.187045 -0.0440696 0.5 +v 0.187045 -0.0440696 -0.5 +v 0.196223 -0.0445349 0.5 +v 0.196223 -0.0445349 -0.5 +v 0.205864 -0.0449725 0.5 +v 0.205864 -0.0449725 -0.5 +v 0.215985 -0.045448 0.5 +v 0.215985 -0.045448 -0.5 +v 0.226615 -0.0458797 0.5 +v 0.226615 -0.0458797 -0.5 +v 0.237778 -0.0463184 0.5 +v 0.237778 -0.0463184 -0.5 +v 0.249497 -0.0468156 0.5 +v 0.249497 -0.0468156 -0.5 +v 0.261804 -0.0472732 0.5 +v 0.261804 -0.0472732 -0.5 +v 0.274727 -0.0477637 0.5 +v 0.274727 -0.0477637 -0.5 +v 0.288294 -0.0483182 0.5 +v 0.288294 -0.0483182 -0.5 +v 0.302542 -0.0488257 0.5 +v 0.302542 -0.0488257 -0.5 +v 0.317502 -0.0493844 0.5 +v 0.317502 -0.0493844 -0.5 +v 0.33321 -0.0499788 0.5 +v 0.33321 -0.0499788 -0.5 +v 0.349702 -0.0506056 0.5 +v 0.349702 -0.0506056 -0.5 +v 0.367015 -0.0513872 0.5 +v 0.367015 -0.0513872 -0.5 +v 0.385192 -0.0522281 0.5 +v 0.385192 -0.0522281 -0.5 +v 0.404277 -0.0531254 0.5 +v 0.404277 -0.0531254 -0.5 +v 0.424316 -0.0540817 0.5 +v 0.424316 -0.0540817 -0.5 +v 0.445357 -0.0550979 0.5 +v 0.445357 -0.0550979 -0.5 +v 0.467451 -0.0560874 0.5 +v 0.467451 -0.0560874 -0.5 +v 0.490649 -0.0571824 0.5 +v 0.490649 -0.0571824 -0.5 +v 0.51501 -0.0582757 0.5 +v 0.51501 -0.0582757 -0.5 +v 0.540585 -0.0594903 0.5 +v 0.540585 -0.0594903 -0.5 +v 0.567439 -0.0607815 0.5 +v 0.567439 -0.0607815 -0.5 +v 0.595635 -0.0621304 0.5 +v 0.595635 -0.0621304 -0.5 +v 0.625242 -0.0635352 0.5 +v 0.625242 -0.0635352 -0.5 +v 0.649433 -0.0648334 0.5 +v 0.649433 -0.0648334 -0.5 +v 0.672415 -0.0660494 0.5 +v 0.672415 -0.0660494 -0.5 +v 0.694245 -0.0672674 0.5 +v 0.694245 -0.0672674 -0.5 +v 0.714979 -0.0684936 0.5 +v 0.714979 -0.0684936 -0.5 +v 0.734678 -0.0696472 0.5 +v 0.734678 -0.0696472 -0.5 +v 0.753392 -0.070724 0.5 +v 0.753392 -0.070724 -0.5 +v 0.771162 -0.0718742 0.5 +v 0.771162 -0.0718742 -0.5 +v 0.788046 -0.0729552 0.5 +v 0.788046 -0.0729552 -0.5 +v 0.804086 -0.0739668 0.5 +v 0.804086 -0.0739668 -0.5 +v 0.819316 -0.0750462 0.5 +v 0.819316 -0.0750462 -0.5 +v 0.833785 -0.076061 0.5 +v 0.833785 -0.076061 -0.5 +v 0.847532 -0.0770175 0.5 +v 0.847532 -0.0770175 -0.5 +v 0.86059 -0.0779215 0.5 +v 0.86059 -0.0779215 -0.5 +v 0.872998 -0.0787716 0.5 +v 0.872998 -0.0787716 -0.5 +v 0.884776 -0.079698 0.5 +v 0.884776 -0.079698 -0.5 +v 0.89597 -0.0805061 0.5 +v 0.89597 -0.0805061 -0.5 +v 0.906605 -0.0812554 0.5 +v 0.906605 -0.0812554 -0.5 +v 0.916704 -0.0820352 0.5 +v 0.916704 -0.0820352 -0.5 +v 0.926301 -0.0827494 0.5 +v 0.926301 -0.0827494 -0.5 +v 0.935409 -0.0835384 0.5 +v 0.935409 -0.0835384 -0.5 +v 0.944071 -0.0841575 0.5 +v 0.944071 -0.0841575 -0.5 +v 0.952294 -0.0848264 0.5 +v 0.952294 -0.0848264 -0.5 +v 0.960109 -0.0854166 0.5 +v 0.960109 -0.0854166 -0.5 +v 0.967527 -0.0860602 0.5 +v 0.967527 -0.0860602 -0.5 +v 0.97458 -0.0865997 0.5 +v 0.97458 -0.0865997 -0.5 +v 0.981277 -0.0871547 0.5 +v 0.981277 -0.0871547 -0.5 +v 0.987637 -0.0876912 0.5 +v 0.987637 -0.0876912 -0.5 +v 0.993684 -0.0881407 0.5 +v 0.993684 -0.0881407 -0.5 +# </points> + +# <faces count="520"> +g WALL10 +f 1 2 3 +f 3 4 1 +f 4 3 5 +f 5 6 4 +f 6 5 7 +f 7 8 6 +f 8 7 9 +f 9 10 8 +f 10 9 11 +f 11 12 10 +f 12 11 13 +f 13 14 12 +f 14 13 15 +f 15 16 14 +f 16 15 17 +f 17 18 16 +f 18 17 19 +f 19 20 18 +f 20 19 21 +f 21 22 20 +f 22 21 23 +f 23 24 22 +f 24 23 25 +f 25 26 24 +f 26 25 27 +f 27 28 26 +f 28 27 29 +f 29 30 28 +f 30 29 31 +f 31 32 30 +f 32 31 33 +f 33 34 32 +f 34 33 35 +f 35 36 34 +f 36 35 37 +f 37 38 36 +f 38 37 39 +f 39 40 38 +f 40 39 41 +f 41 42 40 +f 42 41 43 +f 43 44 42 +f 44 43 45 +f 45 46 44 +f 46 45 47 +f 47 48 46 +f 48 47 49 +f 49 50 48 +f 50 49 51 +f 51 52 50 +f 52 51 53 +f 53 54 52 +f 54 53 55 +f 55 56 54 +f 56 55 57 +f 57 58 56 +f 58 57 59 +f 59 60 58 +f 60 59 61 +f 61 62 60 +f 62 61 63 +f 63 64 62 +f 64 63 65 +f 65 66 64 +f 66 65 67 +f 67 68 66 +f 68 67 69 +f 69 70 68 +f 70 69 71 +f 71 72 70 +f 72 71 73 +f 73 74 72 +f 74 73 75 +f 75 76 74 +f 76 75 77 +f 77 78 76 +f 78 77 79 +f 79 80 78 +f 80 79 81 +f 81 82 80 +f 82 81 83 +f 83 84 82 +f 84 83 85 +f 85 86 84 +f 86 85 87 +f 87 88 86 +f 88 87 89 +f 89 90 88 +f 90 89 91 +f 91 92 90 +f 92 91 93 +f 93 94 92 +f 94 93 95 +f 95 96 94 +f 96 95 97 +f 97 98 96 +f 98 97 99 +f 99 100 98 +f 100 99 101 +f 101 102 100 +f 102 101 103 +f 103 104 102 +f 104 103 105 +f 105 106 104 +f 106 105 107 +f 107 108 106 +f 108 107 109 +f 109 110 108 +f 110 109 111 +f 111 112 110 +f 112 111 113 +f 113 114 112 +f 114 113 115 +f 115 116 114 +f 116 115 117 +f 117 118 116 +f 118 117 119 +f 119 120 118 +f 120 119 121 +f 121 122 120 +f 122 121 123 +f 123 124 122 +f 124 123 125 +f 125 126 124 +f 126 125 127 +f 127 128 126 +f 128 127 129 +f 129 130 128 +f 130 129 131 +f 131 132 130 +f 132 131 133 +f 133 134 132 +f 134 133 135 +f 135 136 134 +f 136 135 137 +f 137 138 136 +f 138 137 139 +f 139 140 138 +f 140 139 141 +f 141 142 140 +f 142 141 143 +f 143 144 142 +f 144 143 145 +f 145 146 144 +f 146 145 147 +f 147 148 146 +f 148 147 149 +f 149 150 148 +f 150 149 151 +f 151 152 150 +f 152 151 153 +f 153 154 152 +f 154 153 155 +f 155 156 154 +f 156 155 157 +f 157 158 156 +f 158 157 159 +f 159 160 158 +f 160 159 161 +f 161 162 160 +f 162 161 163 +f 163 164 162 +f 164 163 165 +f 165 166 164 +f 166 165 167 +f 167 168 166 +f 168 167 169 +f 169 170 168 +f 170 169 171 +f 171 172 170 +f 172 171 173 +f 173 174 172 +f 174 173 175 +f 175 176 174 +f 176 175 177 +f 177 178 176 +f 178 177 179 +f 179 180 178 +f 180 179 181 +f 181 182 180 +f 182 181 183 +f 183 184 182 +f 184 183 185 +f 185 186 184 +f 186 185 187 +f 187 188 186 +f 188 187 189 +f 189 190 188 +f 190 189 191 +f 191 192 190 +f 192 191 193 +f 193 194 192 +f 194 193 195 +f 195 196 194 +f 196 195 197 +f 197 198 196 +f 198 197 199 +f 199 200 198 +f 200 199 201 +f 201 202 200 +f 202 201 203 +f 203 204 202 +f 204 203 205 +f 205 206 204 +f 206 205 207 +f 207 208 206 +f 208 207 209 +f 209 210 208 +f 210 209 211 +f 211 212 210 +f 212 211 213 +f 213 214 212 +f 214 213 215 +f 215 216 214 +f 216 215 217 +f 217 218 216 +f 218 217 219 +f 219 220 218 +f 220 219 221 +f 221 222 220 +f 222 221 223 +f 223 224 222 +f 224 223 225 +f 225 226 224 +f 226 225 227 +f 227 228 226 +f 228 227 229 +f 229 230 228 +f 230 229 231 +f 231 232 230 +f 232 231 233 +f 233 234 232 +f 234 233 235 +f 235 236 234 +f 236 235 237 +f 237 238 236 +f 238 237 239 +f 239 240 238 +f 240 239 241 +f 241 242 240 +f 242 241 243 +f 243 244 242 +f 244 243 245 +f 245 246 244 +f 246 245 247 +f 247 248 246 +f 248 247 249 +f 249 250 248 +f 250 249 251 +f 251 252 250 +f 252 251 253 +f 253 254 252 +f 254 253 255 +f 255 256 254 +f 256 255 257 +f 257 258 256 +f 258 257 259 +f 259 260 258 +f 261 262 2 +f 2 1 261 +f 260 259 263 +f 263 264 260 +f 264 263 265 +f 265 266 264 +f 266 265 267 +f 267 268 266 +f 268 267 269 +f 269 270 268 +f 270 269 271 +f 271 272 270 +f 272 271 273 +f 273 274 272 +f 274 273 275 +f 275 276 274 +f 276 275 277 +f 277 278 276 +f 278 277 279 +f 279 280 278 +f 280 279 281 +f 281 282 280 +f 282 281 283 +f 283 284 282 +f 284 283 285 +f 285 286 284 +f 286 285 287 +f 287 288 286 +f 288 287 289 +f 289 290 288 +f 290 289 291 +f 291 292 290 +f 292 291 293 +f 293 294 292 +f 294 293 295 +f 295 296 294 +f 296 295 297 +f 297 298 296 +f 298 297 299 +f 299 300 298 +f 300 299 301 +f 301 302 300 +f 302 301 303 +f 303 304 302 +f 304 303 305 +f 305 306 304 +f 306 305 307 +f 307 308 306 +f 308 307 309 +f 309 310 308 +f 310 309 311 +f 311 312 310 +f 312 311 313 +f 313 314 312 +f 314 313 315 +f 315 316 314 +f 316 315 317 +f 317 318 316 +f 318 317 319 +f 319 320 318 +f 320 319 321 +f 321 322 320 +f 322 321 323 +f 323 324 322 +f 324 323 325 +f 325 326 324 +f 326 325 327 +f 327 328 326 +f 328 327 329 +f 329 330 328 +f 330 329 331 +f 331 332 330 +f 332 331 333 +f 333 334 332 +f 334 333 335 +f 335 336 334 +f 336 335 337 +f 337 338 336 +f 338 337 339 +f 339 340 338 +f 340 339 341 +f 341 342 340 +f 342 341 343 +f 343 344 342 +f 344 343 345 +f 345 346 344 +f 346 345 347 +f 347 348 346 +f 348 347 349 +f 349 350 348 +f 350 349 351 +f 351 352 350 +f 352 351 353 +f 353 354 352 +f 354 353 355 +f 355 356 354 +f 356 355 357 +f 357 358 356 +f 358 357 359 +f 359 360 358 +f 360 359 361 +f 361 362 360 +f 362 361 363 +f 363 364 362 +f 364 363 365 +f 365 366 364 +f 366 365 367 +f 367 368 366 +f 368 367 369 +f 369 370 368 +f 370 369 371 +f 371 372 370 +f 372 371 373 +f 373 374 372 +f 374 373 375 +f 375 376 374 +f 376 375 377 +f 377 378 376 +f 378 377 379 +f 379 380 378 +f 380 379 381 +f 381 382 380 +f 382 381 383 +f 383 384 382 +f 384 383 385 +f 385 386 384 +f 386 385 387 +f 387 388 386 +f 388 387 389 +f 389 390 388 +f 390 389 391 +f 391 392 390 +f 392 391 393 +f 393 394 392 +f 394 393 395 +f 395 396 394 +f 396 395 397 +f 397 398 396 +f 398 397 399 +f 399 400 398 +f 400 399 401 +f 401 402 400 +f 402 401 403 +f 403 404 402 +f 404 403 405 +f 405 406 404 +f 406 405 407 +f 407 408 406 +f 408 407 409 +f 409 410 408 +f 410 409 411 +f 411 412 410 +f 412 411 413 +f 413 414 412 +f 414 413 415 +f 415 416 414 +f 416 415 417 +f 417 418 416 +f 418 417 419 +f 419 420 418 +f 420 419 421 +f 421 422 420 +f 422 421 423 +f 423 424 422 +f 424 423 425 +f 425 426 424 +f 426 425 427 +f 427 428 426 +f 428 427 429 +f 429 430 428 +f 430 429 431 +f 431 432 430 +f 432 431 433 +f 433 434 432 +f 434 433 435 +f 435 436 434 +f 436 435 437 +f 437 438 436 +f 438 437 439 +f 439 440 438 +f 440 439 441 +f 441 442 440 +f 442 441 443 +f 443 444 442 +f 444 443 445 +f 445 446 444 +f 446 445 447 +f 447 448 446 +f 448 447 449 +f 449 450 448 +f 450 449 451 +f 451 452 450 +f 452 451 453 +f 453 454 452 +f 454 453 455 +f 455 456 454 +f 456 455 457 +f 457 458 456 +f 458 457 459 +f 459 460 458 +f 460 459 461 +f 461 462 460 +f 462 461 463 +f 463 464 462 +f 464 463 465 +f 465 466 464 +f 466 465 467 +f 467 468 466 +f 468 467 469 +f 469 470 468 +f 470 469 471 +f 471 472 470 +f 472 471 473 +f 473 474 472 +f 474 473 475 +f 475 476 474 +f 476 475 477 +f 477 478 476 +f 478 477 479 +f 479 480 478 +f 480 479 481 +f 481 482 480 +f 482 481 483 +f 483 484 482 +f 484 483 485 +f 485 486 484 +f 486 485 487 +f 487 488 486 +f 488 487 489 +f 489 490 488 +f 490 489 491 +f 491 492 490 +f 492 491 493 +f 493 494 492 +f 494 493 495 +f 495 496 494 +f 496 495 497 +f 497 498 496 +f 498 497 499 +f 499 500 498 +f 500 499 501 +f 501 502 500 +f 502 501 503 +f 503 504 502 +f 504 503 505 +f 505 506 504 +f 506 505 507 +f 507 508 506 +f 508 507 509 +f 509 510 508 +f 510 509 511 +f 511 512 510 +f 512 511 513 +f 513 514 512 +f 514 513 515 +f 515 516 514 +f 516 515 517 +f 517 518 516 +f 518 517 519 +f 519 520 518 +f 520 519 262 +f 262 261 520 +# </faces> diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/turbulenceProperties b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..1ae39077556a5ae9141ca29f1effaeeb09599669 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/constant/turbulenceProperties @@ -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 turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kEpsilon; //kOmegaSST; + + turbulence on; + + printCoeffs on; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/blockMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..9c95d3eac673927d7ed24e3d5c3b1a4476938555 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/blockMeshDict @@ -0,0 +1,93 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-1.0 -1.0 -0.1) + ( 2.0 -1.0 -0.1) + ( 2.0 1.0 -0.1) + (-1.0 1.0 -0.1) + (-1.0 -1.0 0.1) + ( 2.0 -1.0 0.1) + ( 2.0 1.0 0.1) + (-1.0 1.0 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (17 11 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + topAndBottom + { + type patch; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type patch; + faces + ( + (2 6 5 1) + ); + } + + symFront + { + type symmetryPlane; + faces + ( + (4 5 6 7) + ); + } + + symBack + { + type symmetryPlane; + faces + ( + (0 3 2 1) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/controlDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..28436ef928dbdfd1a2accbaf91d8b649931bb29d --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("liboverset.so"); + +application overSimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 2000; + +deltaT 1; + +writeControl timeStep; + +writeInterval 200; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/createPatchDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/createPatchDict new file mode 100644 index 0000000000000000000000000000000000000000..f84e309be748ba5377bf2b8b4e3b2742aba462b9 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/createPatchDict @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 createPatchDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Do a synchronisation of coupled points after creation of any patches. +// Note: this does not work with points that are on multiple coupled patches +// with transformations (i.e. cyclics). +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name frontAndBack; + + // Dictionary to construct new patch from + patchInfo + { + type empty; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (symFront symBack); + + // If constructFrom = set : name of faceSet + set f0; + } + +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/decomposeParDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..5a457a752003f61bd4651e953791e75b814fe8cb --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/decomposeParDict @@ -0,0 +1,39 @@ +/*--------------------------------*- 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 8; + +method hierarchical; + +simpleCoeffs +{ + n (1 3 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (8 1 1); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile "cellDecomposition"; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/extrudeMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/extrudeMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..e5f2993d226818646dc7650ad4719c9b5f55dbb5 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/extrudeMeshDict @@ -0,0 +1,52 @@ +/*--------------------------------*- 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 extrudeMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// What to extrude: +// patch : from patch of another case ('sourceCase') +// mesh : as above but with original case included +// surface : from externally read surface + +constructFrom patch; +sourceCase "../background_snappyHexMesh"; +sourcePatches (symFront); + +// If construct from patch: patch to use for back (can be same as sourcePatch) +exposedPatchName symBack; + +// Flip surface normals before usage. Valid only for extrude from surface or +// patch. +flipNormals false; + +//- Linear extrusion in point-normal direction +extrudeModel linearNormal; + +nLayers 1; + +expansionRatio 1.0; + +linearNormalCoeffs +{ + thickness 0.05; +} + +// Do front and back need to be merged? Usually only makes sense for 360 +// degree wedges. +mergeFaces false; //true; + +// Merge small edges. Fraction of bounding box. +mergeTol 0; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/fvSchemes b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..08936ae7678062b978752d20f851f669e7731be2 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/fvSchemes @@ -0,0 +1,95 @@ +/*--------------------------------*- 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 steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(yPsi) cellLimited Gauss linear 1.0; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss limitedLinearV 1; + div(phi,k) bounded Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phid,p) Gauss limitedLinear 1; + div(phi,K) Gauss limitedLinear 1; + div(phi,e) Gauss limitedLinear 1; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; + div(phi,omega) bounded Gauss limitedLinear 1; + div((nuEff*dev2(T(grad(U))))) Gauss linear; + +} + +laplacianSchemes +{ + default Gauss linear limited corrected 0.5; + laplacian(diffusivity,cellDisplacement) Gauss linear corrected; + laplacian(yPsi) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + pcorr ; + p ; + yPsi ; +} + +oversetInterpolation +{ + method inverseDistance; //trackingInverseDistance; + + // The inverseDistance method uses a 'voxel' like search structure. + // Optionally specify the extent and number of divisions n. + // Note that it will allocate an array of nx*ny*nz. If not specified: + // - searchBox : local mesh bounding box + // - searchBoxDivisions : root (2D) or cube-root(3D) of number of cells + searchBox (-0.1 -0.5 0)(1.1 0.5 1); + searchBoxDivisions (100 100 1); +} + +oversetInterpolationRequired +{ + omega; + k; + nut; +} + +wallDist +{ + method Poisson; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/fvSolution b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..71cf71b4055b1515b1cc3ee9dc493bac665f7088 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/fvSolution @@ -0,0 +1,90 @@ +/*--------------------------------*- 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; + } + + p + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-6; + relTol 0.01; + } + + pcorr + { + $p; + solver PCG; + preconditioner DIC; + } + + yPsi + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-5; + relTol 0.0; + } + + "(U|k|omega|epsilon)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0.01; + } +} + +SIMPLE +{ + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + + residualControl + { + p 2e-3; + U 2e-4; + "(k|epsilon|omega|f|v2)" 1e-4; + } +} + +relaxationFactors +{ + fields + { + p 0.3; + } + equations + { + U 0.6; + k 0.7; + omega 0.7; + epsilon 0.7; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/postProcessingDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/postProcessingDict new file mode 100644 index 0000000000000000000000000000000000000000..8fe6333aa0542d7c71e3e97eb31d09145642b0d9 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/postProcessingDict @@ -0,0 +1,35 @@ +/*--------------------------------*- 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 postProcessingDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +functions +{ + processorField1 + { + // Type of functionObject + type processorField; + + // Where to load it from (if not already in solver) + libs ("libfieldFunctionObjects.so"); + + // Function object enabled flag + enabled true; + + // When to output the average fields + writeControl writeTime; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/setFieldsDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..8efb92d61024b852440bc0491e5e1005ffc411f9 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/setFieldsDict @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 +); + +regions +( + // Set cell values + // (does zerogradient on boundaries) + cellToCell + { + set c0; + + fieldValues + ( + volScalarFieldValue zoneID 0 + ); + } + + cellToCell + { + set c1; + + fieldValues + ( + volScalarFieldValue zoneID 1 + ); + } + +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/topoSetDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..92b72993854180dabbf1da9e158bb47970720e4c --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_overset/system/topoSetDict @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 -1 0.1)); + } + } + + { + name c1; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c0; + } + } + + { + name c1; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/Allrun.pre b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..756120464768b748c11e94e52540b2b0aa539ca2 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/Allrun.pre @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Make 3D mesh in slab of cells. +# Make 3D mesh in slab of cells. +runApplication blockMesh +runApplication snappyHexMesh -overwrite diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/constant/triSurface/wing_5degrees.obj b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/constant/triSurface/wing_5degrees.obj new file mode 100644 index 0000000000000000000000000000000000000000..4be2aac5f2f0b963d2ec6208458908df4fd04c50 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/constant/triSurface/wing_5degrees.obj @@ -0,0 +1,1054 @@ +# Wavefront OBJ file written 2010-05-13T09:12:43 +o wing_5degrees + +# points : 520 +# faces : 520 +# zones : 1 +# 0 WALL10 (nFaces: 520) + +# <points count="520"> +v 1.00488 -0.0890722 -0.5 +v 1.00488 -0.0890722 0.5 +v 0.999453 -0.0870827 0.5 +v 0.999453 -0.0870827 -0.5 +v 0.993747 -0.0849908 0.5 +v 0.993747 -0.0849908 -0.5 +v 0.98776 -0.0827959 0.5 +v 0.98776 -0.0827959 -0.5 +v 0.981475 -0.0804834 0.5 +v 0.981475 -0.0804834 -0.5 +v 0.974878 -0.0780483 0.5 +v 0.974878 -0.0780483 -0.5 +v 0.967936 -0.075535 0.5 +v 0.967936 -0.075535 -0.5 +v 0.960671 -0.0728297 0.5 +v 0.960671 -0.0728297 -0.5 +v 0.952986 -0.070149 0.5 +v 0.952986 -0.070149 -0.5 +v 0.944915 -0.067332 0.5 +v 0.944915 -0.067332 -0.5 +v 0.936442 -0.064377 0.5 +v 0.936442 -0.064377 -0.5 +v 0.927543 -0.0612777 0.5 +v 0.927543 -0.0612777 -0.5 +v 0.918171 -0.0581074 0.5 +v 0.918171 -0.0581074 -0.5 +v 0.908345 -0.0547308 0.5 +v 0.908345 -0.0547308 -0.5 +v 0.897978 -0.0513371 0.5 +v 0.897978 -0.0513371 -0.5 +v 0.887113 -0.0477115 0.5 +v 0.887113 -0.0477115 -0.5 +v 0.875671 -0.0440076 0.5 +v 0.875671 -0.0440076 -0.5 +v 0.863634 -0.0401898 0.5 +v 0.863634 -0.0401898 -0.5 +v 0.850988 -0.0362043 0.5 +v 0.850988 -0.0362043 -0.5 +v 0.837677 -0.0321259 0.5 +v 0.837677 -0.0321259 -0.5 +v 0.8237 -0.0278406 0.5 +v 0.8237 -0.0278406 -0.5 +v 0.808997 -0.0234314 0.5 +v 0.808997 -0.0234314 -0.5 +v 0.793536 -0.0188824 0.5 +v 0.793536 -0.0188824 -0.5 +v 0.777248 -0.0142896 0.5 +v 0.777248 -0.0142896 -0.5 +v 0.760144 -0.00947585 0.5 +v 0.760144 -0.00947585 -0.5 +v 0.742148 -0.0045544 0.5 +v 0.742148 -0.0045544 -0.5 +v 0.723207 0.000449948 0.5 +v 0.723207 0.000449948 -0.5 +v 0.703296 0.00561154 0.5 +v 0.703296 0.00561154 -0.5 +v 0.682345 0.010854 0.5 +v 0.682345 0.010854 -0.5 +v 0.660295 0.0161554 0.5 +v 0.660295 0.0161554 -0.5 +v 0.637103 0.0215548 0.5 +v 0.637103 0.0215548 -0.5 +v 0.606829 0.0282606 0.5 +v 0.606829 0.0282606 -0.5 +v 0.578018 0.0343978 0.5 +v 0.578018 0.0343978 -0.5 +v 0.550557 0.0397874 0.5 +v 0.550557 0.0397874 -0.5 +v 0.524436 0.0447356 0.5 +v 0.524436 0.0447356 -0.5 +v 0.499549 0.0490421 0.5 +v 0.499549 0.0490421 -0.5 +v 0.475869 0.05291 0.5 +v 0.475869 0.05291 -0.5 +v 0.45334 0.0563729 0.5 +v 0.45334 0.0563729 -0.5 +v 0.431911 0.059484 0.5 +v 0.431911 0.059484 -0.5 +v 0.411518 0.0621876 0.5 +v 0.411518 0.0621876 -0.5 +v 0.392118 0.0645445 0.5 +v 0.392118 0.0645445 -0.5 +v 0.373644 0.0664046 0.5 +v 0.373644 0.0664046 -0.5 +v 0.356081 0.0680196 0.5 +v 0.356081 0.0680196 -0.5 +v 0.339375 0.0692961 0.5 +v 0.339375 0.0692961 -0.5 +v 0.323487 0.0702815 0.5 +v 0.323487 0.0702815 -0.5 +v 0.308383 0.0710035 0.5 +v 0.308383 0.0710035 -0.5 +v 0.294024 0.0714698 0.5 +v 0.294024 0.0714698 -0.5 +v 0.28038 0.0717809 0.5 +v 0.28038 0.0717809 -0.5 +v 0.267416 0.0719191 0.5 +v 0.267416 0.0719191 -0.5 +v 0.255099 0.0718222 0.5 +v 0.255099 0.0718222 -0.5 +v 0.243399 0.0716511 0.5 +v 0.243399 0.0716511 -0.5 +v 0.232288 0.0713208 0.5 +v 0.232288 0.0713208 -0.5 +v 0.221735 0.0709249 0.5 +v 0.221735 0.0709249 -0.5 +v 0.211715 0.0704338 0.5 +v 0.211715 0.0704338 -0.5 +v 0.202202 0.0698513 0.5 +v 0.202202 0.0698513 -0.5 +v 0.19317 0.0692271 0.5 +v 0.19317 0.0692271 -0.5 +v 0.184599 0.0685108 0.5 +v 0.184599 0.0685108 -0.5 +v 0.176464 0.0677409 0.5 +v 0.176464 0.0677409 -0.5 +v 0.168741 0.0669472 0.5 +v 0.168741 0.0669472 -0.5 +v 0.161418 0.0660755 0.5 +v 0.161418 0.0660755 -0.5 +v 0.154469 0.0651852 0.5 +v 0.154469 0.0651852 -0.5 +v 0.145493 0.0640314 0.5 +v 0.145493 0.0640314 -0.5 +v 0.136995 0.0627463 0.5 +v 0.136995 0.0627463 -0.5 +v 0.128932 0.0614383 0.5 +v 0.128932 0.0614383 -0.5 +v 0.121282 0.0601525 0.5 +v 0.121282 0.0601525 -0.5 +v 0.114049 0.0587416 0.5 +v 0.114049 0.0587416 -0.5 +v 0.107186 0.0573482 0.5 +v 0.107186 0.0573482 -0.5 +v 0.100675 0.0559871 0.5 +v 0.100675 0.0559871 -0.5 +v 0.0945147 0.0545794 0.5 +v 0.0945147 0.0545794 -0.5 +v 0.0886858 0.0531426 0.5 +v 0.0886858 0.0531426 -0.5 +v 0.0831659 0.0517083 0.5 +v 0.0831659 0.0517083 -0.5 +v 0.0779342 0.0503006 0.5 +v 0.0779342 0.0503006 -0.5 +v 0.072975 0.0489224 0.5 +v 0.072975 0.0489224 -0.5 +v 0.0682798 0.0475559 0.5 +v 0.0682798 0.0475559 -0.5 +v 0.0638499 0.0461601 0.5 +v 0.0638499 0.0461601 -0.5 +v 0.0596656 0.0447577 0.5 +v 0.0596656 0.0447577 -0.5 +v 0.055694 0.0434126 0.5 +v 0.055694 0.0434126 -0.5 +v 0.0519364 0.0420932 0.5 +v 0.0519364 0.0420932 -0.5 +v 0.0484053 0.0407363 0.5 +v 0.0484053 0.0407363 -0.5 +v 0.0450779 0.0393756 0.5 +v 0.0450779 0.0393756 -0.5 +v 0.0419215 0.0380722 0.5 +v 0.0419215 0.0380722 -0.5 +v 0.0389288 0.0368211 0.5 +v 0.0389288 0.0368211 -0.5 +v 0.036102 0.0355928 0.5 +v 0.036102 0.0355928 -0.5 +v 0.0334425 0.034368 0.5 +v 0.0334425 0.034368 -0.5 +v 0.0309496 0.0331356 0.5 +v 0.0309496 0.0331356 -0.5 +v 0.0286117 0.0319047 0.5 +v 0.0286117 0.0319047 -0.5 +v 0.0264077 0.0307022 0.5 +v 0.0264077 0.0307022 -0.5 +v 0.0243248 0.02954 0.5 +v 0.0243248 0.02954 -0.5 +v 0.0223665 0.0284014 0.5 +v 0.0223665 0.0284014 -0.5 +v 0.0205353 0.0272716 0.5 +v 0.0205353 0.0272716 -0.5 +v 0.0188204 0.0261581 0.5 +v 0.0188204 0.0261581 -0.5 +v 0.0172057 0.0250781 0.5 +v 0.0172057 0.0250781 -0.5 +v 0.015681 0.0240389 0.5 +v 0.015681 0.0240389 -0.5 +v 0.0142472 0.0230307 0.5 +v 0.0142472 0.0230307 -0.5 +v 0.0129051 0.0220434 0.5 +v 0.0129051 0.0220434 -0.5 +v 0.0116567 0.0210699 0.5 +v 0.0116567 0.0210699 -0.5 +v 0.0105044 0.0201047 0.5 +v 0.0105044 0.0201047 -0.5 +v 0.00944864 0.0191444 0.5 +v 0.00944864 0.0191444 -0.5 +v 0.00847997 0.0181956 0.5 +v 0.00847997 0.0181956 -0.5 +v 0.00758214 0.0172702 0.5 +v 0.00758214 0.0172702 -0.5 +v 0.00674204 0.0163779 0.5 +v 0.00674204 0.0163779 -0.5 +v 0.00595671 0.0155186 0.5 +v 0.00595671 0.0155186 -0.5 +v 0.00523198 0.0146848 0.5 +v 0.00523198 0.0146848 -0.5 +v 0.00457157 0.0138701 0.5 +v 0.00457157 0.0138701 -0.5 +v 0.00397503 0.0130721 0.5 +v 0.00397503 0.0130721 -0.5 +v 0.00343506 0.0122936 0.5 +v 0.00343506 0.0122936 -0.5 +v 0.0029443 0.0115379 0.5 +v 0.0029443 0.0115379 -0.5 +v 0.0024965 0.010807 0.5 +v 0.0024965 0.010807 -0.5 +v 0.00209053 0.0101012 0.5 +v 0.00209053 0.0101012 -0.5 +v 0.00172938 0.00941821 0.5 +v 0.00172938 0.00941821 -0.5 +v 0.00141481 0.00875662 0.5 +v 0.00141481 0.00875662 -0.5 +v 0.00114703 0.00811509 0.5 +v 0.00114703 0.00811509 -0.5 +v 0.000922634 0.00749375 0.5 +v 0.000922634 0.00749375 -0.5 +v 0.00073432 0.00689421 0.5 +v 0.00073432 0.00689421 -0.5 +v 0.000575606 0.00631745 0.5 +v 0.000575606 0.00631745 -0.5 +v 0.000441178 0.00576428 0.5 +v 0.000441178 0.00576428 -0.5 +v 0.000326628 0.00523494 0.5 +v 0.000326628 0.00523494 -0.5 +v 0.000229331 0.00472926 0.5 +v 0.000229331 0.00472926 -0.5 +v 0.000147968 0.00424663 0.5 +v 0.000147968 0.00424663 -0.5 +v 8.13071e-05 0.00378656 0.5 +v 8.13071e-05 0.00378656 -0.5 +v 2.81186e-05 0.00334838 0.5 +v 2.81186e-05 0.00334838 -0.5 +v -1.28053e-05 0.00293132 0.5 +v -1.28053e-05 0.00293132 -0.5 +v -4.26138e-05 0.00253464 0.5 +v -4.26138e-05 0.00253464 -0.5 +v -6.24104e-05 0.00215753 0.5 +v -6.24104e-05 0.00215753 -0.5 +v -7.32354e-05 0.00179922 0.5 +v -7.32354e-05 0.00179922 -0.5 +v -7.6066e-05 0.00145891 0.5 +v -7.6066e-05 0.00145891 -0.5 +v -7.18149e-05 0.00113574 0.5 +v -7.18149e-05 0.00113574 -0.5 +v -6.13265e-05 0.000828962 0.5 +v -6.13265e-05 0.000828962 -0.5 +v -4.5388e-05 0.000537894 0.5 +v -4.5388e-05 0.000537894 -0.5 +v -2.47174e-05 0.000261729 0.5 +v -2.47174e-05 0.000261729 -0.5 +v 0.999428 -0.0886333 -0.5 +v 0.999428 -0.0886333 0.5 +v 0 0 0.5 +v 0 0 -0.5 +v 3.07731e-05 -0.000269468 0.5 +v 3.07731e-05 -0.000269468 -0.5 +v 6.87839e-05 -0.000551758 0.5 +v 6.87839e-05 -0.000551758 -0.5 +v 0.00011487 -0.000847395 0.5 +v 0.00011487 -0.000847395 -0.5 +v 0.000169958 -0.00115699 0.5 +v 0.000169958 -0.00115699 -0.5 +v 0.000235006 -0.00148084 0.5 +v 0.000235006 -0.00148084 -0.5 +v 0.000311085 -0.00181947 0.5 +v 0.000311085 -0.00181947 -0.5 +v 0.000399343 -0.00217329 0.5 +v 0.000399343 -0.00217329 -0.5 +v 0.000501006 -0.00254265 0.5 +v 0.000501006 -0.00254265 -0.5 +v 0.000617405 -0.00292793 0.5 +v 0.000617405 -0.00292793 -0.5 +v 0.000749918 -0.00332928 0.5 +v 0.000749918 -0.00332928 -0.5 +v 0.000900098 -0.00374706 0.5 +v 0.000900098 -0.00374706 -0.5 +v 0.00106951 -0.00418123 0.5 +v 0.00106951 -0.00418123 -0.5 +v 0.00125981 -0.00463173 0.5 +v 0.00125981 -0.00463173 -0.5 +v 0.00147278 -0.00509836 0.5 +v 0.00147278 -0.00509836 -0.5 +v 0.00171023 -0.00558073 0.5 +v 0.00171023 -0.00558073 -0.5 +v 0.0019741 -0.00607866 0.5 +v 0.0019741 -0.00607866 -0.5 +v 0.00226657 -0.00659235 0.5 +v 0.00226657 -0.00659235 -0.5 +v 0.00258985 -0.00712192 0.5 +v 0.00258985 -0.00712192 -0.5 +v 0.00294625 -0.00766749 0.5 +v 0.00294625 -0.00766749 -0.5 +v 0.0033381 -0.00822888 0.5 +v 0.0033381 -0.00822888 -0.5 +v 0.00376858 -0.00880495 0.5 +v 0.00376858 -0.00880495 -0.5 +v 0.00424144 -0.00939356 0.5 +v 0.00424144 -0.00939356 -0.5 +v 0.0047608 -0.00999197 0.5 +v 0.0047608 -0.00999197 -0.5 +v 0.00533108 -0.0105969 0.5 +v 0.00533108 -0.0105969 -0.5 +v 0.00595465 -0.0112076 0.5 +v 0.00595465 -0.0112076 -0.5 +v 0.00663108 -0.0118268 0.5 +v 0.00663108 -0.0118268 -0.5 +v 0.00735864 -0.0124589 0.5 +v 0.00735864 -0.0124589 -0.5 +v 0.00813479 -0.0131082 0.5 +v 0.00813479 -0.0131082 -0.5 +v 0.00896315 -0.0137726 0.5 +v 0.00896315 -0.0137726 -0.5 +v 0.00985143 -0.0144449 0.5 +v 0.00985143 -0.0144449 -0.5 +v 0.0108089 -0.0151156 0.5 +v 0.0108089 -0.0151156 -0.5 +v 0.0118417 -0.0157801 0.5 +v 0.0118417 -0.0157801 -0.5 +v 0.0129485 -0.0164439 0.5 +v 0.0129485 -0.0164439 -0.5 +v 0.0141258 -0.0171158 0.5 +v 0.0141258 -0.0171158 -0.5 +v 0.0153717 -0.0178024 0.5 +v 0.0153717 -0.0178024 -0.5 +v 0.0166914 -0.0185005 0.5 +v 0.0166914 -0.0185005 -0.5 +v 0.0180921 -0.0192037 0.5 +v 0.0180921 -0.0192037 -0.5 +v 0.01958 -0.019908 0.5 +v 0.01958 -0.019908 -0.5 +v 0.0211576 -0.0206151 0.5 +v 0.0211576 -0.0206151 -0.5 +v 0.0228265 -0.0213288 0.5 +v 0.0228265 -0.0213288 -0.5 +v 0.0245895 -0.0220523 0.5 +v 0.0245895 -0.0220523 -0.5 +v 0.0264506 -0.0227868 0.5 +v 0.0264506 -0.0227868 -0.5 +v 0.028415 -0.0235332 0.5 +v 0.028415 -0.0235332 -0.5 +v 0.0304905 -0.0242814 0.5 +v 0.0304905 -0.0242814 -0.5 +v 0.0326872 -0.0250146 0.5 +v 0.0326872 -0.0250146 -0.5 +v 0.0350128 -0.0257258 0.5 +v 0.0350128 -0.0257258 -0.5 +v 0.0374672 -0.0264333 0.5 +v 0.0374672 -0.0264333 -0.5 +v 0.0400497 -0.0271566 0.5 +v 0.0400497 -0.0271566 -0.5 +v 0.0427704 -0.0278802 0.5 +v 0.0427704 -0.0278802 -0.5 +v 0.0456434 -0.0285739 0.5 +v 0.0456434 -0.0285739 -0.5 +v 0.0486731 -0.0292495 0.5 +v 0.0486731 -0.0292495 -0.5 +v 0.0518554 -0.0299566 0.5 +v 0.0518554 -0.0299566 -0.5 +v 0.0551966 -0.030697 0.5 +v 0.0551966 -0.030697 -0.5 +v 0.0587179 -0.0314085 0.5 +v 0.0587179 -0.0314085 -0.5 +v 0.062431 -0.032078 0.5 +v 0.062431 -0.032078 -0.5 +v 0.0663314 -0.0327743 0.5 +v 0.0663314 -0.0327743 -0.5 +v 0.0704248 -0.033514 0.5 +v 0.0704248 -0.033514 -0.5 +v 0.0747335 -0.0342256 0.5 +v 0.0747335 -0.0342256 -0.5 +v 0.0792714 -0.0348902 0.5 +v 0.0792714 -0.0348902 -0.5 +v 0.0840416 -0.0355492 0.5 +v 0.0840416 -0.0355492 -0.5 +v 0.089054 -0.0362103 0.5 +v 0.089054 -0.0362103 -0.5 +v 0.0943226 -0.0368627 0.5 +v 0.0943226 -0.0368627 -0.5 +v 0.0998603 -0.0375041 0.5 +v 0.0998603 -0.0375041 -0.5 +v 0.105679 -0.0381355 0.5 +v 0.105679 -0.0381355 -0.5 +v 0.111793 -0.0387575 0.5 +v 0.111793 -0.0387575 -0.5 +v 0.118218 -0.0393567 0.5 +v 0.118218 -0.0393567 -0.5 +v 0.124968 -0.0399429 0.5 +v 0.124968 -0.0399429 -0.5 +v 0.132055 -0.0405782 0.5 +v 0.132055 -0.0405782 -0.5 +v 0.1395 -0.0411771 0.5 +v 0.1395 -0.0411771 -0.5 +v 0.147326 -0.041699 0.5 +v 0.147326 -0.041699 -0.5 +v 0.15451 -0.0421969 0.5 +v 0.15451 -0.0421969 -0.5 +v 0.162054 -0.042698 0.5 +v 0.162054 -0.042698 -0.5 +v 0.16998 -0.0431596 0.5 +v 0.16998 -0.0431596 -0.5 +v 0.178305 -0.0435984 0.5 +v 0.178305 -0.0435984 -0.5 +v 0.187045 -0.0440696 0.5 +v 0.187045 -0.0440696 -0.5 +v 0.196223 -0.0445349 0.5 +v 0.196223 -0.0445349 -0.5 +v 0.205864 -0.0449725 0.5 +v 0.205864 -0.0449725 -0.5 +v 0.215985 -0.045448 0.5 +v 0.215985 -0.045448 -0.5 +v 0.226615 -0.0458797 0.5 +v 0.226615 -0.0458797 -0.5 +v 0.237778 -0.0463184 0.5 +v 0.237778 -0.0463184 -0.5 +v 0.249497 -0.0468156 0.5 +v 0.249497 -0.0468156 -0.5 +v 0.261804 -0.0472732 0.5 +v 0.261804 -0.0472732 -0.5 +v 0.274727 -0.0477637 0.5 +v 0.274727 -0.0477637 -0.5 +v 0.288294 -0.0483182 0.5 +v 0.288294 -0.0483182 -0.5 +v 0.302542 -0.0488257 0.5 +v 0.302542 -0.0488257 -0.5 +v 0.317502 -0.0493844 0.5 +v 0.317502 -0.0493844 -0.5 +v 0.33321 -0.0499788 0.5 +v 0.33321 -0.0499788 -0.5 +v 0.349702 -0.0506056 0.5 +v 0.349702 -0.0506056 -0.5 +v 0.367015 -0.0513872 0.5 +v 0.367015 -0.0513872 -0.5 +v 0.385192 -0.0522281 0.5 +v 0.385192 -0.0522281 -0.5 +v 0.404277 -0.0531254 0.5 +v 0.404277 -0.0531254 -0.5 +v 0.424316 -0.0540817 0.5 +v 0.424316 -0.0540817 -0.5 +v 0.445357 -0.0550979 0.5 +v 0.445357 -0.0550979 -0.5 +v 0.467451 -0.0560874 0.5 +v 0.467451 -0.0560874 -0.5 +v 0.490649 -0.0571824 0.5 +v 0.490649 -0.0571824 -0.5 +v 0.51501 -0.0582757 0.5 +v 0.51501 -0.0582757 -0.5 +v 0.540585 -0.0594903 0.5 +v 0.540585 -0.0594903 -0.5 +v 0.567439 -0.0607815 0.5 +v 0.567439 -0.0607815 -0.5 +v 0.595635 -0.0621304 0.5 +v 0.595635 -0.0621304 -0.5 +v 0.625242 -0.0635352 0.5 +v 0.625242 -0.0635352 -0.5 +v 0.649433 -0.0648334 0.5 +v 0.649433 -0.0648334 -0.5 +v 0.672415 -0.0660494 0.5 +v 0.672415 -0.0660494 -0.5 +v 0.694245 -0.0672674 0.5 +v 0.694245 -0.0672674 -0.5 +v 0.714979 -0.0684936 0.5 +v 0.714979 -0.0684936 -0.5 +v 0.734678 -0.0696472 0.5 +v 0.734678 -0.0696472 -0.5 +v 0.753392 -0.070724 0.5 +v 0.753392 -0.070724 -0.5 +v 0.771162 -0.0718742 0.5 +v 0.771162 -0.0718742 -0.5 +v 0.788046 -0.0729552 0.5 +v 0.788046 -0.0729552 -0.5 +v 0.804086 -0.0739668 0.5 +v 0.804086 -0.0739668 -0.5 +v 0.819316 -0.0750462 0.5 +v 0.819316 -0.0750462 -0.5 +v 0.833785 -0.076061 0.5 +v 0.833785 -0.076061 -0.5 +v 0.847532 -0.0770175 0.5 +v 0.847532 -0.0770175 -0.5 +v 0.86059 -0.0779215 0.5 +v 0.86059 -0.0779215 -0.5 +v 0.872998 -0.0787716 0.5 +v 0.872998 -0.0787716 -0.5 +v 0.884776 -0.079698 0.5 +v 0.884776 -0.079698 -0.5 +v 0.89597 -0.0805061 0.5 +v 0.89597 -0.0805061 -0.5 +v 0.906605 -0.0812554 0.5 +v 0.906605 -0.0812554 -0.5 +v 0.916704 -0.0820352 0.5 +v 0.916704 -0.0820352 -0.5 +v 0.926301 -0.0827494 0.5 +v 0.926301 -0.0827494 -0.5 +v 0.935409 -0.0835384 0.5 +v 0.935409 -0.0835384 -0.5 +v 0.944071 -0.0841575 0.5 +v 0.944071 -0.0841575 -0.5 +v 0.952294 -0.0848264 0.5 +v 0.952294 -0.0848264 -0.5 +v 0.960109 -0.0854166 0.5 +v 0.960109 -0.0854166 -0.5 +v 0.967527 -0.0860602 0.5 +v 0.967527 -0.0860602 -0.5 +v 0.97458 -0.0865997 0.5 +v 0.97458 -0.0865997 -0.5 +v 0.981277 -0.0871547 0.5 +v 0.981277 -0.0871547 -0.5 +v 0.987637 -0.0876912 0.5 +v 0.987637 -0.0876912 -0.5 +v 0.993684 -0.0881407 0.5 +v 0.993684 -0.0881407 -0.5 +# </points> + +# <faces count="520"> +g WALL10 +f 1 2 3 +f 3 4 1 +f 4 3 5 +f 5 6 4 +f 6 5 7 +f 7 8 6 +f 8 7 9 +f 9 10 8 +f 10 9 11 +f 11 12 10 +f 12 11 13 +f 13 14 12 +f 14 13 15 +f 15 16 14 +f 16 15 17 +f 17 18 16 +f 18 17 19 +f 19 20 18 +f 20 19 21 +f 21 22 20 +f 22 21 23 +f 23 24 22 +f 24 23 25 +f 25 26 24 +f 26 25 27 +f 27 28 26 +f 28 27 29 +f 29 30 28 +f 30 29 31 +f 31 32 30 +f 32 31 33 +f 33 34 32 +f 34 33 35 +f 35 36 34 +f 36 35 37 +f 37 38 36 +f 38 37 39 +f 39 40 38 +f 40 39 41 +f 41 42 40 +f 42 41 43 +f 43 44 42 +f 44 43 45 +f 45 46 44 +f 46 45 47 +f 47 48 46 +f 48 47 49 +f 49 50 48 +f 50 49 51 +f 51 52 50 +f 52 51 53 +f 53 54 52 +f 54 53 55 +f 55 56 54 +f 56 55 57 +f 57 58 56 +f 58 57 59 +f 59 60 58 +f 60 59 61 +f 61 62 60 +f 62 61 63 +f 63 64 62 +f 64 63 65 +f 65 66 64 +f 66 65 67 +f 67 68 66 +f 68 67 69 +f 69 70 68 +f 70 69 71 +f 71 72 70 +f 72 71 73 +f 73 74 72 +f 74 73 75 +f 75 76 74 +f 76 75 77 +f 77 78 76 +f 78 77 79 +f 79 80 78 +f 80 79 81 +f 81 82 80 +f 82 81 83 +f 83 84 82 +f 84 83 85 +f 85 86 84 +f 86 85 87 +f 87 88 86 +f 88 87 89 +f 89 90 88 +f 90 89 91 +f 91 92 90 +f 92 91 93 +f 93 94 92 +f 94 93 95 +f 95 96 94 +f 96 95 97 +f 97 98 96 +f 98 97 99 +f 99 100 98 +f 100 99 101 +f 101 102 100 +f 102 101 103 +f 103 104 102 +f 104 103 105 +f 105 106 104 +f 106 105 107 +f 107 108 106 +f 108 107 109 +f 109 110 108 +f 110 109 111 +f 111 112 110 +f 112 111 113 +f 113 114 112 +f 114 113 115 +f 115 116 114 +f 116 115 117 +f 117 118 116 +f 118 117 119 +f 119 120 118 +f 120 119 121 +f 121 122 120 +f 122 121 123 +f 123 124 122 +f 124 123 125 +f 125 126 124 +f 126 125 127 +f 127 128 126 +f 128 127 129 +f 129 130 128 +f 130 129 131 +f 131 132 130 +f 132 131 133 +f 133 134 132 +f 134 133 135 +f 135 136 134 +f 136 135 137 +f 137 138 136 +f 138 137 139 +f 139 140 138 +f 140 139 141 +f 141 142 140 +f 142 141 143 +f 143 144 142 +f 144 143 145 +f 145 146 144 +f 146 145 147 +f 147 148 146 +f 148 147 149 +f 149 150 148 +f 150 149 151 +f 151 152 150 +f 152 151 153 +f 153 154 152 +f 154 153 155 +f 155 156 154 +f 156 155 157 +f 157 158 156 +f 158 157 159 +f 159 160 158 +f 160 159 161 +f 161 162 160 +f 162 161 163 +f 163 164 162 +f 164 163 165 +f 165 166 164 +f 166 165 167 +f 167 168 166 +f 168 167 169 +f 169 170 168 +f 170 169 171 +f 171 172 170 +f 172 171 173 +f 173 174 172 +f 174 173 175 +f 175 176 174 +f 176 175 177 +f 177 178 176 +f 178 177 179 +f 179 180 178 +f 180 179 181 +f 181 182 180 +f 182 181 183 +f 183 184 182 +f 184 183 185 +f 185 186 184 +f 186 185 187 +f 187 188 186 +f 188 187 189 +f 189 190 188 +f 190 189 191 +f 191 192 190 +f 192 191 193 +f 193 194 192 +f 194 193 195 +f 195 196 194 +f 196 195 197 +f 197 198 196 +f 198 197 199 +f 199 200 198 +f 200 199 201 +f 201 202 200 +f 202 201 203 +f 203 204 202 +f 204 203 205 +f 205 206 204 +f 206 205 207 +f 207 208 206 +f 208 207 209 +f 209 210 208 +f 210 209 211 +f 211 212 210 +f 212 211 213 +f 213 214 212 +f 214 213 215 +f 215 216 214 +f 216 215 217 +f 217 218 216 +f 218 217 219 +f 219 220 218 +f 220 219 221 +f 221 222 220 +f 222 221 223 +f 223 224 222 +f 224 223 225 +f 225 226 224 +f 226 225 227 +f 227 228 226 +f 228 227 229 +f 229 230 228 +f 230 229 231 +f 231 232 230 +f 232 231 233 +f 233 234 232 +f 234 233 235 +f 235 236 234 +f 236 235 237 +f 237 238 236 +f 238 237 239 +f 239 240 238 +f 240 239 241 +f 241 242 240 +f 242 241 243 +f 243 244 242 +f 244 243 245 +f 245 246 244 +f 246 245 247 +f 247 248 246 +f 248 247 249 +f 249 250 248 +f 250 249 251 +f 251 252 250 +f 252 251 253 +f 253 254 252 +f 254 253 255 +f 255 256 254 +f 256 255 257 +f 257 258 256 +f 258 257 259 +f 259 260 258 +f 261 262 2 +f 2 1 261 +f 260 259 263 +f 263 264 260 +f 264 263 265 +f 265 266 264 +f 266 265 267 +f 267 268 266 +f 268 267 269 +f 269 270 268 +f 270 269 271 +f 271 272 270 +f 272 271 273 +f 273 274 272 +f 274 273 275 +f 275 276 274 +f 276 275 277 +f 277 278 276 +f 278 277 279 +f 279 280 278 +f 280 279 281 +f 281 282 280 +f 282 281 283 +f 283 284 282 +f 284 283 285 +f 285 286 284 +f 286 285 287 +f 287 288 286 +f 288 287 289 +f 289 290 288 +f 290 289 291 +f 291 292 290 +f 292 291 293 +f 293 294 292 +f 294 293 295 +f 295 296 294 +f 296 295 297 +f 297 298 296 +f 298 297 299 +f 299 300 298 +f 300 299 301 +f 301 302 300 +f 302 301 303 +f 303 304 302 +f 304 303 305 +f 305 306 304 +f 306 305 307 +f 307 308 306 +f 308 307 309 +f 309 310 308 +f 310 309 311 +f 311 312 310 +f 312 311 313 +f 313 314 312 +f 314 313 315 +f 315 316 314 +f 316 315 317 +f 317 318 316 +f 318 317 319 +f 319 320 318 +f 320 319 321 +f 321 322 320 +f 322 321 323 +f 323 324 322 +f 324 323 325 +f 325 326 324 +f 326 325 327 +f 327 328 326 +f 328 327 329 +f 329 330 328 +f 330 329 331 +f 331 332 330 +f 332 331 333 +f 333 334 332 +f 334 333 335 +f 335 336 334 +f 336 335 337 +f 337 338 336 +f 338 337 339 +f 339 340 338 +f 340 339 341 +f 341 342 340 +f 342 341 343 +f 343 344 342 +f 344 343 345 +f 345 346 344 +f 346 345 347 +f 347 348 346 +f 348 347 349 +f 349 350 348 +f 350 349 351 +f 351 352 350 +f 352 351 353 +f 353 354 352 +f 354 353 355 +f 355 356 354 +f 356 355 357 +f 357 358 356 +f 358 357 359 +f 359 360 358 +f 360 359 361 +f 361 362 360 +f 362 361 363 +f 363 364 362 +f 364 363 365 +f 365 366 364 +f 366 365 367 +f 367 368 366 +f 368 367 369 +f 369 370 368 +f 370 369 371 +f 371 372 370 +f 372 371 373 +f 373 374 372 +f 374 373 375 +f 375 376 374 +f 376 375 377 +f 377 378 376 +f 378 377 379 +f 379 380 378 +f 380 379 381 +f 381 382 380 +f 382 381 383 +f 383 384 382 +f 384 383 385 +f 385 386 384 +f 386 385 387 +f 387 388 386 +f 388 387 389 +f 389 390 388 +f 390 389 391 +f 391 392 390 +f 392 391 393 +f 393 394 392 +f 394 393 395 +f 395 396 394 +f 396 395 397 +f 397 398 396 +f 398 397 399 +f 399 400 398 +f 400 399 401 +f 401 402 400 +f 402 401 403 +f 403 404 402 +f 404 403 405 +f 405 406 404 +f 406 405 407 +f 407 408 406 +f 408 407 409 +f 409 410 408 +f 410 409 411 +f 411 412 410 +f 412 411 413 +f 413 414 412 +f 414 413 415 +f 415 416 414 +f 416 415 417 +f 417 418 416 +f 418 417 419 +f 419 420 418 +f 420 419 421 +f 421 422 420 +f 422 421 423 +f 423 424 422 +f 424 423 425 +f 425 426 424 +f 426 425 427 +f 427 428 426 +f 428 427 429 +f 429 430 428 +f 430 429 431 +f 431 432 430 +f 432 431 433 +f 433 434 432 +f 434 433 435 +f 435 436 434 +f 436 435 437 +f 437 438 436 +f 438 437 439 +f 439 440 438 +f 440 439 441 +f 441 442 440 +f 442 441 443 +f 443 444 442 +f 444 443 445 +f 445 446 444 +f 446 445 447 +f 447 448 446 +f 448 447 449 +f 449 450 448 +f 450 449 451 +f 451 452 450 +f 452 451 453 +f 453 454 452 +f 454 453 455 +f 455 456 454 +f 456 455 457 +f 457 458 456 +f 458 457 459 +f 459 460 458 +f 460 459 461 +f 461 462 460 +f 462 461 463 +f 463 464 462 +f 464 463 465 +f 465 466 464 +f 466 465 467 +f 467 468 466 +f 468 467 469 +f 469 470 468 +f 470 469 471 +f 471 472 470 +f 472 471 473 +f 473 474 472 +f 474 473 475 +f 475 476 474 +f 476 475 477 +f 477 478 476 +f 478 477 479 +f 479 480 478 +f 480 479 481 +f 481 482 480 +f 482 481 483 +f 483 484 482 +f 484 483 485 +f 485 486 484 +f 486 485 487 +f 487 488 486 +f 488 487 489 +f 489 490 488 +f 490 489 491 +f 491 492 490 +f 492 491 493 +f 493 494 492 +f 494 493 495 +f 495 496 494 +f 496 495 497 +f 497 498 496 +f 498 497 499 +f 499 500 498 +f 500 499 501 +f 501 502 500 +f 502 501 503 +f 503 504 502 +f 504 503 505 +f 505 506 504 +f 506 505 507 +f 507 508 506 +f 508 507 509 +f 509 510 508 +f 510 509 511 +f 511 512 510 +f 512 511 513 +f 513 514 512 +f 514 513 515 +f 515 516 514 +f 516 515 517 +f 517 518 516 +f 518 517 519 +f 519 520 518 +f 520 519 262 +f 262 261 520 +# </faces> diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/blockMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..5151eb3c5f61e739724cbbfcbeb95f73a74e716e --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/blockMeshDict @@ -0,0 +1,93 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-1.2 -2.2 -0.1) + ( 5 -2.2 -0.1) + ( 5 2.2 -0.1) + (-1.2 2.2 -0.1) + (-1.2 -2.2 0.1) + ( 5 -2.2 0.1) + ( 5 2.2 0.1) + (-1.2 2.2 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (36 24 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + topAndBottom + { + type patch; + faces + ( + (3 7 6 2) + (1 5 4 0) + ); + } + + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type patch; + faces + ( + (2 6 5 1) + ); + } + + symFront + { + type symmetryPlane; + faces + ( + (4 5 6 7) + ); + } + + symBack + { + type symmetryPlane; + faces + ( + (0 3 2 1) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/controlDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..28130318d743dd4236bf0f2ae3226e1925750e95 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application snappyHexMesh; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 100; + +deltaT 1; + +writeControl runTime; + +writeInterval 1; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/fvSchemes b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..52f9f1efc28040d10b13f2a2ac6e8c16587e7804 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/fvSchemes @@ -0,0 +1,56 @@ +/*--------------------------------*- 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; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phid,p) Gauss limitedLinear 1; + div(phi,K) Gauss limitedLinear 1; + div(phi,e) Gauss limitedLinear 1; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited corrected 0.5; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/fvSolution b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..04a2dd4fdbe390b7872f54c8a0a587e53fd86c0b --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/fvSolution @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 +{ + p + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-12; + relTol 0; + } + + rho + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0; + } + + "(U|e|k|epsilon|R)" + { + $p; + tolerance 1e-08; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 2; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/snappyHexMeshDict b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/snappyHexMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..4f7f6b1a1b1dc6b6d21d71c5cc8e32a71fcb6e77 --- /dev/null +++ b/tutorials/incompressible/overSimpleFoam/aeroFoil/background_snappyHexMesh/system/snappyHexMeshDict @@ -0,0 +1,290 @@ +/*--------------------------------*- 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 snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap true; +addLayers false; + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + + refinementBox + { + type searchableBox; + min (-5 -1 -1); + max ( 5 1 1); + } +}; + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 100000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just + // a few cells. This setting will cause refinement to stop if <= + // minimumRefine are selected for refinement. Note: it will at least do one + // iteration (unless the number of cells to refine is 0) + minRefinementCells 100; + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 6; + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + features (); + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + refinementSurfaces + { + } + + // Resolve sharp angles on fridges + resolveFeatureAngle 30; + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + refinementBox + { + mode inside; + levels ((1e15 1)); + } + } + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (-0.5 0 0.0); + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces true; +} + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 4.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 30; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; +} + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + wing + { + nSurfaceLayers 3; + } + } + + // Expansion factor for layer mesh + expansionRatio 1.3; + + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + finalLayerThickness 0.7; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + minThickness 0.25; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 60; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 16x! 90 degrees corresponds to 130 in 16x. + minMedianAxisAngle 90; + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 65; + + //- Max skewness allowed. Set to <0 to disable. + maxBoundarySkewness 20; + maxInternalSkewness 4; + + //- Max concaveness allowed. Is angle (in degrees) below which concavity + // is allowed. 0 is straight face, <0 would be convex face. + // Set to 180 to disable. + maxConcave 80; + + //- Minimum pyramid volume. Is absolute volume of cell pyramid. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. + minVol 1e-13; + + //- Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet + minTetQuality 1e-30; + + //- Minimum face area. Set to <0 to disable. + minArea -1; + + //- Minimum face twist. Set to <-1 to disable. dot product of face normal + // and face centre triangles normal + minTwist 0.05; + + //- Minimum normalised cell determinant + // 1 = hex, <= 0 = folded or flattened illegal cell + minDeterminant 0.001; + + //- minFaceWeight (0 -> 0.5) + minFaceWeight 0.05; + + //- minVolRatio (0 -> 1) + minVolRatio 0.01; + + //must be >0 for Fluent compatibility + minTriangleTwist -1; + + // Advanced + + //- Number of error distribution iterations + nSmoothScale 4; + //- Amount to scale back displacement at error points + errorReduction 0.75; +} + +// Advanced + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/Allclean b/tutorials/multiphase/overInterDyMFoam/floatingBody/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..e3c5c15e9c9086e649acfb0b94273f289c08cac0 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +(cd background && ./Allclean) +(cd floatingBody && ./Allclean) + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/Allrun b/tutorials/multiphase/overInterDyMFoam/floatingBody/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..95ffcc4bf4c2eb11eb4de646685f234b2c940bb6 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/Allrun @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre +(cd background && runApplication $(getApplication)) + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/Allrun.pre b/tutorials/multiphase/overInterDyMFoam/floatingBody/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..a69774179d3a8170a4828c98c802bb5c9c308f63 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/Allrun.pre @@ -0,0 +1,8 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# mesh floating body +(cd floatingBody && ./Allrun.pre) + +# Add background mesh +(cd background && ./Allrun.pre) diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/U b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..a63b70f9b0f7998bdc259db17a0ca494e113b46a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/U @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type fixedValue; + value uniform (0 0 0); + } + atmosphere + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } + floatingObject + { + type movingWallVelocity; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/alpha.water b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..672fe184ceff4f1c79455194ef3e99a1f073cf3a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/alpha.water @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: overlap | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type zeroGradient; + } + atmosphere + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + floatingObject + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/epsilon b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..55bbd29c2f13859f270604183335843d9c2fbf81 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/epsilon @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 0.1; + +boundaryField +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.1; + } + atmosphere + { + type inletOutlet; + inletValue uniform 0.1; + value uniform 0.1; + } + floatingObject + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/k b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/k new file mode 100644 index 0000000000000000000000000000000000000000..b1a2019085727cec704b968e0447935f2e3891d1 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/k @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.1; + +boundaryField +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type kqRWallFunction; + value uniform 0.1; + } + atmosphere + { + type inletOutlet; + inletValue uniform 0.1; + value uniform 0.1; + } + floatingObject + { + type kqRWallFunction; + value uniform 0.1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/nut b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/nut new file mode 100644 index 0000000000000000000000000000000000000000..282297cbd887aaa50dc26befe22e23b2bd2a8720 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/nut @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + atmosphere + { + type calculated; + value uniform 0; + } + floatingObject + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/p_rgh b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..75ac340beaf83b87429956fcb046bb9281704d7f --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/p_rgh @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + oversetPatch + { + type overset; + } + stationaryWalls + { + type fixedFluxPressure; + } + atmosphere + { + type totalPressure; + p0 uniform 0; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + value uniform 0; + } + floatingObject + { + type fixedFluxPressure; + } + overset + { + patchType overset; + type fixedFluxPressure; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/pointDisplacement b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..d23a59c0e10d3215ccc768b0fa92fd2ca66103da --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/pointDisplacement @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type fixedValue; + value uniform (0 0 0); + } + atmosphere + { + type fixedValue; + value uniform (0 0 0); + } + floatingObject + { + type calculated; + value uniform (0 0 0); + } + oversetPatch + { + patchType overset; + type zeroGradient; + } + sides + { + patchType overset; + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/zoneID b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/zoneID new file mode 100644 index 0000000000000000000000000000000000000000..384338071d3461a3b5ee60bf1d7c3f6246a865c0 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/0.org/zoneID @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: overlap | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ 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 +{ + //- Set patchGroups for constraint patches + #includeEtc "caseDicts/setConstraintTypes" + + stationaryWalls + { + type zeroGradient; + } + atmosphere + { + type zeroGradient; + } + floatingObject + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/Allclean b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..d16400a94f636d461b62f6f909c2d64d7e29c335 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 > /dev/null 2>&1 + +cleanCase + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/Allrun.pre b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..78da51948ae9f124254eb7450925a985d0d40fc5 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/Allrun.pre @@ -0,0 +1,17 @@ +#!/bin/sh +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Create background mesh +runApplication blockMesh + +# Add the cylinder mesh +runApplication mergeMeshes . ../floatingBody -overwrite + +# Select cellSets for the different zones +runApplication topoSet + +# Copy standard fields +rm -rf 0 && cp -r 0.org 0 + +# Use cellSets to write zoneID +runApplication setFields diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/background.foam b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/background.foam new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..197de15a5242d3a633d6233582f652301e2d8630 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/dynamicMeshDict @@ -0,0 +1,104 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object motionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motionSolverLibs ("libsixDoFRigidBodyMotion.so"); + + +dynamicFvMesh dynamicOversetFvMesh; + +dynamicOversetFvMeshCoeffs +{ +} + +solver sixDoFRigidBodyMotion; + +sixDoFRigidBodyMotionCoeffs +{ + + patches (floatingObject); + innerDistance 100.0; + outerDistance 101.0; + + centreOfMass (0.5 0.5 0.3); + + // Cuboid dimensions + Lx 0.24; + Ly 0.24; + Lz 0.4; + + // Density of the solid + rhoSolid 700; + + // Cuboid mass + mass #calc "$rhoSolid*$Lx*$Ly*$Lz"; + + // Cuboid moment of inertia about the centre of mass + momentOfInertia #codeStream + { + codeInclude + #{ + #include "diagTensor.H" + #}; + + code + #{ + scalar sqrLx = sqr($Lx); + scalar sqrLy = sqr($Ly); + scalar sqrLz = sqr($Lz); + os << + $mass + *diagTensor(sqrLy + sqrLz, sqrLx + sqrLz, sqrLx + sqrLy)/12.0; + #}; + }; + + report on; + accelerationRelaxation 0.6; + + solver + { + type Newmark; + } + + constraints + { + + /* + fixedPoint + { + sixDoFRigidBodyMotionConstraint point; + centreOfRotation (0.5 0.45 0.1); + } + */ + + fixedLine + { + sixDoFRigidBodyMotionConstraint line; + //centreOfRotation (0.5 0.45 0.1); + direction (0 0 1); + } + + /* + fixedAxis + { + sixDoFRigidBodyMotionConstraint axis; + axis (0 1 0); + } + */ + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/g b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..897615a50df92736e7b9c64bb2e64fba539496fc --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..3729fc7648bb9d76cae6c48139d4b359b92e526c --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/transportProperties @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 998.2; +} + +air +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/turbulenceProperties b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..cd2daf8229ba0b2be3dca97cab3a5c08f20b0e8a --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/constant/turbulenceProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..bff73562f4cad80a773f6b19cc588acaac55d06e --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/blockMeshDict @@ -0,0 +1,76 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 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) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (35 35 35) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + // Dummy patch to trigger overset interpolation before any other + // bcs + oversetPatch + { + type overset; + faces (); + } + + stationaryWalls + { + type wall; + faces + ( + (0 3 2 1) + (2 6 5 1) + (1 5 4 0) + (3 7 6 2) + (0 4 7 3) + ); + } + atmosphere + { + type patch; + faces + ( + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..a21e0935f31ea5f4073b237ded2cd37829a2e0a9 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/controlDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Load the additional patches, patchFields etc. +libs ("liboverset.so"); + +application overInterDyMFoam ; + +startFrom startTime; + +startTime 0.0; + +stopAt endTime; + +endTime 4; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.05; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 12; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 2.0; +maxAlphaCo 2.0; +maxDeltaT 1; + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/decomposeParDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..ede2181dfeeee7a102669796ed3d681ebe89b00d --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/decomposeParDict @@ -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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 2 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..bc6574b81bc098aa2f740ebf3e3754d0437e015c --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSchemes @@ -0,0 +1,70 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss limitedLinearV 1; + div(U) Gauss linear; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; + + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,omega) Gauss upwind; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +oversetInterpolation +{ + method inverseDistance; +} + +fluxRequired +{ + default no; + p_rgh; + pcorr; + alpha.water; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..d786f2392654b82faad516a69ed8fdbad038bd74 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/fvSolution @@ -0,0 +1,110 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + + "cellDisplacement.*" + { + solver PCG; + preconditioner DIC; + + tolerance 1e-06; + relTol 0; + maxIter 100; + } + + "alpha.water.*" + { + nAlphaCorr 2; + nAlphaSubCycles 1; + cAlpha 1; + icAlpha 0; + + + MULESCorr yes; + nLimiterIter 5; + alphaApplyPrevCorr no; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + "pcorr.*" + { + solver PCG; + preconditioner DIC; + tolerance 1e-9; + relTol 0; + } + + p_rgh + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-9; + relTol 0.01; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "(U|k|omega|epsilon).*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-08; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nOuterCorrectors 3; + nCorrectors 1; + nNonOrthogonalCorrectors 0; + + ddtCorr yes; + correctPhi no; + + moveMeshOuterCorrectors no; + turbOnFinalIterOnly no; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +cache +{ + grad(U); +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..0c2bb614d27b3ad31e3bed2fb6ac08bf240b869c --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/setFieldsDict @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 + volScalarFieldValue zoneID 123 +); + +regions +( + boxToCell + { + box ( -100 -100 -100 ) ( 100 100 0.5368 ); + fieldValues ( volScalarFieldValue alpha.water 1 ); + } + + boxToCell + { + box ( 0.7 0.8 -100 ) ( 100 100 0.75 ); + fieldValues ( volScalarFieldValue alpha.water 1 ); + } + cellToCell + { + set c0; + + fieldValues + ( + volScalarFieldValue zoneID 0 + ); + } + cellToCell + { + set c1; + + fieldValues + ( + volScalarFieldValue zoneID 1 + ); + } + +); + + + + + + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/topoSetDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..7b957344b8951d644dac046a88e6db2c98b9d836 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/background/system/topoSetDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source regionToCell; + sourceInfo + { + insidePoints ((0.1 0.1 0.1)); + } + } + + { + name c1; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set c0; + } + } + + { + name c1; + type cellSet; + action invert; + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/Allclean b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..d16400a94f636d461b62f6f909c2d64d7e29c335 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 > /dev/null 2>&1 + +cleanCase + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/Allrun.pre b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..36d051548dfb8388f0e94c2437d803c370ed766c --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/Allrun.pre @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Set application name +application=`getApplication` + +runApplication blockMesh +runApplication topoSet +runApplication subsetMesh -overwrite c0 -patch floatingObject + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..300835baa5e2a9f8a55eb70ca0b07ea47b04d584 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/blockMeshDict @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 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) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (20 20 30) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + sides + { + type overset; + faces + ( + (0 3 2 1) + (2 6 5 1) + (1 5 4 0) + (3 7 6 2) + (0 4 7 3) + (4 5 6 7) + ); + } + floatingObject + { + type wall; + faces (); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/controlDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..6510d78a1221ab4cb9e49162027bd4e99531e1bc --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/controlDict @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 6; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 12; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 1; +maxAlphaCo 1; +maxDeltaT 1; + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/fvSchemes b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..88424a730cbdf5f4a6c63c0f9a86c97b048cf293 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/fvSchemes @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss vanLeerV; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div((muEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_rgh; + pcorr; + alpha.water; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/fvSolution b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..b391dcbc82a50ccb1fc73b69efa1d50ae7890e3b --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/fvSolution @@ -0,0 +1,139 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 1; + cAlpha 1; + + MULESCorr yes; + nLimiterIter 5; + alphaApplyPrevCorr true; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + "pcorr.*" + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-5; + relTol 0; + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 1e-05; + relTol 0; + maxIter 100; + } + + p_rgh + { + solver GAMG; + tolerance 1e-8; + relTol 0.01; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + p_rghFinal + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-8; + relTol 0; + nVcycles 2; + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 1e-8; + relTol 0; + maxIter 20; + } + + "(U|k|epsilon)" + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-6; + relTol 0.1; + nSweeps 1; + } + + "(U|k|epsilon)Final" + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-6; + relTol 0; + nSweeps 1; + } +} + +PIMPLE +{ + momentumPredictor no; + nOuterCorrectors 5; + nCorrectors 1; + nNonOrthogonalCorrectors 0; + correctPhi yes; + moveMeshOuterCorrectors yes; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/setFieldsDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..2506a693af099682fa83ec08257f7e33b07498f8 --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/setFieldsDict @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box ( -100 -100 -100 ) ( 100 100 0.5368 ); + fieldValues ( volScalarFieldValue alpha.water 1 ); + } + + boxToCell + { + box ( 0.7 0.8 -100 ) ( 100 100 0.65 ); + fieldValues ( volScalarFieldValue alpha.water 1 ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/topoSetDict b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..2f271d34d3e3d1eafde1cfa03e6720e8c20dc43f --- /dev/null +++ b/tutorials/multiphase/overInterDyMFoam/floatingBody/floatingBody/system/topoSetDict @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (0.38 0.38 0.2) (0.62 0.62 0.6); + } + } + + { + name c0; + type cellSet; + action invert; + } +); + +// ************************************************************************* //