diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index d3eb9f805ff9150c97939fcb8402f5accd4ebdb1..cc78c310905aee5b334c95391a5d8122591a2fb6 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -129,7 +129,7 @@ FoamFile // source sphereToCell; // sourceInfo // { -// centre (0.2 0.2 -10); +// origin (0.2 0.2 -10); // radius 5.0; // } // @@ -394,7 +394,7 @@ FoamFile // sourceInfo // { // surface searchableSphere; -// centre (0.05 0.05 0.005); +// origin (0.05 0.05 0.005); // radius 0.025; // //name sphere.stl; // Optional name if surface triSurfaceMesh // } diff --git a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C index 37bc94df278e2faa01a9a1723af6dac6a6055af5..44001f4dd8e87853e5d403565aa87a1969ca4378 100644 --- a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C +++ b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) ( shapeSelector::shapeTypeNames.get("type", dict) ); - const vector centre(dict.get<vector>("centre")); + const vector origin(dict.getCompat<vector>("origin", {{"centre", 1806}})); const word fieldName(dict.get<word>("field")); Info<< "Reading field " << fieldName << "\n" << endl; @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) mesh ); - scalar f0 = 0.0; + scalar f0 = 0; scalarField f(mesh.points().size()); Info<< "Processing type '" << shapeSelector::shapeTypeNames[surfType] @@ -126,15 +126,15 @@ int main(int argc, char *argv[]) { const vector direction(dict.get<vector>("direction")); - f = -(mesh.points() - centre) & (direction/mag(direction)); - f0 = 0.0; + f = -(mesh.points() - origin) & (direction/mag(direction)); + f0 = 0; break; } case shapeSelector::shapeType::SPHERE: { const scalar radius(dict.get<scalar>("radius")); - f = -mag(mesh.points() - centre); + f = -mag(mesh.points() - origin); f0 = -radius; break; } @@ -145,8 +145,8 @@ int main(int argc, char *argv[]) f = -sqrt ( - sqr(mag(mesh.points() - centre)) - - sqr(mag((mesh.points() - centre) & direction)) + sqr(mag(mesh.points() - origin)) + - sqr(mag((mesh.points() - origin) & direction)) ); f0 = -radius; break; @@ -160,9 +160,9 @@ int main(int argc, char *argv[]) const scalarField xx ( - (mesh.points() - centre) & direction/mag(direction) + (mesh.points() - origin) & direction/mag(direction) ); - const scalarField zz((mesh.points() - centre) & up/mag(up)); + const scalarField zz((mesh.points() - origin) & up/mag(up)); f = amplitude*Foam::sin(2*mathematical::pi*xx/period) - zz; f0 = 0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C index 87e782dc4b83db850813d1cf0aecd69687116540..138d2d0af094e2a993444867371871209b2a8807 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C @@ -75,7 +75,7 @@ cylindricalInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(p, iF, dict), - origin_(dict.lookupCompat("origin", {{"centre", 1712}})), + origin_(dict.getCompat<vector>("origin", {{"centre", 1712}})), axis_(dict.lookup("axis")), axialVelocity_(Function1<scalar>::New("axialVelocity", dict)), radialVelocity_(Function1<scalar>::New("radialVelocity", dict)), diff --git a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C index 5691a89e31f75fa714003737e96798cdc88632ef..fc7cebeda182f444cea4d5d2be40acf70529d7b2 100644 --- a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C +++ b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C @@ -57,18 +57,18 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest { pointIndexHit info(false, sample, -1); - const vector n(sample - centre_); + const vector n(sample - origin_); scalar magN = mag(n); if (nearestDistSqr >= sqr(magN - radius_)) { if (magN < ROOTVSMALL) { - info.rawPoint() = centre_ + vector(1,0,0)*radius_; + info.rawPoint() = origin_ + vector(1,0,0)*radius_; } else { - info.rawPoint() = centre_ + n/magN*radius_; + info.rawPoint() = origin_ + n/magN*radius_; } info.setHit(); info.setIndex(0); @@ -95,7 +95,7 @@ void Foam::searchableSphere::findLineAll if (magSqrDir > ROOTVSMALL) { - const vector toCentre(centre_-start); + const vector toCentre(origin_ - start); scalar magSqrToCentre = magSqr(toCentre); dir /= Foam::sqrt(magSqrDir); @@ -135,18 +135,18 @@ void Foam::searchableSphere::findLineAll Foam::searchableSphere::searchableSphere ( const IOobject& io, - const point& centre, + const point& origin, const scalar radius ) : searchableSurface(io), - centre_(centre), + origin_(origin), radius_(radius) { bounds() = boundBox ( - centre_ - radius_*vector::one, - centre_ + radius_*vector::one + origin_ - radius_*vector::one, + origin_ + radius_*vector::one ); } @@ -157,23 +157,20 @@ Foam::searchableSphere::searchableSphere const dictionary& dict ) : - searchableSurface(io), - centre_(dict.get<point>("centre")), - radius_(dict.get<scalar>("radius")) -{ - bounds() = boundBox + searchableSphere ( - centre_ - radius_*vector::one, - centre_ + radius_*vector::one - ); -} + io, + dict.getCompat<vector>("origin", {{"centre", 1806}}), + dict.get<scalar>("radius") + ) +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::searchableSphere::overlaps(const boundBox& bb) const { - return bb.overlaps(centre_, sqr(radius_)); + return bb.overlaps(origin_, sqr(radius_)); } @@ -181,8 +178,8 @@ const Foam::wordList& Foam::searchableSphere::regions() const { if (regions_.empty()) { - regions_.setSize(1); - regions_[0] = "region0"; + regions_.resize(1); + regions_.first() = "region0"; } return regions_; } @@ -195,10 +192,10 @@ void Foam::searchableSphere::boundingSpheres scalarField& radiusSqr ) const { - centres.setSize(1); - centres[0] = centre_; + centres.resize(1); + centres[0] = origin_; - radiusSqr.setSize(1); + radiusSqr.resize(1); radiusSqr[0] = Foam::sqr(radius_); // Add a bit to make sure all points are tested inside @@ -336,7 +333,7 @@ void Foam::searchableSphere::getNormal { if (info[i].hit()) { - normal[i] = normalised(info[i].hitPoint() - centre_); + normal[i] = normalised(info[i].hitPoint() - origin_); } else { @@ -362,7 +359,7 @@ void Foam::searchableSphere::getVolumeType volType[pointi] = ( - (magSqr(pt - centre_) <= rad2) + (magSqr(pt - origin_) <= rad2) ? volumeType::INSIDE : volumeType::OUTSIDE ); } diff --git a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H index 69ee3ce22a26b1d37f1a84dc01f509b4a9ce3126..6978a90c1c16bb4d2127b5cc4d8124a44fc248c1 100644 --- a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H +++ b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H @@ -29,10 +29,11 @@ Description \heading Dictionary parameters \table - Property | Description | Required | Default - type | sphere / searchableSphere | selector | - centre | The sphere centre | yes | - radius | The (outside) radius of sphere | yes | + Property | Description | Required | Default + type | sphere / searchableSphere | selector | + origin | The origin (centre) of the sphere | yes | + radius | The (outside) radius of sphere | yes | + centre | Alternative for 'origin' | no | \endtable SourceFiles @@ -64,7 +65,7 @@ private: // Private Member Data //- Centre point of the sphere - const point centre_; + const point origin_; //- The outer radius of the sphere const scalar radius_; @@ -151,7 +152,7 @@ public: // Usually the element centres (should be of length size()). virtual tmp<pointField> coordinates() const { - return tmp<pointField>::New(1, centre_); + return tmp<pointField>::New(1, origin_); } //- Get bounding spheres (centre and radius squared), one per element. diff --git a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C index 3f640426e112ed080c680d458805fab3fcbd8155..9dcf09ad52b02b4bc237f8aad1861be71561d75f 100644 --- a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C +++ b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C @@ -55,7 +55,7 @@ void Foam::sphereToCell::combine(topoSet& set, const bool add) const forAll(ctrs, celli) { - if (magSqr(ctrs[celli] - centre_) <= rad2) + if (magSqr(ctrs[celli] - origin_) <= rad2) { addOrDelete(set, celli, add); } @@ -68,12 +68,12 @@ void Foam::sphereToCell::combine(topoSet& set, const bool add) const Foam::sphereToCell::sphereToCell ( const polyMesh& mesh, - const point& centre, + const point& origin, const scalar radius ) : topoSetSource(mesh), - centre_(centre), + origin_(origin), radius_(radius) {} @@ -84,9 +84,12 @@ Foam::sphereToCell::sphereToCell const dictionary& dict ) : - topoSetSource(mesh), - centre_(dict.get<point>("centre")), - radius_(dict.get<scalar>("radius")) + sphereToCell + ( + mesh, + dict.getCompat<vector>("origin", {{"centre", 1806}}), + dict.get<scalar>("radius") + ) {} @@ -97,7 +100,7 @@ Foam::sphereToCell::sphereToCell ) : topoSetSource(mesh), - centre_(checkIs(is)), + origin_(checkIs(is)), radius_(readScalar(checkIs(is))) {} @@ -112,15 +115,15 @@ void Foam::sphereToCell::applyToSet { if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) { - Info<< " Adding cells with centre within sphere, with centre = " - << centre_ << " and radius = " << radius_ << endl; + Info<< " Adding cells within a sphere with centre = " + << origin_ << " and radius = " << radius_ << endl; combine(set, true); } else if (action == topoSetSource::DELETE) { - Info<< " Removing cells with centre within sphere, with centre = " - << centre_ << " and radius = " << radius_ << endl; + Info<< " Removing cells within a sphere with centre = " + << origin_ << " and radius = " << radius_ << endl; combine(set, false); } diff --git a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H index 200b9f68b2ef14d056c4e1f0525af0b7fd2777b1..0da213707c66c79ab8171e06e23b6bb4481520af 100644 --- a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H +++ b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.H @@ -29,9 +29,10 @@ Description \heading Dictionary parameters \table - Property | Description | Required | Default - centre | The sphere centre | yes | - radius | The (outside) radius of sphere | yes | + Property | Description | Required | Default + origin | The origin (centre) of the sphere | yes | + radius | The (outside) radius of sphere | yes | + centre | Alternative for 'origin' | no | \endtable SourceFiles @@ -64,7 +65,7 @@ class sphereToCell static addToUsageTable usage_; //- Centre point of the sphere - point centre_; + point origin_; //- The outer radius of the sphere scalar radius_; @@ -87,7 +88,7 @@ public: sphereToCell ( const polyMesh& mesh, - const point& centre, + const point& origin, const scalar radius ); @@ -104,7 +105,7 @@ public: // Member Functions - virtual sourceType setType() const + virtual topoSetSource::sourceType setType() const { return CELLSETSOURCE; } diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict index bcf459bfb8556409f6584c89be72564ce14b4809..58ff35ed4a26fdc4763b9c78e4d5bc2f4d6dea11 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/topoSetDict @@ -25,8 +25,8 @@ actions source sphereToCell; sourceInfo { - centre (0.125 0.375 0.05); - radius 0.005; + origin (0.125 0.375 0.05); + radius 0.005; } } ); diff --git a/tutorials/mesh/foamyHexMesh/blob/system/topoSetDict b/tutorials/mesh/foamyHexMesh/blob/system/topoSetDict index afa9c6971cdf2353977a571fec6e9dbd18f4823c..8d1ac69992b717df10071334907ba0e6d56c5366 100644 --- a/tutorials/mesh/foamyHexMesh/blob/system/topoSetDict +++ b/tutorials/mesh/foamyHexMesh/blob/system/topoSetDict @@ -110,7 +110,7 @@ actions source sphereToCell; sourceInfo { - centre (-0.3 -0.3 -0.3); + origin (-0.3 -0.3 -0.3); radius 0.4; } } diff --git a/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background b/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background index 141b615cce05fa80e62961b38be6a945336e602b..8fd3b95a976f2eeff66d03374560d6f67990f6d1 100644 --- a/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background +++ b/tutorials/mesh/foamyHexMesh/flange/system/topoSetDict-background @@ -110,7 +110,7 @@ FoamFile // // Cells with centre within sphere // source sphereToCell; // { -// centre (0.2 0.2 -10); +// origin (0.2 0.2 -10); // radius 5.0; // } // diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict index 1743e4fe18c1f15e0ed2f26867e15b63cc266c8c..ee905dc545e50de0cc7c3f157f18adbf4484541d 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict +++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict @@ -27,8 +27,9 @@ regions ( sphereToCell { - centre (0.5 0.5 0); - radius 0.1; + centre (0.5 0.5 0); + radius 0.1; + fieldValues ( volScalarFieldValue alpha.water 0 diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict index b9d9566b3e964848c8745b2334fe16b0ca7533b5..1ac3bd391bb9341ed6bb9f62810c1d01fcaf1ffd 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict +++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict @@ -27,8 +27,9 @@ regions ( sphereToCell { - centre (0.5 0.5 0.5); - radius 0.1; + origin (0.5 0.5 0.5); + radius 0.1; + fieldValues ( volScalarFieldValue alpha.water 0