BUG: zeroFixedValue pointPatch not set correctly (fixes #2807)

This commit is contained in:
Mark Olesen
2023-06-19 16:54:53 +02:00
parent 34f12219bd
commit e54ead28e8
2 changed files with 23 additions and 37 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,43 +28,35 @@ License
#include "zeroFixedValuePointPatchField.H" #include "zeroFixedValuePointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
zeroFixedValuePointPatchField<Type>:: Foam::zeroFixedValuePointPatchField<Type>::zeroFixedValuePointPatchField
zeroFixedValuePointPatchField
( (
const pointPatch& p, const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF const DimensionedField<Type, pointMesh>& iF
) )
: :
fixedValuePointPatchField<Type>(p, iF) // Field is zero
fixedValuePointPatchField<Type>(p, iF, Type(Zero))
{} {}
template<class Type> template<class Type>
zeroFixedValuePointPatchField<Type>:: Foam::zeroFixedValuePointPatchField<Type>::zeroFixedValuePointPatchField
zeroFixedValuePointPatchField
( (
const pointPatch& p, const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF, const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict const dictionary& dict
) )
: :
fixedValuePointPatchField<Type>(p, iF, dict, false) // Field is zero
{ fixedValuePointPatchField<Type>(p, iF, Type(Zero))
fixedValuePointPatchField<Type>::operator=(Type(Zero)); {}
}
template<class Type> template<class Type>
zeroFixedValuePointPatchField<Type>:: Foam::zeroFixedValuePointPatchField<Type>::zeroFixedValuePointPatchField
zeroFixedValuePointPatchField
( (
const zeroFixedValuePointPatchField<Type>& ptf, const zeroFixedValuePointPatchField<Type>& ptf,
const pointPatch& p, const pointPatch& p,
@ -71,27 +64,26 @@ zeroFixedValuePointPatchField
const pointPatchFieldMapper& mapper const pointPatchFieldMapper& mapper
) )
: :
fixedValuePointPatchField<Type>(ptf, p, iF, mapper) // Field is zero : no mapping needed
{ fixedValuePointPatchField<Type>(p, iF, Type(Zero))
// For safety re-evaluate {}
fixedValuePointPatchField<Type>::operator=(Type(Zero));
}
template<class Type> template<class Type>
zeroFixedValuePointPatchField<Type>:: Foam::zeroFixedValuePointPatchField<Type>::zeroFixedValuePointPatchField
zeroFixedValuePointPatchField
( (
const zeroFixedValuePointPatchField<Type>& ptf const zeroFixedValuePointPatchField<Type>& ptf
) )
: :
fixedValuePointPatchField<Type>(ptf) fixedValuePointPatchField<Type>(ptf)
{} {
// Field is zero. For safety, re-assign
valuePointPatchField<Type>::operator=(Type(Zero));
}
template<class Type> template<class Type>
zeroFixedValuePointPatchField<Type>:: Foam::zeroFixedValuePointPatchField<Type>::zeroFixedValuePointPatchField
zeroFixedValuePointPatchField
( (
const zeroFixedValuePointPatchField<Type>& ptf, const zeroFixedValuePointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF const DimensionedField<Type, pointMesh>& iF
@ -99,13 +91,9 @@ zeroFixedValuePointPatchField
: :
fixedValuePointPatchField<Type>(ptf, iF) fixedValuePointPatchField<Type>(ptf, iF)
{ {
// For safety re-evaluate // Field is zero. For safety, re-assign
fixedValuePointPatchField<Type>::operator=(Type(Zero)); valuePointPatchField<Type>::operator=(Type(Zero));
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef zeroFixedValuePointPatchField_H #ifndef Foam_zeroFixedValuePointPatchField_H
#define zeroFixedValuePointPatchField_H #define Foam_zeroFixedValuePointPatchField_H
#include "fixedValuePointPatchField.H" #include "fixedValuePointPatchField.H"
@ -61,7 +61,6 @@ class zeroFixedValuePointPatchField
: :
public fixedValuePointPatchField<Type> public fixedValuePointPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -135,7 +134,6 @@ public:
) )
); );
} }
}; };