mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: protected method fa/fv option::resetApplied()
- resizes to current fieldNames_ size and assigns everything to false to avoid any "stickiness" if the field ordering changes between reads. ENH: additional debugging faOption/fvOption (#2110) - aids tracing which sources are being used/ignored - update code style STYLE: rename CodedSource -> CodedFvSource - avoid future name clashes with CodedFaSource
This commit is contained in:
@ -144,10 +144,11 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
|
|||||||
),
|
),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(2);
|
fieldNames_.resize(2);
|
||||||
fieldNames_[0] = "U";
|
fieldNames_[0] = "U";
|
||||||
fieldNames_[1] = "T";
|
fieldNames_[1] = "T";
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
|
||||||
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,6 @@ bool Foam::fv::VoFSolidificationMeltingSource::read(const dictionary& dict)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -107,7 +107,7 @@ Foam::fv::atmAmbientTurbSource::atmAmbientTurbSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(2, "undefined");
|
fieldNames_.resize(2);
|
||||||
|
|
||||||
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
||||||
tmp<volScalarField> tomega = turbPtr->omega();
|
tmp<volScalarField> tomega = turbPtr->omega();
|
||||||
@ -140,7 +140,7 @@ Foam::fv::atmAmbientTurbSource::atmAmbientTurbSource
|
|||||||
|
|
||||||
fieldNames_[1] = turbPtr->k()().name();
|
fieldNames_[1] = turbPtr->k()().name();
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmAmbientTurbSource to: "
|
Log << " Applying atmAmbientTurbSource to: "
|
||||||
<< fieldNames_[0] << " and " << fieldNames_[1]
|
<< fieldNames_[0] << " and " << fieldNames_[1]
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -198,7 +198,7 @@ Foam::fv::atmBuoyancyTurbSource::atmBuoyancyTurbSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(2, "undefined");
|
fieldNames_.resize(2);
|
||||||
|
|
||||||
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
||||||
tmp<volScalarField> tomega = turbPtr->omega();
|
tmp<volScalarField> tomega = turbPtr->omega();
|
||||||
@ -232,7 +232,7 @@ Foam::fv::atmBuoyancyTurbSource::atmBuoyancyTurbSource
|
|||||||
|
|
||||||
fieldNames_[1] = turbPtr->k()().name();
|
fieldNames_[1] = turbPtr->k()().name();
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmBuoyancyTurbSource to: "
|
Log << " Applying atmBuoyancyTurbSource to: "
|
||||||
<< fieldNames_[0] << " and " << fieldNames_[1]
|
<< fieldNames_[0] << " and " << fieldNames_[1]
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 CENER
|
Copyright (C) 2020 CENER
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -109,9 +109,9 @@ Foam::fv::atmCoriolisUSource::atmCoriolisUSource
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(1, "U");
|
fieldNames_.resize(1, "U");
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmCoriolisUSource to: " << fieldNames_[0] << endl;
|
Log << " Applying atmCoriolisUSource to: " << fieldNames_[0] << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -134,7 +134,7 @@ Foam::fv::atmLengthScaleTurbSource::atmLengthScaleTurbSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(1, "undefined");
|
fieldNames_.resize(1);
|
||||||
|
|
||||||
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
||||||
tmp<volScalarField> tomega = turbPtr->omega();
|
tmp<volScalarField> tomega = turbPtr->omega();
|
||||||
@ -165,7 +165,7 @@ Foam::fv::atmLengthScaleTurbSource::atmLengthScaleTurbSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmLengthScaleTurbSource to: " << fieldNames_[0]
|
Log << " Applying atmLengthScaleTurbSource to: " << fieldNames_[0]
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -88,7 +88,7 @@ Foam::fv::atmNutSource::atmNutSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(1, "undefined");
|
fieldNames_.resize(1);
|
||||||
|
|
||||||
const tmp<volScalarField>& tnut = turbPtr->nut();
|
const tmp<volScalarField>& tnut = turbPtr->nut();
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ Foam::fv::atmNutSource::atmNutSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmNutSource to: " << fieldNames_[0] << endl;
|
Log << " Applying atmNutSource to: " << fieldNames_[0] << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -79,9 +79,9 @@ Foam::fv::atmPlantCanopyTSource::atmPlantCanopyTSource
|
|||||||
mesh
|
mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, "T");
|
fieldNames_.resize(1, "T");
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmPlantCanopyTSource to: " << fieldNames_[0] << endl;
|
Log << " Applying atmPlantCanopyTSource to: " << fieldNames_[0] << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -108,7 +108,7 @@ Foam::fv::atmPlantCanopyTurbSource::atmPlantCanopyTurbSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(1, "undefined");
|
fieldNames_.resize(1);
|
||||||
|
|
||||||
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
||||||
tmp<volScalarField> tomega = turbPtr->omega();
|
tmp<volScalarField> tomega = turbPtr->omega();
|
||||||
@ -138,7 +138,7 @@ Foam::fv::atmPlantCanopyTurbSource::atmPlantCanopyTurbSource
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmPlantCanopyTurbSource to: " << fieldNames_[0]
|
Log << " Applying atmPlantCanopyTurbSource to: " << fieldNames_[0]
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,9 +78,9 @@ Foam::fv::atmPlantCanopyUSource::atmPlantCanopyUSource
|
|||||||
mesh
|
mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, "U");
|
fieldNames_.resize(1, "U");
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying atmPlantCanopyUSource to: " << fieldNames_[0] << endl;
|
Log << " Applying atmPlantCanopyUSource to: " << fieldNames_[0] << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,15 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::option::resetApplied()
|
||||||
|
{
|
||||||
|
applied_.resize(fieldNames_.size());
|
||||||
|
applied_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fa::option::option
|
Foam::fa::option::option
|
||||||
|
|||||||
@ -132,6 +132,13 @@ protected:
|
|||||||
//- Region name (finite-area)
|
//- Region name (finite-area)
|
||||||
word regionName_;
|
word regionName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Resize/reset applied flag list for all fieldNames_ entries
|
||||||
|
void resetApplied();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,33 +38,27 @@ namespace fa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::dictionary& Foam::fa::optionList::optionsDict
|
const Foam::dictionary& Foam::fa::optionList::optionsDict
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
if (dict.found("options"))
|
return dict.optionalSubDict("options", keyType::LITERAL);
|
||||||
{
|
|
||||||
return dict.subDict("options");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return dict;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::fa::optionList::readOptions(const dictionary& dict)
|
bool Foam::fa::optionList::readOptions(const dictionary& dict)
|
||||||
{
|
{
|
||||||
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
||||||
|
|
||||||
bool allOk = true;
|
bool allOk = true;
|
||||||
forAll(*this, i)
|
for (fa::option& opt : *this)
|
||||||
{
|
{
|
||||||
option& bs = this->operator[](i);
|
bool ok = opt.read(dict.subDict(opt.name()));
|
||||||
bool ok = bs.read(dict.subDict(bs.name()));
|
|
||||||
allOk = (allOk && ok);
|
allOk = (allOk && ok);
|
||||||
}
|
}
|
||||||
return allOk;
|
return allOk;
|
||||||
@ -75,10 +69,9 @@ void Foam::fa::optionList::checkApplied() const
|
|||||||
{
|
{
|
||||||
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
||||||
{
|
{
|
||||||
forAll(*this, i)
|
for (const fa::option& opt : *this)
|
||||||
{
|
{
|
||||||
const option& bs = this->operator[](i);
|
opt.checkApplied();
|
||||||
bs.checkApplied();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,6 +137,22 @@ void Foam::fa::optionList::reset(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::optionList::appliesToField(const word& fieldName) const
|
||||||
|
{
|
||||||
|
for (const fa::option& source : *this)
|
||||||
|
{
|
||||||
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
|
if (fieldi != -1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::fa::optionList::read(const dictionary& dict)
|
bool Foam::fa::optionList::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
return readOptions(optionsDict(dict));
|
return readOptions(optionsDict(dict));
|
||||||
@ -153,12 +162,12 @@ bool Foam::fa::optionList::read(const dictionary& dict)
|
|||||||
bool Foam::fa::optionList::writeData(Ostream& os) const
|
bool Foam::fa::optionList::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
// Write list contents
|
// Write list contents
|
||||||
forAll(*this, i)
|
for (const fa::option& opt : *this)
|
||||||
{
|
{
|
||||||
os << nl;
|
os << nl;
|
||||||
this->operator[](i).writeHeader(os);
|
opt.writeHeader(os);
|
||||||
this->operator[](i).writeData(os);
|
opt.writeData(os);
|
||||||
this->operator[](i).writeFooter(os);
|
opt.writeFooter(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
|
|||||||
@ -83,8 +83,8 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Return the "options" sub-dictionary if present otherwise return dict
|
//- Return "options" sub-dictionary (if present) or return dict
|
||||||
const dictionary& optionsDict(const dictionary& dict) const;
|
static const dictionary& optionsDict(const dictionary& dict);
|
||||||
|
|
||||||
//- Read options dictionary
|
//- Read options dictionary
|
||||||
bool readOptions(const dictionary& dict);
|
bool readOptions(const dictionary& dict);
|
||||||
@ -117,11 +117,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch
|
//- Default construct from patch
|
||||||
optionList(const fvPatch& p);
|
explicit optionList(const fvPatch& p);
|
||||||
|
|
||||||
//- Construct from mesh and dictionary
|
//- Construct from patch and dictionary
|
||||||
optionList(const fvPatch&, const dictionary& );
|
optionList(const fvPatch& p, const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -133,6 +133,9 @@ public:
|
|||||||
//- Reset the source list
|
//- Reset the source list
|
||||||
void reset(const dictionary& dict);
|
void reset(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Return whether there is something to apply to the field
|
||||||
|
bool appliesToField(const word& fieldName) const;
|
||||||
|
|
||||||
|
|
||||||
// Sources
|
// Sources
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,11 +44,9 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::source
|
|||||||
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, ds));
|
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, ds));
|
||||||
faMatrix<Type>& mtx = tmtx.ref();
|
faMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fa::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -56,14 +54,24 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::source
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying source " << source.name() << " to field "
|
|
||||||
<< fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Apply";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.addSup(h, mtx, fieldi);
|
source.addSup(h, mtx, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,11 +135,9 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
|||||||
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, ds));
|
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, ds));
|
||||||
faMatrix<Type>& mtx = tmtx.ref();
|
faMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fa::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -139,14 +145,24 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying source " << source.name() << " to field "
|
|
||||||
<< fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Apply";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.addSup(h, rho, mtx, fieldi);
|
source.addSup(h, rho, mtx, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,11 +187,9 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
|||||||
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, dsMat));
|
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, dsMat));
|
||||||
faMatrix<Type>& mtx = tmtx.ref();
|
faMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fa::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(field.name());
|
||||||
|
|
||||||
label fieldi = source.applyToField(field.name());
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -183,14 +197,24 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying source " << source.name() << " to field "
|
|
||||||
<< field.name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Apply";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << field.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.addSup(rho, mtx, fieldi);
|
source.addSup(rho, mtx, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,11 +250,9 @@ void Foam::fa::optionList::constrain(faMatrix<Type>& eqn)
|
|||||||
{
|
{
|
||||||
checkApplied();
|
checkApplied();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fa::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(eqn.psi().name());
|
||||||
|
|
||||||
label fieldi = source.applyToField(eqn.psi().name());
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -238,14 +260,24 @@ void Foam::fa::optionList::constrain(faMatrix<Type>& eqn)
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying constraint " << source.name()
|
|
||||||
<< " to field " << eqn.psi().name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Constrain";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive constrain)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << eqn.psi().name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.constrain(eqn, fieldi);
|
source.constrain(eqn, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,11 +293,9 @@ void Foam::fa::optionList::correct
|
|||||||
{
|
{
|
||||||
const word& fieldName = field.name();
|
const word& fieldName = field.name();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fa::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -273,14 +303,24 @@ void Foam::fa::optionList::correct
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Correcting source " << source.name()
|
|
||||||
<< " for field " << fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Correct";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive correct)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.correct(field);
|
source.correct(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,7 +204,7 @@ Foam::fa::faceSetOption::faceSetOption
|
|||||||
|
|
||||||
bool Foam::fa::faceSetOption::isActive()
|
bool Foam::fa::faceSetOption::isActive()
|
||||||
{
|
{
|
||||||
if (option::isActive() && inTimeLimits(mesh_.time().value()))
|
if (fa::option::isActive() && inTimeLimits(mesh_.time().value()))
|
||||||
{
|
{
|
||||||
// Update the face set if the mesh is changing
|
// Update the face set if the mesh is changing
|
||||||
if (mesh_.changing())
|
if (mesh_.changing())
|
||||||
@ -229,7 +229,7 @@ bool Foam::fa::faceSetOption::isActive()
|
|||||||
|
|
||||||
bool Foam::fa::faceSetOption::read(const dictionary& dict)
|
bool Foam::fa::faceSetOption::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (option::read(dict))
|
if (fa::option::read(dict))
|
||||||
{
|
{
|
||||||
if (coeffs_.readIfPresent("timeStart", timeStart_))
|
if (coeffs_.readIfPresent("timeStart", timeStart_))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,9 +78,9 @@ Foam::fa::contactHeatFluxSource::contactHeatFluxSource
|
|||||||
contactRes_(0),
|
contactRes_(0),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, TName_);
|
fieldNames_.resize(1, TName_);
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fa::option::resetApplied();
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,9 +83,9 @@ Foam::fa::externalFileSource::externalFileSource
|
|||||||
),
|
),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, fieldName_);
|
fieldNames_.resize(1, fieldName_);
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fa::option::resetApplied();
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -77,9 +77,9 @@ Foam::fa::externalHeatFluxSource::externalHeatFluxSource
|
|||||||
Ta_(),
|
Ta_(),
|
||||||
emissivity_(dict.getOrDefault<scalar>("emissivity", 0))
|
emissivity_(dict.getOrDefault<scalar>("emissivity", 0))
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, TName_);
|
fieldNames_.resize(1, TName_);
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fa::option::resetApplied();
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -72,9 +72,9 @@ Foam::fa::jouleHeatingSource::jouleHeatingSource
|
|||||||
nIter_(1),
|
nIter_(1),
|
||||||
anisotropicElectricalConductivity_(false)
|
anisotropicElectricalConductivity_(false)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, TName_);
|
fieldNames_.resize(1, TName_);
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fa::option::resetApplied();
|
||||||
|
|
||||||
if (anisotropicElectricalConductivity_)
|
if (anisotropicElectricalConductivity_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
Copyright (C) 2020 PCOpt/NTUA
|
Copyright (C) 2020 PCOpt/NTUA
|
||||||
Copyright (C) 2020 FOSS GP
|
Copyright (C) 2020 FOSS GP
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -43,6 +43,15 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fv::option::resetApplied()
|
||||||
|
{
|
||||||
|
applied_.resize(fieldNames_.size());
|
||||||
|
applied_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fv::option::option
|
Foam::fv::option::option
|
||||||
|
|||||||
@ -123,6 +123,12 @@ protected:
|
|||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Resize/reset applied flag list for all fieldNames_ entries
|
||||||
|
void resetApplied();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Switch write log to Info
|
//- Switch write log to Info
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,33 +40,27 @@ namespace fv
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::dictionary& Foam::fv::optionList::optionsDict
|
const Foam::dictionary& Foam::fv::optionList::optionsDict
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
if (dict.found("options"))
|
return dict.optionalSubDict("options", keyType::LITERAL);
|
||||||
{
|
|
||||||
return dict.subDict("options");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return dict;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::fv::optionList::readOptions(const dictionary& dict)
|
bool Foam::fv::optionList::readOptions(const dictionary& dict)
|
||||||
{
|
{
|
||||||
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
||||||
|
|
||||||
bool allOk = true;
|
bool allOk = true;
|
||||||
forAll(*this, i)
|
for (fv::option& opt : *this)
|
||||||
{
|
{
|
||||||
option& bs = this->operator[](i);
|
bool ok = opt.read(dict.subDict(opt.name()));
|
||||||
bool ok = bs.read(dict.subDict(bs.name()));
|
|
||||||
allOk = (allOk && ok);
|
allOk = (allOk && ok);
|
||||||
}
|
}
|
||||||
return allOk;
|
return allOk;
|
||||||
@ -76,10 +71,9 @@ void Foam::fv::optionList::checkApplied() const
|
|||||||
{
|
{
|
||||||
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
||||||
{
|
{
|
||||||
forAll(*this, i)
|
for (const fv::option& opt : *this)
|
||||||
{
|
{
|
||||||
const option& bs = this->operator[](i);
|
opt.checkApplied();
|
||||||
bs.checkApplied();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,11 +135,9 @@ void Foam::fv::optionList::reset(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::fv::optionList::appliesToField(const word& fieldName) const
|
bool Foam::fv::optionList::appliesToField(const word& fieldName) const
|
||||||
{
|
{
|
||||||
forAll(*this, i)
|
for (const fv::option& source : *this)
|
||||||
{
|
{
|
||||||
const option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -166,12 +158,12 @@ bool Foam::fv::optionList::read(const dictionary& dict)
|
|||||||
bool Foam::fv::optionList::writeData(Ostream& os) const
|
bool Foam::fv::optionList::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
// Write list contents
|
// Write list contents
|
||||||
forAll(*this, i)
|
for (const fv::option& opt : *this)
|
||||||
{
|
{
|
||||||
os << nl;
|
os << nl;
|
||||||
this->operator[](i).writeHeader(os);
|
opt.writeHeader(os);
|
||||||
this->operator[](i).writeData(os);
|
opt.writeData(os);
|
||||||
this->operator[](i).writeFooter(os);
|
opt.writeFooter(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
|
|||||||
@ -84,8 +84,8 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Return the "options" sub-dictionary if present otherwise return dict
|
//- Return "options" sub-dictionary (if present) or return dict
|
||||||
const dictionary& optionsDict(const dictionary& dict) const;
|
static const dictionary& optionsDict(const dictionary& dict);
|
||||||
|
|
||||||
//- Read options dictionary
|
//- Read options dictionary
|
||||||
bool readOptions(const dictionary& dict);
|
bool readOptions(const dictionary& dict);
|
||||||
@ -117,8 +117,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct from mesh
|
||||||
optionList(const fvMesh& mesh);
|
explicit optionList(const fvMesh& mesh);
|
||||||
|
|
||||||
//- Construct from mesh and dictionary
|
//- Construct from mesh and dictionary
|
||||||
optionList(const fvMesh& mesh, const dictionary& dict);
|
optionList(const fvMesh& mesh, const dictionary& dict);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
Copyright (C) 2020 PCOpt/NTUA
|
Copyright (C) 2020 PCOpt/NTUA
|
||||||
Copyright (C) 2020 FOSS GP
|
Copyright (C) 2020 FOSS GP
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -45,11 +45,9 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::source
|
|||||||
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
|
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
|
||||||
fvMatrix<Type>& mtx = tmtx.ref();
|
fvMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fv::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -57,14 +55,24 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::source
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying source " << source.name() << " to field "
|
|
||||||
<< fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Apply";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.addSup(mtx, fieldi);
|
source.addSup(mtx, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,11 +132,9 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
|
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
|
||||||
fvMatrix<Type>& mtx = tmtx.ref();
|
fvMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fv::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -136,14 +142,24 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying source " << source.name() << " to field "
|
|
||||||
<< fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Apply";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.addSup(rho, mtx, fieldi);
|
source.addSup(rho, mtx, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,11 +201,9 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
|
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
|
||||||
fvMatrix<Type>& mtx = tmtx.ref();
|
fvMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fv::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -197,14 +211,24 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying source " << source.name() << " to field "
|
|
||||||
<< fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Apply";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.addSup(alpha, rho, mtx, fieldi);
|
source.addSup(alpha, rho, mtx, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,11 +315,9 @@ void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn)
|
|||||||
{
|
{
|
||||||
checkApplied();
|
checkApplied();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fv::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(eqn.psi().name());
|
||||||
|
|
||||||
label fieldi = source.applyToField(eqn.psi().name());
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -303,14 +325,24 @@ void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn)
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Applying constraint " << source.name()
|
|
||||||
<< " to field " << eqn.psi().name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Constrain";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive constrain)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << eqn.psi().name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.constrain(eqn, fieldi);
|
source.constrain(eqn, fieldi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,11 +358,9 @@ void Foam::fv::optionList::correct
|
|||||||
{
|
{
|
||||||
const word& fieldName = field.name();
|
const word& fieldName = field.name();
|
||||||
|
|
||||||
forAll(*this, i)
|
for (fv::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
@ -338,14 +368,24 @@ void Foam::fv::optionList::correct
|
|||||||
|
|
||||||
source.setApplied(fieldi);
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Correcting source " << source.name()
|
|
||||||
<< " for field " << fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
Info<< "Correct";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "(Inactive correct)";
|
||||||
|
}
|
||||||
|
Info<< " source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.correct(field);
|
source.correct(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,25 +401,24 @@ void Foam::fv::optionList::postProcessSens
|
|||||||
const word& designVariablesName
|
const word& designVariablesName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(*this, i)
|
for (fv::option& source : *this)
|
||||||
{
|
{
|
||||||
option& source = this->operator[](i);
|
const label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
label fieldi = source.applyToField(fieldName);
|
|
||||||
|
|
||||||
if (fieldi != -1)
|
if (fieldi != -1)
|
||||||
{
|
{
|
||||||
addProfiling(fvopt, "fvOption::postProcessSens." + source.name());
|
addProfiling(fvopt, "fvOption::postProcessSens." + source.name());
|
||||||
|
|
||||||
if (source.isActive())
|
const bool ok = source.isActive();
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Post processing sensitivity from source "
|
|
||||||
<< source.name()
|
|
||||||
<< " for field " << fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (debug && ok)
|
||||||
|
{
|
||||||
|
Info<< "Post processing sensitivity source "
|
||||||
|
<< source.name() << " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
source.postProcessSens
|
source.postProcessSens
|
||||||
(
|
(
|
||||||
sensField,
|
sensField,
|
||||||
|
|||||||
@ -4,7 +4,7 @@ interRegionOption/interRegionOption.C
|
|||||||
/* Sources */
|
/* Sources */
|
||||||
|
|
||||||
generalSources=sources/general
|
generalSources=sources/general
|
||||||
$(generalSources)/codedSource/codedSource.C
|
$(generalSources)/codedSource/codedFvSources.C
|
||||||
$(generalSources)/semiImplicitSource/semiImplicitSource.C
|
$(generalSources)/semiImplicitSource/semiImplicitSource.C
|
||||||
|
|
||||||
derivedSources=sources/derived
|
derivedSources=sources/derived
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -101,9 +101,9 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
|
|||||||
|
|
||||||
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
fieldNames_.setSize(1, thermo.he().name());
|
fieldNames_.resize(1, thermo.he().name());
|
||||||
|
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -132,7 +132,7 @@ bool Foam::fv::velocityDampingConstraint::read(const dictionary& dict)
|
|||||||
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016 OpenFOAM Foundation
|
Copyright (C) 2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -59,9 +59,10 @@ bool Foam::fv::FixedValueConstraint<Type>::read(const dictionary& dict)
|
|||||||
|
|
||||||
label count = fieldValuesDict.size();
|
label count = fieldValuesDict.size();
|
||||||
|
|
||||||
fieldNames_.setSize(count);
|
fieldNames_.resize(count);
|
||||||
fieldValues_.setSize(count);
|
fieldValues_.resize(count);
|
||||||
applied_.setSize(count, false);
|
|
||||||
|
fv::option::resetApplied();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (const entry& dEntry : fieldValuesDict)
|
for (const entry& dEntry : fieldValuesDict)
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,9 +66,9 @@ Foam::fv::limitTemperature::limitTemperature
|
|||||||
IOobject::groupName(basicThermo::dictName, phase_)
|
IOobject::groupName(basicThermo::dictName, phase_)
|
||||||
);
|
);
|
||||||
|
|
||||||
fieldNames_.setSize(1, thermo.he().name());
|
fieldNames_.resize(1, thermo.he().name());
|
||||||
|
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,8 +56,8 @@ Foam::fv::limitVelocity::limitVelocity
|
|||||||
UName_(coeffs_.getOrDefault<word>("U", "U")),
|
UName_(coeffs_.getOrDefault<word>("U", "U")),
|
||||||
max_(coeffs_.get<scalar>("max"))
|
max_(coeffs_.get<scalar>("max"))
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, UName_);
|
fieldNames_.resize(1, UName_);
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -182,7 +182,7 @@ bool Foam::fv::acousticDampingSource::read(const dictionary& dict)
|
|||||||
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
coeffs_.readEntry("frequency", frequency_.value());
|
coeffs_.readEntry("frequency", frequency_.value());
|
||||||
coeffs_.readEntry("URef", URefName_);
|
coeffs_.readEntry("URef", URefName_);
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd
|
Copyright (C) 2018-2021 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -219,9 +219,9 @@ Foam::fv::actuationDiskSource::actuationDiskSource
|
|||||||
{
|
{
|
||||||
setMonitorCells(coeffs_);
|
setMonitorCells(coeffs_);
|
||||||
|
|
||||||
fieldNames_.setSize(1, "U");
|
fieldNames_.resize(1, "U");
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Info<< " - creating actuation disk zone: " << this->name() << endl;
|
Info<< " - creating actuation disk zone: " << this->name() << endl;
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Foam::fv::buoyancyEnergy::buoyancyEnergy
|
|||||||
<< "settings are:" << fieldNames_ << exit(FatalError);
|
<< "settings are:" << fieldNames_ << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -64,7 +64,7 @@ Foam::fv::buoyancyForce::buoyancyForce
|
|||||||
<< "settings are:" << fieldNames_ << exit(FatalError);
|
<< "settings are:" << fieldNames_ << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -178,7 +178,7 @@ Foam::fv::buoyancyTurbSource::buoyancyTurbSource
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_.setSize(2, "undefined");
|
fieldNames_.resize(2);
|
||||||
|
|
||||||
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
tmp<volScalarField> tepsilon = turbPtr->epsilon();
|
||||||
tmp<volScalarField> tomega = turbPtr->omega();
|
tmp<volScalarField> tomega = turbPtr->omega();
|
||||||
@ -202,7 +202,8 @@ Foam::fv::buoyancyTurbSource::buoyancyTurbSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
fieldNames_[1] = turbPtr->k()().name();
|
fieldNames_[1] = turbPtr->k()().name();
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
|
||||||
|
fv::option::resetApplied();
|
||||||
|
|
||||||
Log << " Applying buoyancyTurbSource to: "
|
Log << " Applying buoyancyTurbSource to: "
|
||||||
<< fieldNames_[0] << " and " << fieldNames_[1]
|
<< fieldNames_[0] << " and " << fieldNames_[1]
|
||||||
|
|||||||
@ -223,7 +223,7 @@ directionalPressureGradientExplicitSource
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
// Read the initial pressure gradient from file if it exists
|
// Read the initial pressure gradient from file if it exists
|
||||||
IFstream propsFile
|
IFstream propsFile
|
||||||
|
|||||||
@ -160,9 +160,9 @@ Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
|
|||||||
|
|
||||||
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
fieldNames_.setSize(1, thermo.he().name());
|
fieldNames_.resize(1, thermo.he().name());
|
||||||
|
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
eTable_.reset(new interpolation2DTable<scalar>(coeffs_));
|
eTable_.reset(new interpolation2DTable<scalar>(coeffs_));
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2018 OpenFOAM Foundation
|
Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -123,7 +123,7 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
|
|||||||
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -134,9 +134,9 @@ Foam::fv::jouleHeatingSource::jouleHeatingSource
|
|||||||
|
|
||||||
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
fieldNames_.setSize(1, thermo.he().name());
|
fieldNames_.resize(1, thermo.he().name());
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ Foam::fv::meanVelocityForce::meanVelocityForce
|
|||||||
<< "settings are:" << fieldNames_ << exit(FatalError);
|
<< "settings are:" << fieldNames_ << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
// Read the initial pressure gradient from file if it exists
|
// Read the initial pressure gradient from file if it exists
|
||||||
IFstream propsFile
|
IFstream propsFile
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -96,7 +96,7 @@ Foam::fv::multiphaseStabilizedTurbulence::multiphaseStabilizedTurbulence
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(2, "undefined");
|
fieldNames_.resize(2);
|
||||||
|
|
||||||
// Note: incompressible only
|
// Note: incompressible only
|
||||||
const auto* turbPtr =
|
const auto* turbPtr =
|
||||||
@ -123,7 +123,7 @@ Foam::fv::multiphaseStabilizedTurbulence::multiphaseStabilizedTurbulence
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -47,8 +47,8 @@ Foam::fv::PhaseLimitStabilization<Type>::PhaseLimitStabilization
|
|||||||
rateName_(coeffs_.get<word>("rate")),
|
rateName_(coeffs_.get<word>("rate")),
|
||||||
residualAlpha_(coeffs_.get<scalar>("residualAlpha"))
|
residualAlpha_(coeffs_.get<scalar>("residualAlpha"))
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, fieldName_);
|
fieldNames_.resize(1, fieldName_);
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -548,7 +548,7 @@ bool Foam::fv::rotorDiskSource::read(const dictionary& dict)
|
|||||||
if (cellSetOption::read(dict))
|
if (cellSetOption::read(dict))
|
||||||
{
|
{
|
||||||
coeffs_.readEntry("fields", fieldNames_);
|
coeffs_.readEntry("fields", fieldNames_);
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
// Read coordinate system/geometry invariant properties
|
// Read coordinate system/geometry invariant properties
|
||||||
omega_ = rpmToRads(coeffs_.get<scalar>("rpm"));
|
omega_ = rpmToRads(coeffs_.get<scalar>("rpm"));
|
||||||
|
|||||||
@ -192,7 +192,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
|
|||||||
curTimeIndex_(-1),
|
curTimeIndex_(-1),
|
||||||
deltaT_(cells_.size(), 0)
|
deltaT_(cells_.size(), 0)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(2);
|
fieldNames_.resize(2);
|
||||||
fieldNames_[0] = UName_;
|
fieldNames_[0] = UName_;
|
||||||
|
|
||||||
switch (mode_)
|
switch (mode_)
|
||||||
@ -218,7 +218,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -59,8 +59,8 @@ Foam::fv::tabulatedAccelerationSource::tabulatedAccelerationSource
|
|||||||
UName_(coeffs_.getOrDefault<word>("U", "U")),
|
UName_(coeffs_.getOrDefault<word>("U", "U")),
|
||||||
g0_("g0", dimAcceleration, Zero)
|
g0_("g0", dimAcceleration, Zero)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, UName_);
|
fieldNames_.resize(1, UName_);
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
if (mesh.time().foundObject<uniformDimensionedVectorField>("g"))
|
if (mesh.time().foundObject<uniformDimensionedVectorField>("g"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -106,7 +106,7 @@ Foam::fv::viscousDissipation::viscousDissipation
|
|||||||
|
|
||||||
if (thermoPtr)
|
if (thermoPtr)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, thermoPtr->he().name());
|
fieldNames_.resize(1, thermoPtr->he().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldNames_.empty())
|
if (fieldNames_.empty())
|
||||||
@ -120,7 +120,7 @@ Foam::fv::viscousDissipation::viscousDissipation
|
|||||||
<< "settings are:" << fieldNames_ << exit(FatalError);
|
<< "settings are:" << fieldNames_ << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "CodedSource.H"
|
#include "CodedFvSource.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "fvMatrices.H"
|
#include "fvMatrices.H"
|
||||||
#include "dynamicCode.H"
|
#include "dynamicCode.H"
|
||||||
@ -52,7 +52,7 @@ Foam::string Foam::fv::CodedSource<Type>::description() const
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fv::CodedSource<Type>::clearRedirect() const
|
void Foam::fv::CodedSource<Type>::clearRedirect() const
|
||||||
{
|
{
|
||||||
redirectFvOptionPtr_.reset(nullptr);
|
redirectOptionPtr_.reset(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ Foam::fv::CodedSource<Type>::CodedSource
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSetOption(name, modelType, dict, mesh)
|
fv::cellSetOption(name, modelType, dict, mesh)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -133,22 +133,62 @@ Foam::fv::CodedSource<Type>::CodedSource
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::fv::option& Foam::fv::CodedSource<Type>::redirectFvOption() const
|
bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (!redirectFvOptionPtr_)
|
codedBase::setCodeContext(coeffs_);
|
||||||
|
|
||||||
|
if (!fv::cellSetOption::read(dict))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
coeffs_.readEntry("fields", fieldNames_);
|
||||||
|
|
||||||
|
fv::option::resetApplied();
|
||||||
|
|
||||||
|
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
||||||
|
|
||||||
|
|
||||||
|
// Code context chunks
|
||||||
|
|
||||||
|
auto& ctx = codedBase::codeContext();
|
||||||
|
|
||||||
|
ctx.readEntry("codeCorrect", codeCorrect_);
|
||||||
|
ctx.readEntry("codeAddSup", codeAddSup_);
|
||||||
|
|
||||||
|
// ctx.readEntry("codeConstrain", codeConstrain_);
|
||||||
|
ctx.readEntry // Compatibility
|
||||||
|
(
|
||||||
|
coeffs_.lookupEntryCompat
|
||||||
|
(
|
||||||
|
"codeConstrain",
|
||||||
|
{{ "codeSetValue", 1812 }},
|
||||||
|
keyType::LITERAL
|
||||||
|
).keyword(),
|
||||||
|
codeConstrain_
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::fv::option& Foam::fv::CodedSource<Type>::redirectOption() const
|
||||||
|
{
|
||||||
|
if (!redirectOptionPtr_)
|
||||||
{
|
{
|
||||||
dictionary constructDict(dict_);
|
dictionary constructDict(dict_);
|
||||||
constructDict.set("type", name_);
|
constructDict.set("type", name_);
|
||||||
constructDict.changeKeyword(modelType_ & "Coeffs", name_ & "Coeffs");
|
constructDict.changeKeyword(modelType_ & "Coeffs", name_ & "Coeffs");
|
||||||
|
|
||||||
redirectFvOptionPtr_ = fv::option::New
|
redirectOptionPtr_ = fv::option::New
|
||||||
(
|
(
|
||||||
name_,
|
name_,
|
||||||
constructDict,
|
constructDict,
|
||||||
mesh_
|
mesh_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return *redirectFvOptionPtr_;
|
return *redirectOptionPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,11 +199,11 @@ void Foam::fv::CodedSource<Type>::correct
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DebugInfo
|
DebugInfo
|
||||||
<< "CodedSource<" << pTraits<Type>::typeName
|
<< "fv::CodedSource<" << pTraits<Type>::typeName
|
||||||
<< ">::correct for source " << name_ << endl;
|
<< ">::correct for source " << name_ << endl;
|
||||||
|
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().correct(field);
|
redirectOption().correct(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -175,11 +215,11 @@ void Foam::fv::CodedSource<Type>::addSup
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DebugInfo
|
DebugInfo
|
||||||
<< "CodedSource<" << pTraits<Type>::typeName
|
<< "fv::CodedSource<" << pTraits<Type>::typeName
|
||||||
<< ">::addSup for source " << name_ << endl;
|
<< ">::addSup for source " << name_ << endl;
|
||||||
|
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().addSup(eqn, fieldi);
|
redirectOption().addSup(eqn, fieldi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -192,11 +232,11 @@ void Foam::fv::CodedSource<Type>::addSup
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DebugInfo
|
DebugInfo
|
||||||
<< "CodedSource<" << pTraits<Type>::typeName
|
<< "fv::CodedSource<" << pTraits<Type>::typeName
|
||||||
<< ">::addSup for source " << name_ << endl;
|
<< ">::addSup for source " << name_ << endl;
|
||||||
|
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().addSup(rho, eqn, fieldi);
|
redirectOption().addSup(rho, eqn, fieldi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,11 +248,11 @@ void Foam::fv::CodedSource<Type>::constrain
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DebugInfo
|
DebugInfo
|
||||||
<< "CodedSource<" << pTraits<Type>::typeName
|
<< "fv::CodedSource<" << pTraits<Type>::typeName
|
||||||
<< ">::constrain for source " << name_ << endl;
|
<< ">::constrain for source " << name_ << endl;
|
||||||
|
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().constrain(eqn, fieldi);
|
redirectOption().constrain(eqn, fieldi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,6 +58,14 @@ Description
|
|||||||
field is the name of the field in the fields list
|
field is the name of the field in the fields list
|
||||||
eqn is the fvMatrix
|
eqn is the fvMatrix
|
||||||
|
|
||||||
|
These are in addition to the usual code entries:
|
||||||
|
\plaintable
|
||||||
|
codeInclude | include files
|
||||||
|
codeOptions | compiler line: added to EXE_INC (Make/options)
|
||||||
|
codeLibs | linker line: added to LIB_LIBS (Make/options)
|
||||||
|
localCode | c++; local static functions
|
||||||
|
\endplaintable
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
Example usage in controlDict:
|
Example usage in controlDict:
|
||||||
\verbatim
|
\verbatim
|
||||||
@ -89,7 +97,7 @@ Usage
|
|||||||
heSource -= 0.1*sqr(time.value())*V;
|
heSource -= 0.1*sqr(time.value())*V;
|
||||||
#};
|
#};
|
||||||
|
|
||||||
codeContrain
|
codeConstrain
|
||||||
#{
|
#{
|
||||||
Pout<< "**codeConstrain**" << endl;
|
Pout<< "**codeConstrain**" << endl;
|
||||||
#};
|
#};
|
||||||
@ -97,14 +105,13 @@ Usage
|
|||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
codedSource.C
|
codedSource.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef CodedSource_H
|
#ifndef fv_CodedFvSource_H
|
||||||
#define CodedSource_H
|
#define fv_CodedFvSource_H
|
||||||
|
|
||||||
#include "cellSetOption.H"
|
#include "cellSetOption.H"
|
||||||
#include "codedBase.H"
|
#include "codedBase.H"
|
||||||
@ -137,7 +144,7 @@ protected:
|
|||||||
string codeConstrain_;
|
string codeConstrain_;
|
||||||
|
|
||||||
//- Underlying code
|
//- Underlying code
|
||||||
mutable autoPtr<fv::option> redirectFvOptionPtr_;
|
mutable autoPtr<fv::option> redirectOptionPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
@ -190,7 +197,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Dynamically compiled fvOption
|
//- Dynamically compiled fvOption
|
||||||
option& redirectFvOption() const;
|
fv::option& redirectOption() const;
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
@ -239,8 +246,7 @@ public:
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "CodedSource.C"
|
#include "CodedFvSource.C"
|
||||||
#include "CodedSourceIO.C"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -1,72 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
|
||||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "CodedSource.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
codedBase::setCodeContext(coeffs_);
|
|
||||||
|
|
||||||
if (!cellSetOption::read(dict))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
coeffs_.readEntry("fields", fieldNames_);
|
|
||||||
applied_.resize(fieldNames_.size(), false);
|
|
||||||
|
|
||||||
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
|
||||||
|
|
||||||
|
|
||||||
// Code context chunks
|
|
||||||
|
|
||||||
auto& ctx = codedBase::codeContext();
|
|
||||||
|
|
||||||
ctx.readEntry("codeCorrect", codeCorrect_);
|
|
||||||
ctx.readEntry("codeAddSup", codeAddSup_);
|
|
||||||
|
|
||||||
// ctx.readEntry("codeConstrain", codeConstrain_);
|
|
||||||
ctx.readEntry // Compatibility
|
|
||||||
(
|
|
||||||
coeffs_.lookupEntryCompat
|
|
||||||
(
|
|
||||||
"codeConstrain",
|
|
||||||
{{ "codeSetValue", 1812 }},
|
|
||||||
keyType::LITERAL
|
|
||||||
).keyword(),
|
|
||||||
codeConstrain_
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -26,7 +26,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "makeFvOption.H"
|
#include "makeFvOption.H"
|
||||||
#include "CodedSource.H"
|
#include "CodedFvSource.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -54,10 +54,10 @@ void Foam::fv::SemiImplicitSource<Type>::setFieldData(const dictionary& dict)
|
|||||||
label count = dict.size();
|
label count = dict.size();
|
||||||
|
|
||||||
fieldNames_.resize(count);
|
fieldNames_.resize(count);
|
||||||
Su_.resize(count);
|
Su_.resize(fieldNames_.size());
|
||||||
Sp_.resize(count);
|
Sp_.resize(fieldNames_.size());
|
||||||
|
|
||||||
applied_.resize(count, false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (const entry& dEntry : dict)
|
for (const entry& dEntry : dict)
|
||||||
|
|||||||
@ -126,8 +126,8 @@ Foam::fv::interRegionExplicitPorositySource::interRegionExplicitPorositySource
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
fieldNames_.setSize(1, UName_);
|
fieldNames_.resize(1, UName_);
|
||||||
applied_.setSize(1, false);
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -147,9 +147,8 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
|
|||||||
if (active())
|
if (active())
|
||||||
{
|
{
|
||||||
coeffs_.readEntry("fields", fieldNames_);
|
coeffs_.readEntry("fields", fieldNames_);
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
|
||||||
|
|
||||||
coeffs_.readEntry("semiImplicit", semiImplicit_);
|
coeffs_.readEntry("semiImplicit", semiImplicit_);
|
||||||
|
fv::option::resetApplied();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,9 +57,9 @@ Foam::fv::radiation::radiation
|
|||||||
{
|
{
|
||||||
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
const auto& thermo = mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
fieldNames_.setSize(1);
|
fieldNames_.resize(1);
|
||||||
fieldNames_[0] = thermo.he().name();
|
fieldNames_[0] = thermo.he().name();
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
fv::option::resetApplied();
|
||||||
|
|
||||||
radiation_ = Foam::radiation::radiationModel::New(thermo.T());
|
radiation_ = Foam::radiation::radiationModel::New(thermo.T());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 IH-Cantabria
|
Copyright (C) 2017 IH-Cantabria
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -213,8 +213,7 @@ bool Foam::fv::multiphaseMangrovesSource::read(const dictionary& dict)
|
|||||||
fieldNames_.resize(1);
|
fieldNames_.resize(1);
|
||||||
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
|
||||||
}
|
}
|
||||||
|
fv::option::resetApplied();
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
|
||||||
|
|
||||||
// Create the Mangroves models - 1 per region
|
// Create the Mangroves models - 1 per region
|
||||||
const dictionary& regionsDict(coeffs_.subDict("regions"));
|
const dictionary& regionsDict(coeffs_.subDict("regions"));
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 IH-Cantabria
|
Copyright (C) 2017 IH-Cantabria
|
||||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -243,8 +243,7 @@ bool Foam::fv::multiphaseMangrovesTurbulenceModel::read(const dictionary& dict)
|
|||||||
fieldNames_[1] = "k";
|
fieldNames_[1] = "k";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fv::option::resetApplied();
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
|
||||||
|
|
||||||
// Create the Mangroves models - 1 per region
|
// Create the Mangroves models - 1 per region
|
||||||
const dictionary& regionsDict(coeffs_.subDict("regions"));
|
const dictionary& regionsDict(coeffs_.subDict("regions"));
|
||||||
|
|||||||
Reference in New Issue
Block a user