mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
cycicACMI: Removed duplicate code in fv and fvs patches and fields
This commit is contained in:
@ -78,16 +78,6 @@ class cyclicFvPatchField
|
|||||||
const cyclicFvPatch& cyclicPatch_;
|
const cyclicFvPatch& cyclicPatch_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Return neighbour side field given internal fields
|
|
||||||
template<class Type2>
|
|
||||||
tmp<Field<Type2>> neighbourSideField
|
|
||||||
(
|
|
||||||
const Field<Type2>&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -26,157 +26,8 @@ License
|
|||||||
#include "cyclicACMIFvPatchField.H"
|
#include "cyclicACMIFvPatchField.H"
|
||||||
#include "transformField.H"
|
#include "transformField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvPatchField<Type>(p, iF),
|
|
||||||
cyclicACMILduInterfaceField(),
|
|
||||||
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvPatchField<Type>(p, iF, dict, dict.found("value")),
|
|
||||||
cyclicACMILduInterfaceField(),
|
|
||||||
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p))
|
|
||||||
{
|
|
||||||
if (!isA<cyclicACMIFvPatch>(p))
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction
|
|
||||||
(
|
|
||||||
dict
|
|
||||||
) << " patch type '" << p.type()
|
|
||||||
<< "' not constraint type '" << typeName << "'"
|
|
||||||
<< "\n for patch " << p.name()
|
|
||||||
<< " of field " << this->internalField().name()
|
|
||||||
<< " in file " << this->internalField().objectPath()
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dict.found("value") && this->coupled())
|
|
||||||
{
|
|
||||||
this->evaluate(Pstream::commsTypes::blocking);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvPatchField<Type>& ptf,
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, volMesh>& iF,
|
|
||||||
const fvPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvPatchField<Type>(ptf, p, iF, mapper),
|
|
||||||
cyclicACMILduInterfaceField(),
|
|
||||||
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p))
|
|
||||||
{
|
|
||||||
if (!isA<cyclicACMIFvPatch>(this->patch()))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "' not constraint type '" << typeName << "'"
|
|
||||||
<< "\n for patch " << p.name()
|
|
||||||
<< " of field " << this->internalField().name()
|
|
||||||
<< " in file " << this->internalField().objectPath()
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvPatchField<Type>& ptf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvPatchField<Type>(ptf),
|
|
||||||
cyclicACMILduInterfaceField(),
|
|
||||||
cyclicACMIPatch_(ptf.cyclicACMIPatch_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvPatchField<Type>& ptf,
|
|
||||||
const DimensionedField<Type, volMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvPatchField<Type>(ptf, iF),
|
|
||||||
cyclicACMILduInterfaceField(),
|
|
||||||
cyclicACMIPatch_(ptf.cyclicACMIPatch_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool Foam::cyclicACMIFvPatchField<Type>::coupled() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPatch_.coupled();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::tmp<Foam::Field<Type>>
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::patchNeighbourField() const
|
|
||||||
{
|
|
||||||
const Field<Type>& iField = this->primitiveField();
|
|
||||||
const cyclicACMIPolyPatch& cpp = cyclicACMIPatch_.cyclicACMIPatch();
|
|
||||||
tmp<Field<Type>> tpnf
|
|
||||||
(
|
|
||||||
cyclicACMIPatch_.interpolate
|
|
||||||
(
|
|
||||||
Field<Type>
|
|
||||||
(
|
|
||||||
iField,
|
|
||||||
cpp.neighbPatch().faceCells()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (doTransform())
|
|
||||||
{
|
|
||||||
tpnf.ref() = transform(forwardT(), tpnf());
|
|
||||||
}
|
|
||||||
|
|
||||||
return tpnf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
const Foam::cyclicACMIFvPatchField<Type>&
|
|
||||||
Foam::cyclicACMIFvPatchField<Type>::neighbourPatchField() const
|
|
||||||
{
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& fld =
|
|
||||||
static_cast<const GeometricField<Type, fvPatchField, volMesh>&>
|
|
||||||
(
|
|
||||||
this->primitiveField()
|
|
||||||
);
|
|
||||||
|
|
||||||
return refCast<const cyclicACMIFvPatchField<Type>>
|
|
||||||
(
|
|
||||||
fld.boundaryField()[cyclicACMIPatch_.neighbPatchID()]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::fvPatchField<Type>&
|
const Foam::fvPatchField<Type>&
|
||||||
Foam::cyclicACMIFvPatchField<Type>::nonOverlapPatchField() const
|
Foam::cyclicACMIFvPatchField<Type>::nonOverlapPatchField() const
|
||||||
@ -187,71 +38,10 @@ Foam::cyclicACMIFvPatchField<Type>::nonOverlapPatchField() const
|
|||||||
this->primitiveField()
|
this->primitiveField()
|
||||||
);
|
);
|
||||||
|
|
||||||
return fld.boundaryField()[cyclicACMIPatch_.nonOverlapPatchID()];
|
return fld.boundaryField()
|
||||||
}
|
[
|
||||||
|
cyclicACMIPatch().cyclicACMIPatch().nonOverlapPatchID()
|
||||||
|
];
|
||||||
template<class Type>
|
|
||||||
void Foam::cyclicACMIFvPatchField<Type>::updateInterfaceMatrix
|
|
||||||
(
|
|
||||||
scalarField& result,
|
|
||||||
const scalarField& psiInternal,
|
|
||||||
const scalarField& coeffs,
|
|
||||||
const direction cmpt,
|
|
||||||
const Pstream::commsTypes
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const cyclicACMIPolyPatch& cpp = cyclicACMIPatch_.cyclicACMIPatch();
|
|
||||||
|
|
||||||
// note: only applying coupled contribution
|
|
||||||
|
|
||||||
const labelUList& nbrFaceCellsCoupled =
|
|
||||||
cpp.neighbPatch().faceCells();
|
|
||||||
|
|
||||||
scalarField pnf(psiInternal, nbrFaceCellsCoupled);
|
|
||||||
|
|
||||||
// Transform according to the transformation tensors
|
|
||||||
transformCoupleField(pnf, cmpt);
|
|
||||||
|
|
||||||
const labelUList& faceCells = cyclicACMIPatch_.faceCells();
|
|
||||||
|
|
||||||
pnf = cyclicACMIPatch_.interpolate(pnf);
|
|
||||||
|
|
||||||
forAll(faceCells, elemI)
|
|
||||||
{
|
|
||||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::cyclicACMIFvPatchField<Type>::updateInterfaceMatrix
|
|
||||||
(
|
|
||||||
Field<Type>& result,
|
|
||||||
const Field<Type>& psiInternal,
|
|
||||||
const scalarField& coeffs,
|
|
||||||
const Pstream::commsTypes
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const cyclicACMIPolyPatch& cpp = cyclicACMIPatch_.cyclicACMIPatch();
|
|
||||||
|
|
||||||
// note: only applying coupled contribution
|
|
||||||
|
|
||||||
const labelUList& nbrFaceCellsCoupled = cpp.neighbPatch().faceCells();
|
|
||||||
|
|
||||||
Field<Type> pnf(psiInternal, nbrFaceCellsCoupled);
|
|
||||||
|
|
||||||
// Transform according to the transformation tensors
|
|
||||||
transformCoupleField(pnf);
|
|
||||||
|
|
||||||
const labelUList& faceCells = cyclicACMIPatch_.faceCells();
|
|
||||||
|
|
||||||
pnf = cyclicACMIPatch_.interpolate(pnf);
|
|
||||||
|
|
||||||
forAll(faceCells, elemI)
|
|
||||||
{
|
|
||||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -261,7 +51,7 @@ void Foam::cyclicACMIFvPatchField<Type>::manipulateMatrix
|
|||||||
fvMatrix<Type>& matrix
|
fvMatrix<Type>& matrix
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
const scalarField& mask = cyclicACMIPatch().cyclicACMIPatch().mask();
|
||||||
|
|
||||||
// nothing to be done by the AMI, but re-direct to non-overlap patch
|
// nothing to be done by the AMI, but re-direct to non-overlap patch
|
||||||
// with non-overlap patch weights
|
// with non-overlap patch weights
|
||||||
@ -280,18 +70,10 @@ void Foam::cyclicACMIFvPatchField<Type>::updateCoeffs()
|
|||||||
// Pass in (1 - mask) to give non-overlap patch the chance to do
|
// Pass in (1 - mask) to give non-overlap patch the chance to do
|
||||||
// manipulation of non-face based data
|
// manipulation of non-face based data
|
||||||
|
|
||||||
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
const scalarField& mask = cyclicACMIPatch().cyclicACMIPatch().mask();
|
||||||
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
||||||
const_cast<fvPatchField<Type>&>(npf).updateWeightedCoeffs(1.0 - mask);
|
const_cast<fvPatchField<Type>&>(npf).updateWeightedCoeffs(1.0 - mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::cyclicACMIFvPatchField<Type>::write(Ostream& os) const
|
|
||||||
{
|
|
||||||
fvPatchField<Type>::write(os);
|
|
||||||
this->writeEntry("value", os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -52,8 +52,7 @@ SourceFiles
|
|||||||
#ifndef cyclicACMIFvPatchField_H
|
#ifndef cyclicACMIFvPatchField_H
|
||||||
#define cyclicACMIFvPatchField_H
|
#define cyclicACMIFvPatchField_H
|
||||||
|
|
||||||
#include "coupledFvPatchField.H"
|
#include "cyclicAMIFvPatchField.H"
|
||||||
#include "cyclicACMILduInterfaceField.H"
|
|
||||||
#include "cyclicACMIFvPatch.H"
|
#include "cyclicACMIFvPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -68,25 +67,8 @@ namespace Foam
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class cyclicACMIFvPatchField
|
class cyclicACMIFvPatchField
|
||||||
:
|
:
|
||||||
public coupledFvPatchField<Type>,
|
public cyclicAMIFvPatchField<Type>
|
||||||
public cyclicACMILduInterfaceField
|
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Local reference cast into the cyclic patch
|
|
||||||
const cyclicACMIFvPatch& cyclicACMIPatch_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Return neighbour side field given internal fields
|
|
||||||
template<class Type2>
|
|
||||||
tmp<Field<Type2>> neighbourSideField
|
|
||||||
(
|
|
||||||
const Field<Type2>&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -95,32 +77,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Inherit parent constructors
|
||||||
cyclicACMIFvPatchField
|
using cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField;
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, volMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
|
||||||
cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, volMesh>&,
|
|
||||||
const dictionary&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct by mapping given cyclicACMIFvPatchField onto a new patch
|
|
||||||
cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvPatchField<Type>&,
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, volMesh>&,
|
|
||||||
const fvPatchFieldMapper&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
cyclicACMIFvPatchField(const cyclicACMIFvPatchField<Type>&);
|
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual tmp<fvPatchField<Type>> clone() const
|
virtual tmp<fvPatchField<Type>> clone() const
|
||||||
@ -131,13 +89,6 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
|
||||||
cyclicACMIFvPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvPatchField<Type>&,
|
|
||||||
const DimensionedField<Type, volMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<fvPatchField<Type>> clone
|
virtual tmp<fvPatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -155,26 +106,22 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return local reference cast into the cyclic AMI patch
|
//- Return the fv patch
|
||||||
const cyclicACMIFvPatch& cyclicACMIPatch() const
|
const cyclicACMIFvPatch& cyclicACMIPatch() const
|
||||||
{
|
{
|
||||||
return cyclicACMIPatch_;
|
return refCast<const cyclicACMIFvPatch>(this->patch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
//- Return true if coupled. Note that the underlying patch
|
|
||||||
// is not coupled() - the points don't align
|
|
||||||
virtual bool coupled() const;
|
|
||||||
|
|
||||||
//- Return true if this patch field fixes a value
|
//- Return true if this patch field fixes a value
|
||||||
// Needed to check if a level has to be specified while solving
|
// Needed to check if a level has to be specified while solving
|
||||||
// Poissons equations
|
// Poissons equations
|
||||||
virtual bool fixesValue() const
|
virtual bool fixesValue() const
|
||||||
{
|
{
|
||||||
const scalarField& mask =
|
const scalarField& mask =
|
||||||
cyclicACMIPatch_.cyclicACMIPatch().mask();
|
cyclicACMIPatch().cyclicACMIPatch().mask();
|
||||||
|
|
||||||
if (gMax(mask) > 1e-5)
|
if (gMax(mask) > 1e-5)
|
||||||
{
|
{
|
||||||
@ -188,74 +135,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return neighbour coupled internal cell data
|
|
||||||
virtual tmp<Field<Type>> patchNeighbourField() const;
|
|
||||||
|
|
||||||
//- Return reference to neighbour patchField
|
|
||||||
const cyclicACMIFvPatchField<Type>& neighbourPatchField() const;
|
|
||||||
|
|
||||||
//- Return reference to non-overlapping patchField
|
//- Return reference to non-overlapping patchField
|
||||||
const fvPatchField<Type>& nonOverlapPatchField() const;
|
const fvPatchField<Type>& nonOverlapPatchField() const;
|
||||||
|
|
||||||
//- Update result field based on interface functionality
|
|
||||||
virtual void updateInterfaceMatrix
|
|
||||||
(
|
|
||||||
scalarField& result,
|
|
||||||
const scalarField& psiInternal,
|
|
||||||
const scalarField& coeffs,
|
|
||||||
const direction cmpt,
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Update result field based on interface functionality
|
|
||||||
virtual void updateInterfaceMatrix
|
|
||||||
(
|
|
||||||
Field<Type>&,
|
|
||||||
const Field<Type>&,
|
|
||||||
const scalarField&,
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Manipulate matrix
|
//- Manipulate matrix
|
||||||
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
|
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
// Cyclic AMI coupled interface functions
|
|
||||||
|
|
||||||
//- Does the patch field perform the transformation
|
|
||||||
virtual bool doTransform() const
|
|
||||||
{
|
|
||||||
return
|
|
||||||
!(cyclicACMIPatch_.parallel() || pTraits<Type>::rank == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return face transformation tensor
|
|
||||||
virtual const tensorField& forwardT() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPatch_.forwardT();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return neighbour-cell transformation tensor
|
|
||||||
virtual const tensorField& reverseT() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPatch_.reverseT();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return rank of component for transform
|
|
||||||
virtual int rank() const
|
|
||||||
{
|
|
||||||
return pTraits<Type>::rank;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write(Ostream& os) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -82,16 +82,6 @@ class cyclicAMIFvPatchField
|
|||||||
const cyclicAMIFvPatch& cyclicAMIPatch_;
|
const cyclicAMIFvPatch& cyclicAMIPatch_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Return neighbour side field given internal fields
|
|
||||||
template<class Type2>
|
|
||||||
tmp<Field<Type2>> neighbourSideField
|
|
||||||
(
|
|
||||||
const Field<Type2>&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -1,135 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
|
||||||
\\/ 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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "cyclicACMIFvsPatchField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvsPatchField<Type>::cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, surfaceMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvsPatchField<Type>(p, iF),
|
|
||||||
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvsPatchField<Type>::cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvsPatchField<Type>& ptf,
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, surfaceMesh>& iF,
|
|
||||||
const fvPatchFieldMapper& mapper
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvsPatchField<Type>(ptf, p, iF, mapper),
|
|
||||||
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p))
|
|
||||||
{
|
|
||||||
if (!isA<cyclicACMIFvPatch>(this->patch()))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Field type does not correspond to patch type for patch "
|
|
||||||
<< this->patch().index() << "." << endl
|
|
||||||
<< "Field type: " << typeName << endl
|
|
||||||
<< "Patch type: " << this->patch().type()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvsPatchField<Type>::cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<Type, surfaceMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvsPatchField<Type>(p, iF, dict),
|
|
||||||
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p))
|
|
||||||
{
|
|
||||||
if (!isA<cyclicACMIFvPatch>(p))
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction
|
|
||||||
(
|
|
||||||
dict
|
|
||||||
) << "patch " << this->patch().index() << " not cyclicACMI type. "
|
|
||||||
<< "Patch type = " << p.type()
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvsPatchField<Type>::cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvsPatchField<Type>& ptf
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvsPatchField<Type>(ptf),
|
|
||||||
cyclicACMIPatch_(ptf.cyclicACMIPatch_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::cyclicACMIFvsPatchField<Type>::cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvsPatchField<Type>& ptf,
|
|
||||||
const DimensionedField<Type, surfaceMesh>& iF
|
|
||||||
)
|
|
||||||
:
|
|
||||||
coupledFvsPatchField<Type>(ptf, iF),
|
|
||||||
cyclicACMIPatch_(ptf.cyclicACMIPatch_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool Foam::cyclicACMIFvsPatchField<Type>::coupled() const
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
Pstream::parRun()
|
|
||||||
|| (
|
|
||||||
this->cyclicACMIPatch_.size()
|
|
||||||
&& this->cyclicACMIPatch_.cyclicACMIPatch().neighbPatch().size()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,7 +35,7 @@ SourceFiles
|
|||||||
#ifndef cyclicACMIFvsPatchField_H
|
#ifndef cyclicACMIFvsPatchField_H
|
||||||
#define cyclicACMIFvsPatchField_H
|
#define cyclicACMIFvsPatchField_H
|
||||||
|
|
||||||
#include "coupledFvsPatchField.H"
|
#include "cyclicAMIFvsPatchField.H"
|
||||||
#include "cyclicACMIFvPatch.H"
|
#include "cyclicACMIFvPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -50,14 +50,8 @@ namespace Foam
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class cyclicACMIFvsPatchField
|
class cyclicACMIFvsPatchField
|
||||||
:
|
:
|
||||||
public coupledFvsPatchField<Type>
|
public cyclicAMIFvsPatchField<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Local reference cast into the cyclic patch
|
|
||||||
const cyclicACMIFvPatch& cyclicACMIPatch_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -66,35 +60,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Inherit parent constructors
|
||||||
cyclicACMIFvsPatchField
|
using cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField;
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, surfaceMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
|
||||||
cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, surfaceMesh>&,
|
|
||||||
const dictionary&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct by mapping given cyclicACMIFvsPatchField onto a new patch
|
|
||||||
cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvsPatchField<Type>&,
|
|
||||||
const fvPatch&,
|
|
||||||
const DimensionedField<Type, surfaceMesh>&,
|
|
||||||
const fvPatchFieldMapper&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvsPatchField<Type>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual tmp<fvsPatchField<Type>> clone() const
|
virtual tmp<fvsPatchField<Type>> clone() const
|
||||||
@ -105,13 +72,6 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
|
||||||
cyclicACMIFvsPatchField
|
|
||||||
(
|
|
||||||
const cyclicACMIFvsPatchField<Type>&,
|
|
||||||
const DimensionedField<Type, surfaceMesh>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
//- Construct and return a clone setting internal field reference
|
||||||
virtual tmp<fvsPatchField<Type>> clone
|
virtual tmp<fvsPatchField<Type>> clone
|
||||||
(
|
(
|
||||||
@ -123,13 +83,6 @@ public:
|
|||||||
new cyclicACMIFvsPatchField<Type>(*this, iF)
|
new cyclicACMIFvsPatchField<Type>(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return true if running parallel
|
|
||||||
virtual bool coupled() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -139,12 +92,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "cyclicACMIFvsPatchField.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "cyclicACMIFvsPatchFields.H"
|
#include "cyclicACMIFvsPatchFields.H"
|
||||||
#include "fvsPatchFields.H"
|
#include "fvsPatchFields.H"
|
||||||
|
#include "surfaceMesh.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -37,16 +37,16 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::cyclicACMIFvPatch::updateAreas() const
|
void Foam::cyclicACMIFvPatch::updateAreas() const
|
||||||
{
|
{
|
||||||
if (cyclicACMIPolyPatch_.updated())
|
if (cyclicACMIPatch().updated())
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "cyclicACMIFvPatch::updateAreas() : updating fv areas for "
|
Pout<< "cyclicACMIFvPatch::updateAreas() : updating fv areas for "
|
||||||
<< name() << " and " << this->nonOverlapPatch().name()
|
<< name() << " and " << nonOverlapFvPatch().name()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,58 +55,49 @@ void Foam::cyclicACMIFvPatch::updateAreas() const
|
|||||||
const_cast<scalarField&>(magSf()) = mag(patch().faceAreas());
|
const_cast<scalarField&>(magSf()) = mag(patch().faceAreas());
|
||||||
|
|
||||||
// owner non-overlapping
|
// owner non-overlapping
|
||||||
const fvPatch& nonOverlapPatch = this->nonOverlapPatch();
|
const fvPatch& nonOverlapPatch = nonOverlapFvPatch();
|
||||||
const_cast<vectorField&>(nonOverlapPatch.Sf()) =
|
const_cast<vectorField&>(nonOverlapPatch.Sf()) =
|
||||||
nonOverlapPatch.patch().faceAreas();
|
nonOverlapPatch.patch().faceAreas();
|
||||||
const_cast<scalarField&>(nonOverlapPatch.magSf()) =
|
const_cast<scalarField&>(nonOverlapPatch.magSf()) =
|
||||||
mag(nonOverlapPatch.patch().faceAreas());
|
mag(nonOverlapPatch.patch().faceAreas());
|
||||||
|
|
||||||
// neighbour couple
|
// neighbour couple
|
||||||
const cyclicACMIFvPatch& nbrACMI = neighbPatch();
|
const cyclicACMIFvPatch& nbrACMI = neighbFvPatch();
|
||||||
const_cast<vectorField&>(nbrACMI.Sf()) =
|
const_cast<vectorField&>(nbrACMI.Sf()) =
|
||||||
nbrACMI.patch().faceAreas();
|
nbrACMI.patch().faceAreas();
|
||||||
const_cast<scalarField&>(nbrACMI.magSf()) =
|
const_cast<scalarField&>(nbrACMI.magSf()) =
|
||||||
mag(nbrACMI.patch().faceAreas());
|
mag(nbrACMI.patch().faceAreas());
|
||||||
|
|
||||||
// neighbour non-overlapping
|
// neighbour non-overlapping
|
||||||
const fvPatch& nbrNonOverlapPatch = nbrACMI.nonOverlapPatch();
|
const fvPatch& nbrNonOverlapPatch = nbrACMI.nonOverlapFvPatch();
|
||||||
const_cast<vectorField&>(nbrNonOverlapPatch.Sf()) =
|
const_cast<vectorField&>(nbrNonOverlapPatch.Sf()) =
|
||||||
nbrNonOverlapPatch.patch().faceAreas();
|
nbrNonOverlapPatch.patch().faceAreas();
|
||||||
const_cast<scalarField&>(nbrNonOverlapPatch.magSf()) =
|
const_cast<scalarField&>(nbrNonOverlapPatch.magSf()) =
|
||||||
mag(nbrNonOverlapPatch.patch().faceAreas());
|
mag(nbrNonOverlapPatch.patch().faceAreas());
|
||||||
|
|
||||||
// set the updated flag
|
// set the updated flag
|
||||||
cyclicACMIPolyPatch_.setUpdated(false);
|
cyclicACMIPatch().setUpdated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::cyclicACMIFvPatch::makeWeights(scalarField& w) const
|
void Foam::cyclicACMIFvPatch::makeWeights(scalarField& w) const
|
||||||
{
|
{
|
||||||
if (coupled())
|
if (coupled())
|
||||||
{
|
{
|
||||||
const cyclicACMIFvPatch& nbrPatch = neighbFvPatch();
|
|
||||||
const scalarField deltas(nf() & coupledFvPatch::delta());
|
|
||||||
|
|
||||||
// These deltas are of the cyclic part alone - they are
|
// These deltas are of the cyclic part alone - they are
|
||||||
// not affected by the amount of overlap with the nonOverlapPatch
|
// not affected by the amount of overlap with the nonOverlapPatch
|
||||||
scalarField nbrDeltas
|
const scalarField deltan(this->deltan());
|
||||||
(
|
const scalarField nbrDeltan(this->nbrDeltan());
|
||||||
interpolate
|
|
||||||
(
|
|
||||||
nbrPatch.nf() & nbrPatch.coupledFvPatch::delta()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalar tol = cyclicACMIPolyPatch::tolerance();
|
forAll(deltan, facei)
|
||||||
|
|
||||||
|
|
||||||
forAll(deltas, facei)
|
|
||||||
{
|
{
|
||||||
scalar di = deltas[facei];
|
scalar di = deltan[facei];
|
||||||
scalar dni = nbrDeltas[facei];
|
scalar dni = nbrDeltan[facei];
|
||||||
|
|
||||||
if (dni < tol)
|
if (dni < cyclicACMIPolyPatch::tolerance())
|
||||||
{
|
{
|
||||||
// Avoid zero weights on disconnected faces. This value
|
// Avoid zero weights on disconnected faces. This value
|
||||||
// will be weighted with the (zero) face area so will not
|
// will be weighted with the (zero) face area so will not
|
||||||
@ -127,76 +118,4 @@ void Foam::cyclicACMIFvPatch::makeWeights(scalarField& w) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::cyclicACMIFvPatch::coupled() const
|
|
||||||
{
|
|
||||||
return Pstream::parRun() || (this->size() && neighbFvPatch().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::cyclicACMIFvPatch::delta() const
|
|
||||||
{
|
|
||||||
if (coupled())
|
|
||||||
{
|
|
||||||
const cyclicACMIFvPatch& nbrPatch = neighbFvPatch();
|
|
||||||
|
|
||||||
const vectorField patchD(coupledFvPatch::delta());
|
|
||||||
|
|
||||||
vectorField nbrPatchD(interpolate(nbrPatch.coupledFvPatch::delta()));
|
|
||||||
|
|
||||||
|
|
||||||
tmp<vectorField> tpdv(new vectorField(patchD.size()));
|
|
||||||
vectorField& pdv = tpdv.ref();
|
|
||||||
|
|
||||||
// do the transformation if necessary
|
|
||||||
if (parallel())
|
|
||||||
{
|
|
||||||
forAll(patchD, facei)
|
|
||||||
{
|
|
||||||
const vector& ddi = patchD[facei];
|
|
||||||
const vector& dni = nbrPatchD[facei];
|
|
||||||
|
|
||||||
pdv[facei] = ddi - dni;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(patchD, facei)
|
|
||||||
{
|
|
||||||
const vector& ddi = patchD[facei];
|
|
||||||
const vector& dni = nbrPatchD[facei];
|
|
||||||
|
|
||||||
pdv[facei] = ddi - transform(forwardT()[0], dni);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tpdv;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return coupledFvPatch::delta();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::labelField> Foam::cyclicACMIFvPatch::interfaceInternalField
|
|
||||||
(
|
|
||||||
const labelUList& internalData
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return patchInternalField(internalData);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::labelField> Foam::cyclicACMIFvPatch::internalFieldTransfer
|
|
||||||
(
|
|
||||||
const Pstream::commsTypes commsType,
|
|
||||||
const labelUList& iF
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return neighbFvPatch().patchInternalField(iF);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -35,10 +35,8 @@ SourceFiles
|
|||||||
#ifndef cyclicACMIFvPatch_H
|
#ifndef cyclicACMIFvPatch_H
|
||||||
#define cyclicACMIFvPatch_H
|
#define cyclicACMIFvPatch_H
|
||||||
|
|
||||||
#include "coupledFvPatch.H"
|
#include "cyclicAMIFvPatch.H"
|
||||||
#include "cyclicACMILduInterface.H"
|
|
||||||
#include "cyclicACMIPolyPatch.H"
|
#include "cyclicACMIPolyPatch.H"
|
||||||
#include "fvBoundaryMesh.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -51,23 +49,22 @@ namespace Foam
|
|||||||
|
|
||||||
class cyclicACMIFvPatch
|
class cyclicACMIFvPatch
|
||||||
:
|
:
|
||||||
public coupledFvPatch,
|
public cyclicAMIFvPatch
|
||||||
public cyclicACMILduInterface
|
|
||||||
{
|
{
|
||||||
// Private data
|
private:
|
||||||
|
|
||||||
const cyclicACMIPolyPatch& cyclicACMIPolyPatch_;
|
// Private member functions
|
||||||
|
|
||||||
|
//- Update the patch areas after AMI update
|
||||||
|
void updateAreas() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Member functions
|
// Protected Member functions
|
||||||
|
|
||||||
//- Update the patch areas after AMI update
|
|
||||||
void updateAreas() const;
|
|
||||||
|
|
||||||
//- Make patch weighting factors
|
//- Make patch weighting factors
|
||||||
void makeWeights(scalarField&) const;
|
virtual void makeWeights(scalarField&) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -81,9 +78,7 @@ public:
|
|||||||
//- Construct from polyPatch
|
//- Construct from polyPatch
|
||||||
cyclicACMIFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
|
cyclicACMIFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
|
||||||
:
|
:
|
||||||
coupledFvPatch(patch, bm),
|
cyclicAMIFvPatch(patch, bm)
|
||||||
cyclicACMILduInterface(),
|
|
||||||
cyclicACMIPolyPatch_(refCast<const cyclicACMIPolyPatch>(patch))
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -91,49 +86,11 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return local reference cast into the cyclic patch
|
|
||||||
const cyclicACMIPolyPatch& cyclicACMIPatch() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPolyPatch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return neighbour
|
|
||||||
virtual label neighbPatchID() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPolyPatch_.neighbPatchID();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool owner() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPolyPatch_.owner();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return neighbour fvPatch
|
|
||||||
virtual const cyclicACMIFvPatch& neighbPatch() const
|
|
||||||
{
|
|
||||||
return refCast<const cyclicACMIFvPatch>
|
|
||||||
(
|
|
||||||
this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return neighbour
|
|
||||||
virtual label nonOverlapPatchID() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPolyPatch_.nonOverlapPatchID();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return non-overlapping fvPatch
|
|
||||||
virtual const fvPatch& nonOverlapPatch() const
|
|
||||||
{
|
|
||||||
return this->boundaryMesh()[nonOverlapPatchID()];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return a reference to the AMI interpolators
|
//- Return a reference to the AMI interpolators
|
||||||
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
|
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
|
||||||
{
|
{
|
||||||
const PtrList<AMIPatchToPatchInterpolation>& AMIs =
|
const PtrList<AMIPatchToPatchInterpolation>& AMIs =
|
||||||
cyclicACMIPolyPatch_.AMIs();
|
cyclicAMIFvPatch::AMIs();
|
||||||
|
|
||||||
updateAreas();
|
updateAreas();
|
||||||
|
|
||||||
@ -144,89 +101,36 @@ public:
|
|||||||
virtual const List<vectorTensorTransform>& AMITransforms() const
|
virtual const List<vectorTensorTransform>& AMITransforms() const
|
||||||
{
|
{
|
||||||
const List<vectorTensorTransform>& AMITransforms =
|
const List<vectorTensorTransform>& AMITransforms =
|
||||||
cyclicACMIPolyPatch_.AMITransforms();
|
cyclicAMIFvPatch::AMITransforms();
|
||||||
|
|
||||||
updateAreas();
|
updateAreas();
|
||||||
|
|
||||||
return AMITransforms;
|
return AMITransforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Are the cyclic planes parallel
|
//- Return the poly patch
|
||||||
virtual bool parallel() const
|
const cyclicACMIPolyPatch& cyclicACMIPatch() const
|
||||||
{
|
{
|
||||||
return cyclicACMIPolyPatch_.parallel();
|
return refCast<const cyclicACMIPolyPatch>(this->patch());
|
||||||
}
|
|
||||||
|
|
||||||
//- Return face transformation tensor
|
|
||||||
virtual const tensorField& forwardT() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPolyPatch_.forwardT();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return neighbour-cell transformation tensor
|
|
||||||
virtual const tensorField& reverseT() const
|
|
||||||
{
|
|
||||||
return cyclicACMIPolyPatch_.reverseT();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the neighbour patch
|
||||||
const cyclicACMIFvPatch& neighbFvPatch() const
|
const cyclicACMIFvPatch& neighbFvPatch() const
|
||||||
{
|
{
|
||||||
return refCast<const cyclicACMIFvPatch>
|
return refCast<const cyclicACMIFvPatch>
|
||||||
(
|
(
|
||||||
this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
|
this->boundaryMesh()[this->cyclicAMIPatch().neighbPatchID()]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if this patch is coupled. This is equivalent
|
//- Return the non-overlap patch
|
||||||
// to the coupledPolyPatch::coupled() if parallel running or
|
const fvPatch& nonOverlapFvPatch() const
|
||||||
// both sides present, false otherwise
|
|
||||||
virtual bool coupled() const;
|
|
||||||
|
|
||||||
//- Return delta (P to N) vectors across coupled patch
|
|
||||||
virtual tmp<vectorField> delta() const;
|
|
||||||
|
|
||||||
//- Interpolate (make sure to have uptodate areas)
|
|
||||||
template<class Type>
|
|
||||||
tmp<Field<Type>> interpolate
|
|
||||||
(
|
|
||||||
const Field<Type>& fld
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
updateAreas();
|
return this->boundaryMesh()
|
||||||
|
[
|
||||||
return
|
cyclicACMIPatch().nonOverlapPatchID()
|
||||||
cyclicACMIPolyPatch_.cyclicAMIPolyPatch::interpolate
|
];
|
||||||
(
|
|
||||||
fld
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Interpolate (make sure to have uptodate areas)
|
|
||||||
template<class Type>
|
|
||||||
tmp<Field<Type>> interpolate
|
|
||||||
(
|
|
||||||
const tmp<Field<Type>>& tfld
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return interpolate(tfld());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Interface transfer functions
|
|
||||||
|
|
||||||
//- Return the values of the given internal data adjacent to
|
|
||||||
// the interface as a field
|
|
||||||
virtual tmp<labelField> interfaceInternalField
|
|
||||||
(
|
|
||||||
const labelUList& internalData
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Return neighbour field
|
|
||||||
virtual tmp<labelField> internalFieldTransfer
|
|
||||||
(
|
|
||||||
const Pstream::commsTypes commsType,
|
|
||||||
const labelUList& internalData
|
|
||||||
) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -37,26 +37,24 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::cyclicAMIFvPatch::coupled() const
|
Foam::tmp<Foam::scalarField> Foam::cyclicAMIFvPatch::deltan() const
|
||||||
{
|
{
|
||||||
return Pstream::parRun() || (this->size() && neighbFvPatch().size());
|
return nf() & coupledFvPatch::delta();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
|
Foam::tmp<Foam::scalarField> Foam::cyclicAMIFvPatch::nbrDeltan() const
|
||||||
{
|
{
|
||||||
if (coupled())
|
if (coupled())
|
||||||
{
|
{
|
||||||
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
||||||
|
|
||||||
const scalarField deltas(nf() & coupledFvPatch::delta());
|
tmp<scalarField> tnbrDeltan;
|
||||||
|
|
||||||
tmp<scalarField> tnbrDeltas;
|
|
||||||
if (applyLowWeightCorrection())
|
if (applyLowWeightCorrection())
|
||||||
{
|
{
|
||||||
tnbrDeltas =
|
tnbrDeltan =
|
||||||
interpolate
|
interpolate
|
||||||
(
|
(
|
||||||
nbrPatch.nf() & nbrPatch.coupledFvPatch::delta(),
|
nbrPatch.nf() & nbrPatch.coupledFvPatch::delta(),
|
||||||
@ -65,16 +63,30 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tnbrDeltas =
|
tnbrDeltan =
|
||||||
interpolate(nbrPatch.nf() & nbrPatch.coupledFvPatch::delta());
|
interpolate(nbrPatch.nf() & nbrPatch.coupledFvPatch::delta());
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarField& nbrDeltas = tnbrDeltas();
|
return tnbrDeltan;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<scalarField>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
forAll(deltas, facei)
|
|
||||||
|
void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
|
||||||
|
{
|
||||||
|
if (coupled())
|
||||||
|
{
|
||||||
|
const scalarField deltan(this->deltan());
|
||||||
|
const scalarField nbrDeltan(this->nbrDeltan());
|
||||||
|
|
||||||
|
forAll(deltan, facei)
|
||||||
{
|
{
|
||||||
scalar di = deltas[facei];
|
scalar di = deltan[facei];
|
||||||
scalar dni = nbrDeltas[facei];
|
scalar dni = nbrDeltan[facei];
|
||||||
|
|
||||||
w[facei] = dni/(di + dni);
|
w[facei] = dni/(di + dni);
|
||||||
}
|
}
|
||||||
@ -87,6 +99,14 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::cyclicAMIFvPatch::coupled() const
|
||||||
|
{
|
||||||
|
return Pstream::parRun() || (this->size() && neighbFvPatch().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
|
Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
|
||||||
{
|
{
|
||||||
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
||||||
|
|||||||
@ -63,8 +63,14 @@ protected:
|
|||||||
|
|
||||||
// Protected Member functions
|
// Protected Member functions
|
||||||
|
|
||||||
|
//- Return the patch-normal component of the deltas
|
||||||
|
tmp<scalarField> deltan() const;
|
||||||
|
|
||||||
|
//- Return the neighbour patch-normal component of the deltas
|
||||||
|
tmp<scalarField> nbrDeltan() const;
|
||||||
|
|
||||||
//- Make patch weighting factors
|
//- Make patch weighting factors
|
||||||
void makeWeights(scalarField&) const;
|
virtual void makeWeights(scalarField&) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -94,18 +100,19 @@ public:
|
|||||||
return cyclicAMIPolyPatch_;
|
return cyclicAMIPolyPatch_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return neighbour
|
//- Return the neighbour patch ID
|
||||||
virtual label neighbPatchID() const
|
virtual label neighbPatchID() const
|
||||||
{
|
{
|
||||||
return cyclicAMIPolyPatch_.neighbPatchID();
|
return cyclicAMIPolyPatch_.neighbPatchID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Is this side the owner?
|
||||||
virtual bool owner() const
|
virtual bool owner() const
|
||||||
{
|
{
|
||||||
return cyclicAMIPolyPatch_.owner();
|
return cyclicAMIPolyPatch_.owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return processor number
|
//- Return the neighbour patch
|
||||||
virtual const cyclicAMIFvPatch& neighbPatch() const
|
virtual const cyclicAMIFvPatch& neighbPatch() const
|
||||||
{
|
{
|
||||||
return refCast<const cyclicAMIFvPatch>
|
return refCast<const cyclicAMIFvPatch>
|
||||||
|
|||||||
Reference in New Issue
Block a user