diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index f613a7e6a2c13e47c86947d186d18bd5e3cbefe7..6ea997f3fd8e41fc4e1d9ba464744ad40b03574f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -343,6 +343,18 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() ) ); + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValueFvPatchField<Type>::" + "checkTable()" + ) << "Number of values (" << vals.size() + << ") differs from the number of points (" + << mapperPtr_().sourceSize() + << ") in file " << vals.objectPath() << exit(FatalError); + } + startAverage_ = vals.average(); startSampledValues_ = mapperPtr_().interpolate(vals); } @@ -388,6 +400,19 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() false ) ); + + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValueFvPatchField<Type>::" + "checkTable()" + ) << "Number of values (" << vals.size() + << ") differs from the number of points (" + << mapperPtr_().sourceSize() + << ") in file " << vals.objectPath() << exit(FatalError); + } + endAverage_ = vals.average(); endSampledValues_ = mapperPtr_().interpolate(vals); } diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index 1fa44b5d64c0c54c14453a7f49270a89f6081a4e..8bca126f9b503a10f0ff1488117626d4107f74a3 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -313,6 +313,18 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable() ) ); + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValuePointPatchField<Type>::" + "checkTable()" + ) << "Number of values (" << vals.size() + << ") differs from the number of points (" + << mapperPtr_().sourceSize() + << ") in file " << vals.objectPath() << exit(FatalError); + } + startAverage_ = vals.average(); startSampledValues_ = mapperPtr_().interpolate(vals); } @@ -357,6 +369,19 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable() false ) ); + + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValuePointPatchField<Type>::" + "checkTable()" + ) << "Number of values (" << vals.size() + << ") differs from the number of points (" + << mapperPtr_().sourceSize() + << ") in file " << vals.objectPath() << exit(FatalError); + } + endAverage_ = vals.average(); endSampledValues_ = mapperPtr_().interpolate(vals); } diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C index 9f8a6a5179bf739ac3b41244c337924ac3c7fd96..bc1402bd7a3c00e8ad3249452e76748a83d73aba 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -222,7 +222,8 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation ) : perturb_(perturb), - referenceCS_(calcCoordinateSystem(sourcePoints)) + referenceCS_(calcCoordinateSystem(sourcePoints)), + nPoints_(sourcePoints.size()) { calcWeights(sourcePoints, destPoints); @@ -238,7 +239,8 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation ) : perturb_(perturb), - referenceCS_(referenceCS) + referenceCS_(referenceCS), + nPoints_(sourcePoints.size()) { calcWeights(sourcePoints, destPoints); } diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H index daec2e46880a4aad4b79988e4bce3282f052f685..e3428d80fea5af4cf98569ef22fc0fb7d9b1a763 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,6 +59,9 @@ class pointToPointPlanarInterpolation //- Coordinate system coordinateSystem referenceCS_; + //- Number of source points (for checking) + label nPoints_; + //- Current interpolation addressing to face centres of underlying // patch List<FixedList<label, 3> > nearestVertex_; @@ -114,6 +117,12 @@ public: return referenceCS_; } + //- Number of source points + label sourceSize() const + { + return nPoints_; + } + // patch const List<FixedList<label, 3> >& nearestVertex() const { diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C index 9159a03eddecdc0faef4261314ac203c1f536b6d..f17f249d13a1a8384ca5334ea67b06b0a4d89ab0 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,6 +33,17 @@ Foam::tmp<Foam::Field<Type> > Foam::pointToPointPlanarInterpolation::interpolate const Field<Type>& sourceFld ) const { + if (nPoints_ != sourceFld.size()) + { + FatalErrorIn + ( + "pointToPointPlanarInterpolation::interpolate" + "(const Field<Type>&) const" + ) << "Number of source points = " << nPoints_ + << " number of values = " << sourceFld.size() + << exit(FatalError); + } + tmp<Field<Type> > tfld(new Field<Type>(nearestVertex_.size())); Field<Type>& fld = tfld();