Backported containers and function objects. Henrik Rusche

This commit is contained in:
Hrvoje Jasak 2018-02-19 11:38:59 +00:00
commit 0b511b8ae6
1032 changed files with 75068 additions and 8870 deletions

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"turbulenceProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -23,7 +23,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -39,7 +39,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -50,10 +50,12 @@ PDRkEpsilon::PDRkEpsilon
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View file

@ -112,7 +112,9 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);
@ -123,11 +125,6 @@ public:
// Member Functions
tmp<volScalarField> mut() const
{
return mut_;
}
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
@ -146,6 +143,18 @@ public:
);
}
//- Return the turbulence viscosity
virtual tmp<volScalarField> mut() const
{
return mut_;
}
//- Return the turbulence thermal diffusivity
virtual tmp<volScalarField> alphat() const
{
return alphat_;
}
//- Return the effective turbulent thermal diffusivity
tmp<volScalarField> alphaEff() const
{

View file

@ -110,7 +110,7 @@
"PDRProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"combustionProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"combustionProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@ IOdictionary combustionProperties
"combustionProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -65,7 +65,7 @@ IOdictionary combustionProperties
"combustionProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@ IOdictionary chemistryProperties
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -7,7 +7,7 @@ IOdictionary chemistryProperties
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -9,7 +9,7 @@ IOdictionary thermophysicalProperties
"thermophysicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -69,7 +69,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"physicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"financialProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -5,7 +5,7 @@ IOdictionary transportProperties
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -21,7 +21,7 @@ IOdictionary transportProperties
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
This file is part of foam-extend.
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.
foam-extend 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.
foam-extend 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/>.
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Application
RichardsFoam

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\/ M anipulation |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
This file is part of foam-extend.
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.
foam-extend 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.
foam-extend 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/>.
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Global
setDeltaT

View file

@ -1,25 +1,25 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
This file is part of foam-extend.
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.
foam-extend 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.
foam-extend 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/>.
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Application
spatialMeanValue

View file

@ -6,7 +6,7 @@
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::AUTO_WRITE
),
mesh
@ -44,7 +44,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -6,7 +6,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@ IOdictionary gravitationalProperties
"gravitationalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@ IOdictionary chemistryProperties
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -7,7 +7,7 @@ IOdictionary chemistryProperties
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -7,7 +7,7 @@ IOdictionary chemistryProperties
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -39,7 +39,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -91,7 +91,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -5,7 +5,7 @@
"RASProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -43,7 +43,7 @@ Foam::phaseChangeTwoPhaseMixture::New
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)

View file

@ -50,7 +50,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -5,7 +5,7 @@
"ppProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -8,7 +8,7 @@
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::AUTO_WRITE
),
mesh
@ -23,7 +23,7 @@
"mechanicalProperties",
"constant",
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -6,7 +6,7 @@
"couplingProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"mechanicalProperties",
runTime.constant(),
stressMesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"mechanicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"mechanicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"thermalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -6,7 +6,7 @@
"couplingProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -7,7 +7,7 @@
"mechanicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -28,7 +28,7 @@
"mrfProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

View file

@ -285,7 +285,7 @@ bool Foam::bubbleHistory::start()
}
bool Foam::bubbleHistory::execute()
bool Foam::bubbleHistory::execute(const bool forceWrite)
{
const fvMesh& mesh =
time_.lookupObject<fvMesh>(regionName_);
@ -401,6 +401,11 @@ bool Foam::bubbleHistory::execute()
}
bool Foam::bubbleHistory::setTime()
{
return true;
}
bool Foam::bubbleHistory::read(const dictionary& dict)
{
if (dict.found("region"))

View file

@ -109,10 +109,21 @@ public:
virtual bool start();
//- execute is called at each ++ or += of the time-loop
virtual bool execute();
virtual bool execute(const bool forceWrite);
//- Called when time was set at the end of the Time::operator++
virtual bool setTime();
//- Read and set the function object if its data has changed
virtual bool read(const dictionary& dict);
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};

View file

@ -186,7 +186,7 @@ bool Foam::sloshingHistory::start()
}
bool Foam::sloshingHistory::execute()
bool Foam::sloshingHistory::execute(const bool forceWrite)
{
const fvMesh& mesh =
time_.lookupObject<fvMesh>(regionName_);
@ -209,6 +209,12 @@ bool Foam::sloshingHistory::execute()
}
bool Foam::sloshingHistory::setTime()
{
return true;
}
bool Foam::sloshingHistory::read(const dictionary& dict)
{
if (dict.found("region"))

View file

@ -114,10 +114,21 @@ public:
virtual bool start();
//- execute is called at each ++ or += of the time-loop
virtual bool execute();
virtual bool execute(const bool forceWrite);
//- Called when time was set at the end of the Time::operator++
virtual bool setTime();
//- Read and set the function object if its data has changed
virtual bool read(const dictionary& dict);
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};

View file

@ -14,5 +14,4 @@ EXE_LIBS = \
-lmeshTools \
-ldynamicMesh \
-ldynamicFvMesh \
-lautoMesh \
-L$(MESQUITE_LIB_DIR) -lmesquite
-lautoMesh

View file

@ -46,6 +46,7 @@ Description
#include "mapPolyMesh.H"
#include "directTopoChange.H"
#include "polyModifyFace.H"
#include "wordReList.H"
using namespace Foam;
@ -698,7 +699,10 @@ int main(int argc, char *argv[])
if (sourceType == "patches")
{
labelHashSet patchSources(patches.patchSet(dict.lookup("patches")));
labelHashSet patchSources
(
patches.patchSet(wordReList(dict.lookup("patches")))
);
// Repatch faces of the patches.
forAllConstIter(labelHashSet, patchSources, iter)

View file

@ -95,7 +95,7 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class GeoField>
void addPatchFields(fvMesh& mesh, const word& patchFieldType)
void addPatchFields(const fvMesh& mesh, const word& patchFieldType)
{
HashTable<const GeoField*> flds
(
@ -136,7 +136,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType)
// Remove last patch field
template<class GeoField>
void trimPatchFields(fvMesh& mesh, const label nPatches)
void trimPatchFields(const fvMesh& mesh, const label nPatches)
{
HashTable<const GeoField*> flds
(
@ -163,7 +163,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches)
// Reorder patch field
template<class GeoField>
void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
void reorderPatchFields(const fvMesh& mesh, const labelList& oldToNew)
{
HashTable<const GeoField*> flds
(

View file

@ -90,7 +90,7 @@ int main(int argc, char *argv[])
// Set all times on processor meshes equal to decomposed mesh
forAll (databases, procI)
{
databases[procI].setTime(runTime.timeName(), runTime.timeIndex());
databases[procI].setTime(runTime, runTime.timeIndex());
}
// Read all meshes and addressing to reconstructed mesh

View file

@ -51,7 +51,7 @@ Description
int main(int argc, char *argv[])
{
// enable -constant ... if someone really wants it
// enable -zeroTime to prevent accidentally trashing the initial fields
// enable -noZero to prevent accidentally trashing the initial fields
timeSelector::addOptions(true, true);
argList::noParallel();
# include "addRegionOption.H"
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
// Set all times on processor meshes equal to reconstructed mesh
forAll (databases, procI)
{
databases[procI].setTime(runTime.timeName(), runTime.timeIndex());
databases[procI].setTime(runTime, runTime.timeIndex());
}
// Read all meshes and addressing to reconstructed mesh

View file

@ -50,8 +50,8 @@ Description
int main(int argc, char *argv[])
{
// enable -constant ... if someone really wants it
// enable -zeroTime to prevent accidentally trashing the initial fields
// disable -constant
// enable -noZero to prevent accidentally trashing the initial fields
timeSelector::addOptions(false, true);
argList::noParallel();
# include "addRegionOption.H"
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
{
Info<< "Reading database for processor " << procI << endl;
databases[procI].setTime(runTime.timeName(), runTime.timeIndex());
databases[procI].setTime(runTime, runTime.timeIndex());
}
// Read all meshes and addressing to reconstructed mesh

View file

@ -74,7 +74,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
// enable -constant
// probably don't need -zeroTime though, since the fields are vetted
// probably don't need -noZero though, since the fields are vetted
// afterwards anyhow
timeSelector::addOptions(true, false);
argList::noParallel();

View file

@ -22,12 +22,14 @@ LINK_DIRECTORIES(
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV3Foam
)
ADD_DEFINITIONS(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
)
# Set output library destination to plugin folder

View file

@ -22,12 +22,14 @@ LINK_DIRECTORIES(
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/foam/lnInclude
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV4Foam
)
ADD_DEFINITIONS(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
)
# Set output library destination to plugin folder

View file

@ -18,11 +18,16 @@ SET(PVFoamReader_LIBS
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
$ENV{ParaView_INST_DIR}/include
../vtkFoam/lnInclude
)
ADD_DEFINITIONS(-DWM_$ENV{WM_PRECISION_OPTION})
ADD_DEFINITIONS(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
)
#-----------------------------------------------------------------------------
# Most users should not need to change anything below this line.

View file

@ -55,7 +55,7 @@ void parseOptions
token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::FATALERROR)
if (nextOption.type() == token::ERROR)
{
break;
}
@ -89,7 +89,7 @@ void parseOptions
token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::FATALERROR)
if (nextOption.type() == token::ERROR)
{
break;
}

View file

@ -49,7 +49,7 @@ int main(int argc, char *argv[])
(
probes::typeName,
mesh,
"probesDict",
word("probesDict"),
IOobject::MUST_READ,
true
);

View file

@ -106,7 +106,7 @@ int main(int argc, char *argv[])
(
sampledSets::typeName,
mesh,
"sampleDict",
word("sampleDict"),
IOobject::MUST_READ,
true
);
@ -115,7 +115,7 @@ int main(int argc, char *argv[])
(
sampledSurfaces::typeName,
mesh,
"sampleDict",
word("sampleDict"),
IOobject::MUST_READ,
true
);

View file

@ -29,10 +29,10 @@ Description
type in the field and polyMesh/boundary files.
Reads dictionaries (fields) and entries to change from a dictionary.
E.g. to make the @em movingWall a @em fixedValue for @em p but all other
@em Walls a zeroGradient boundary condition, the
@c system/changeDictionaryDict would contain the following:
@verbatim
E.g. to make the \em movingWall a \em fixedValue for \em p but all other
\em Walls a zeroGradient boundary condition, the
\c system/changeDictionaryDict would contain the following:
\verbatim
dictionaryReplacement
{
p // field to change
@ -51,15 +51,22 @@ Description
}
}
}
@endverbatim
\endverbatim
Replacement entries starting with '~' will remove the entry.
Usage
- changeDictionary [OPTION]
@param -literalRE \n
Do not interpret regular expressions; treat them as any other keyword.
\param -literalRE \n
Do not interpret regular expressions or patchGroups;
treat them as any other keyword.
\param -enableFunctionEntries \n
By default all dictionary preprocessing of fields is disabled
\param -disablePatchGroups \n
By default all keys are also checked for being patchGroups
\*---------------------------------------------------------------------------*/
@ -68,6 +75,7 @@ Usage
#include "IOPtrList.H"
#include "volFields.H"
#include "stringListOps.H"
#include "timeSelector.H"
using namespace Foam;
@ -81,7 +89,47 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool merge(dictionary&, const dictionary&, const bool);
// Extract groupPatch (= shortcut) info from boundary file info
HashTable<wordList, word> extractPatchGroups(const dictionary& boundaryDict)
{
HashTable<wordList, word> groupToPatch;
forAllConstIter(dictionary, boundaryDict, iter)
{
const word& patchName = iter().keyword();
const dictionary& patchDict = iter().dict();
wordList groups;
if (patchDict.readIfPresent("inGroups", groups))
{
forAll(groups, i)
{
HashTable<wordList, word>::iterator fndGroup = groupToPatch.find
(
groups[i]
);
if (fndGroup == groupToPatch.end())
{
groupToPatch.insert(groups[i], wordList(1, patchName));
}
else
{
fndGroup().append(patchName);
}
}
}
}
return groupToPatch;
}
bool merge
(
dictionary&,
const dictionary&,
const bool,
const HashTable<wordList, word>&
);
// Add thisEntry to dictionary thisDict.
@ -90,7 +138,8 @@ bool addEntry
dictionary& thisDict,
entry& thisEntry,
const entry& mergeEntry,
const bool literalRE
const bool literalRE,
const HashTable<wordList, word>& shortcuts
)
{
bool changed = false;
@ -105,7 +154,8 @@ bool addEntry
(
const_cast<dictionary&>(thisEntry.dict()),
mergeEntry.dict(),
literalRE
literalRE,
shortcuts
)
)
{
@ -123,6 +173,46 @@ bool addEntry
}
// List of indices into thisKeys
labelList findMatches
(
const HashTable<wordList, word>& shortcuts,
const wordList& shortcutNames,
const wordList& thisKeys,
const keyType& key
)
{
labelList matches;
if (key.isPattern())
{
// Wildcard match
matches = findStrings(key, thisKeys);
}
else if (shortcuts.size())
{
// See if patchGroups expand to valid thisKeys
labelList indices = findStrings(key, shortcutNames);
forAll(indices, i)
{
const word& name = shortcutNames[indices[i]];
const wordList& keys = shortcuts[name];
forAll(keys, j)
{
label index = findIndex(thisKeys, keys[j]);
if (index != -1)
{
matches.append(index);
}
}
}
}
return matches;
}
// Dictionary merging/editing.
// literalRE:
// - true: behave like dictionary::merge, i.e. add regexps just like
@ -132,10 +222,11 @@ bool merge
(
dictionary& thisDict,
const dictionary& mergeDict,
const bool literalRE
const bool literalRE,
const HashTable<wordList, word>& shortcuts
)
{
bool wildCardInMergeDict = false;
const wordList shortcutNames(shortcuts.toc());
bool changed = false;
@ -155,7 +246,18 @@ bool merge
{
const keyType& key = mergeIter().keyword();
if (literalRE || !key.isPattern())
if (key[0] == '~')
{
word eraseKey = key(1, key.size()-1);
if (thisDict.remove(eraseKey))
{
// Mark thisDict entry as having been match for wildcard
// handling later on.
thisKeysSet.erase(eraseKey);
}
changed = true;
}
else if (literalRE || !(key.isPattern() || shortcuts.found(key)))
{
entry* entryPtr = thisDict.lookupEntryPtr
(
@ -178,7 +280,8 @@ bool merge
thisDict,
*entryPtr,
mergeIter(),
literalRE
literalRE,
shortcuts
)
)
{
@ -195,42 +298,63 @@ bool merge
}
// Pass 2. Wildcard matches (if any) on any non-match keys.
// Pass 2. Wildcard or shortcut matches (if any) on any non-match keys.
if (!literalRE && thisKeysSet.size() > 0)
{
// Pick up remaining dictionary entries
wordList thisKeys(thisKeysSet.toc());
forAllConstIter(IDLList<entry>, mergeDict, mergeIter)
{
const keyType& key = mergeIter().keyword();
if (key.isPattern())
if (key[0] == '~')
{
// Find all matching entries in the original thisDict
word eraseKey = key(1, key.size()-1);
if (!wildCardInMergeDict)
{
wildCardInMergeDict = true;
WarningIn("changeDictionary()")
<< "Detected wildcard " << key
<< " in changeDictionaryDict" << endl
<< "The behaviour of wildcards has changed -"
<< " they are now interpreted by changeDictionary."
<< endl << "Please take care or use the -literalRE"
<< " command line option to revert to"
<< " previous behaviour." << endl;
}
labelList matches = findStrings(key, thisKeys);
// List of indices into thisKeys
labelList matches
(
findMatches
(
shortcuts,
shortcutNames,
thisKeys,
eraseKey
)
);
// Remove all matches
forAll(matches, i)
{
label matchI = matches[i];
const word& thisKey = thisKeys[matches[i]];
thisKeysSet.erase(thisKey);
}
changed = true;
}
else
{
// List of indices into thisKeys
labelList matches
(
findMatches
(
shortcuts,
shortcutNames,
thisKeys,
key
)
);
// Add all matches
forAll(matches, i)
{
const word& thisKey = thisKeys[matches[i]];
entry& thisEntry = const_cast<entry&>
(
thisDict.lookupEntry(thisKeys[matchI], false, false)
thisDict.lookupEntry(thisKey, false, false)
);
if
@ -240,7 +364,9 @@ bool merge
thisDict,
thisEntry,
mergeIter(),
literalRE
literalRE,
HashTable<wordList, word>(0) // no shortcuts
// at deeper levels
)
)
{
@ -255,20 +381,54 @@ bool merge
}
// Main program:
int main(int argc, char *argv[])
{
argList::validOptions.insert("instance", "instance");
argList::validOptions.insert("literalRE", "");
#include "addDictOption.H"
argList::addOption
(
"instance",
"name",
"override instance setting (default is the time name)"
);
// Add explicit time option
timeSelector::addOptions();
argList::addBoolOption
(
"literalRE",
"treat regular expressions literally (i.e., as a keyword)"
);
argList::addBoolOption
(
"enableFunctionEntries",
"enable expansion of dictionary directives - #include, #codeStream etc"
);
argList::addBoolOption
(
"disablePatchGroups",
"disable matching keys to patch groups"
);
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
// Optionally override controlDict time with -time options
instantList times = timeSelector::selectIfPresent(runTime, args);
if (times.size() < 1)
{
FatalErrorIn(args.executable())
<< "No times selected." << exit(FatalError);
}
runTime.setTime(times[0], 0);
word instance = args.optionLookupOrDefault("instance", runTime.timeName());
#include "createNamedMesh.H"
bool literalRE = args.optionFound("literalRE");
const bool literalRE = args.optionFound("literalRE");
if (literalRE)
{
Info<< "Not interpreting any regular expressions (RE)"
@ -277,6 +437,29 @@ int main(int argc, char *argv[])
<< " not present." << endl;
}
const bool enableEntries = args.optionFound("enableFunctionEntries");
if (enableEntries)
{
Info<< "Allowing dictionary preprocessing ('#include', '#codeStream')."
<< endl;
}
int oldFlag = entry::disableFunctionEntries();
if (!enableEntries)
{
// By default disable dictionary expansion for fields
entry::disableFunctionEntries = 1;
}
const bool disablePatchGroups = args.optionFound("disablePatchGroups");
if (disablePatchGroups)
{
Info<< "Not interpreting any keys in the changeDictionary"
<< " as patchGroups"
<< endl;
}
fileName regionPrefix = "";
if (regionName != fvMesh::defaultRegion)
@ -284,30 +467,88 @@ int main(int argc, char *argv[])
regionPrefix = regionName;
}
word instance = runTime.timeName();
if (args.options().found("instance"))
{
instance = args.options()["instance"];
}
// Make sure we do not use the master-only reading since we read
// fields (different per processor) as dictionaries.
regIOobject::fileModificationChecking = regIOobject::timeStamp;
// Get the replacement rules from a dictionary
IOdictionary dict
(
IOobject
(
"changeDictionaryDict",
runTime.system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const word dictName("changeDictionaryDict");
#include "setSystemMeshDictionaryIO.H"
IOdictionary dict(dictIO);
const dictionary& replaceDicts = dict.subDict("dictionaryReplacement");
Info<< "Read dictionary " << dict.name()
<< " with replacements for dictionaries "
<< replaceDicts.toc() << endl;
// Always read boundary to get patch groups
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Info<< "Reading polyMesh/boundary file to extract patch names"
<< endl;
// Read PtrList of dictionary as dictionary.
const word oldTypeName = IOPtrList<entry>::typeName;
const_cast<word&>(IOPtrList<entry>::typeName) = word::null;
IOPtrList<entry> dictList
(
IOobject
(
"boundary",
runTime.findInstance
(
regionPrefix/polyMesh::meshSubDir,
"boundary",
IOobject::READ_IF_PRESENT
),
polyMesh::meshSubDir,
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(dictList.type()) = dictList.headerClassName();
// Temporary convert to dictionary
dictionary fieldDict;
forAll(dictList, i)
{
fieldDict.add(dictList[i].keyword(), dictList[i].dict());
}
if (dictList.size())
{
Info<< "Loaded dictionary " << dictList.name()
<< " with entries " << fieldDict.toc() << endl;
}
// Extract any patchGroups information (= shortcut for set of
// patches)
HashTable<wordList, word> patchGroups;
if (!disablePatchGroups)
{
patchGroups = extractPatchGroups(fieldDict);
if (patchGroups.size())
{
Info<< "Extracted patch groups:" << endl;
wordList groups(patchGroups.sortedToc());
forAll(groups, i)
{
Info<< " group " << groups[i] << " with patches "
<< patchGroups[groups[i]] << endl;
}
}
}
// Every replacement is a dictionary name and a keyword in this
forAllConstIter(dictionary, replaceDicts, fieldIter)
@ -323,46 +564,12 @@ int main(int argc, char *argv[])
Info<< "Special handling of " << fieldName
<< " as polyMesh/boundary file." << endl;
// Read PtrList of dictionary as dictionary.
const word oldTypeName = IOPtrList<entry>::typeName;
const_cast<word&>(IOPtrList<entry>::typeName) = word::null;
IOPtrList<entry> dictList
(
IOobject
(
fieldName,
runTime.findInstance
(
regionPrefix/polyMesh::meshSubDir,
fieldName
),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(dictList.type()) = dictList.headerClassName();
// Temporary convert to dictionary
dictionary fieldDict;
forAll(dictList, i)
{
fieldDict.add(dictList[i].keyword(), dictList[i].dict());
}
Info<< "Loaded dictionary " << fieldName
<< " with entries " << fieldDict.toc() << endl;
// Get the replacement dictionary for the field
const dictionary& replaceDict = fieldIter().dict();
Info<< "Merging entries from " << replaceDict.toc() << endl;
// Merge the replacements in
merge(fieldDict, replaceDict, literalRE);
merge(fieldDict, replaceDict, literalRE, patchGroups);
Info<< "fieldDict:" << fieldDict << endl;
@ -370,6 +577,7 @@ int main(int argc, char *argv[])
wordList doneKeys(dictList.size());
label nEntries = fieldDict.size();
forAll(dictList, i)
{
doneKeys[i] = dictList[i].keyword();
@ -385,16 +593,22 @@ int main(int argc, char *argv[])
);
fieldDict.remove(doneKeys[i]);
}
// Add remaining entries
label sz = dictList.size();
dictList.setSize(nEntries);
forAllConstIter(dictionary, fieldDict, iter)
{
dictList.set(sz, iter().clone());
dictList.set(sz++, iter().clone());
}
Info<< "Writing modified fieldDict " << fieldName << endl;
dictList.write();
Info<< "Writing modified " << fieldName << endl;
dictList.writeObject
(
runTime.writeFormat(),
runTime.writeFormat(),
IOstream::UNCOMPRESSED
);
}
else
{
@ -411,11 +625,12 @@ int main(int argc, char *argv[])
fieldName,
instance,
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
@ -428,13 +643,15 @@ int main(int argc, char *argv[])
Info<< "Merging entries from " << replaceDict.toc() << endl;
// Merge the replacements in
merge(fieldDict, replaceDict, literalRE);
merge(fieldDict, replaceDict, literalRE, patchGroups);
Info<< "Writing modified fieldDict " << fieldName << endl;
fieldDict.regIOobject::write();
}
}
entry::disableFunctionEntries = oldFlag;
Info<< endl;
Info<< "End\n" << endl;

View file

@ -20,7 +20,7 @@ dictionaryReplacement
{
".*"
{
type directMappedPatch;
type mappedPatch;
}
}
@ -86,5 +86,4 @@ dictionaryReplacement
}
}
// ************************************************************************* //

View file

@ -47,7 +47,7 @@ export FOAM_DEV=1
#
# Location of FOAM installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamInstall=$HOME/$WM_PROJECT
foamInstall=$HOME/OpenFOAM
# foamInstall=~$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT
# foamInstall=/opt/$WM_PROJECT
@ -179,6 +179,9 @@ export WM_COMPILER_LIB_ARCH=
# WM_PRECISION_OPTION = LDP | DP | SP
: ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
# WM_LABEL_SIZE = 32 | 64
: ${WM_LABEL_SIZE:=32}; export WM_LABEL_SIZE
# WM_COMPILE_OPTION = Opt | Debug | Prof
: ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION

240
etc/codeTemplates/BC/BC.C Normal file
View file

@ -0,0 +1,240 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CONSTRUCT.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
Foam::scalar Foam::CLASS::t() const
{
return this->db().time().timeOutputValue();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::CLASS::
CONSTRUCT
(
const fvPatch& p,
const DimensionedField<TYPE, volMesh>& iF
)
:
PARENT(p, iF),
scalarData_(0.0),
data_(pTraits<TYPE>::zero),
fieldData_(p.size(), pTraits<TYPE>::zero),
timeVsData_(),
wordData_("wordDefault"),
labelData_(-1),
boolData_(false)
{
this->refValue() = pTraits<TYPE>::zero;
this->refGrad() = pTraits<TYPE>::zero;
this->valueFraction() = 0.0;
}
template<class Type>
Foam::CLASS::
CONSTRUCT
(
const fvPatch& p,
const DimensionedField<TYPE, volMesh>& iF,
const dictionary& dict
)
:
PARENT(p, iF),
scalarData_(readScalar(dict.lookup("scalarData"))),
data_(pTraits<TYPE>(dict.lookup("data"))),
fieldData_("fieldData", dict, p.size()),
timeVsData_(DataEntry<TYPE>::New("timeVsData", dict)),
wordData_(dict.lookupOrDefault<word>("wordName", "wordDefault")),
labelData_(-1),
boolData_(false)
{
this->refGrad() = pTraits<TYPE>::zero;
this->valueFraction() = 0.0;
this->refValue() = FIELD("fieldData", dict, p.size());
FVPATCHF::operator=(this->refValue());
PARENT::evaluate();
/*
//Initialise with the value entry if evaluation is not possible
FVPATCHF::operator=
(
FIELD("value", dict, p.size())
);
this->refValue() = *this;
*/
}
template<class Type>
Foam::CLASS::
CONSTRUCT
(
const CLASS& ptf,
const fvPatch& p,
const DimensionedField<TYPE, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
PARENT(ptf, p, iF, mapper),
scalarData_(ptf.scalarData_),
data_(ptf.data_),
fieldData_(ptf.fieldData_, mapper),
timeVsData_(ptf.timeVsData_, false),
wordData_(ptf.wordData_),
labelData_(-1),
boolData_(ptf.boolData_)
{}
template<class Type>
Foam::CLASS::
CONSTRUCT
(
const CLASS& ptf
)
:
PARENT(ptf),
scalarData_(ptf.scalarData_),
data_(ptf.data_),
fieldData_(ptf.fieldData_),
timeVsData_(ptf.timeVsData_, false),
wordData_(ptf.wordData_),
labelData_(-1),
boolData_(ptf.boolData_)
{}
template<class Type>
Foam::CLASS::
CONSTRUCT
(
const CLASS& ptf,
const DimensionedField<TYPE, volMesh>& iF
)
:
PARENT(ptf, iF),
scalarData_(ptf.scalarData_),
data_(ptf.data_),
fieldData_(ptf.fieldData_),
timeVsData_(ptf.timeVsData_, false),
wordData_(ptf.wordData_),
labelData_(-1),
boolData_(ptf.boolData_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::CLASS::autoMap
(
const fvPatchFieldMapper& m
)
{
PARENT::autoMap(m);
fieldData_.autoMap(m);
}
template<class Type>
void Foam::CLASS::rmap
(
const FVPATCHF& ptf,
const labelList& addr
)
{
PARENT::rmap(ptf, addr);
const CLASS& tiptf =
refCast<const CLASS>(ptf);
fieldData_.rmap(tiptf.fieldData_, addr);
}
template<class Type>
void Foam::CLASS::updateCoeffs()
{
if (this->updated())
{
return;
}
PARENT::operator==
(
data_
+ fieldData_
+ scalarData_*timeVsData_->value(t())
);
const scalarField& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>("phi");
this->valueFraction() = 1.0 - pos(phip);
PARENT::updateCoeffs();
}
template<class Type>
void Foam::CLASS::write
(
Ostream& os
) const
{
FVPATCHF::write(os);
os.writeKeyword("scalarData") << scalarData_ << token::END_STATEMENT << nl;
os.writeKeyword("data") << data_ << token::END_STATEMENT << nl;
fieldData_.writeEntry("fieldData", os);
timeVsData_->writeData(os);
os.writeKeyword("wordData") << wordData_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
FVPATCHF,
CLASS
);
}
// ************************************************************************* //

246
etc/codeTemplates/BC/BC.H Normal file
View file

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CONSTRUCT
Group
grpGenericBoundaryConditions
Description
This boundary condition provides a NAME condition,
calculated as:
\f[
Q = Q_{0} + Q_{p} + s*Q_{t}
\f]
where
\vartable
s | single scalar value [units]
Q_{0} | single TYPE value [units]
Q_{p} | TYPE field across patch [units]
Q_{t} | TYPE function of time [units]
\endtable
\heading Patch usage
\table
Property | Description | Req'd? | Default
scalarData | single scalar value | yes |
data | single TYPE value | yes |
fieldData | TYPE field across patch | yes |
timeVsData | TYPE function of time | yes |
wordData | word, eg name of data object | no | wordDefault
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type NAME;
scalarData -1;
data ONE;
fieldData uniform THREE;
timeVsData table (
(0 ZERO)
(1 TWO)
);
wordName anotherName;
value uniform FOUR; // optional initial value
}
\endverbatim
SourceFiles
CONSTRUCT.C
\*---------------------------------------------------------------------------*/
#ifndef CONSTRUCT_H
#define CONSTRUCT_H
#include "BASEFvPatchFields.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CONSTRUCT Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class CONSTRUCT
:
public PARENT
{
// Private data
//- Single valued scalar quantity, e.g. a coefficient
scalar scalarData_;
//- Single valued Type quantity, e.g. reference pressure pRefValue_
// Other options include vector, tensor
TYPE data_;
//- Field of Types, typically defined across patch faces
// e.g. total pressure p0_. Other options include vectorField
FIELD fieldData_;
//- Type specified as a function of time for time-varying BCs
autoPtr<DataEntry<TYPE> > timeVsData_;
//- Word entry, e.g. pName_ for name of the pressure field on database
word wordData_;
//- Label, e.g. patch index, current time index
label labelData_;
//- Boolean for true/false, e.g. specify if flow rate is volumetric_
bool boolData_;
// Private Member Functions
//- Return current time
scalar t() const;
public:
//- Runtime type information
TypeName("NAME");
// Constructors
//- Construct from patch and internal field
CONSTRUCT
(
const fvPatch&,
const DimensionedField<TYPE, volMesh>&
);
//- Construct from patch, internal field and dictionary
CONSTRUCT
(
const fvPatch&,
const DimensionedField<TYPE, volMesh>&,
const dictionary&
);
//- Construct by mapping given BASETypeFvPatchField
// onto a new patch
CONSTRUCT
(
const CLASS&,
const fvPatch&,
const DimensionedField<TYPE, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
CONSTRUCT
(
const CLASS&
);
//- Construct and return a clone
virtual tmp<FVPATCHF> clone() const
{
return tmp<FVPATCHF>
(
new CLASS(*this)
);
}
//- Construct as copy setting internal field reference
CONSTRUCT
(
const CLASS&,
const DimensionedField<TYPE, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<FVPATCHF> clone
(
const DimensionedField<TYPE, volMesh>& iF
) const
{
return tmp<FVPATCHF>
(
new CLASS
(
*this,
iF
)
);
}
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const FVPATCHF&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CONSTRUCT.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -23,10 +23,9 @@ License
\*---------------------------------------------------------------------------*/
#include "objectRegistry.H"
#include "dxSurfaceWriter.H"
#include "surfaceWriters.H"
#include "CONSTRUCTs.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -35,7 +34,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(dxSurfaceWriter);
makePatchFields(NAME);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -23,23 +23,27 @@ License
\*---------------------------------------------------------------------------*/
#include "objectRegistry.H"
#include "rawSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H"
#ifndef CONSTRUCTs_H
#define CONSTRUCTs_H
#include "CONSTRUCT.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeSurfaceWriterType(rawSurfaceWriter, bool);
makeSurfaceWriters(rawSurfaceWriter);
makePatchTypeFieldTypedefs(NAME);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -23,23 +23,28 @@ License
\*---------------------------------------------------------------------------*/
#include "objectRegistry.H"
#include "nullSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H"
#ifndef CONSTRUCTsFwd_H
#define CONSTRUCTsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeSurfaceWriterType(nullSurfaceWriter, bool);
makeSurfaceWriters(nullSurfaceWriter);
template<class Type> class CONSTRUCT;
makePatchTypeFieldTypedefs(NAME);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
COMPILED.C
LIB = $(FOAM_USER_LIBBIN)/libNAME

View file

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools

View file

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

View file

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

View file

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Application
NAME
Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "FilterFunctionObjectTemplate.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
extern "C"
{
// dynamicCode:
// SHA1 = ${SHA1sum}
//
// unique function name that can be checked if the correct library version
// has been loaded
void ${typeName}_${SHA1sum}(bool load)
{
if (load)
{
// code that can be explicitly executed after loading
}
else
{
// code that can be explicitly executed before unloading
}
}
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(${typeName}FilterFunctionObject, 0);
//addToRunTimeSelectionTable
addToRunTimeSelectionTable
(
functionObject,
${typeName}FilterFunctionObject,
dictionary
);
}
// ************************************************************************* //

View file

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
FunctionObject wrapper around functionObjectTemplate to allow them
to be created via the functions entry within controlDict.
SourceFiles
FilterFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef FilterFunctionObject_H
#define FilterFunctionObject_H
#include "functionObjectTemplate.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<${typeName}FunctionObject>
${typeName}FilterFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOfunctionObjectTemplate
Description
Instance of the generic IOOutputFilter for ${typeName}FunctionObject.
\*---------------------------------------------------------------------------*/
#ifndef IOfunctionObjectTemplate_H
#define IOfunctionObjectTemplate_H
#include "functionObjectTemplate.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<${typeName}FunctionObject>
IO${typeName}FunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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