diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C index 238bb5d21ddde241b9d5bf52cbeae64a89eac39c..3bdfa9e6e965c7b05fcd23e44467a3fbf4b26040 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,9 +60,9 @@ cylindricalInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), centre_(ptf.centre_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_().clone().ptr()), - radialVelocity_(ptf.radialVelocity_().clone().ptr()), - rpm_(ptf.rpm_().clone().ptr()) + axialVelocity_(ptf.axialVelocity_, false), + radialVelocity_(ptf.radialVelocity_, false), + rpm_(ptf.rpm_, false) {} @@ -92,9 +92,9 @@ cylindricalInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf), centre_(ptf.centre_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_().clone().ptr()), - radialVelocity_(ptf.radialVelocity_().clone().ptr()), - rpm_(ptf.rpm_().clone().ptr()) + axialVelocity_(ptf.axialVelocity_, false), + radialVelocity_(ptf.radialVelocity_, false), + rpm_(ptf.rpm_, false) {} @@ -108,9 +108,9 @@ cylindricalInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, iF), centre_(ptf.centre_), axis_(ptf.axis_), - axialVelocity_(ptf.axialVelocity_().clone().ptr()), - radialVelocity_(ptf.radialVelocity_().clone().ptr()), - rpm_(ptf.rpm_().clone().ptr()) + axialVelocity_(ptf.axialVelocity_, false), + radialVelocity_(ptf.radialVelocity_, false), + rpm_(ptf.rpm_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index 936e702aa321cfec7e43968b4de3034e028b51bd..e3a9409b25eeee757a98fff270dd7c3d2fa18b53 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -44,57 +44,57 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( - const fixedFluxPressureFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper + const dictionary& dict ) : fixedGradientFvPatchScalarField(p, iF), curTimeIndex_(-1) { - patchType() = ptf.patchType(); - - // Map gradient. Set unmapped values and overwrite with mapped ptf - gradient() = 0.0; - gradient().map(ptf.gradient(), mapper); - - // Evaluate the value field from the gradient if the internal field is valid - if (notNull(iF) && iF.size()) + if (dict.found("value") && dict.found("gradient")) { - scalarField::operator= + fvPatchField<scalar>::operator= ( - //patchInternalField() + gradient()/patch().deltaCoeffs() - // ***HGW Hack to avoid the construction of mesh.deltaCoeffs - // which fails for AMI patches for some mapping operations - patchInternalField() + gradient()*(patch().nf() & patch().delta()) + scalarField("value", dict, p.size()) ); + gradient() = scalarField("gradient", dict, p.size()); + } + else + { + fvPatchField<scalar>::operator=(patchInternalField()); + gradient() = 0.0; } } Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField ( + const fixedFluxPressureFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict + const fvPatchFieldMapper& mapper ) : fixedGradientFvPatchScalarField(p, iF), curTimeIndex_(-1) { - if (dict.found("value") && dict.found("gradient")) + patchType() = ptf.patchType(); + + // Map gradient. Set unmapped values and overwrite with mapped ptf + gradient() = 0.0; + gradient().map(ptf.gradient(), mapper); + + // Evaluate the value field from the gradient if the internal field is valid + if (notNull(iF) && iF.size()) { - fvPatchField<scalar>::operator= + scalarField::operator= ( - scalarField("value", dict, p.size()) + //patchInternalField() + gradient()/patch().deltaCoeffs() + // ***HGW Hack to avoid the construction of mesh.deltaCoeffs + // which fails for AMI patches for some mapping operations + patchInternalField() + gradient()*(patch().nf() & patch().delta()) ); - gradient() = scalarField("gradient", dict, p.size()); - } - else - { - fvPatchField<scalar>::operator=(patchInternalField()); - gradient() = 0.0; } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index 0838108985ca4b5520812ba4e32fcb6640a2111a..7dc2d9497ba75e387cdd8a814bd0955b89867786 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -56,7 +56,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), - flowRate_(ptf.flowRate_().clone().ptr()), + flowRate_(ptf.flowRate_, false), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_) @@ -117,7 +117,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf), - flowRate_(ptf.flowRate_().clone().ptr()), + flowRate_(ptf.flowRate_, false), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_) @@ -132,7 +132,7 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(ptf, iF), - flowRate_(ptf.flowRate_().clone().ptr()), + flowRate_(ptf.flowRate_, false), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C index 42d52401d8701e17e4fabdfb6e4cca1c7a959e1c..715586a3691c69c5142b22b25073cefddea771dd 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,8 +74,8 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField fixedValueFvPatchField<Type>(ptf, p, iF, mapper), refValue_(ptf.refValue_, mapper), offset_(ptf.offset_), - amplitude_(ptf.amplitude_().clone().ptr()), - frequency_(ptf.frequency_().clone().ptr()), + amplitude_(ptf.amplitude_, false), + frequency_(ptf.frequency_, false), curTimeIndex_(-1) {} @@ -122,8 +122,8 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField fixedValueFvPatchField<Type>(ptf), refValue_(ptf.refValue_), offset_(ptf.offset_), - amplitude_(ptf.amplitude_().clone().ptr()), - frequency_(ptf.frequency_().clone().ptr()), + amplitude_(ptf.amplitude_, false), + frequency_(ptf.frequency_, false), curTimeIndex_(-1) {} @@ -138,8 +138,8 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField fixedValueFvPatchField<Type>(ptf, iF), refValue_(ptf.refValue_), offset_(ptf.offset_), - amplitude_(ptf.amplitude_().clone().ptr()), - frequency_(ptf.frequency_().clone().ptr()), + amplitude_(ptf.amplitude_, false), + frequency_(ptf.frequency_, false), curTimeIndex_(-1) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index 22b36b08447051e721eea0383cc7d74a7806f3f9..3a49f4a6800fdf50716e4269ad27a132c64caf22 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,7 +71,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper), - omega_(ptf.omega_().clone().ptr()) + omega_(ptf.omega_, false) { calcTangentialVelocity(); } @@ -99,7 +99,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(rppvf), - omega_(rppvf.omega_().clone().ptr()) + omega_(rppvf.omega_, false) { calcTangentialVelocity(); } @@ -113,7 +113,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField ) : pressureInletOutletVelocityFvPatchVectorField(rppvf, iF), - omega_(rppvf.omega_().clone().ptr()) + omega_(rppvf.omega_, false) { calcTangentialVelocity(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C index 87a99128610d54f547cfd8397e445b9fda145451..83647fb78208f4dc312b8b07738e45b54b79ec28 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(ptf, p, iF, mapper), - omega_(ptf.omega_().clone().ptr()) + omega_(ptf.omega_, false) {} @@ -77,7 +77,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(rtppsf), - omega_(rtppsf.omega_().clone().ptr()) + omega_(rtppsf.omega_, false) {} @@ -89,7 +89,7 @@ rotatingTotalPressureFvPatchScalarField ) : totalPressureFvPatchScalarField(rtppsf, iF), - omega_(rtppsf.omega_().clone().ptr()) + omega_(rtppsf.omega_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C index daa6a83903ce1515e96dd888705e1b609de39497..82f5d2e28bb7ec389c5e3695f3ae53590fce1d20 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), origin_(ptf.origin_), axis_(ptf.axis_), - omega_(ptf.omega_().clone().ptr()) + omega_(ptf.omega_, false) {} @@ -97,7 +97,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(rwvpvf), origin_(rwvpvf.origin_), axis_(rwvpvf.axis_), - omega_(rwvpvf.omega_().clone().ptr()) + omega_(rwvpvf.omega_, false) {} @@ -111,7 +111,7 @@ rotatingWallVelocityFvPatchVectorField fixedValueFvPatchField<vector>(rwvpvf, iF), origin_(rwvpvf.origin_), axis_(rwvpvf.axis_), - omega_(rwvpvf.omega_().clone().ptr()) + omega_(rwvpvf.omega_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C index e86d92d5dba097e8a1e717e592846b94ab5ff50f..a871e91de077886a7462c28f907adeeda3d269d4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C @@ -59,8 +59,8 @@ swirlFlowRateInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, p, iF, mapper), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - flowRate_(ptf.flowRate_().clone().ptr()), - rpm_(ptf.rpm_().clone().ptr()) + flowRate_(ptf.flowRate_, false), + rpm_(ptf.rpm_, false) {} @@ -89,8 +89,8 @@ swirlFlowRateInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - flowRate_(ptf.flowRate_().clone().ptr()), - rpm_(ptf.rpm_().clone().ptr()) + flowRate_(ptf.flowRate_, false), + rpm_(ptf.rpm_, false) {} @@ -104,8 +104,8 @@ swirlFlowRateInletVelocityFvPatchVectorField fixedValueFvPatchField<vector>(ptf, iF), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - flowRate_(ptf.flowRate_().clone().ptr()), - rpm_(ptf.rpm_().clone().ptr()) + flowRate_(ptf.flowRate_, false), + rpm_(ptf.rpm_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index f52abedfdd025eee4a78f88b9aacaa79d0b40d71..3e2f43965baf4b060ac7dd6609dc4d09da946b47 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -58,38 +58,6 @@ timeVaryingMappedFixedValueFvPatchField {} -template<class Type> -timeVaryingMappedFixedValueFvPatchField<Type>:: -timeVaryingMappedFixedValueFvPatchField -( - const timeVaryingMappedFixedValueFvPatchField<Type>& ptf, - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField<Type>(ptf, p, iF, mapper), - fieldTableName_(ptf.fieldTableName_), - setAverage_(ptf.setAverage_), - perturb_(ptf.perturb_), - mapMethod_(ptf.mapMethod_), - mapperPtr_(NULL), - sampleTimes_(0), - startSampleTime_(-1), - startSampledValues_(0), - startAverage_(pTraits<Type>::zero), - endSampleTime_(-1), - endSampledValues_(0), - endAverage_(pTraits<Type>::zero), - offset_ - ( - ptf.offset_.valid() - ? ptf.offset_().clone().ptr() - : NULL - ) -{} - - template<class Type> timeVaryingMappedFixedValueFvPatchField<Type>:: timeVaryingMappedFixedValueFvPatchField @@ -152,6 +120,33 @@ timeVaryingMappedFixedValueFvPatchField } +template<class Type> +timeVaryingMappedFixedValueFvPatchField<Type>:: +timeVaryingMappedFixedValueFvPatchField +( + const timeVaryingMappedFixedValueFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<Type>(ptf, p, iF, mapper), + fieldTableName_(ptf.fieldTableName_), + setAverage_(ptf.setAverage_), + perturb_(ptf.perturb_), + mapMethod_(ptf.mapMethod_), + mapperPtr_(NULL), + sampleTimes_(0), + startSampleTime_(-1), + startSampledValues_(0), + startAverage_(pTraits<Type>::zero), + endSampleTime_(-1), + endSampledValues_(0), + endAverage_(pTraits<Type>::zero), + offset_(ptf.offset_, false) +{} + + template<class Type> timeVaryingMappedFixedValueFvPatchField<Type>:: timeVaryingMappedFixedValueFvPatchField @@ -172,12 +167,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offset_ - ( - ptf.offset_.valid() - ? ptf.offset_().clone().ptr() - : NULL - ) + offset_(ptf.offset_, false) {} @@ -202,12 +192,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offset_ - ( - ptf.offset_.valid() - ? ptf.offset_().clone().ptr() - : NULL - ) + offset_(ptf.offset_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C index 0a5a113d907c49039aef74e286f86fdefee3296f..aa7c057a7a08fc27e9bcad818d17054d3a0388f0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C @@ -55,44 +55,30 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField template<class Type> Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ( - const uniformFixedGradientFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper + const dictionary& dict ) : - fixedGradientFvPatchField<Type>(ptf, p, iF, mapper), - uniformGradient_(ptf.uniformGradient_().clone().ptr()) + fixedGradientFvPatchField<Type>(p, iF), + uniformGradient_(DataEntry<Type>::New("uniformGradient", dict)) { - // For safety re-evaluate - const scalar t = this->db().time().timeOutputValue(); - this->gradient() = uniformGradient_->value(t); + this->evaluate(); } template<class Type> Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ( + const uniformFixedGradientFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const dictionary& dict + const fvPatchFieldMapper& mapper ) : - fixedGradientFvPatchField<Type>(p, iF), - uniformGradient_(DataEntry<Type>::New("uniformGradient", dict)) -{ - if (dict.found("gradient")) - { - this->gradient() = Field<Type>("gradient", dict, p.size()); - } - else - { - const scalar t = this->db().time().timeOutputValue(); - this->gradient() = uniformGradient_->value(t); - } - - fixedGradientFvPatchField<Type>::evaluate(); -} + fixedGradientFvPatchField<Type>(ptf, p, iF, mapper), + uniformGradient_(ptf.uniformGradient_, false) +{} template<class Type> @@ -102,12 +88,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField<Type>(ptf), - uniformGradient_ - ( - ptf.uniformGradient_.valid() - ? ptf.uniformGradient_().clone().ptr() - : NULL - ) + uniformGradient_(ptf.uniformGradient_, false) {} @@ -119,19 +100,12 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField<Type>(ptf, iF), - uniformGradient_ - ( - ptf.uniformGradient_.valid() - ? ptf.uniformGradient_().clone().ptr() - : NULL - ) + uniformGradient_(ptf.uniformGradient_, false) { - // For safety re-evaluate - const scalar t = this->db().time().timeOutputValue(); - + // Evaluate the profile if defined if (ptf.uniformGradient_.valid()) { - this->gradient() = uniformGradient_->value(t); + this->evaluate(); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H index 5659297fecc0c37610440c7336b1e79fb302da59..2ad895b362c2bece1a0b65ef0113b8bc0ac48ca2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -164,12 +164,8 @@ public: // Member functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index e5870388908325c1df50c5665659fc8557066bd4..8d52b8700d73d6a08a74c0278aeb18501b403773 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -55,34 +55,32 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField template<class Type> Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ( - const uniformFixedValueFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper + const dictionary& dict ) : - fixedValueFvPatchField<Type>(p, iF), // bypass mapper - uniformValue_(ptf.uniformValue_().clone().ptr()) + fixedValueFvPatchField<Type>(p, iF), + uniformValue_(DataEntry<Type>::New("uniformValue", dict)) { - // Evaluate since value not mapped - const scalar t = this->db().time().timeOutputValue(); - fvPatchField<Type>::operator==(uniformValue_->value(t)); + this->evaluate(); } template<class Type> Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ( + const uniformFixedValueFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const dictionary& dict + const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchField<Type>(p, iF), - uniformValue_(DataEntry<Type>::New("uniformValue", dict)) + fixedValueFvPatchField<Type>(p, iF), // Don't map + uniformValue_(ptf.uniformValue_, false) { - const scalar t = this->db().time().timeOutputValue(); - fvPatchField<Type>::operator==(uniformValue_->value(t)); + // Evaluate since value not mapped + this->evaluate(); } @@ -93,12 +91,7 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf), - uniformValue_ - ( - ptf.uniformValue_.valid() - ? ptf.uniformValue_().clone().ptr() - : NULL - ) + uniformValue_(ptf.uniformValue_, false) {} @@ -110,19 +103,12 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), - uniformValue_ - ( - ptf.uniformValue_.valid() - ? ptf.uniformValue_().clone().ptr() - : NULL - ) + uniformValue_(ptf.uniformValue_, false) { - // For safety re-evaluate - const scalar t = this->db().time().timeOutputValue(); - + // Evaluate the profile if defined if (ptf.uniformValue_.valid()) { - fvPatchField<Type>::operator==(uniformValue_->value(t)); + this->evaluate(); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H index 072d02f1b6d94024a54ad85618a1c241cb059e6b..6d77aa885715e611979a934d2fec484ef7c3e757 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -163,12 +163,8 @@ public: // Member functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C index 3c4da515c4195455fc09a3bb319ec73f268cc251..54217a529af8d9b94b36583ba73043582b70958e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,63 +46,61 @@ Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField template<class Type> Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField ( - const uniformInletOutletFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper + const dictionary& dict ) : mixedFvPatchField<Type>(p, iF), - phiName_(ptf.phiName_), - uniformInletValue_(ptf.uniformInletValue_, false) + phiName_(dict.lookupOrDefault<word>("phi", "phi")), + uniformInletValue_(DataEntry<Type>::New("uniformInletValue", dict)) { - this->patchType() = ptf.patchType(); - - // For safety re-evaluate const scalar t = this->db().time().timeOutputValue(); this->refValue() = uniformInletValue_->value(t); - this->refGrad() = pTraits<Type>::zero; - this->valueFraction() = 0.0; - // Map value (unmapped get refValue) - if (notNull(iF) && iF.size()) + if (dict.found("value")) + { + fvPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } + else { fvPatchField<Type>::operator=(this->refValue()); } - this->map(ptf, mapper); + this->refGrad() = pTraits<Type>::zero; + this->valueFraction() = 0.0; } template<class Type> Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField ( + const uniformInletOutletFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, - const dictionary& dict + const fvPatchFieldMapper& mapper ) : - mixedFvPatchField<Type>(p, iF), - phiName_(dict.lookupOrDefault<word>("phi", "phi")), - uniformInletValue_(DataEntry<Type>::New("uniformInletValue", dict)) + mixedFvPatchField<Type>(p, iF), // Don't map + phiName_(ptf.phiName_), + uniformInletValue_(ptf.uniformInletValue_, false) { + this->patchType() = ptf.patchType(); + + // Evaluate refValue since not mapped const scalar t = this->db().time().timeOutputValue(); this->refValue() = uniformInletValue_->value(t); - if (dict.found("value")) - { - fvPatchField<Type>::operator= - ( - Field<Type>("value", dict, p.size()) - ); - } - else - { - fvPatchField<Type>::operator=(this->refValue()); - } - this->refGrad() = pTraits<Type>::zero; this->valueFraction() = 0.0; + + // Initialize the patch value to the refValue + fvPatchField<Type>::operator=(this->refValue()); + + this->map(ptf, mapper); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H index cc9e2d0a9df2fa705ba05f2ca67ccd4a849a0897..2ab8c72ee861fd2091400abbd85cd3dafb306f38 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -193,7 +193,6 @@ public: // Member operators virtual void operator=(const fvPatchField<Type>& pvf); - }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C index 250442dad05d416d0ac011b9acb7dfba9ba132ac..046d9bbeb831a2c372165e985de005a00506bc8b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_().clone().ptr()) + jumpTable_(ptf.jumpTable_, false) {} @@ -90,7 +90,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(ptf), - jumpTable_(ptf.jumpTable_().clone().ptr()) + jumpTable_(ptf.jumpTable_, false) {} @@ -102,7 +102,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(ptf, iF), - jumpTable_(ptf.jumpTable_().clone().ptr()) + jumpTable_(ptf.jumpTable_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C index 0670119ab0cee9d0cb147564ace121a063c39860..7b2d55e1eb3e7cb00215bc1f86960941cd43c4af 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField ) : fixedJumpAMIFvPatchField<Type>(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_().clone().ptr()) + jumpTable_(ptf.jumpTable_, false) {} @@ -87,7 +87,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField ) : fixedJumpAMIFvPatchField<Type>(ptf), - jumpTable_(ptf.jumpTable_().clone().ptr()) + jumpTable_(ptf.jumpTable_, false) {} @@ -99,7 +99,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField ) : fixedJumpAMIFvPatchField<Type>(ptf, iF), - jumpTable_(ptf.jumpTable_().clone().ptr()) + jumpTable_(ptf.jumpTable_, false) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C index 5cfd99db24ae9c214f9b6c3b1a1851b6d223a815..52ecf6fe4f197f22ff7a82cc57f121a4f41f2bfd 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C @@ -73,8 +73,8 @@ uniformTotalPressureFvPatchScalarField } else { - scalar p0 = pressure_->value(this->db().time().timeOutputValue()); - fvPatchField<scalar>::operator=(p0); + const scalar t = this->db().time().timeOutputValue(); + fvPatchScalarField::operator==(pressure_->value(t)); } } @@ -88,15 +88,18 @@ uniformTotalPressureFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchScalarField(p, iF), // bypass mapper + fixedValueFvPatchScalarField(p, iF), // Don't map UName_(ptf.UName_), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - pressure_(ptf.pressure_().clone().ptr()) + pressure_(ptf.pressure_, false) { - // Evaluate since value not mapped + patchType() = ptf.patchType(); + + // Set the patch pressure to the current total pressure + // This is not ideal but avoids problems with the creation of patch faces const scalar t = this->db().time().timeOutputValue(); fvPatchScalarField::operator==(pressure_->value(t)); } @@ -114,12 +117,7 @@ uniformTotalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - pressure_ - ( - ptf.pressure_.valid() - ? ptf.pressure_().clone().ptr() - : NULL - ) + pressure_(ptf.pressure_, false) {} @@ -136,12 +134,7 @@ uniformTotalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - pressure_ - ( - ptf.pressure_.valid() - ? ptf.pressure_().clone().ptr() - : NULL - ) + pressure_(ptf.pressure_, false) {}