ENH: overset: Initial release of overset capability.

Adds overset discretisation to selected physics:
- diffusion : overLaplacianDyMFoam
- incompressible steady : overSimpleFoam
- incompressible transient : overPimpleDyMFoam
- compressible transient: overRhoPimpleDyMFoam
- two-phase VOF: overInterDyMFoam

The overset method chosen is a parallel, fully implicit implementation
whereby the interpolation (from donor to acceptor) is inserted as an
adapted discretisation on the donor cells, such that the resulting matrix
can be solved using the standard linear solvers.

Above solvers come with a set of tutorials, showing how to create and set-up
simple simulations from scratch.
This commit is contained in:
mattijs
2017-06-14 09:51:02 +01:00
parent 69deec2e1c
commit fd665b4a3c
374 changed files with 29369 additions and 579 deletions

View File

@ -0,0 +1,3 @@
laplacianDyMFoam.C
EXE = $(FOAM_APPBIN)/overLaplacianDyMFoam

View File

@ -0,0 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-loverset

View File

@ -0,0 +1,53 @@
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Add overset specific interpolations
{
dictionary oversetDict;
oversetDict.add("T", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
Info<< "Reading diffusivity DT\n" << endl;
dimensionedScalar DT
(
transportProperties.lookup("DT")
);

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
laplacianFoam
Group
grpBasicSolvers
Description
Laplace equation solver for a scalar quantity.
\heading Solver details
The solver is applicable to, e.g. for thermal diffusion in a solid. The
equation is given by:
\f[
\ddt{T} = \div \left( D_T \grad T \right)
\f]
Where:
\vartable
T | Scalar field which is solved for, e.g. temperature
D_T | Diffusion coefficient
\endvartable
\heading Required fields
\plaintable
T | Scalar field which is solved for, e.g. temperature
\endplaintable
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "fvOptions.H"
#include "simpleControl.H"
#include "dynamicFvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedDynamicFvMesh.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "createFvOptions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nCalculating temperature distribution\n" << endl;
while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
mesh.update();
while (simple.correctNonOrthogonal())
{
fvScalarMatrix TEqn
(
fvm::ddt(T) - fvm::laplacian(DT, T)
==
fvOptions(T)
);
fvOptions.constrain(TEqn);
TEqn.solve();
fvOptions.correct(T);
}
#include "write.H"
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
if (runTime.outputTime())
{
volVectorField gradT(fvc::grad(T));
volScalarField gradTx
(
IOobject
(
"gradTx",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.component(vector::X)
);
volScalarField gradTy
(
IOobject
(
"gradTy",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.component(vector::Y)
);
volScalarField gradTz
(
IOobject
(
"gradTz",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.component(vector::Z)
);
runTime.write();
}

View File

@ -0,0 +1,3 @@
rhoPimpleDyMFoam.C
EXE = $(FOAM_APPBIN)/overRhoPimpleDyMFoam

View File

@ -0,0 +1,25 @@
EXE_INC = \
-I.. \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-loverset \
-lfvOptions \
-ldynamicFvMesh \
-ltopoChangerFvMesh

View File

@ -0,0 +1,11 @@
CorrectPhi
(
U,
phi,
p,
rho,
psi,
dimensionedScalar("rAUf", dimTime, 1),
divrhoU,
pimple
);

View File

@ -0,0 +1,11 @@
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
);

View File

@ -0,0 +1,117 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiThermo> pThermo
(
psiThermo::New(mesh)
);
psiThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
thermo.rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
pimple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
pimple.dict(),
dimDensity,
0
)
);
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
mesh.setFluxRequired(p.name());
Info<< "Creating field dpdt\n" << endl;
volScalarField dpdt
(
IOobject
(
"dpdt",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
);
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));
//- Overset specific
// Add solver-specific interpolations
{
dictionary oversetDict;
oversetDict.add("U", true);
oversetDict.add("p", true);
oversetDict.add("HbyA", true);
oversetDict.add("grad(p)", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
// Mask field for zeroing out contributions on hole cells
#include "createCellMask.H"

View File

@ -0,0 +1,123 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", constrainHbyA(rAU*UEqn.H(), U, p));
//mesh.interpolate(HbyA);
if (pimple.nCorrPISO() <= 1)
{
tUEqn.clear();
}
if (pimple.transonic())
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
)
);
fvc::makeRelative(phid, psi, U);
MRF.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi == pEqn.flux();
}
}
}
else
{
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
);
fvc::makeRelative(phiHbyA, rho, U);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
while (pimple.correctNonOrthogonal())
{
// Pressure corrector
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA + pEqn.flux();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Recalculate density from the relaxed pressure
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
volVectorField gradP(fvc::grad(p));
//mesh.interpolate(gradP);
U = HbyA - rAU*cellMask*gradP;
U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf));
}
if (thermo.dpdt())
{
dpdt = fvc::ddt(p);
if (mesh.moving())
{
dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
}
}

View File

@ -0,0 +1,6 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
rhoPimpleFoam
Group
grpCompressibleSolvers grpMovingMeshSolvers
Description
Transient solver for laminar or turbulent flow of compressible fluids
for HVAC and similar applications.
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
pseudo-transient simulations.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "psiThermo.H"
#include "turbulentFluidThermoModel.H"
#include "bound.H"
#include "pimpleControl.H"
#include "CorrectPhi.H"
#include "fvOptions.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"
#include "cellCellStencilObject.H"
#include "localMin.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
pimpleControl pimple(mesh);
#include "createRDeltaT.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createMRF.H"
#include "createFvOptions.H"
#include "createRhoUf.H"
#include "createControls.H"
turbulence->validate();
if (!LTS)
{
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readControls.H"
{
// Store divrhoU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the
// same divergence
volScalarField divrhoU
(
"divrhoU",
fvc::div(fvc::absolute(phi, rho, U))
);
if (LTS)
{
#include "setRDeltaT.H"
}
else
{
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
}
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Store momentum to set rhoUf for introduced faces.
volVectorField rhoU("rhoU", rho*U);
// Do any mesh changes
mesh.update();
if (mesh.changing())
{
#include "setCellMask.H"
}
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf;
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
#include "rhoEqn.H"
Info<< "rhoEqn max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H"
#include "EEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;
if (mesh.nInternalFaces())
{
surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask));
scalarField sumPhi(fvc::surfaceSum(mag(phiMask*phi))().internalField());
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl;
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
pimpleDyMFoam.C
EXE = $(FOAM_APPBIN)/overPimpleDyMFoam

View File

@ -0,0 +1,24 @@
EXE_INC = \
-I.. \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lfvOptions \
-lsampling \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-ldynamicMesh \
-loverset

View File

@ -0,0 +1,24 @@
// Solve the Momentum equation
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::ddt(U) + fvm::div(phi, U)
+ MRF.DDt(U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn.relax();
fvOptions.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve(UEqn == -cellMask*fvc::grad(p));
fvOptions.correct(U);
}

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
continuityErrs
Description
Calculates and prints the continuity errors.
\*---------------------------------------------------------------------------*/
{
volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi));
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr
<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
if (mesh.changing())
{
volVectorField::Boundary& bfld = U.boundaryFieldRef();
forAll(bfld, patchi)
{
if (bfld[patchi].fixesValue())
{
bfld[patchi].initEvaluate();
}
}
surfaceScalarField::Boundary& phiBfld = phi.boundaryFieldRef();
forAll(bfld, patchi)
{
if (bfld[patchi].fixesValue())
{
bfld[patchi].evaluate();
phiBfld[patchi] = bfld[patchi] & mesh.Sf().boundaryField()[patchi];
}
}
}
// Initialize BCs list for pcorr to zero-gradient
wordList pcorrTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
);
// Set BCs of pcorr to fixed-value for patches at which p is fixed
forAll(p.boundaryField(), patchi)
{
if (p.boundaryField()[patchi].fixesValue())
{
pcorrTypes[patchi] = fixedValueFvPatchScalarField::typeName;
}
}
volScalarField pcorr
(
IOobject
(
"pcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", p.dimensions(), 0.0),
pcorrTypes
);
{
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
const cellCellStencilObject& overlap = Stencil::New(mesh);
const labelList& cellTypes = overlap.cellTypes();
const labelIOList& zoneIDs = overlap.zoneID();
while (pimple.correctNonOrthogonal())
{
label nZones = gMax(zoneIDs)+1;
//label refCellI2 = -1;
labelList refCells(nZones, -1);
labelList refZones(nZones, -1);
forAll(zoneIDs, cellI)
{
label zoneId = zoneIDs[cellI];
if
(
refCells[zoneId] == -1
&& cellTypes[cellI] == cellCellStencil::CALCULATED
&& refZones[zoneId] == -1
)
{
refCells[zoneId] = cellI;
refZones[zoneId] = zoneId;
}
}
fvScalarMatrix pcorrEqn
(
fvm::laplacian(rAUf, pcorr) == fvc::div(phi)
);
//pcorrEqn.setReference(refCellI2, 0.0, true);
scalarList values(nZones, 0.0);
pcorrEqn.setReferences(refCells, values, true);
const dictionary& d = mesh.solver
(
pcorr.select
(
pimple.finalInnerIter()
)
);
mesh.fvMesh::solve(pcorrEqn, d);
if (pimple.finalNonOrthogonalIter())
{
phi -= pcorrEqn.flux();
}
}
if (runTime.outputTime())
{
volScalarField("contPhiPcorr", fvc::div(phi)).write();
pcorr.write();
}
}

View File

@ -0,0 +1,26 @@
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().lookupOrDefault("correctPhi", false)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);
bool massFluxInterpolation
(
pimple.dict().lookupOrDefault("massFluxInterpolation", false)
);
bool adjustFringe
(
pimple.dict().lookupOrDefault("oversetAdjustPhi", false)
);
bool ddtCorr
(
pimple.dict().lookupOrDefault("ddtCorr", true)
);

View File

@ -0,0 +1,70 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name());
//- Overset specific
// Add solver-specific interpolations
{
dictionary oversetDict;
oversetDict.add("U", true);
oversetDict.add("p", true);
oversetDict.add("HbyA", true);
oversetDict.add("grad(p)", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
// Mask field for zeroing out contributions on hole cells
#include "createCellMask.H"
// Create bool field with interpolated cells
#include "createInterpolatedCells.H"
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);

View File

@ -0,0 +1,269 @@
// Interpolation used
interpolationCellPoint<vector> UInterpolator(HbyA);
// Determine faces on outside of interpolated cells
PackedBoolList isOwnerInterpolatedFace(mesh.nInternalFaces());
PackedBoolList isNeiInterpolatedFace(mesh.nInternalFaces());
// Determine donor cells
labelListList donorCell(mesh.nInternalFaces());
scalarListList weightCellCells(mesh.nInternalFaces());
// Interpolated HbyA faces
vectorField UIntFaces(mesh.nInternalFaces(), vector::zero);
// Determine receptor neighbourd cells
labelList receptorNeigCell(mesh.nInternalFaces(), -1);
{
const cellCellStencilObject& overlap = Stencil::New(mesh);
const labelList& cellTypes = overlap.cellTypes();
const labelIOList& zoneID = overlap.zoneID();
label nZones = gMax(zoneID)+1;
PtrList<fvMeshSubset> meshParts(nZones);
labelList nCellsPerZone(nZones, 0);
forAll(nCellsPerZone, zoneI)
{
meshParts.set(zoneI, new fvMeshSubset(mesh));
meshParts[zoneI].setLargeCellSubset(zoneID, zoneI);
}
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
label ownType = cellTypes[mesh.faceOwner()[faceI]];
label neiType = cellTypes[mesh.faceNeighbour()[faceI]];
if
(
ownType == cellCellStencil::INTERPOLATED
&& neiType == cellCellStencil::CALCULATED
)
{
isOwnerInterpolatedFace[faceI] = true;
const vector& fc = mesh.faceCentres()[faceI];
for (label zoneI = 0; zoneI < nZones; zoneI++)
{
if (zoneI != zoneID[mesh.faceOwner()[faceI]])
{
const fvMesh& partMesh = meshParts[zoneI].subMesh();
const labelList& cellMap = meshParts[zoneI].cellMap();
label cellI = partMesh.findCell(fc);
if (cellI != -1)
{
// Determine weights
labelList stencil(partMesh.cellCells()[cellI]);
stencil.append(cellI);
label st = stencil.size();
donorCell[faceI].setSize(st);
weightCellCells[faceI].setSize(st);
scalarField weights(st);
forAll(stencil, i)
{
scalar d = mag
(
partMesh.cellCentres()[stencil[i]]
- fc
);
weights[i] = 1.0/d;
donorCell[faceI][i] = cellMap[stencil[i]];
}
weights /= sum(weights);
weightCellCells[faceI] = weights;
forAll(stencil, i)
{
UIntFaces[faceI] +=
weightCellCells[faceI][i]
*UInterpolator.interpolate
(
fc,
donorCell[faceI][i]
);
}
break;
}
}
}
receptorNeigCell[faceI] = mesh.faceNeighbour()[faceI];
}
else if
(
ownType == cellCellStencil::CALCULATED
&& neiType == cellCellStencil::INTERPOLATED
)
{
isNeiInterpolatedFace[faceI] = true;
const vector& fc = mesh.faceCentres()[faceI];
for (label zoneI = 0; zoneI < nZones; zoneI++)
{
if (zoneI != zoneID[mesh.faceNeighbour()[faceI]])
{
const fvMesh& partMesh = meshParts[zoneI].subMesh();
const labelList& cellMap = meshParts[zoneI].cellMap();
label cellI = partMesh.findCell(fc);
if (cellI != -1)
{
// Determine weights
labelList stencil(partMesh.cellCells()[cellI]);
stencil.append(cellI);
label st = stencil.size();
donorCell[faceI].setSize(st);
weightCellCells[faceI].setSize(st);
scalarField weights(st);
forAll(stencil, i)
{
scalar d = mag
(
partMesh.cellCentres()[stencil[i]]
- fc
);
weights[i] = 1.0/d;
donorCell[faceI][i] = cellMap[stencil[i]];
}
weights /= sum(weights);
weightCellCells[faceI] = weights;
forAll(stencil, i)
{
UIntFaces[faceI] +=
weightCellCells[faceI][i]
*UInterpolator.interpolate
(
fc,
donorCell[faceI][i]
);
}
break;
}
}
}
receptorNeigCell[faceI] = mesh.faceOwner()[faceI];
}
}
}
// contravariant U
vectorField U1Contrav(mesh.nInternalFaces(), vector::zero);
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf());
forAll(isNeiInterpolatedFace, faceI)
{
label cellId = -1;
if (isNeiInterpolatedFace[faceI])
{
cellId = mesh.faceNeighbour()[faceI];
}
else if (isOwnerInterpolatedFace[faceI])
{
cellId = mesh.faceOwner()[faceI];
}
if (cellId != -1)
{
const vector& n = faceNormals[faceI];
vector n1 = vector::zero;
// 2-D cases
if (mesh.nSolutionD() == 2)
{
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
{
if (mesh.geometricD()[cmpt] == -1)
{
switch (cmpt)
{
case vector::X:
{
n1 = vector(0, n.z(), -n.y());
break;
}
case vector::Y:
{
n1 = vector(n.z(), 0, -n.x());
break;
}
case vector::Z:
{
n1 = vector(n.y(), -n.x(), 0);
break;
}
}
}
}
}
else if (mesh.nSolutionD() == 3)
{
//Determine which is the primary direction
if (mag(n.x()) > mag(n.y()) && mag(n.x()) > mag(n.z()))
{
n1 = vector(n.y(), -n.x(), 0);
}
else if (mag(n.y()) > mag(n.z()))
{
n1 = vector(0, n.z(), -n.y());
}
else
{
n1 = vector(-n.z(), 0, n.x());
}
}
n1 /= mag(n1);
vector n2 = n ^ n1;
n2 /= mag(n2);
tensor rot =
tensor
(
n.x() ,n.y(), n.z(),
n1.x() ,n1.y(), n1.z(),
n2.x() ,n2.y(), n2.z()
);
// tensor rot =
// tensor
// (
// n & x ,n & y, n & z,
// n1 & x ,n1 & y, n1 & z,
// n2 & x ,n2 & y, n2 & z
// );
U1Contrav[faceI].x() =
2*transform(rot, UIntFaces[faceI]).x()
- transform(rot, HbyA[receptorNeigCell[faceI]]).x();
U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y();
U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z();
HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]);
}
}

View File

@ -0,0 +1,109 @@
volScalarField rAU(1.0/UEqn.A());
// Option 1: interpolate rAU, do not block out rAU on blocked cells
//mesh.interpolate(rAU, false);
//surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
// Option 2: do not interpolate rAU but block out rAU
//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU));
// Option 3: do not interpolate rAU but zero out rAUf on faces on holes
// But what about:
//
// H
// H I C C C C
// H
//
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
HbyA = constrainHbyA(rAU*UEqn.H(), U, p);
//mesh.interpolate(HbyA);
if (massFluxInterpolation)
{
#include "interpolatedFaces.H"
}
if (pimple.nCorrPISO() <= 1)
{
tUEqn.clear();
}
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
if (ddtCorr)
{
phiHbyA += rAUf*fvc::ddtCorr(U, Uf);
}
MRF.makeRelative(phiHbyA);
if (p.needReference())
{
fvc::makeRelative(phiHbyA, U);
adjustPhi(phiHbyA, U, p);
fvc::makeAbsolute(phiHbyA, U);
}
if (adjustFringe)
{
fvc::makeRelative(phiHbyA, U);
oversetAdjustPhi(phiHbyA, U);
fvc::makeAbsolute(phiHbyA, U);
}
if (runTime.outputTime())
{
volScalarField
(
"div(phiHbyA)",
fvc::div(phiHbyA)
//interpolatedCells*cellMask*fvc::div(phiHbyA)
).write();
}
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
volVectorField gradP(fvc::grad(p));
//mesh.interpolate(gradP);
// Option 1: leave velocity intact on blocked out cells
//U = HbyA - rAU*gradP;
// Option 2: zero out velocity on blocked out cells
U = (HbyA - rAU*cellMask*gradP);
U.correctBoundaryConditions();
fvOptions.correct(U);
{
Uf = fvc::interpolate(U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
Uf += n*(phi/mesh.magSf() - (n & Uf));
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
pimpleDyMFoam.C
Group
grpIncompressibleSolvers grpMovingMeshSolvers
Description
Transient solver for incompressible, flow of Newtonian fluids
on a moving mesh using the PIMPLE (merged PISO-SIMPLE) algorithm.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "cellCellStencilObject.H"
#include "zeroGradientFvPatchFields.H"
#include "localMin.H"
#include "interpolationCellPoint.H"
#include "transform.H"
#include "fvMeshSubset.H"
#include "oversetAdjustPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Experimental version of pimpleDyMFoam with support for overset meshes"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "createUf.H"
#include "createMRF.H"
#include "createFvOptions.H"
#include "createControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
bool changed = mesh.update();
if (changed)
{
#include "setCellMask.H"
#include "setInterpolatedCells.H"
}
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
if (runTime.outputTime())
{
volScalarField
(
"contPhi",
interpolatedCells*cellMask*fvc::div(phi)
).write();
}
if (mesh.changing() && correctPhi)
{
#include "correctPhi.H"
}
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
laminarTransport.correct();
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
massFluxInterpolation =
pimple.dict().lookupOrDefault("massFluxInterpolation", false);
ddtCorr = pimple.dict().lookupOrDefault("ddtCorr", true);

View File

@ -0,0 +1,3 @@
simpleFoam.C
EXE = $(FOAM_APPBIN)/overSimpleFoam

View File

@ -0,0 +1,25 @@
EXE_INC = \
-I. \
-I$(FOAM_SOLVERS)/incompressible/pimpleFoam/overPimpleDyMFoam \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lfvOptions \
-lsampling \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-ldynamicMesh \
-loverset

View File

@ -0,0 +1,21 @@
// Momentum predictor
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
+ MRF.DDt(U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn.relax();
fvOptions.constrain(UEqn);
solve(UEqn == -cellMask*fvc::grad(p));
fvOptions.correct(U);

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
continuityErrs
Description
Calculates and prints the continuity errors.
\*---------------------------------------------------------------------------*/
{
volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi));
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr
<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name());
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
#include "createMRF.H"
#include "createOversetFields.H"

View File

@ -0,0 +1,34 @@
//- Overset specific
// Add solver-specific interpolations
{
dictionary oversetDict;
oversetDict.add("U", true);
oversetDict.add("p", true);
oversetDict.add("HbyA", true);
oversetDict.add("grad(p)", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
// Mask field for zeroing out contributions on hole cells
#include "createCellMask.H"
#include "createInterpolatedCells.H"
bool adjustFringe
(
simple.dict().lookupOrDefault("oversetAdjustPhi", false)
);
bool massFluxInterpolation
(
simple.dict().lookupOrDefault("massFluxInterpolation", false)
);

View File

@ -0,0 +1,22 @@
Info<< "Create dynamic mesh for time = "
<< runTime.timeName() << nl << endl;
autoPtr<dynamicFvMesh> meshPtr
(
dynamicFvMesh::New
(
IOobject
(
dynamicFvMesh::defaultRegion,
runTime.timeName(),
runTime,
IOobject::MUST_READ
)
)
);
dynamicFvMesh& mesh = meshPtr();
// Calculate initial mesh-to-mesh mapping. Note that this should be
// done under the hood, e.g. as a MeshObject
mesh.update();

View File

@ -0,0 +1,57 @@
{
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
HbyA = constrainHbyA(rAU*UEqn.H(), U, p);
//mesh.interpolate(HbyA);
if (massFluxInterpolation)
{
#include "interpolatedFaces.H"
}
tUEqn.clear();
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
adjustPhi(phiHbyA, U, p);
if (adjustFringe)
{
oversetAdjustPhi(phiHbyA, U);
}
// Non-orthogonal pressure corrector loop
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
volVectorField gradP(fvc::grad(p));
//mesh.interpolate(gradP);
U = HbyA - rAU*cellMask*gradP;
U.correctBoundaryConditions();
fvOptions.correct(U);
}

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
simpleFoam
Group
grpIncompressibleSolvers
Description
Steady-state solver for incompressible flows with turbulence modelling.
\heading Solver details
The solver uses the SIMPLE algorithm to solve the continuity equation:
\f[
\div \vec{U} = 0
\f]
and momentum equation:
\f[
\div \left( \vec{U} \vec{U} \right) - \div \gvec{R}
= - \grad p + \vec{S}_U
\f]
Where:
\vartable
\vec{U} | Velocity
p | Pressure
\vec{R} | Stress tensor
\vec{S}_U | Momentum source
\endvartable
\heading Required fields
\plaintable
U | Velocity [m/s]
p | Kinematic pressure, p/rho [m2/s2]
\<turbulence fields\> | As required by user selection
\endplaintable
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "simpleControl.H"
#include "fvOptions.H"
#include "dynamicFvMesh.H"
#include "cellCellStencilObject.H"
#include "localMin.H"
#include "interpolationCellPoint.H"
#include "fvMeshSubset.H"
#include "transform.H"
#include "oversetAdjustPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#define CREATE_MESH createUpdatedDynamicFvMesh.H
#include "postProcess.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createUpdatedDynamicFvMesh.H"
#include "createControl.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "pEqn.H"
}
laminarTransport.correct();
turbulence->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;
if (mesh.nInternalFaces())
{
surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask));
scalarField sumPhi
(
fvc::surfaceSum(mag(phiMask*phi))().internalField()
);
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl;
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
interDyMFoam.C
EXE = $(FOAM_APPBIN)/overInterDyMFoam

View File

@ -0,0 +1,31 @@
EXE_INC = \
-I. \
-I.. \
-I../../VoF \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(FOAM_SOLVERS)/incompressible/pimpleFoam/overPimpleDyMFoam \
-I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-limmiscibleIncompressibleTwoPhaseMixture \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lfiniteVolume \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-loverset \
-lfvOptions \
-lsampling \
-lwaveModels

View File

@ -0,0 +1,33 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
+ MRF.DDt(rho, U)
+ turbulence->divDevRhoReff(rho, U)
==
fvOptions(rho, U)
);
UEqn.relax();
fvOptions.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve
(
UEqn
==
cellMask*fvc::reconstruct
(
(
mixture.surfaceTensionForce()
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
) * mesh.magSf()
)
);
fvOptions.correct(U);
}

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
continuityErrs
Description
Calculates and prints the continuity errors.
\*---------------------------------------------------------------------------*/
{
volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi));
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr
<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
{
if (mesh.changing())
{
volVectorField::Boundary& bfld = U.boundaryFieldRef();
forAll(bfld, patchi)
{
if (bfld[patchi].fixesValue())
{
bfld[patchi].initEvaluate();
}
}
surfaceScalarField::Boundary& phiBfld = phi.boundaryFieldRef();
forAll(bfld, patchi)
{
if (bfld[patchi].fixesValue())
{
bfld[patchi].evaluate();
phiBfld[patchi] =
bfld[patchi]
& mesh.Sf().boundaryField()[patchi];
}
}
}
wordList pcorrTypes
(
p_rgh.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
);
for (label i=0; i<p_rgh.boundaryField().size(); i++)
{
if (p_rgh.boundaryField()[i].fixesValue())
{
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
}
}
volScalarField pcorr
(
IOobject
(
"pcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", p_rgh.dimensions(), 0.0),
pcorrTypes
);
if (pcorr.needReference())
{
fvc::makeRelative(phi, U);
adjustPhi(phi, U, pcorr);
fvc::makeAbsolute(phi, U);
}
mesh.setFluxRequired(pcorr.name());
dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0);
const cellCellStencilObject& overlap = Stencil::New(mesh);
const labelList& cellTypes = overlap.cellTypes();
const labelIOList& zoneIDs = overlap.zoneID();
while (pimple.correctNonOrthogonal())
{
label nZones = gMax(zoneIDs)+1;
//label refCellI2 = -1;
labelList refCells(nZones, -1);
labelList refZones(nZones, -1);
forAll(zoneIDs, cellI)
{
label zoneId = zoneIDs[cellI];
if
(
refCells[zoneId] == -1
&& cellTypes[cellI] == cellCellStencil::CALCULATED
&& refZones[zoneId] == -1
)
{
refCells[zoneId] = cellI;
refZones[zoneId] = zoneId;
}
}
fvScalarMatrix pcorrEqn
(
fvm::laplacian(rAUf, pcorr) == fvc::div(phi)
);
//pcorrEqn.setReference(refCellI2, 0, true);
scalarList values(nZones, 0.0);
pcorrEqn.setReferences(refCells, values, true);
const dictionary& d = mesh.solver
(
pcorr.select
(
pimple.finalInnerIter()
)
);
//Bypass virtual layer
mesh.fvMesh::solve(pcorrEqn, d);
if (pimple.finalNonOrthogonalIter())
{
phi -= pcorrEqn.flux();
}
}
if (runTime.outputTime())
{
volScalarField("contPhiPcorr", fvc::div(phi)).write();
pcorr.write();
}
}

View File

@ -0,0 +1,25 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);
bool massFluxInterpolation
(
pimple.dict().lookupOrDefault("massFluxInterpolation", false)
);
bool ddtCorr
(
pimple.dict().lookupOrDefault("ddtCorr", true)
);

View File

@ -0,0 +1,171 @@
#include "createRDeltaT.H"
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
//- Overset specific
// Add solver-specific interpolations
{
dictionary oversetDict;
oversetDict.add("U", true);
oversetDict.add("p", true);
oversetDict.add("HbyA", true);
oversetDict.add("p_rgh", true);
oversetDict.add("alpha1", true);
oversetDict.add("minGradP", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
// Mask field for zeroing out contributions on hole cells
#include "createCellMask.H"
// Create bool field with interpolated cells
#include "createInterpolatedCells.H"
Info<< "Reading transportProperties\n" << endl;
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
volScalarField& alpha1(mixture.alpha1());
volScalarField& alpha2(mixture.alpha2());
const dimensionedScalar& rho1 = mixture.rho1();
const dimensionedScalar& rho2 = mixture.rho2();
// Need to store rho for ddt(rho, U)
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT
),
alpha1*rho1 + alpha2*rho2
);
rho.oldTime();
// Mass flux
surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::interpolate(rho)*phi
);
// Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, mixture)
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh + rho*gh
);
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
p_rgh = p - rho*gh;
}
mesh.setFluxRequired(p_rgh.name());
mesh.setFluxRequired(alpha1.name());
// MULES compressed flux is registered in case scalarTransport FO needs it.
surfaceScalarField alphaPhiUn
(
IOobject
(
"alphaPhiUn",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", phi.dimensions(), 0.0)
);
#include "createMRF.H"

View File

@ -0,0 +1,209 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
overInterDyMFoam
Group
grpMultiphaseSolvers grpMovingMeshSolvers
Description
Solver for 2 incompressible, isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach,
with optional mesh motion and mesh topology changes including adaptive
re-meshing.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "CMULES.H"
#include "EulerDdtScheme.H"
#include "localEulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"
#include "subCycle.H"
#include "immiscibleIncompressibleTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "CorrectPhi.H"
#include "fvcSmooth.H"
#include "cellCellStencilObject.H"
#include "localMin.H"
#include "interpolationCellPoint.H"
#include "transform.H"
#include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "postProcess.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "initContinuityErrs.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createAlphaFluxes.H"
#include "createFvOptions.H"
volScalarField rAU
(
IOobject
(
"rAU",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0)
);
#include "correctPhi.H"
#include "createUf.H"
turbulence->validate();
if (!LTS)
{
#include "CourantNo.H"
#include "setInitialDeltaT.H"
}
#include "setCellMask.H"
#include "setInterpolatedCells.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readControls.H"
if (LTS)
{
#include "setRDeltaT.H"
}
else
{
#include "CourantNo.H"
#include "alphaCourantNo.H"
#include "setDeltaT.H"
}
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
mesh.update();
if (mesh.changing())
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
// Do not apply previous time-step mesh compression flux
// if the mesh topology changed
if (mesh.topoChanging())
{
talphaPhiCorr0.clear();
}
gh = (g & mesh.C()) - ghRef;
ghf = (g & mesh.Cf()) - ghRef;
// Update cellMask field for blocking out hole cells
#include "setCellMask.H"
#include "setInterpolatedCells.H"
}
if ((mesh.changing() && correctPhi) || mesh.topoChanging())
{
// Calculate absolute flux from the mapped surface velocity
// Note: temporary fix until mapped Uf is assessed
Uf = fvc::interpolate(U);
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
mixture.correct();
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
#include "alphaControls.H"
#include "alphaEqnSubCycle.H"
mixture.correct();
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,96 @@
{
rAU = 1.0/UEqn.A();
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
//HbyA = rAU*UEqn.H();
HbyA = constrainHbyA(rAU*UEqn.H(), U, p_rgh);
if (massFluxInterpolation)
{
#include "interpolatedFaces.H"
}
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
if (ddtCorr)
{
phiHbyA += fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf);
}
MRF.makeRelative(phiHbyA);
if (p_rgh.needReference())
{
fvc::makeRelative(phiHbyA, U);
adjustPhi(phiHbyA, U, p_rgh);
fvc::makeAbsolute(phiHbyA, U);
}
surfaceScalarField phig
(
(
mixture.surfaceTensionForce()
- ghf*fvc::snGrad(rho)
)*faceMask*rAUf*mesh.magSf()
);
phiHbyA += phig;
// Update the pressure BCs to ensure flux consistency
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_rghEqn
(
fvm::laplacian(faceMask*rAUf, p_rgh) == fvc::div(phiHbyA)
);
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA - p_rghEqn.flux();
p_rgh.relax();
// Reconstruct body forces (-grad(p) and gh etc)
volVectorField minGradP
(
"minGradP",
fvc::reconstruct((phig - p_rghEqn.flux())/rAUf)
);
U = HbyA + rAU*cellMask*minGradP;
U.correctBoundaryConditions();
fvOptions.correct(U);
}
}
#include "continuityErrs.H"
{
Uf = fvc::interpolate(U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
Uf += n*(phi/mesh.magSf() - (n & Uf));
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
p == p_rgh + rho*gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
p_rgh = p - rho*gh;
}
}

View File

@ -0,0 +1,15 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);
massFluxInterpolation =
pimple.dict().lookupOrDefault("massFluxInterpolation", false);
ddtCorr =
pimple.dict().lookupOrDefault("ddtCorr", true);

View File

@ -0,0 +1,3 @@
laplacianDyMFoam.C
EXE = $(FOAM_USER_APPBIN)/correctBoundaryConditions

View File

@ -0,0 +1,12 @@
EXE_INC = \
-DFULLDEBUG -g -O0 \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/overset/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsampling \
-loverset

View File

@ -0,0 +1,53 @@
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Add overset specific interpolations
{
dictionary oversetDict;
oversetDict.add("T", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
Info<< "Reading diffusivity DT\n" << endl;
dimensionedScalar DT
(
transportProperties.lookup("DT")
);

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 273;
boundaryField
{
//- Set patchGroups for constraint patches
#include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"
"(walls|hole)"
{
type zeroGradient;
}
left1
{
type fixedValue;
value uniform 300;
}
right1
{
type fixedValue;
value uniform 273;
}
overset
{
type overset;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
".*"
{
type uniformFixedValue;
uniformValue (0 0 0);
}
"(free|hole)"
{
patchType overset;
type uniformFixedValue;
uniformValue (0 0 0);
// uniformValue table
// (
// (0.0 (0 0 0))
// (1.0 (0.31 0 0))
// (2.0 (0 0 0))
// );
}
}
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev-OpenCFD.overlap |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object zoneID;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
//- Set patchGroups for constraint patches
#include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"
overset
{
type overset;
}
".*"
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -f constant/polyMesh/boundary
rm -f constant/polyMesh/zoneID
rm -rf 0
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,17 @@
#!/bin/sh
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
# Select cellSets
runApplication topoSet
runApplication subsetMesh box -patch hole -overwrite
# Select cellSets
runApplication -s zoneID topoSet
rm -rf 0 && cp -r 0.org 0
# Use cellSets to write zoneID
runApplication setFields

View File

@ -0,0 +1,33 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
motionSolverLibs ( "libfvMotionSolvers.so" );
solver displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity uniform 1;
}
dynamicFvMesh dynamicOversetFvMesh;
dynamicOversetFvMeshCoeffs
{
// layerRelax 0.3;
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DT DT [ 0 2 -1 0 0 0 0 ] 1;
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1e-05;
CrossPowerLawCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
m m [ 0 0 1 0 0 0 0 ] 1;
n n [ 0 0 0 0 0 0 0 ] 1;
}
BirdCarreauCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
k k [ 0 0 1 0 0 0 0 ] 0;
n n [ 0 0 0 0 0 0 0 ] 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0.00 0.0 0)
( 1.00 0.0 0)
( 1.00 1.0 0)
( 0.00 1.0 0)
( 0.00 0.0 1)
( 1.00 0.0 1)
( 1.00 1.0 1)
( 0.00 1.0 1)
//- 0 degrees
( 0.25 0.25 0)
( 0.75 0.25 0)
( 0.75 0.75 0)
( 0.25 0.75 0)
( 0.25 0.25 1)
( 0.75 0.25 1)
( 0.75 0.75 1)
( 0.25 0.75 1)
//- 45 degrees rotated
// ( 0.25 0.5 0)
// ( 0.5 0.25 0)
// ( 0.75 0.5 0)
// ( 0.5 0.75 0)
// ( 0.25 0.5 1)
// ( 0.5 0.25 1)
// ( 0.75 0.5 1)
// ( 0.5 0.75 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (18 18 1) simpleGrading (1 1 1)
hex (8 9 10 11 12 13 14 15) movingZone (30 30 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
free
{
type overset;
faces
(
(8 12 15 11)
(10 14 13 9)
(11 15 14 10)
( 9 13 12 8)
);
}
walls
{
type patch;
faces
(
(3 7 6 2)
(1 5 4 0)
);
}
// Populated by subsetMesh
hole
{
type patch;
faces ();
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
( 8 11 10 9)
(12 13 14 15)
);
}
left1
{
type patch;
faces
(
(0 4 7 3)
);
}
right1
{
type patch;
faces
(
(2 6 5 1)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Make sure all preprocessing tools know about the 'overset' bc
libs ("liboverset.so");
DebugSwitches
{
overset 1;
inverseDistance 1;
}
application correctBoundaryConditions; //overLaplacianDyMFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 1;
deltaT 0.1;
writeControl timeStep;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 16;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
//constraints
//{
// localOverset
// {
// //- Keep donor and acceptor on same processor
// type localOverset;
// }
//}
method hierarchical;
hierarchicalCoeffs
{
n (1 2 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "decompositionData";
}
// ************************************************************************* //

View File

@ -0,0 +1,85 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
grad(T) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss limitedLinearV 1;
div(phi,k) bounded Gauss limitedLinear 1;
div(phi,epsilon) bounded Gauss limitedLinear 1;
div(phi,R) bounded Gauss limitedLinear 1;
div(R) Gauss linear;
div(phi,nuTilda) bounded Gauss limitedLinear 1;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
laplacian(diffusivity,cellDisplacement) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
pcorr ;
p ;
}
oversetInterpolation
{
// Interpolation scheme to use for overset calculation
method inverseDistance;
// The inverseDistance method uses a 'voxel' like search structure.
// Optionally specify the extent and number of divisions n.
// Note that it will allocate an array of nx*ny*nz. If not specified:
// - searchBox : local mesh bounding box
// - searchBoxDivisions : root (2D) or cube-root(3D) of number of cells
searchBox (0 0 0)(1 1 1);
searchBoxDivisions (100 100 1);
}
oversetInterpolationRequired
{
// Any additional fields that require overset interpolation
}
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
T
{
solver PBiCGStab;
preconditioner DILU;
//solver GAMG;
//smoother DILUGaussSeidel;
//agglomerator algebraicPair;
//processorAgglomerator none;
tolerance 1e-10;
relTol 0;
}
cellDisplacement
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
maxIter 100;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0; //2;
}
PIMPLE
{
correctPhi yes;
nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
fields
{
p 0.3;
}
equations
{
U 0.7;
k 0.7;
omega 0.7;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object postProcessingDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
functions
{
processorField1
{
// Type of functionObject
type processorField;
// Where to load it from (if not already in solver)
libs ("libfieldFunctionObjects.so");
// Function object enabled flag
enabled true;
// When to output the average fields
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object postProcessingDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
processorField
{
// Type of functionObject
type processorField;
// Where to load it from (if not already in solver)
libs ("libfieldFunctionObjects.so");
// Function object enabled flag
enabled true;
// When to output the average fields
writeControl timeStep;
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue zoneID 123
);
regions
(
// Set cell values
// (does zerogradient on boundaries)
cellToCell
{
set c0;
fieldValues
(
volScalarFieldValue zoneID 0
);
}
cellToCell
{
set c1;
fieldValues
(
volScalarFieldValue zoneID 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name c0;
type cellSet;
action new;
source regionToCell;
sourceInfo
{
insidePoints ((0.001 0.001 0.001));
}
}
{
name c1;
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set c0;
}
}
{
name c1;
type cellSet;
action invert;
}
// Select box to remove from region 1
{
name box;
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set c1;
}
}
{
name box;
type cellSet;
action subset;
source boxToCell;
sourceInfo
{
box (0.4 0.4 -100)(0.6 0.6 100);
}
}
{
name box;
type cellSet;
action invert;
}
);
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
laplacianFoam
Group
grpBasicSolvers
Description
Laplace equation solver for a scalar quantity.
\heading Solver details
The solver is applicable to, e.g. for thermal diffusion in a solid. The
equation is given by:
\f[
\ddt{T} = \div \left( D_T \grad T \right)
\f]
Where:
\vartable
T | Scalar field which is solved for, e.g. temperature
D_T | Diffusion coefficient
\endvartable
\heading Required fields
\plaintable
T | Scalar field which is solved for, e.g. temperature
\endplaintable
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "simpleControl.H"
#include "dynamicFvMesh.H"
#include "dynamicOversetFvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedDynamicFvMesh.H"
simpleControl simple(mesh);
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nCorrecting boundary conditions on " << T.name() << nl << endl;
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
Info<< "Reading : ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
mesh.update();
Info<< "Overset calculation : ExecutionTime = "
<< runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
if (false)
{
// Test correctBoundaryConditions
// Change the internalField
component(T.ref(), mesh.C(), 0);
component(T.ref(), mesh.C(), 1);
// Interpolate + halo swap
T.correctBoundaryConditions();
// Check halo swap
dynamicOversetFvMesh::checkCoupledBC(T);
}
if (true)
{
// Test solving
fvScalarMatrix TEqn(fvm::laplacian(DT, T));
TEqn.solve();
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
if (runTime.outputTime())
{
volVectorField gradT(fvc::grad(T));
volScalarField gradTx
(
IOobject
(
"gradTx",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.component(vector::X)
);
volScalarField gradTy
(
IOobject
(
"gradTy",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.component(vector::Y)
);
volScalarField gradTz
(
IOobject
(
"gradTz",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.component(vector::Z)
);
runTime.write();
}

View File

@ -0,0 +1,3 @@
Test-wallDistDyM.C
EXE = $(FOAM_USER_APPBIN)/Test-wallDistDyM

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicFvMesh

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Calculate and write the distance-to-wall field for a moving mesh.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "dynamicFvMesh.H"
#include "wallDist.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
Info<< "Mesh read in = "
<< runTime.cpuTimeIncrement()
<< " s\n" << endl << endl;
// Calculate initial mesh-to-mesh mapping. Note that this should be
// done under the hood, e.g. as a MeshObject
mesh.update();
Info<< "Time now = " << runTime.timeName() << endl;
// Wall-reflection vectors
const volVectorField& n = wallDist::New(mesh).n();
n.write();
// Wall distance
const volScalarField& y = wallDist::New(mesh).y();
y.write();
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.

View File

@ -64,5 +64,10 @@ wedge
type wedge; type wedge;
} }
overset
{
type overset;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -54,6 +54,8 @@ wmake $targetType topoChangerFvMesh
parallel/Allwmake $targetType $* parallel/Allwmake $targetType $*
randomProcesses/Allwmake $targetType $* randomProcesses/Allwmake $targetType $*
wmake $targetType overset
wmake $targetType ODE wmake $targetType ODE
wmake $targetType fvMotionSolver wmake $targetType fvMotionSolver

View File

@ -97,6 +97,7 @@ public:
virtual void initInterfaceMatrixUpdate virtual void initInterfaceMatrixUpdate
( (
Field<Type>&, Field<Type>&,
const bool add,
const Field<Type>&, const Field<Type>&,
const scalarField&, const scalarField&,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
@ -110,6 +111,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
Field<Type>&, Field<Type>&,
const bool add,
const Field<Type>&, const Field<Type>&,
const scalarField&, const scalarField&,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType

View File

@ -617,6 +617,7 @@ public:
// for matrix operations // for matrix operations
void initMatrixInterfaces void initMatrixInterfaces
( (
const bool add,
const FieldField<Field, LUType>& interfaceCoeffs, const FieldField<Field, LUType>& interfaceCoeffs,
const Field<Type>& psiif, const Field<Type>& psiif,
Field<Type>& result Field<Type>& result
@ -625,6 +626,7 @@ public:
//- Update interfaced interfaces for matrix operations //- Update interfaced interfaces for matrix operations
void updateMatrixInterfaces void updateMatrixInterfaces
( (
const bool add,
const FieldField<Field, LUType>& interfaceCoeffs, const FieldField<Field, LUType>& interfaceCoeffs,
const Field<Type>& psiif, const Field<Type>& psiif,
Field<Type>& result Field<Type>& result

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -82,6 +82,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Amul
// Initialise the update of interfaced interfaces // Initialise the update of interfaced interfaces
initMatrixInterfaces initMatrixInterfaces
( (
true,
interfacesUpper_, interfacesUpper_,
psi, psi,
Apsi Apsi
@ -104,6 +105,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Amul
// Update interface interfaces // Update interface interfaces
updateMatrixInterfaces updateMatrixInterfaces
( (
true,
interfacesUpper_, interfacesUpper_,
psi, psi,
Apsi Apsi
@ -136,6 +138,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Tmul
// Initialise the update of interfaced interfaces // Initialise the update of interfaced interfaces
initMatrixInterfaces initMatrixInterfaces
( (
true,
interfacesLower_, interfacesLower_,
psi, psi,
Tpsi Tpsi
@ -157,6 +160,7 @@ void Foam::LduMatrix<Type, DType, LUType>::Tmul
// Update interface interfaces // Update interface interfaces
updateMatrixInterfaces updateMatrixInterfaces
( (
true,
interfacesLower_, interfacesLower_,
psi, psi,
Tpsi Tpsi
@ -237,20 +241,11 @@ void Foam::LduMatrix<Type, DType, LUType>::residual
// Note: there is a change of sign in the coupled // Note: there is a change of sign in the coupled
// interface update to add the contibution to the r.h.s. // interface update to add the contibution to the r.h.s.
FieldField<Field, LUType> mBouCoeffs(interfacesUpper_.size());
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs.set(patchi, -interfacesUpper_[patchi]);
}
}
// Initialise the update of interfaced interfaces // Initialise the update of interfaced interfaces
initMatrixInterfaces initMatrixInterfaces
( (
mBouCoeffs, false, // negate interface contributions
interfacesUpper_,
psi, psi,
rA rA
); );
@ -272,7 +267,8 @@ void Foam::LduMatrix<Type, DType, LUType>::residual
// Update interface interfaces // Update interface interfaces
updateMatrixInterfaces updateMatrixInterfaces
( (
mBouCoeffs, false,
interfacesUpper_,
psi, psi,
rA rA
); );

View File

@ -31,6 +31,7 @@ License
template<class Type, class DType, class LUType> template<class Type, class DType, class LUType>
void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
( (
const bool add,
const FieldField<Field, LUType>& interfaceCoeffs, const FieldField<Field, LUType>& interfaceCoeffs,
const Field<Type>& psiif, const Field<Type>& psiif,
Field<Type>& result Field<Type>& result
@ -49,6 +50,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
interfaces_[interfacei].initInterfaceMatrixUpdate interfaces_[interfacei].initInterfaceMatrixUpdate
( (
result, result,
add,
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
@ -75,6 +77,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
interfaces_[interfacei].initInterfaceMatrixUpdate interfaces_[interfacei].initInterfaceMatrixUpdate
( (
result, result,
add,
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
@ -96,6 +99,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
template<class Type, class DType, class LUType> template<class Type, class DType, class LUType>
void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
( (
const bool add,
const FieldField<Field, LUType>& interfaceCoeffs, const FieldField<Field, LUType>& interfaceCoeffs,
const Field<Type>& psiif, const Field<Type>& psiif,
Field<Type>& result Field<Type>& result
@ -121,6 +125,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
interfaces_[interfacei].updateInterfaceMatrix interfaces_[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
@ -145,6 +150,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
interfaces_[interfacei].initInterfaceMatrixUpdate interfaces_[interfacei].initInterfaceMatrixUpdate
( (
result, result,
add,
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
@ -156,6 +162,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
interfaces_[interfacei].updateInterfaceMatrix interfaces_[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
@ -179,6 +186,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
interfaces_[interfacei].updateInterfaceMatrix interfaces_[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -91,30 +91,22 @@ void Foam::TGaussSeidelSmoother<Type, DType, LUType>::smooth
// Note: there is a change of sign in the coupled // Note: there is a change of sign in the coupled
// interface update to add the contibution to the r.h.s. // interface update to add the contibution to the r.h.s.
FieldField<Field, LUType> mBouCoeffs(matrix_.interfacesUpper().size());
forAll(mBouCoeffs, patchi)
{
if (matrix_.interfaces().set(patchi))
{
mBouCoeffs.set(patchi, -matrix_.interfacesUpper()[patchi]);
}
}
for (label sweep=0; sweep<nSweeps; sweep++) for (label sweep=0; sweep<nSweeps; sweep++)
{ {
bPrime = matrix_.source(); bPrime = matrix_.source();
matrix_.initMatrixInterfaces matrix_.initMatrixInterfaces
( (
mBouCoeffs, false,
matrix_.interfacesUpper(),
psi, psi,
bPrime bPrime
); );
matrix_.updateMatrixInterfaces matrix_.updateMatrixInterfaces
( (
mBouCoeffs, false,
matrix_.interfacesUpper(),
psi, psi,
bPrime bPrime
); );

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -215,6 +215,14 @@ const Foam::labelUList& Foam::lduAddressing::losortStartAddr() const
} }
void Foam::lduAddressing::clearOut()
{
deleteDemandDrivenData(losortPtr_);
deleteDemandDrivenData(ownerStartPtr_);
deleteDemandDrivenData(losortStartPtr_);
}
Foam::label Foam::lduAddressing::triIndex(const label a, const label b) const Foam::label Foam::lduAddressing::triIndex(const label a, const label b) const
{ {
label own = min(a, b); label own = min(a, b);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -186,6 +186,9 @@ public:
// Return patch field evaluation schedule // Return patch field evaluation schedule
virtual const lduSchedule& patchSchedule() const = 0; virtual const lduSchedule& patchSchedule() const = 0;
//- Clear additional addressing
void clearOut();
//- Return losort addressing //- Return losort addressing
const labelUList& losortAddr() const; const labelUList& losortAddr() const;

View File

@ -131,10 +131,12 @@ public:
return true; return true;
} }
//- Initialise neighbour matrix update //- Initialise neighbour matrix update. Add
// or subtract coupled contributions to matrix
virtual void initInterfaceMatrixUpdate virtual void initInterfaceMatrixUpdate
( (
scalarField&, scalarField&,
const bool add,
const scalarField&, const scalarField&,
const scalarField&, const scalarField&,
const direction, const direction,
@ -142,15 +144,28 @@ public:
) const ) const
{} {}
//- Update result field based on interface functionality //- Update result field based on interface functionality. Add
// or subtract coupled contributions to matrix
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
scalarField&, scalarField&,
const bool add,
const scalarField&, const scalarField&,
const scalarField&, const scalarField&,
const direction, const direction,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const = 0; ) const = 0;
//- Helper: add (or subtract) weighted contributions to internal
// field
template<class Type>
void addToInternalField
(
Field<Type>& result,
const bool add,
const scalarField& coeffs,
const Field<Type>& vals
) const;
}; };
@ -160,6 +175,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "lduInterfaceFieldTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::lduInterfaceField::addToInternalField
(
Field<Type>& result,
const bool add,
const scalarField& coeffs,
const Field<Type>& vals
) const
{
const labelUList& faceCells = this->interface().faceCells();
if (add)
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] += coeffs[elemI]*vals[elemI];
}
}
else
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*vals[elemI];
}
}
}
// ************************************************************************* //

View File

@ -672,6 +672,7 @@ public:
// for matrix operations // for matrix operations
void initMatrixInterfaces void initMatrixInterfaces
( (
const bool add,
const FieldField<Field, scalar>& interfaceCoeffs, const FieldField<Field, scalar>& interfaceCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const scalarField& psiif, const scalarField& psiif,
@ -682,6 +683,7 @@ public:
//- Update interfaced interfaces for matrix operations //- Update interfaced interfaces for matrix operations
void updateMatrixInterfaces void updateMatrixInterfaces
( (
const bool add,
const FieldField<Field, scalar>& interfaceCoeffs, const FieldField<Field, scalar>& interfaceCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const scalarField& psiif, const scalarField& psiif,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,6 +56,7 @@ void Foam::lduMatrix::Amul
// Initialise the update of interfaced interfaces // Initialise the update of interfaced interfaces
initMatrixInterfaces initMatrixInterfaces
( (
true,
interfaceBouCoeffs, interfaceBouCoeffs,
interfaces, interfaces,
psi, psi,
@ -81,6 +82,7 @@ void Foam::lduMatrix::Amul
// Update interface interfaces // Update interface interfaces
updateMatrixInterfaces updateMatrixInterfaces
( (
true,
interfaceBouCoeffs, interfaceBouCoeffs,
interfaces, interfaces,
psi, psi,
@ -117,6 +119,7 @@ void Foam::lduMatrix::Tmul
// Initialise the update of interfaced interfaces // Initialise the update of interfaced interfaces
initMatrixInterfaces initMatrixInterfaces
( (
true,
interfaceIntCoeffs, interfaceIntCoeffs,
interfaces, interfaces,
psi, psi,
@ -140,6 +143,7 @@ void Foam::lduMatrix::Tmul
// Update interface interfaces // Update interface interfaces
updateMatrixInterfaces updateMatrixInterfaces
( (
true,
interfaceIntCoeffs, interfaceIntCoeffs,
interfaces, interfaces,
psi, psi,
@ -233,20 +237,11 @@ void Foam::lduMatrix::residual
// To compensate for this, it is necessary to turn the // To compensate for this, it is necessary to turn the
// sign of the contribution. // sign of the contribution.
FieldField<Field, scalar> mBouCoeffs(interfaceBouCoeffs.size());
forAll(mBouCoeffs, patchi)
{
if (interfaces.set(patchi))
{
mBouCoeffs.set(patchi, -interfaceBouCoeffs[patchi]);
}
}
// Initialise the update of interfaced interfaces // Initialise the update of interfaced interfaces
initMatrixInterfaces initMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs,
interfaces, interfaces,
psi, psi,
rA, rA,
@ -271,7 +266,8 @@ void Foam::lduMatrix::residual
// Update interface interfaces // Update interface interfaces
updateMatrixInterfaces updateMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs,
interfaces, interfaces,
psi, psi,
rA, rA,

View File

@ -29,6 +29,7 @@ License
void Foam::lduMatrix::initMatrixInterfaces void Foam::lduMatrix::initMatrixInterfaces
( (
const bool add,
const FieldField<Field, scalar>& coupleCoeffs, const FieldField<Field, scalar>& coupleCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const scalarField& psiif, const scalarField& psiif,
@ -49,6 +50,7 @@ void Foam::lduMatrix::initMatrixInterfaces
interfaces[interfacei].initInterfaceMatrixUpdate interfaces[interfacei].initInterfaceMatrixUpdate
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -75,6 +77,7 @@ void Foam::lduMatrix::initMatrixInterfaces
interfaces[interfacei].initInterfaceMatrixUpdate interfaces[interfacei].initInterfaceMatrixUpdate
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -95,6 +98,7 @@ void Foam::lduMatrix::initMatrixInterfaces
void Foam::lduMatrix::updateMatrixInterfaces void Foam::lduMatrix::updateMatrixInterfaces
( (
const bool add,
const FieldField<Field, scalar>& coupleCoeffs, const FieldField<Field, scalar>& coupleCoeffs,
const lduInterfaceFieldPtrsList& interfaces, const lduInterfaceFieldPtrsList& interfaces,
const scalarField& psiif, const scalarField& psiif,
@ -111,6 +115,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
interfaces[interfacei].updateInterfaceMatrix interfaces[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -139,6 +144,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
interfaces[interfacei].updateInterfaceMatrix interfaces[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -190,6 +196,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
interfaces[interfacei].updateInterfaceMatrix interfaces[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -214,6 +221,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
interfaces[interfacei].initInterfaceMatrixUpdate interfaces[interfacei].initInterfaceMatrixUpdate
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -225,6 +233,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
interfaces[interfacei].updateInterfaceMatrix interfaces[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
@ -248,6 +257,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
interfaces[interfacei].updateInterfaceMatrix interfaces[interfacei].updateInterfaceMatrix
( (
result, result,
add,
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -107,28 +107,14 @@ void Foam::GaussSeidelSmoother::smooth
// To compensate for this, it is necessary to turn the // To compensate for this, it is necessary to turn the
// sign of the contribution. // sign of the contribution.
FieldField<Field, scalar>& mBouCoeffs =
const_cast<FieldField<Field, scalar>&>
(
interfaceBouCoeffs_
);
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
for (label sweep=0; sweep<nSweeps; sweep++) for (label sweep=0; sweep<nSweeps; sweep++)
{ {
bPrime = source; bPrime = source;
matrix_.initMatrixInterfaces matrix_.initMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs_,
interfaces_, interfaces_,
psi, psi,
bPrime, bPrime,
@ -137,7 +123,8 @@ void Foam::GaussSeidelSmoother::smooth
matrix_.updateMatrixInterfaces matrix_.updateMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs_,
interfaces_, interfaces_,
psi, psi,
bPrime, bPrime,
@ -175,15 +162,6 @@ void Foam::GaussSeidelSmoother::smooth
psiPtr[celli] = psii; psiPtr[celli] = psii;
} }
} }
// Restore interfaceBouCoeffs_
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -134,18 +134,6 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth
// To compensate for this, it is necessary to turn the // To compensate for this, it is necessary to turn the
// sign of the contribution. // sign of the contribution.
FieldField<Field, scalar>& mBouCoeffs =
const_cast<FieldField<Field, scalar>&>
(
interfaceBouCoeffs_
);
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
for (label sweep=0; sweep<nSweeps; sweep++) for (label sweep=0; sweep<nSweeps; sweep++)
{ {
@ -153,7 +141,8 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth
matrix_.initMatrixInterfaces matrix_.initMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs_,
interfaces_, interfaces_,
psi, psi,
bPrime, bPrime,
@ -193,7 +182,8 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth
matrix_.updateMatrixInterfaces matrix_.updateMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs_,
interfaces_, interfaces_,
psi, psi,
bPrime, bPrime,
@ -228,15 +218,6 @@ void Foam::nonBlockingGaussSeidelSmoother::smooth
psiPtr[celli] = curPsi; psiPtr[celli] = curPsi;
} }
} }
// Restore interfaceBouCoeffs_
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -107,28 +107,14 @@ void Foam::symGaussSeidelSmoother::smooth
// To compensate for this, it is necessary to turn the // To compensate for this, it is necessary to turn the
// sign of the contribution. // sign of the contribution.
FieldField<Field, scalar>& mBouCoeffs =
const_cast<FieldField<Field, scalar>&>
(
interfaceBouCoeffs_
);
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
for (label sweep=0; sweep<nSweeps; sweep++) for (label sweep=0; sweep<nSweeps; sweep++)
{ {
bPrime = source; bPrime = source;
matrix_.initMatrixInterfaces matrix_.initMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs_,
interfaces_, interfaces_,
psi, psi,
bPrime, bPrime,
@ -137,7 +123,8 @@ void Foam::symGaussSeidelSmoother::smooth
matrix_.updateMatrixInterfaces matrix_.updateMatrixInterfaces
( (
mBouCoeffs, false,
interfaceBouCoeffs_,
interfaces_, interfaces_,
psi, psi,
bPrime, bPrime,
@ -204,15 +191,6 @@ void Foam::symGaussSeidelSmoother::smooth
psiPtr[celli] = psii; psiPtr[celli] = psii;
} }
} }
// Restore interfaceBouCoeffs_
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.

View File

@ -51,6 +51,7 @@ void Foam::GAMGSolver::interpolate
m.initMatrixInterfaces m.initMatrixInterfaces
( (
true,
interfaceBouCoeffs, interfaceBouCoeffs,
interfaces, interfaces,
psi, psi,
@ -67,6 +68,7 @@ void Foam::GAMGSolver::interpolate
m.updateMatrixInterfaces m.updateMatrixInterfaces
( (
true,
interfaceBouCoeffs, interfaceBouCoeffs,
interfaces, interfaces,
psi, psi,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.

View File

@ -109,6 +109,7 @@ Foam::cyclicGAMGInterfaceField::~cyclicGAMGInterfaceField()
void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,
@ -123,12 +124,7 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
transformCoupleField(pnf, cmpt); transformCoupleField(pnf, cmpt);
const labelUList& faceCells = cyclicInterface_.faceCells(); this->addToInternalField(result, !add, coeffs, pnf);
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
} }

View File

@ -146,6 +146,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,

View File

@ -93,6 +93,7 @@ Foam::processorGAMGInterfaceField::~processorGAMGInterfaceField()
void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
( (
scalarField&, scalarField&,
const bool,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField&, const scalarField&,
const direction, const direction,
@ -148,6 +149,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
void Foam::processorGAMGInterfaceField::updateInterfaceMatrix void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField&, const scalarField&,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,
@ -162,8 +164,6 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
label oldWarn = UPstream::warnComm; label oldWarn = UPstream::warnComm;
UPstream::warnComm = comm(); UPstream::warnComm = comm();
const labelUList& faceCells = procInterface_.faceCells();
if if
( (
commsType == Pstream::commsTypes::nonBlocking commsType == Pstream::commsTypes::nonBlocking
@ -189,10 +189,7 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
transformCoupleField(scalarReceiveBuf_, cmpt); transformCoupleField(scalarReceiveBuf_, cmpt);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
forAll(faceCells, elemI) addToInternalField(result, !add, coeffs, scalarReceiveBuf_);
{
result[faceCells[elemI]] -= coeffs[elemI]*scalarReceiveBuf_[elemI];
}
} }
else else
{ {
@ -202,10 +199,7 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
); );
transformCoupleField(pnf, cmpt); transformCoupleField(pnf, cmpt);
forAll(faceCells, elemI) addToInternalField(result, !add, coeffs, pnf);
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
} }
const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = true; const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = true;

View File

@ -135,6 +135,7 @@ public:
virtual void initInterfaceMatrixUpdate virtual void initInterfaceMatrixUpdate
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,
@ -145,6 +146,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -78,21 +78,6 @@ class lduPrimitiveMesh
//- Get size of all meshes //- Get size of all meshes
static label totalSize(const PtrList<lduPrimitiveMesh>&); static label totalSize(const PtrList<lduPrimitiveMesh>&);
static labelList upperTriOrder
(
const label nCells,
const labelUList& lower,
const labelUList& upper
);
//- Check if in upper-triangular ordering
static void checkUpperTriangular
(
const label size,
const labelUList& l,
const labelUList& u
);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
lduPrimitiveMesh(const lduPrimitiveMesh&); lduPrimitiveMesh(const lduPrimitiveMesh&);
@ -261,6 +246,21 @@ public:
template<class ProcPatch> template<class ProcPatch>
static lduSchedule nonBlockingSchedule(const lduInterfacePtrsList&); static lduSchedule nonBlockingSchedule(const lduInterfacePtrsList&);
//- Calculate upper-triangular order
static labelList upperTriOrder
(
const label nCells,
const labelUList& lower,
const labelUList& upper
);
//- Check if in upper-triangular ordering
static void checkUpperTriangular
(
const label size,
const labelUList& l,
const labelUList& u
);
}; };

View File

@ -311,7 +311,7 @@ Foam::labelList Foam::polyMeshTetDecomposition::findFaceBasePts
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Coupled face base point exchange failure for face " << "Coupled face base point exchange failure for face "
<< fI << fI << " at " << mesh.faceCentres()[fI]
<< abort(FatalError); << abort(FatalError);
} }
@ -552,6 +552,7 @@ Foam::List<Foam::tetIndices> Foam::polyMeshTetDecomposition::faceTetIndices
{ {
WarningInFunction WarningInFunction
<< "No base point for face " << fI << ", " << f << "No base point for face " << fI << ", " << f
<< ", vertices " << UIndirectList<point>(mesh.points(), f)
<< ", produces a valid tet decomposition." << ", produces a valid tet decomposition."
<< endl; << endl;
nWarnings++; nWarnings++;
@ -616,6 +617,7 @@ Foam::tetIndices Foam::polyMeshTetDecomposition::triangleTetIndices
{ {
WarningInFunction WarningInFunction
<< "No base point for face " << fI << ", " << f << "No base point for face " << fI << ", " << f
<< ", vertices " << UIndirectList<point>(mesh.points(), f)
<< ", produces a valid tet decomposition." << ", produces a valid tet decomposition."
<< endl; << endl;
nWarnings++; nWarnings++;

View File

@ -1,219 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
<<<<<<< HEAD
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
=======
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
>>>>>>> d2a62df7c
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
Description
Mixed boundary condition for temperature and radiation heat transfer
to be used for in multiregion cases. Optional thin thermal layer
resistances can be specified through thicknessLayers and kappaLayers
entries.
The thermal conductivity \c kappa can either be retrieved from various
possible sources, as detailed in the class temperatureCoupledBase.
Usage
\table
Property | Description | Required | Default value
Tnbr | name of the field | no | T
qrNbr | name of the radiative flux in the nbr region | no | none
qr | name of the radiative flux in this region | no | none
thicknessLayers | list of thicknesses per layer [m] | no |
kappaLayers | list of thermal conductivites per layer [W/m/K] | no |
kappaMethod | inherited from temperatureCoupledBase | inherited |
kappa | inherited from temperatureCoupledBase | inherited |
thermalInertia | Add thermal inertia to wall node | no | false
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
qrNbr qr; // or none. Name of qr field on neighbour region
qr qr; // or none. Name of qr field on local region
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4);
thermalInertia false/true;
kappaMethod lookup;
kappa kappa;
value uniform 300;
}
\endverbatim
Needs to be on underlying mapped(Wall)FvPatch.
See also
Foam::temperatureCoupledBase
SourceFiles
turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
#define turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class turbulentTemperatureRadCoupledMixedFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class turbulentTemperatureRadCoupledMixedFvPatchScalarField
:
public mixedFvPatchScalarField,
public temperatureCoupledBase
{
// Private data
//- Name of field on the neighbour region
const word TnbrName_;
//- Name of the radiative heat flux in the neighbout region
const word qrNbrName_;
//- Name of the radiative heat flux in local region
const word qrName_;
//- Thickness of layers
scalarList thicknessLayers_;
//- Conductivity of layers
scalarList kappaLayers_;
//- Total contact resistance
scalar contactRes_;
//- Thermal inertia term
Switch thermalInertia_;
public:
//- Runtime type information
TypeName("compressible::turbulentTemperatureRadCoupledMixed");
// Constructors
//- Construct from patch and internal field
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
// new patch
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const
turbulentTemperatureRadCoupledMixedFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
*this
)
);
}
//- Construct as copy setting internal field reference
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const turbulentTemperatureRadCoupledMixedFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -207,6 +207,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction, const direction,
@ -217,6 +218,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
Field<Type>&, Field<Type>&,
const bool add,
const Field<Type>&, const Field<Type>&,
const scalarField&, const scalarField&,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType

View File

@ -173,6 +173,7 @@ template<class Type>
void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,
@ -188,12 +189,7 @@ void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix
transformCoupleField(pnf, cmpt); transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
const labelUList& faceCells = cyclicPatch_.faceCells(); this->addToInternalField(result, !add, coeffs, pnf);
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
} }
@ -201,6 +197,7 @@ template<class Type>
void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix
( (
Field<Type>& result, Field<Type>& result,
const bool add,
const Field<Type>& psiInternal, const Field<Type>& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const Pstream::commsTypes const Pstream::commsTypes
@ -215,12 +212,7 @@ void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix
transformCoupleField(pnf); transformCoupleField(pnf);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
const labelUList& faceCells = cyclicPatch_.faceCells(); this->addToInternalField(result, !add, coeffs, pnf);
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
} }

View File

@ -178,6 +178,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
scalarField& result, scalarField& result,
const bool add,
const scalarField& psiInternal, const scalarField& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,
@ -188,6 +189,7 @@ public:
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (
Field<Type>& result, Field<Type>& result,
const bool add,
const Field<Type>& psiInternal, const Field<Type>& psiInternal,
const scalarField& coeffs, const scalarField& coeffs,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType

Some files were not shown because too many files have changed in this diff Show More