mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "cfmesh"]
|
||||||
|
path = modules/cfmesh
|
||||||
|
url = https://develop.openfoam.com/Community/integration-cfmesh.git
|
||||||
9
Allwmake
9
Allwmake
@ -43,6 +43,15 @@ echo "Compile OpenFOAM applications"
|
|||||||
echo
|
echo
|
||||||
applications/Allwmake $targetType $*
|
applications/Allwmake $targetType $*
|
||||||
|
|
||||||
|
# Additional components/modules
|
||||||
|
if [ -d "$WM_PROJECT_DIR/modules" ]
|
||||||
|
then
|
||||||
|
echo "========================================"
|
||||||
|
echo "Compile OpenFOAM modules"
|
||||||
|
echo
|
||||||
|
(cd $WM_PROJECT_DIR/modules 2>/dev/null && wmake -all)
|
||||||
|
fi
|
||||||
|
|
||||||
# Some summary information
|
# Some summary information
|
||||||
echo
|
echo
|
||||||
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
|
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
|
||||||
|
|||||||
@ -42,7 +42,7 @@ Description
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "thermoPhysicsTypes.H"
|
#include "thermoPhysicsTypes.H"
|
||||||
#include "basicMultiComponentMixture.H"
|
#include "basicMultiComponentMixture.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,7 @@ points[5] = vector(1, 0, 1);
|
|||||||
points[6] = vector(1, 1, 1);
|
points[6] = vector(1, 1, 1);
|
||||||
points[7] = vector(0, 1, 1);
|
points[7] = vector(0, 1, 1);
|
||||||
|
|
||||||
const cellModel& hexa = *(cellModeller::lookup("hex"));
|
faceList faces = cellModel::ref(cellModel::HEX).modelFaces();
|
||||||
faceList faces = hexa.modelFaces();
|
|
||||||
|
|
||||||
fvMesh mesh
|
fvMesh mesh
|
||||||
(
|
(
|
||||||
@ -25,7 +24,7 @@ fvMesh mesh
|
|||||||
runTime,
|
runTime,
|
||||||
IOobject::READ_IF_PRESENT
|
IOobject::READ_IF_PRESENT
|
||||||
),
|
),
|
||||||
xferMove<Field<vector>>(points),
|
xferMove<pointField>(points),
|
||||||
faces.xfer(),
|
faces.xfer(),
|
||||||
owner.xfer(),
|
owner.xfer(),
|
||||||
neighbour.xfer()
|
neighbour.xfer()
|
||||||
|
|||||||
@ -7,8 +7,8 @@ surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
|
|||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU));
|
surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU));
|
||||||
volVectorField HbyA("HbyA", constrainHbyA(rAU*UEqn.H(), U, p));
|
volVectorField HbyA("HbyA", U);
|
||||||
//mesh.interpolate(HbyA);
|
HbyA = constrainHbyA(rAU*UEqn.H(), U, p);
|
||||||
|
|
||||||
if (pimple.nCorrPISO() <= 1)
|
if (pimple.nCorrPISO() <= 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 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.
|
||||||
@ -39,6 +39,7 @@ The available solvers are grouped into the following categories:
|
|||||||
- \ref grpLagrangianSolvers
|
- \ref grpLagrangianSolvers
|
||||||
- \ref grpMultiphaseSolvers
|
- \ref grpMultiphaseSolvers
|
||||||
- \ref grpStressAnalysisSolvers
|
- \ref grpStressAnalysisSolvers
|
||||||
|
- \ref grpFiniteAreaSolvers
|
||||||
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -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) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 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.
|
||||||
@ -34,4 +34,10 @@ License
|
|||||||
This group contains moving mesh solvers solvers
|
This group contains moving mesh solvers solvers
|
||||||
@}
|
@}
|
||||||
|
|
||||||
|
\defgroup grpFiniteAreaSolvers Finite area solvers
|
||||||
|
@{
|
||||||
|
\ingroup grpSolvers
|
||||||
|
This group contains finite area solvers
|
||||||
|
@}
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
3
applications/solvers/finiteArea/liquidFilmFoam/Make/files
Executable file
3
applications/solvers/finiteArea/liquidFilmFoam/Make/files
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
liquidFilmFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/liquidFilmFoam
|
||||||
10
applications/solvers/finiteArea/liquidFilmFoam/Make/options
Executable file
10
applications/solvers/finiteArea/liquidFilmFoam/Make/options
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/cfdTools/general/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteArea \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
// Stabilisation of friction factor calculation
|
||||||
|
// Friction factor is defined with standard gravity
|
||||||
|
frictionFactor.primitiveFieldRef() =
|
||||||
|
mag(2*9.81*sqr(manningField.primitiveField())/
|
||||||
|
pow(mag(h.primitiveField()) + 1e-7, 1.0/3.0));
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
scalar CoNumSigma = max
|
||||||
|
(
|
||||||
|
sqrt
|
||||||
|
(
|
||||||
|
2*M_PI*sigma*sqr(aMesh.edgeInterpolation::deltaCoeffs())
|
||||||
|
*aMesh.edgeInterpolation::deltaCoeffs()
|
||||||
|
/rhol
|
||||||
|
)
|
||||||
|
).value()*runTime.deltaT().value();
|
||||||
|
|
||||||
|
Info<< "Max Capillary Courant Number = " << CoNumSigma << '\n' << endl;
|
||||||
|
}
|
||||||
158
applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H
Normal file
158
applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
Info<< "Reading field h" << endl;
|
||||||
|
areaScalarField h
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"h",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
aMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Reading field Us" << endl;
|
||||||
|
areaVectorField Us
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Us",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
aMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
edgeScalarField phis
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phis",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
fac::interpolate(Us) & aMesh.Le()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
edgeScalarField phi2s
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phi2s",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
fac::interpolate(h*Us) & aMesh.Le()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
const areaVectorField& Ns = aMesh.faceAreaNormals();
|
||||||
|
areaVectorField Gs(g - Ns*(Ns & g));
|
||||||
|
areaScalarField Gn(mag(g - Gs));
|
||||||
|
|
||||||
|
// Mass source
|
||||||
|
areaScalarField Sm
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Sm",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
aMesh,
|
||||||
|
dimensionedScalar("Sm", dimLength/dimTime, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mass sink
|
||||||
|
areaScalarField Sd
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Sd",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
aMesh,
|
||||||
|
dimensionedScalar("Sd", dimLength/dimTime, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
areaVectorField Ug
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Sg",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
aMesh,
|
||||||
|
dimensionedVector("Ug", dimVelocity, vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Surface pressure
|
||||||
|
areaScalarField ps
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"ps",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
rhol*Gn*h - sigma*fac::laplacian(h)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Friction factor
|
||||||
|
areaScalarField dotProduct
|
||||||
|
(
|
||||||
|
aMesh.faceAreaNormals() & (g/mag(g))
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "View factor: min = " << min(dotProduct.internalField())
|
||||||
|
<< " max = " << max(dotProduct.internalField()) << endl;
|
||||||
|
|
||||||
|
areaScalarField manningField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"manningField",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
aMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
areaScalarField frictionFactor
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"frictionFactor",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
aMesh,
|
||||||
|
dimensionedScalar("one", dimless, 0.01)
|
||||||
|
);
|
||||||
|
|
||||||
|
aMesh.setFluxRequired("h");
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedVector("0", dimVelocity, vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
volScalarField H
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"H",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("0", dimLength, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create volume-to surface mapping object
|
||||||
|
volSurfaceMapping vsm(aMesh);
|
||||||
160
applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C
Normal file
160
applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd |
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
| Copyright (C) 2016-2017 Wikki 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
|
||||||
|
liquidFilmFoam
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFiniteAreaSolvers
|
||||||
|
|
||||||
|
Description
|
||||||
|
Transient solver for incompressible, laminar flow of Newtonian fluids in
|
||||||
|
liquid film formulation.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Zeljko Tukovic, FMENA
|
||||||
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
#include "loopControl.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "createFaMesh.H"
|
||||||
|
#include "readGravitationalAcceleration.H"
|
||||||
|
#include "readTransportProperties.H"
|
||||||
|
#include "createFaFields.H"
|
||||||
|
#include "createFvFields.H"
|
||||||
|
#include "createTimeControls.H"
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.run())
|
||||||
|
{
|
||||||
|
#include "readSolutionControls.H"
|
||||||
|
#include "readTimeControls.H"
|
||||||
|
#include "surfaceCourantNo.H"
|
||||||
|
#include "capillaryCourantNo.H"
|
||||||
|
#include "setDeltaT.H"
|
||||||
|
|
||||||
|
runTime++;
|
||||||
|
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
while (iters.loop())
|
||||||
|
{
|
||||||
|
phi2s = fac::interpolate(h)*phis;
|
||||||
|
|
||||||
|
#include "calcFrictionFactor.H"
|
||||||
|
|
||||||
|
faVectorMatrix UsEqn
|
||||||
|
(
|
||||||
|
fam::ddt(h, Us)
|
||||||
|
+ fam::div(phi2s, Us)
|
||||||
|
+ fam::Sp(0.0125*frictionFactor*mag(Us), Us)
|
||||||
|
==
|
||||||
|
Gs*h
|
||||||
|
- fam::Sp(Sd, Us)
|
||||||
|
);
|
||||||
|
|
||||||
|
UsEqn.relax();
|
||||||
|
solve(UsEqn == - fac::grad(ps*h)/rhol + ps*fac::grad(h)/rhol);
|
||||||
|
|
||||||
|
areaScalarField UsA(UsEqn.A());
|
||||||
|
|
||||||
|
Us = UsEqn.H()/UsA;
|
||||||
|
Us.correctBoundaryConditions();
|
||||||
|
|
||||||
|
phis =
|
||||||
|
(fac::interpolate(Us) & aMesh.Le())
|
||||||
|
- fac::interpolate(1.0/(rhol*UsA))*fac::lnGrad(ps*h)*aMesh.magLe()
|
||||||
|
+ fac::interpolate(ps/(rhol*UsA))*fac::lnGrad(h)*aMesh.magLe();
|
||||||
|
|
||||||
|
faScalarMatrix hEqn
|
||||||
|
(
|
||||||
|
fam::ddt(h)
|
||||||
|
+ fam::div(phis, h)
|
||||||
|
==
|
||||||
|
Sm
|
||||||
|
- fam::Sp
|
||||||
|
(
|
||||||
|
Sd/(h + dimensionedScalar("small", dimLength, SMALL)),
|
||||||
|
h
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
hEqn.relax();
|
||||||
|
hEqn.solve();
|
||||||
|
|
||||||
|
phi2s = hEqn.flux();
|
||||||
|
|
||||||
|
// Bound h
|
||||||
|
h.primitiveFieldRef() = max
|
||||||
|
(
|
||||||
|
max
|
||||||
|
(
|
||||||
|
h.primitiveField(),
|
||||||
|
fac::average(max(h, h0))().primitiveField()
|
||||||
|
*pos(h0.value() - h.primitiveField())
|
||||||
|
),
|
||||||
|
h0.value()
|
||||||
|
);
|
||||||
|
|
||||||
|
ps = rhol*Gn*h - sigma*fac::laplacian(h);
|
||||||
|
ps.correctBoundaryConditions();
|
||||||
|
|
||||||
|
Us -= (1.0/(rhol*UsA))*fac::grad(ps*h)
|
||||||
|
- (ps/(rhol*UsA))*fac::grad(h);
|
||||||
|
Us.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runTime.outputTime())
|
||||||
|
{
|
||||||
|
vsm.mapToVolume(h, H.boundaryFieldRef());
|
||||||
|
vsm.mapToVolume(Us, U.boundaryFieldRef());
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1 @@
|
|||||||
|
loopControl iters(runTime, aMesh.solutionDict(), "solution");
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar mug
|
||||||
|
(
|
||||||
|
transportProperties.lookup("mug")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar mul
|
||||||
|
(
|
||||||
|
transportProperties.lookup("mul")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar sigma
|
||||||
|
(
|
||||||
|
transportProperties.lookup("sigma")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar rhol
|
||||||
|
(
|
||||||
|
transportProperties.lookup("rhol")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar rhog
|
||||||
|
(
|
||||||
|
transportProperties.lookup("rhog")
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar h0
|
||||||
|
(
|
||||||
|
transportProperties.lookup("h0")
|
||||||
|
);
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd |
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
| Copyright (C) 2016-2017 Wikki 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
|
||||||
|
surfaceCourantNo
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Calculates and outputs the mean and maximum Courant Numbers for the
|
||||||
|
Finite Area method.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
scalar CoNum = 0.0;
|
||||||
|
scalar meanCoNum = 0.0;
|
||||||
|
scalar velMag = 0.0;
|
||||||
|
|
||||||
|
if (aMesh.nInternalEdges())
|
||||||
|
{
|
||||||
|
edgeScalarField SfUfbyDelta
|
||||||
|
(
|
||||||
|
aMesh.edgeInterpolation::deltaCoeffs()*mag(phis)
|
||||||
|
);
|
||||||
|
|
||||||
|
CoNum = max(SfUfbyDelta/aMesh.magLe())
|
||||||
|
.value()*runTime.deltaT().value();
|
||||||
|
|
||||||
|
meanCoNum = (sum(SfUfbyDelta)/sum(aMesh.magLe()))
|
||||||
|
.value()*runTime.deltaT().value();
|
||||||
|
|
||||||
|
velMag = max(mag(phis)/aMesh.magLe()).value();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Courant Number mean: " << meanCoNum
|
||||||
|
<< " max: " << CoNum
|
||||||
|
<< " velocity magnitude: " << velMag << endl;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
surfactantFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/sphereSurfactantFoam
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/cfdTools/general/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteArea \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
Info<< "Reading field Cs" << endl;
|
||||||
|
areaScalarField Cs
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Cs",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
aMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensioned<scalar> Cs0
|
||||||
|
(
|
||||||
|
"Cs0",
|
||||||
|
dimensionSet(1, -2, 0, 0, 0, 0, 0),
|
||||||
|
1.0
|
||||||
|
);
|
||||||
|
|
||||||
|
const areaVectorField& R = aMesh.areaCentres();
|
||||||
|
|
||||||
|
Cs = Cs0*(1.0 + R.component(vector::X)/mag(R));
|
||||||
|
|
||||||
|
|
||||||
|
dimensioned<scalar> Ds
|
||||||
|
(
|
||||||
|
"Ds",
|
||||||
|
dimensionSet(0, 2, -1, 0, 0, 0, 0),
|
||||||
|
1.0
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
areaVectorField Us
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Us",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
aMesh,
|
||||||
|
dimensioned<vector>("Us", dimVelocity, vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensioned<scalar> Uinf("Uinf", dimVelocity, 1.0);
|
||||||
|
|
||||||
|
forAll (Us, faceI)
|
||||||
|
{
|
||||||
|
Us[faceI].x() =
|
||||||
|
Uinf.value()*(0.25*(3.0 + sqr(R[faceI].x()/mag(R[faceI]))) - 1.0);
|
||||||
|
|
||||||
|
Us[faceI].y() =
|
||||||
|
Uinf.value()*0.25*R[faceI].x()*R[faceI].y()/sqr(mag(R[faceI]));
|
||||||
|
|
||||||
|
Us[faceI].z() =
|
||||||
|
Uinf.value()*0.25*R[faceI].x()*R[faceI].z()/sqr(mag(R[faceI]));
|
||||||
|
}
|
||||||
|
|
||||||
|
Us -= aMesh.faceAreaNormals()*(aMesh.faceAreaNormals() & Us);
|
||||||
|
|
||||||
|
|
||||||
|
edgeScalarField phis
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phis",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
linearEdgeInterpolate(Us) & aMesh.Le()
|
||||||
|
);
|
||||||
|
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
// Create Finite Area mesh
|
||||||
|
faMesh aMesh(mesh);
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
// Create volume-to surface mapping object
|
||||||
|
volSurfaceMapping vsm(aMesh);
|
||||||
|
|
||||||
|
volScalarField Cvf
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Cvf",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("0", dimless/dimLength, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
|
||||||
|
Cvf.write();
|
||||||
|
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedVector("zero", dimVelocity, vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
vsm.mapToVolume(Us, U.boundaryFieldRef());
|
||||||
|
U.write();
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd |
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
| Copyright (C) 2016-2017 Wikki 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
|
||||||
|
surfactantFoam for sphere transport
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFiniteAreaSolvers
|
||||||
|
|
||||||
|
Description
|
||||||
|
Passive scalar transport equation solver on a sphere
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
#include "createFaMesh.H"
|
||||||
|
#include "createFaFields.H"
|
||||||
|
#include "createVolFields.H"
|
||||||
|
|
||||||
|
Info<< "Total mass of surfactant: "
|
||||||
|
<< sum(Cs.internalField()*aMesh.S()) << endl;
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.loop())
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.value() << endl;
|
||||||
|
|
||||||
|
faScalarMatrix CsEqn
|
||||||
|
(
|
||||||
|
fam::ddt(Cs)
|
||||||
|
+ fam::div(phis, Cs)
|
||||||
|
- fam::laplacian(Ds, Cs)
|
||||||
|
);
|
||||||
|
|
||||||
|
CsEqn.solve();
|
||||||
|
|
||||||
|
if (runTime.writeTime())
|
||||||
|
{
|
||||||
|
vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Total mass of surfactant: "
|
||||||
|
<< sum(Cs.internalField()*aMesh.S()) << endl;
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
surfactantFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/surfactantFoam
|
||||||
10
applications/solvers/finiteArea/surfactantFoam/Make/options
Normal file
10
applications/solvers/finiteArea/surfactantFoam/Make/options
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/cfdTools/general/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteArea \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
Info<< "Reading field Cs" << endl;
|
||||||
|
areaScalarField Cs
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Cs",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
aMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
|
|
||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Reading diffusivity D\n" << endl;
|
||||||
|
|
||||||
|
dimensionedScalar Ds
|
||||||
|
(
|
||||||
|
transportProperties.lookup("Ds")
|
||||||
|
);
|
||||||
|
|
||||||
|
areaVectorField Us
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Us",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
aMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
edgeScalarField phis
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phis",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
linearEdgeInterpolate(Us) & aMesh.Le()
|
||||||
|
);
|
||||||
|
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
// Create Finite Area mesh
|
||||||
|
faMesh aMesh(mesh);
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
// Create volume-to surface mapping object
|
||||||
|
volSurfaceMapping vsm(aMesh);
|
||||||
|
|
||||||
|
volScalarField Cvf
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Cvf",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("0", dimless/dimLength, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
|
||||||
|
Cvf.write();
|
||||||
|
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedVector("zero", dimVelocity, vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
vsm.mapToVolume(Us, U.boundaryFieldRef());
|
||||||
|
U.write();
|
||||||
114
applications/solvers/finiteArea/surfactantFoam/surfactantFoam.C
Normal file
114
applications/solvers/finiteArea/surfactantFoam/surfactantFoam.C
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd |
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
| Copyright (C) 2016-2017 Wikki 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
|
||||||
|
surfactantFoam
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFiniteAreaSolvers
|
||||||
|
|
||||||
|
Description
|
||||||
|
Passive scalar transport equation solver.
|
||||||
|
|
||||||
|
\heading Solver details
|
||||||
|
The equation is given by:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\ddt{Cs} + \div \left(\vec{U} Cs\right) - \div \left(D_T \grad Cs \right)
|
||||||
|
= 0
|
||||||
|
\f]
|
||||||
|
|
||||||
|
Where:
|
||||||
|
\vartable
|
||||||
|
Cs | Passive scalar
|
||||||
|
Ds | Diffusion coefficient
|
||||||
|
\endvartable
|
||||||
|
|
||||||
|
\heading Required fields
|
||||||
|
\plaintable
|
||||||
|
Cs | Passive scalar
|
||||||
|
Us | Velocity [m/s]
|
||||||
|
\endplaintable
|
||||||
|
|
||||||
|
Author
|
||||||
|
Zeljko Tukovic, FMENA
|
||||||
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "createFaMesh.H"
|
||||||
|
#include "createFaFields.H"
|
||||||
|
#include "createVolFields.H"
|
||||||
|
|
||||||
|
Info<< "Total mass of surfactant: "
|
||||||
|
<< sum(Cs.internalField()*aMesh.S()) << endl;
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.loop())
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.value() << endl;
|
||||||
|
|
||||||
|
faScalarMatrix CsEqn
|
||||||
|
(
|
||||||
|
fam::ddt(Cs)
|
||||||
|
+ fam::div(phis, Cs)
|
||||||
|
- fam::laplacian(Ds, Cs)
|
||||||
|
);
|
||||||
|
|
||||||
|
CsEqn.solve();
|
||||||
|
|
||||||
|
if (runTime.writeTime())
|
||||||
|
{
|
||||||
|
vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Total mass of surfactant: "
|
||||||
|
<< sum(Cs.internalField()*aMesh.S()) << endl;
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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.
|
||||||
@ -47,6 +47,7 @@ Description
|
|||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
#include "fvOptions.H"
|
#include "fvOptions.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
|
#include "loopControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -89,11 +90,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- PIMPLE loop
|
// --- PIMPLE loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for (int oCorr=0; oCorr<nOuterCorr; ++oCorr)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
const bool finalIter = (oCorr == nOuterCorr-1);
|
||||||
|
|
||||||
forAll(fluidRegions, i)
|
forAll(fluidRegions, i)
|
||||||
{
|
{
|
||||||
@ -113,6 +113,35 @@ int main(int argc, char *argv[])
|
|||||||
#include "solveSolid.H"
|
#include "solveSolid.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Additional loops for energy solution only
|
||||||
|
if (!oCorr && nOuterCorr > 1)
|
||||||
|
{
|
||||||
|
loopControl looping(runTime, pimple, "energyCoupling");
|
||||||
|
|
||||||
|
while (looping.loop())
|
||||||
|
{
|
||||||
|
Info<< nl << looping << nl;
|
||||||
|
|
||||||
|
forAll(fluidRegions, i)
|
||||||
|
{
|
||||||
|
Info<< "\nSolving for fluid region "
|
||||||
|
<< fluidRegions[i].name() << endl;
|
||||||
|
#include "setRegionFluidFields.H"
|
||||||
|
#include "readFluidMultiRegionPIMPLEControls.H"
|
||||||
|
frozenFlow = true;
|
||||||
|
#include "solveFluid.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(solidRegions, i)
|
||||||
|
{
|
||||||
|
Info<< "\nSolving for solid region "
|
||||||
|
<< solidRegions[i].name() << endl;
|
||||||
|
#include "setRegionSolidFields.H"
|
||||||
|
#include "readSolidMultiRegionPIMPLEControls.H"
|
||||||
|
#include "solveSolid.H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -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.
|
||||||
@ -42,6 +42,7 @@ Description
|
|||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
#include "fvOptions.H"
|
#include "fvOptions.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
|
#include "loopControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,7 +58,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
|
||||||
while (runTime.loop())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
@ -80,6 +80,35 @@ int main(int argc, char *argv[])
|
|||||||
#include "solveSolid.H"
|
#include "solveSolid.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Additional loops for energy solution only
|
||||||
|
{
|
||||||
|
loopControl looping(runTime, "SIMPLE", "energyCoupling");
|
||||||
|
|
||||||
|
while (looping.loop())
|
||||||
|
{
|
||||||
|
Info<< nl << looping << nl;
|
||||||
|
|
||||||
|
forAll(fluidRegions, i)
|
||||||
|
{
|
||||||
|
Info<< "\nSolving for fluid region "
|
||||||
|
<< fluidRegions[i].name() << endl;
|
||||||
|
#include "setRegionFluidFields.H"
|
||||||
|
#include "readFluidMultiRegionSIMPLEControls.H"
|
||||||
|
frozenFlow = true;
|
||||||
|
#include "solveFluid.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(solidRegions, i)
|
||||||
|
{
|
||||||
|
Info<< "\nSolving for solid region "
|
||||||
|
<< solidRegions[i].name() << endl;
|
||||||
|
#include "setRegionSolidFields.H"
|
||||||
|
#include "readSolidMultiRegionSIMPLEControls.H"
|
||||||
|
#include "solveSolid.H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
fvOptions.constrain(UEqn);
|
fvOptions.constrain(UEqn);
|
||||||
|
|
||||||
|
if (momentumPredictor)
|
||||||
|
{
|
||||||
solve
|
solve
|
||||||
(
|
(
|
||||||
UEqn
|
UEqn
|
||||||
@ -30,3 +32,4 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
|
}
|
||||||
|
|||||||
@ -2,3 +2,6 @@
|
|||||||
|
|
||||||
const int nNonOrthCorr =
|
const int nNonOrthCorr =
|
||||||
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||||
|
|
||||||
|
const bool momentumPredictor =
|
||||||
|
simple.lookupOrDefault("momentumPredictor", true);
|
||||||
|
|||||||
@ -12,6 +12,14 @@
|
|||||||
volScalarField& p = thermo.p();
|
volScalarField& p = thermo.p();
|
||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
|
|
||||||
|
volScalarField& p_rgh = p_rghFluid[i];
|
||||||
|
|
||||||
|
const dimensionedVector& g = gFluid[i];
|
||||||
|
const volScalarField& gh = ghFluid[i];
|
||||||
|
const surfaceScalarField& ghf = ghfFluid[i];
|
||||||
|
|
||||||
|
radiation::radiationModel& rad = radiation[i];
|
||||||
|
|
||||||
IOMRFZoneList& MRF = MRFfluid[i];
|
IOMRFZoneList& MRF = MRFfluid[i];
|
||||||
fv::options& fvOptions = fluidFvOptions[i];
|
fv::options& fvOptions = fluidFvOptions[i];
|
||||||
|
|
||||||
@ -22,14 +30,7 @@
|
|||||||
initialMassFluid[i]
|
initialMassFluid[i]
|
||||||
);
|
);
|
||||||
|
|
||||||
radiation::radiationModel& rad = radiation[i];
|
bool frozenFlow = frozenFlowFluid[i];
|
||||||
|
|
||||||
const label pRefCell = pRefCellFluid[i];
|
const label pRefCell = pRefCellFluid[i];
|
||||||
const scalar pRefValue = pRefValueFluid[i];
|
const scalar pRefValue = pRefValueFluid[i];
|
||||||
const bool frozenFlow = frozenFlowFluid[i];
|
|
||||||
|
|
||||||
volScalarField& p_rgh = p_rghFluid[i];
|
|
||||||
|
|
||||||
const dimensionedVector& g = gFluid[i];
|
|
||||||
const volScalarField& gh = ghFluid[i];
|
|
||||||
const surfaceScalarField& ghf = ghfFluid[i];
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth)
|
||||||
{
|
{
|
||||||
fvScalarMatrix hEqn
|
fvScalarMatrix hEqn
|
||||||
(
|
(
|
||||||
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
fvOptions.correct(h);
|
fvOptions.correct(h);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
|
|
||||||
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
||||||
<< max(thermo.T()).value() << endl;
|
<< max(thermo.T()).value() << endl;
|
||||||
|
}
|
||||||
|
|||||||
@ -19,8 +19,8 @@ List<bool> frozenFlowFluid(fluidRegions.size(), false);
|
|||||||
PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size());
|
PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size());
|
||||||
PtrList<fv::options> fluidFvOptions(fluidRegions.size());
|
PtrList<fv::options> fluidFvOptions(fluidRegions.size());
|
||||||
|
|
||||||
List<label> refCellFluid(fluidRegions.size());
|
List<label> pRefCellFluid(fluidRegions.size());
|
||||||
List<scalar> refValueFluid(fluidRegions.size());
|
List<scalar> pRefValueFluid(fluidRegions.size());
|
||||||
|
|
||||||
// Populate fluid field pointer lists
|
// Populate fluid field pointer lists
|
||||||
forAll(fluidRegions, i)
|
forAll(fluidRegions, i)
|
||||||
@ -252,8 +252,8 @@ forAll(fluidRegions, i)
|
|||||||
|
|
||||||
turbulence[i].validate();
|
turbulence[i].validate();
|
||||||
|
|
||||||
refCellFluid[i] = 0;
|
pRefCellFluid[i] = 0;
|
||||||
refValueFluid[i] = 0.0;
|
pRefValueFluid[i] = 0.0;
|
||||||
|
|
||||||
if (p_rghFluid[i].needReference())
|
if (p_rghFluid[i].needReference())
|
||||||
{
|
{
|
||||||
@ -262,8 +262,8 @@ forAll(fluidRegions, i)
|
|||||||
thermoFluid[i].p(),
|
thermoFluid[i].p(),
|
||||||
p_rghFluid[i],
|
p_rghFluid[i],
|
||||||
pimpleDict,
|
pimpleDict,
|
||||||
refCellFluid[i],
|
pRefCellFluid[i],
|
||||||
refValueFluid[i]
|
pRefValueFluid[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,8 @@
|
|||||||
initialMassFluid[i]
|
initialMassFluid[i]
|
||||||
);
|
);
|
||||||
|
|
||||||
const bool frozenFlow = frozenFlowFluid[i];
|
bool frozenFlow = frozenFlowFluid[i];
|
||||||
|
|
||||||
|
const label pRefCell = pRefCellFluid[i];
|
||||||
|
const scalar pRefValue = pRefValueFluid[i];
|
||||||
|
|
||||||
const label pRefCell = refCellFluid[i];
|
|
||||||
const scalar pRefValue = refValueFluid[i];
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
const wordList solidsNames(rp["solid"]);
|
const wordList solidNames(rp["solid"]);
|
||||||
|
|
||||||
PtrList<fvMesh> solidRegions(solidsNames.size());
|
PtrList<fvMesh> solidRegions(solidNames.size());
|
||||||
|
|
||||||
forAll(solidsNames, i)
|
forAll(solidNames, i)
|
||||||
{
|
{
|
||||||
Info<< "Create solid mesh for region " << solidsNames[i]
|
Info<< "Create solid mesh for region " << solidNames[i]
|
||||||
<< " for time = " << runTime.timeName() << nl << endl;
|
<< " for time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
solidRegions.set
|
solidRegions.set
|
||||||
@ -14,7 +14,7 @@
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
solidsNames[i],
|
solidNames[i],
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
|
|||||||
@ -4,7 +4,7 @@ if (finalIter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth)
|
||||||
{
|
{
|
||||||
fvScalarMatrix hEqn
|
fvScalarMatrix hEqn
|
||||||
(
|
(
|
||||||
@ -26,12 +26,12 @@ if (finalIter)
|
|||||||
|
|
||||||
fvOptions.correct(h);
|
fvOptions.correct(h);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
|
|
||||||
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
||||||
<< max(thermo.T()).value() << endl;
|
<< max(thermo.T()).value() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
fvOptions.constrain(UEqn);
|
fvOptions.constrain(UEqn);
|
||||||
|
|
||||||
|
if (simple.momentumPredictor())
|
||||||
|
{
|
||||||
solve(UEqn == -cellMask*fvc::grad(p));
|
solve(UEqn == -cellMask*fvc::grad(p));
|
||||||
|
}
|
||||||
|
|
||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
|
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = constrainHbyA(rAU*UEqn.H(), U, p);
|
HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p);
|
||||||
|
|
||||||
//mesh.interpolate(HbyA);
|
//mesh.interpolate(HbyA);
|
||||||
if (massFluxInterpolation)
|
if (massFluxInterpolation)
|
||||||
|
|||||||
@ -29,8 +29,10 @@ volVectorField U
|
|||||||
#include "createPhi.H"
|
#include "createPhi.H"
|
||||||
|
|
||||||
// Creating e based thermo
|
// Creating e based thermo
|
||||||
autoPtr<twoPhaseMixtureEThermo> thermo;
|
autoPtr<twoPhaseMixtureEThermo> thermo
|
||||||
thermo.set(new twoPhaseMixtureEThermo(U, phi));
|
(
|
||||||
|
new twoPhaseMixtureEThermo(U, phi)
|
||||||
|
);
|
||||||
|
|
||||||
// Create mixture and
|
// Create mixture and
|
||||||
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;
|
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
|
|
||||||
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
|
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", false);
|
||||||
|
|
||||||
checkMeshCourantNo =
|
checkMeshCourantNo =
|
||||||
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
|
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::ThermoPhaseModel
|
|||||||
{
|
{
|
||||||
if (createThermo)
|
if (createThermo)
|
||||||
{
|
{
|
||||||
thermoPtr_.set
|
thermoPtr_.reset
|
||||||
(
|
(
|
||||||
ThermoType::New(fluid.mesh(), this->name()).ptr()
|
ThermoType::New(fluid.mesh(), this->name()).ptr()
|
||||||
);
|
);
|
||||||
|
|||||||
@ -76,7 +76,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
|
|||||||
{
|
{
|
||||||
if (modelTable.found(pair_))
|
if (modelTable.found(pair_))
|
||||||
{
|
{
|
||||||
model_.set
|
model_.reset
|
||||||
(
|
(
|
||||||
modelType::New
|
modelType::New
|
||||||
(
|
(
|
||||||
@ -88,7 +88,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
|
|||||||
|
|
||||||
if (modelTable.found(pair1In2_))
|
if (modelTable.found(pair1In2_))
|
||||||
{
|
{
|
||||||
model1In2_.set
|
model1In2_.reset
|
||||||
(
|
(
|
||||||
modelType::New
|
modelType::New
|
||||||
(
|
(
|
||||||
@ -100,7 +100,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
|
|||||||
|
|
||||||
if (modelTable.found(pair2In1_))
|
if (modelTable.found(pair2In1_))
|
||||||
{
|
{
|
||||||
model2In1_.set
|
model2In1_.reset
|
||||||
(
|
(
|
||||||
modelType::New
|
modelType::New
|
||||||
(
|
(
|
||||||
|
|||||||
@ -41,7 +41,7 @@ Foam::orderedPhasePair::orderedPhasePair
|
|||||||
{
|
{
|
||||||
if (aspectRatioTable.found(*this))
|
if (aspectRatioTable.found(*this))
|
||||||
{
|
{
|
||||||
aspectRatio_.set
|
aspectRatio_.reset
|
||||||
(
|
(
|
||||||
aspectRatioModel::New
|
aspectRatioModel::New
|
||||||
(
|
(
|
||||||
|
|||||||
@ -132,7 +132,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
phasePair::scalarTable sigmaTable(lookup("sigma"));
|
phasePair::scalarTable sigmaTable(lookup("sigma"));
|
||||||
phasePair::dictTable aspectRatioTable(lookup("aspectRatio"));
|
phasePair::dictTable aspectRatioTable(lookup("aspectRatio"));
|
||||||
|
|
||||||
pair_.set
|
pair_.reset
|
||||||
(
|
(
|
||||||
new phasePair
|
new phasePair
|
||||||
(
|
(
|
||||||
@ -143,7 +143,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
pair1In2_.set
|
pair1In2_.reset
|
||||||
(
|
(
|
||||||
new orderedPhasePair
|
new orderedPhasePair
|
||||||
(
|
(
|
||||||
@ -155,7 +155,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
pair2In1_.set
|
pair2In1_.reset
|
||||||
(
|
(
|
||||||
new orderedPhasePair
|
new orderedPhasePair
|
||||||
(
|
(
|
||||||
@ -170,7 +170,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
|
|
||||||
// Models
|
// Models
|
||||||
|
|
||||||
drag_.set
|
drag_.reset
|
||||||
(
|
(
|
||||||
new BlendedInterfacialModel<dragModel>
|
new BlendedInterfacialModel<dragModel>
|
||||||
(
|
(
|
||||||
@ -187,7 +187,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
virtualMass_.set
|
virtualMass_.reset
|
||||||
(
|
(
|
||||||
new BlendedInterfacialModel<virtualMassModel>
|
new BlendedInterfacialModel<virtualMassModel>
|
||||||
(
|
(
|
||||||
@ -203,7 +203,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
heatTransfer_.set
|
heatTransfer_.reset
|
||||||
(
|
(
|
||||||
new BlendedInterfacialModel<heatTransferModel>
|
new BlendedInterfacialModel<heatTransferModel>
|
||||||
(
|
(
|
||||||
@ -219,7 +219,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
lift_.set
|
lift_.reset
|
||||||
(
|
(
|
||||||
new BlendedInterfacialModel<liftModel>
|
new BlendedInterfacialModel<liftModel>
|
||||||
(
|
(
|
||||||
@ -235,7 +235,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
wallLubrication_.set
|
wallLubrication_.reset
|
||||||
(
|
(
|
||||||
new BlendedInterfacialModel<wallLubricationModel>
|
new BlendedInterfacialModel<wallLubricationModel>
|
||||||
(
|
(
|
||||||
@ -251,7 +251,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
turbulentDispersion_.set
|
turbulentDispersion_.reset
|
||||||
(
|
(
|
||||||
new BlendedInterfacialModel<turbulentDispersionModel>
|
new BlendedInterfacialModel<turbulentDispersionModel>
|
||||||
(
|
(
|
||||||
|
|||||||
@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("ODESolver");
|
argList::addArgument("ODESolver");
|
||||||
argList args(argc, argv);
|
argList args(argc, argv);
|
||||||
|
|
||||||
// Create the ODE system
|
// Create the ODE system
|
||||||
|
|||||||
@ -82,7 +82,7 @@ inline void reportInfo()
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("file .. fileN");
|
argList::addArgument("file .. fileN");
|
||||||
|
|
||||||
argList::addBoolOption("mask", "report information about the bit masks");
|
argList::addBoolOption("mask", "report information about the bit masks");
|
||||||
argList::addBoolOption("count", "test the count() method");
|
argList::addBoolOption("count", "test the count() method");
|
||||||
|
|||||||
@ -40,7 +40,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("patch");
|
argList::addArgument("patch");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -201,7 +201,7 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addTimeOptions.H"
|
#include "addTimeOptions.H"
|
||||||
argList::validArgs.append("patch");
|
argList::addArgument("patch");
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("(patches)");
|
argList::addArgument("(patches)");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -38,12 +38,24 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noBanner();
|
argList::noBanner();
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::noFunctionObjects();
|
// argList::noFunctionObjects();
|
||||||
argList::removeOption("case");
|
argList::removeOption("case");
|
||||||
|
|
||||||
argList::addOption("label", "value", "Test parsing of label");
|
argList::addOption("label", "value", "Test parsing of label");
|
||||||
argList::addOption("scalar", "value", "Test parsing of scalar");
|
argList::addOption("scalar", "value", "Test parsing of scalar");
|
||||||
|
|
||||||
|
// These are actually lies (never had -parseLabel, -parseScalar etc),
|
||||||
|
// but good for testing...
|
||||||
|
|
||||||
|
// Emits warning about it being old
|
||||||
|
argList::addOptionCompat("label", {"parseLabel", 1612});
|
||||||
|
|
||||||
|
// Specifying version=0 to use alias without any warnings
|
||||||
|
argList::addOptionCompat("scalar", {"parseScalar", 0});
|
||||||
|
|
||||||
|
// Fake a future option...
|
||||||
|
argList::addOptionCompat("label", {"parse-label", 2112});
|
||||||
|
|
||||||
argList args(argc, argv);
|
argList args(argc, argv);
|
||||||
|
|
||||||
label ival;
|
label ival;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ Description
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModel.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -52,15 +52,11 @@ boundBox cube(scalar start, scalar width)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
// #include "createTime.H"
|
|
||||||
// #include "createMesh.H"
|
|
||||||
|
|
||||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
Info<<"boundBox faces: " << boundBox::faces << nl
|
||||||
|
<<"hex faces: " << cellModel::ref(cellModel::HEX).modelFaces() << nl
|
||||||
Info<<"boundBox faces: " << boundBox::faces << endl;
|
<<"tree-bb faces: " << treeBoundBox::faces << nl
|
||||||
Info<<"hex faces: " << hex.modelFaces() << endl;
|
<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
||||||
Info<<"tree-bb faces: " << treeBoundBox::faces << endl;
|
|
||||||
Info<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
|
||||||
|
|
||||||
boundBox bb = boundBox::greatBox;
|
boundBox bb = boundBox::greatBox;
|
||||||
Info<<"great box: " << bb << endl;
|
Info<<"great box: " << bb << endl;
|
||||||
|
|||||||
3
applications/test/cellModels/Make/files
Normal file
3
applications/test/cellModels/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-cellModels.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-cellModels
|
||||||
0
applications/test/cellModels/Make/options
Normal file
0
applications/test/cellModels/Make/options
Normal file
97
applications/test/cellModels/Test-cellModels.C
Normal file
97
applications/test/cellModels/Test-cellModels.C
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Test-cellModels
|
||||||
|
|
||||||
|
Description
|
||||||
|
Print information about known cellModels
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cellModel.H"
|
||||||
|
#include "cellModeller.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
void printInfo(const cellModel* mdl)
|
||||||
|
{
|
||||||
|
if (mdl)
|
||||||
|
{
|
||||||
|
Info<< *mdl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "nullptr" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void printInfo(const cellModel::modelType type)
|
||||||
|
{
|
||||||
|
Info<< cellModel::modelNames[type] << " = ";
|
||||||
|
printInfo(cellModel::ptr(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
Info<<"lookup by enum" << nl
|
||||||
|
<<"=========================" << endl;
|
||||||
|
|
||||||
|
printInfo(cellModel::UNKNOWN);
|
||||||
|
printInfo(cellModel::HEX);
|
||||||
|
printInfo(cellModel::WEDGE);
|
||||||
|
printInfo(cellModel::PRISM);
|
||||||
|
printInfo(cellModel::PYR);
|
||||||
|
printInfo(cellModel::TET);
|
||||||
|
printInfo(cellModel::SPLITHEX);
|
||||||
|
printInfo(cellModel::TETWEDGE);
|
||||||
|
|
||||||
|
|
||||||
|
Info<<"lookup by name" << nl
|
||||||
|
<<"=========================" << endl;
|
||||||
|
|
||||||
|
printInfo(cellModel::ptr("tet"));
|
||||||
|
|
||||||
|
Info<<"lookup by index" << nl
|
||||||
|
<<"=========================" << endl;
|
||||||
|
|
||||||
|
printInfo(cellModel::ptr(7));
|
||||||
|
|
||||||
|
// Compatibility mode
|
||||||
|
Info<<"cellModeller::lookup (compatibility)" << nl
|
||||||
|
<<"=========================" << endl;
|
||||||
|
|
||||||
|
printInfo(cellModeller::lookup("tet"));
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
|||||||
"more information about decomposition"
|
"more information about decomposition"
|
||||||
);
|
);
|
||||||
|
|
||||||
argList::validArgs.append("kaffpa-output-file");
|
argList::addArgument("kaffpa-output-file");
|
||||||
|
|
||||||
// Include explicit constant options, have zero from time range
|
// Include explicit constant options, have zero from time range
|
||||||
timeSelector::addOptions(true, false);
|
timeSelector::addOptions(true, false);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("dict .. dictN");
|
argList::addArgument("dict .. dictN");
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
|
|||||||
@ -2,7 +2,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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,8 +30,10 @@ Description
|
|||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "fileNameList.H"
|
#include "fileNameList.H"
|
||||||
|
#include "stringOps.H"
|
||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
#include "wordList.H"
|
#include "wordList.H"
|
||||||
|
#include "SubStrings.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -53,6 +55,26 @@ int print(const CStringList& cstrLst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Using nullptr termination
|
||||||
|
int print(char *argv[])
|
||||||
|
{
|
||||||
|
if (!argv)
|
||||||
|
{
|
||||||
|
Info<< "argv=null" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
while (argv[i])
|
||||||
|
{
|
||||||
|
Info<< " argv[" << i << "] = \"" << argv[i] << "\"" << endl;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -62,18 +84,49 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
dynlst.append("string1 with content");
|
dynlst.append("string1 with content");
|
||||||
dynlst.append("string2 other content");
|
dynlst.append("string2 other content");
|
||||||
dynlst.append("string3 done");
|
dynlst.append("string3 more");
|
||||||
|
dynlst.append("string4 done");
|
||||||
|
|
||||||
{
|
{
|
||||||
CStringList inC(dynlst);
|
CStringList inC(dynlst);
|
||||||
|
|
||||||
Info<< "input: " << dynlst << endl;
|
Info<< "input: " << dynlst << nl;
|
||||||
print(inC);
|
print(inC);
|
||||||
|
|
||||||
|
Info<< "null-terminated string list" << nl;
|
||||||
|
print(inC.strings());
|
||||||
|
|
||||||
|
Info<< "sublist: starting at " << inC.size()/2 << nl;
|
||||||
|
print(inC.strings(inC.size()/2));
|
||||||
|
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
string testInput
|
||||||
|
(
|
||||||
|
" A test input line with various spacing "
|
||||||
|
" and text to be split on whitespace "
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< testInput << nl;
|
||||||
|
SubStrings<string> args = stringOps::splitSpace(testInput);
|
||||||
|
Info<< "split into " << args.size() << " args" << nl;
|
||||||
|
|
||||||
|
CStringList inC(args);
|
||||||
|
print(inC);
|
||||||
|
|
||||||
|
Info<< "sublist: starting at " << inC.size()/2 << nl;
|
||||||
|
print(inC.strings(inC.size()/2));
|
||||||
|
|
||||||
|
Info<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<<"command-line with " << CStringList::count(argv) << " items"<< endl;
|
Info<<"command-line with " << CStringList::count(argv) << " items"<< endl;
|
||||||
|
|
||||||
print(argc, argv);
|
print(argc, argv);
|
||||||
|
|
||||||
|
Info<< nl;
|
||||||
{
|
{
|
||||||
dynlst.clear();
|
dynlst.clear();
|
||||||
for (int i=0; i<argc; ++i)
|
for (int i=0; i<argc; ++i)
|
||||||
|
|||||||
@ -41,7 +41,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("file");
|
argList::addArgument("file");
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
if (!Pstream::parRun())
|
if (!Pstream::parRun())
|
||||||
|
|||||||
@ -43,7 +43,7 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("dict .. dictN");
|
argList::addArgument("dict .. dictN");
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
argList::addBoolOption("info", "report token info");
|
argList::addBoolOption("info", "report token info");
|
||||||
argList::addBoolOption("value", "report token value");
|
argList::addBoolOption("value", "report token value");
|
||||||
|
|
||||||
argList::validArgs.insert("dict .. dictN");
|
argList::addArgument("dict .. dictN");
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|
||||||
const bool optInfo = args.optionFound("info");
|
const bool optInfo = args.optionFound("info");
|
||||||
|
|||||||
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noBanner();
|
argList::noBanner();
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("fileName .. fileNameN");
|
argList::addArgument("fileName .. fileNameN");
|
||||||
|
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
|||||||
"list",
|
"list",
|
||||||
"List directories or files to be checked"
|
"List directories or files to be checked"
|
||||||
);
|
);
|
||||||
argList::validArgs.insert("file...");
|
argList::addArgument("file...");
|
||||||
|
|
||||||
argList::addNote
|
argList::addNote
|
||||||
(
|
(
|
||||||
|
|||||||
@ -57,7 +57,7 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addTimeOptions.H"
|
#include "addTimeOptions.H"
|
||||||
argList::validArgs.append("inflate (true|false)");
|
argList::addArgument("inflate (true|false)");
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|||||||
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noBanner();
|
argList::noBanner();
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("fileName .. fileNameN");
|
argList::addArgument("fileName .. fileNameN");
|
||||||
argList::addOption("istream", "file", "test Istream values");
|
argList::addOption("istream", "file", "test Istream values");
|
||||||
|
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("point (x y z)");
|
argList::addArgument("point (x y z)");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -58,7 +58,7 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addTimeOptions.H"
|
#include "addTimeOptions.H"
|
||||||
argList::validArgs.append("inflate (true|false)");
|
argList::addArgument("inflate (true|false)");
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|||||||
@ -39,7 +39,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::noFunctionObjects();
|
argList::noFunctionObjects();
|
||||||
argList::validArgs.insert("start size .. startN sizeN");
|
argList::addArgument("start size .. startN sizeN");
|
||||||
argList::addOption("verbose");
|
argList::addOption("verbose");
|
||||||
argList::addNote
|
argList::addNote
|
||||||
(
|
(
|
||||||
|
|||||||
@ -40,7 +40,7 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const int n = 10000000;
|
const int n = 10000000;
|
||||||
const char* const memTags = "peak/size/rss mem: ";
|
const char* const memTags = "peak/size/rss/free mem: ";
|
||||||
|
|
||||||
memInfo mem;
|
memInfo mem;
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noBanner();
|
argList::noBanner();
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("file .. fileN");
|
argList::addArgument("file .. fileN");
|
||||||
|
|
||||||
argList::removeOption("case");
|
argList::removeOption("case");
|
||||||
argList::addOption("ext", "bak");
|
argList::addOption("ext", "bak");
|
||||||
|
|||||||
@ -158,7 +158,7 @@ int main(int argc, char *argv[])
|
|||||||
"skip",
|
"skip",
|
||||||
"skip some parts"
|
"skip some parts"
|
||||||
);
|
);
|
||||||
argList::validArgs.append("recursive (true|false)");
|
argList::addArgument("recursive (true|false)");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Description
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("cloud");
|
argList::addArgument("cloud");
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|||||||
@ -44,7 +44,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::validArgs.append("patch");
|
argList::addArgument("patch");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -212,7 +212,7 @@ void writeFaceFaces
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.append("patch");
|
argList::addArgument("patch");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -32,6 +32,7 @@ bodies
|
|||||||
type sphere;
|
type sphere;
|
||||||
mass 1;
|
mass 1;
|
||||||
radius 0.05;
|
radius 0.05;
|
||||||
|
centreOfMass (0 10 0);
|
||||||
transform (1 0 0 0 1 0 0 0 1) (0 -1 0);
|
transform (1 0 0 0 1 0 0 0 1) (0 -1 0);
|
||||||
mergeWith hinge;
|
mergeWith hinge;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ bodies
|
|||||||
parent root;
|
parent root;
|
||||||
mass 6e4;
|
mass 6e4;
|
||||||
radius 0.01;
|
radius 0.01;
|
||||||
|
centreOfMass (0 0 0);
|
||||||
transform (1 0 0 0 1 0 0 0 1) (0 0 0);
|
transform (1 0 0 0 1 0 0 0 1) (0 0 0);
|
||||||
joint
|
joint
|
||||||
{
|
{
|
||||||
@ -37,6 +38,7 @@ bodies
|
|||||||
parent M;
|
parent M;
|
||||||
mass 6e3;
|
mass 6e3;
|
||||||
radius 0.01;
|
radius 0.01;
|
||||||
|
centreOfMass (0 0 0);
|
||||||
transform (1 0 0 0 1 0 0 0 1) (0 -5 0);
|
transform (1 0 0 0 1 0 0 0 1) (0 -5 0);
|
||||||
mergeWith M;
|
mergeWith M;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ inline Ostream& printPoint(Ostream& os, const point& p)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("file .. fileN");
|
argList::addArgument("file .. fileN");
|
||||||
argList::addBoolOption("B", "B-Spline implementation");
|
argList::addBoolOption("B", "B-Spline implementation");
|
||||||
argList::addBoolOption("CMR", "catmull-rom spline (default)");
|
argList::addBoolOption("CMR", "catmull-rom spline (default)");
|
||||||
argList::addOption
|
argList::addOption
|
||||||
|
|||||||
@ -62,6 +62,18 @@ int main(int argc, char *argv[])
|
|||||||
dict.add("FOAM_RUN", subDict);
|
dict.add("FOAM_RUN", subDict);
|
||||||
|
|
||||||
|
|
||||||
|
// Test Foam::name with formatting string
|
||||||
|
{
|
||||||
|
word formatted = Foam::name("formatted=<%X>", 0xdeadbeef);
|
||||||
|
Info<<"formatted: " << formatted << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<<"formatted: "
|
||||||
|
<< Foam::name("formatted not checked for validity=<%X>", 0xdeadbeef)
|
||||||
|
<< nl
|
||||||
|
<< endl
|
||||||
|
|
||||||
|
|
||||||
Info<< "string:" << test << nl << "hash:"
|
Info<< "string:" << test << nl << "hash:"
|
||||||
<< unsigned(string::hash()(test)) << endl;
|
<< unsigned(string::hash()(test)) << endl;
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,18 @@ int main(int argc, char *argv[])
|
|||||||
"string",
|
"string",
|
||||||
"test split on substring"
|
"test split on substring"
|
||||||
);
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"char",
|
||||||
|
"delim",
|
||||||
|
"test split on specified delimiter character"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"fixed",
|
||||||
|
"int",
|
||||||
|
"test split on fixed width"
|
||||||
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"slash",
|
"slash",
|
||||||
@ -81,6 +93,11 @@ int main(int argc, char *argv[])
|
|||||||
"space",
|
"space",
|
||||||
"test split on space"
|
"test split on space"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"empty",
|
||||||
|
"preserve empty strings in split"
|
||||||
|
);
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|
||||||
if (args.size() <= 1 && args.options().empty())
|
if (args.size() <= 1 && args.options().empty())
|
||||||
@ -88,8 +105,10 @@ int main(int argc, char *argv[])
|
|||||||
args.printUsage();
|
args.printUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool keepEmpty = args.optionFound("empty");
|
||||||
|
|
||||||
int nopts = 0;
|
int nopts = 0;
|
||||||
for (auto optName : { "any", "slash", "space", "sub" })
|
for (auto optName : { "any", "slash", "space", "sub", "fixed", "char" })
|
||||||
{
|
{
|
||||||
if (args.optionFound(optName))
|
if (args.optionFound(optName))
|
||||||
{
|
{
|
||||||
@ -152,15 +171,55 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("char"))
|
||||||
|
{
|
||||||
|
const char delim = args["char"][0];
|
||||||
|
|
||||||
|
Info<< "split on char=" << delim << nl
|
||||||
|
<< "~~~~~~~~~~~~~~" << nl;
|
||||||
|
|
||||||
|
for (label argi=1; argi < args.size(); ++argi)
|
||||||
|
{
|
||||||
|
const auto split = stringOps::split(args[argi], delim, keepEmpty);
|
||||||
|
printSubStrings(args[argi], split);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nopts == 1)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("fixed"))
|
||||||
|
{
|
||||||
|
const label width = readLabel(args["fixed"]);
|
||||||
|
|
||||||
|
Info<< "split on fixed width = " << width << nl
|
||||||
|
<< "~~~~~~~~~~~~~~" << nl;
|
||||||
|
|
||||||
|
for (label argi=1; argi < args.size(); ++argi)
|
||||||
|
{
|
||||||
|
const auto split = stringOps::splitFixed(args[argi], width);
|
||||||
|
printSubStrings(args[argi], split);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nopts == 1)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
if (!nopts || args.optionFound("slash"))
|
if (!nopts || args.optionFound("slash"))
|
||||||
{
|
{
|
||||||
|
const char delim = '/';
|
||||||
|
|
||||||
Info<< "split on slash" << nl
|
Info<< "split on slash" << nl
|
||||||
<< "~~~~~~~~~~~~~~" << nl;
|
<< "~~~~~~~~~~~~~~" << nl;
|
||||||
|
|
||||||
for (label argi=1; argi < args.size(); ++argi)
|
for (label argi=1; argi < args.size(); ++argi)
|
||||||
{
|
{
|
||||||
const auto split = stringOps::split(args[argi], '/');
|
const auto split = stringOps::split(args[argi], delim, keepEmpty);
|
||||||
printSubStrings(args[argi], split);
|
printSubStrings(args[argi], split);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,8 +122,8 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::noFunctionObjects();
|
argList::noFunctionObjects();
|
||||||
argList::validArgs.append("surface file");
|
argList::addArgument("surface file");
|
||||||
argList::validArgs.append("surface file");
|
argList::addArgument("surface file");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -86,8 +86,8 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.append("inputFile");
|
argList::addArgument("inputFile");
|
||||||
argList::validArgs.append("outputFile");
|
argList::addArgument("outputFile");
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
|
|||||||
@ -30,6 +30,7 @@ Description
|
|||||||
#include "profilingSysInfo.H"
|
#include "profilingSysInfo.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "endian.H"
|
#include "endian.H"
|
||||||
|
#include "cpuInfo.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -38,7 +39,9 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
profiling::sysInfo().write(Info);
|
profilingSysInfo().write(Info);
|
||||||
|
|
||||||
|
cpuInfo().write(Info);
|
||||||
|
|
||||||
#ifdef WM_BIG_ENDIAN
|
#ifdef WM_BIG_ENDIAN
|
||||||
Info
|
Info
|
||||||
|
|||||||
@ -44,7 +44,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::noBanner();
|
argList::noBanner();
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.insert("string .. stringN");
|
argList::addArgument("string .. stringN");
|
||||||
argList::addOption("file", "name");
|
argList::addOption("file", "name");
|
||||||
argList::addOption("repeat", "count");
|
argList::addOption("repeat", "count");
|
||||||
argList::addBoolOption("verbose", "report for each repeat");
|
argList::addBoolOption("verbose", "report for each repeat");
|
||||||
|
|||||||
3
applications/utilities/finiteArea/checkFaMesh/Make/files
Normal file
3
applications/utilities/finiteArea/checkFaMesh/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
checkFaMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/checkFaMesh
|
||||||
@ -1,9 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(CCMIO_ARCH_PATH)/include
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-L$(CCMIO_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN) -lccmio
|
-lfiniteArea
|
||||||
83
applications/utilities/finiteArea/checkFaMesh/checkFaMesh.C
Normal file
83
applications/utilities/finiteArea/checkFaMesh/checkFaMesh.C
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd |
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
| Copyright (C) 2016-2017 Wikki 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
|
||||||
|
makeFaMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
Check a Finite Area mesh
|
||||||
|
|
||||||
|
Author
|
||||||
|
Zeljko Tukovic, FAMENA
|
||||||
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "addRegionOption.H"
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createNamedMesh.H"
|
||||||
|
# include "createFaMesh.H"
|
||||||
|
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
// General mesh statistics
|
||||||
|
Info<< "Number of points: " << aMesh.nPoints() << nl
|
||||||
|
<< "Number of internal edges: " << aMesh.nInternalEdges() << nl
|
||||||
|
<< "Number of edges: " << aMesh.nEdges() << nl
|
||||||
|
<< "Number of faces: " << aMesh.nFaces() << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
// Check geometry
|
||||||
|
Info<< "Face area: min = " << min(aMesh.S().field())
|
||||||
|
<< " max = " << max(aMesh.S().field()) << nl
|
||||||
|
<< "Internal edge length: min = "
|
||||||
|
<< min(aMesh.magLe().internalField()) << nl
|
||||||
|
<< " max = " << max(aMesh.magLe().internalField()) << nl
|
||||||
|
<< "Edge length: min = "
|
||||||
|
<< min(aMesh.magLe()).value() << nl
|
||||||
|
<< " max = " << max(aMesh.magLe()).value() << nl
|
||||||
|
<< "Face area normals: min = " << min(aMesh.faceAreaNormals().field())
|
||||||
|
<< " max = " << max(aMesh.faceAreaNormals().field()) << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
3
applications/utilities/finiteArea/makeFaMesh/Make/files
Normal file
3
applications/utilities/finiteArea/makeFaMesh/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
makeFaMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/makeFaMesh
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/cfdTools/general/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteArea \
|
||||||
|
-lfiniteVolume
|
||||||
355
applications/utilities/finiteArea/makeFaMesh/makeFaMesh.C
Normal file
355
applications/utilities/finiteArea/makeFaMesh/makeFaMesh.C
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd |
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
| Copyright (C) 2016-2017 Wikki 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
|
||||||
|
makeFaMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
A mesh generator for finite area mesh.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Zeljko Tukovic, FAMENA
|
||||||
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "objectRegistry.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "argList.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
class faPatchData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
word name_;
|
||||||
|
word type_;
|
||||||
|
dictionary dict_;
|
||||||
|
label ownPolyPatchID_;
|
||||||
|
label ngbPolyPatchID_;
|
||||||
|
labelList edgeLabels_;
|
||||||
|
faPatchData()
|
||||||
|
:
|
||||||
|
name_(word::null),
|
||||||
|
type_(word::null),
|
||||||
|
ownPolyPatchID_(-1),
|
||||||
|
ngbPolyPatchID_(-1)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "addRegionOption.H"
|
||||||
|
argList::noParallel();
|
||||||
|
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
|
// Reading faMeshDefinition dictionary
|
||||||
|
IOdictionary faMeshDefinition
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"faMeshDefinition",
|
||||||
|
runTime.constant(),
|
||||||
|
"faMesh",
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
wordList polyMeshPatches
|
||||||
|
(
|
||||||
|
faMeshDefinition.lookup("polyMeshPatches")
|
||||||
|
);
|
||||||
|
|
||||||
|
const dictionary& bndDict = faMeshDefinition.subDict("boundary");
|
||||||
|
|
||||||
|
const wordList faPatchNames(bndDict.toc());
|
||||||
|
|
||||||
|
List<faPatchData> faPatches(faPatchNames.size()+1);
|
||||||
|
|
||||||
|
forAll(faPatchNames, patchI)
|
||||||
|
{
|
||||||
|
const dictionary& curPatchDict = bndDict.subDict(faPatchNames[patchI]);
|
||||||
|
|
||||||
|
faPatches[patchI].name_ = faPatchNames[patchI];
|
||||||
|
|
||||||
|
faPatches[patchI].type_ = word(curPatchDict.lookup("type"));
|
||||||
|
|
||||||
|
const word ownName = curPatchDict.lookup("ownerPolyPatch");
|
||||||
|
|
||||||
|
faPatches[patchI].ownPolyPatchID_ =
|
||||||
|
mesh.boundaryMesh().findPatchID(ownName);
|
||||||
|
|
||||||
|
if (faPatches[patchI].ownPolyPatchID_ < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("makeFaMesh:")
|
||||||
|
<< "neighbourPolyPatch " << ownName << " does not exist"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const word neiName = curPatchDict.lookup("neighbourPolyPatch");
|
||||||
|
|
||||||
|
faPatches[patchI].ngbPolyPatchID_ =
|
||||||
|
mesh.boundaryMesh().findPatchID(neiName);
|
||||||
|
|
||||||
|
if (faPatches[patchI].ngbPolyPatchID_ < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("makeFaMesh:")
|
||||||
|
<< "neighbourPolyPatch " << neiName << " does not exist"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setting faceLabels list size
|
||||||
|
label size = 0;
|
||||||
|
|
||||||
|
labelList patchIDs(polyMeshPatches.size(), -1);
|
||||||
|
|
||||||
|
forAll(polyMeshPatches, patchI)
|
||||||
|
{
|
||||||
|
patchIDs[patchI] =
|
||||||
|
mesh.boundaryMesh().findPatchID(polyMeshPatches[patchI]);
|
||||||
|
|
||||||
|
if (patchIDs[patchI] < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("makeFaMesh:")
|
||||||
|
<< "Patch " << polyMeshPatches[patchI] << " does not exist"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
size += mesh.boundaryMesh()[patchIDs[patchI]].size();
|
||||||
|
}
|
||||||
|
|
||||||
|
labelList faceLabels(size, -1);
|
||||||
|
|
||||||
|
sort(patchIDs);
|
||||||
|
|
||||||
|
|
||||||
|
// Filling of faceLabels list
|
||||||
|
label faceI = -1;
|
||||||
|
|
||||||
|
forAll(polyMeshPatches, patchI)
|
||||||
|
{
|
||||||
|
label start = mesh.boundaryMesh()[patchIDs[patchI]].start();
|
||||||
|
|
||||||
|
label size = mesh.boundaryMesh()[patchIDs[patchI]].size();
|
||||||
|
|
||||||
|
for (label i = 0; i < size; ++i)
|
||||||
|
{
|
||||||
|
faceLabels[++faceI] = start + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating faMesh
|
||||||
|
Info << "Create faMesh ... ";
|
||||||
|
|
||||||
|
faMesh areaMesh
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
faceLabels
|
||||||
|
);
|
||||||
|
Info << "Done" << endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Determination of faPatch ID for each boundary edge.
|
||||||
|
// Result is in the bndEdgeFaPatchIDs list
|
||||||
|
const indirectPrimitivePatch& patch = areaMesh.patch();
|
||||||
|
|
||||||
|
labelList faceCells(faceLabels.size(), -1);
|
||||||
|
|
||||||
|
forAll(faceCells, faceI)
|
||||||
|
{
|
||||||
|
label faceID = faceLabels[faceI];
|
||||||
|
|
||||||
|
faceCells[faceI] = mesh.faceOwner()[faceID];
|
||||||
|
}
|
||||||
|
|
||||||
|
labelList meshEdges =
|
||||||
|
patch.meshEdges
|
||||||
|
(
|
||||||
|
mesh.edges(),
|
||||||
|
mesh.cellEdges(),
|
||||||
|
faceCells
|
||||||
|
);
|
||||||
|
|
||||||
|
const labelListList& edgeFaces = mesh.edgeFaces();
|
||||||
|
|
||||||
|
const label nTotalEdges = patch.nEdges();
|
||||||
|
const label nInternalEdges = patch.nInternalEdges();
|
||||||
|
|
||||||
|
labelList bndEdgeFaPatchIDs(nTotalEdges - nInternalEdges, -1);
|
||||||
|
|
||||||
|
for (label edgeI = nInternalEdges; edgeI < nTotalEdges; ++edgeI)
|
||||||
|
{
|
||||||
|
label curMeshEdge = meshEdges[edgeI];
|
||||||
|
|
||||||
|
labelList curEdgePatchIDs(2, label(-1));
|
||||||
|
|
||||||
|
label patchI = -1;
|
||||||
|
|
||||||
|
forAll(edgeFaces[curMeshEdge], faceI)
|
||||||
|
{
|
||||||
|
label curFace = edgeFaces[curMeshEdge][faceI];
|
||||||
|
|
||||||
|
label curPatchID = mesh.boundaryMesh().whichPatch(curFace);
|
||||||
|
|
||||||
|
if (curPatchID != -1)
|
||||||
|
{
|
||||||
|
curEdgePatchIDs[++patchI] = curPatchID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (label pI = 0; pI < faPatches.size() - 1; ++pI)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
curEdgePatchIDs[0] == faPatches[pI].ownPolyPatchID_
|
||||||
|
&& curEdgePatchIDs[1] == faPatches[pI].ngbPolyPatchID_
|
||||||
|
)
|
||||||
|
||
|
||||||
|
(
|
||||||
|
curEdgePatchIDs[1] == faPatches[pI].ownPolyPatchID_
|
||||||
|
&& curEdgePatchIDs[0] == faPatches[pI].ngbPolyPatchID_
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bndEdgeFaPatchIDs[edgeI - nInternalEdges] = pI;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set edgeLabels for each faPatch
|
||||||
|
for (label pI=0; pI<(faPatches.size()-1); ++pI)
|
||||||
|
{
|
||||||
|
SLList<label> tmpList;
|
||||||
|
|
||||||
|
forAll(bndEdgeFaPatchIDs, eI)
|
||||||
|
{
|
||||||
|
if (bndEdgeFaPatchIDs[eI] == pI)
|
||||||
|
{
|
||||||
|
tmpList.append(nInternalEdges + eI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
faPatches[pI].edgeLabels_ = tmpList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for undefined edges
|
||||||
|
SLList<label> tmpList;
|
||||||
|
|
||||||
|
forAll(bndEdgeFaPatchIDs, eI)
|
||||||
|
{
|
||||||
|
if (bndEdgeFaPatchIDs[eI] == -1)
|
||||||
|
{
|
||||||
|
tmpList.append(nInternalEdges + eI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmpList.size() > 0)
|
||||||
|
{
|
||||||
|
label pI = faPatches.size()-1;
|
||||||
|
|
||||||
|
faPatches[pI].name_ = "undefined";
|
||||||
|
faPatches[pI].type_ = "patch";
|
||||||
|
faPatches[pI].edgeLabels_ = tmpList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add good patches to faMesh
|
||||||
|
SLList<faPatch*> faPatchLst;
|
||||||
|
|
||||||
|
for (label pI = 0; pI < faPatches.size(); ++pI)
|
||||||
|
{
|
||||||
|
faPatches[pI].dict_.add("type", faPatches[pI].type_);
|
||||||
|
faPatches[pI].dict_.add("edgeLabels", faPatches[pI].edgeLabels_);
|
||||||
|
faPatches[pI].dict_.add
|
||||||
|
(
|
||||||
|
"ngbPolyPatchIndex",
|
||||||
|
faPatches[pI].ngbPolyPatchID_
|
||||||
|
);
|
||||||
|
|
||||||
|
if(faPatches[pI].edgeLabels_.size() > 0)
|
||||||
|
{
|
||||||
|
faPatchLst.append
|
||||||
|
(
|
||||||
|
faPatch::New
|
||||||
|
(
|
||||||
|
faPatches[pI].name_,
|
||||||
|
faPatches[pI].dict_,
|
||||||
|
pI,
|
||||||
|
areaMesh.boundary()
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("addEmptyPatch"))
|
||||||
|
{
|
||||||
|
word emptyPatchName(args.optionLookup("addEmptyPatch")());
|
||||||
|
dictionary emptyPatchDict;
|
||||||
|
emptyPatchDict.add("type", "empty");
|
||||||
|
emptyPatchDict.add("edgeLabels", labelList());
|
||||||
|
emptyPatchDict.add("ngbPolyPatchIndex", -1);
|
||||||
|
|
||||||
|
faPatchLst.append
|
||||||
|
(
|
||||||
|
faPatch::New
|
||||||
|
(
|
||||||
|
emptyPatchName,
|
||||||
|
emptyPatchDict,
|
||||||
|
faPatchLst.size(),
|
||||||
|
areaMesh.boundary()
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Add faPatches ... ";
|
||||||
|
areaMesh.addFaPatches(List<faPatch*>(faPatchLst));
|
||||||
|
Info << "Done" << endl;
|
||||||
|
|
||||||
|
// Writing faMesh
|
||||||
|
Info << "Write finite area mesh ... ";
|
||||||
|
areaMesh.write();
|
||||||
|
|
||||||
|
Info << "Done" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -166,7 +166,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
meshFilterPtr.set
|
meshFilterPtr.reset
|
||||||
(
|
(
|
||||||
new polyMeshFilter(mesh, pointPriority, collapseDict)
|
new polyMeshFilter(mesh, pointPriority, collapseDict)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -349,7 +349,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
|
|
||||||
argList::validArgs.append("featureAngle [0..180]");
|
argList::addArgument("featureAngle [0..180]");
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"concaveAngle",
|
"concaveAngle",
|
||||||
|
|||||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
argList::validArgs.append("cellSet");
|
argList::addArgument("cellSet");
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"minSet",
|
"minSet",
|
||||||
|
|||||||
@ -62,8 +62,8 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
argList::validArgs.append("patches");
|
argList::addArgument("patches");
|
||||||
argList::validArgs.append("edgeFraction");
|
argList::addArgument("edgeFraction");
|
||||||
|
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
|
|||||||
@ -54,7 +54,7 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
argList::validArgs.append("faceSet");
|
argList::addArgument("faceSet");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -52,7 +52,7 @@ Description
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "cellCuts.H"
|
#include "cellCuts.H"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModel.H"
|
||||||
#include "meshCutter.H"
|
#include "meshCutter.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "geomCellLooper.H"
|
#include "geomCellLooper.H"
|
||||||
@ -387,7 +387,7 @@ void collectCuts
|
|||||||
const vectorField& faceAreas = mesh.faceAreas();
|
const vectorField& faceAreas = mesh.faceAreas();
|
||||||
|
|
||||||
// Hex shape
|
// Hex shape
|
||||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||||
|
|
||||||
// cut handling functions
|
// cut handling functions
|
||||||
edgeVertex ev(mesh);
|
edgeVertex ev(mesh);
|
||||||
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.append("edgeAngle [0..360]");
|
argList::addArgument("edgeAngle [0..360]");
|
||||||
|
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
|
|
||||||
# Optional component: continue-on-error
|
|
||||||
# - may not have third-party installed
|
|
||||||
export WM_CONTINUE_ON_ERROR=true
|
|
||||||
|
|
||||||
# Parse arguments for compilation (at least for error catching)
|
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
|
||||||
|
|
||||||
warning="==> skip ccmio"
|
|
||||||
|
|
||||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
|
|
||||||
then
|
|
||||||
. $settings
|
|
||||||
else
|
|
||||||
echo "$warning (no config.sh/ccmio settings)"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build libccmio (.a|.so) - use static linkage for fewer issues
|
|
||||||
$WM_THIRD_PARTY_DIR/makeCCMIO lib
|
|
||||||
|
|
||||||
: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH} # Extra safety
|
|
||||||
export FOAM_EXT_LIBBIN
|
|
||||||
|
|
||||||
if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
|
|
||||||
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o -e $FOAM_EXT_LIBBIN/libccmio.so \) ]
|
|
||||||
then
|
|
||||||
wmake $targetType ccm26ToFoam
|
|
||||||
else
|
|
||||||
echo $warning
|
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
ccm26ToFoam.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/ccm26ToFoam
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
1. how to write mesh from prostar
|
|
||||||
|
|
||||||
Type ngeom,[name].ngeom,star in the command line. This will create a
|
|
||||||
.ngeom file of your Prostar model.
|
|
||||||
|
|
||||||
If you have boundaries defined, these will be kept in the .ngeom file so
|
|
||||||
you won't have to rename and redefine the boundaries in ccm+. However,
|
|
||||||
the values (properties) are not exported.
|
|
||||||
|
|
||||||
If you don't have boundaries you'll get a single wall patch in ccm+ that
|
|
||||||
you'll have to split accordingly.
|
|
||||||
|
|
||||||
2. how to load it into star-ccm+
|
|
||||||
|
|
||||||
In ccm+ create a new simulation and do File>Import...
|
|
||||||
|
|
||||||
Browse to the location where you have your .ngeom file, select it, press
|
|
||||||
OK and that's it.
|
|
||||||
|
|
||||||
3. how to do merging (or is automatic?)
|
|
||||||
|
|
||||||
If you had couples in your Prostar model, your meshes will all be
|
|
||||||
"fused" together automatically in ccm+ when you import the .ngeom file.
|
|
||||||
Keep a look on the output window in Prostar when you run the ngeom
|
|
||||||
command to make sure the couples are exported OK.
|
|
||||||
|
|
||||||
Alternatively, you can "fuse" the different fluid regions in ccm+. To do
|
|
||||||
this select all the fluid regions you want to merge together from the
|
|
||||||
command tree on the left of your screen, under Regions. Press control
|
|
||||||
and click on top of each one, once you've selected all, click the
|
|
||||||
right-hand buttom of your mouse and select Fuse...
|
|
||||||
|
|
||||||
4. how to save it from star-ccm+
|
|
||||||
|
|
||||||
Once your model is ready in ccm+ (i.e. all regions and boundary patches
|
|
||||||
defined), go to File>Export... and select .ccm format.
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user