diff --git a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.C index bcc81e72e7f6f94c4bee4cf0df2b833ca0144788..c90344dd19d9a8e21da43a45be835cb985e6422a 100644 --- a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.C @@ -93,6 +93,21 @@ Foam::mixedFaPatchField<Type>::mixedFaPatchField {} +template<class Type> +Foam::mixedFaPatchField<Type>::mixedFaPatchField +( + const faPatch& p, + const DimensionedField<Type, areaMesh>& iF, + const Foam::zero +) +: + faPatchField<Type>(p, iF), + refValue_(p.size(), Zero), + refGrad_(p.size(), Zero), + valueFraction_(p.size(), Zero) +{} + + template<class Type> Foam::mixedFaPatchField<Type>::mixedFaPatchField ( diff --git a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H index 5109e6492082d7994a85967bcf9a0b5dedcd5e9d..f4d0bdbab504c786df6fa6759d950a6fd5551b75 100644 --- a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H @@ -109,6 +109,15 @@ public: const DimensionedField<Type, areaMesh>& ); + //- Construct from patch and internal field, + //- initialise as zero-gradient + mixedFaPatchField + ( + const faPatch&, + const DimensionedField<Type, areaMesh>&, + const Foam::zero + ); + //- Construct from patch, internal field and dictionary mixedFaPatchField ( diff --git a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C index 82ee838495f353225b430395911112e0d0d7ca64..cf9c1dd88d3a97a4c2d857bf5ec9d319f1cef056 100644 --- a/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/uniformMixed/uniformMixedFaPatchField.C @@ -66,7 +66,8 @@ Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField const dictionary& dict ) : - mixedFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ), + // Bypass dict constructor, default initialise as zero-gradient + mixedFaPatchField<Type>(p, iF, Foam::zero{}), refValueFunc_ ( Function1<Type>::NewIfPresent @@ -87,6 +88,8 @@ Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField ), valueFractionFunc_(nullptr) { + faPatchFieldBase::readDict(dict); // Consistent with a dict constructor + if (refValueFunc_) { if (refGradFunc_) diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C index 80dd0a9718215b3aabce8a32ca51a4668b2461ec..812bd194716dc761490a356e964416eea093cc20 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C @@ -94,6 +94,22 @@ Foam::mixedFvPatchField<Type>::mixedFvPatchField {} +template<class Type> +Foam::mixedFvPatchField<Type>::mixedFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const Foam::zero +) +: + fvPatchField<Type>(p, iF), + refValue_(p.size(), Zero), + refGrad_(p.size(), Zero), + valueFraction_(p.size(), Zero), + source_(p.size(), Zero) +{} + + template<class Type> Foam::mixedFvPatchField<Type>::mixedFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H index 143df47f4fae3f990d03b0d052ecce55c8582ab7..7c43a6ca226d3dcfcf5ffd0db038fc061056ffcf 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H @@ -133,6 +133,15 @@ public: const DimensionedField<Type, volMesh>& ); + //- Construct from patch and internal field, + //- initialise as zero-gradient + mixedFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const Foam::zero + ); + //- Construct from patch, internal field and dictionary mixedFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C index da6886a505413ada61bab146a5208ba75ae24609..4249c7d443fa22dda13d8ae85c8d17552e647bd0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C @@ -61,8 +61,9 @@ Foam::mappedMixedFvPatchField<Type>::mappedMixedFvPatchField const dictionary& dict ) : - // Reading of mixed entries handled later... - mixedFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ), + // Bypass dictionary constructor (all reading handled later) + // but cannot use NO_READ since will still trigger an evaluate() + mixedFvPatchField<Type>(p, iF), mappedPatchFieldBase<Type> ( mappedFixedValueFvPatchField<Type>::mapper(p, iF), @@ -71,6 +72,8 @@ Foam::mappedMixedFvPatchField<Type>::mappedMixedFvPatchField ), weightFieldName_(dict.getOrDefault<word>("weightField", word::null)) { + fvPatchFieldBase::readDict(dict); // Consistent with a dict constructor + this->readValueEntry(dict, IOobjectOption::MUST_READ); if (this->readMixedEntries(dict)) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C index c73934f4ec1d718b60634c57a5fd7bd1db121491..ca2817148a9de9980dd15ba97a45c32db52c7306 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformMixed/uniformMixedFvPatchField.C @@ -66,7 +66,8 @@ Foam::uniformMixedFvPatchField<Type>::uniformMixedFvPatchField const dictionary& dict ) : - mixedFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ), + // Bypass dict constructor, default initialise as zero-gradient + mixedFvPatchField<Type>(p, iF, Foam::zero{}), refValueFunc_ ( PatchFunction1<Type>::NewIfPresent(p.patch(), "uniformValue", dict) @@ -77,6 +78,8 @@ Foam::uniformMixedFvPatchField<Type>::uniformMixedFvPatchField ), valueFractionFunc_(nullptr) { + fvPatchFieldBase::readDict(dict); // Consistent with a dict constructor + if (refValueFunc_) { if (refGradFunc_)