ENH: add finite-area extrapolatedCalculated BC

This commit is contained in:
Mark Olesen
2023-02-16 17:09:17 +01:00
parent b17422ef1a
commit 26400d7534
6 changed files with 378 additions and 1 deletions

View File

@ -44,6 +44,7 @@ $(faPatchFields)/faPatchField/faPatchFields.C
basicFaPatchFields = $(faPatchFields)/basic
$(basicFaPatchFields)/basicSymmetry/basicSymmetryFaPatchFields.C
$(basicFaPatchFields)/calculated/calculatedFaPatchFields.C
$(basicFaPatchFields)/extrapolatedCalculated/extrapolatedCalculatedFaPatchFields.C
$(basicFaPatchFields)/coupled/coupledFaPatchFields.C
$(basicFaPatchFields)/zeroGradient/zeroGradientFaPatchFields.C
$(basicFaPatchFields)/fixedValue/fixedValueFaPatchFields.C

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2023 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 "extrapolatedCalculatedFaPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
:
calculatedFaPatchField<Type>(p, iF)
{}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
calculatedFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
calculatedFaPatchField<Type>::operator==(this->patchInternalField());
}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
calculatedFaPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>& ptf
)
:
calculatedFaPatchField<Type>(ptf)
{}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
)
:
calculatedFaPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::extrapolatedCalculatedFaPatchField<Type>::evaluate
(
const Pstream::commsTypes
)
{
if (!this->updated())
{
this->updateCoeffs();
}
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
calculatedFaPatchField<Type>::evaluate();
}
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2023 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/>.
Class
Foam::extrapolatedCalculatedFaPatchField
Group
grpGenericBoundaryConditions
Description
This boundary condition applies a zero-gradient condition from the patch
internal field onto the patch faces when \c evaluated but may also be
assigned. \c snGrad returns the patch gradient evaluated from the current
internal and patch field values rather than returning zero.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type extrapolatedCalculated;
}
\endverbatim
SourceFiles
extrapolatedCalculatedFaPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_extrapolatedCalculatedFaPatchField_H
#define Foam_extrapolatedCalculatedFaPatchField_H
#include "calculatedFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extrapolatedCalculatedFaPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class extrapolatedCalculatedFaPatchField
:
public calculatedFaPatchField<Type>
{
public:
//- Runtime type information
TypeName("extrapolatedCalculated");
// Constructors
//- Construct from patch and internal field
extrapolatedCalculatedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch, internal field and dictionary
extrapolatedCalculatedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&
);
//- Construct by mapping given patchField onto a new patch
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>&,
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper&
);
//- Construct as copy
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<faPatchField<Type>> clone() const
{
return tmp<faPatchField<Type>>
(
new extrapolatedCalculatedFaPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>&,
const DimensionedField<Type, areaMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<faPatchField<Type>> clone
(
const DimensionedField<Type, areaMesh>& iF
) const
{
return tmp<faPatchField<Type>>
(
new extrapolatedCalculatedFaPatchField<Type>(*this, iF)
);
}
// Member Functions
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "extrapolatedCalculatedFaPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 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 "extrapolatedCalculatedFaPatchFields.H"
#include "faPatchFields.H"
#include "areaFaMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(extrapolatedCalculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 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/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_extrapolatedCalculatedFaPatchFields_H
#define Foam_extrapolatedCalculatedFaPatchFields_H
#include "extrapolatedCalculatedFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(extrapolatedCalculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -54,7 +54,7 @@ extrapolatedCalculatedFvPatchField
:
calculatedFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
evaluate();
calculatedFvPatchField<Type>::operator==(this->patchInternalField());
}