mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: changes for implicit handling, region coupling
- avoid deprecated autoPtr check - bundle bool values in fvPatchField for compacter allocation - change useImplicit to a set method taking an argument instead of allowing direct access.
This commit is contained in:
@ -9,7 +9,7 @@ forAll(fluidRegions, i)
|
||||
const rhoThermo& thermo = refCast<const rhoThermo>(thermoFluid[i]);
|
||||
const auto& bpsi = thermo.T().boundaryField();
|
||||
|
||||
forAll (bpsi, patchI)
|
||||
forAll(bpsi, patchI)
|
||||
{
|
||||
if (bpsi[patchI].useImplicit())
|
||||
{
|
||||
@ -23,7 +23,7 @@ forAll(solidRegions, i)
|
||||
solidThermo& thermo = thermos[i];
|
||||
const auto& bpsi = thermo.T().boundaryField();
|
||||
|
||||
forAll (bpsi, patchI)
|
||||
forAll(bpsi, patchI)
|
||||
{
|
||||
if (bpsi[patchI].useImplicit())
|
||||
{
|
||||
@ -37,7 +37,7 @@ forAll(fluidRegions, i)
|
||||
const rhoThermo& thermo = refCast<const rhoThermo>(thermoFluid[i]);
|
||||
if (coupled)
|
||||
{
|
||||
Info << "Create fvMatrixAssembly." << endl;
|
||||
Info<< "Create fvMatrixAssembly." << endl;
|
||||
fvMatrixAssemblyPtr.reset
|
||||
(
|
||||
new fvMatrix<scalar>
|
||||
@ -50,12 +50,12 @@ forAll(fluidRegions, i)
|
||||
}
|
||||
}
|
||||
|
||||
forAll(solidRegions, i)
|
||||
if (coupled && !fvMatrixAssemblyPtr)
|
||||
{
|
||||
if (coupled && fvMatrixAssemblyPtr.empty())
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
solidThermo& thermo = thermos[i];
|
||||
Info << "Create fvMatrixAssembly." << endl;
|
||||
Info<< "Create fvMatrixAssembly." << endl;
|
||||
fvMatrixAssemblyPtr.reset
|
||||
(
|
||||
new fvMatrix<scalar>
|
||||
|
||||
@ -151,9 +151,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
|
||||
valueFraction() = 1.0;
|
||||
}
|
||||
|
||||
if (dict.found("useImplicit"))
|
||||
bool boolVal(false);
|
||||
if (dict.readIfPresent("useImplicit", boolVal))
|
||||
{
|
||||
useImplicit() = dict.get<Switch>("useImplicit");
|
||||
this->useImplicit(boolVal);
|
||||
}
|
||||
if (dict.found("source"))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,8 +46,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(word::null),
|
||||
useImplicit_(false)
|
||||
useImplicit_(false),
|
||||
patchType_()
|
||||
{}
|
||||
|
||||
|
||||
@ -64,8 +64,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(word::null),
|
||||
useImplicit_(false)
|
||||
useImplicit_(false),
|
||||
patchType_()
|
||||
{}
|
||||
|
||||
|
||||
@ -82,8 +82,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(patchType),
|
||||
useImplicit_(false)
|
||||
useImplicit_(false),
|
||||
patchType_(patchType)
|
||||
{}
|
||||
|
||||
|
||||
@ -100,8 +100,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(word::null),
|
||||
useImplicit_(false)
|
||||
useImplicit_(false),
|
||||
patchType_()
|
||||
{}
|
||||
|
||||
|
||||
@ -119,8 +119,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(dict.getOrDefault<word>("patchType", word::null)),
|
||||
useImplicit_(dict.getOrDefault<bool>("useImplicit", false))
|
||||
useImplicit_(dict.getOrDefault<bool>("useImplicit", false)),
|
||||
patchType_(dict.getOrDefault<word>("patchType", word::null))
|
||||
{
|
||||
if (valueRequired)
|
||||
{
|
||||
@ -155,8 +155,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(ptf.patchType_),
|
||||
useImplicit_(ptf.useImplicit_)
|
||||
useImplicit_(ptf.useImplicit_),
|
||||
patchType_(ptf.patchType_)
|
||||
{
|
||||
// For unmapped faces set to internal field value (zero-gradient)
|
||||
if (notNull(iF) && mapper.hasUnmapped())
|
||||
@ -178,8 +178,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(ptf.internalField_),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(ptf.patchType_),
|
||||
useImplicit_(ptf.useImplicit_)
|
||||
useImplicit_(ptf.useImplicit_),
|
||||
patchType_(ptf.patchType_)
|
||||
{}
|
||||
|
||||
|
||||
@ -195,8 +195,8 @@ Foam::fvPatchField<Type>::fvPatchField
|
||||
internalField_(iF),
|
||||
updated_(false),
|
||||
manipulatedMatrix_(false),
|
||||
patchType_(ptf.patchType_),
|
||||
useImplicit_(ptf.useImplicit_)
|
||||
useImplicit_(ptf.useImplicit_),
|
||||
patchType_(ptf.patchType_)
|
||||
{}
|
||||
|
||||
|
||||
@ -384,7 +384,11 @@ template<class Type>
|
||||
void Foam::fvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
os.writeEntry("type", type());
|
||||
os.writeEntryIfDifferent<bool>("useImplicit", false, useImplicit_);
|
||||
|
||||
if (useImplicit_)
|
||||
{
|
||||
os.writeEntry("useImplicit", "true");
|
||||
}
|
||||
|
||||
if (patchType_.size())
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,7 +82,7 @@ class fvPatchField
|
||||
:
|
||||
public Field<Type>
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Reference to patch
|
||||
const fvPatch& patch_;
|
||||
@ -91,21 +91,21 @@ class fvPatchField
|
||||
const DimensionedField<Type, volMesh>& internalField_;
|
||||
|
||||
//- Update index used so that updateCoeffs is called only once during
|
||||
// the construction of the matrix
|
||||
//- the construction of the matrix
|
||||
bool updated_;
|
||||
|
||||
//- Update index used so that manipulateMatrix is called only once
|
||||
// during the construction of the matrix
|
||||
//- during the construction of the matrix
|
||||
bool manipulatedMatrix_;
|
||||
|
||||
//- Use implicit formulation
|
||||
bool useImplicit_;
|
||||
|
||||
//- Optional patch type, used to allow specified boundary conditions
|
||||
// to be applied to constraint patches by providing the constraint
|
||||
// patch type as 'patchType'
|
||||
word patchType_;
|
||||
|
||||
//- Use implicit formulation
|
||||
bool useImplicit_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -307,15 +307,18 @@ public:
|
||||
// Implicit Functions
|
||||
|
||||
//- Use implicit formulation for coupled patches only
|
||||
bool useImplicit() const
|
||||
bool useImplicit() const noexcept
|
||||
{
|
||||
return useImplicit_;
|
||||
}
|
||||
|
||||
//- Non-const access to useImplicit
|
||||
bool& useImplicit()
|
||||
//- Set useImplicit on/off
|
||||
// \return old value
|
||||
bool useImplicit(bool on) noexcept
|
||||
{
|
||||
return useImplicit_;
|
||||
bool old(useImplicit_);
|
||||
useImplicit_ = on;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
@ -393,7 +396,8 @@ public:
|
||||
return manipulatedMatrix_;
|
||||
}
|
||||
|
||||
// Mapping functions
|
||||
|
||||
// Mapping Functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
@ -409,7 +413,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
// Evaluation Functions
|
||||
|
||||
//- Return patch-normal gradient
|
||||
virtual tmp<Field<Type>> snGrad() const;
|
||||
@ -558,7 +562,7 @@ public:
|
||||
void check(const fvPatchField<Type>&) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
// Member Operators
|
||||
|
||||
virtual void operator=(const UList<Type>&);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -83,7 +83,7 @@ void Foam::heThermo<BasicThermo, MixtureType>::init
|
||||
patchi
|
||||
);
|
||||
|
||||
heBf[patchi].useImplicit() = T.boundaryField()[patchi].useImplicit();
|
||||
heBf[patchi].useImplicit(T.boundaryField()[patchi].useImplicit());
|
||||
}
|
||||
|
||||
this->heBoundaryCorrection(he);
|
||||
|
||||
Reference in New Issue
Block a user