CONT: Addition of compressibleIsoInterFOam and PLIC
1) Implementation of the compressibleIsoInterFOam solver 2) Implementation of a new PLIC interpolation scheme. 3) New tutorials associated with the solvers This implementation was carried out by Henning Scheufler (DLR) and Johan Roenby (DHI), following : \verbatim Henning Scheufler, Johan Roenby, Accurate and efficient surface reconstruction from volume fraction data on general meshes, Journal of Computational Physics, 2019, doi 10.1016/j.jcp.2019.01.009 \endverbatim The integration of the code was carried out by Andy Heather and Sergio Ferraris from OpenCFD Ltd.
This commit is contained in:
parent
237f2e1076
commit
44a84d4778
@ -0,0 +1,3 @@
|
||||
compressibleInterIsoFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/compressibleInterIsoFoam
|
@ -0,0 +1,39 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I../VoF \
|
||||
-I../compressibleInterFoam \
|
||||
-I$(FOAM_SOLVERS)/multiphase/compressibleInterFoam/twoPhaseMixtureThermo \
|
||||
-I$(FOAM_SOLVERS)/multiphase/compressibleInterFoam/VoFphaseCompressibleTurbulenceModels \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh \
|
||||
-ltwoPhaseMixtureThermo \
|
||||
-ltwoPhaseSurfaceTension \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-ltwoPhaseMixture \
|
||||
-ltwoPhaseProperties \
|
||||
-linterfaceProperties \
|
||||
-lturbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-lVoFphaseCompressibleTurbulenceModels \
|
||||
-lgeometricVoF
|
@ -0,0 +1,3 @@
|
||||
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
|
||||
|
||||
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
|
@ -0,0 +1,15 @@
|
||||
// Update alpha1
|
||||
#include "alphaSuSp.H"
|
||||
advector.advect(Sp,(Su + divU*min(alpha1(), scalar(1)))());
|
||||
|
||||
// Update rhoPhi
|
||||
rhoPhi = advector.getRhoPhi(rho1, rho2);
|
||||
alphaPhi10 = advector.alphaPhi();
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
|
||||
<< " Max(" << alpha1.name() << ") - 1 = " << max(alpha1).value() - 1
|
||||
<< endl;
|
@ -0,0 +1,43 @@
|
||||
volScalarField::Internal Sp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dgdt.dimensions(), Zero)
|
||||
);
|
||||
|
||||
volScalarField::Internal Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dgdt.dimensions(), Zero)
|
||||
);
|
||||
|
||||
forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
}
|
||||
else if (dgdt[celli] < 0.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField::Internal divU
|
||||
(
|
||||
mesh.moving()
|
||||
? fvc::div(phi + mesh.phi())
|
||||
: fvc::div(phi)
|
||||
);
|
@ -0,0 +1,70 @@
|
||||
if (pimple.nCorrPIMPLE() > 1)
|
||||
{
|
||||
if (!pimple.firstIter())
|
||||
{
|
||||
// Resetting alpha1 to value before advection in first PIMPLE
|
||||
// iteration.
|
||||
alpha1 = alpha1.oldTime();
|
||||
}
|
||||
}
|
||||
tmp<surfaceScalarField> talphaPhi1(alphaPhi10);
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
|
||||
talphaPhi1 = new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphaPhi1",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(alphaPhi10.dimensions(), Zero)
|
||||
);
|
||||
|
||||
surfaceScalarField rhoPhiSum
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhiSum",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(rhoPhi.dimensions(), Zero)
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
talphaPhi1.ref() += (runTime.deltaT()/totalDeltaT)*alphaPhi10;
|
||||
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
|
||||
}
|
||||
|
||||
rhoPhi = rhoPhiSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
}
|
||||
|
||||
rho == alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
const surfaceScalarField& alphaPhi1 = talphaPhi1();
|
||||
surfaceScalarField alphaPhi2("alphaPhi2", phi - alphaPhi1);
|
||||
|
||||
volScalarField::Internal contErr
|
||||
(
|
||||
(
|
||||
fvc::ddt(rho) + fvc::div(rhoPhi)
|
||||
- (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
|
||||
- (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
|
||||
)()
|
||||
);
|
@ -0,0 +1,203 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020 Johan Roenby
|
||||
Copyright (C) 2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
compressibleInterFlow
|
||||
|
||||
Description
|
||||
Solver derived from interFoam for two compressible, immiscible
|
||||
fluids using the isoAdvector phase-fraction based interface capturing
|
||||
approach, with optional mesh motion and mesh topology changes including
|
||||
adaptive re-meshing.
|
||||
|
||||
Reference:
|
||||
\verbatim
|
||||
Roenby, J., Bredmose, H. and Jasak, H. (2016).
|
||||
A computational method for sharp interface advection
|
||||
Royal Society Open Science, 3
|
||||
doi 10.1098/rsos.160405
|
||||
\endverbatim
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "CMULES.H"
|
||||
#include "EulerDdtScheme.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "CrankNicolsonDdtScheme.H"
|
||||
#include "subCycle.H"
|
||||
#include "compressibleInterPhaseTransportModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvcSmooth.H"
|
||||
#include "dynamicRefineFvMesh.H"
|
||||
#include "isoAdvection.H"
|
||||
#include "twoPhaseMixtureThermo.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Solver for two compressible, non-isothermal immiscible fluids"
|
||||
" using VOF phase-fraction based interface capturing.\n"
|
||||
"With optional mesh motion and mesh topology changes including"
|
||||
" adaptive re-meshing."
|
||||
);
|
||||
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createUf.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
volScalarField& p = mixture.p();
|
||||
volScalarField& T = mixture.T();
|
||||
const volScalarField& psi1 = mixture.thermo1().psi();
|
||||
const volScalarField& psi2 = mixture.thermo2().psi();
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readDyMControls.H"
|
||||
|
||||
// Store divU and divUp from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
||||
|
||||
#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();
|
||||
|
||||
if (isA<dynamicRefineFvMesh>(mesh))
|
||||
{
|
||||
advector.surf().reconstruct();
|
||||
}
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
|
||||
if (isA<dynamicRefineFvMesh>(mesh))
|
||||
{
|
||||
advector.surf().mapAlphaField();
|
||||
alpha2 = 1.0 - alpha1;
|
||||
alpha2.correctBoundaryConditions();
|
||||
rho == alpha1*rho1 + alpha2*rho2;
|
||||
rho.correctBoundaryConditions();
|
||||
rho.oldTime() = rho;
|
||||
alpha2.oldTime() = alpha2;
|
||||
}
|
||||
|
||||
MRF.update();
|
||||
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
}
|
||||
|
||||
if ((mesh.changing() && correctPhi))
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "compressibleAlphaEqnSubCycle.H"
|
||||
|
||||
turbulence.correctPhasePhi();
|
||||
|
||||
#include "UEqn.H"
|
||||
volScalarField divUp("divUp", fvc::div(fvc::absolute(phi, U), p));
|
||||
#include "TEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence.correct();
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
runTime.printExecutionTime(Info);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,13 @@
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
phi,
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
divU,
|
||||
pimple
|
||||
);
|
||||
|
||||
//***HGW phi.oldTime() = phi;
|
||||
|
||||
#include "continuityErrs.H"
|
@ -0,0 +1,110 @@
|
||||
#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"
|
||||
|
||||
Info<< "Constructing twoPhaseMixtureThermo\n" << endl;
|
||||
twoPhaseMixtureThermo mixture(U, phi);
|
||||
|
||||
|
||||
volScalarField& alpha1(mixture.alpha1());
|
||||
volScalarField& alpha2(mixture.alpha2());
|
||||
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
const volScalarField& rho1 = mixture.thermo1().rho();
|
||||
const volScalarField& rho2 = mixture.thermo2().rho();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
alpha1*rho1 + alpha2*rho2
|
||||
);
|
||||
|
||||
|
||||
dimensionedScalar pMin
|
||||
(
|
||||
"pMin",
|
||||
dimPressure,
|
||||
mixture
|
||||
);
|
||||
|
||||
mesh.setFluxRequired(p_rgh.name());
|
||||
mesh.setFluxRequired(alpha1.name());
|
||||
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "readhRef.H"
|
||||
#include "gh.H"
|
||||
|
||||
|
||||
// Mass flux
|
||||
// Initialisation does not matter because rhoPhi is reset after the
|
||||
// alpha1 solution before it is used in the U equation.
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::interpolate(rho)*phi
|
||||
);
|
||||
|
||||
volScalarField dgdt(alpha1*fvc::div(phi));
|
||||
|
||||
#include "createAlphaFluxes.H"
|
||||
|
||||
Foam::isoAdvection advector(alpha1,phi,U);
|
||||
// Construct compressible turbulence model
|
||||
compressibleInterPhaseTransportModel turbulence
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
rhoPhi,
|
||||
alphaPhi10,
|
||||
mixture
|
||||
);
|
||||
|
||||
#include "createK.H"
|
||||
|
||||
#include "createMRF.H"
|
||||
#include "createFvOptions.H"
|
169
applications/solvers/multiphase/compressibleInterIsoFoam/pEqn.H
Normal file
169
applications/solvers/multiphase/compressibleInterIsoFoam/pEqn.H
Normal file
@ -0,0 +1,169 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
fvc::flux(HbyA)
|
||||
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf))
|
||||
);
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
|
||||
tmp<fvScalarMatrix> p_rghEqnComp1;
|
||||
tmp<fvScalarMatrix> p_rghEqnComp2;
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
#include "rhofs.H"
|
||||
|
||||
surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
|
||||
surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
|
||||
|
||||
p_rghEqnComp1 =
|
||||
(
|
||||
(
|
||||
fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
|
||||
- (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
|
||||
)/rho1
|
||||
- fvc::ddt(alpha1) - fvc::div(alphaPhi1)
|
||||
+ (alpha1/rho1)
|
||||
*correction
|
||||
(
|
||||
psi1*fvm::ddt(p_rgh)
|
||||
+ fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
|
||||
)
|
||||
);
|
||||
p_rghEqnComp1.ref().relax();
|
||||
|
||||
p_rghEqnComp2 =
|
||||
(
|
||||
(
|
||||
fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
|
||||
- (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
|
||||
)/rho2
|
||||
- fvc::ddt(alpha2) - fvc::div(alphaPhi2)
|
||||
+ (alpha2/rho2)
|
||||
*correction
|
||||
(
|
||||
psi2*fvm::ddt(p_rgh)
|
||||
+ fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
|
||||
)
|
||||
);
|
||||
p_rghEqnComp2.ref().relax();
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "rhofs.H"
|
||||
|
||||
p_rghEqnComp1 =
|
||||
pos(alpha1)
|
||||
*(
|
||||
(
|
||||
fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
|
||||
- (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
|
||||
)/rho1
|
||||
- fvc::ddt(alpha1) - fvc::div(alphaPhi1)
|
||||
+ (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh))
|
||||
);
|
||||
|
||||
p_rghEqnComp2 =
|
||||
pos(alpha2)
|
||||
*(
|
||||
(
|
||||
fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
|
||||
- (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
|
||||
)/rho2
|
||||
- fvc::ddt(alpha2) - fvc::div(alphaPhi2)
|
||||
+ (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh))
|
||||
);
|
||||
}
|
||||
|
||||
if (mesh.moving())
|
||||
{
|
||||
p_rghEqnComp1.ref() += fvc::div(mesh.phi())*alpha1;
|
||||
p_rghEqnComp2.ref() += fvc::div(mesh.phi())*alpha2;
|
||||
}
|
||||
|
||||
p_rghEqnComp1.ref() *= pos(alpha1);
|
||||
p_rghEqnComp2.ref() *= pos(alpha2);
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
p_rghEqnComp1.ref().relax();
|
||||
p_rghEqnComp2.ref().relax();
|
||||
}
|
||||
|
||||
// Cache p_rgh prior to solve for density update
|
||||
volScalarField p_rgh_0(p_rgh);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqnIncomp
|
||||
(
|
||||
fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rAUf, p_rgh)
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
|
||||
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
|
||||
);
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||
p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
|
||||
|
||||
dgdt =
|
||||
(
|
||||
alpha1*(p_rghEqnComp2 & p_rgh)
|
||||
- alpha2*(p_rghEqnComp1 & p_rgh)
|
||||
);
|
||||
|
||||
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||
|
||||
U = HbyA
|
||||
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
// Correct Uf if the mesh is moving
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
|
||||
// Update densities from change in p_rgh
|
||||
mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
|
||||
mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
// Correct p_rgh for consistency with p and the updated densities
|
||||
p_rgh = p - rho*gh;
|
||||
p_rgh.correctBoundaryConditions();
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
@ -7,7 +7,8 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
@ -15,4 +16,5 @@ LIB_LIBS = \
|
||||
-lfluidThermophysicalModels \
|
||||
-lreactionThermophysicalModels \
|
||||
-lsolidThermo \
|
||||
-lsolidSpecie
|
||||
-lsolidSpecie \
|
||||
-lgeometricVoF
|
||||
|
@ -28,7 +28,7 @@ License
|
||||
|
||||
#include "interfaceHeatResistance.H"
|
||||
#include "constants.H"
|
||||
#include "isoCutCell.H"
|
||||
#include "cutCellIso.H"
|
||||
#include "volPointInterpolation.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "fvcSmooth.H"
|
||||
@ -52,7 +52,7 @@ interfaceHeatResistance<Thermo, OtherThermo>
|
||||
volPointInterpolation::New(mesh).interpolate(alpha)
|
||||
);
|
||||
|
||||
isoCutCell cutCell(mesh, ap);
|
||||
cutCellIso cutCell(mesh, ap);
|
||||
|
||||
forAll(interfaceArea_, celli)
|
||||
{
|
||||
@ -61,7 +61,7 @@ interfaceHeatResistance<Thermo, OtherThermo>
|
||||
if (status == 0) // cell is cut
|
||||
{
|
||||
interfaceArea_[celli] =
|
||||
mag(cutCell.isoFaceArea())/mesh.V()[celli];
|
||||
mag(cutCell.faceArea())/mesh.V()[celli];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ License
|
||||
|
||||
#include "kineticGasEvaporation.H"
|
||||
#include "constants.H"
|
||||
#include "isoCutCell.H"
|
||||
#include "cutCellIso.H"
|
||||
#include "volPointInterpolation.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "fvcSmooth.H"
|
||||
@ -50,7 +50,7 @@ void Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
volPointInterpolation::New(mesh).interpolate(alpha)
|
||||
);
|
||||
|
||||
isoCutCell cutCell(mesh, ap);
|
||||
cutCellIso cutCell(mesh, ap);
|
||||
|
||||
forAll(interfaceArea_, celli)
|
||||
{
|
||||
@ -59,7 +59,7 @@ void Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
if (status == 0) // cell is cut
|
||||
{
|
||||
interfaceArea_[celli] =
|
||||
mag(cutCell.isoFaceArea())/mesh.V()[celli];
|
||||
mag(cutCell.faceArea())/mesh.V()[celli];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lgeometricVoF \
|
||||
-ltwoPhaseMixture \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lfluidThermophysicalModels
|
||||
|
@ -29,7 +29,7 @@ License
|
||||
#include "interfaceHeatResistance.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "twoPhaseMixtureEThermo.H"
|
||||
#include "isoCutCell.H"
|
||||
#include "cutCellIso.H"
|
||||
#include "volPointInterpolation.H"
|
||||
#include "calculatedFvPatchFields.H"
|
||||
#include "wallPolyPatch.H"
|
||||
@ -342,7 +342,7 @@ updateInterface()
|
||||
volPointInterpolation::New(mesh_).interpolate(mixture_.alpha1())
|
||||
);
|
||||
|
||||
isoCutCell cutCell(mesh_, ap);
|
||||
cutCellIso cutCell(mesh_, ap);
|
||||
|
||||
forAll(interfaceArea_, celli)
|
||||
{
|
||||
@ -351,7 +351,7 @@ updateInterface()
|
||||
if (status == 0) // cell is cut
|
||||
{
|
||||
interfaceArea_[celli] =
|
||||
mag(cutCell.isoFaceArea())/mesh_.V()[celli];
|
||||
mag(cutCell.faceArea())/mesh_.V()[celli];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,26 @@
|
||||
EXE_INC = \
|
||||
-I../VoF \
|
||||
-I../interFoam \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-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)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-ldynamicFvMesh \
|
||||
@ -22,4 +29,5 @@ EXE_LIBS = \
|
||||
-limmiscibleIncompressibleTwoPhaseMixture \
|
||||
-lturbulenceModels \
|
||||
-lincompressibleTurbulenceModels \
|
||||
-lwaveModels
|
||||
-lwaveModels \
|
||||
-lgeometricVoF
|
||||
|
@ -1,33 +0,0 @@
|
||||
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
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
@ -6,7 +6,8 @@
|
||||
}
|
||||
|
||||
// Updating alpha1
|
||||
advector.advect();
|
||||
#include "alphaSuSp.H"
|
||||
advector.advect(Sp, Su);
|
||||
|
||||
// Making U absolute again after advection step
|
||||
if (mesh.moving())
|
||||
|
@ -1,11 +0,0 @@
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
phi,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
@ -1,34 +0,0 @@
|
||||
tmp<volScalarField> rAU;
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
rAU = new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rAU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("rAU", dimTime/dimDensity, 1)
|
||||
);
|
||||
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
phi,
|
||||
p_rgh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
Copyright (C) 2016 DHI
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2018 Johan Roenby
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -63,6 +64,7 @@ Description
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvcSmooth.H"
|
||||
#include "dynamicRefineFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -113,14 +115,29 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
if (isA<dynamicRefineFvMesh>(mesh))
|
||||
{
|
||||
advector.surf().reconstruct();
|
||||
}
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
|
||||
if (isA<dynamicRefineFvMesh>(mesh))
|
||||
{
|
||||
advector.surf().mapAlphaField();
|
||||
alpha2 = 1.0 - alpha1;
|
||||
alpha2.correctBoundaryConditions();
|
||||
rho == alpha1*rho1 + alpha2*rho2;
|
||||
rho.correctBoundaryConditions();
|
||||
rho.oldTime() = rho;
|
||||
alpha2.oldTime() = alpha2;
|
||||
}
|
||||
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
|
@ -1,89 +0,0 @@
|
||||
{
|
||||
if (correctPhi)
|
||||
{
|
||||
rAU.ref() = 1.0/UEqn.A();
|
||||
}
|
||||
else
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
}
|
||||
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||
volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh));
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
fvc::flux(HbyA)
|
||||
+ MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, 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)
|
||||
)*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(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();
|
||||
|
||||
U = HbyA + rAU()*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
// Correct Uf if the mesh is moving
|
||||
fvc::correctUf(Uf, U, phi);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (!correctPhi)
|
||||
{
|
||||
rAU.clear();
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
const dimensionedScalar& rho1f(rho1);
|
||||
const dimensionedScalar& rho2f(rho2);
|
3
applications/test/leastSquareGrad/Make/files
Normal file
3
applications/test/leastSquareGrad/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-leastSquareGrad.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-leastSquareGrad
|
9
applications/test/leastSquareGrad/Make/options
Normal file
9
applications/test/leastSquareGrad/Make/options
Normal file
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
101
applications/test/leastSquareGrad/Test-leastSquareGrad.C
Normal file
101
applications/test/leastSquareGrad/Test-leastSquareGrad.C
Normal file
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
Test-leastSquareGrad
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "leastSquareGrad.H"
|
||||
#include "labelVector.H"
|
||||
#include "Field.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
labelVector geomDim(1,1,-1);
|
||||
|
||||
leastSquareGrad<scalar> lsGrad("polyDegree1", geomDim);
|
||||
|
||||
List<vector> pos
|
||||
({
|
||||
{0,0,0},
|
||||
{1,0,0},
|
||||
{-1,0,0},
|
||||
{0,1,0},
|
||||
{0,-1,0},
|
||||
// {1,1,0}
|
||||
});
|
||||
|
||||
List<scalar> values
|
||||
({
|
||||
0, 1, -1, 1, -1
|
||||
//, 2
|
||||
});
|
||||
|
||||
|
||||
Map<List<vector>> posMap;
|
||||
|
||||
posMap.insert(0, pos);
|
||||
posMap.insert(1, pos);
|
||||
posMap.insert(2, pos);
|
||||
|
||||
Map<List<scalar>> valMap;
|
||||
|
||||
valMap.insert(0, values);
|
||||
valMap.insert(1, values);
|
||||
valMap.insert(2, values);
|
||||
|
||||
Info<< lsGrad.grad(posMap, valMap) << nl;
|
||||
|
||||
|
||||
leastSquareGrad<vector> lsGradVec("polyDegree1", geomDim);
|
||||
|
||||
List<vector> valuesVec
|
||||
({
|
||||
{0,0,0},
|
||||
{1,0,0},
|
||||
{-1,0,0},
|
||||
{1,0,0},
|
||||
{-1,0,0}
|
||||
});
|
||||
|
||||
Map<List<vector>> valMapVec;
|
||||
|
||||
valMapVec.insert(0, valuesVec);
|
||||
valMapVec.insert(1, valuesVec);
|
||||
valMapVec.insert(2, valuesVec);
|
||||
|
||||
Info<< lsGradVec.grad(posMap,valMapVec) << nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
3
applications/test/multiDimPolyFitter/Make/files
Normal file
3
applications/test/multiDimPolyFitter/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-multiDimPolyFitter.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-multiDimPolyFitter
|
9
applications/test/multiDimPolyFitter/Make/options
Normal file
9
applications/test/multiDimPolyFitter/Make/options
Normal file
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
113
applications/test/multiDimPolyFitter/Test-multiDimPolyFitter.C
Normal file
113
applications/test/multiDimPolyFitter/Test-multiDimPolyFitter.C
Normal file
@ -0,0 +1,113 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
Test-multiDimPolyFitter
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "multiDimPolyFitter.H"
|
||||
#include "labelVector.H"
|
||||
#include "Field.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
labelVector test(1,-1,-1);
|
||||
|
||||
autoPtr<multiDimPolyFunctions> polyFunc
|
||||
= multiDimPolyFunctions::New("polyDegree1", test);
|
||||
|
||||
vector vec(1,2,3);
|
||||
|
||||
Info<< "polyFunc" << nl
|
||||
<< " nTerms " << polyFunc->nTerms() << nl
|
||||
<< " coeffs " << polyFunc->coeffs() << nl
|
||||
<< " termValues " << polyFunc->termValues(vec) << nl;
|
||||
|
||||
multiDimPolyFitter<scalar> polyFitter("polyDegree1",test);
|
||||
|
||||
List<vector> pos
|
||||
({
|
||||
{0,0,0},
|
||||
{1,0,0},
|
||||
{-1,0,0}
|
||||
});
|
||||
|
||||
List<scalar> values
|
||||
({
|
||||
1, 2, 0
|
||||
});
|
||||
|
||||
Info<< "pos " << pos << nl
|
||||
<< "values " << values << nl;
|
||||
|
||||
scalarField fitData = polyFitter.fitData(pos, values);
|
||||
|
||||
Info<< "fitData " << fitData << nl;
|
||||
|
||||
autoPtr<multiDimPolyFunctions> polyFuncDeg2
|
||||
= multiDimPolyFunctions::New("polyDegree2", labelVector(1,1,-1));
|
||||
|
||||
//vector vec(1,2,3);
|
||||
|
||||
Info<< "polyFunc" << nl
|
||||
<< " nTerms" << polyFuncDeg2->nTerms() << nl
|
||||
// << " coeffs " << polyFunc->coeffs() << nl
|
||||
<< " termValues " << polyFuncDeg2->termValues(vector(1,1,0)) << nl;
|
||||
|
||||
List<vector> pos2
|
||||
({
|
||||
{0,0,0},
|
||||
{1,0,0},
|
||||
{-1,0,0},
|
||||
{0,1,0},
|
||||
{0,-1,0},
|
||||
{1,1,0}
|
||||
});
|
||||
|
||||
List<scalar> values2
|
||||
({
|
||||
0, 1, 1, 1, 1, 2
|
||||
});
|
||||
|
||||
multiDimPolyFitter<scalar> polyFitter2
|
||||
{
|
||||
"polyDegree2", labelVector(1,1,-1)
|
||||
};
|
||||
|
||||
scalarField fitData2 = polyFitter2.fitData(pos2, values2);
|
||||
|
||||
Info<< "fitData " << fitData2 << nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,3 @@
|
||||
Test-reconstructedDistanceFunction.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-reconstructedDistanceFunction
|
11
applications/test/reconstructedDistanceFunction/Make/options
Normal file
11
applications/test/reconstructedDistanceFunction/Make/options
Normal file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-lgeometricVoF
|
@ -0,0 +1,139 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "reconstructionSchemes.H"
|
||||
#include "reconstructedDistanceFunction.H"
|
||||
#include "Field.H"
|
||||
#include "DynamicField.H"
|
||||
#include "zoneDistribute.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
Info<< "Reading field alpha1\n" << endl;
|
||||
|
||||
volScalarField alpha1
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alpha1",
|
||||
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
|
||||
);
|
||||
|
||||
Info<< "create field phi\n" << endl;
|
||||
surfaceScalarField phi = fvc::interpolate(U) & mesh.Sf();
|
||||
|
||||
dictionary dict = mesh.solverDict(alpha1.name());
|
||||
|
||||
autoPtr<reconstructionSchemes> surf =
|
||||
reconstructionSchemes::New(alpha1,phi,U,dict);
|
||||
|
||||
++runTime;
|
||||
|
||||
const volVectorField& centre = surf->centre();
|
||||
const volVectorField& normal = surf->normal();
|
||||
|
||||
|
||||
//pointField centres(0);
|
||||
//vectorField normals(0);
|
||||
DynamicField<point> centres(1000);
|
||||
DynamicField<vector> normals(1000);
|
||||
|
||||
surf->reconstruct();
|
||||
|
||||
zoneDistribute exchangeFields_(mesh);
|
||||
|
||||
exchangeFields_.setUpCommforZone(surf->interfaceCell());
|
||||
|
||||
Map<Field<vector>> mapCentres =
|
||||
exchangeFields_.getFields(surf->interfaceCell(),centre);
|
||||
|
||||
Map<Field<vector>> mapNormal =
|
||||
exchangeFields_.getFields(surf->interfaceCell(),normal);
|
||||
|
||||
forAll(surf->centre(),celli)
|
||||
{
|
||||
if (surf->interfaceCell()[celli])
|
||||
{
|
||||
centres.append(surf->centre()[celli]);
|
||||
normals.append(surf->normal()[celli]);
|
||||
}
|
||||
}
|
||||
|
||||
reconstructedDistanceFunction distFunc(mesh);
|
||||
|
||||
{
|
||||
runTime.cpuTimeIncrement();
|
||||
|
||||
Info<< "Time " << runTime.cpuTimeIncrement() << endl;
|
||||
|
||||
distFunc.constructRDF
|
||||
(
|
||||
surf->interfaceCell(),
|
||||
surf->centre(),
|
||||
surf->normal(),
|
||||
2,
|
||||
exchangeFields_
|
||||
);
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,39 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ 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
|
||||
{
|
||||
walls
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
front
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
back
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,39 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object alpha1;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
front
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
back
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,40 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object markedCells;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
front
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
back
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
9
applications/test/reconstructedDistanceFunction/case1/Allclean
Executable file
9
applications/test/reconstructedDistanceFunction/case1/Allclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase0
|
||||
rm -rf AlphaInit/
|
||||
|
||||
#------------------------------------------------------------------------------
|
13
applications/test/reconstructedDistanceFunction/case1/Allrun
Executable file
13
applications/test/reconstructedDistanceFunction/case1/Allrun
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
restore0Dir
|
||||
touch Test-reconDistFunc.foam
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication setAlphaField
|
||||
runApplication Test-reconstructedDistanceFunction
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class uniformDimensionedVectorField;
|
||||
location "constant";
|
||||
object g;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -2 0 0 0 0];
|
||||
value ( 0 -9.81 0 );
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,64 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
DT [ 0 2 -1 0 0 0 0 ] 0;
|
||||
|
||||
sigma [ 1 0 -2 0 0 0 0 ] 0;
|
||||
|
||||
phase1
|
||||
{
|
||||
transportModel Newtonian;
|
||||
nu [ 0 2 -1 0 0 0 0 ] 0;
|
||||
rho [ 1 -3 0 0 0 0 0 ] 1000;
|
||||
BirdCarreauCoeffs
|
||||
{
|
||||
nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515;
|
||||
nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
k [ 0 0 1 0 0 0 0 ] 99.6;
|
||||
n [ 0 0 0 0 0 0 0 ] 0.1003;
|
||||
}
|
||||
CrossPowerLawCoeffs
|
||||
{
|
||||
nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
m [ 0 0 1 0 0 0 0 ] 1;
|
||||
n [ 0 0 0 0 0 0 0 ] 0;
|
||||
}
|
||||
}
|
||||
|
||||
phase2
|
||||
{
|
||||
transportModel Newtonian;
|
||||
nu [ 0 2 -1 0 0 0 0 ] 0;
|
||||
rho [ 1 -3 0 0 0 0 0 ] 1;
|
||||
BirdCarreauCoeffs
|
||||
{
|
||||
nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515;
|
||||
nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
k [ 0 0 1 0 0 0 0 ] 99.6;
|
||||
n [ 0 0 0 0 0 0 0 ] 0.1003;
|
||||
}
|
||||
CrossPowerLawCoeffs
|
||||
{
|
||||
nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||
m [ 0 0 1 0 0 0 0 ] 1;
|
||||
n [ 0 0 0 0 0 0 0 ] 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,20 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,89 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
L 1;
|
||||
n 3;
|
||||
|
||||
y1 0;
|
||||
y2 1;
|
||||
|
||||
H 0.1;
|
||||
|
||||
|
||||
vertices
|
||||
(
|
||||
(0 $y1 0)
|
||||
($L $y1 0)
|
||||
($L $y2 0)
|
||||
(0 $y2 0)
|
||||
(0 $y1 $H)
|
||||
($L $y1 $H)
|
||||
($L $y2 $H)
|
||||
(0 $y2 $H)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (100 100 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
walls
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 5 6 7)
|
||||
(0 4 7 3)
|
||||
(1 2 6 5)
|
||||
(0 3 2 1)
|
||||
// (2 3 7 6)
|
||||
// (0 1 5 4)
|
||||
);
|
||||
}
|
||||
|
||||
front
|
||||
{
|
||||
type empty;
|
||||
faces
|
||||
(
|
||||
(2 3 7 6)
|
||||
);
|
||||
}
|
||||
|
||||
back
|
||||
{
|
||||
type empty;
|
||||
faces
|
||||
(
|
||||
(0 1 5 4)
|
||||
);
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
mergePatchPairs
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,30 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object changeDictionaryDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
boundary
|
||||
{
|
||||
front
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
|
||||
back
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,59 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application Test-reconstructedDistanceFunction;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0.0;
|
||||
|
||||
stopAt writeNow;
|
||||
|
||||
endTime 4;
|
||||
|
||||
writeControl adjustableRunTime;
|
||||
|
||||
writeInterval 0.1;
|
||||
|
||||
deltaT 1e-3;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 14;
|
||||
|
||||
writeCompression no;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 14;
|
||||
|
||||
graphFormat raw;
|
||||
|
||||
runTimeModifiable no;
|
||||
|
||||
adjustTimeStep yes;
|
||||
|
||||
maxCo 1e6;
|
||||
|
||||
maxAlphaCo 0.5;
|
||||
|
||||
maxDeltaT 1e6;
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,27 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 4;
|
||||
|
||||
method simple;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (2 2 1);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,62 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
//default Gauss linear;
|
||||
default pointCellsLeastSquares;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
div(rho*phi,U) Gauss limitedLinearV 1;
|
||||
div(phi,alpha) Gauss vanLeer;
|
||||
div(phi,alpha1) Gauss HRIC;
|
||||
div(phirb,alpha) Gauss interfaceCompression;
|
||||
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;
|
||||
alpha1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
alpha1
|
||||
{
|
||||
|
||||
reconstructionScheme isoAlpha;
|
||||
vof2IsoTol 1e-8;
|
||||
surfCellTol 1e-8;
|
||||
writeVTK false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
momentumPredictor no;
|
||||
nCorrectors -1;
|
||||
nNonOrthogonalCorrectors -1;
|
||||
nAlphaCorr 1;
|
||||
nAlphaSubCycles 1;
|
||||
cAlpha 1;
|
||||
pRefCell 0;
|
||||
pRefValue 0;
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,23 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
field "alpha1";
|
||||
type sphere;
|
||||
centre (0.51 0.51 0.51);
|
||||
radius 0.25;
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,23 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
field "alpha1";
|
||||
type plane;
|
||||
origin (0.485 0.0 0.0);
|
||||
normal (-1 0 0);
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,34 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name c0;
|
||||
type cellSet;
|
||||
action new;
|
||||
source boxToCell;
|
||||
box (-1e10 -1e10 -1e10) (1e10 0 1e10);
|
||||
}
|
||||
|
||||
{
|
||||
name c0;
|
||||
type cellSet;
|
||||
action invert;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
34
applications/test/setAlphaField/case1/0.orig/T
Normal file
34
applications/test/setAlphaField/case1/0.orig/T
Normal file
@ -0,0 +1,34 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object T;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 1 0 0 0];
|
||||
|
||||
internalField uniform 300;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
defaultFaces
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
33
applications/test/setAlphaField/case1/0.orig/U
Normal file
33
applications/test/setAlphaField/case1/0.orig/U
Normal file
@ -0,0 +1,33 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: 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
|
||||
{
|
||||
walls
|
||||
{
|
||||
type noSlip;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
34
applications/test/setAlphaField/case1/0.orig/alpha.water
Normal file
34
applications/test/setAlphaField/case1/0.orig/alpha.water
Normal file
@ -0,0 +1,34 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object alpha.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
defaultFaces
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
35
applications/test/setAlphaField/case1/0.orig/p
Normal file
35
applications/test/setAlphaField/case1/0.orig/p
Normal file
@ -0,0 +1,35 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 1e5;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
{
|
||||
type calculated;
|
||||
value uniform 1e5;
|
||||
}
|
||||
|
||||
defaultFaces
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
35
applications/test/setAlphaField/case1/0.orig/p_rgh
Normal file
35
applications/test/setAlphaField/case1/0.orig/p_rgh
Normal file
@ -0,0 +1,35 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p_rgh;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 1e5;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
value uniform 1e5;
|
||||
}
|
||||
|
||||
defaultFaces
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
10
applications/test/setAlphaField/case1/Allclean
Executable file
10
applications/test/setAlphaField/case1/Allclean
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase0
|
||||
rm -rf processor*
|
||||
rm -r AlphaInit/
|
||||
|
||||
#------------------------------------------------------------------------------
|
15
applications/test/setAlphaField/case1/Allrun
Executable file
15
applications/test/setAlphaField/case1/Allrun
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
runApplication blockMesh
|
||||
#runApplication refineMesh -overwrite
|
||||
touch test-initAlphaField.foam
|
||||
restore0Dir
|
||||
runApplication setAlphaField
|
||||
#runApplication decomposePar
|
||||
#runParallel $(getApplication)
|
||||
#runApplication reconstructPar
|
||||
|
||||
#------------------------------------------------------------------------------
|
21
applications/test/setAlphaField/case1/constant/g
Normal file
21
applications/test/setAlphaField/case1/constant/g
Normal file
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class uniformDimensionedVectorField;
|
||||
location "constant";
|
||||
object g;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -2 0 0 0 0];
|
||||
value (0 -9.81 0);
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object thermophysicalProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
phases (water air);
|
||||
|
||||
pMin 10000;
|
||||
|
||||
sigma 0.07;
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object thermophysicalProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
thermoType
|
||||
{
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 28.9;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Cp 1007;
|
||||
Hf 0;
|
||||
}
|
||||
transport
|
||||
{
|
||||
mu 1.84e-05;
|
||||
Pr 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object thermophysicalProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
thermoType
|
||||
{
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hConst;
|
||||
equationOfState perfectFluid;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 18.0;
|
||||
}
|
||||
equationOfState
|
||||
{
|
||||
R 3000;
|
||||
rho0 1027;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Cp 4195;
|
||||
Hf 0;
|
||||
}
|
||||
transport
|
||||
{
|
||||
mu 3.645e-4;
|
||||
Pr 2.289;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
53
applications/test/setAlphaField/case1/system/blockMeshDict
Normal file
53
applications/test/setAlphaField/case1/system/blockMeshDict
Normal file
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(0 0 0)
|
||||
(1 0 0)
|
||||
(1 2 0)
|
||||
(0 2 0)
|
||||
(0 0 1)
|
||||
(1 0 1)
|
||||
(1 2 1)
|
||||
(0 2 1)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (20 40 20) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
walls
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
(0 4 7 3)
|
||||
(2 6 5 1)
|
||||
(1 5 4 0)
|
||||
(0 3 2 1)
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
55
applications/test/setAlphaField/case1/system/controlDict
Normal file
55
applications/test/setAlphaField/case1/system/controlDict
Normal file
@ -0,0 +1,55 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application setAlphaField;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.1;
|
||||
|
||||
deltaT 0.0001;
|
||||
|
||||
writeControl adjustableRunTime;
|
||||
|
||||
writeInterval 0.01;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 8;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 10;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
adjustTimeStep yes;
|
||||
|
||||
maxCo 0.5;
|
||||
maxAlphaCo 0.5;
|
||||
maxDeltaT 1;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,33 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 64;
|
||||
|
||||
method scotch;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (1 4 1);
|
||||
//delta 0.001; // default=0.001
|
||||
//order xyz; // default=xzy
|
||||
}
|
||||
|
||||
distributed no;
|
||||
|
||||
roots ( );
|
||||
|
||||
|
||||
// ************************************************************************* //
|
57
applications/test/setAlphaField/case1/system/fvSchemes
Normal file
57
applications/test/setAlphaField/case1/system/fvSchemes
Normal file
@ -0,0 +1,57 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: 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
|
||||
{
|
||||
div(phi,alpha) Gauss vanLeer;
|
||||
div(phirb,alpha) Gauss linear;
|
||||
|
||||
div(rhoPhi,U) Gauss upwind;
|
||||
div(rhoPhi,T) Gauss upwind;
|
||||
div(rhoPhi,K) Gauss upwind;
|
||||
div(phi,p) Gauss upwind;
|
||||
div(phi,k) Gauss upwind;
|
||||
|
||||
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear uncorrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default uncorrected;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
108
applications/test/setAlphaField/case1/system/fvSolution
Normal file
108
applications/test/setAlphaField/case1/system/fvSolution
Normal file
@ -0,0 +1,108 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
"alpha.water.*"
|
||||
{
|
||||
nAlphaCorr 1;
|
||||
nAlphaSubCycles 2;
|
||||
cAlpha 1;
|
||||
|
||||
MULESCorr no;
|
||||
nLimiterIter 5;
|
||||
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
"pcorr.*"
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner
|
||||
{
|
||||
preconditioner GAMG;
|
||||
tolerance 1e-05;
|
||||
relTol 0;
|
||||
smoother DICGaussSeidel;
|
||||
}
|
||||
tolerance 1e-05;
|
||||
relTol 0;
|
||||
maxIter 100;
|
||||
}
|
||||
|
||||
".*(rho|rhoFinal)"
|
||||
{
|
||||
solver diagonal;
|
||||
}
|
||||
|
||||
p_rgh
|
||||
{
|
||||
solver GAMG;
|
||||
tolerance 1e-07;
|
||||
relTol 0.01;
|
||||
smoother DIC;
|
||||
}
|
||||
|
||||
p_rghFinal
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner
|
||||
{
|
||||
preconditioner GAMG;
|
||||
tolerance 1e-07;
|
||||
relTol 0;
|
||||
nVcycles 2;
|
||||
smoother DICGaussSeidel;
|
||||
nPreSweeps 2;
|
||||
}
|
||||
tolerance 1e-07;
|
||||
relTol 0;
|
||||
maxIter 20;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-06;
|
||||
relTol 0;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
"(T|k|B|nuTilda).*"
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-08;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
momentumPredictor no;
|
||||
transonic no;
|
||||
nOuterCorrectors 1;
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
field "alpha.water";
|
||||
|
||||
type composedFunction;
|
||||
mode minDist;
|
||||
composedFunctions
|
||||
{
|
||||
plane
|
||||
{
|
||||
type plane;
|
||||
origin (0 1. 0);
|
||||
normal (0 -1 0);
|
||||
}
|
||||
|
||||
sphere
|
||||
{
|
||||
type sphere;
|
||||
radius 0.4;
|
||||
origin (0.5 1.5 0.5);
|
||||
scale 1;
|
||||
}
|
||||
|
||||
sphere2
|
||||
{
|
||||
type sphere;
|
||||
radius 0.4;
|
||||
origin (0.5 0.5 0.5);
|
||||
scale -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
3
applications/test/zoneDistribute/Make/files
Normal file
3
applications/test/zoneDistribute/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-zoneDistribute.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-zoneDistribute
|
13
applications/test/zoneDistribute/Make/options
Normal file
13
applications/test/zoneDistribute/Make/options
Normal file
@ -0,0 +1,13 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-lsampling
|
121
applications/test/zoneDistribute/Test-zoneDistribute.C
Normal file
121
applications/test/zoneDistribute/Test-zoneDistribute.C
Normal file
@ -0,0 +1,121 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
Test-zoneDistribute
|
||||
|
||||
Description
|
||||
Test of zoneDistribute validated with mapDistribute
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "centredCPCCellToCellStencilObject.H"
|
||||
#include "zoneDistribute.H"
|
||||
|
||||
#include "SortableList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
const extendedCentredCellToCellStencil& stencil =
|
||||
centredCPCCellToCellStencilObject::New(mesh);
|
||||
|
||||
const List<List<label>>& stencilAddr = stencil.stencil();
|
||||
|
||||
List<List<vector>> stencilCentre(mesh.nCells());
|
||||
|
||||
stencil.collectData
|
||||
(
|
||||
mesh.C(),
|
||||
stencilCentre
|
||||
);
|
||||
|
||||
zoneDistribute exchangeFields(mesh);
|
||||
|
||||
|
||||
boolList interfaceCell(mesh.nCells(),true);
|
||||
exchangeFields.setUpCommforZone(interfaceCell);
|
||||
|
||||
|
||||
const labelListList& stencil_zoneDist = exchangeFields.getStencil();
|
||||
const globalIndex& gblNumbering = exchangeFields.globalNumbering();
|
||||
|
||||
Map<vectorField> mapCC(exchangeFields.getFields(interfaceCell,mesh.C()));
|
||||
|
||||
// compare stencils
|
||||
Pout<< "size of the stencil match "
|
||||
<< (stencilAddr.size() == stencil_zoneDist.size()) << endl;
|
||||
|
||||
label stencilMatch = 0;
|
||||
|
||||
forAll(stencilAddr,celli)
|
||||
{
|
||||
const vectorField& neiCC = mapCC[celli];
|
||||
if (neiCC.size() != stencilCentre[celli].size())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool foundAllLabel = true;
|
||||
for (const vector& cc : neiCC)
|
||||
{
|
||||
if (!stencilCentre[celli].found(cc))
|
||||
{
|
||||
foundAllLabel = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundAllLabel)
|
||||
{
|
||||
++stencilMatch;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (stencilMatch == mesh.nCells())
|
||||
{
|
||||
Pout << "all Values are identical " << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout << "values did not match in : " << stencilMatch << " of "
|
||||
<< mesh.nCells() << " cases" << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
15
applications/test/zoneDistribute/case1/Allclean
Executable file
15
applications/test/zoneDistribute/case1/Allclean
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase0
|
||||
|
||||
rm -f ./flange ./*.obj
|
||||
|
||||
# Remove surface and features
|
||||
rm -f constant/triSurface/flange.stl.gz
|
||||
rm -f constant/triSurface/flange.eMesh
|
||||
rm -rf constant/extendedFeatureEdgeMesh
|
||||
|
||||
#------------------------------------------------------------------------------
|
13
applications/test/zoneDistribute/case1/Allrun
Executable file
13
applications/test/zoneDistribute/case1/Allrun
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
touch test-zoneDistribute.foam
|
||||
runApplication blockMesh
|
||||
#runApplication surfaceFeatureExtract
|
||||
runApplication snappyHexMesh -overwrite
|
||||
runApplication decomposePar
|
||||
runParallel test-zoneDistribute
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -0,0 +1,4 @@
|
||||
Directory to house tri-surfaces
|
||||
|
||||
The Allrun script copies the surface from the $FOAM_TUTORIALS/resources/geometry
|
||||
directory
|
57
applications/test/zoneDistribute/case1/system/blockMeshDict
Normal file
57
applications/test/zoneDistribute/case1/system/blockMeshDict
Normal file
@ -0,0 +1,57 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
( -1 -1 -1)
|
||||
( 1 -1 -1)
|
||||
( 1 1 -1)
|
||||
( -1 1 -1)
|
||||
( -1 -1 1)
|
||||
( 1 -1 1)
|
||||
( 1 1 1)
|
||||
( -1 1 1)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
allBoundary
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
(0 4 7 3)
|
||||
(2 6 5 1)
|
||||
(1 5 4 0)
|
||||
(0 3 2 1)
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
49
applications/test/zoneDistribute/case1/system/controlDict
Normal file
49
applications/test/zoneDistribute/case1/system/controlDict
Normal file
@ -0,0 +1,49 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application snappyHexMesh;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 50;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 20;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,27 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 8;
|
||||
|
||||
method simple;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (4 2 1);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
30
applications/test/zoneDistribute/case1/system/fvSchemes
Normal file
30
applications/test/zoneDistribute/case1/system/fvSchemes
Normal file
@ -0,0 +1,30 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
18
applications/test/zoneDistribute/case1/system/fvSolution
Normal file
18
applications/test/zoneDistribute/case1/system/fvSolution
Normal file
@ -0,0 +1,18 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,22 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object meshQualityDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Include defaults parameters from master dictionary
|
||||
#includeEtc "caseDicts/meshQualityDict"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
310
applications/test/zoneDistribute/case1/system/snappyHexMeshDict
Normal file
310
applications/test/zoneDistribute/case1/system/snappyHexMeshDict
Normal file
@ -0,0 +1,310 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: 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
|
||||
{
|
||||
|
||||
//- Refine a bit extra around the small centre hole
|
||||
sphere
|
||||
{
|
||||
type sphere;
|
||||
origin (0 0 -0.00);
|
||||
radius 0.99;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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 0;
|
||||
|
||||
// Number of buffer layers between different levels.
|
||||
// 1 means normal 2:1 refinement restriction, larger means slower
|
||||
// refinement.
|
||||
nCellsBetweenLevels 1;
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
{
|
||||
sphere
|
||||
{
|
||||
// Surface-wise min and max refinement level
|
||||
level (2 2);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// refineHole
|
||||
// {
|
||||
// mode inside;
|
||||
// levels ((1E15 3));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// 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.
|
||||
// This is an outside point locationInMesh (-0.033 -0.033 0.0033);
|
||||
locationInMesh (0 0 0); // Inside point
|
||||
|
||||
// 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 1.0;
|
||||
|
||||
//- Number of mesh displacement relaxation iterations.
|
||||
nSolveIter 300;
|
||||
|
||||
//- Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 5;
|
||||
|
||||
// Feature snapping
|
||||
|
||||
//- Number of feature edge snapping iterations.
|
||||
// Leave out altogether to disable.
|
||||
nFeatureSnapIter 10;
|
||||
|
||||
//- Detect (geometric) features by sampling the surface
|
||||
implicitFeatureSnap false;
|
||||
|
||||
//- Use castellatedMeshControls::features
|
||||
explicitFeatureSnap true;
|
||||
|
||||
//- Detect features between multiple surfaces
|
||||
// (only for explicitFeatureSnap, default = false)
|
||||
multiRegionFeatureSnap true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
{
|
||||
"flange_.*"
|
||||
{
|
||||
nSurfaceLayers 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Expansion factor for layer mesh
|
||||
expansionRatio 1.0;
|
||||
|
||||
|
||||
// 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.3;
|
||||
|
||||
// Minimum thickness of cell layer. If for any reason layer
|
||||
// cannot be above minThickness do not add 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.
|
||||
nGrow 0;
|
||||
|
||||
|
||||
// Advanced settings
|
||||
|
||||
// When not to extrude surface. 0 is flat surface, 90 is when two faces
|
||||
// are perpendicular
|
||||
featureAngle 30;
|
||||
|
||||
// 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
|
||||
minMedialAxisAngle 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;
|
||||
|
||||
// Max number of iterations after which relaxed meshQuality controls
|
||||
// get used. Up to nRelaxIter it uses the settings in meshQualityControls,
|
||||
// after nRelaxIter it uses the values in meshQualityControls::relaxed.
|
||||
nRelaxedIter 20;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generic mesh quality settings. At any undoable phase these determine
|
||||
// where to undo.
|
||||
meshQualityControls
|
||||
{
|
||||
#include "meshQualityDict"
|
||||
|
||||
// Optional : some meshing phases allow usage of relaxed rules.
|
||||
// See e.g. addLayersControls::nRelaxedIter.
|
||||
relaxed
|
||||
{
|
||||
//- Maximum non-orthogonality allowed. Set to 180 to disable.
|
||||
maxNonOrtho 75;
|
||||
}
|
||||
|
||||
// Advanced
|
||||
|
||||
//- Number of error distribution iterations
|
||||
nSmoothScale 4;
|
||||
//- Amount to scale back displacement at error points
|
||||
errorReduction 0.75;
|
||||
}
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
// Write flags
|
||||
writeFlags
|
||||
(
|
||||
scalarLevels // write volScalarField with cellLevel for postprocessing
|
||||
layerSets // write cellSets, faceSets of faces in layer
|
||||
layerFields // write volScalarField for layer coverage
|
||||
);
|
||||
|
||||
|
||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||
// Note: the write tolerance needs to be higher than this.
|
||||
mergeTolerance 1E-6;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,35 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object surfaceFeatureExtractDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
flange.stl
|
||||
{
|
||||
// How to obtain raw features (extractFromFile || extractFromSurface)
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
// Mark edges whose adjacent surface normals are at an angle less
|
||||
// than includedAngle as features
|
||||
// - 0 : selects no edges
|
||||
// - 180: selects all edges
|
||||
includedAngle 150;
|
||||
|
||||
// Write options
|
||||
|
||||
// Write features to obj format for postprocessing
|
||||
writeObj yes;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
7
applications/utilities/preProcessing/setAlphaField/Allwclean
Executable file
7
applications/utilities/preProcessing/setAlphaField/Allwclean
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
wclean libso alphaFieldFunctions
|
||||
wclean
|
||||
|
||||
#------------------------------------------------------------------------------
|
10
applications/utilities/preProcessing/setAlphaField/Allwmake
Executable file
10
applications/utilities/preProcessing/setAlphaField/Allwmake
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
wmake $targetType alphaFieldFunctions
|
||||
wmake $targetType
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -1,9 +1,17 @@
|
||||
EXE_INC = \
|
||||
-IalphaFieldFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
-lsampling \
|
||||
-lgeometricVoF \
|
||||
-lalphaFieldFunctions
|
||||
|
@ -0,0 +1,11 @@
|
||||
/* Run-time selectable implicitFunctions */
|
||||
implicitFunctions/implicitFunction.C
|
||||
implicitFunctions/sphere/sphereImplicitFunction.C
|
||||
implicitFunctions/sin/sinImplicitFunction.C
|
||||
implicitFunctions/ellipsoid/ellipsoidImplicitFunction.C
|
||||
implicitFunctions/paraboloid/paraboloidImplicitFunction.C
|
||||
implicitFunctions/plane/planeImplicitFunction.C
|
||||
implicitFunctions/cylinder/cylinderImplicitFunction.C
|
||||
implicitFunctions/composedFunction/composedFunctionImplicitFunction.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libalphaFieldFunctions
|
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* LIB_LIBS = */
|
@ -0,0 +1,207 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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 "composedFunctionImplicitFunction.H"
|
||||
#include "scalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(composedFunctionImplicitFunction, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
implicitFunction,
|
||||
composedFunctionImplicitFunction,
|
||||
dict
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::implicitFunctions::composedFunctionImplicitFunction::modeType
|
||||
>
|
||||
Foam::implicitFunctions::composedFunctionImplicitFunction::modeTypeNames
|
||||
({
|
||||
{ modeType::ADD, "add" },
|
||||
{ modeType::SUBTRACT, "subtract" },
|
||||
{ modeType::MINDIST, "minDist" },
|
||||
{ modeType::INTERSECT, "intersect" },
|
||||
});
|
||||
|
||||
|
||||
Foam::label
|
||||
Foam::implicitFunctions::composedFunctionImplicitFunction::selectFunction
|
||||
(
|
||||
const scalarField& values
|
||||
) const
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case modeType::MINDIST:
|
||||
{
|
||||
scalarField absVal(mag(values));
|
||||
return findMin(absVal);
|
||||
}
|
||||
case modeType::ADD:
|
||||
{
|
||||
return findMax(values);
|
||||
}
|
||||
case modeType::SUBTRACT:
|
||||
{
|
||||
// Note: start at the second entry
|
||||
const label idx = findMin(values, 1);
|
||||
|
||||
if (values[idx] < values[0] && pos(values[0]))
|
||||
{
|
||||
return idx;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
case modeType::INTERSECT:
|
||||
{
|
||||
return findMin(values);
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "This mode is not supported only " << nl
|
||||
<< "Supported modes are: " << nl
|
||||
<< modeTypeNames
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::implicitFunctions::composedFunctionImplicitFunction::
|
||||
composedFunctionImplicitFunction
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functions_(),
|
||||
mode_(modeTypeNames.get("mode", dict)),
|
||||
values_()
|
||||
{
|
||||
const dictionary& funcDict = dict.subDict("composedFunction");
|
||||
|
||||
functions_.resize(funcDict.size());
|
||||
values_.resize(funcDict.size(), Zero);
|
||||
|
||||
label funci = 0;
|
||||
|
||||
for (const entry& dEntry : funcDict)
|
||||
{
|
||||
const word& key = dEntry.keyword();
|
||||
|
||||
if (!dEntry.isDict())
|
||||
{
|
||||
FatalIOErrorInFunction(funcDict)
|
||||
<< "Entry " << key << " is not a dictionary" << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const dictionary& subdict = dEntry.dict();
|
||||
|
||||
functions_.set
|
||||
(
|
||||
funci,
|
||||
implicitFunction::New(subdict.get<word>("type"), subdict)
|
||||
);
|
||||
|
||||
++funci;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::implicitFunctions::composedFunctionImplicitFunction::value
|
||||
(
|
||||
const vector& p
|
||||
) const
|
||||
{
|
||||
forAll(values_,i)
|
||||
{
|
||||
values_[i] = functions_[i].value(p);
|
||||
}
|
||||
|
||||
const label idx = selectFunction(values_);
|
||||
|
||||
return values_[idx];
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::implicitFunctions::composedFunctionImplicitFunction::grad
|
||||
(
|
||||
const vector& p
|
||||
) const
|
||||
{
|
||||
forAll(values_,i)
|
||||
{
|
||||
values_[i] = mag(functions_[i].value(p));
|
||||
}
|
||||
|
||||
const label minIdx = findMin(values_);
|
||||
|
||||
return functions_[minIdx].grad(p);
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar
|
||||
Foam::implicitFunctions::composedFunctionImplicitFunction::distanceToSurfaces
|
||||
(
|
||||
const vector& p
|
||||
) const
|
||||
{
|
||||
forAll(values_,i)
|
||||
{
|
||||
values_[i] = mag(functions_[i].value(p));
|
||||
}
|
||||
|
||||
const label minIdx = findMin(values_);
|
||||
|
||||
return functions_[minIdx].distanceToSurfaces(p);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,169 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunctions::composedFunctionImplicitFunction
|
||||
|
||||
Description
|
||||
Handles multiple implicit functions and offers multiple ways to combine
|
||||
them
|
||||
|
||||
Usage
|
||||
Example of function object partial specification:
|
||||
\verbatim
|
||||
function composedFunctionImplicitFunction;
|
||||
mode minDist;
|
||||
// following mode are available:
|
||||
// "add" "subtract" "minDist" "intersect"
|
||||
composedFunctionImplicitFunctions
|
||||
{
|
||||
plane
|
||||
{
|
||||
function plane;
|
||||
origin (0 1. 0);
|
||||
normal (0 1 0);
|
||||
}
|
||||
|
||||
sphere
|
||||
{
|
||||
function sphere;
|
||||
radius 0.4;
|
||||
origin (0.5 1.5 0.5);
|
||||
scale 1;
|
||||
}
|
||||
|
||||
sphere2
|
||||
{
|
||||
function sphere;
|
||||
radius 0.4;
|
||||
origin (0.5 0.5 0.5);
|
||||
scale -1;
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
composedFunctionImplicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunctions_composedFunctionImplicitFunction_H
|
||||
#define implicitFunctions_composedFunctionImplicitFunction_H
|
||||
|
||||
#include "implicitFunction.H"
|
||||
#include "scalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class composedFunctionImplicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class composedFunctionImplicitFunction
|
||||
:
|
||||
public implicitFunction
|
||||
{
|
||||
// Private Member Data
|
||||
|
||||
//- Enumeration defining the valid actions
|
||||
enum class modeType
|
||||
{
|
||||
ADD,
|
||||
SUBTRACT,
|
||||
MINDIST,
|
||||
INTERSECT
|
||||
};
|
||||
|
||||
//- The setActions text representations
|
||||
static const Enum<modeType> modeTypeNames;
|
||||
|
||||
//- Stores the functions
|
||||
PtrList<implicitFunction> functions_;
|
||||
|
||||
//- Mode
|
||||
modeType mode_;
|
||||
|
||||
//- Needed for finding the closest function.
|
||||
// Note: avoid creation every call
|
||||
mutable scalarField values_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
label selectFunction(const scalarField& values) const;
|
||||
|
||||
//- No copy construct
|
||||
composedFunctionImplicitFunction
|
||||
(
|
||||
const composedFunctionImplicitFunction&
|
||||
) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const composedFunctionImplicitFunction&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("composedFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
explicit composedFunctionImplicitFunction(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~composedFunctionImplicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const;
|
||||
|
||||
virtual vector grad(const vector& p) const;
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
} // End namespace implicitFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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 "cylinderImplicitFunction.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(cylinderImplicitFunction, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
implicitFunction,
|
||||
cylinderImplicitFunction,
|
||||
dict
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::implicitFunctions::cylinderImplicitFunction::cylinderImplicitFunction
|
||||
(
|
||||
const point& origin,
|
||||
const scalar radius,
|
||||
const scalar scale,
|
||||
const vector& direction
|
||||
)
|
||||
:
|
||||
origin_(origin),
|
||||
radius_(radius),
|
||||
scale_(scale),
|
||||
direction_(normalised(direction)),
|
||||
project_(tensor::I - direction_*direction_) // outer product
|
||||
{}
|
||||
|
||||
|
||||
Foam::implicitFunctions::cylinderImplicitFunction::cylinderImplicitFunction
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
cylinderImplicitFunction
|
||||
(
|
||||
dict.get<point>("origin"),
|
||||
dict.get<scalar>("radius"),
|
||||
dict.getOrDefault<scalar>("scale", 1),
|
||||
dict.get<vector>("direction")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,132 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunctions::cylinderImplicitFunction
|
||||
|
||||
Description
|
||||
creates a infintite long cylinderImplicitFunction
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
cylinderImplicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunction_cylinderImplicitFunction_H
|
||||
#define implicitFunction_cylinderImplicitFunction_H
|
||||
|
||||
#include "implicitFunction.H"
|
||||
#include "point.H"
|
||||
#include "tensor.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cylinderImplicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cylinderImplicitFunction
|
||||
:
|
||||
public implicitFunction
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Origin point
|
||||
const point origin_;
|
||||
|
||||
//- Radius
|
||||
const scalar radius_;
|
||||
|
||||
const scalar scale_;
|
||||
|
||||
const vector direction_;
|
||||
|
||||
const tensor project_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cylinder");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
cylinderImplicitFunction
|
||||
(
|
||||
const point& origin,
|
||||
const scalar radius,
|
||||
const scalar scale,
|
||||
const vector& direction
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
explicit cylinderImplicitFunction(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cylinderImplicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const
|
||||
{
|
||||
return (-mag(project_ & (p - origin_)) + radius_)*scale_;
|
||||
}
|
||||
|
||||
virtual vector grad(const vector& p) const
|
||||
{
|
||||
return -(project_ & (p - origin_))*scale_;
|
||||
}
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const
|
||||
{
|
||||
return mag(mag(project_ & (p - origin_)) - radius_)*scale_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace implicitFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,73 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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 "ellipsoidImplicitFunction.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(ellipsoidImplicitFunction, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
implicitFunction,
|
||||
ellipsoidImplicitFunction,
|
||||
dict
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::implicitFunctions::ellipsoidImplicitFunction::ellipsoidImplicitFunction
|
||||
(
|
||||
const vector& semiAxis
|
||||
)
|
||||
:
|
||||
semiAxis_(semiAxis),
|
||||
origin_(Zero)
|
||||
{}
|
||||
|
||||
|
||||
Foam::implicitFunctions::ellipsoidImplicitFunction::ellipsoidImplicitFunction
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ellipsoidImplicitFunction
|
||||
(
|
||||
dict.get<vector>("semiAxis")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunctions::ellipsoidImplicitFunction
|
||||
|
||||
Description
|
||||
creates an ellipsoidImplicitFunction
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
ellipsoidImplicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunction_ellipsoidImplicitFunction_H
|
||||
#define implicitFunction_ellipsoidImplicitFunction_H
|
||||
|
||||
#include "implicitFunction.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ellipsoidImplicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ellipsoidImplicitFunction
|
||||
:
|
||||
public implicitFunction
|
||||
{
|
||||
// Private Member Data
|
||||
|
||||
//- Axis
|
||||
const vector semiAxis_;
|
||||
|
||||
//- Origin point
|
||||
const vector origin_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("ellipsoidImplicitFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
explicit ellipsoidImplicitFunction(const vector& semiAxis);
|
||||
|
||||
//- Construct from dictionary
|
||||
explicit ellipsoidImplicitFunction(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ellipsoidImplicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const
|
||||
{
|
||||
return
|
||||
-sqrt
|
||||
(
|
||||
sqr((p.x() - origin_.x())/semiAxis_.x())
|
||||
+ sqr((p.y() - origin_.y())/semiAxis_.y())
|
||||
+ sqr((p.z() - origin_.z())/semiAxis_.z())
|
||||
) + 1;
|
||||
}
|
||||
|
||||
|
||||
virtual vector grad(const vector& p) const
|
||||
{
|
||||
// normal_ has the length of one
|
||||
return vector
|
||||
(
|
||||
2*(p.x() - origin_.x())/sqr(semiAxis_.x()),
|
||||
2*(p.y() - origin_.y())/sqr(semiAxis_.y()),
|
||||
2*(p.z() - origin_.z())/sqr(semiAxis_.z())
|
||||
);
|
||||
}
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const
|
||||
{
|
||||
NotImplemented;
|
||||
return GREAT;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace implicitFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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 "implicitFunction.H"
|
||||
#include "error.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(implicitFunction, 0);
|
||||
defineRunTimeSelectionTable(implicitFunction, dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::implicitFunction> Foam::implicitFunction::New
|
||||
(
|
||||
const word& implicitFunctionType,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto cstrIter = dictConstructorTablePtr_->cfind(implicitFunctionType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
dict,
|
||||
"implicitFunction",
|
||||
implicitFunctionType,
|
||||
*dictConstructorTablePtr_
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<implicitFunction>(cstrIter()(dict));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunction
|
||||
|
||||
Description
|
||||
Base class for implicit functions
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
implicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunction_H
|
||||
#define implicitFunction_H
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "dictionary.H"
|
||||
#include "vector.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class implicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class implicitFunction
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("implicitFunction");
|
||||
|
||||
//- Declare run-time constructor selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
implicitFunction,
|
||||
dict,
|
||||
(
|
||||
const dictionary& dict
|
||||
),
|
||||
(dict)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
implicitFunction() = default;
|
||||
|
||||
|
||||
//- Return a reference to the selected implicitFunction
|
||||
static autoPtr<implicitFunction> New
|
||||
(
|
||||
const word& implicitFunctionType,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~implicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const
|
||||
{
|
||||
return GREAT;
|
||||
}
|
||||
|
||||
virtual vector grad(const vector& p) const
|
||||
{
|
||||
return vector::max;
|
||||
}
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const
|
||||
{
|
||||
return GREAT;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -5,7 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -23,33 +24,50 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Global
|
||||
setDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum courant Number.
|
||||
Reduction of time-step is immediate, but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
#include "paraboloidImplicitFunction.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
|
||||
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
namespace implicitFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(paraboloidImplicitFunction, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
implicitFunction,
|
||||
paraboloidImplicitFunction,
|
||||
dict
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::implicitFunctions::paraboloidImplicitFunction::paraboloidImplicitFunction
|
||||
(
|
||||
const vector& coeffs
|
||||
)
|
||||
:
|
||||
coeffs_(coeffs)
|
||||
{}
|
||||
|
||||
|
||||
Foam::implicitFunctions::paraboloidImplicitFunction::paraboloidImplicitFunction
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
paraboloidImplicitFunction
|
||||
(
|
||||
dict.get<vector>("coeffs")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,120 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunctions::paraboloidImplicitFunction
|
||||
|
||||
Description
|
||||
creates a paraboloid
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
paraboloidImplicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunction_paraboloidImplicitFunction_H
|
||||
#define implicitFunction_paraboloidImplicitFunction_H
|
||||
|
||||
#include "implicitFunction.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class paraboloidImplicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class paraboloidImplicitFunction
|
||||
:
|
||||
public implicitFunction
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Coefficients of ax^2 + bx*y + cy^2
|
||||
const vector coeffs_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("paraboloid");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
explicit paraboloidImplicitFunction(const vector& coeffs);
|
||||
|
||||
//- Construct from dictionary
|
||||
explicit paraboloidImplicitFunction(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~paraboloidImplicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const
|
||||
{
|
||||
return
|
||||
coeffs_.x()*sqr(p.x())
|
||||
+ coeffs_.y()*p.x()*p.y()
|
||||
+ coeffs_.z()*sqr(p.y())
|
||||
- p.z();
|
||||
}
|
||||
|
||||
virtual vector grad(const vector& p) const
|
||||
{
|
||||
NotImplemented;
|
||||
return Zero;
|
||||
}
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const
|
||||
{
|
||||
NotImplemented;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace implicitFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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 "planeImplicitFunction.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(planeImplicitFunction, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
implicitFunction,
|
||||
planeImplicitFunction,
|
||||
dict
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::implicitFunctions::planeImplicitFunction::planeImplicitFunction
|
||||
(
|
||||
const vector& origin,
|
||||
const vector& normal
|
||||
)
|
||||
:
|
||||
origin_(origin),
|
||||
normal_(normalised(normal))
|
||||
{}
|
||||
|
||||
|
||||
Foam::implicitFunctions::planeImplicitFunction::planeImplicitFunction
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
planeImplicitFunction
|
||||
(
|
||||
dict.get<vector>("origin"),
|
||||
dict.get<vector>("normal")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,120 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunctions::planeImplicitFunction
|
||||
|
||||
Description
|
||||
creates a plane
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
planeImplicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunction_planeImplicitFunction_H
|
||||
#define implicitFunction_planeImplicitFunction_H
|
||||
|
||||
#include "implicitFunction.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class planeImplicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class planeImplicitFunction
|
||||
:
|
||||
public implicitFunction
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Reference point
|
||||
const vector origin_;
|
||||
|
||||
//- Unit-normal vector
|
||||
const vector normal_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("plane");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
planeImplicitFunction(const vector& origin, const vector& normal);
|
||||
|
||||
//- Construct from dictionary (used by implicitFunctions)
|
||||
explicit planeImplicitFunction(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~planeImplicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const
|
||||
{
|
||||
return -normal_ & (origin_ - p);
|
||||
}
|
||||
|
||||
virtual vector grad(const vector& p) const
|
||||
{
|
||||
// normal_ has the length of one
|
||||
return normal_;
|
||||
}
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const
|
||||
{
|
||||
// normal_ has the length of one
|
||||
return mag((p - origin_) & -normal_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace implicitFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,87 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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 "sinImplicitFunction.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(sinImplicitFunction, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
implicitFunction,
|
||||
sinImplicitFunction,
|
||||
dict
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
|
||||
(
|
||||
const scalar period,
|
||||
const scalar phase,
|
||||
const scalar amplitude,
|
||||
const vector& direction,
|
||||
const vector& up,
|
||||
const vector& origin
|
||||
)
|
||||
:
|
||||
period_(period),
|
||||
phase_(phase),
|
||||
amplitude_(amplitude),
|
||||
up_(normalised(up)),
|
||||
direction_(normalised(direction)),
|
||||
origin_(origin)
|
||||
{}
|
||||
|
||||
|
||||
Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
sinImplicitFunction
|
||||
(
|
||||
dict.get<scalar>("period"),
|
||||
dict.getOrDefault<scalar>("phase", 0),
|
||||
dict.get<scalar>("amplitude"),
|
||||
dict.get<vector>("direction"),
|
||||
dict.get<vector>("up"),
|
||||
dict.get<vector>("origin")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,142 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
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::implicitFunctions::sinImplicitFunction
|
||||
|
||||
Description
|
||||
|
||||
Original code supplied by Henning Scheufler, DLR (2019)
|
||||
|
||||
SourceFiles
|
||||
sinImplicitFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef implicitFunction_sinImplicitFunction_H
|
||||
#define implicitFunction_sinImplicitFunction_H
|
||||
|
||||
#include "implicitFunction.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace implicitFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sinImplicitFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class sinImplicitFunction
|
||||
:
|
||||
public implicitFunction
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Origin point
|
||||
const scalar period_;
|
||||
|
||||
//- Radius
|
||||
const scalar phase_;
|
||||
|
||||
const scalar amplitude_;
|
||||
|
||||
const vector up_;
|
||||
|
||||
const vector direction_;
|
||||
|
||||
const vector origin_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sin");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
sinImplicitFunction
|
||||
(
|
||||
const scalar period,
|
||||
const scalar phase,
|
||||
const scalar amplitude,
|
||||
const vector& direction,
|
||||
const vector& up,
|
||||
const vector& origin
|
||||
);
|
||||
|
||||
//- Construct from dictionary (used by implicitFunctions)
|
||||
explicit sinImplicitFunction(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~sinImplicitFunction() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual scalar value(const vector& p) const
|
||||
{
|
||||
const scalar x = (p - origin_) & direction_;
|
||||
const scalar z = (p - origin_) & -up_;
|
||||
|
||||
return
|
||||
z
|
||||
- amplitude_
|
||||
*Foam::sin(2*constant::mathematical::pi*x/period_ + phase_);
|
||||
}
|
||||
|
||||
virtual vector grad(const vector& p) const
|
||||
{
|
||||
NotImplemented;
|
||||
return Zero;
|
||||
}
|
||||
|
||||
virtual scalar distanceToSurfaces(const vector& p) const
|
||||
{
|
||||
NotImplemented;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace implicitFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user