mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: replace processorFvPatchField specialization with 'if...' (#1304)
- only apply component-wise transformCoupleField for non-scalar types
This commit is contained in:
committed by
Andrew Heather
parent
c96a84e653
commit
83d26d19b5
@ -129,7 +129,6 @@ $(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C
|
|||||||
$(constraintFvPatchFields)/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C
|
$(constraintFvPatchFields)/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C
|
||||||
$(constraintFvPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatchFields.C
|
$(constraintFvPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatchFields.C
|
||||||
$(constraintFvPatchFields)/processor/processorFvPatchFields.C
|
$(constraintFvPatchFields)/processor/processorFvPatchFields.C
|
||||||
$(constraintFvPatchFields)/processor/processorFvPatchScalarField.C
|
|
||||||
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
|
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
|
||||||
$(constraintFvPatchFields)/symmetryPlane/symmetryPlaneFvPatchFields.C
|
$(constraintFvPatchFields)/symmetryPlane/symmetryPlaneFvPatchFields.C
|
||||||
$(constraintFvPatchFields)/symmetryPlane/symmetryPlaneFvPatchScalarField.C
|
$(constraintFvPatchFields)/symmetryPlane/symmetryPlaneFvPatchScalarField.C
|
||||||
|
|||||||
@ -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 |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
@ -402,11 +402,13 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
|
|||||||
// Recv finished so assume sending finished as well.
|
// Recv finished so assume sending finished as well.
|
||||||
outstandingSendRequest_ = -1;
|
outstandingSendRequest_ = -1;
|
||||||
outstandingRecvRequest_ = -1;
|
outstandingRecvRequest_ = -1;
|
||||||
|
|
||||||
// Consume straight from scalarReceiveBuf_
|
// Consume straight from scalarReceiveBuf_
|
||||||
|
|
||||||
// Transform according to the transformation tensor
|
if (!std::is_arithmetic<Type>::value)
|
||||||
|
{
|
||||||
|
// Transform non-scalar data according to the transformation tensor
|
||||||
transformCoupleField(scalarReceiveBuf_, cmpt);
|
transformCoupleField(scalarReceiveBuf_, cmpt);
|
||||||
|
}
|
||||||
|
|
||||||
// Multiply the field by coefficients and add into the result
|
// Multiply the field by coefficients and add into the result
|
||||||
this->addToInternalField(result, !add, coeffs, scalarReceiveBuf_);
|
this->addToInternalField(result, !add, coeffs, scalarReceiveBuf_);
|
||||||
@ -418,8 +420,11 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
|
|||||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Transform according to the transformation tensor
|
if (!std::is_arithmetic<Type>::value)
|
||||||
|
{
|
||||||
|
// Transform non-scalar data according to the transformation tensor
|
||||||
transformCoupleField(pnf, cmpt);
|
transformCoupleField(pnf, cmpt);
|
||||||
|
}
|
||||||
|
|
||||||
// Multiply the field by coefficients and add into the result
|
// Multiply the field by coefficients and add into the result
|
||||||
this->addToInternalField(result, !add, coeffs, pnf);
|
this->addToInternalField(result, !add, coeffs, pnf);
|
||||||
|
|||||||
@ -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 |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011 OpenFOAM Foundation
|
| Copyright (C) 2011 OpenFOAM Foundation
|
||||||
@ -28,7 +28,7 @@ License
|
|||||||
#ifndef processorFvPatchFields_H
|
#ifndef processorFvPatchFields_H
|
||||||
#define processorFvPatchFields_H
|
#define processorFvPatchFields_H
|
||||||
|
|
||||||
#include "processorFvPatchScalarField.H"
|
#include "processorFvPatchField.H"
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -1,146 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 "processorFvPatchScalarField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::processorFvPatchField<Foam::scalar>::initInterfaceMatrixUpdate
|
|
||||||
(
|
|
||||||
scalarField&,
|
|
||||||
const bool add,
|
|
||||||
const scalarField& psiInternal,
|
|
||||||
const scalarField&,
|
|
||||||
const direction,
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
this->patch().patchInternalField(psiInternal, scalarSendBuf_);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
commsType == Pstream::commsTypes::nonBlocking
|
|
||||||
&& !Pstream::floatTransfer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Fast path.
|
|
||||||
if (debug && !this->ready())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "On patch " << procPatch_.name()
|
|
||||||
<< " outstanding request."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
|
||||||
outstandingRecvRequest_ = UPstream::nRequests();
|
|
||||||
UIPstream::read
|
|
||||||
(
|
|
||||||
Pstream::commsTypes::nonBlocking,
|
|
||||||
procPatch_.neighbProcNo(),
|
|
||||||
reinterpret_cast<char*>(scalarReceiveBuf_.begin()),
|
|
||||||
scalarReceiveBuf_.byteSize(),
|
|
||||||
procPatch_.tag(),
|
|
||||||
procPatch_.comm()
|
|
||||||
);
|
|
||||||
|
|
||||||
outstandingSendRequest_ = UPstream::nRequests();
|
|
||||||
UOPstream::write
|
|
||||||
(
|
|
||||||
Pstream::commsTypes::nonBlocking,
|
|
||||||
procPatch_.neighbProcNo(),
|
|
||||||
reinterpret_cast<const char*>(scalarSendBuf_.begin()),
|
|
||||||
scalarSendBuf_.byteSize(),
|
|
||||||
procPatch_.tag(),
|
|
||||||
procPatch_.comm()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
procPatch_.compressedSend(commsType, scalarSendBuf_);
|
|
||||||
}
|
|
||||||
|
|
||||||
const_cast<processorFvPatchField<scalar>&>(*this).updatedMatrix() = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::processorFvPatchField<Foam::scalar>::updateInterfaceMatrix
|
|
||||||
(
|
|
||||||
scalarField& result,
|
|
||||||
const bool add,
|
|
||||||
const scalarField&,
|
|
||||||
const scalarField& coeffs,
|
|
||||||
const direction,
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (this->updatedMatrix())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
commsType == Pstream::commsTypes::nonBlocking
|
|
||||||
&& !Pstream::floatTransfer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Fast path.
|
|
||||||
if
|
|
||||||
(
|
|
||||||
outstandingRecvRequest_ >= 0
|
|
||||||
&& outstandingRecvRequest_ < Pstream::nRequests()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UPstream::waitRequest(outstandingRecvRequest_);
|
|
||||||
}
|
|
||||||
// Recv finished so assume sending finished as well.
|
|
||||||
outstandingSendRequest_ = -1;
|
|
||||||
outstandingRecvRequest_ = -1;
|
|
||||||
|
|
||||||
|
|
||||||
// Consume straight from scalarReceiveBuf_
|
|
||||||
this->addToInternalField(result, !add, coeffs, scalarReceiveBuf_);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scalarField pnf
|
|
||||||
(
|
|
||||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
|
||||||
);
|
|
||||||
|
|
||||||
this->addToInternalField(result, !add, coeffs, pnf);
|
|
||||||
}
|
|
||||||
|
|
||||||
const_cast<processorFvPatchField<scalar>&>(*this).updatedMatrix() = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd |
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
| Copyright (C) 2011-2012 OpenFOAM Foundation
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 processorFvPatchScalarField_H
|
|
||||||
#define processorFvPatchScalarField_H
|
|
||||||
|
|
||||||
#include "processorFvPatchField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
|
|
||||||
(
|
|
||||||
scalarField&,
|
|
||||||
const bool add,
|
|
||||||
const scalarField&,
|
|
||||||
const scalarField&,
|
|
||||||
const direction,
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void processorFvPatchField<scalar>::updateInterfaceMatrix
|
|
||||||
(
|
|
||||||
scalarField& result,
|
|
||||||
const bool add,
|
|
||||||
const scalarField&,
|
|
||||||
const scalarField& coeffs,
|
|
||||||
const direction,
|
|
||||||
const Pstream::commsTypes commsType
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Reference in New Issue
Block a user