mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -31,7 +31,7 @@ if (solveSpecies)
|
|||||||
==
|
==
|
||||||
parcels.SYi(i, Yi)
|
parcels.SYi(i, Yi)
|
||||||
+ combustion->R(Yi)
|
+ combustion->R(Yi)
|
||||||
+ sources(Yi)
|
+ sources(rho, Yi)
|
||||||
);
|
);
|
||||||
|
|
||||||
sources.constrain(YEqn);
|
sources.constrain(YEqn);
|
||||||
|
|||||||
@ -47,17 +47,10 @@
|
|||||||
|
|
||||||
#include "createPhi.H"
|
#include "createPhi.H"
|
||||||
|
|
||||||
Info<< "Creating turbulence model\n" << endl;
|
|
||||||
|
|
||||||
singlePhaseTransportModel laminarTransport(U, phi);
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
||||||
const volScalarField nu(laminarTransport.nu());
|
const volScalarField nu(laminarTransport.nu());
|
||||||
|
|
||||||
autoPtr<incompressible::turbulenceModel> turbulence
|
|
||||||
(
|
|
||||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
|
||||||
);
|
|
||||||
|
|
||||||
volScalarField mu
|
volScalarField mu
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
|
|||||||
@ -33,11 +33,10 @@ Application
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
# include "setRootCase.H"
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
# include "createTime.H"
|
|
||||||
# include "createMesh.H"
|
|
||||||
|
|
||||||
Info<< "Reading field p\n" << endl;
|
Info<< "Reading field p\n" << endl;
|
||||||
volScalarField p
|
volScalarField p
|
||||||
@ -67,9 +66,29 @@ int main(int argc, char *argv[])
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||||
|
const pointBoundaryMesh& pbm = pMesh.boundary();
|
||||||
|
|
||||||
|
Info<< "pointMesh boundary" << nl;
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
Info<< "patch=" << pbm[patchI].name()
|
||||||
|
<< ", type=" << pbm[patchI].type()
|
||||||
|
<< ", coupled=" << pbm[patchI].coupled()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
const volPointInterpolation& pInterp = volPointInterpolation::New(mesh);
|
const volPointInterpolation& pInterp = volPointInterpolation::New(mesh);
|
||||||
|
|
||||||
|
|
||||||
pointScalarField pp(pInterp.interpolate(p));
|
pointScalarField pp(pInterp.interpolate(p));
|
||||||
|
Info<< pp.name() << " boundary" << endl;
|
||||||
|
forAll(pp.boundaryField(), patchI)
|
||||||
|
{
|
||||||
|
Info<< pbm[patchI].name() << " coupled="
|
||||||
|
<< pp.boundaryField()[patchI].coupled()<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
pp.write();
|
pp.write();
|
||||||
|
|
||||||
pointVectorField pU(pInterp.interpolate(U));
|
pointVectorField pU(pInterp.interpolate(U));
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
redistributeMeshPar.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/redistributeMeshPar
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
redistributePar.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/redistributePar
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
redistributeMeshPar
|
redistributePar
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Redistributes existing decomposed mesh and fields according to the current
|
Redistributes existing decomposed mesh and fields according to the current
|
||||||
@ -42,7 +42,7 @@ Description
|
|||||||
cp -r constant processor0
|
cp -r constant processor0
|
||||||
|
|
||||||
# Distribute
|
# Distribute
|
||||||
mpirun -np ddd redistributeMeshPar -parallel
|
mpirun -np ddd redistributePar -parallel
|
||||||
\endverbatim
|
\endverbatim
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
181
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
Normal file
181
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "CSV.H"
|
||||||
|
#include "DynamicList.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
// doesn't recognize specialization otherwise
|
||||||
|
template<>
|
||||||
|
scalar CSV<scalar>::readValue(const List<string>& splitted)
|
||||||
|
{
|
||||||
|
if (componentColumns_[0] >= splitted.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn("CSV<scalar>::readValue(const List<string>&)")
|
||||||
|
<< "No column " << componentColumns_[0] << " in "
|
||||||
|
<< splitted << endl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return readScalar(IStringStream(splitted[componentColumns_[0]])());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type CSV<Type>::readValue(const List<string>& splitted)
|
||||||
|
{
|
||||||
|
Type result;
|
||||||
|
|
||||||
|
for (label i = 0; i < pTraits<Type>::nComponents; i++)
|
||||||
|
{
|
||||||
|
if (componentColumns_[i] >= splitted.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn("CSV<Type>::readValue(const List<string>&)")
|
||||||
|
<< "No column " << componentColumns_[i] << " in "
|
||||||
|
<< splitted << endl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
result[i] =
|
||||||
|
readScalar(IStringStream(splitted[componentColumns_[i]])());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::CSV<Type>::read()
|
||||||
|
{
|
||||||
|
IFstream is(fName_.expand());
|
||||||
|
|
||||||
|
DynamicList<Tuple2<scalar, Type> > values;
|
||||||
|
|
||||||
|
// skip header
|
||||||
|
if (headerLine_)
|
||||||
|
{
|
||||||
|
string line;
|
||||||
|
is.getLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// read data
|
||||||
|
while (is.good())
|
||||||
|
{
|
||||||
|
string line;
|
||||||
|
is.getLine(line);
|
||||||
|
|
||||||
|
DynamicList<string> splitted;
|
||||||
|
|
||||||
|
std::size_t pos = 0;
|
||||||
|
while (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
std::size_t nPos = line.find(separator_, pos);
|
||||||
|
|
||||||
|
if (nPos == std::string::npos)
|
||||||
|
{
|
||||||
|
splitted.append(line.substr(pos));
|
||||||
|
pos = nPos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
splitted.append(line.substr(pos, nPos - pos));
|
||||||
|
pos = nPos + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (splitted.size() <= 1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar x = readScalar(IStringStream(splitted[refColumn_])());
|
||||||
|
Type value = readValue(splitted);
|
||||||
|
|
||||||
|
values.append(Tuple2<scalar,Type>(x, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->table_.transfer(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::CSV<Type>::CSV(const word& entryName, const dictionary& dict)
|
||||||
|
:
|
||||||
|
DataEntry<Type>(entryName),
|
||||||
|
TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")),
|
||||||
|
coeffs_(dict.subDict(type() + "Coeffs")),
|
||||||
|
headerLine_(readBool(coeffs_.lookup("hasHeaderLine"))),
|
||||||
|
refColumn_(readLabel(coeffs_.lookup("refColumn"))),
|
||||||
|
componentColumns_(coeffs_.lookup("componentColumns")),
|
||||||
|
separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
|
||||||
|
fName_(coeffs_.lookup("fileName"))
|
||||||
|
{
|
||||||
|
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Foam::CSV<Type>::CSV(const word&, Istream&)")
|
||||||
|
<< componentColumns_ << " does not have the expected length of "
|
||||||
|
<< pTraits<Type>::nComponents << endl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
read();
|
||||||
|
|
||||||
|
TableBase<Type>::check();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::CSV<Type>::CSV(const CSV<Type>& tbl)
|
||||||
|
:
|
||||||
|
DataEntry<Type>(tbl),
|
||||||
|
TableBase<Type>(tbl),
|
||||||
|
headerLine_(tbl.headerLine_),
|
||||||
|
refColumn_(tbl.refColumn_),
|
||||||
|
componentColumns_(tbl.componentColumns_),
|
||||||
|
separator_(tbl.separator_),
|
||||||
|
fName_(tbl.fName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::CSV<Type>::~CSV()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "CSVIO.C"
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
183
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
Normal file
183
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::CSV
|
||||||
|
|
||||||
|
Description
|
||||||
|
Templated CSV container data entry. Reference column is always a scalar,
|
||||||
|
e.g. time
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
<entryName> csvFile
|
||||||
|
{
|
||||||
|
hasHeaderLine true;
|
||||||
|
refColumn 0; // reference column index
|
||||||
|
componentColumns (0 1 2); // component column indices
|
||||||
|
separator ","; // optional (defaults to ",")
|
||||||
|
fileName fileXYZ; // name of csv data file
|
||||||
|
outOfBounds clamp; // optional out-of-bounds handling
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
CSV.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef CSV_H
|
||||||
|
#define CSV_H
|
||||||
|
|
||||||
|
#include "DataEntry.H"
|
||||||
|
#include "TableBase.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
#include "labelList.H"
|
||||||
|
#include "ISstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class CSV;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const CSV<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class CSV Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class CSV
|
||||||
|
:
|
||||||
|
public DataEntry<Type>,
|
||||||
|
public TableBase<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Coefficients dictionary (for convenience on reading)
|
||||||
|
dictionary coeffs_;
|
||||||
|
|
||||||
|
//- Does the file have a header line?
|
||||||
|
bool headerLine_;
|
||||||
|
|
||||||
|
//- Column of the time
|
||||||
|
label refColumn_;
|
||||||
|
|
||||||
|
//- Labels of the components
|
||||||
|
labelList componentColumns_;
|
||||||
|
|
||||||
|
//- Separator character
|
||||||
|
char separator_;
|
||||||
|
|
||||||
|
//- File name for csv table (optional)
|
||||||
|
fileName fName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read csv data table
|
||||||
|
void read();
|
||||||
|
|
||||||
|
//- Read the next value from the splitted string
|
||||||
|
Type readValue(const List<string>&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const CSV<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("csvFile");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and Istream
|
||||||
|
CSV(const word& entryName, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy constructor
|
||||||
|
CSV(const CSV<Type>& tbl);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<DataEntry<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<DataEntry<Type> >(new CSV<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~CSV();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return Table value
|
||||||
|
virtual Type value(const scalar x) const
|
||||||
|
{
|
||||||
|
return TableBase<Type>::value(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Integrate between two (scalar) values
|
||||||
|
virtual Type integrate(const scalar x1, const scalar x2) const
|
||||||
|
{
|
||||||
|
return TableBase<Type>::integrate(x1, x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// I/O
|
||||||
|
|
||||||
|
//- Ostream Operator
|
||||||
|
friend Ostream& operator<< <Type>
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const CSV<Type>& cnst
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "CSV.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
80
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
Normal file
80
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const CSV<Type>& tbl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (os.format() == IOstream::ASCII)
|
||||||
|
{
|
||||||
|
os << static_cast<const DataEntry<Type>& >(tbl)
|
||||||
|
<< token::SPACE << tbl.headerLine_
|
||||||
|
<< token::SPACE << tbl.timeColumn_
|
||||||
|
<< token::SPACE << tbl.componentColumns_
|
||||||
|
<< token::SPACE << tbl.separator_
|
||||||
|
<< token::SPACE << tbl.fileName_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << static_cast<const DataEntry<Type>& >(tbl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check state of Ostream
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Ostream& operator<<(Ostream&, const CSV<Type>&)"
|
||||||
|
);
|
||||||
|
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::CSV<Type>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
DataEntry<Type>::writeData(os);
|
||||||
|
|
||||||
|
os << token::END_STATEMENT << nl;
|
||||||
|
os << indent << word(type() + "Coeffs") << nl;
|
||||||
|
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
os.writeKeyword("headerLine") << headerLine_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("refColumn") << refColumn_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("componentColumns") << componentColumns_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("separator") << string(separator_)
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -28,11 +28,14 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Constant<Type>::Constant(const word& entryName, Istream& is)
|
Foam::Constant<Type>::Constant(const word& entryName, const dictionary& dict)
|
||||||
:
|
:
|
||||||
DataEntry<Type>(entryName),
|
DataEntry<Type>(entryName),
|
||||||
value_(pTraits<Type>::zero)
|
value_(pTraits<Type>::zero)
|
||||||
{
|
{
|
||||||
|
Istream& is(dict.lookup(entryName));
|
||||||
|
word entryType(is);
|
||||||
|
|
||||||
is >> value_;
|
is >> value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and Istream
|
//- Construct from entry name and Istream
|
||||||
Constant(const word& entryName, Istream& is);
|
Constant(const word& entryName, const dictionary& dict);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
Constant(const Constant<Type>& cnst);
|
Constant(const Constant<Type>& cnst);
|
||||||
|
|||||||
@ -92,9 +92,9 @@ public:
|
|||||||
dictionary,
|
dictionary,
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
Istream& is
|
const dictionary& dict
|
||||||
),
|
),
|
||||||
(entryName, is)
|
(entryName, dict)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,6 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
Istream& is(dict.lookup(entryName));
|
Istream& is(dict.lookup(entryName));
|
||||||
|
|
||||||
word DataEntryType(is);
|
word DataEntryType(is);
|
||||||
|
|
||||||
typename dictionaryConstructorTable::iterator cstrIter =
|
typename dictionaryConstructorTable::iterator cstrIter =
|
||||||
@ -54,7 +53,7 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<DataEntry<Type> >(cstrIter()(entryName, is));
|
return autoPtr<DataEntry<Type> >(cstrIter()(entryName, dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,17 +28,17 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Table<Type>::Table(const word& entryName, Istream& is)
|
Foam::Table<Type>::Table(const word& entryName, const dictionary& dict)
|
||||||
:
|
:
|
||||||
DataEntry<Type>(entryName),
|
DataEntry<Type>(entryName),
|
||||||
table_(is)
|
TableBase<Type>(entryName, dictionary::null)
|
||||||
{
|
{
|
||||||
if (!table_.size())
|
Istream& is(dict.lookup(entryName));
|
||||||
{
|
word entryType(is);
|
||||||
FatalErrorIn("Foam::Table<Type>::Table(const Istream&)")
|
|
||||||
<< "Table for entry " << this->name_ << " is invalid (empty)"
|
is >> this->table_;
|
||||||
<< nl << exit(FatalError);
|
|
||||||
}
|
TableBase<Type>::check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ template<class Type>
|
|||||||
Foam::Table<Type>::Table(const Table<Type>& tbl)
|
Foam::Table<Type>::Table(const Table<Type>& tbl)
|
||||||
:
|
:
|
||||||
DataEntry<Type>(tbl),
|
DataEntry<Type>(tbl),
|
||||||
table_(tbl.table_)
|
TableBase<Type>(tbl)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -57,98 +57,6 @@ Foam::Table<Type>::~Table()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Type Foam::Table<Type>::value(const scalar x) const
|
|
||||||
{
|
|
||||||
// Return zero if out of bounds
|
|
||||||
if (x < table_[0].first() || x > table_.last().first())
|
|
||||||
{
|
|
||||||
return pTraits<Type>::zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find i such that x(i) < x < x(i+1)
|
|
||||||
label i = 0;
|
|
||||||
while ((table_[i+1].first() < x) && (i+1 < table_.size()))
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Linear interpolation to find value. Note constructor needed for
|
|
||||||
// Table<label> to convert intermediate scalar back to label.
|
|
||||||
return Type
|
|
||||||
(
|
|
||||||
(x - table_[i].first())/(table_[i+1].first() - table_[i].first())
|
|
||||||
* (table_[i+1].second() - table_[i].second())
|
|
||||||
+ table_[i].second()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
|
|
||||||
{
|
|
||||||
// Initialise return value
|
|
||||||
Type sum = pTraits<Type>::zero;
|
|
||||||
|
|
||||||
// Return zero if out of bounds
|
|
||||||
if ((x1 > table_.last().first()) || (x2 < table_[0].first()))
|
|
||||||
{
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find next index greater than x1
|
|
||||||
label id1 = 0;
|
|
||||||
while ((table_[id1].first() < x1) && (id1 < table_.size()))
|
|
||||||
{
|
|
||||||
id1++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find next index less than x2
|
|
||||||
label id2 = table_.size() - 1;
|
|
||||||
while ((table_[id2].first() > x2) && (id2 >= 1))
|
|
||||||
{
|
|
||||||
id2--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((id1 - id2) == 1)
|
|
||||||
{
|
|
||||||
// x1 and x2 lie within 1 interval
|
|
||||||
sum = 0.5*(value(x1) + value(x2))*(x2 - x1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// x1 and x2 cross multiple intervals
|
|
||||||
|
|
||||||
// Integrate table body
|
|
||||||
for (label i=id1; i<id2; i++)
|
|
||||||
{
|
|
||||||
sum +=
|
|
||||||
(table_[i].second() + table_[i+1].second())
|
|
||||||
* (table_[i+1].first() - table_[i].first());
|
|
||||||
}
|
|
||||||
sum *= 0.5;
|
|
||||||
|
|
||||||
// Add table ends (partial segments)
|
|
||||||
if (id1 > 0)
|
|
||||||
{
|
|
||||||
sum += 0.5
|
|
||||||
* (value(x1) + table_[id1].second())
|
|
||||||
* (table_[id1].first() - x1);
|
|
||||||
}
|
|
||||||
if (id2 < table_.size() - 1)
|
|
||||||
{
|
|
||||||
sum += 0.5
|
|
||||||
* (table_[id2].second() + value(x2))
|
|
||||||
* (x2 - table_[id2].first());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "TableIO.C"
|
#include "TableIO.C"
|
||||||
|
|||||||
@ -70,14 +70,9 @@ Ostream& operator<<
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class Table
|
class Table
|
||||||
:
|
:
|
||||||
public DataEntry<Type>
|
public DataEntry<Type>,
|
||||||
|
public TableBase<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Table data
|
|
||||||
List<Tuple2<scalar, Type> > table_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
@ -93,7 +88,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and Istream
|
//- Construct from entry name and Istream
|
||||||
Table(const word& entryName, Istream& is);
|
Table(const word& entryName, const dictionary& dict);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
Table(const Table<Type>& tbl);
|
Table(const Table<Type>& tbl);
|
||||||
@ -112,10 +107,16 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return Table value
|
//- Return Table value
|
||||||
Type value(const scalar x) const;
|
virtual Type value(const scalar x) const
|
||||||
|
{
|
||||||
|
return TableBase<Type>::value(x);
|
||||||
|
}
|
||||||
|
|
||||||
//- Integrate between two (scalar) values
|
//- Integrate between two (scalar) values
|
||||||
Type integrate(const scalar x1, const scalar x2) const;
|
virtual Type integrate(const scalar x1, const scalar x2) const
|
||||||
|
{
|
||||||
|
return TableBase<Type>::integrate(x1, x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// I/O
|
// I/O
|
||||||
@ -124,7 +125,7 @@ public:
|
|||||||
friend Ostream& operator<< <Type>
|
friend Ostream& operator<< <Type>
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const Table<Type>& cnst
|
const Table<Type>& tbl
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write in dictionary format
|
//- Write in dictionary format
|
||||||
|
|||||||
399
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C
Normal file
399
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C
Normal file
@ -0,0 +1,399 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "TableBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
boundsHandling_
|
||||||
|
(
|
||||||
|
wordToBoundsHandling
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<word>("outOfBounds", "clamp")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
table_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
|
||||||
|
:
|
||||||
|
name_(tbl.name_),
|
||||||
|
boundsHandling_(tbl.boundsHandling_),
|
||||||
|
table_(tbl.table_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::TableBase<Type>::~TableBase()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::word Foam::TableBase<Type>::boundsHandlingToWord
|
||||||
|
(
|
||||||
|
const boundsHandling& bound
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
word enumName("warn");
|
||||||
|
|
||||||
|
switch (bound)
|
||||||
|
{
|
||||||
|
case ERROR:
|
||||||
|
{
|
||||||
|
enumName = "error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WARN:
|
||||||
|
{
|
||||||
|
enumName = "warn";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLAMP:
|
||||||
|
{
|
||||||
|
enumName = "clamp";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REPEAT:
|
||||||
|
{
|
||||||
|
enumName = "repeat";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
typename Foam::TableBase<Type>::boundsHandling
|
||||||
|
Foam::TableBase<Type>::wordToBoundsHandling
|
||||||
|
(
|
||||||
|
const word& bound
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (bound == "error")
|
||||||
|
{
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
else if (bound == "warn")
|
||||||
|
{
|
||||||
|
return WARN;
|
||||||
|
}
|
||||||
|
else if (bound == "clamp")
|
||||||
|
{
|
||||||
|
return CLAMP;
|
||||||
|
}
|
||||||
|
else if (bound == "repeat")
|
||||||
|
{
|
||||||
|
return REPEAT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningIn("Foam::TableBase<Type>::wordToBoundsHandling(const word&)")
|
||||||
|
<< "bad outOfBounds specifier " << bound << " using 'warn'"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return WARN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
typename Foam::TableBase<Type>::boundsHandling
|
||||||
|
Foam::TableBase<Type>::outOfBounds
|
||||||
|
(
|
||||||
|
const boundsHandling& bound
|
||||||
|
)
|
||||||
|
{
|
||||||
|
boundsHandling prev = boundsHandling_;
|
||||||
|
boundsHandling_ = bound;
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::TableBase<Type>::check() const
|
||||||
|
{
|
||||||
|
if (!table_.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn("Foam::TableBase<Type>::check() const")
|
||||||
|
<< "Table for entry " << this->name_ << " is invalid (empty)"
|
||||||
|
<< nl << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
label n = table_.size();
|
||||||
|
scalar prevValue = table_[0].first();
|
||||||
|
|
||||||
|
for (label i = 1; i < n; ++i)
|
||||||
|
{
|
||||||
|
const scalar currValue = table_[i].first();
|
||||||
|
|
||||||
|
// avoid duplicate values (divide-by-zero error)
|
||||||
|
if (currValue <= prevValue)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Foam::TableBase<Type>::check() const")
|
||||||
|
<< "out-of-order value: " << currValue << " at index " << i
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
prevValue = currValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::TableBase<Type>::checkMinBounds
|
||||||
|
(
|
||||||
|
const scalar x,
|
||||||
|
scalar& xDash
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (x < table_[0].first())
|
||||||
|
{
|
||||||
|
switch (boundsHandling_)
|
||||||
|
{
|
||||||
|
case ERROR:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"bool Foam::TableBase<Type>::checkMinBounds"
|
||||||
|
"("
|
||||||
|
"const scalar, "
|
||||||
|
"scalar&"
|
||||||
|
") const"
|
||||||
|
) << "value (" << x << ") underflow"
|
||||||
|
<< exit(FatalError);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WARN:
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"bool Foam::TableBase<Type>::checkMinBounds"
|
||||||
|
"("
|
||||||
|
"const scalar, "
|
||||||
|
"scalar&"
|
||||||
|
") const"
|
||||||
|
) << "value (" << x << ") underflow" << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
// fall-through to 'CLAMP'
|
||||||
|
}
|
||||||
|
case CLAMP:
|
||||||
|
{
|
||||||
|
xDash = table_[0].first();
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REPEAT:
|
||||||
|
{
|
||||||
|
// adjust x to >= minX
|
||||||
|
scalar span = table_.last().first() - table_[0].first();
|
||||||
|
xDash = fmod(x - table_[0].first(), span) + table_[0].first();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xDash = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::TableBase<Type>::checkMaxBounds
|
||||||
|
(
|
||||||
|
const scalar x,
|
||||||
|
scalar& xDash
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (x > table_.last().first())
|
||||||
|
{
|
||||||
|
switch (boundsHandling_)
|
||||||
|
{
|
||||||
|
case ERROR:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"bool Foam::TableBase<Type>::checkMaxBounds"
|
||||||
|
"("
|
||||||
|
"const scalar, "
|
||||||
|
"scalar&"
|
||||||
|
") const"
|
||||||
|
) << "value (" << x << ") overflow"
|
||||||
|
<< exit(FatalError);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WARN:
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"bool Foam::TableBase<Type>::checkMaxBounds"
|
||||||
|
"("
|
||||||
|
"const scalar, "
|
||||||
|
"scalar&"
|
||||||
|
") const"
|
||||||
|
) << "value (" << x << ") overflow" << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
// fall-through to 'CLAMP'
|
||||||
|
}
|
||||||
|
case CLAMP:
|
||||||
|
{
|
||||||
|
xDash = table_.last().first();
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REPEAT:
|
||||||
|
{
|
||||||
|
// adjust x to >= minX
|
||||||
|
scalar span = table_.last().first() - table_[0].first();
|
||||||
|
xDash = fmod(x - table_[0].first(), span) + table_[0].first();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xDash = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::TableBase<Type>::value(const scalar x) const
|
||||||
|
{
|
||||||
|
scalar xDash = x;
|
||||||
|
|
||||||
|
if (checkMinBounds(x, xDash))
|
||||||
|
{
|
||||||
|
return table_[0].second();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkMaxBounds(xDash, xDash))
|
||||||
|
{
|
||||||
|
return table_.last().second();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find i such that x(i) < xDash < x(i+1)
|
||||||
|
label i = 0;
|
||||||
|
while ((table_[i+1].first() < xDash) && (i+1 < table_.size()))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Linear interpolation to find value
|
||||||
|
return Type
|
||||||
|
(
|
||||||
|
(xDash - table_[i].first())/(table_[i+1].first() - table_[i].first())
|
||||||
|
* (table_[i+1].second() - table_[i].second())
|
||||||
|
+ table_[i].second()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::TableBase<Type>::integrate(const scalar x1, const scalar x2) const
|
||||||
|
{
|
||||||
|
// Initialise return value
|
||||||
|
Type sum = pTraits<Type>::zero;
|
||||||
|
|
||||||
|
// Return zero if out of bounds
|
||||||
|
if ((x1 > table_.last().first()) || (x2 < table_[0].first()))
|
||||||
|
{
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find next index greater than x1
|
||||||
|
label id1 = 0;
|
||||||
|
while ((table_[id1].first() < x1) && (id1 < table_.size()))
|
||||||
|
{
|
||||||
|
id1++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find next index less than x2
|
||||||
|
label id2 = table_.size() - 1;
|
||||||
|
while ((table_[id2].first() > x2) && (id2 >= 1))
|
||||||
|
{
|
||||||
|
id2--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((id1 - id2) == 1)
|
||||||
|
{
|
||||||
|
// x1 and x2 lie within 1 interval
|
||||||
|
sum = 0.5*(value(x1) + value(x2))*(x2 - x1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// x1 and x2 cross multiple intervals
|
||||||
|
|
||||||
|
// Integrate table body
|
||||||
|
for (label i=id1; i<id2; i++)
|
||||||
|
{
|
||||||
|
sum +=
|
||||||
|
(table_[i].second() + table_[i+1].second())
|
||||||
|
* (table_[i+1].first() - table_[i].first());
|
||||||
|
}
|
||||||
|
sum *= 0.5;
|
||||||
|
|
||||||
|
// Add table ends (partial segments)
|
||||||
|
if (id1 > 0)
|
||||||
|
{
|
||||||
|
sum += 0.5
|
||||||
|
* (value(x1) + table_[id1].second())
|
||||||
|
* (table_[id1].first() - x1);
|
||||||
|
}
|
||||||
|
if (id2 < table_.size() - 1)
|
||||||
|
{
|
||||||
|
sum += 0.5
|
||||||
|
* (table_[id2].second() + value(x2))
|
||||||
|
* (x2 - table_[id2].first());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "TableBaseIO.C"
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
167
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
Normal file
167
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::TableBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base class for table with bounds handling, interpolation and integration
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
TableBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef TableBase_H
|
||||||
|
#define TableBase_H
|
||||||
|
|
||||||
|
#include "DataEntry.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class TableBase;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const TableBase<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class TableBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class TableBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public data types
|
||||||
|
|
||||||
|
//- Enumeration for handling out-of-bound values
|
||||||
|
enum boundsHandling
|
||||||
|
{
|
||||||
|
ERROR, /*!< Exit with a FatalError */
|
||||||
|
WARN, /*!< Issue warning and clamp value (default) */
|
||||||
|
CLAMP, /*!< Clamp value to the start/end value */
|
||||||
|
REPEAT /*!< Treat as a repeating list */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Table name
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
//- Enumeration for handling out-of-bound values
|
||||||
|
boundsHandling boundsHandling_;
|
||||||
|
|
||||||
|
//- Table data
|
||||||
|
List<Tuple2<scalar, Type> > table_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const TableBase<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary - note table is not populated
|
||||||
|
TableBase(const word& name, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy constructor
|
||||||
|
TableBase(const TableBase<Type>& tbl);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~TableBase();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the out-of-bounds handling as a word
|
||||||
|
word boundsHandlingToWord(const boundsHandling& bound) const;
|
||||||
|
|
||||||
|
//- Return the out-of-bounds handling as an enumeration
|
||||||
|
boundsHandling wordToBoundsHandling(const word& bound) const;
|
||||||
|
|
||||||
|
//- Set the out-of-bounds handling from enum, return previous setting
|
||||||
|
boundsHandling outOfBounds(const boundsHandling& bound);
|
||||||
|
|
||||||
|
//- Check the table for size and consistency
|
||||||
|
void check() const;
|
||||||
|
|
||||||
|
//- Check minimum table bounds
|
||||||
|
bool checkMinBounds(const scalar x, scalar& xDash) const;
|
||||||
|
|
||||||
|
//- Check maximum table bounds
|
||||||
|
bool checkMaxBounds(const scalar x, scalar& xDash) const;
|
||||||
|
|
||||||
|
//- Return Table value
|
||||||
|
virtual Type value(const scalar x) const;
|
||||||
|
|
||||||
|
//- Integrate between two (scalar) values
|
||||||
|
virtual Type integrate(const scalar x1, const scalar x2) const;
|
||||||
|
|
||||||
|
|
||||||
|
// I/O
|
||||||
|
|
||||||
|
//- Ostream Operator
|
||||||
|
friend Ostream& operator<< <Type>
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const TableBase<Type>& tbl
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "TableBase.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,28 +23,45 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef timeVaryingUniformFixedValueFvPatchFieldsFwd_H
|
#include "DataEntry.H"
|
||||||
#define timeVaryingUniformFixedValueFvPatchFieldsFwd_H
|
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
template<class Type>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
namespace Foam
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const TableBase<Type>& tbl
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
if (os.format() == IOstream::ASCII)
|
||||||
|
{
|
||||||
|
os << token::SPACE << tbl.table_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os.write
|
||||||
|
(
|
||||||
|
reinterpret_cast<const char*>(&tbl.table_),
|
||||||
|
sizeof(tbl.table_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// Check state of Ostream
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Ostream& operator<<(Ostream&, const TableBase<Type>&, const bool)"
|
||||||
|
);
|
||||||
|
|
||||||
template<class Type> class timeVaryingUniformFixedValueFvPatchField;
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
makePatchTypeFieldTypedefs(timeVaryingUniformFixedValue);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
template<class Type>
|
||||||
|
void Foam::TableBase<Type>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << nl << indent << table_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -34,20 +34,8 @@ Foam::Ostream& Foam::operator<<
|
|||||||
const Table<Type>& tbl
|
const Table<Type>& tbl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (os.format() == IOstream::ASCII)
|
os << static_cast<const DataEntry<Type>&>(tbl)
|
||||||
{
|
<< static_cast<const TableBase<Type>&>(tbl);
|
||||||
os << static_cast<const DataEntry<Type>& >(tbl)
|
|
||||||
<< token::SPACE << tbl.table_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
os << static_cast<const DataEntry<Type>& >(tbl);
|
|
||||||
os.write
|
|
||||||
(
|
|
||||||
reinterpret_cast<const char*>(&tbl.table_),
|
|
||||||
sizeof(tbl.table_)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check state of Ostream
|
// Check state of Ostream
|
||||||
os.check
|
os.check
|
||||||
@ -63,8 +51,7 @@ template<class Type>
|
|||||||
void Foam::Table<Type>::writeData(Ostream& os) const
|
void Foam::Table<Type>::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
DataEntry<Type>::writeData(os);
|
DataEntry<Type>::writeData(os);
|
||||||
|
TableBase<Type>::writeData(os);
|
||||||
os << nl << indent << table_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,21 +23,47 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "timeVaryingUniformFixedValueFvPatchFields.H"
|
#include "TableFile.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
template<class Type>
|
||||||
|
Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
|
||||||
|
:
|
||||||
|
DataEntry<Type>(entryName),
|
||||||
|
TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")),
|
||||||
|
fName_("none")
|
||||||
{
|
{
|
||||||
|
const dictionary coeffs(dict.subDict(type() + "Coeffs"));
|
||||||
|
coeffs.lookup("fileName") >> fName_;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
IFstream is(fName_.expand());
|
||||||
|
|
||||||
makePatchFields(timeVaryingUniformFixedValue);
|
is >> this->table_;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
TableBase<Type>::check();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
|
||||||
|
:
|
||||||
|
DataEntry<Type>(tbl),
|
||||||
|
TableBase<Type>(tbl),
|
||||||
|
fName_(tbl.fName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::TableFile<Type>::~TableFile()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "TableFileIO.C"
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,166 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::TableFile
|
||||||
|
|
||||||
|
Description
|
||||||
|
Templated table container data entry where data is read from file.
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
<entryName> tableFile;
|
||||||
|
tableCoeffs
|
||||||
|
{
|
||||||
|
fileName dataFile; // name of data file
|
||||||
|
outOfBounds clamp; // optional out-of-bounds handling
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Items are stored in a list of Tuple2's. First column is always stored as
|
||||||
|
scalar entries. Data is read in the form, e.g. for an entry \<entryName\>
|
||||||
|
that is (scalar, vector):
|
||||||
|
\verbatim
|
||||||
|
(
|
||||||
|
0.0 (1 2 3)
|
||||||
|
1.0 (4 5 6)
|
||||||
|
);
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
TableFile.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef TableFile_H
|
||||||
|
#define TableFile_H
|
||||||
|
|
||||||
|
#include "DataEntry.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class TableFile;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const TableFile<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class TableFile Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class TableFile
|
||||||
|
:
|
||||||
|
public DataEntry<Type>,
|
||||||
|
public TableBase<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- File name for csv table (optional)
|
||||||
|
fileName fName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const TableFile<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("tableFile");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and Istream
|
||||||
|
TableFile(const word& entryName, const dictionary& dict);
|
||||||
|
|
||||||
|
//- Copy constructor
|
||||||
|
TableFile(const TableFile<Type>& tbl);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<DataEntry<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<DataEntry<Type> >(new TableFile<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~TableFile();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return TableFile value
|
||||||
|
virtual Type value(const scalar x) const
|
||||||
|
{
|
||||||
|
return TableBase<Type>::value(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Integrate between two (scalar) values
|
||||||
|
virtual Type integrate(const scalar x1, const scalar x2) const
|
||||||
|
{
|
||||||
|
return TableBase<Type>::integrate(x1, x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// I/O
|
||||||
|
|
||||||
|
//- Ostream Operator
|
||||||
|
friend Ostream& operator<< <Type>
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const TableFile<Type>& tbl
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "TableFile.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,27 +23,41 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef timeVaryingUniformFixedValueFvPatchFields_H
|
#include "DataEntry.H"
|
||||||
#define timeVaryingUniformFixedValueFvPatchFields_H
|
|
||||||
|
|
||||||
#include "timeVaryingUniformFixedValueFvPatchField.H"
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
#include "fieldTypes.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
template<class Type>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
namespace Foam
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const TableFile<Type>& tbl
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
os << static_cast<const DataEntry<Type>&>(tbl)
|
||||||
|
<< static_cast<const TableBase<Type>&>(tbl);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// Check state of Ostream
|
||||||
|
os.check
|
||||||
|
(
|
||||||
|
"Ostream& operator<<(Ostream&, const TableFile<Type>&)"
|
||||||
|
);
|
||||||
|
|
||||||
makePatchTypeFieldTypedefs(timeVaryingUniformFixedValue);
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
template<class Type>
|
||||||
|
void Foam::TableFile<Type>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
DataEntry<Type>::writeData(os);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
os << token::END_STATEMENT << nl
|
||||||
|
<< indent << word(type() + "Coeffs") << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||||
|
os.writeKeyword("fileName")<< fName_ << token::END_STATEMENT << nl;
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -23,27 +23,56 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "DataEntry.H"
|
|
||||||
#include "Constant.H"
|
#include "Constant.H"
|
||||||
|
#include "CSV.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
#include "Table.H"
|
#include "Table.H"
|
||||||
|
#include "TableFile.H"
|
||||||
|
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
#include "sphericalTensor.H"
|
||||||
|
#include "symmTensor.H"
|
||||||
|
#include "tensor.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
makeDataEntry(label);
|
makeDataEntry(label);
|
||||||
makeDataEntryType(Constant, label);
|
makeDataEntryType(Constant, label);
|
||||||
|
// makeDataEntryType(CSV, label);
|
||||||
makeDataEntryType(Table, label);
|
makeDataEntryType(Table, label);
|
||||||
|
makeDataEntryType(TableFile, label);
|
||||||
|
|
||||||
makeDataEntry(scalar);
|
makeDataEntry(scalar);
|
||||||
makeDataEntryType(Constant, scalar);
|
makeDataEntryType(Constant, scalar);
|
||||||
|
makeDataEntryType(CSV, scalar);
|
||||||
makeDataEntryType(Table, scalar);
|
makeDataEntryType(Table, scalar);
|
||||||
|
makeDataEntryType(TableFile, scalar);
|
||||||
|
|
||||||
makeDataEntry(vector);
|
makeDataEntry(vector);
|
||||||
makeDataEntryType(Constant, vector);
|
makeDataEntryType(Constant, vector);
|
||||||
|
makeDataEntryType(CSV, vector);
|
||||||
makeDataEntryType(Table, vector);
|
makeDataEntryType(Table, vector);
|
||||||
|
makeDataEntryType(TableFile, vector);
|
||||||
|
|
||||||
|
makeDataEntry(sphericalTensor);
|
||||||
|
makeDataEntryType(Constant, sphericalTensor);
|
||||||
|
makeDataEntryType(CSV, sphericalTensor);
|
||||||
|
makeDataEntryType(Table, sphericalTensor);
|
||||||
|
makeDataEntryType(TableFile, sphericalTensor);
|
||||||
|
|
||||||
|
makeDataEntry(symmTensor);
|
||||||
|
makeDataEntryType(Constant, symmTensor);
|
||||||
|
makeDataEntryType(CSV, symmTensor);
|
||||||
|
makeDataEntryType(Table, symmTensor);
|
||||||
|
makeDataEntryType(TableFile, symmTensor);
|
||||||
|
|
||||||
|
makeDataEntry(tensor);
|
||||||
|
makeDataEntryType(Constant, tensor);
|
||||||
|
makeDataEntryType(CSV, tensor);
|
||||||
|
makeDataEntryType(Table, tensor);
|
||||||
|
makeDataEntryType(TableFile, tensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,12 +34,17 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::polynomial::polynomial(const word& entryName, Istream& is)
|
Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
|
||||||
:
|
:
|
||||||
DataEntry<scalar>(entryName),
|
DataEntry<scalar>(entryName),
|
||||||
coeffs_(is),
|
coeffs_(),
|
||||||
canIntegrate_(true)
|
canIntegrate_(true)
|
||||||
{
|
{
|
||||||
|
Istream& is(dict.lookup(entryName));
|
||||||
|
word entryType(is);
|
||||||
|
|
||||||
|
is >> coeffs_;
|
||||||
|
|
||||||
if (!coeffs_.size())
|
if (!coeffs_.size())
|
||||||
{
|
{
|
||||||
FatalErrorIn("Foam::polynomial::polynomial(const word&, Istream&)")
|
FatalErrorIn("Foam::polynomial::polynomial(const word&, Istream&)")
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
polynomial(const word& entryName, Istream& is);
|
polynomial(const word& entryName, const dictionary& dict);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
polynomial(const polynomial& poly);
|
polynomial(const polynomial& poly);
|
||||||
|
|||||||
@ -80,17 +80,12 @@ singleStepCombustion<CombThermoType, ThermoType>::R
|
|||||||
{
|
{
|
||||||
const label specieI = this->thermo_->composition().species()[Y.name()];
|
const label specieI = this->thermo_->composition().species()[Y.name()];
|
||||||
|
|
||||||
const label fNorm = singleMixture_.specieProd()[specieI];
|
|
||||||
|
|
||||||
const volScalarField fres(singleMixture_.fres(specieI));
|
|
||||||
|
|
||||||
const volScalarField wSpecie
|
const volScalarField wSpecie
|
||||||
(
|
(
|
||||||
wFuel_*singleMixture_.specieStoichCoeffs()[specieI]
|
wFuel_*singleMixture_.specieStoichCoeffs()[specieI]
|
||||||
/ max(fNorm*(Y - fres), scalar(0.001))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
|
return wSpecie + fvm::Sp(0.0*wSpecie, Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -158,8 +158,6 @@ $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVe
|
|||||||
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C
|
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C
|
||||||
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C
|
|
||||||
$(derivedFvPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C
|
|
||||||
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
|
$(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
|
||||||
|
|||||||
@ -31,8 +31,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::
|
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||||
flowRateInletVelocityFvPatchVectorField::
|
|
||||||
flowRateInletVelocityFvPatchVectorField
|
flowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
@ -40,14 +39,13 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
flowRate_(0),
|
flowRate_(),
|
||||||
phiName_("phi"),
|
phiName_("phi"),
|
||||||
rhoName_("rho")
|
rhoName_("rho")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||||
flowRateInletVelocityFvPatchVectorField::
|
|
||||||
flowRateInletVelocityFvPatchVectorField
|
flowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const flowRateInletVelocityFvPatchVectorField& ptf,
|
const flowRateInletVelocityFvPatchVectorField& ptf,
|
||||||
@ -57,14 +55,13 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||||
flowRate_(ptf.flowRate_),
|
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_)
|
rhoName_(ptf.rhoName_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||||
flowRateInletVelocityFvPatchVectorField::
|
|
||||||
flowRateInletVelocityFvPatchVectorField
|
flowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
@ -73,28 +70,26 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||||
flowRate_(readScalar(dict.lookup("flowRate"))),
|
flowRate_(DataEntry<scalar>::New("flowRate", dict)),
|
||||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||||
flowRateInletVelocityFvPatchVectorField::
|
|
||||||
flowRateInletVelocityFvPatchVectorField
|
flowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const flowRateInletVelocityFvPatchVectorField& ptf
|
const flowRateInletVelocityFvPatchVectorField& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(ptf),
|
fixedValueFvPatchField<vector>(ptf),
|
||||||
flowRate_(ptf.flowRate_),
|
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_)
|
rhoName_(ptf.rhoName_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::
|
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||||
flowRateInletVelocityFvPatchVectorField::
|
|
||||||
flowRateInletVelocityFvPatchVectorField
|
flowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const flowRateInletVelocityFvPatchVectorField& ptf,
|
const flowRateInletVelocityFvPatchVectorField& ptf,
|
||||||
@ -102,7 +97,7 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(ptf, iF),
|
fixedValueFvPatchField<vector>(ptf, iF),
|
||||||
flowRate_(ptf.flowRate_),
|
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_)
|
rhoName_(ptf.rhoName_)
|
||||||
{}
|
{}
|
||||||
@ -117,8 +112,10 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scalar t = db().time().value();
|
||||||
|
|
||||||
// a simpler way of doing this would be nice
|
// a simpler way of doing this would be nice
|
||||||
const scalar avgU = -flowRate_/gSum(patch().magSf());
|
const scalar avgU = -flowRate_->value(t)/gSum(patch().magSf());
|
||||||
|
|
||||||
tmp<vectorField> n = patch().nf();
|
tmp<vectorField> n = patch().nf();
|
||||||
|
|
||||||
@ -157,7 +154,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
|
void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fvPatchField<vector>::write(os);
|
fvPatchField<vector>::write(os);
|
||||||
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
|
flowRate_->writeData(os);
|
||||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
|
|||||||
@ -57,6 +57,7 @@ SourceFiles
|
|||||||
#define flowRateInletVelocityFvPatchVectorField_H
|
#define flowRateInletVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ class flowRateInletVelocityFvPatchVectorField
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Inlet integral flow rate
|
//- Inlet integral flow rate
|
||||||
scalar flowRate_;
|
autoPtr<DataEntry<scalar> > flowRate_;
|
||||||
|
|
||||||
//- Name of the flux transporting the field
|
//- Name of the flux transporting the field
|
||||||
word phiName_;
|
word phiName_;
|
||||||
@ -153,27 +154,11 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the flux
|
|
||||||
scalar flowRate() const
|
|
||||||
{
|
|
||||||
return flowRate_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return reference to the flux to allow adjustment
|
|
||||||
scalar& flowRate()
|
|
||||||
{
|
|
||||||
return flowRate_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,10 +33,13 @@ License
|
|||||||
void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||||
calcTangentialVelocity()
|
calcTangentialVelocity()
|
||||||
{
|
{
|
||||||
vector axisHat = omega_/mag(omega_);
|
const scalar t = this->db().time().value();
|
||||||
|
vector om = omega_->value(t);
|
||||||
|
|
||||||
|
vector axisHat = om/mag(om);
|
||||||
const vectorField tangentialVelocity
|
const vectorField tangentialVelocity
|
||||||
(
|
(
|
||||||
(-omega_) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()))
|
(-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()))
|
||||||
);
|
);
|
||||||
|
|
||||||
const vectorField n(patch().nf());
|
const vectorField n(patch().nf());
|
||||||
@ -54,7 +57,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
pressureInletOutletVelocityFvPatchVectorField(p, iF),
|
pressureInletOutletVelocityFvPatchVectorField(p, iF),
|
||||||
omega_(vector::zero)
|
omega_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +71,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
||||||
omega_(ptf.omega_)
|
omega_(ptf.omega_().clone().ptr())
|
||||||
{
|
{
|
||||||
calcTangentialVelocity();
|
calcTangentialVelocity();
|
||||||
}
|
}
|
||||||
@ -83,7 +86,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
|
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
|
||||||
omega_(dict.lookup("omega"))
|
omega_(DataEntry<vector>::New("omega", dict))
|
||||||
{
|
{
|
||||||
calcTangentialVelocity();
|
calcTangentialVelocity();
|
||||||
}
|
}
|
||||||
@ -92,11 +95,11 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||||
rotatingPressureInletOutletVelocityFvPatchVectorField
|
rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf
|
const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pressureInletOutletVelocityFvPatchVectorField(pivpvf),
|
pressureInletOutletVelocityFvPatchVectorField(rppvf),
|
||||||
omega_(pivpvf.omega_)
|
omega_(rppvf.omega_().clone().ptr())
|
||||||
{
|
{
|
||||||
calcTangentialVelocity();
|
calcTangentialVelocity();
|
||||||
}
|
}
|
||||||
@ -105,12 +108,12 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||||
rotatingPressureInletOutletVelocityFvPatchVectorField
|
rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf,
|
const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf,
|
||||||
const DimensionedField<vector, volMesh>& iF
|
const DimensionedField<vector, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pressureInletOutletVelocityFvPatchVectorField(pivpvf, iF),
|
pressureInletOutletVelocityFvPatchVectorField(rppvf, iF),
|
||||||
omega_(pivpvf.omega_)
|
omega_(rppvf.omega_().clone().ptr())
|
||||||
{
|
{
|
||||||
calcTangentialVelocity();
|
calcTangentialVelocity();
|
||||||
}
|
}
|
||||||
@ -125,7 +128,7 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write
|
|||||||
{
|
{
|
||||||
fvPatchVectorField::write(os);
|
fvPatchVectorField::write(os);
|
||||||
os.writeKeyword("phi") << phiName() << token::END_STATEMENT << nl;
|
os.writeKeyword("phi") << phiName() << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
|
omega_->writeData(os);
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvPatchFields.H"
|
#include "fvPatchFields.H"
|
||||||
#include "pressureInletOutletVelocityFvPatchVectorField.H"
|
#include "pressureInletOutletVelocityFvPatchVectorField.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Angular velocity of the frame
|
//- Angular velocity of the frame
|
||||||
vector omega_;
|
autoPtr<DataEntry<vector> > omega_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -141,23 +142,6 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the angular velocity of rotation
|
|
||||||
const vector& omega() const
|
|
||||||
{
|
|
||||||
return omega_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Reset the angular velocity of rotation
|
|
||||||
// and update the tangentialVelocity
|
|
||||||
void setOmega(const vector& omega)
|
|
||||||
{
|
|
||||||
omega_ = omega;
|
|
||||||
calcTangentialVelocity();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -39,7 +39,7 @@ rotatingTotalPressureFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
totalPressureFvPatchScalarField(p, iF),
|
totalPressureFvPatchScalarField(p, iF),
|
||||||
omega_(vector::zero)
|
omega_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ rotatingTotalPressureFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
totalPressureFvPatchScalarField(ptf, p, iF, mapper),
|
totalPressureFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
omega_(ptf.omega_)
|
omega_(ptf.omega_().clone().ptr())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -66,30 +66,30 @@ rotatingTotalPressureFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
totalPressureFvPatchScalarField(p, iF, dict),
|
totalPressureFvPatchScalarField(p, iF, dict),
|
||||||
omega_(dict.lookup("omega"))
|
omega_(DataEntry<vector>::New("omega", dict))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::rotatingTotalPressureFvPatchScalarField::
|
Foam::rotatingTotalPressureFvPatchScalarField::
|
||||||
rotatingTotalPressureFvPatchScalarField
|
rotatingTotalPressureFvPatchScalarField
|
||||||
(
|
(
|
||||||
const rotatingTotalPressureFvPatchScalarField& tppsf
|
const rotatingTotalPressureFvPatchScalarField& rtppsf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
totalPressureFvPatchScalarField(tppsf),
|
totalPressureFvPatchScalarField(rtppsf),
|
||||||
omega_(tppsf.omega_)
|
omega_(rtppsf.omega_().clone().ptr())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::rotatingTotalPressureFvPatchScalarField::
|
Foam::rotatingTotalPressureFvPatchScalarField::
|
||||||
rotatingTotalPressureFvPatchScalarField
|
rotatingTotalPressureFvPatchScalarField
|
||||||
(
|
(
|
||||||
const rotatingTotalPressureFvPatchScalarField& tppsf,
|
const rotatingTotalPressureFvPatchScalarField& rtppsf,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
totalPressureFvPatchScalarField(tppsf, iF),
|
totalPressureFvPatchScalarField(rtppsf, iF),
|
||||||
omega_(tppsf.omega_)
|
omega_(rtppsf.omega_().clone().ptr())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -102,9 +102,12 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector axisHat = omega_/mag(omega_);
|
const scalar t = this->db().time().value();
|
||||||
|
const vector om = omega_->value(t);
|
||||||
|
|
||||||
|
vector axisHat = om/mag(om);
|
||||||
tmp<vectorField> rotationVelocity =
|
tmp<vectorField> rotationVelocity =
|
||||||
omega_ ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
|
om ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
|
||||||
|
|
||||||
const vectorField Up
|
const vectorField Up
|
||||||
(
|
(
|
||||||
@ -119,7 +122,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
|||||||
void Foam::rotatingTotalPressureFvPatchScalarField::write(Ostream& os) const
|
void Foam::rotatingTotalPressureFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
totalPressureFvPatchScalarField::write(os);
|
totalPressureFvPatchScalarField::write(os);
|
||||||
os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
|
omega_->writeData(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ SourceFiles
|
|||||||
#define rotatingTotalPressureFvPatchScalarField_H
|
#define rotatingTotalPressureFvPatchScalarField_H
|
||||||
|
|
||||||
#include "totalPressureFvPatchScalarField.H"
|
#include "totalPressureFvPatchScalarField.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ class rotatingTotalPressureFvPatchScalarField
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Angular velocity of the frame
|
//- Angular velocity of the frame
|
||||||
vector omega_;
|
autoPtr<DataEntry<vector> > omega_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -126,21 +127,6 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the angular velocity of rotation
|
|
||||||
const vector& omega() const
|
|
||||||
{
|
|
||||||
return omega_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the angular velocity of rotation
|
|
||||||
vector& omega()
|
|
||||||
{
|
|
||||||
return omega_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
|
|||||||
@ -38,7 +38,7 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
origin_(vector::zero),
|
origin_(),
|
||||||
axis_(vector::zero),
|
axis_(vector::zero),
|
||||||
omega_(0)
|
omega_(0)
|
||||||
{}
|
{}
|
||||||
@ -56,7 +56,7 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||||
origin_(ptf.origin_),
|
origin_(ptf.origin_),
|
||||||
axis_(ptf.axis_),
|
axis_(ptf.axis_),
|
||||||
omega_(ptf.omega_)
|
omega_(ptf.omega_().clone().ptr())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.lookup("origin")),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.lookup("axis")),
|
||||||
omega_(readScalar(dict.lookup("omega")))
|
omega_(DataEntry<scalar>::New("omega", dict))
|
||||||
{
|
{
|
||||||
// Evaluate the wall velocity
|
// Evaluate the wall velocity
|
||||||
updateCoeffs();
|
updateCoeffs();
|
||||||
@ -81,27 +81,27 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
Foam::rotatingWallVelocityFvPatchVectorField::
|
Foam::rotatingWallVelocityFvPatchVectorField::
|
||||||
rotatingWallVelocityFvPatchVectorField
|
rotatingWallVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const rotatingWallVelocityFvPatchVectorField& pivpvf
|
const rotatingWallVelocityFvPatchVectorField& rwvpvf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(pivpvf),
|
fixedValueFvPatchField<vector>(rwvpvf),
|
||||||
origin_(pivpvf.origin_),
|
origin_(rwvpvf.origin_),
|
||||||
axis_(pivpvf.axis_),
|
axis_(rwvpvf.axis_),
|
||||||
omega_(pivpvf.omega_)
|
omega_(rwvpvf.omega_().clone().ptr())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::rotatingWallVelocityFvPatchVectorField::
|
Foam::rotatingWallVelocityFvPatchVectorField::
|
||||||
rotatingWallVelocityFvPatchVectorField
|
rotatingWallVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const rotatingWallVelocityFvPatchVectorField& pivpvf,
|
const rotatingWallVelocityFvPatchVectorField& rwvpvf,
|
||||||
const DimensionedField<vector, volMesh>& iF
|
const DimensionedField<vector, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(pivpvf, iF),
|
fixedValueFvPatchField<vector>(rwvpvf, iF),
|
||||||
origin_(pivpvf.origin_),
|
origin_(rwvpvf.origin_),
|
||||||
axis_(pivpvf.axis_),
|
axis_(rwvpvf.axis_),
|
||||||
omega_(pivpvf.omega_)
|
omega_(rwvpvf.omega_().clone().ptr())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -114,10 +114,13 @@ void Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scalar t = this->db().time().value();
|
||||||
|
scalar om = omega_->value(t);
|
||||||
|
|
||||||
// Calculate the rotating wall velocity from the specification of the motion
|
// Calculate the rotating wall velocity from the specification of the motion
|
||||||
const vectorField Up
|
const vectorField Up
|
||||||
(
|
(
|
||||||
(-omega_)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
(-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove the component of Up normal to the wall
|
// Remove the component of Up normal to the wall
|
||||||
@ -134,7 +137,7 @@ void Foam::rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const
|
|||||||
fvPatchVectorField::write(os);
|
fvPatchVectorField::write(os);
|
||||||
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
|
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
|
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("omega") << omega_ << token::END_STATEMENT << nl;
|
omega_->writeData(os);
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ SourceFiles
|
|||||||
#define rotatingWallVelocityFvPatchVectorField_H
|
#define rotatingWallVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ class rotatingWallVelocityFvPatchVectorField
|
|||||||
vector axis_;
|
vector axis_;
|
||||||
|
|
||||||
//- Rotational speed
|
//- Rotational speed
|
||||||
scalar omega_;
|
autoPtr<DataEntry<scalar> > omega_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -147,12 +148,6 @@ public:
|
|||||||
return axis_;
|
return axis_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the rotational speed
|
|
||||||
scalar omega() const
|
|
||||||
{
|
|
||||||
return omega_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return non-const access to the origin of the rotation
|
//- Return non-const access to the origin of the rotation
|
||||||
vector& origin()
|
vector& origin()
|
||||||
{
|
{
|
||||||
@ -165,12 +160,6 @@ public:
|
|||||||
return axis_;
|
return axis_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the rotational speed
|
|
||||||
scalar& omega()
|
|
||||||
{
|
|
||||||
return omega_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|||||||
@ -1,132 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "timeVaryingFlowRateInletVelocityFvPatchVectorField.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
#include "fvPatchFieldMapper.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
#include "Time.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<vector, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
flowRateInletVelocityFvPatchVectorField(p, iF),
|
|
||||||
timeSeries_()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf,
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<vector, volMesh>& iF,
|
|
||||||
const fvPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
flowRateInletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
|
||||||
timeSeries_(ptf.timeSeries_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<vector, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
flowRateInletVelocityFvPatchVectorField(p, iF, dict),
|
|
||||||
timeSeries_(dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
flowRateInletVelocityFvPatchVectorField(ptf),
|
|
||||||
timeSeries_(ptf.timeSeries_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf,
|
|
||||||
const DimensionedField<vector, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
flowRateInletVelocityFvPatchVectorField(ptf, iF),
|
|
||||||
timeSeries_(ptf.timeSeries_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
updateCoeffs()
|
|
||||||
{
|
|
||||||
if (updated())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
flowRate() = timeSeries_(this->db().time().timeOutputValue());
|
|
||||||
flowRateInletVelocityFvPatchVectorField::updateCoeffs();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
|
||||||
write(Ostream& os) const
|
|
||||||
{
|
|
||||||
flowRateInletVelocityFvPatchVectorField::write(os);
|
|
||||||
timeSeries_.write(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
makePatchTypeField
|
|
||||||
(
|
|
||||||
fvPatchVectorField,
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,182 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
|
|
||||||
Description
|
|
||||||
A time-varying form of a flow normal vector boundary condition. The
|
|
||||||
variation is specified as an interpolationTable (see
|
|
||||||
Foam::interpolationTable).
|
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
|
||||||
\verbatim
|
|
||||||
inlet
|
|
||||||
{
|
|
||||||
type timeVaryingFlowRateInletVelocity;
|
|
||||||
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
|
||||||
value uniform (0 0 0); // placeholder
|
|
||||||
fileName "$FOAM_CASE/time-series";
|
|
||||||
outOfBounds repeat; // (error|warn|clamp|repeat)
|
|
||||||
}
|
|
||||||
\endverbatim
|
|
||||||
|
|
||||||
Note
|
|
||||||
- The value is positive inwards
|
|
||||||
- may not work correctly for transonic inlets!
|
|
||||||
- strange behaviour with potentialFoam since the U equation is not solved
|
|
||||||
|
|
||||||
See Also
|
|
||||||
Foam::interpolationTable and Foam::flowRateInletVelocityFvPatchVectorField
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef timeVaryingFlowRateInletVelocityFvPatchVectorField_H
|
|
||||||
#define timeVaryingFlowRateInletVelocityFvPatchVectorField_H
|
|
||||||
|
|
||||||
#include "flowRateInletVelocityFvPatchVectorField.H"
|
|
||||||
#include "interpolationTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class timeVaryingFlowRateInletVelocityFvPatch Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
:
|
|
||||||
public flowRateInletVelocityFvPatchVectorField
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- the time series being used, including the bounding treatment
|
|
||||||
interpolationTable<scalar> timeSeries_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("timeVaryingFlowRateInletVelocity");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<vector, volMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<vector, volMesh>&,
|
|
||||||
const dictionary&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct by mapping given patch field onto a new patch
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField&,
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<vector, volMesh>&,
|
|
||||||
const fvPatchFieldMapper&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<fvPatchVectorField> clone() const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchVectorField>
|
|
||||||
(
|
|
||||||
new timeVaryingFlowRateInletVelocityFvPatchVectorField(*this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
|
||||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField&,
|
|
||||||
const DimensionedField<vector, volMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
|
||||||
virtual tmp<fvPatchVectorField> clone
|
|
||||||
(
|
|
||||||
const DimensionedField<vector, volMesh>& iF
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchVectorField>
|
|
||||||
(
|
|
||||||
new timeVaryingFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
*this,
|
|
||||||
iF
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the time series used
|
|
||||||
const interpolationTable<scalar>& timeSeries() const
|
|
||||||
{
|
|
||||||
return timeSeries_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
|
||||||
virtual void updateCoeffs();
|
|
||||||
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write(Ostream&) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,137 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "timeVaryingUniformFixedValueFvPatchField.H"
|
|
||||||
#include "Time.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchField<Type>(p, iF),
|
|
||||||
timeSeries_()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchField<Type>(p, iF),
|
|
||||||
timeSeries_(dict)
|
|
||||||
{
|
|
||||||
if (dict.found("value"))
|
|
||||||
{
|
|
||||||
fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
updateCoeffs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingUniformFixedValueFvPatchField<Type>& ptf,
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
|
||||||
const fvPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
|
||||||
timeSeries_(ptf.timeSeries_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingUniformFixedValueFvPatchField<Type>& ptf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchField<Type>(ptf),
|
|
||||||
timeSeries_(ptf.timeSeries_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingUniformFixedValueFvPatchField<Type>& ptf,
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchField<Type>(ptf, iF),
|
|
||||||
timeSeries_(ptf.timeSeries_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()
|
|
||||||
{
|
|
||||||
if (this->updated())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fvPatchField<Type>::operator==
|
|
||||||
(
|
|
||||||
timeSeries_(this->db().time().timeOutputValue())
|
|
||||||
);
|
|
||||||
fixedValueFvPatchField<Type>::updateCoeffs();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::write
|
|
||||||
(
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
fvPatchField<Type>::write(os);
|
|
||||||
timeSeries_.write(os);
|
|
||||||
this->writeEntry("value", os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::timeVaryingUniformFixedValueFvPatchField
|
|
||||||
|
|
||||||
Description
|
|
||||||
A time-varying form of a uniform fixed value boundary condition. The
|
|
||||||
variation is specified as an interpolationTable (see
|
|
||||||
Foam::interpolationTable for read options).
|
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
|
||||||
\verbatim
|
|
||||||
inlet
|
|
||||||
{
|
|
||||||
type timeVaryingUniformFixedValue;
|
|
||||||
fileName "$FOAM_CASE/time-series";
|
|
||||||
outOfBounds clamp; // (error|warn|clamp|repeat)
|
|
||||||
}
|
|
||||||
\endverbatim
|
|
||||||
|
|
||||||
Note
|
|
||||||
This class is derived directly from a fixedValue patch rather than from
|
|
||||||
a uniformFixedValue patch.
|
|
||||||
|
|
||||||
See Also
|
|
||||||
Foam::interpolationTable and Foam::fixedValueFvPatchField
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
timeVaryingUniformFixedValueFvPatchField.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef timeVaryingUniformFixedValueFvPatchField_H
|
|
||||||
#define timeVaryingUniformFixedValueFvPatchField_H
|
|
||||||
|
|
||||||
#include "fixedValueFvPatchField.H"
|
|
||||||
#include "interpolationTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class timeVaryingUniformFixedValueFvPatch Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class timeVaryingUniformFixedValueFvPatchField
|
|
||||||
:
|
|
||||||
public fixedValueFvPatchField<Type>
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- The time series being used, including the bounding treatment
|
|
||||||
interpolationTable<Type> timeSeries_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("timeVaryingUniformFixedValue");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, volMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, volMesh>&,
|
|
||||||
const dictionary&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct by mapping given patch field onto a new patch
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingUniformFixedValueFvPatchField<Type>&,
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, volMesh>&,
|
|
||||||
const fvPatchFieldMapper&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingUniformFixedValueFvPatchField<Type>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<fvPatchField<Type> > clone() const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchField<Type> >
|
|
||||||
(
|
|
||||||
new timeVaryingUniformFixedValueFvPatchField<Type>(*this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
|
||||||
timeVaryingUniformFixedValueFvPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingUniformFixedValueFvPatchField<Type>&,
|
|
||||||
const DimensionedField<Type, volMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
|
||||||
virtual tmp<fvPatchField<Type> > clone
|
|
||||||
(
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchField<Type> >
|
|
||||||
(
|
|
||||||
new timeVaryingUniformFixedValueFvPatchField<Type>(*this, iF)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the time series used
|
|
||||||
const interpolationTable<Type>& timeSeries() const
|
|
||||||
{
|
|
||||||
return timeSeries_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 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 "timeVaryingUniformFixedValueFvPatchField.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -40,7 +40,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(p, iF),
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
uniformValue_(pTraits<Type>::zero)
|
uniformValue_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -54,9 +54,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(p, iF),
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
uniformValue_(ptf.uniformValue_)
|
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::operator==(uniformValue_);
|
const scalar t = this->db().time().value();
|
||||||
|
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,9 +70,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(p, iF),
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
uniformValue_(pTraits<Type>(dict.lookup("uniformValue")))
|
uniformValue_(DataEntry<Type>::New("uniformValue", dict))
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::operator==(uniformValue_);
|
const scalar t = this->db().time().value();
|
||||||
|
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,9 +84,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(ptf),
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
uniformValue_(ptf.uniformValue_)
|
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::operator==(uniformValue_);
|
const scalar t = this->db().time().value();
|
||||||
|
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +99,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(ptf, iF),
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
uniformValue_(ptf.uniformValue_)
|
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::operator==(uniformValue_);
|
const scalar t = this->db().time().value();
|
||||||
|
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +115,8 @@ void uniformFixedValueFvPatchField<Type>::autoMap
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
this->setSize(m.size());
|
this->setSize(m.size());
|
||||||
fvPatchField<Type>::operator==(uniformValue_);
|
const scalar t = this->db().time().value();
|
||||||
|
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +124,7 @@ template<class Type>
|
|||||||
void uniformFixedValueFvPatchField<Type>::write(Ostream& os) const
|
void uniformFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::write(os);
|
fvPatchField<Type>::write(os);
|
||||||
os.writeKeyword("uniformValue")
|
uniformValue_->writeData(os);
|
||||||
<< uniformValue_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ class uniformFixedValueFvPatchField
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
Type uniformValue_;
|
autoPtr<DataEntry<Type> > uniformValue_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -127,21 +128,6 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the fluctuation scale
|
|
||||||
const Type& uniformValue() const
|
|
||||||
{
|
|
||||||
return uniformValue_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return reference to the fluctuation scale to allow adjustment
|
|
||||||
Type& uniformValue()
|
|
||||||
{
|
|
||||||
return uniformValue_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Mapping functions
|
// Mapping functions
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
|
|||||||
@ -235,7 +235,11 @@ tmp<Field<Type> > volPointInterpolation::flatBoundaryField
|
|||||||
{
|
{
|
||||||
label bFaceI = bm[patchI].patch().start() - mesh.nInternalFaces();
|
label bFaceI = bm[patchI].patch().start() - mesh.nInternalFaces();
|
||||||
|
|
||||||
if (!isA<emptyFvPatch>(bm[patchI]) && !bm[patchI].coupled())
|
if
|
||||||
|
(
|
||||||
|
!isA<emptyFvPatch>(bm[patchI])
|
||||||
|
&& !vf.boundaryField()[patchI].coupled()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SubList<Type>
|
SubList<Type>
|
||||||
(
|
(
|
||||||
|
|||||||
@ -31,6 +31,8 @@ License
|
|||||||
#include "coupledPointPatchFields.H"
|
#include "coupledPointPatchFields.H"
|
||||||
#include "pointConstraint.H"
|
#include "pointConstraint.H"
|
||||||
|
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -75,11 +77,19 @@ void volPointInterpolation::calcBoundaryAddressing()
|
|||||||
|
|
||||||
const polyBoundaryMesh& pbm = mesh().boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh().boundaryMesh();
|
||||||
|
|
||||||
|
// Get precalculated volField only so we can use coupled() tests for
|
||||||
|
// cyclicAMI
|
||||||
|
const surfaceScalarField& magSf = mesh().magSf();
|
||||||
|
|
||||||
forAll(pbm, patchI)
|
forAll(pbm, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = pbm[patchI];
|
const polyPatch& pp = pbm[patchI];
|
||||||
|
|
||||||
if (!isA<emptyPolyPatch>(pp) && !pp.coupled())
|
if
|
||||||
|
(
|
||||||
|
!isA<emptyPolyPatch>(pp)
|
||||||
|
&& !magSf.boundaryField()[patchI].coupled()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
label bFaceI = pp.start()-mesh().nInternalFaces();
|
label bFaceI = pp.start()-mesh().nInternalFaces();
|
||||||
|
|
||||||
|
|||||||
@ -31,9 +31,33 @@ License
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
|
#include "cyclicAMIPolyPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ParticleType>
|
||||||
|
void Foam::Cloud<ParticleType>::checkPatches() const
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh();
|
||||||
|
bool ok = true;
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
if (isA<cyclicAMIPolyPatch>(pbm[patchI]))
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
WarningIn("void Foam::Cloud<ParticleType>::initCloud(const bool)")
|
||||||
|
<< "Particle tracking across AMI patches is not currently "
|
||||||
|
<< "supported" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParticleType>
|
template<class ParticleType>
|
||||||
void Foam::Cloud<ParticleType>::calcCellWallFaces() const
|
void Foam::Cloud<ParticleType>::calcCellWallFaces() const
|
||||||
{
|
{
|
||||||
@ -76,6 +100,8 @@ Foam::Cloud<ParticleType>::Cloud
|
|||||||
nTrackingRescues_(),
|
nTrackingRescues_(),
|
||||||
cellWallFacesPtr_()
|
cellWallFacesPtr_()
|
||||||
{
|
{
|
||||||
|
checkPatches();
|
||||||
|
|
||||||
// Ask for the tetBasePtIs to trigger all processors to build
|
// Ask for the tetBasePtIs to trigger all processors to build
|
||||||
// them, otherwise, if some processors have no particles then
|
// them, otherwise, if some processors have no particles then
|
||||||
// there is a comms mismatch.
|
// there is a comms mismatch.
|
||||||
@ -100,6 +126,8 @@ Foam::Cloud<ParticleType>::Cloud
|
|||||||
nTrackingRescues_(),
|
nTrackingRescues_(),
|
||||||
cellWallFacesPtr_()
|
cellWallFacesPtr_()
|
||||||
{
|
{
|
||||||
|
checkPatches();
|
||||||
|
|
||||||
// Ask for the tetBasePtIs to trigger all processors to build
|
// Ask for the tetBasePtIs to trigger all processors to build
|
||||||
// them, otherwise, if some processors have no particles then
|
// them, otherwise, if some processors have no particles then
|
||||||
// there is a comms mismatch.
|
// there is a comms mismatch.
|
||||||
|
|||||||
@ -93,6 +93,9 @@ class Cloud
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Check patches
|
||||||
|
void checkPatches() const;
|
||||||
|
|
||||||
//- Initialise cloud on IO constructor
|
//- Initialise cloud on IO constructor
|
||||||
void initCloud(const bool checkClass);
|
void initCloud(const bool checkClass);
|
||||||
|
|
||||||
|
|||||||
@ -162,6 +162,8 @@ Foam::Cloud<ParticleType>::Cloud
|
|||||||
nTrackingRescues_(),
|
nTrackingRescues_(),
|
||||||
cellWallFacesPtr_()
|
cellWallFacesPtr_()
|
||||||
{
|
{
|
||||||
|
checkPatches();
|
||||||
|
|
||||||
initCloud(checkClass);
|
initCloud(checkClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +182,8 @@ Foam::Cloud<ParticleType>::Cloud
|
|||||||
nTrackingRescues_(),
|
nTrackingRescues_(),
|
||||||
cellWallFacesPtr_()
|
cellWallFacesPtr_()
|
||||||
{
|
{
|
||||||
|
checkPatches();
|
||||||
|
|
||||||
initCloud(checkClass);
|
initCloud(checkClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::fieldValues::cellSource::operationType,
|
Foam::fieldValues::cellSource::operationType,
|
||||||
7
|
8
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
@ -59,7 +59,8 @@ namespace Foam
|
|||||||
"volIntegrate",
|
"volIntegrate",
|
||||||
"weightedAverage",
|
"weightedAverage",
|
||||||
"min",
|
"min",
|
||||||
"max"
|
"max",
|
||||||
|
"CoV"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ namespace Foam
|
|||||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2>
|
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2>
|
||||||
Foam::fieldValues::cellSource::sourceTypeNames_;
|
Foam::fieldValues::cellSource::sourceTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>
|
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 8>
|
||||||
Foam::fieldValues::cellSource::operationTypeNames_;
|
Foam::fieldValues::cellSource::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,7 @@ Description
|
|||||||
- volAverage
|
- volAverage
|
||||||
- volIntegrate
|
- volIntegrate
|
||||||
- weightedAverage
|
- weightedAverage
|
||||||
|
- CoV (Coefficient of variation: standard deviation/mean)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
cellSource.C
|
cellSource.C
|
||||||
@ -106,11 +107,12 @@ public:
|
|||||||
opVolIntegrate,
|
opVolIntegrate,
|
||||||
opWeightedAverage,
|
opWeightedAverage,
|
||||||
opMin,
|
opMin,
|
||||||
opMax
|
opMax,
|
||||||
|
opCoV
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 7> operationTypeNames_;
|
static const NamedEnum<operationType, 8> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -115,6 +115,23 @@ Type Foam::fieldValues::cellSource::processValues
|
|||||||
result = max(values);
|
result = max(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opCoV:
|
||||||
|
{
|
||||||
|
Type meanValue = sum(values*V)/sum(V);
|
||||||
|
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
scalarField vals(values.component(d));
|
||||||
|
scalar mean = component(meanValue, d);
|
||||||
|
scalar& res = setComponent(result, d);
|
||||||
|
|
||||||
|
res = sqrt(sum(V*sqr(vals - mean))/(V.size()*sum(V)))/mean;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|||||||
@ -53,7 +53,7 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::fieldValues::faceSource::operationType,
|
Foam::fieldValues::faceSource::operationType,
|
||||||
7
|
8
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
@ -62,7 +62,8 @@ namespace Foam
|
|||||||
"areaIntegrate",
|
"areaIntegrate",
|
||||||
"weightedAverage",
|
"weightedAverage",
|
||||||
"min",
|
"min",
|
||||||
"max"
|
"max",
|
||||||
|
"CoV"
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ namespace Foam
|
|||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
||||||
Foam::fieldValues::faceSource::sourceTypeNames_;
|
Foam::fieldValues::faceSource::sourceTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 7>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 8>
|
||||||
Foam::fieldValues::faceSource::operationTypeNames_;
|
Foam::fieldValues::faceSource::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,7 @@ Description
|
|||||||
- weightedAverage
|
- weightedAverage
|
||||||
- min
|
- min
|
||||||
- max
|
- max
|
||||||
|
- CoV (Coefficient of variation: standard deviation/mean)
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- faces on empty patches get ignored
|
- faces on empty patches get ignored
|
||||||
@ -132,11 +133,12 @@ public:
|
|||||||
opAreaIntegrate,
|
opAreaIntegrate,
|
||||||
opWeightedAverage,
|
opWeightedAverage,
|
||||||
opMin,
|
opMin,
|
||||||
opMax
|
opMax,
|
||||||
|
opCoV
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 7> operationTypeNames_;
|
static const NamedEnum<operationType, 8> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -134,6 +134,25 @@ Type Foam::fieldValues::faceSource::processValues
|
|||||||
result = max(values);
|
result = max(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opCoV:
|
||||||
|
{
|
||||||
|
Type meanValue = sum(values*magSf)/sum(magSf);
|
||||||
|
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
scalarField vals(values.component(d));
|
||||||
|
scalar mean = component(meanValue, d);
|
||||||
|
scalar& res = setComponent(result, d);
|
||||||
|
|
||||||
|
res =
|
||||||
|
sqrt(sum(magSf*sqr(vals - mean))/(magSf.size()*sum(magSf)))
|
||||||
|
/mean;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|||||||
@ -38,7 +38,7 @@ boundaryField
|
|||||||
left
|
left
|
||||||
{
|
{
|
||||||
type uniformFixedValue;
|
type uniformFixedValue;
|
||||||
uniformValue (1 0 0);
|
uniformValue constant (1 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cylinder
|
cylinder
|
||||||
|
|||||||
@ -22,7 +22,7 @@ oneD true;
|
|||||||
|
|
||||||
sampleMode nearestPatchFace;
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch
|
oneDPolyPatchType empty; //wedge
|
||||||
|
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
|
|||||||
@ -15,8 +15,8 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//combustionModel infinitelyFastChemistry<psiCombustionModel,gasThermoPhysics>;
|
combustionModel infinitelyFastChemistry<psiCombustionModel,gasThermoPhysics>;
|
||||||
combustionModel FSD<psiCombustionModel,gasThermoPhysics>;
|
//combustionModel FSD<psiCombustionModel,gasThermoPhysics>;
|
||||||
|
|
||||||
active true;
|
active true;
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.1;
|
flowRate constant 0.1;
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -43,7 +43,7 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.1;
|
flowRate constant 0.1;
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -43,7 +43,7 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.1;
|
flowRate constant 0.1;
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -28,7 +28,7 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.5; //0.75;
|
flowRate constant 0.5; //0.75;
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -43,7 +43,7 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.1;
|
flowRate constant 0.1;
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -54,8 +54,8 @@ boundaryField
|
|||||||
ground
|
ground
|
||||||
{
|
{
|
||||||
type uniformFixedValue;
|
type uniformFixedValue;
|
||||||
uniformValue (0 0 0);
|
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
|
uniformValue constant (0 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "include/sideAndTopPatches"
|
#include "include/sideAndTopPatches"
|
||||||
|
|||||||
@ -33,8 +33,8 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type uniformFixedValue;
|
type uniformFixedValue;
|
||||||
uniformValue $turbulentKE;
|
|
||||||
value $turbulentKE;
|
value $turbulentKE;
|
||||||
|
uniformValue constant $turbulentKE;
|
||||||
}
|
}
|
||||||
"terrain_.*"
|
"terrain_.*"
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,8 +30,8 @@ boundaryField
|
|||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type uniformFixedValue;
|
type uniformFixedValue;
|
||||||
value uniform $pressure;
|
value $pressure;
|
||||||
uniformValue $pressure;
|
uniformValue constant $pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
"terrain_.*"
|
"terrain_.*"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ cp system/decomposeParDict-4proc system/decomposeParDict
|
|||||||
# Unset floating point trapping since creating processor directories
|
# Unset floating point trapping since creating processor directories
|
||||||
unset FOAM_SIGFPE
|
unset FOAM_SIGFPE
|
||||||
unset FOAM_SETNAN
|
unset FOAM_SETNAN
|
||||||
runParallel redistributeMeshPar 4 -overwrite
|
runParallel redistributePar 4 -overwrite
|
||||||
runParallel renumberMesh 4 -overwrite
|
runParallel renumberMesh 4 -overwrite
|
||||||
|
|
||||||
# Add wildcard entries for meshes patches since not preserved
|
# Add wildcard entries for meshes patches since not preserved
|
||||||
|
|||||||
@ -32,13 +32,13 @@ boundaryField
|
|||||||
inletCentral
|
inletCentral
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00379;
|
flowRate constant 0.00379;
|
||||||
value uniform (0 14.68 0);
|
value uniform (0 14.68 0);
|
||||||
}
|
}
|
||||||
inletSides
|
inletSides
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00832;
|
flowRate constant 0.00832;
|
||||||
value uniform (0 17.79 0);
|
value uniform (0 17.79 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -32,13 +32,13 @@ boundaryField
|
|||||||
inletCentral
|
inletCentral
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00379;
|
flowRate constant 0.00379;
|
||||||
value uniform (0 14.68 0);
|
value uniform (0 14.68 0);
|
||||||
}
|
}
|
||||||
inletSides
|
inletSides
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00832;
|
flowRate constant 0.00832;
|
||||||
value uniform (0 17.79 0);
|
value uniform (0 17.79 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -32,13 +32,13 @@ boundaryField
|
|||||||
inletCentral
|
inletCentral
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00379;
|
flowRate constant 0.00379;
|
||||||
value uniform (0 14.68 0);
|
value uniform (0 14.68 0);
|
||||||
}
|
}
|
||||||
inletSides
|
inletSides
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00832;
|
flowRate constant 0.00832;
|
||||||
value uniform (0 17.79 0);
|
value uniform (0 17.79 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
@ -32,13 +32,13 @@ boundaryField
|
|||||||
inletCentral
|
inletCentral
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00379;
|
flowRate constant 0.00379;
|
||||||
value uniform (0 14.68 0);
|
value uniform (0 14.68 0);
|
||||||
}
|
}
|
||||||
inletSides
|
inletSides
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
flowRate 0.00832;
|
flowRate constant 0.00832;
|
||||||
value uniform (0 17.79 0);
|
value uniform (0 17.79 0);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
|
|||||||
Reference in New Issue
Block a user