mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
timeVaryingMappedFixedValue: Reinstated support for AverageField
This commit is contained in:
@ -123,6 +123,23 @@ void Foam::pointPatchField<Type>::write(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
template<class EntryType>
|
||||||
|
void Foam::pointPatchField<Type>::writeEntryIfDifferent
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& entryName,
|
||||||
|
const EntryType& value1,
|
||||||
|
const EntryType& value2
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (value1 != value2)
|
||||||
|
{
|
||||||
|
os.writeKeyword(entryName) << value2 << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type>>
|
Foam::tmp<Foam::Field<Type>>
|
||||||
Foam::pointPatchField<Type>::patchInternalField() const
|
Foam::pointPatchField<Type>::patchInternalField() const
|
||||||
|
|||||||
@ -429,8 +429,21 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Write
|
// I-O
|
||||||
virtual void write(Ostream&) const;
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
//- Helper function to write the keyword and entry only if the
|
||||||
|
// values are not equal. The value is then output as value2
|
||||||
|
template<class EntryType>
|
||||||
|
void writeEntryIfDifferent
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const word& entryName,
|
||||||
|
const EntryType& value1,
|
||||||
|
const EntryType& value2
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|||||||
@ -27,6 +27,18 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::Constant<Type>::Constant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const Type& val
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<Type>(entryName),
|
||||||
|
value_(val)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1Types::Constant<Type>::Constant
|
Foam::Function1Types::Constant<Type>::Constant
|
||||||
(
|
(
|
||||||
|
|||||||
@ -78,6 +78,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and value
|
||||||
|
Constant(const word& entryName, const Type& val);
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name and dictionary
|
||||||
Constant(const word& entryName, const dictionary& dict);
|
Constant(const word& entryName, const dictionary& dict);
|
||||||
|
|
||||||
|
|||||||
@ -180,7 +180,6 @@ $(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorFi
|
|||||||
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C
|
|
||||||
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
|
$(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
|
||||||
|
|||||||
@ -23,65 +23,60 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "AverageIOField.H"
|
#include "AverageField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::AverageIOField<Type>::AverageIOField
|
Foam::AverageField<Type>::AverageField(const label size)
|
||||||
(
|
|
||||||
const IOobject& io
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
regIOobject(io)
|
|
||||||
{
|
|
||||||
readStream(typeName) >> average_;
|
|
||||||
readStream(typeName) >> static_cast<Field<Type>&>(*this);
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::AverageIOField<Type>::AverageIOField
|
|
||||||
(
|
|
||||||
const IOobject& io,
|
|
||||||
const label size
|
|
||||||
)
|
|
||||||
:
|
|
||||||
regIOobject(io),
|
|
||||||
Field<Type>(size),
|
Field<Type>(size),
|
||||||
average_(Zero)
|
average_(Zero)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::AverageIOField<Type>::AverageIOField
|
Foam::AverageField<Type>::AverageField
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const Field<Type>& f,
|
||||||
const Type& average,
|
const Type& average
|
||||||
const Field<Type>& f
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
regIOobject(io),
|
|
||||||
Field<Type>(f),
|
Field<Type>(f),
|
||||||
average_(average)
|
average_(average)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::AverageField<Type>::AverageField(Istream& is)
|
||||||
|
:
|
||||||
|
Field<Type>(is),
|
||||||
|
average_(pTraits<Type>(is))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Type& Foam::AverageField<Type>::average() const
|
||||||
{
|
{
|
||||||
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
return average_;
|
||||||
{
|
|
||||||
readStream(typeName)
|
|
||||||
>> average_
|
|
||||||
>> static_cast<Field<Type>&>(*this);
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::AverageIOField<Type>::writeData(Ostream& os) const
|
Type&Foam::AverageField<Type>::average()
|
||||||
{
|
{
|
||||||
os << average_
|
return average_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::AverageField<Type>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << static_cast<const Field<Type>&>(*this)
|
||||||
<< token::NL
|
<< token::NL
|
||||||
<< static_cast<const Field<Type>&>(*this);
|
<< average_;
|
||||||
|
|
||||||
return os.good();
|
return os.good();
|
||||||
}
|
}
|
||||||
@ -22,20 +22,19 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::AverageIOField
|
Foam::AverageField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A primitive field + average with IO.
|
A primitive field with a separate average value.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
AverageIOField.C
|
AverageField.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef AverageIOField_H
|
#ifndef AverageField_H
|
||||||
#define AverageIOField_H
|
#define AverageField_H
|
||||||
|
|
||||||
#include "regIOobject.H"
|
|
||||||
#include "Field.H"
|
#include "Field.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -44,13 +43,12 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class AverageIOField Declaration
|
Class AverageField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class AverageIOField
|
class AverageField
|
||||||
:
|
:
|
||||||
public regIOobject,
|
|
||||||
public Field<Type>
|
public Field<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
@ -61,44 +59,23 @@ class AverageIOField
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeName("AverageField");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOobject
|
//- Construct from size (does not set values)
|
||||||
AverageIOField
|
AverageField(const label size);
|
||||||
(
|
|
||||||
const IOobject&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from IOobject and size (does not set values)
|
|
||||||
AverageIOField
|
|
||||||
(
|
|
||||||
const IOobject&,
|
|
||||||
const label size
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
AverageIOField
|
AverageField(const Field<Type>&, const Type& average);
|
||||||
(
|
|
||||||
const IOobject&,
|
//- Construct from Istream
|
||||||
const Type& average,
|
AverageField(Istream&);
|
||||||
const Field<Type>&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
const Type& average() const
|
const Type& average() const;
|
||||||
{
|
|
||||||
return average_;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type& average()
|
Type& average();
|
||||||
{
|
|
||||||
return average_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool writeData(Ostream& os) const;
|
bool writeData(Ostream& os) const;
|
||||||
};
|
};
|
||||||
@ -111,7 +88,7 @@ public:
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "AverageIOField.C"
|
#include "AverageField.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -1,78 +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/>.
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "AverageIOField.H"
|
|
||||||
#include "fieldTypes.H"
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
typedef AverageIOField<scalar> scalarAverageIOField;
|
|
||||||
typedef AverageIOField<vector> vectorAverageIOField;
|
|
||||||
typedef AverageIOField<sphericalTensor> sphericalTensorAverageIOField;
|
|
||||||
typedef AverageIOField<symmTensor> symmTensorAverageIOField;
|
|
||||||
typedef AverageIOField<tensor> tensorAverageIOField;
|
|
||||||
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
scalarAverageIOField,
|
|
||||||
"scalarAverageField",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
vectorAverageIOField,
|
|
||||||
"vectorAverageField",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
sphericalTensorAverageIOField,
|
|
||||||
"sphericalTensorAverageField",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
symmTensorAverageIOField,
|
|
||||||
"symmTensorAverageField",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
tensorAverageIOField,
|
|
||||||
"tensorAverageField",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "timeVaryingMappedFixedValueFvPatchField.H"
|
#include "timeVaryingMappedFixedValueFvPatchField.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "AverageField.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -64,7 +65,7 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(p, iF),
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
fieldTableName_(iF.name()),
|
fieldTableName_(iF.name()),
|
||||||
setAverage_(readBool(dict.lookup("setAverage"))),
|
setAverage_(dict.lookupOrDefault("setAverage", false)),
|
||||||
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
||||||
mapMethod_
|
mapMethod_
|
||||||
(
|
(
|
||||||
@ -82,8 +83,13 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
endSampleTime_(-1),
|
endSampleTime_(-1),
|
||||||
endSampledValues_(0),
|
endSampledValues_(0),
|
||||||
endAverage_(Zero),
|
endAverage_(Zero),
|
||||||
offset_(Function1<Type>::New("offset", dict))
|
offset_()
|
||||||
{
|
{
|
||||||
|
if (dict.found("offset"))
|
||||||
|
{
|
||||||
|
offset_ = Function1<Type>::New("offset", dict);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
mapMethod_ != "planarInterpolation"
|
mapMethod_ != "planarInterpolation"
|
||||||
@ -97,7 +103,6 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
<< ", 'nearest'" << exit(FatalIOError);
|
<< ", 'nearest'" << exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dict.readIfPresent("fieldTable", fieldTableName_);
|
dict.readIfPresent("fieldTable", fieldTableName_);
|
||||||
|
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
@ -251,20 +256,6 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
|
|||||||
|
|
||||||
pointField samplePoints((IFstream(samplePointsFile)()));
|
pointField samplePoints((IFstream(samplePointsFile)()));
|
||||||
|
|
||||||
// pointIOField samplePoints
|
|
||||||
// (
|
|
||||||
// IOobject
|
|
||||||
// (
|
|
||||||
// "points",
|
|
||||||
// this->db().time().constant(),
|
|
||||||
// "boundaryData"/this->patch().name(),
|
|
||||||
// this->db(),
|
|
||||||
// IOobject::MUST_READ,
|
|
||||||
// IOobject::AUTO_WRITE,
|
|
||||||
// false
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "timeVaryingMappedFixedValueFvPatchField :"
|
Info<< "timeVaryingMappedFixedValueFvPatchField :"
|
||||||
@ -376,22 +367,18 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
|
|||||||
/fieldTableName_
|
/fieldTableName_
|
||||||
);
|
);
|
||||||
|
|
||||||
Field<Type> vals((IFstream(valsFile)()));
|
Field<Type> vals;
|
||||||
// IOField<Type> vals
|
|
||||||
// (
|
if (setAverage_)
|
||||||
// IOobject
|
{
|
||||||
// (
|
AverageField<Type> avals((IFstream(valsFile)()));
|
||||||
// fieldTableName_,
|
vals = avals;
|
||||||
// this->db().time().constant(),
|
startAverage_ = avals.average();
|
||||||
// "boundaryData"
|
}
|
||||||
// /this->patch().name()
|
else
|
||||||
// /sampleTimes_[startSampleTime_].name(),
|
{
|
||||||
// this->db(),
|
IFstream(valsFile)() >> vals;
|
||||||
// IOobject::MUST_READ,
|
}
|
||||||
// IOobject::AUTO_WRITE,
|
|
||||||
// false
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
|
|
||||||
if (vals.size() != mapperPtr_().sourceSize())
|
if (vals.size() != mapperPtr_().sourceSize())
|
||||||
{
|
{
|
||||||
@ -402,7 +389,6 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
|
|||||||
<< ") in file " << valsFile << exit(FatalError);
|
<< ") in file " << valsFile << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
//startAverage_ = vals.average();
|
|
||||||
startSampledValues_ = mapperPtr_().interpolate(vals);
|
startSampledValues_ = mapperPtr_().interpolate(vals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -432,32 +418,37 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reread values and interpolate
|
// Reread values and interpolate
|
||||||
IOField<Type> vals
|
fileName valsFile
|
||||||
(
|
(
|
||||||
IOobject
|
this->db().time().constant()
|
||||||
(
|
/"boundaryData"
|
||||||
fieldTableName_,
|
/this->patch().name()
|
||||||
this->db().time().constant(),
|
/sampleTimes_[endSampleTime_].name()
|
||||||
"boundaryData"
|
/fieldTableName_
|
||||||
/this->patch().name()
|
|
||||||
/sampleTimes_[endSampleTime_].name(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Field<Type> vals;
|
||||||
|
|
||||||
|
if (setAverage_)
|
||||||
|
{
|
||||||
|
AverageField<Type> avals((IFstream(valsFile)()));
|
||||||
|
vals = avals;
|
||||||
|
endAverage_ = avals.average();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IFstream(valsFile)() >> vals;
|
||||||
|
}
|
||||||
|
|
||||||
if (vals.size() != mapperPtr_().sourceSize())
|
if (vals.size() != mapperPtr_().sourceSize())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Number of values (" << vals.size()
|
<< "Number of values (" << vals.size()
|
||||||
<< ") differs from the number of points ("
|
<< ") differs from the number of points ("
|
||||||
<< mapperPtr_().sourceSize()
|
<< mapperPtr_().sourceSize()
|
||||||
<< ") in file " << vals.objectPath() << exit(FatalError);
|
<< ") in file " << valsFile << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
//endAverage_ = vals.average();
|
|
||||||
endSampledValues_ = mapperPtr_().interpolate(vals);
|
endSampledValues_ = mapperPtr_().interpolate(vals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +472,7 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
|||||||
|
|
||||||
if (endSampleTime_ == -1)
|
if (endSampleTime_ == -1)
|
||||||
{
|
{
|
||||||
// only start value
|
// Only start value
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "updateCoeffs : Sampled, non-interpolated values"
|
Pout<< "updateCoeffs : Sampled, non-interpolated values"
|
||||||
@ -554,9 +545,12 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply offset to mapped values
|
// Apply offset to mapped values
|
||||||
const scalar t = this->db().time().timeOutputValue();
|
if (offset_.valid())
|
||||||
this->operator==(*this + offset_->value(t));
|
{
|
||||||
|
const scalar t = this->db().time().timeOutputValue();
|
||||||
|
this->operator==(*this + offset_->value(t));
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -576,31 +570,31 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::write
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::write(os);
|
fvPatchField<Type>::write(os);
|
||||||
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
|
|
||||||
if (perturb_ != 1e-5)
|
|
||||||
{
|
|
||||||
os.writeKeyword("perturb") << perturb_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fieldTableName_ != this->internalField().name())
|
this->writeEntryIfDifferent(os, "setAverage", Switch(false), setAverage_);
|
||||||
{
|
|
||||||
os.writeKeyword("fieldTable") << fieldTableName_
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
this->writeEntryIfDifferent(os, "perturb", 1e-5, perturb_);
|
||||||
|
|
||||||
|
this->writeEntryIfDifferent
|
||||||
(
|
(
|
||||||
(
|
os,
|
||||||
!mapMethod_.empty()
|
"fieldTable",
|
||||||
&& mapMethod_ != "planarInterpolation"
|
this->internalField().name(),
|
||||||
)
|
fieldTableName_
|
||||||
)
|
);
|
||||||
{
|
|
||||||
os.writeKeyword("mapMethod") << mapMethod_
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset_->writeData(os);
|
this->writeEntryIfDifferent
|
||||||
|
(
|
||||||
|
os,
|
||||||
|
"mapMethod",
|
||||||
|
word("planarInterpolation"),
|
||||||
|
mapMethod_
|
||||||
|
);
|
||||||
|
|
||||||
|
if (offset_.valid())
|
||||||
|
{
|
||||||
|
offset_->writeData(os);
|
||||||
|
}
|
||||||
|
|
||||||
this->writeEntry("value", os);
|
this->writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,38 +29,36 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
This boundary conditions interpolates the values from a set of supplied
|
This boundary conditions interpolates the values from a set of supplied
|
||||||
points in space and time. Supplied data should be specified in
|
points in space and time.
|
||||||
constant/boundaryData/\<patchname\> where:
|
|
||||||
- points : pointField with locations
|
|
||||||
- ddd : supplied values at time ddd
|
|
||||||
The default mode of operation (mapMethod planarInterpolation) is
|
|
||||||
to project the points onto a plane (constructed from the first threee
|
|
||||||
points) and construct a 2D triangulation and finds for the face centres
|
|
||||||
the triangle it is in and the weights to the 3 vertices.
|
|
||||||
|
|
||||||
The optional mapMethod nearest will avoid all projection and
|
Supplied data should be specified in constant/boundaryData/\<patchname\>/
|
||||||
triangulation and just use the value at the nearest vertex.
|
- points : pointField of locations
|
||||||
|
- \<time\>/\<field\> : field of values at time \<time\>
|
||||||
|
|
||||||
|
The default mode of operation (mapMethod planarInterpolation) is to project
|
||||||
|
the points onto a plane (constructed from the first threee points) and
|
||||||
|
construct a 2D triangulation and finds for the face centres the triangle it
|
||||||
|
is in and the weights to the 3 vertices.
|
||||||
|
|
||||||
|
The optional mapMethod nearest will avoid all projection and triangulation
|
||||||
|
and just use the value at the nearest vertex.
|
||||||
|
|
||||||
Values are interpolated linearly between times.
|
Values are interpolated linearly between times.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
setAverage | flag to activate setting of average value | yes |
|
setAverage | Switch to activate setting of average value | no | false
|
||||||
perturb | perturb points for regular geometries | no | 1e-5
|
perturb | Perturb points for regular geometries | no | 1e-5
|
||||||
fieldTableName | alternative field name to sample | no| this field name
|
fieldTableName | Alternative field name to sample | no| this field name
|
||||||
mapMethod | type of mapping | no | planarInterpolation
|
mapMethod | Type of mapping | no | planarInterpolation
|
||||||
offset | for applying offset to mapped values | no | constant 0.0
|
offset | Offset to mapped values | no | Zero
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
\verbatim
|
\verbatim
|
||||||
<patchName>
|
<patchName>
|
||||||
{
|
{
|
||||||
type timeVaryingMappedFixedValue;
|
type timeVaryingMappedFixedValue;
|
||||||
setAverage false;
|
|
||||||
//perturb 0.0;
|
|
||||||
//fieldTableName samples;
|
|
||||||
//offset constant 0.2;
|
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
@ -102,7 +100,7 @@ class timeVaryingMappedFixedValueFvPatchField
|
|||||||
word fieldTableName_;
|
word fieldTableName_;
|
||||||
|
|
||||||
//- If true adjust the mapped field to maintain average value
|
//- If true adjust the mapped field to maintain average value
|
||||||
bool setAverage_;
|
Switch setAverage_;
|
||||||
|
|
||||||
//- Fraction of perturbation (fraction of bounding box) to add
|
//- Fraction of perturbation (fraction of bounding box) to add
|
||||||
scalar perturb_;
|
scalar perturb_;
|
||||||
|
|||||||
@ -25,13 +25,13 @@ License
|
|||||||
|
|
||||||
#include "timeVaryingMappedFixedValuePointPatchField.H"
|
#include "timeVaryingMappedFixedValuePointPatchField.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "AverageIOField.H"
|
#include "AverageField.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::
|
Foam::timeVaryingMappedFixedValuePointPatchField<Type>::
|
||||||
timeVaryingMappedFixedValuePointPatchField<Type>::
|
|
||||||
timeVaryingMappedFixedValuePointPatchField
|
timeVaryingMappedFixedValuePointPatchField
|
||||||
(
|
(
|
||||||
const pointPatch& p,
|
const pointPatch& p,
|
||||||
@ -55,41 +55,7 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::
|
Foam::timeVaryingMappedFixedValuePointPatchField<Type>::
|
||||||
timeVaryingMappedFixedValuePointPatchField<Type>::
|
|
||||||
timeVaryingMappedFixedValuePointPatchField
|
|
||||||
(
|
|
||||||
const timeVaryingMappedFixedValuePointPatchField<Type>& ptf,
|
|
||||||
const pointPatch& p,
|
|
||||||
const DimensionedField<Type, pointMesh>& iF,
|
|
||||||
const pointPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
|
||||||
fieldTableName_(ptf.fieldTableName_),
|
|
||||||
setAverage_(ptf.setAverage_),
|
|
||||||
perturb_(ptf.perturb_),
|
|
||||||
mapMethod_(ptf.mapMethod_),
|
|
||||||
mapperPtr_(NULL),
|
|
||||||
sampleTimes_(0),
|
|
||||||
startSampleTime_(-1),
|
|
||||||
startSampledValues_(0),
|
|
||||||
startAverage_(Zero),
|
|
||||||
endSampleTime_(-1),
|
|
||||||
endSampledValues_(0),
|
|
||||||
endAverage_(Zero),
|
|
||||||
offset_
|
|
||||||
(
|
|
||||||
ptf.offset_.valid()
|
|
||||||
? ptf.offset_().clone().ptr()
|
|
||||||
: NULL
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::
|
|
||||||
timeVaryingMappedFixedValuePointPatchField<Type>::
|
|
||||||
timeVaryingMappedFixedValuePointPatchField
|
timeVaryingMappedFixedValuePointPatchField
|
||||||
(
|
(
|
||||||
const pointPatch& p,
|
const pointPatch& p,
|
||||||
@ -99,7 +65,7 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
:
|
:
|
||||||
fixedValuePointPatchField<Type>(p, iF),
|
fixedValuePointPatchField<Type>(p, iF),
|
||||||
fieldTableName_(iF.name()),
|
fieldTableName_(iF.name()),
|
||||||
setAverage_(readBool(dict.lookup("setAverage"))),
|
setAverage_(dict.lookupOrDefault("setAverage", false)),
|
||||||
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
||||||
mapMethod_
|
mapMethod_
|
||||||
(
|
(
|
||||||
@ -124,6 +90,19 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
offset_ = Function1<Type>::New("offset", dict);
|
offset_ = Function1<Type>::New("offset", dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
mapMethod_ != "planarInterpolation"
|
||||||
|
&& mapMethod_ != "nearest"
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction
|
||||||
|
(
|
||||||
|
dict
|
||||||
|
) << "mapMethod should be one of 'planarInterpolation'"
|
||||||
|
<< ", 'nearest'" << exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
dict.readIfPresent("fieldTableName", fieldTableName_);
|
dict.readIfPresent("fieldTableName", fieldTableName_);
|
||||||
|
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
@ -145,8 +124,34 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::
|
Foam::timeVaryingMappedFixedValuePointPatchField<Type>::
|
||||||
timeVaryingMappedFixedValuePointPatchField<Type>::
|
timeVaryingMappedFixedValuePointPatchField
|
||||||
|
(
|
||||||
|
const timeVaryingMappedFixedValuePointPatchField<Type>& ptf,
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<Type, pointMesh>& iF,
|
||||||
|
const pointPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
perturb_(ptf.perturb_),
|
||||||
|
mapMethod_(ptf.mapMethod_),
|
||||||
|
mapperPtr_(NULL),
|
||||||
|
sampleTimes_(0),
|
||||||
|
startSampleTime_(-1),
|
||||||
|
startSampledValues_(0),
|
||||||
|
startAverage_(Zero),
|
||||||
|
endSampleTime_(-1),
|
||||||
|
endSampledValues_(0),
|
||||||
|
endAverage_(Zero),
|
||||||
|
offset_(ptf.offset_, false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::timeVaryingMappedFixedValuePointPatchField<Type>::
|
||||||
timeVaryingMappedFixedValuePointPatchField
|
timeVaryingMappedFixedValuePointPatchField
|
||||||
(
|
(
|
||||||
const timeVaryingMappedFixedValuePointPatchField<Type>& ptf
|
const timeVaryingMappedFixedValuePointPatchField<Type>& ptf
|
||||||
@ -165,18 +170,12 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
endSampleTime_(ptf.endSampleTime_),
|
endSampleTime_(ptf.endSampleTime_),
|
||||||
endSampledValues_(ptf.endSampledValues_),
|
endSampledValues_(ptf.endSampledValues_),
|
||||||
endAverage_(ptf.endAverage_),
|
endAverage_(ptf.endAverage_),
|
||||||
offset_
|
offset_(ptf.offset_, false)
|
||||||
(
|
|
||||||
ptf.offset_.valid()
|
|
||||||
? ptf.offset_().clone().ptr()
|
|
||||||
: NULL
|
|
||||||
)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::
|
Foam::timeVaryingMappedFixedValuePointPatchField<Type>::
|
||||||
timeVaryingMappedFixedValuePointPatchField<Type>::
|
|
||||||
timeVaryingMappedFixedValuePointPatchField
|
timeVaryingMappedFixedValuePointPatchField
|
||||||
(
|
(
|
||||||
const timeVaryingMappedFixedValuePointPatchField<Type>& ptf,
|
const timeVaryingMappedFixedValuePointPatchField<Type>& ptf,
|
||||||
@ -196,12 +195,7 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
endSampleTime_(ptf.endSampleTime_),
|
endSampleTime_(ptf.endSampleTime_),
|
||||||
endSampledValues_(ptf.endSampledValues_),
|
endSampledValues_(ptf.endSampledValues_),
|
||||||
endAverage_(ptf.endAverage_),
|
endAverage_(ptf.endAverage_),
|
||||||
offset_
|
offset_(ptf.offset_, false)
|
||||||
(
|
|
||||||
ptf.offset_.valid()
|
|
||||||
? ptf.offset_().clone().ptr()
|
|
||||||
: NULL
|
|
||||||
)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -288,20 +282,17 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
|
|||||||
meshPts = pointField(points0, this->patch().meshPoints());
|
meshPts = pointField(points0, this->patch().meshPoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
pointIOField samplePoints
|
// Reread values and interpolate
|
||||||
|
fileName samplePointsFile
|
||||||
(
|
(
|
||||||
IOobject
|
this->db().time().constant()
|
||||||
(
|
/"boundaryData"
|
||||||
"points",
|
/this->patch().name()
|
||||||
this->db().time().constant(),
|
/"points"
|
||||||
"boundaryData"/this->patch().name(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
pointField samplePoints((IFstream(samplePointsFile)()));
|
||||||
|
|
||||||
// tbd: run-time selection
|
// tbd: run-time selection
|
||||||
bool nearestOnly =
|
bool nearestOnly =
|
||||||
(
|
(
|
||||||
@ -323,7 +314,6 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
|
|||||||
|
|
||||||
// Read the times for which data is available
|
// Read the times for which data is available
|
||||||
|
|
||||||
const fileName samplePointsFile = samplePoints.filePath();
|
|
||||||
const fileName samplePointsDir = samplePointsFile.path();
|
const fileName samplePointsDir = samplePointsFile.path();
|
||||||
sampleTimes_ = Time::findTimes(samplePointsDir);
|
sampleTimes_ = Time::findTimes(samplePointsDir);
|
||||||
|
|
||||||
@ -396,32 +386,37 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reread values and interpolate
|
// Reread values and interpolate
|
||||||
AverageIOField<Type> vals
|
fileName valsFile
|
||||||
(
|
(
|
||||||
IOobject
|
this->db().time().constant()
|
||||||
(
|
/"boundaryData"
|
||||||
fieldTableName_,
|
/this->patch().name()
|
||||||
this->db().time().constant(),
|
/sampleTimes_[startSampleTime_].name()
|
||||||
"boundaryData"
|
/fieldTableName_
|
||||||
/this->patch().name()
|
|
||||||
/sampleTimes_[startSampleTime_].name(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Field<Type> vals;
|
||||||
|
|
||||||
|
if (setAverage_)
|
||||||
|
{
|
||||||
|
AverageField<Type> avals((IFstream(valsFile)()));
|
||||||
|
vals = avals;
|
||||||
|
startAverage_ = avals.average();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IFstream(valsFile)() >> vals;
|
||||||
|
}
|
||||||
|
|
||||||
if (vals.size() != mapperPtr_().sourceSize())
|
if (vals.size() != mapperPtr_().sourceSize())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Number of values (" << vals.size()
|
<< "Number of values (" << vals.size()
|
||||||
<< ") differs from the number of points ("
|
<< ") differs from the number of points ("
|
||||||
<< mapperPtr_().sourceSize()
|
<< mapperPtr_().sourceSize()
|
||||||
<< ") in file " << vals.objectPath() << exit(FatalError);
|
<< ") in file " << valsFile << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
startAverage_ = vals.average();
|
|
||||||
startSampledValues_ = mapperPtr_().interpolate(vals);
|
startSampledValues_ = mapperPtr_().interpolate(vals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,33 +444,39 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
|
|||||||
/sampleTimes_[endSampleTime_].name()
|
/sampleTimes_[endSampleTime_].name()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reread values and interpolate
|
// Reread values and interpolate
|
||||||
AverageIOField<Type> vals
|
fileName valsFile
|
||||||
(
|
(
|
||||||
IOobject
|
this->db().time().constant()
|
||||||
(
|
/"boundaryData"
|
||||||
fieldTableName_,
|
/this->patch().name()
|
||||||
this->db().time().constant(),
|
/sampleTimes_[endSampleTime_].name()
|
||||||
"boundaryData"
|
/fieldTableName_
|
||||||
/this->patch().name()
|
|
||||||
/sampleTimes_[endSampleTime_].name(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Field<Type> vals;
|
||||||
|
|
||||||
|
if (setAverage_)
|
||||||
|
{
|
||||||
|
AverageField<Type> avals((IFstream(valsFile)()));
|
||||||
|
vals = avals;
|
||||||
|
endAverage_ = avals.average();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IFstream(valsFile)() >> vals;
|
||||||
|
}
|
||||||
|
|
||||||
if (vals.size() != mapperPtr_().sourceSize())
|
if (vals.size() != mapperPtr_().sourceSize())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Number of values (" << vals.size()
|
<< "Number of values (" << vals.size()
|
||||||
<< ") differs from the number of points ("
|
<< ") differs from the number of points ("
|
||||||
<< mapperPtr_().sourceSize()
|
<< mapperPtr_().sourceSize()
|
||||||
<< ") in file " << vals.objectPath() << exit(FatalError);
|
<< ") in file " << valsFile << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
endAverage_ = vals.average();
|
|
||||||
endSampledValues_ = mapperPtr_().interpolate(vals);
|
endSampledValues_ = mapperPtr_().interpolate(vals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -569,7 +570,7 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::updateCoeffs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply offset to mapped values
|
// Apply offset to mapped values
|
||||||
if (offset_.valid())
|
if (offset_.valid())
|
||||||
{
|
{
|
||||||
const scalar t = this->db().time().timeOutputValue();
|
const scalar t = this->db().time().timeOutputValue();
|
||||||
@ -594,29 +595,26 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::write
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
fixedValuePointPatchField<Type>::write(os);
|
fixedValuePointPatchField<Type>::write(os);
|
||||||
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
|
|
||||||
if (perturb_ != 1e-5)
|
|
||||||
{
|
|
||||||
os.writeKeyword("perturb") << perturb_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fieldTableName_ != this->internalField().name())
|
this->writeEntryIfDifferent(os, "setAverage", Switch(false), setAverage_);
|
||||||
{
|
|
||||||
os.writeKeyword("fieldTableName") << fieldTableName_
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
this->writeEntryIfDifferent(os, "perturb", 1e-5, perturb_);
|
||||||
|
|
||||||
|
this->writeEntryIfDifferent
|
||||||
(
|
(
|
||||||
(
|
os,
|
||||||
!mapMethod_.empty()
|
"fieldTable",
|
||||||
&& mapMethod_ != "planarInterpolation"
|
this->internalField().name(),
|
||||||
)
|
fieldTableName_
|
||||||
)
|
);
|
||||||
{
|
|
||||||
os.writeKeyword("mapMethod") << mapMethod_
|
this->writeEntryIfDifferent
|
||||||
<< token::END_STATEMENT << nl;
|
(
|
||||||
}
|
os,
|
||||||
|
"mapMethod",
|
||||||
|
word("planarInterpolation"),
|
||||||
|
mapMethod_
|
||||||
|
);
|
||||||
|
|
||||||
if (offset_.valid())
|
if (offset_.valid())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class timeVaryingMappedFixedValuePointPatchField
|
|||||||
word fieldTableName_;
|
word fieldTableName_;
|
||||||
|
|
||||||
//- If true adjust the mapped field to maintain average value
|
//- If true adjust the mapped field to maintain average value
|
||||||
bool setAverage_;
|
Switch setAverage_;
|
||||||
|
|
||||||
//- Fraction of perturbation (fraction of bounding box) to add
|
//- Fraction of perturbation (fraction of bounding box) to add
|
||||||
scalar perturb_;
|
scalar perturb_;
|
||||||
|
|||||||
@ -25,7 +25,8 @@ Class
|
|||||||
Foam::sampledCuttingPlane
|
Foam::sampledCuttingPlane
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A sampledSurface defined by a plane
|
A sampledSurface defined by a plane using the iso-surface algorithm
|
||||||
|
to 'cut' the mesh.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
sampledCuttingPlane.C
|
sampledCuttingPlane.C
|
||||||
|
|||||||
@ -25,7 +25,8 @@ Class
|
|||||||
Foam::sampledPlane
|
Foam::sampledPlane
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A sampledSurface defined by a cuttingPlane. Triangulated by default.
|
A sampledSurface defined by a plane which 'cuts' the mesh using the
|
||||||
|
cuttingPlane alorithm. The plane is triangulated by default.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
Does not actually cut until update() called.
|
Does not actually cut until update() called.
|
||||||
|
|||||||
Reference in New Issue
Block a user