/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Class
Foam::calculatedProcessorFvPatchField
Group
grpGenericBoundaryConditions
Description
processorFvPatchField type bypassing fvPatch
Used to temporarily add updateInterfaceMatrix capabilities to a matrix
during overset solving. Supplies:
- patchNeighbourField functionality (cached in *this as per
processorFvPatchField)
- initEvaluate/evaluate: caching of patchNeighbourField (see above)
- initInterfaceMatrixUpdate etc: adding of neighbouring data
SourceFiles
calculatedProcessorFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef calculatedProcessorFvPatchField_H
#define calculatedProcessorFvPatchField_H
#include "lduPrimitiveProcessorInterface.H"
//#include "lduInterfaceField.H"
//#include "fvPatchField.H"
#include "coupledFvPatchField.H"
#include "processorLduInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class calculatedProcessorFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template
class calculatedProcessorFvPatchField
:
public processorLduInterfaceField,
public coupledFvPatchField
{
protected:
// Private data
//- Local reference cast into the interface
const lduPrimitiveProcessorInterface& procInterface_;
// Sending and receiving
//- Send buffer
mutable Field sendBuf_;
//- Receive buffer
mutable Field receiveBuf_;
//- Scalar send buffer
mutable Field scalarSendBuf_;
//- Scalar receive buffer
mutable Field scalarReceiveBuf_;
//- Outstanding request
mutable label outstandingSendRequest_;
//- Outstanding request
mutable label outstandingRecvRequest_;
// Private Member Functions
void addToInternalField
(
scalarField& result,
const bool add,
const scalarField& coeffs,
const scalarField& vals
) const;
public:
//- Runtime type information
TypeName("calculatedProcessor");
// Constructors
//- Construct from patch and internal field
calculatedProcessorFvPatchField
(
const lduInterface& interface,
const fvPatch&,
const DimensionedField&
);
//- Construct as copy
calculatedProcessorFvPatchField
(
const calculatedProcessorFvPatchField&
);
//- Construct and return a clone
virtual tmp> clone() const
{
return tmp>
(
new calculatedProcessorFvPatchField(*this)
);
}
//- Construct as copy setting internal field reference
calculatedProcessorFvPatchField
(
const calculatedProcessorFvPatchField&,
const DimensionedField&
);
//- Construct and return a clone setting internal field reference
virtual tmp> clone
(
const DimensionedField& iF
) const
{
return tmp>
(
new calculatedProcessorFvPatchField(*this, iF)
);
}
//- Destructor
virtual ~calculatedProcessorFvPatchField() = default;
// Member functions
// processorLduInterfaceField implementation
//- Return communicator used for comms
virtual label comm() const
{
return procInterface_.comm();
}
//- Return processor number
virtual int myProcNo() const
{
return procInterface_.myProcNo();
}
//- Return neighbour processor number
virtual int neighbProcNo() const
{
return procInterface_.myProcNo();
}
//- Is the transform required
virtual bool doTransform() const
{
return false;
}
//- Return face transformation tensor
virtual const tensorField& forwardT() const
{
return procInterface_.forwardT();
}
//- Return rank of component for transform
virtual int rank() const
{
return pTraits::rank;
}
// Access
//- Return true if this patch field is coupled. Our field supplies
// coefficients to the fvMatrix so should behave as a
// processorFvPatchField (in addBoundarySource it should not add
// to the source)
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
//- Return neighbour field of internal field
virtual tmp> patchNeighbourField() const;
// Evaluation functions
//- Is all data available
virtual bool ready() const;
//- 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);
//- 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& result,
const bool add,
const Field& psiInternal,
const scalarField& coeffs,
const Pstream::commsTypes commsType
) const
{
NotImplemented;
}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
Field& result,
const bool add,
const Field& psiInternal,
const scalarField& coeffs,
const Pstream::commsTypes commsType
) const
{
NotImplemented;
}
//- Write
//virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "calculatedProcessorFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //