/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2026 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 .
\*---------------------------------------------------------------------------*/
#include "coupledFvPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::coupledFvPatchField::coupledFvPatchField
(
const fvPatch& p,
const DimensionedField& iF
)
:
LduInterfaceField(refCast(p)),
fvPatchField(p, iF)
{}
template
Foam::coupledFvPatchField::coupledFvPatchField
(
const fvPatch& p,
const DimensionedField& iF,
const Field& f
)
:
LduInterfaceField(refCast(p)),
fvPatchField(p, iF, f)
{}
template
Foam::coupledFvPatchField::coupledFvPatchField
(
const fvPatch& p,
const DimensionedField& iF,
const dictionary& dict,
const bool valueRequired
)
:
LduInterfaceField(refCast(p)),
fvPatchField(p, iF, dict, valueRequired)
{}
template
Foam::coupledFvPatchField::coupledFvPatchField
(
const coupledFvPatchField& ptf,
const fvPatch& p,
const DimensionedField& iF,
const fieldMapper& mapper
)
:
LduInterfaceField(refCast(p)),
fvPatchField(ptf, p, iF, mapper, false)
{
mapper(*this, ptf, pTraits::nan);
}
template
Foam::coupledFvPatchField::coupledFvPatchField
(
const coupledFvPatchField& ptf,
const DimensionedField& iF
)
:
LduInterfaceField(refCast(ptf.patch())),
fvPatchField(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
void Foam::coupledFvPatchField::map
(
const fvPatchField& ptf,
const fieldMapper& mapper
)
{
mapper(*this, ptf, pTraits::nan);
}
template
Foam::tmp> Foam::coupledFvPatchField::snGrad
(
const scalarField& deltaCoeffs
) const
{
return deltaCoeffs*(patchNeighbourField() - patchInternalField());
}
template
void Foam::coupledFvPatchField::initEvaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
}
template
void Foam::coupledFvPatchField::evaluateNoUpdateCoeffs()
{
Field::operator=
(
patch().weights()*patchInternalField()
+ (1.0 - patch().weights())*patchNeighbourField()
);
}
template
void Foam::coupledFvPatchField::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
evaluateNoUpdateCoeffs();
fvPatchField::evaluate();
}
template
Foam::tmp>
Foam::coupledFvPatchField::valueInternalCoeffs
(
const tmp& w
) const
{
return Type(pTraits::one)*w;
}
template
Foam::tmp>
Foam::coupledFvPatchField::valueBoundaryCoeffs
(
const tmp& w
) const
{
return Type(pTraits::one)*(1.0 - w);
}
template
Foam::tmp>
Foam::coupledFvPatchField::gradientInternalCoeffs
(
const scalarField& deltaCoeffs
) const
{
return -Type(pTraits::one)*deltaCoeffs;
}
template
Foam::tmp>
Foam::coupledFvPatchField::gradientInternalCoeffs() const
{
NotImplemented;
return -Type(pTraits::one)*patch().deltaCoeffs();
}
template
Foam::tmp>
Foam::coupledFvPatchField::gradientBoundaryCoeffs
(
const scalarField& deltaCoeffs
) const
{
return -this->gradientInternalCoeffs(deltaCoeffs);
}
template
Foam::tmp>
Foam::coupledFvPatchField::gradientBoundaryCoeffs() const
{
NotImplemented;
return -this->gradientInternalCoeffs();
}
template
void Foam::coupledFvPatchField::write(Ostream& os) const
{
fvPatchField::write(os);
writeEntry(os, "value", *this);
}
// ************************************************************************* //