Implicit treatment of coupled boundary conditions

This commit is contained in:
Sergio Ferraris
2021-08-03 20:08:49 +00:00
committed by Andrew Heather
parent 11e0db96d3
commit 53af23b9fb
308 changed files with 12354 additions and 527 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,6 +49,7 @@ void Foam::cyclicFaPatch::calcTransforms()
{
if (size() > 0)
{
// const label sizeby2 = this->size()/2;
pointField half0Ctrs(size()/2);
pointField half1Ctrs(size()/2);
for (label i=0; i<size()/2; ++i)
@ -153,7 +155,7 @@ void Foam::cyclicFaPatch::makeWeights(scalarField& w) const
const scalarField& magL = magEdgeLengths();
const scalarField deltas(edgeNormals() & faPatch::delta());
label sizeby2 = deltas.size()/2;
const label sizeby2 = deltas.size()/2;
scalar maxMatchError = 0;
label errorEdge = -1;
@ -206,7 +208,7 @@ void Foam::cyclicFaPatch::makeWeights(scalarField& w) const
void Foam::cyclicFaPatch::makeDeltaCoeffs(scalarField& dc) const
{
const scalarField deltas(edgeNormals() & faPatch::delta());
label sizeby2 = deltas.size()/2;
const label sizeby2 = deltas.size()/2;
for (label edgei = 0; edgei < sizeby2; ++edgei)
{
@ -248,10 +250,10 @@ void Foam::cyclicFaPatch::movePoints(const pointField& p)
Foam::tmp<Foam::vectorField> Foam::cyclicFaPatch::delta() const
{
const vectorField patchD(faPatch::delta());
label sizeby2 = patchD.size()/2;
const label sizeby2 = patchD.size()/2;
tmp<vectorField> tpdv(new vectorField(patchD.size()));
vectorField& pdv = tpdv.ref();
auto tpdv = tmp<vectorField>::New(patchD.size());
auto& pdv = tpdv.ref();
// Do the transformation if necessary
if (parallel())
@ -290,16 +292,26 @@ Foam::tmp<Foam::labelField> Foam::cyclicFaPatch::interfaceInternalField
}
Foam::tmp<Foam::labelField> Foam::cyclicFaPatch::interfaceInternalField
(
const labelUList& internalData,
const labelUList& edgeFaces
) const
{
return patchInternalField(internalData, edgeFaces);
}
Foam::tmp<Foam::labelField> Foam::cyclicFaPatch::transfer
(
const Pstream::commsTypes,
const Pstream::commsTypes commsType,
const labelUList& interfaceData
) const
{
tmp<labelField> tpnf(new labelField(this->size()));
labelField& pnf = tpnf.ref();
auto tpnf = tmp<labelField>::New(this->size());
auto& pnf = tpnf.ref();
label sizeby2 = this->size()/2;
const label sizeby2 = this->size()/2;
for (label edgei=0; edgei<sizeby2; ++edgei)
{
@ -317,12 +329,21 @@ Foam::tmp<Foam::labelField> Foam::cyclicFaPatch::internalFieldTransfer
const labelUList& iF
) const
{
const labelUList& edgeCells = this->faceCells();
return internalFieldTransfer(commsType, iF, this->faceCells());
}
tmp<labelField> tpnf(new labelField(this->size()));
labelField& pnf = tpnf.ref();
label sizeby2 = this->size()/2;
Foam::tmp<Foam::labelField> Foam::cyclicFaPatch::internalFieldTransfer
(
const Pstream::commsTypes commsType,
const labelUList& iF,
const labelUList& edgeCells
) const
{
auto tpnf = tmp<labelField>::New(this->size());
auto& pnf = tpnf.ref();
const label sizeby2 = this->size()/2;
for (label edgei=0; edgei<sizeby2; ++edgei)
{

View File

@ -167,12 +167,22 @@ public:
// Interface transfer functions
//- Return the values of the given internal data adjacent to
// the interface as a field
//- the interface as a field
virtual tmp<labelField> interfaceInternalField
(
const labelUList& internalData
) const;
//- Return the values of the given internal data adjacent to
//- the interface as a field using edgeFace mapping
virtual tmp<labelField> interfaceInternalField
(
const labelUList& internalData,
const labelUList& edgeFaces
) const;
//- Transfer and return neighbour field
virtual tmp<labelField> transfer
(
@ -186,6 +196,15 @@ public:
const Pstream::commsTypes commsType,
const labelUList& internalData
) const;
//- Return neighbour field using edgeCells mapping
virtual tmp<labelField> internalFieldTransfer
(
const Pstream::commsTypes commsType,
const labelUList& internalData,
const labelUList& edgeCells
) const;
};

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,7 +78,6 @@ void Foam::processorFaPatch::makeNonGlobalPatchPoints() const
(
!Pstream::parRun()
|| !boundaryMesh().mesh()().globalData().nGlobalPoints()
// || !boundaryMesh().mesh().globalData().nGlobalPoints()
)
{
nonGlobalPatchPointsPtr_ = new labelList(nPoints());
@ -464,6 +464,16 @@ Foam::tmp<Foam::labelField> Foam::processorFaPatch::interfaceInternalField
}
Foam::tmp<Foam::labelField> Foam::processorFaPatch::interfaceInternalField
(
const labelUList& internalData,
const labelUList& edgeFaces
) const
{
return patchInternalField(internalData, edgeFaces);
}
void Foam::processorFaPatch::initTransfer
(
const Pstream::commsTypes commsType,
@ -504,6 +514,17 @@ Foam::tmp<Foam::labelField> Foam::processorFaPatch::internalFieldTransfer
}
Foam::tmp<Foam::labelField> Foam::processorFaPatch::internalFieldTransfer
(
const Pstream::commsTypes commsType,
const labelUList&,
const labelUList&
) const
{
return receive<label>(commsType, this->size());
}
void Foam::processorFaPatch::write(Ostream& os) const
{
faPatch::write(os);

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -264,12 +265,20 @@ public:
// Interface transfer functions
//- Return the values of the given internal data adjacent to
// the interface as a field
//- the interface as a field
virtual tmp<labelField> interfaceInternalField
(
const labelUList& internalData
) const;
//- Return the values of the given internal data adjacent to
//- the interface as a field using edgeFaces
virtual tmp<labelField> interfaceInternalField
(
const labelUList& internalData,
const labelUList& edgeFaces
) const;
//- Initialise interface data transfer
virtual void initTransfer
(
@ -298,8 +307,16 @@ public:
const labelUList& internalData
) const;
//- Return neighbour field using mapping
virtual tmp<labelField> internalFieldTransfer
(
const Pstream::commsTypes commsType,
const labelUList& internalData,
const labelUList& edgeCells
) const;
//- Write the patch data as a dictionary
virtual void write(Ostream&) const;
virtual void write(Ostream& os) const;
};

View File

@ -357,6 +357,15 @@ public:
template<class Type>
tmp<Field<Type>> patchInternalField(const UList<Type>&) const;
//- Return given internal field next to patch as patch field
// providing addressing
template<class Type>
tmp<Foam::Field<Type>> patchInternalField
(
const UList<Type>& f,
const labelUList& edgeFaces
) const;
//- Return the corresponding patchField of the named field
template<class GeometricField, class Type>
const typename GeometricField::Patch& patchField

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,10 +36,19 @@ Foam::tmp<Foam::Field<Type>> Foam::faPatch::patchInternalField
const UList<Type>& f
) const
{
tmp<Field<Type>> tpif (new Field<Type>(size()));
Field<Type>& pif = tpif.ref();
return patchInternalField(f, this->edgeFaces());
}
const labelUList& edgeFaces = this->edgeFaces();
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::faPatch::patchInternalField
(
const UList<Type>& f,
const labelUList& edgeFaces
) const
{
auto tpif = tmp<Field<Type>>::New(size());
auto& pif = tpif.ref();
forAll(pif, facei)
{