mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: lerp for patch/neighbour weights
This commit is contained in:
@ -130,8 +130,12 @@ void Foam::coupledFaPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
{
|
||||
Field<Type>::operator=
|
||||
(
|
||||
this->patch().weights()*this->patchInternalField()
|
||||
+ (1.0 - this->patch().weights())*patchNeighbourField()
|
||||
lerp
|
||||
(
|
||||
this->patchNeighbourField(),
|
||||
this->patchInternalField(),
|
||||
this->patch().weights()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ public:
|
||||
scalar phict = 1 - 0.5*gradf/gradcf;
|
||||
scalar limiter = min(max(phict/k_, 0), 1);
|
||||
|
||||
return limiter*cdWeight + (1 - limiter)*udWeight;
|
||||
return lerp(udWeight, cdWeight, limiter);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -139,8 +139,12 @@ void Foam::coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
|
||||
Field<Type>::operator=
|
||||
(
|
||||
this->patch().weights()*this->patchInternalField()
|
||||
+ (1.0 - this->patch().weights())*this->patchNeighbourField()
|
||||
lerp
|
||||
(
|
||||
this->patchNeighbourField(),
|
||||
this->patchInternalField(),
|
||||
this->patch().weights()
|
||||
)
|
||||
);
|
||||
|
||||
fvPatchField<Type>::evaluate();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -264,6 +264,9 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
|
||||
|
||||
for (label fi=0; fi<P.size(); fi++)
|
||||
{
|
||||
// Same as:
|
||||
// sfi[fi] = Sfi[fi] & lerp(vfi[N[fi]], vfi[P[fi]], lambda[fi]);
|
||||
// but maybe the compiler notices the fused multiply add form
|
||||
sfi[fi] = Sfi[fi] & (lambda[fi]*(vfi[P[fi]] - vfi[N[fi]]) + vfi[N[fi]]);
|
||||
}
|
||||
|
||||
@ -282,9 +285,11 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
|
||||
{
|
||||
psf =
|
||||
pSf
|
||||
& (
|
||||
pLambda*vf.boundaryField()[pi].patchInternalField()
|
||||
+ (1.0 - pLambda)*vf.boundaryField()[pi].patchNeighbourField()
|
||||
& lerp
|
||||
(
|
||||
vf.boundaryField()[pi].patchNeighbourField(),
|
||||
vf.boundaryField()[pi].patchInternalField(),
|
||||
pLambda
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -111,11 +111,12 @@ Foam::isoSurfacePoint::adaptPatchFields
|
||||
sliceFldBf[patchi]
|
||||
);
|
||||
|
||||
const scalarField& w = mesh.weights().boundaryField()[patchi];
|
||||
|
||||
tmp<Field<Type>> f =
|
||||
w*pfld.patchInternalField()
|
||||
+ (1.0-w)*pfld.patchNeighbourField();
|
||||
tmp<Field<Type>> f = lerp
|
||||
(
|
||||
pfld.patchNeighbourField(),
|
||||
pfld.patchInternalField(),
|
||||
mesh.weights().boundaryField()[patchi]
|
||||
);
|
||||
|
||||
bitSet isCollocated
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user