diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H index d28e884605..eebe511d71 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H @@ -117,7 +117,7 @@ public: // Member functions - //- Constraint handling + // Constraint handling //- Return the constraint type this pointPatchField implements virtual const word& constraintType() const @@ -125,12 +125,17 @@ public: return cyclicPointPatch::typeName; } - //- Cyclic coupled interface functions + + // Cyclic coupled interface functions //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index 6fa9bf6cac..2c07dac7ca 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -125,7 +125,7 @@ public: //- Return true if running parallel virtual bool coupled() const { - return Pstream::parRun(); + return UPstream::parRun(); } //- Does the patch field perform the transformation @@ -133,7 +133,7 @@ public: { return ( - pTraits::rank + is_rotational_vectorspace_v && !procPatch_.procPolyPatch().parallel() ); } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H index 147fd58cf9..c660b8299a 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H @@ -133,7 +133,7 @@ public: //- Return true if running parallel virtual bool coupled() const { - return Pstream::parRun(); + return UPstream::parRun(); } //- Does the patch field perform the transformation @@ -141,7 +141,7 @@ public: { return ( - pTraits::rank + is_rotational_vectorspace_v && !procPatch_.procPolyPatch().parallel() ); } diff --git a/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchField.C index 3a808480e8..3cf2d45348 100644 --- a/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchField.C @@ -141,9 +141,20 @@ template Foam::tmp> Foam::basicSymmetryFaPatchField::snGradTransformDiag() const { - tmp diag(cmptMag(this->patch().edgeNormals())); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + // FatalErrorInFunction + // << "Should not be called for this type" + // << ::Foam::abort(FatalError); + return tmp>::New(this->size(), Foam::zero{}); + } + else + { + tmp diag(cmptMag(this->patch().edgeNormals())); - return transformFieldMask(pow::rank>(diag)); + return transformFieldMask(pow::rank>(diag)); + } } diff --git a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H index ad4888466a..0449a8e60e 100644 --- a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H @@ -231,6 +231,9 @@ public: const Pstream::commsTypes commsType ) const = 0; + + // Other + //- Write virtual void write(Ostream&) const; }; diff --git a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchField.C index 247c8c9754..7b968ec17e 100644 --- a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,9 +87,9 @@ Foam::transformFaPatchField::valueInternalCoeffs const tmp& ) const { - // OR (!is_rotational_vectorspace_v) - if constexpr (std::is_arithmetic_v) + if constexpr (!is_rotational_vectorspace_v) { + // Rotational-invariant type return tmp>::New(this->size(), pTraits::one); } else @@ -119,9 +120,9 @@ template Foam::tmp> Foam::transformFaPatchField::gradientInternalCoeffs() const { - // OR (!is_rotational_vectorspace_v) - if constexpr (std::is_arithmetic_v) + if constexpr (!is_rotational_vectorspace_v) { + // Rotational-invariant type return tmp>::New(this->size(), Foam::zero{}); } else diff --git a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H index fd57164c22..19d1881849 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H @@ -183,7 +183,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H index b25337db04..c774ead515 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H @@ -287,7 +287,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !procPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !procPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C index 9988f59f1a..1b9e88f380 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -155,25 +156,36 @@ template Foam::tmp> Foam::wedgeFaPatchField::snGradTransformDiag() const { - const auto& rot = refCast(this->patch()).faceT(); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + // FatalErrorInFunction + // << "Should not be called for this type" + // << ::Foam::abort(FatalError); + return tmp>::New(this->size(), Foam::zero{}); + } + else + { + const auto& rot = refCast(this->patch()).faceT(); - const vector diagV = 0.5*(I - rot).diag(); + const vector diag = 0.5*(I - rot).diag(); - return tmp>::New - ( - this->size(), - transformMask + return tmp>::New ( - pow + this->size(), + transformMask ( - diagV, - pTraits - < - typename powProduct::rank>::type - >::zero + pow + ( + diag, + pTraits + < + typename powProduct::rank>::type + >::zero + ) ) - ) - ); + ); + } } diff --git a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.H b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.H index a1e33ce9a0..a71a1fe418 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.H @@ -114,22 +114,19 @@ public: } - // Member functions + // Member Functions - // Evaluation functions + //- Return gradient at boundary + virtual tmp> snGrad() const; - //- Return gradient at boundary - virtual tmp> snGrad() const; + //- Evaluate the patch field + virtual void evaluate + ( + const Pstream::commsTypes commsType=Pstream::commsTypes::buffered + ); - //- Evaluate the patch field - virtual void evaluate - ( - const Pstream::commsTypes commsType = Pstream::commsTypes::buffered - ); - - - //- Return face-gradient transform diagonal - virtual tmp> snGradTransformDiag() const; + //- Return face-gradient transform diagonal + virtual tmp> snGradTransformDiag() const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C index a4054b2b82..2991ae8703 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C @@ -141,9 +141,20 @@ template Foam::tmp> Foam::basicSymmetryFvPatchField::snGradTransformDiag() const { - tmp diag(cmptMag(this->patch().nf())); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + // FatalErrorInFunction + // << "Should not be called for this type" + // << ::Foam::abort(FatalError); + return tmp>::New(this->size(), Foam::zero{}); + } + else + { + tmp diag(cmptMag(this->patch().nf())); - return transformFieldMask(pow::rank>(diag)); + return transformFieldMask(pow::rank>(diag)); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C index 1f23f5acc6..011dec6c37 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C @@ -179,25 +179,33 @@ template Foam::tmp> Foam::directionMixedFvPatchField::snGradTransformDiag() const { - vectorField diag(valueFraction_.size()); + // static_assert(!std::is_arithmetic_v, "direction-mixed with scalar??"); + // if constexpr (!is_rotational_vectorspace_v) + // { + // // Rotational-invariant type + // return tmp>::New(this->size(), Foam::zero{}); + // } - diag.replace - ( - vector::X, - sqrt(mag(valueFraction_.component(symmTensor::XX))) - ); - diag.replace - ( - vector::Y, - sqrt(mag(valueFraction_.component(symmTensor::YY))) - ); - diag.replace - ( - vector::Z, - sqrt(mag(valueFraction_.component(symmTensor::ZZ))) - ); + { + vectorField diag(valueFraction_.size()); - return transformFieldMask(pow::rank>(diag)); + std::transform + ( + valueFraction_.cbegin(), + valueFraction_.cend(), + diag.begin(), + + [](const symmTensor& t) + { + return vector + ( + sqrt(mag(t.xx())), sqrt(mag(t.yy())), sqrt(mag(t.zz())) + ); + } + ); + + return transformFieldMask(pow::rank>(diag)); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C index eab338b93f..408e683dbb 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -97,9 +98,9 @@ Foam::transformFvPatchField::valueInternalCoeffs const tmp& ) const { - // OR (!is_rotational_vectorspace_v) - if constexpr (std::is_arithmetic_v) + if constexpr (!is_rotational_vectorspace_v) { + // Rotational-invariant type return tmp>::New(this->size(), pTraits::one); } else @@ -130,9 +131,9 @@ template Foam::tmp> Foam::transformFvPatchField::gradientInternalCoeffs() const { - // OR (!is_rotational_vectorspace_v) - if constexpr (std::is_arithmetic_v) + if constexpr (!is_rotational_vectorspace_v) { + // Rotational-invariant type return tmp>::New(this->size(), Foam::zero{}); } else diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H index 047eb2b36b..590053bbb1 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H @@ -209,7 +209,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H index 3647bdd38e..d19975f48a 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.H @@ -333,7 +333,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicACMIPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicACMIPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H index a0ed730956..9afe8cf1c5 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H @@ -339,7 +339,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicAMIPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicAMIPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index ab926351c5..05fe1361b5 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -298,7 +298,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !procPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !procPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H index 8287cd4359..94a379ad6f 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H @@ -151,19 +151,21 @@ public: // Member Functions - // Access + //- Does the patch field perform the transformation + virtual bool doTransform() const + { + return + ( + is_rotational_vectorspace_v + && !procPatch_.parallel() + ); + } - //- Does the patch field perform the transformation - virtual bool doTransform() const - { - return (pTraits::rank && !procPatch_.parallel()); - } - - //- Return face transformation tensor - virtual const tensorField& forwardT() const - { - return procPatch_.forwardT(); - } + //- Return face transformation tensor + virtual const tensorField& forwardT() const + { + return procPatch_.forwardT(); + } }; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C index 485cd67afd..bbd40d45de 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C @@ -172,24 +172,35 @@ template Foam::tmp> Foam::symmetryPlaneFvPatchField::snGradTransformDiag() const { - const vector diag(cmptMag(symmetryPlanePatch_.n())); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + // FatalErrorInFunction + // << "Should not be called for this type" + // << ::Foam::abort(FatalError); + return tmp>::New(this->size(), Foam::zero{}); + } + else + { + const vector diag(cmptMag(symmetryPlanePatch_.n())); - return tmp>::New - ( - this->size(), - transformMask + return tmp>::New ( - //pow::rank>(diag) - pow + this->size(), + transformMask ( - diag, - pTraits - < - typename powProduct::rank>::type - >::zero + //pow::rank>(diag) + pow + ( + diag, + pTraits + < + typename powProduct::rank>::type + >::zero + ) ) - ) - ); + ); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C index 3508eff784..d3ff5800a6 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C @@ -170,25 +170,36 @@ template Foam::tmp> Foam::wedgeFvPatchField::snGradTransformDiag() const { - const auto& rot = refCast(this->patch()).cellT(); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + // FatalErrorInFunction + // << "Should not be called for this type" + // << ::Foam::abort(FatalError); + return tmp>::New(this->size(), Foam::zero{}); + } + else + { + const auto& rot = refCast(this->patch()).cellT(); - const vector diagV = 0.5*(I - rot).diag(); + const vector diag = 0.5*(I - rot).diag(); - return tmp>::New - ( - this->size(), - transformMask + return tmp>::New ( - pow - ( - diagV, - pTraits - < - typename powProduct::rank>::type - >::zero - ) - ) - ); + this->size(), + transformMask + ( + pow + ( + diag, + pTraits + < + typename powProduct::rank>::type + >::zero + ) + ) + ); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C index 32c993eaa1..81cf67c1ab 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C @@ -135,6 +135,12 @@ template Foam::tmp> Foam::fixedNormalSlipFvPatchField::snGrad() const { + static_assert + ( + is_rotational_vectorspace_v, + "normal-slip with vector, tensor only!" + ); + const vectorField nHat(this->patch().nf()); const Field pif(this->patchInternalField()); @@ -172,9 +178,22 @@ template Foam::tmp> Foam::fixedNormalSlipFvPatchField::snGradTransformDiag() const { - tmp diag(cmptMag(this->patch().nf())); + static_assert + ( + is_rotational_vectorspace_v, + "normal-slip with vector, tensor only!" + ); + // if constexpr (!is_rotational_vectorspace_v) + // { + // // Rotational-invariant type + // return tmp>::New(this->size(), Foam::zero{}); + // } - return transformFieldMask(pow::rank>(diag)); + { + tmp diag(cmptMag(this->patch().nf())); + + return transformFieldMask(pow::rank>(diag)); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C index b11935b557..abd50151c1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -142,17 +142,24 @@ template Foam::tmp> Foam::partialSlipFvPatchField::snGrad() const { - tmp nHat = this->patch().nf(); const Field pif(this->patchInternalField()); + tmp> rotated; + + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + rotated.cref(pif); + } + else + { + tmp nHat(this->patch().nf()); + rotated = transform(I - sqr(nHat), pif); + } + return ( - lerp - ( - transform(I - sqr(nHat), pif), - refValue_, - valueFraction_ - ) - pif + lerp(rotated, refValue_, valueFraction_) - pif )*this->patch().deltaCoeffs(); } @@ -168,16 +175,23 @@ void Foam::partialSlipFvPatchField::evaluate this->updateCoeffs(); } - tmp nHat = this->patch().nf(); + tmp> rotated; + + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type + rotated = this->patchInternalField(); + } + else + { + tmp nHat(this->patch().nf()); + rotated = transform(I - sqr(nHat), this->patchInternalField()); + } + Field::operator= ( - lerp - ( - transform(I - sqr(nHat), this->patchInternalField()), - refValue_, - valueFraction_ - ) + lerp(rotated, refValue_, valueFraction_) ); parent_bctype::evaluate(); @@ -188,12 +202,23 @@ template Foam::tmp> Foam::partialSlipFvPatchField::snGradTransformDiag() const { - tmp diag(cmptMag(this->patch().nf())); + // static_assert(!std::is_arithmetic_v, "partial-slip with scalar??"); + // if constexpr (!is_rotational_vectorspace_v) + // { + // // Rotational-invariant type + // return tmp>::New(this->size(), Foam::zero{}); + // } - return - valueFraction_*pTraits::one - + (1.0 - valueFraction_) - *transformFieldMask(pow::rank>(diag)); + { + tmp diag(cmptMag(this->patch().nf())); + + return + ( + valueFraction_*pTraits::one + + (1.0 - valueFraction_) + * transformFieldMask(pow::rank>(diag)) + ); + } } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H index 2dd4ed08e4..f534eecab4 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.H @@ -177,7 +177,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicACMIPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicACMIPatch_.parallel() + ); } //- Return face transformation tensor diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H index 35816cc5ac..871c600da1 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H @@ -161,7 +161,7 @@ public: } - // Member functions + // Member Functions // Constraint handling @@ -177,7 +177,11 @@ public: //- Does the patch field perform the transformation virtual bool doTransform() const { - return (pTraits::rank && !cyclicAMIPatch_.parallel()); + return + ( + is_rotational_vectorspace_v + && !cyclicAMIPatch_.parallel() + ); } //- Return face transformation tensor