mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
287 lines
8.2 KiB
C++
287 lines
8.2 KiB
C++
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd |
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
| Copyright (C) 2016-2017 Wikki 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::processorFaPatchField
|
|
|
|
Description
|
|
|
|
Author
|
|
Zeljko Tukovic, FMENA
|
|
Hrvoje Jasak, Wikki Ltd.
|
|
|
|
SourceFiles
|
|
processorFaPatchField.C
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#ifndef processorFaPatchField_H
|
|
#define processorFaPatchField_H
|
|
|
|
#include "coupledFaPatchField.H"
|
|
#include "processorLduInterfaceField.H"
|
|
#include "processorFaPatch.H"
|
|
#include "areaFaMesh.H"
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
namespace Foam
|
|
{
|
|
|
|
/*---------------------------------------------------------------------------*\
|
|
Class processorFaPatchField Declaration
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
template<class Type>
|
|
class processorFaPatchField
|
|
:
|
|
public processorLduInterfaceField,
|
|
public coupledFaPatchField<Type>
|
|
{
|
|
// Private data
|
|
|
|
//- Local reference cast into the processor patch
|
|
const processorFaPatch& procPatch_;
|
|
|
|
|
|
public:
|
|
|
|
//- Runtime type information
|
|
TypeName(processorFaPatch::typeName_());
|
|
|
|
|
|
// Constructors
|
|
|
|
//- Construct from patch and internal field
|
|
processorFaPatchField
|
|
(
|
|
const faPatch&,
|
|
const DimensionedField<Type, areaMesh>&
|
|
);
|
|
|
|
//- Construct from patch and internal field and patch field
|
|
processorFaPatchField
|
|
(
|
|
const faPatch&,
|
|
const DimensionedField<Type, areaMesh>&,
|
|
const Field<Type>&
|
|
);
|
|
|
|
//- Construct from patch, internal field and dictionary
|
|
processorFaPatchField
|
|
(
|
|
const faPatch&,
|
|
const DimensionedField<Type, areaMesh>&,
|
|
const dictionary&
|
|
);
|
|
|
|
//- Construct by mapping given processorFaPatchField onto a new patch
|
|
processorFaPatchField
|
|
(
|
|
const processorFaPatchField<Type>&,
|
|
const faPatch&,
|
|
const DimensionedField<Type, areaMesh>&,
|
|
const faPatchFieldMapper&
|
|
);
|
|
|
|
//- Construct as copy
|
|
processorFaPatchField(const processorFaPatchField<Type>&);
|
|
|
|
//- Construct and return a clone
|
|
virtual tmp<faPatchField<Type>> clone() const
|
|
{
|
|
return tmp<faPatchField<Type>>
|
|
(
|
|
new processorFaPatchField<Type>(*this)
|
|
);
|
|
}
|
|
|
|
//- Construct as copy setting internal field reference
|
|
processorFaPatchField
|
|
(
|
|
const processorFaPatchField<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 processorFaPatchField<Type>(*this, iF)
|
|
);
|
|
}
|
|
|
|
|
|
// Destructor
|
|
|
|
~processorFaPatchField();
|
|
|
|
|
|
// Member functions
|
|
|
|
// Access
|
|
|
|
//- Return true if running parallel
|
|
virtual bool coupled() const
|
|
{
|
|
if (Pstream::parRun())
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
//- Return neighbour field given internal field
|
|
tmp<Field<Type>> patchNeighbourField() const;
|
|
|
|
|
|
// Evaluation functions
|
|
|
|
//- Initialise the evaluation of the patch field
|
|
virtual void initEvaluate(const Pstream::commsTypes commsType);
|
|
|
|
//- Evaluate the patch field
|
|
virtual void evaluate(const Pstream::commsTypes commsType);
|
|
|
|
//- Return patch-normal gradient
|
|
virtual tmp<Field<Type>> snGrad() const;
|
|
|
|
// Coupled interface functionality
|
|
|
|
//- Transform neighbour field
|
|
virtual void transformCoupleField
|
|
(
|
|
scalarField& f,
|
|
const direction cmpt
|
|
) const
|
|
{
|
|
processorLduInterfaceField::transformCoupleField(f, cmpt);
|
|
}
|
|
|
|
//- Initialise neighbour matrix update
|
|
virtual void initInterfaceMatrixUpdate
|
|
(
|
|
scalarField& result,
|
|
const bool add,
|
|
const scalarField& psiInternal,
|
|
const scalarField& coeffs,
|
|
const direction cmpt,
|
|
const Pstream::commsTypes commsType
|
|
) const;
|
|
|
|
//- Update result field based on interface functionality
|
|
virtual void updateInterfaceMatrix
|
|
(
|
|
scalarField& result,
|
|
const bool add,
|
|
const scalarField& psiInternal,
|
|
const scalarField& coeffs,
|
|
const direction cmpt,
|
|
const Pstream::commsTypes commsType
|
|
) const;
|
|
|
|
//- Initialise neighbour matrix update
|
|
virtual void initInterfaceMatrixUpdate
|
|
(
|
|
Field<Type>& result,
|
|
const bool add,
|
|
const Field<Type>&,
|
|
const scalarField& coeffs,
|
|
const Pstream::commsTypes commsType
|
|
) const;
|
|
|
|
//- Update result field based on interface functionality
|
|
virtual void updateInterfaceMatrix
|
|
(
|
|
Field<Type>& result,
|
|
const bool add,
|
|
const Field<Type>&,
|
|
const scalarField& coeffs,
|
|
const Pstream::commsTypes commsType
|
|
) const;
|
|
|
|
//- Processor coupled interface functions
|
|
|
|
//- Return communicator used for comms
|
|
virtual label comm() const
|
|
{
|
|
return UPstream::worldComm;
|
|
}
|
|
|
|
//- Return processor number
|
|
virtual int myProcNo() const
|
|
{
|
|
return procPatch_.myProcNo();
|
|
}
|
|
|
|
//- Return neigbour processor number
|
|
virtual int neighbProcNo() const
|
|
{
|
|
return procPatch_.neighbProcNo();
|
|
}
|
|
|
|
//- Does the patch field perform the transfromation
|
|
virtual bool doTransform() const
|
|
{
|
|
return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
|
|
}
|
|
|
|
//- Return face transformation tensor
|
|
virtual const tensorField& forwardT() const
|
|
{
|
|
return procPatch_.forwardT();
|
|
}
|
|
|
|
//- Return rank of component for transform
|
|
virtual int rank() const
|
|
{
|
|
return pTraits<Type>::rank;
|
|
}
|
|
};
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
} // End namespace Foam
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
#ifdef NoRepository
|
|
#include "processorFaPatchField.C"
|
|
#endif
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
#endif
|
|
|
|
// ************************************************************************* //
|