Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2017-12-18 08:24:58 -08:00
1629 changed files with 113896 additions and 16822 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "cfmesh"]
path = modules/cfmesh
url = https://develop.openfoam.com/Community/integration-cfmesh.git

View File

@ -43,6 +43,15 @@ echo "Compile OpenFOAM applications"
echo
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
echo
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"

View File

@ -42,7 +42,7 @@ Description
#include "OFstream.H"
#include "thermoPhysicsTypes.H"
#include "basicMultiComponentMixture.H"
#include "cellModeller.H"
#include "cellModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -13,8 +13,7 @@ points[5] = vector(1, 0, 1);
points[6] = vector(1, 1, 1);
points[7] = vector(0, 1, 1);
const cellModel& hexa = *(cellModeller::lookup("hex"));
faceList faces = hexa.modelFaces();
faceList faces = cellModel::ref(cellModel::HEX).modelFaces();
fvMesh mesh
(
@ -25,7 +24,7 @@ fvMesh mesh
runTime,
IOobject::READ_IF_PRESENT
),
xferMove<Field<vector>>(points),
xferMove<pointField>(points),
faces.xfer(),
owner.xfer(),
neighbour.xfer()

View File

@ -7,8 +7,8 @@ surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", constrainHbyA(rAU*UEqn.H(), U, p));
//mesh.interpolate(HbyA);
volVectorField HbyA("HbyA", U);
HbyA = constrainHbyA(rAU*UEqn.H(), U, p);
if (pimple.nCorrPISO() <= 1)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,6 +39,7 @@ The available solvers are grouped into the following categories:
- \ref grpLagrangianSolvers
- \ref grpMultiphaseSolvers
- \ref grpStressAnalysisSolvers
- \ref grpFiniteAreaSolvers
\*---------------------------------------------------------------------------*/

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,4 +34,10 @@ License
This group contains moving mesh solvers solvers
@}
\defgroup grpFiniteAreaSolvers Finite area solvers
@{
\ingroup grpSolvers
This group contains finite area solvers
@}
\*---------------------------------------------------------------------------*/

View File

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

View 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

View File

@ -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));
}

View File

@ -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;
}

View 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");

View File

@ -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);

View 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;
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
loopControl iters(runTime, aMesh.solutionDict(), "solution");

View File

@ -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")
);

View File

@ -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;
// ************************************************************************* //

View File

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

View 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

View File

@ -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()
);

View File

@ -0,0 +1,2 @@
// Create Finite Area mesh
faMesh aMesh(mesh);

View File

@ -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();

View File

@ -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;
}
// ************************************************************************* //

View File

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

View 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

View File

@ -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()
);

View File

@ -0,0 +1,2 @@
// Create Finite Area mesh
faMesh aMesh(mesh);

View File

@ -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();

View 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;
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,6 +47,7 @@ Description
#include "radiationModel.H"
#include "fvOptions.H"
#include "coordinateSystem.H"
#include "loopControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -89,11 +90,10 @@ int main(int argc, char *argv[])
}
}
// --- 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)
{
@ -113,6 +113,35 @@ int main(int argc, char *argv[])
#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();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,6 +42,7 @@ Description
#include "radiationModel.H"
#include "fvOptions.H"
#include "coordinateSystem.H"
#include "loopControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +58,6 @@ int main(int argc, char *argv[])
#include "createFields.H"
#include "initContinuityErrs.H"
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
@ -80,6 +80,35 @@ int main(int argc, char *argv[])
#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();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -16,17 +16,20 @@
fvOptions.constrain(UEqn);
solve
(
UEqn
==
fvc::reconstruct
if (momentumPredictor)
{
solve
(
UEqn
==
fvc::reconstruct
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
fvOptions.correct(U);
fvOptions.correct(U);
}

View File

@ -2,3 +2,6 @@
const int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
const bool momentumPredictor =
simple.lookupOrDefault("momentumPredictor", true);

View File

@ -12,6 +12,14 @@
volScalarField& p = thermo.p();
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];
fv::options& fvOptions = fluidFvOptions[i];
@ -22,14 +30,7 @@
initialMassFluid[i]
);
radiation::radiationModel& rad = radiation[i];
bool frozenFlow = frozenFlowFluid[i];
const label pRefCell = pRefCellFluid[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];

View File

@ -1,5 +1,5 @@
{
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth)
{
fvScalarMatrix hEqn
(
@ -20,9 +20,9 @@
fvOptions.correct(h);
}
thermo.correct();
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
<< max(thermo.T()).value() << endl;
}
thermo.correct();
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
<< max(thermo.T()).value() << endl;

View File

@ -19,8 +19,8 @@ List<bool> frozenFlowFluid(fluidRegions.size(), false);
PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size());
PtrList<fv::options> fluidFvOptions(fluidRegions.size());
List<label> refCellFluid(fluidRegions.size());
List<scalar> refValueFluid(fluidRegions.size());
List<label> pRefCellFluid(fluidRegions.size());
List<scalar> pRefValueFluid(fluidRegions.size());
// Populate fluid field pointer lists
forAll(fluidRegions, i)
@ -252,8 +252,8 @@ forAll(fluidRegions, i)
turbulence[i].validate();
refCellFluid[i] = 0;
refValueFluid[i] = 0.0;
pRefCellFluid[i] = 0;
pRefValueFluid[i] = 0.0;
if (p_rghFluid[i].needReference())
{
@ -262,8 +262,8 @@ forAll(fluidRegions, i)
thermoFluid[i].p(),
p_rghFluid[i],
pimpleDict,
refCellFluid[i],
refValueFluid[i]
pRefCellFluid[i],
pRefValueFluid[i]
);
}

View File

@ -32,7 +32,8 @@
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];

View File

@ -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;
solidRegions.set
@ -14,7 +14,7 @@
(
IOobject
(
solidsNames[i],
solidNames[i],
runTime.timeName(),
runTime,
IOobject::MUST_READ

View File

@ -4,7 +4,7 @@ if (finalIter)
}
{
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth)
{
fvScalarMatrix hEqn
(
@ -26,13 +26,13 @@ if (finalIter)
fvOptions.correct(h);
}
thermo.correct();
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
<< max(thermo.T()).value() << endl;
}
thermo.correct();
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
<< max(thermo.T()).value() << endl;
if (finalIter)
{
mesh.data::remove("finalIteration");

View File

@ -16,6 +16,9 @@
fvOptions.constrain(UEqn);
solve(UEqn == -cellMask*fvc::grad(p));
if (simple.momentumPredictor())
{
solve(UEqn == -cellMask*fvc::grad(p));
}
fvOptions.correct(U);

View File

@ -5,7 +5,7 @@
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
HbyA = constrainHbyA(rAU*UEqn.H(), U, p);
HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p);
//mesh.interpolate(HbyA);
if (massFluxInterpolation)

View File

@ -29,8 +29,10 @@ volVectorField U
#include "createPhi.H"
// Creating e based thermo
autoPtr<twoPhaseMixtureEThermo> thermo;
thermo.set(new twoPhaseMixtureEThermo(U, phi));
autoPtr<twoPhaseMixtureEThermo> thermo
(
new twoPhaseMixtureEThermo(U, phi)
);
// Create mixture and
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;

View File

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

View File

@ -49,7 +49,7 @@ Foam::ThermoPhaseModel<BasePhaseModel, ThermoType>::ThermoPhaseModel
{
if (createThermo)
{
thermoPtr_.set
thermoPtr_.reset
(
ThermoType::New(fluid.mesh(), this->name()).ptr()
);

View File

@ -36,7 +36,7 @@ namespace Foam
namespace dragModels
{
defineTypeNameAndDebug(GidaspowErgunWenYu, 0);
addToRunTimeSelectionTable(dragModel, GidaspowErgunWenYu, dictionary);
addToRunTimeSelectionTable(dragModel, GidaspowErgunWenYu, dictionary);
}
}

View File

@ -76,7 +76,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
{
if (modelTable.found(pair_))
{
model_.set
model_.reset
(
modelType::New
(
@ -88,7 +88,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
if (modelTable.found(pair1In2_))
{
model1In2_.set
model1In2_.reset
(
modelType::New
(
@ -100,7 +100,7 @@ Foam::BlendedInterfacialModel<modelType>::BlendedInterfacialModel
if (modelTable.found(pair2In1_))
{
model2In1_.set
model2In1_.reset
(
modelType::New
(

View File

@ -41,7 +41,7 @@ Foam::orderedPhasePair::orderedPhasePair
{
if (aspectRatioTable.found(*this))
{
aspectRatio_.set
aspectRatio_.reset
(
aspectRatioModel::New
(

View File

@ -132,7 +132,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
phasePair::scalarTable sigmaTable(lookup("sigma"));
phasePair::dictTable aspectRatioTable(lookup("aspectRatio"));
pair_.set
pair_.reset
(
new phasePair
(
@ -143,7 +143,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
pair1In2_.set
pair1In2_.reset
(
new orderedPhasePair
(
@ -155,7 +155,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
pair2In1_.set
pair2In1_.reset
(
new orderedPhasePair
(
@ -170,7 +170,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
// Models
drag_.set
drag_.reset
(
new BlendedInterfacialModel<dragModel>
(
@ -187,7 +187,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
virtualMass_.set
virtualMass_.reset
(
new BlendedInterfacialModel<virtualMassModel>
(
@ -203,7 +203,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
heatTransfer_.set
heatTransfer_.reset
(
new BlendedInterfacialModel<heatTransferModel>
(
@ -219,7 +219,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
lift_.set
lift_.reset
(
new BlendedInterfacialModel<liftModel>
(
@ -235,7 +235,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
wallLubrication_.set
wallLubrication_.reset
(
new BlendedInterfacialModel<wallLubricationModel>
(
@ -251,7 +251,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
)
);
turbulentDispersion_.set
turbulentDispersion_.reset
(
new BlendedInterfacialModel<turbulentDispersionModel>
(

View File

@ -103,7 +103,7 @@ public:
int main(int argc, char *argv[])
{
argList::validArgs.append("ODESolver");
argList::addArgument("ODESolver");
argList args(argc, argv);
// Create the ODE system

View File

@ -82,7 +82,7 @@ inline void reportInfo()
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.insert("file .. fileN");
argList::addArgument("file .. fileN");
argList::addBoolOption("mask", "report information about the bit masks");
argList::addBoolOption("count", "test the count() method");

View File

@ -40,7 +40,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("patch");
argList::addArgument("patch");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -201,7 +201,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::validArgs.append("patch");
argList::addArgument("patch");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -41,7 +41,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("(patches)");
argList::addArgument("(patches)");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -38,12 +38,24 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::noFunctionObjects();
// argList::noFunctionObjects();
argList::removeOption("case");
argList::addOption("label", "value", "Test parsing of label");
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);
label ival;

View File

@ -31,7 +31,7 @@ Description
#include "polyMesh.H"
#include "boundBox.H"
#include "treeBoundBox.H"
#include "cellModeller.H"
#include "cellModel.H"
using namespace Foam;
@ -52,15 +52,11 @@ boundBox cube(scalar start, scalar width)
int main(int argc, char *argv[])
{
#include "setRootCase.H"
// #include "createTime.H"
// #include "createMesh.H"
const cellModel& hex = *(cellModeller::lookup("hex"));
Info<<"boundBox faces: " << boundBox::faces << endl;
Info<<"hex faces: " << hex.modelFaces() << endl;
Info<<"tree-bb faces: " << treeBoundBox::faces << endl;
Info<<"tree-bb edges: " << treeBoundBox::edges << endl;
Info<<"boundBox faces: " << boundBox::faces << nl
<<"hex faces: " << cellModel::ref(cellModel::HEX).modelFaces() << nl
<<"tree-bb faces: " << treeBoundBox::faces << nl
<<"tree-bb edges: " << treeBoundBox::edges << endl;
boundBox bb = boundBox::greatBox;
Info<<"great box: " << bb << endl;

View File

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

View 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;
}
// ************************************************************************* //

View File

@ -65,7 +65,7 @@ int main(int argc, char *argv[])
"more information about decomposition"
);
argList::validArgs.append("kaffpa-output-file");
argList::addArgument("kaffpa-output-file");
// Include explicit constant options, have zero from time range
timeSelector::addOptions(true, false);

View File

@ -42,7 +42,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.insert("dict .. dictN");
argList::addArgument("dict .. dictN");
argList args(argc, argv, false, true);
Info<< nl

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,8 +30,10 @@ Description
#include "DynamicList.H"
#include "IOstreams.H"
#include "fileNameList.H"
#include "stringOps.H"
#include "stringList.H"
#include "wordList.H"
#include "SubStrings.H"
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:
int main(int argc, char *argv[])
@ -62,18 +84,49 @@ int main(int argc, char *argv[])
dynlst.append("string1 with content");
dynlst.append("string2 other content");
dynlst.append("string3 done");
dynlst.append("string3 more");
dynlst.append("string4 done");
{
CStringList inC(dynlst);
Info<< "input: " << dynlst << endl;
Info<< "input: " << dynlst << nl;
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;
print(argc, argv);
Info<< nl;
{
dynlst.clear();
for (int i=0; i<argc; ++i)

View File

@ -41,7 +41,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("file");
argList::addArgument("file");
#include "setRootCase.H"
if (!Pstream::parRun())

View File

@ -43,7 +43,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.insert("dict .. dictN");
argList::addArgument("dict .. dictN");
argList args(argc, argv, false, true);
{

View File

@ -51,7 +51,7 @@ int main(int argc, char *argv[])
argList::addBoolOption("info", "report token info");
argList::addBoolOption("value", "report token value");
argList::validArgs.insert("dict .. dictN");
argList::addArgument("dict .. dictN");
argList args(argc, argv, false, true);
const bool optInfo = args.optionFound("info");

View File

@ -52,7 +52,7 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::validArgs.insert("fileName .. fileNameN");
argList::addArgument("fileName .. fileNameN");
argList args(argc, argv, false, true);

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
"list",
"List directories or files to be checked"
);
argList::validArgs.insert("file...");
argList::addArgument("file...");
argList::addNote
(

View File

@ -57,7 +57,7 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol)
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::validArgs.append("inflate (true|false)");
argList::addArgument("inflate (true|false)");
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::validArgs.insert("fileName .. fileNameN");
argList::addArgument("fileName .. fileNameN");
argList::addOption("istream", "file", "test Istream values");
argList args(argc, argv, false, true);

View File

@ -37,7 +37,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("point (x y z)");
argList::addArgument("point (x y z)");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -58,7 +58,7 @@ bool notEqual(const scalar s1, const scalar s2, const scalar tol)
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::validArgs.append("inflate (true|false)");
argList::addArgument("inflate (true|false)");
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

View File

@ -39,7 +39,7 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.insert("start size .. startN sizeN");
argList::addArgument("start size .. startN sizeN");
argList::addOption("verbose");
argList::addNote
(

View File

@ -40,7 +40,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
const int n = 10000000;
const char* const memTags = "peak/size/rss mem: ";
const char* const memTags = "peak/size/rss/free mem: ";
memInfo mem;

View File

@ -37,7 +37,7 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::validArgs.insert("file .. fileN");
argList::addArgument("file .. fileN");
argList::removeOption("case");
argList::addOption("ext", "bak");

View File

@ -158,7 +158,7 @@ int main(int argc, char *argv[])
"skip",
"skip some parts"
);
argList::validArgs.append("recursive (true|false)");
argList::addArgument("recursive (true|false)");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -36,7 +36,7 @@ Description
int main(int argc, char *argv[])
{
argList::validArgs.append("cloud");
argList::addArgument("cloud");
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

View File

@ -44,7 +44,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::validArgs.append("patch");
argList::addArgument("patch");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -212,7 +212,7 @@ void writeFaceFaces
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("patch");
argList::addArgument("patch");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -32,6 +32,7 @@ bodies
type sphere;
mass 1;
radius 0.05;
centreOfMass (0 10 0);
transform (1 0 0 0 1 0 0 0 1) (0 -1 0);
mergeWith hinge;
}

View File

@ -14,6 +14,7 @@ bodies
parent root;
mass 6e4;
radius 0.01;
centreOfMass (0 0 0);
transform (1 0 0 0 1 0 0 0 1) (0 0 0);
joint
{
@ -37,6 +38,7 @@ bodies
parent M;
mass 6e3;
radius 0.01;
centreOfMass (0 0 0);
transform (1 0 0 0 1 0 0 0 1) (0 -5 0);
mergeWith M;
}

View File

@ -46,7 +46,7 @@ inline Ostream& printPoint(Ostream& os, const point& p)
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.insert("file .. fileN");
argList::addArgument("file .. fileN");
argList::addBoolOption("B", "B-Spline implementation");
argList::addBoolOption("CMR", "catmull-rom spline (default)");
argList::addOption

View File

@ -62,6 +62,18 @@ int main(int argc, char *argv[])
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:"
<< unsigned(string::hash()(test)) << endl;

View File

@ -71,6 +71,18 @@ int main(int argc, char *argv[])
"string",
"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
(
"slash",
@ -81,6 +93,11 @@ int main(int argc, char *argv[])
"space",
"test split on space"
);
argList::addBoolOption
(
"empty",
"preserve empty strings in split"
);
argList args(argc, argv, false, true);
if (args.size() <= 1 && args.options().empty())
@ -88,8 +105,10 @@ int main(int argc, char *argv[])
args.printUsage();
}
const bool keepEmpty = args.optionFound("empty");
int nopts = 0;
for (auto optName : { "any", "slash", "space", "sub" })
for (auto optName : { "any", "slash", "space", "sub", "fixed", "char" })
{
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
if (!nopts || args.optionFound("slash"))
{
const char delim = '/';
Info<< "split on slash" << nl
<< "~~~~~~~~~~~~~~" << nl;
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);
}
}

View File

@ -122,8 +122,8 @@ int main(int argc, char *argv[])
);
argList::noParallel();
argList::noFunctionObjects();
argList::validArgs.append("surface file");
argList::validArgs.append("surface file");
argList::addArgument("surface file");
argList::addArgument("surface file");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -86,8 +86,8 @@ int main(int argc, char *argv[])
);
argList::noParallel();
argList::validArgs.append("inputFile");
argList::validArgs.append("outputFile");
argList::addArgument("inputFile");
argList::addArgument("outputFile");
argList::addBoolOption
(

View File

@ -30,6 +30,7 @@ Description
#include "profilingSysInfo.H"
#include "IOstreams.H"
#include "endian.H"
#include "cpuInfo.H"
using namespace Foam;
@ -38,7 +39,9 @@ using namespace Foam;
int main(int argc, char *argv[])
{
profiling::sysInfo().write(Info);
profilingSysInfo().write(Info);
cpuInfo().write(Info);
#ifdef WM_BIG_ENDIAN
Info

View File

@ -44,7 +44,7 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::validArgs.insert("string .. stringN");
argList::addArgument("string .. stringN");
argList::addOption("file", "name");
argList::addOption("repeat", "count");
argList::addBoolOption("verbose", "report for each repeat");

View File

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

View File

@ -1,9 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(CCMIO_ARCH_PATH)/include
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-L$(CCMIO_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN) -lccmio
-lfiniteArea

View 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);
}
// ************************************************************************* //

View File

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

View File

@ -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

View 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);
}
// ************************************************************************* //

View File

@ -166,7 +166,7 @@ int main(int argc, char *argv[])
{
meshFilterPtr.set
meshFilterPtr.reset
(
new polyMeshFilter(mesh, pointPriority, collapseDict)
);

View File

@ -349,7 +349,7 @@ int main(int argc, char *argv[])
{
#include "addOverwriteOption.H"
argList::validArgs.append("featureAngle [0..180]");
argList::addArgument("featureAngle [0..180]");
argList::addOption
(
"concaveAngle",

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
{
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::validArgs.append("cellSet");
argList::addArgument("cellSet");
argList::addBoolOption
(
"minSet",

View File

@ -62,8 +62,8 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addOverwriteOption.H"
argList::validArgs.append("patches");
argList::validArgs.append("edgeFraction");
argList::addArgument("patches");
argList::addArgument("edgeFraction");
argList::addOption
(

View File

@ -54,7 +54,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addOverwriteOption.H"
argList::validArgs.append("faceSet");
argList::addArgument("faceSet");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -52,7 +52,7 @@ Description
#include "polyMesh.H"
#include "cellCuts.H"
#include "cellSet.H"
#include "cellModeller.H"
#include "cellModel.H"
#include "meshCutter.H"
#include "unitConversion.H"
#include "geomCellLooper.H"
@ -387,7 +387,7 @@ void collectCuts
const vectorField& faceAreas = mesh.faceAreas();
// Hex shape
const cellModel& hex = *(cellModeller::lookup("hex"));
const cellModel& hex = cellModel::ref(cellModel::HEX);
// cut handling functions
edgeVertex ev(mesh);
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
);
#include "addOverwriteOption.H"
argList::noParallel();
argList::validArgs.append("edgeAngle [0..360]");
argList::addArgument("edgeAngle [0..360]");
argList::addOption
(

View File

@ -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
#------------------------------------------------------------------------------

View File

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

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