- the timeSelector is often used to select single or multiple times (eg, for post-processing). However, there are a few applications where only a *single* time should be selected and set. These are now covered by this type of use: timeSelector::addOptions_singleTime(); // Single-time options ... // Allow override of time from specified time options, or no-op timeSelector::setTimeIfPresent(runTime, args); In some cases, if can be desirable to force starting from the initial Time=0 when no time options have been specified: // Set time from specified time options, or force start from Time=0 timeSelector::setTimeIfPresent(runTime, args, true); These changes make a number of includes redundant: * addTimeOptions.H * checkConstantOption.H * checkTimeOption.H * checkTimeOptions.H * checkTimeOptionsNoConstant.H ENH: add time handling to setFields, setAlphaField (#3143) Co-authored-by: Johan Roenby <> STYLE: replace instant("constant") with instant(0, "constant") - avoids relying on atof parse behaviour returning zero
129 lines
3.5 KiB
C
129 lines
3.5 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | www.openfoam.com
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
-------------------------------------------------------------------------------
|
|
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
|
|
testMappedPatch
|
|
|
|
Description
|
|
Test mapped b.c. by mapping face centres (mesh.C().boundaryField()).
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
#include "argList.H"
|
|
#include "fvMesh.H"
|
|
#include "volFields.H"
|
|
#include "meshTools.H"
|
|
#include "Time.H"
|
|
#include "OFstream.H"
|
|
#include "mappedPolyPatch.H"
|
|
#include "mappedFixedValueFvPatchFields.H"
|
|
#include "fvCFD.H"
|
|
|
|
using namespace Foam;
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
// Main program:
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#include "setRootCase.H"
|
|
#include "createTime.H"
|
|
#include "createMesh.H"
|
|
|
|
wordList patchFieldTypes
|
|
(
|
|
mesh.boundaryMesh().size(),
|
|
fvPatchFieldBase::calculatedType()
|
|
);
|
|
|
|
forAll(mesh.boundaryMesh(), patchi)
|
|
{
|
|
if (isA<mappedPolyPatch>(mesh.boundaryMesh()[patchi]))
|
|
{
|
|
patchFieldTypes[patchi] =
|
|
mappedFixedValueFvPatchVectorField::typeName;
|
|
}
|
|
}
|
|
|
|
Pout<< "patchFieldTypes:" << patchFieldTypes << endl;
|
|
|
|
volVectorField cc
|
|
(
|
|
IOobject
|
|
(
|
|
"cc",
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::NO_READ,
|
|
IOobject::AUTO_WRITE
|
|
),
|
|
mesh,
|
|
dimensionedVector(dimLength, Zero),
|
|
patchFieldTypes
|
|
);
|
|
|
|
cc.primitiveFieldRef() = mesh.C().primitiveField();
|
|
cc.boundaryFieldRef().updateCoeffs();
|
|
|
|
forAll(cc.boundaryField(), patchi)
|
|
{
|
|
if
|
|
(
|
|
isA<mappedFixedValueFvPatchVectorField>
|
|
(
|
|
cc.boundaryField()[patchi]
|
|
)
|
|
)
|
|
{
|
|
Pout<< "Detected a mapped patch:" << patchi << endl;
|
|
|
|
OFstream str(mesh.boundaryMesh()[patchi].name() + ".obj");
|
|
Pout<< "Writing mapped values to " << str.name() << endl;
|
|
|
|
label vertI = 0;
|
|
const fvPatchVectorField& fvp = cc.boundaryField()[patchi];
|
|
|
|
forAll(fvp, i)
|
|
{
|
|
meshTools::writeOBJ(str, fvp.patch().Cf()[i]);
|
|
vertI++;
|
|
meshTools::writeOBJ(str, fvp[i]);
|
|
vertI++;
|
|
str << "l " << vertI-1 << ' ' << vertI << nl;
|
|
}
|
|
}
|
|
}
|
|
|
|
Info<< "End\n" << endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|