From 82e9f67857b6f08a875ed671abe1855d328127ff Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 15:24:46 +0000 Subject: [PATCH 01/15] STYLE: selfContainedDirectMapped :indentation --- .../selfContainedDirectMappedFixedValueFvPatchField.H | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchField.H index 0d76fb6d02..20e190686d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchField.H @@ -48,7 +48,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class selfContainedDirectMappedFixedValueFvPatch Declaration + Class selfContainedDirectMappedFixedValueFvPatch Declaration \*---------------------------------------------------------------------------*/ template @@ -75,6 +75,7 @@ class selfContainedDirectMappedFixedValueFvPatchField mutable autoPtr > interpolator_; + // Private Member Functions //- Field to sample. Either on my or nbr mesh @@ -83,6 +84,7 @@ class selfContainedDirectMappedFixedValueFvPatchField //- Access the interpolation method const interpolation& interpolator() const; + public: //- Runtime type information From 1473e9f2ef9abbf6a05a90274c6323d4aa059441 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 15:25:11 +0000 Subject: [PATCH 02/15] COMP: kineticTheroyModel : single precision compilation --- .../kineticTheoryModel/kineticTheoryModel.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index ee2300d91e..32bcf3b0a1 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -218,7 +218,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat) // The solution is higly unstable close to the packing limit. gs0_ = radialModel_->g0 ( - min(max(alpha_, 1e-6), alphaMax_ - 0.01), + min(max(alpha_, scalar(1e-6)), alphaMax_ - 0.01), alphaMax_ ); @@ -255,7 +255,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat) volScalarField J1 = 3.0*betaPrim; volScalarField J2 = 0.25*sqr(betaPrim)*da_*sqr(Ur) - /(max(alpha_, 1e-6)*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt)); + /(max(alpha_, scalar(1e-6))*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt)); // bulk viscosity p. 45 (Lun et al. 1984). lambda_ = (4.0/3.0)*sqr(alpha_)*rhoa_*da_*gs0_*(1.0+e_)*ThetaSqrt/sqrtPi; @@ -309,7 +309,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat) volScalarField t1 = K1*alpha_ + rhoa_; volScalarField l1 = -t1*trD; volScalarField l2 = sqr(t1)*tr2D; - volScalarField l3 = 4.0*K4*max(alpha_, 1e-6)*(2.0*K3*trD2 + K2*tr2D); + volScalarField l3 = 4.0*K4*max(alpha_, scalar(1e-6))*(2.0*K3*trD2 + K2*tr2D); Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4)); } From 9293486dd9f07298bf6709eaccd2c7c9041e1211 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 15:35:03 +0000 Subject: [PATCH 03/15] ENH: ReleaseNotes-dev : update --- ReleaseNotes-dev | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index 815b97d862..fa6c09664b 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -184,6 +184,8 @@ + =setSet=: allows time range (e.g. 0:100) in combination with -batch argument to execute the commands for multiple times. * Post-processing + + =paraFoam=, =foamToVTK=: full support for polyhedral cell type in recent + Paraview versions. + =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal field data. + =singleCellMesh=: new utility to convert mesh and fields to a single cell From 957f8d9d70b4c8644da44890f17029a36cf18804 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 15:35:50 +0000 Subject: [PATCH 04/15] COMP: transform : split off operations --- src/OpenFOAM/primitives/transform/transform.H | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/primitives/transform/transform.H b/src/OpenFOAM/primitives/transform/transform.H index 70e6821612..c880e05888 100644 --- a/src/OpenFOAM/primitives/transform/transform.H +++ b/src/OpenFOAM/primitives/transform/transform.H @@ -48,9 +48,11 @@ inline tensor rotationTensor const vector& n2 ) { + const scalar s = n1 & n2; + const vector n3 = n1 ^ n2; return - (n1 & n2)*I - + (1 - (n1 & n2))*sqr(n1 ^ n2)/(magSqr(n1 ^ n2) + VSMALL) + s*I + + (1 - s)*sqr(n3)/(magSqr(n3) + VSMALL) + (n2*n1 - n1*n2); } From ba1daed66f4f96f9e739351023e9b35da63f6269 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 15:36:44 +0000 Subject: [PATCH 05/15] ENH: windTurbineTerrain : updated Allrun to use ptscotch --- .../simpleFoam/windTurbineTerrain/Allclean | 3 ++ .../simpleFoam/windTurbineTerrain/Allrun | 2 ++ .../system/decomposeParDict-nonPar | 29 +++++++++++++++++++ .../system/decomposeParDict-par | 29 +++++++++++++++++++ .../windTurbineTerrain/system/fvSchemes | 2 +- 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-nonPar create mode 100644 tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allclean b/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allclean index cfc95cf865..2e2bcf8132 100755 --- a/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allclean +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allclean @@ -19,4 +19,7 @@ rm -rf constant/polyMesh/sets #rm -rf constant/refinementHistory #rm -rf constant/surfaceIndex +# Reset decomposeParDict +cp system/decomposeParDict-nonPar system/decomposeParDict + # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allrun b/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allrun index fbbdf2c04a..c69808608c 100755 --- a/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allrun +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/Allrun @@ -7,6 +7,7 @@ cd ${0%/*} || exit 1 # run from this directory compileApplication windSimpleFoam runApplication blockMesh +cp system/decomposeParDict-nonPar system/decomposeParDict runApplication decomposePar #runApplication snappyHexMesh -overwrite @@ -14,6 +15,7 @@ runApplication decomposePar #runApplication setsToZones -noFlipMap #runApplication windSimpleFoam +cp system/decomposeParDict-par system/decomposeParDict runParallel snappyHexMesh 2 -overwrite # Add wildcard entries for meshes patches since not preserved diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-nonPar b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-nonPar new file mode 100644 index 0000000000..f45f2839e1 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-nonPar @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par new file mode 100644 index 0000000000..52262d8cdd --- /dev/null +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method ptscotch;//hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/fvSchemes b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/fvSchemes index 30ee3b82f4..2e7c10da7b 100644 --- a/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/fvSchemes +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/fvSchemes @@ -30,7 +30,7 @@ divSchemes { default none; div(phi,U) Gauss upwind grad(U); - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; div(phi,epsilon) Gauss upwind; div(phi,k) Gauss upwind; } From 20f19d9d18674799e00f44411a16df292d211c2b Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 15:37:46 +0000 Subject: [PATCH 06/15] ENH: windTurbineTerrain : decomposeParDict update --- .../windTurbineTerrain/system/decomposeParDict-par | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par index 52262d8cdd..cd9a4dc250 100644 --- a/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/system/decomposeParDict-par @@ -17,13 +17,6 @@ FoamFile numberOfSubdomains 2; -method ptscotch;//hierarchical; - -hierarchicalCoeffs -{ - n (2 1 1); - delta 0.001; - order xyz; -} +method ptscotch; // ************************************************************************* // From 700600501f897fea9373955b7c397e52cd2dd011 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 17:03:40 +0000 Subject: [PATCH 07/15] ENH: ops.H : added minMag,maxMag eqOp --- src/OpenFOAM/primitives/ops/ops.H | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H index 217fe8db6e..42d16029d0 100644 --- a/src/OpenFOAM/primitives/ops/ops.H +++ b/src/OpenFOAM/primitives/ops/ops.H @@ -76,6 +76,8 @@ EqOp(eqMag, x = mag(y)) EqOp(plusEqMagSqr, x += magSqr(y)) EqOp(maxEq, x = max(x, y)) EqOp(minEq, x = min(x, y)) +EqOp(minMagSqrEq, x = (magSqr(x)<=magSqr(y) ? x : y)) +EqOp(maxMagSqrEq, x = (magSqr(x)>=magSqr(y) ? x : y)) EqOp(andEq, x = (x && y)) EqOp(orEq, x = (x || y)) From 6f2b17a69810c4cd5dbe0078d550c15d77f86920 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 17:05:09 +0000 Subject: [PATCH 08/15] ENH: fvSchemes : updated incompressible tutorials --- .../buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes | 2 +- .../buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes | 2 +- .../iglooWithFridges/system/fvSchemes | 2 +- .../incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes | 2 +- .../adjointShapeOptimizationFoam/pitzDaily/system/fvSchemes | 2 +- .../boundaryFoam/boundaryLaunderSharma/system/fvSchemes | 2 +- .../boundaryFoam/boundaryWallFunctions/system/fvSchemes | 2 +- .../boundaryFoam/boundaryWallFunctionsProfile/system/fvSchemes | 2 +- .../incompressible/channelFoam/channel395/system/fvSchemes | 2 +- .../incompressible/pimpleDyMFoam/movingCone/system/fvSchemes | 2 +- .../wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes | 2 +- .../wingMotion/wingMotion2D_simpleFoam/system/fvSchemes | 2 +- .../pimpleFoam/t-junction-with-fan/system/fvSchemes | 2 +- tutorials/incompressible/pimpleFoam/t-junction/system/fvSchemes | 2 +- .../incompressible/pisoFoam/les/pitzDaily/system/fvSchemes | 2 +- .../pisoFoam/les/pitzDailyDirectMapped/system/fvSchemes | 2 +- tutorials/incompressible/pisoFoam/ras/cavity/system/fvSchemes | 2 +- tutorials/incompressible/simpleFoam/airFoil2D/system/fvSchemes | 2 +- tutorials/incompressible/simpleFoam/motorBike/system/fvSchemes | 2 +- .../compressibleInterFoam/les/depthCharge2D/system/fvSchemes | 2 +- .../compressibleInterFoam/les/depthCharge3D/system/fvSchemes | 2 +- .../multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes | 2 +- tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes index 764772f38e..d5fb42ebd9 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes index 55f535ac70..112f82d2ed 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,T) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes index 6d1f2f881c..7140f0ae69 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes index b0ecc3706b..173a0ce47a 100644 --- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes +++ b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes @@ -33,7 +33,7 @@ divSchemes div(phi,U) Gauss limitedLinearV 1; div(phi,k) Gauss limitedLinear 1; div(phi,epsilon) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/adjointShapeOptimizationFoam/pitzDaily/system/fvSchemes b/tutorials/incompressible/adjointShapeOptimizationFoam/pitzDaily/system/fvSchemes index ba8d982de2..95136217a3 100644 --- a/tutorials/incompressible/adjointShapeOptimizationFoam/pitzDaily/system/fvSchemes +++ b/tutorials/incompressible/adjointShapeOptimizationFoam/pitzDaily/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,U) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; div(-phi,Ua) Gauss upwind; div((nuEff*dev(grad(Ua).T()))) Gauss linear; diff --git a/tutorials/incompressible/boundaryFoam/boundaryLaunderSharma/system/fvSchemes b/tutorials/incompressible/boundaryFoam/boundaryLaunderSharma/system/fvSchemes index 7e835feb83..c4011a71ed 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryLaunderSharma/system/fvSchemes +++ b/tutorials/incompressible/boundaryFoam/boundaryLaunderSharma/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,epsilon) Gauss linear; div(phi,R) Gauss linear; div(phi,nuTilda) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctions/system/fvSchemes b/tutorials/incompressible/boundaryFoam/boundaryWallFunctions/system/fvSchemes index 7e835feb83..c4011a71ed 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctions/system/fvSchemes +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctions/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,epsilon) Gauss linear; div(phi,R) Gauss linear; div(phi,nuTilda) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/system/fvSchemes b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/system/fvSchemes index b4b59b6c27..74f1565e60 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/system/fvSchemes +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/system/fvSchemes @@ -33,7 +33,7 @@ divSchemes div(phi,omega) Gauss linear; div(phi,R) Gauss linear; div(phi,nuTilda) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/channelFoam/channel395/system/fvSchemes b/tutorials/incompressible/channelFoam/channel395/system/fvSchemes index d0df82c153..9e124d99df 100644 --- a/tutorials/incompressible/channelFoam/channel395/system/fvSchemes +++ b/tutorials/incompressible/channelFoam/channel395/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,B) Gauss limitedLinear 1; div(B) Gauss linear; div(phi,nuTilda) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pimpleDyMFoam/movingCone/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/movingCone/system/fvSchemes index 7f5096b709..a2f31f5e87 100644 --- a/tutorials/incompressible/pimpleDyMFoam/movingCone/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/movingCone/system/fvSchemes @@ -30,7 +30,7 @@ divSchemes { default none; div(phi,U) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes index b5c7a16ad4..f5b6b3d915 100644 --- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss linearUpwind grad(U); div(phi,k) Gauss limitedLinear 1; div(phi,omega) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam/system/fvSchemes index 808f6279a5..2d493543e9 100644 --- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss linearUpwind grad(U); div(phi,k) Gauss upwind; div(phi,omega) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/fvSchemes b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/fvSchemes index b1c95ec3b2..9664d38c53 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/fvSchemes +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,R) Gauss limitedLinear 1; div(R) Gauss linear; div(phi,nuTilda) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pimpleFoam/t-junction/system/fvSchemes b/tutorials/incompressible/pimpleFoam/t-junction/system/fvSchemes index b1c95ec3b2..9664d38c53 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction/system/fvSchemes +++ b/tutorials/incompressible/pimpleFoam/t-junction/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,R) Gauss limitedLinear 1; div(R) Gauss linear; div(phi,nuTilda) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pisoFoam/les/pitzDaily/system/fvSchemes b/tutorials/incompressible/pisoFoam/les/pitzDaily/system/fvSchemes index 9baa5bc274..d6292d8089 100644 --- a/tutorials/incompressible/pisoFoam/les/pitzDaily/system/fvSchemes +++ b/tutorials/incompressible/pisoFoam/les/pitzDaily/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,B) Gauss limitedLinear 1; div(phi,nuTilda) Gauss limitedLinear 1; div(B) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/fvSchemes b/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/fvSchemes index c2856acf2e..920abf4ff3 100644 --- a/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/fvSchemes +++ b/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,B) Gauss limitedLinear 1; div(phi,nuTilda) Gauss limitedLinear 1; div(B) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/pisoFoam/ras/cavity/system/fvSchemes b/tutorials/incompressible/pisoFoam/ras/cavity/system/fvSchemes index b1c95ec3b2..9664d38c53 100644 --- a/tutorials/incompressible/pisoFoam/ras/cavity/system/fvSchemes +++ b/tutorials/incompressible/pisoFoam/ras/cavity/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,R) Gauss limitedLinear 1; div(R) Gauss linear; div(phi,nuTilda) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/simpleFoam/airFoil2D/system/fvSchemes b/tutorials/incompressible/simpleFoam/airFoil2D/system/fvSchemes index d5c9bc3261..74a0e5bc10 100644 --- a/tutorials/incompressible/simpleFoam/airFoil2D/system/fvSchemes +++ b/tutorials/incompressible/simpleFoam/airFoil2D/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes default none; div(phi,U) Gauss linearUpwind Gauss linear; div(phi,nuTilda) Gauss linearUpwind Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/fvSchemes b/tutorials/incompressible/simpleFoam/motorBike/system/fvSchemes index 5487837afc..79fd21bad2 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/fvSchemes +++ b/tutorials/incompressible/simpleFoam/motorBike/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss linearUpwind grad(U); div(phi,k) Gauss upwind; div(phi,omega) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes index df3462c54d..0441f1b20a 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phirb,alpha) Gauss interfaceCompression 1; div(phi,p_rgh) Gauss upwind; div(phi,k) Gauss vanLeer; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes index df3462c54d..0441f1b20a 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phirb,alpha) Gauss interfaceCompression 1; div(phi,p_rgh) Gauss upwind; div(phi,k) Gauss vanLeer; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes index 8159d1c62c..ccfffe51ae 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,B) Gauss limitedLinear 1; div(B) Gauss linear; div(phi,nuTilda) Gauss limitedLinear 1; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes diff --git a/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes b/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes index c6205f8cb6..ef617145e1 100644 --- a/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes +++ b/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,R) Gauss upwind; div(R) Gauss linear; div(phi,nuTilda) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes From cde4e666740ca6878e1897a222339bb11623c65c Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Dec 2010 17:06:23 +0000 Subject: [PATCH 09/15] STYLE: kineticTheoryModel.C : line length --- .../kineticTheoryModel/kineticTheoryModel.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 32bcf3b0a1..436d373b04 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -309,7 +309,11 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat) volScalarField t1 = K1*alpha_ + rhoa_; volScalarField l1 = -t1*trD; volScalarField l2 = sqr(t1)*tr2D; - volScalarField l3 = 4.0*K4*max(alpha_, scalar(1e-6))*(2.0*K3*trD2 + K2*tr2D); + volScalarField l3 = + 4.0 + *K4 + *max(alpha_, scalar(1e-6)) + *(2.0*K3*trD2 + K2*tr2D); Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4)); } From aa15f4479cd51532785a0e5dccf517e23892c951 Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 15 Dec 2010 17:46:15 +0000 Subject: [PATCH 10/15] ENH: Transferring momentOfInertia calc from utils to meshTools lib. Adding mesh cell inertia calc. --- .../test/momentOfInertia/Make/options | 3 +- .../momentOfInertia/Test-momentOfInertia.C | 228 ++---- .../surface/surfaceInertia/surfaceInertia.C | 266 +------ .../polyMeshTetDecomposition/tetIndices.H | 5 + .../polyMeshTetDecomposition/tetIndicesI.H | 15 + src/meshTools/Make/files | 1 + .../momentOfInertia/momentOfInertia.C | 654 ++++++++---------- .../momentOfInertia/momentOfInertia.H | 97 ++- 8 files changed, 464 insertions(+), 805 deletions(-) diff --git a/applications/test/momentOfInertia/Make/options b/applications/test/momentOfInertia/Make/options index 54c035b8f5..0b32f3355b 100644 --- a/applications/test/momentOfInertia/Make/options +++ b/applications/test/momentOfInertia/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude EXE_LIBS = \ -lmeshTools diff --git a/applications/test/momentOfInertia/Test-momentOfInertia.C b/applications/test/momentOfInertia/Test-momentOfInertia.C index 9a8ae40a5a..22327f1bdd 100644 --- a/applications/test/momentOfInertia/Test-momentOfInertia.C +++ b/applications/test/momentOfInertia/Test-momentOfInertia.C @@ -26,180 +26,38 @@ Application Description Calculates the inertia tensor and principal axes and moments of a - test face and tetrahedron. + test face, tetrahedron and mesh. \*---------------------------------------------------------------------------*/ +#include "argList.H" +#include "Time.H" +#include "polyMesh.H" #include "ListOps.H" #include "face.H" #include "tetPointRef.H" #include "triFaceList.H" #include "OFstream.H" #include "meshTools.H" +#include "momentOfInertia.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // using namespace Foam; -void massPropertiesSolid -( - const pointField& pts, - const triFaceList triFaces, - scalar density, - scalar& mass, - vector& cM, - tensor& J -) -{ - // Reimplemented from: Wm4PolyhedralMassProperties.cpp - // File Version: 4.10.0 (2009/11/18) - - // Geometric Tools, LC - // Copyright (c) 1998-2010 - // Distributed under the Boost Software License, Version 1.0. - // http://www.boost.org/LICENSE_1_0.txt - // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt - - // Boost Software License - Version 1.0 - August 17th, 2003 - - // Permission is hereby granted, free of charge, to any person or - // organization obtaining a copy of the software and accompanying - // documentation covered by this license (the "Software") to use, - // reproduce, display, distribute, execute, and transmit the - // Software, and to prepare derivative works of the Software, and - // to permit third-parties to whom the Software is furnished to do - // so, all subject to the following: - - // The copyright notices in the Software and this entire - // statement, including the above license grant, this restriction - // and the following disclaimer, must be included in all copies of - // the Software, in whole or in part, and all derivative works of - // the Software, unless such copies or derivative works are solely - // in the form of machine-executable object code generated by a - // source language processor. - - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND - // NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR - // ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR - // OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, - // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - const scalar r6 = 1.0/6.0; - const scalar r24 = 1.0/24.0; - const scalar r60 = 1.0/60.0; - const scalar r120 = 1.0/120.0; - - // order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx - scalarField integrals(10, 0.0); - - forAll(triFaces, i) - { - const triFace& tri(triFaces[i]); - - // vertices of triangle i - vector v0 = pts[tri[0]]; - vector v1 = pts[tri[1]]; - vector v2 = pts[tri[2]]; - - // cross product of edges - vector eA = v1 - v0; - vector eB = v2 - v0; - vector n = eA ^ eB; - - // compute integral terms - scalar tmp0, tmp1, tmp2; - - scalar f1x, f2x, f3x, g0x, g1x, g2x; - - tmp0 = v0.x() + v1.x(); - f1x = tmp0 + v2.x(); - tmp1 = v0.x()*v0.x(); - tmp2 = tmp1 + v1.x()*tmp0; - f2x = tmp2 + v2.x()*f1x; - f3x = v0.x()*tmp1 + v1.x()*tmp2 + v2.x()*f2x; - g0x = f2x + v0.x()*(f1x + v0.x()); - g1x = f2x + v1.x()*(f1x + v1.x()); - g2x = f2x + v2.x()*(f1x + v2.x()); - - scalar f1y, f2y, f3y, g0y, g1y, g2y; - - tmp0 = v0.y() + v1.y(); - f1y = tmp0 + v2.y(); - tmp1 = v0.y()*v0.y(); - tmp2 = tmp1 + v1.y()*tmp0; - f2y = tmp2 + v2.y()*f1y; - f3y = v0.y()*tmp1 + v1.y()*tmp2 + v2.y()*f2y; - g0y = f2y + v0.y()*(f1y + v0.y()); - g1y = f2y + v1.y()*(f1y + v1.y()); - g2y = f2y + v2.y()*(f1y + v2.y()); - - scalar f1z, f2z, f3z, g0z, g1z, g2z; - - tmp0 = v0.z() + v1.z(); - f1z = tmp0 + v2.z(); - tmp1 = v0.z()*v0.z(); - tmp2 = tmp1 + v1.z()*tmp0; - f2z = tmp2 + v2.z()*f1z; - f3z = v0.z()*tmp1 + v1.z()*tmp2 + v2.z()*f2z; - g0z = f2z + v0.z()*(f1z + v0.z()); - g1z = f2z + v1.z()*(f1z + v1.z()); - g2z = f2z + v2.z()*(f1z + v2.z()); - - // update integrals - integrals[0] += n.x()*f1x; - integrals[1] += n.x()*f2x; - integrals[2] += n.y()*f2y; - integrals[3] += n.z()*f2z; - integrals[4] += n.x()*f3x; - integrals[5] += n.y()*f3y; - integrals[6] += n.z()*f3z; - integrals[7] += n.x()*(v0.y()*g0x + v1.y()*g1x + v2.y()*g2x); - integrals[8] += n.y()*(v0.z()*g0y + v1.z()*g1y + v2.z()*g2y); - integrals[9] += n.z()*(v0.x()*g0z + v1.x()*g1z + v2.x()*g2z); - } - - integrals[0] *= r6; - integrals[1] *= r24; - integrals[2] *= r24; - integrals[3] *= r24; - integrals[4] *= r60; - integrals[5] *= r60; - integrals[6] *= r60; - integrals[7] *= r120; - integrals[8] *= r120; - integrals[9] *= r120; - - // mass - mass = integrals[0]; - - // center of mass - cM = vector(integrals[1], integrals[2], integrals[3])/mass; - - // inertia relative to origin - J.xx() = integrals[5] + integrals[6]; - J.xy() = -integrals[7]; - J.xz() = -integrals[9]; - J.yx() = J.xy(); - J.yy() = integrals[4] + integrals[6]; - J.yz() = -integrals[8]; - J.zx() = J.xz(); - J.zy() = J.yz(); - J.zz() = integrals[4] + integrals[5]; - - // inertia relative to center of mass - J -= mass*((cM & cM)*I - cM*cM); - - // Apply density - mass *= density; - J *= density; -} - - int main(int argc, char *argv[]) { + argList::addOption + ( + "cell", + "label", + "cell to use for inertia calculation, defaults to 0" + ); + + #include "setRootCase.H" + #include "createTime.H" + #include "createPolyMesh.H" + scalar density = 1.0; { @@ -286,16 +144,7 @@ int main(int argc, char *argv[]) vector cM = vector::zero; tensor J = tensor::zero; - massPropertiesSolid - ( - - pts, - tetFaces, - density, - m, - cM, - J - ); + momentOfInertia::massPropertiesSolid(pts, tetFaces, density, m, cM, J); vector eVal = eigenValues(J); @@ -344,7 +193,50 @@ int main(int argc, char *argv[]) { str << "l " << nPts + 1 << ' ' << i + 1 << endl; } + } + { + const label cellI = args.optionLookupOrDefault("cell", 0); + + tensorField mI = momentOfInertia::meshInertia(mesh); + + tensor& J = mI[cellI]; + + vector eVal = eigenValues(J); + + Info<< nl + << "Inertia tensor of cell " << cellI << " " << J << nl + << "eigenValues (principal moments) " << eVal << endl; + + J /= cmptMax(eVal); + + tensor eVec = eigenVectors(J); + + Info<< "eigenVectors (principal axes, from normalised inertia) " << eVec + << endl; + + OFstream str("cell_" + name(cellI) + "_inertia.obj"); + + Info<< nl << "Writing scaled principal axes of cell " << cellI << " to " + << str.name() << endl; + + const point& cC = mesh.cellCentres()[cellI]; + + scalar scale = mag + ( + (cC - mesh.faceCentres()[mesh.cells()[cellI][0]]) + /eVal.component(findMin(eVal)) + ); + + meshTools::writeOBJ(str, cC); + meshTools::writeOBJ(str, cC + scale*eVal.x()*eVec.x()); + meshTools::writeOBJ(str, cC + scale*eVal.y()*eVec.y()); + meshTools::writeOBJ(str, cC + scale*eVal.z()*eVec.z()); + + for (label i = 1; i < 4; i++) + { + str << "l " << 1 << ' ' << i + 1 << endl; + } } Info<< nl << "End" << nl << endl; diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C index f72bcb6e5e..2b8183295f 100644 --- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C +++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.C @@ -33,9 +33,6 @@ Description #include "argList.H" #include "ListOps.H" -#include "face.H" -#include "tetPointRef.H" -#include "triFaceList.H" #include "triSurface.H" #include "OFstream.H" #include "meshTools.H" @@ -43,242 +40,12 @@ Description #include "transform.H" #include "IOmanip.H" #include "Pair.H" +#include "momentOfInertia.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // using namespace Foam; -void massPropertiesSolid -( - const pointField& pts, - const triFaceList& triFaces, - scalar density, - scalar& mass, - vector& cM, - tensor& J -) -{ - // Reimplemented from: Wm4PolyhedralMassProperties.cpp - // File Version: 4.10.0 (2009/11/18) - - // Geometric Tools, LC - // Copyright (c) 1998-2010 - // Distributed under the Boost Software License, Version 1.0. - // http://www.boost.org/LICENSE_1_0.txt - // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt - - // Boost Software License - Version 1.0 - August 17th, 2003 - - // Permission is hereby granted, free of charge, to any person or - // organization obtaining a copy of the software and accompanying - // documentation covered by this license (the "Software") to use, - // reproduce, display, distribute, execute, and transmit the - // Software, and to prepare derivative works of the Software, and - // to permit third-parties to whom the Software is furnished to do - // so, all subject to the following: - - // The copyright notices in the Software and this entire - // statement, including the above license grant, this restriction - // and the following disclaimer, must be included in all copies of - // the Software, in whole or in part, and all derivative works of - // the Software, unless such copies or derivative works are solely - // in the form of machine-executable object code generated by a - // source language processor. - - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND - // NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR - // ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR - // OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, - // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - const scalar r6 = 1.0/6.0; - const scalar r24 = 1.0/24.0; - const scalar r60 = 1.0/60.0; - const scalar r120 = 1.0/120.0; - - // order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx - scalarField integrals(10, 0.0); - - forAll(triFaces, i) - { - const triFace& tri(triFaces[i]); - - // vertices of triangle i - vector v0 = pts[tri[0]]; - vector v1 = pts[tri[1]]; - vector v2 = pts[tri[2]]; - - // cross product of edges - vector eA = v1 - v0; - vector eB = v2 - v0; - vector n = eA ^ eB; - - // compute integral terms - scalar tmp0, tmp1, tmp2; - - scalar f1x, f2x, f3x, g0x, g1x, g2x; - - tmp0 = v0.x() + v1.x(); - f1x = tmp0 + v2.x(); - tmp1 = v0.x()*v0.x(); - tmp2 = tmp1 + v1.x()*tmp0; - f2x = tmp2 + v2.x()*f1x; - f3x = v0.x()*tmp1 + v1.x()*tmp2 + v2.x()*f2x; - g0x = f2x + v0.x()*(f1x + v0.x()); - g1x = f2x + v1.x()*(f1x + v1.x()); - g2x = f2x + v2.x()*(f1x + v2.x()); - - scalar f1y, f2y, f3y, g0y, g1y, g2y; - - tmp0 = v0.y() + v1.y(); - f1y = tmp0 + v2.y(); - tmp1 = v0.y()*v0.y(); - tmp2 = tmp1 + v1.y()*tmp0; - f2y = tmp2 + v2.y()*f1y; - f3y = v0.y()*tmp1 + v1.y()*tmp2 + v2.y()*f2y; - g0y = f2y + v0.y()*(f1y + v0.y()); - g1y = f2y + v1.y()*(f1y + v1.y()); - g2y = f2y + v2.y()*(f1y + v2.y()); - - scalar f1z, f2z, f3z, g0z, g1z, g2z; - - tmp0 = v0.z() + v1.z(); - f1z = tmp0 + v2.z(); - tmp1 = v0.z()*v0.z(); - tmp2 = tmp1 + v1.z()*tmp0; - f2z = tmp2 + v2.z()*f1z; - f3z = v0.z()*tmp1 + v1.z()*tmp2 + v2.z()*f2z; - g0z = f2z + v0.z()*(f1z + v0.z()); - g1z = f2z + v1.z()*(f1z + v1.z()); - g2z = f2z + v2.z()*(f1z + v2.z()); - - // update integrals - integrals[0] += n.x()*f1x; - integrals[1] += n.x()*f2x; - integrals[2] += n.y()*f2y; - integrals[3] += n.z()*f2z; - integrals[4] += n.x()*f3x; - integrals[5] += n.y()*f3y; - integrals[6] += n.z()*f3z; - integrals[7] += n.x()*(v0.y()*g0x + v1.y()*g1x + v2.y()*g2x); - integrals[8] += n.y()*(v0.z()*g0y + v1.z()*g1y + v2.z()*g2y); - integrals[9] += n.z()*(v0.x()*g0z + v1.x()*g1z + v2.x()*g2z); - } - - integrals[0] *= r6; - integrals[1] *= r24; - integrals[2] *= r24; - integrals[3] *= r24; - integrals[4] *= r60; - integrals[5] *= r60; - integrals[6] *= r60; - integrals[7] *= r120; - integrals[8] *= r120; - integrals[9] *= r120; - - // mass - mass = integrals[0]; - - // center of mass - cM = vector(integrals[1], integrals[2], integrals[3])/mass; - - // inertia relative to origin - J.xx() = integrals[5] + integrals[6]; - J.xy() = -integrals[7]; - J.xz() = -integrals[9]; - J.yx() = J.xy(); - J.yy() = integrals[4] + integrals[6]; - J.yz() = -integrals[8]; - J.zx() = J.xz(); - J.zy() = J.yz(); - J.zz() = integrals[4] + integrals[5]; - - // inertia relative to center of mass - J -= mass*((cM & cM)*I - cM*cM); - - // Apply density - mass *= density; - J *= density; -} - - -void massPropertiesShell -( - const pointField& pts, - const triFaceList& triFaces, - scalar density, - scalar& mass, - vector& cM, - tensor& J -) -{ - // Reset properties for accumulation - - mass = 0.0; - cM = vector::zero; - J = tensor::zero; - - // Find centre of mass - - forAll(triFaces, i) - { - const triFace& tri(triFaces[i]); - - triPointRef t - ( - pts[tri[0]], - pts[tri[1]], - pts[tri[2]] - ); - - scalar triMag = t.mag(); - - cM += triMag*t.centre(); - - mass += triMag; - } - - cM /= mass; - - mass *= density; - - // Find inertia around centre of mass - - forAll(triFaces, i) - { - const triFace& tri(triFaces[i]); - - J += triPointRef - ( - pts[tri[0]], - pts[tri[1]], - pts[tri[2]] - ).inertia(cM, density); - } -} - - -tensor applyParallelAxisTheorem -( - scalar m, - const vector& cM, - const tensor& J, - const vector& refPt -) -{ - // The displacement vector (refPt = cM) is the displacement of the - // new reference point from the centre of mass of the body that - // the inertia tensor applies to. - - vector d = (refPt - cM); - - return J + m*((d & d)*I - d*d); -} - - int main(int argc, char *argv[]) { argList::addNote @@ -321,40 +88,17 @@ int main(int argc, char *argv[]) triSurface surf(surfFileName); - triFaceList faces(surf.size()); - - forAll(surf, i) - { - faces[i] = triFace(surf[i]); - } - scalar m = 0.0; vector cM = vector::zero; tensor J = tensor::zero; if (args.optionFound("shellProperties")) { - massPropertiesShell - ( - surf.points(), - faces, - density, - m, - cM, - J - ); + momentOfInertia::massPropertiesShell(surf, density, m, cM, J); } else { - massPropertiesSolid - ( - surf.points(), - faces, - density, - m, - cM, - J - ); + momentOfInertia::massPropertiesSolid(surf, density, m, cM, J); } if (m < 0) @@ -583,7 +327,7 @@ int main(int argc, char *argv[]) showTransform = false; } - Info<< nl << setprecision(10) + Info<< nl << setprecision(12) << "Density: " << density << nl << "Mass: " << m << nl << "Centre of mass: " << cM << nl @@ -615,7 +359,7 @@ int main(int argc, char *argv[]) if (calcAroundRefPt) { Info<< nl << "Inertia tensor relative to " << refPt << ": " << nl - << applyParallelAxisTheorem(m, cM, J, refPt) + << momentOfInertia::applyParallelAxisTheorem(m, cM, J, refPt) << endl; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H index 3e5ee425d6..3a7513770d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H @@ -41,6 +41,7 @@ SourceFiles #include "tetPointRef.H" #include "triPointRef.H" #include "polyMesh.H" +#include "triFace.H" #include "face.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -146,6 +147,10 @@ public: // mesh face for this tet from the supplied mesh inline triPointRef faceTri(const polyMesh& mesh) const; + //- Return the point indices corresponding to the tri on the mesh + // face for this tet from the supplied mesh + inline triFace faceTriIs(const polyMesh& mesh) const; + //- Return the geometry corresponding to the tri on the // mesh face for this tet from the supplied mesh using // the old position diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H index 6b8a7871a0..9a4287b5c4 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndicesI.H @@ -122,6 +122,21 @@ Foam::triPointRef Foam::tetIndices::faceTri(const polyMesh& mesh) const } +Foam::triFace Foam::tetIndices::faceTriIs(const polyMesh& mesh) const +{ + const faceList& pFaces = mesh.faces(); + + const Foam::face& f = pFaces[faceI_]; + + return triFace + ( + f[faceBasePtI_], + f[facePtAI_], + f[facePtBI_] + ); +} + + Foam::triPointRef Foam::tetIndices::oldFaceTri(const polyMesh& mesh) const { const pointField& oldPPts = mesh.oldPoints(); diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 2c9f81195d..47310b27e3 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -127,6 +127,7 @@ $(cellZoneSources)/setToCellZone/setToCellZone.C pointZoneSources = sets/pointZoneSources $(pointZoneSources)/setToPointZone/setToPointZone.C +momentOfInertia/momentOfInertia.C surfaceSets/surfaceSets.C diff --git a/src/meshTools/momentOfInertia/momentOfInertia.C b/src/meshTools/momentOfInertia/momentOfInertia.C index af3265a5ec..8dc1a53d61 100644 --- a/src/meshTools/momentOfInertia/momentOfInertia.C +++ b/src/meshTools/momentOfInertia/momentOfInertia.C @@ -21,382 +21,328 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - momentOfInertia - -Description - Reimplementation of volInt.c by Brian Mirtich. - * mirtich@cs.berkeley.edu * - * http://www.cs.berkeley.edu/~mirtich * - -------------------------------------------------------------------------------- -*/ +\*---------------------------------------------------------------------------*/ #include "momentOfInertia.H" -//#include "pyramidPointFaceRef.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -//Foam::tensor Foam::momentOfInertia -//( -// const pointField& points, -// const faceList& faces, -// const cell& cFaces, -// const point& cc -//) -//{ -// tensor t(tensor::zero); -// -// forAll(cFaces, i) -// { -// const face& f = faces[cFaces[i]]; -// -// scalar pyrVol = pyramidPointFaceRef(f, cc).mag(points); -// -// vector pyrCentre = pyramidPointFaceRef(f, cc).centre(points); -// -// vector d = pyrCentre - cc; -// -// t.xx() += pyrVol*(sqr(d.y()) + sqr(d.z())); -// t.yy() += pyrVol*(sqr(d.x()) + sqr(d.z())); -// t.zz() += pyrVol*(sqr(d.x()) + sqr(d.y())); -// -// t.xy() -= pyrVol*d.x()*d.y(); -// t.xz() -= pyrVol*d.x()*d.z(); -// t.yz() -= pyrVol*d.y()*d.z(); -// } -// -// // Symmetric -// t.yx() = t.xy(); -// t.zx() = t.xz(); -// t.zy() = t.yz(); -// -// return t; -//} - - -#define sqr(x) ((x)*(x)) -#define pow3(x) ((x)*(x)*(x)) - -// compute various integrations over projection of face -void Foam::compProjectionIntegrals +void Foam::momentOfInertia::massPropertiesSolid ( - const pointField& points, - const face& f, - const direction A, - const direction B, - - scalar& P1, - scalar& Pa, - scalar& Pb, - scalar& Paa, - scalar& Pab, - scalar& Pbb, - scalar& Paaa, - scalar& Paab, - scalar& Pabb, - scalar& Pbbb -) -{ - P1 = Pa = Pb = Paa = Pab = Pbb = Paaa = Paab = Pabb = Pbbb = 0.0; - - forAll(f, i) - { - scalar a0 = points[f[i]][A]; - scalar b0 = points[f[i]][B]; - scalar a1 = points[f[(i+1) % f.size()]][A]; - scalar b1 = points[f[(i+1) % f.size()]][B]; - scalar da = a1 - a0; - scalar db = b1 - b0; - - scalar a0_2 = a0 * a0; - scalar a0_3 = a0_2 * a0; - scalar a0_4 = a0_3 * a0; - - scalar b0_2 = b0 * b0; - scalar b0_3 = b0_2 * b0; - scalar b0_4 = b0_3 * b0; - - scalar a1_2 = a1 * a1; - scalar a1_3 = a1_2 * a1; - - scalar b1_2 = b1 * b1; - scalar b1_3 = b1_2 * b1; - - scalar C1 = a1 + a0; - - scalar Ca = a1*C1 + a0_2; - scalar Caa = a1*Ca + a0_3; - scalar Caaa = a1*Caa + a0_4; - - scalar Cb = b1*(b1 + b0) + b0_2; - scalar Cbb = b1*Cb + b0_3; - scalar Cbbb = b1*Cbb + b0_4; - - scalar Cab = 3*a1_2 + 2*a1*a0 + a0_2; - scalar Kab = a1_2 + 2*a1*a0 + 3*a0_2; - - scalar Caab = a0*Cab + 4*a1_3; - scalar Kaab = a1*Kab + 4*a0_3; - - scalar Cabb = 4*b1_3 + 3*b1_2*b0 + 2*b1*b0_2 + b0_3; - scalar Kabb = b1_3 + 2*b1_2*b0 + 3*b1*b0_2 + 4*b0_3; - - P1 += db*C1; - Pa += db*Ca; - Paa += db*Caa; - Paaa += db*Caaa; - Pb += da*Cb; - Pbb += da*Cbb; - Pbbb += da*Cbbb; - Pab += db*(b1*Cab + b0*Kab); - Paab += db*(b1*Caab + b0*Kaab); - Pabb += da*(a1*Cabb + a0*Kabb); - } - - P1 /= 2.0; - Pa /= 6.0; - Paa /= 12.0; - Paaa /= 20.0; - Pb /= -6.0; - Pbb /= -12.0; - Pbbb /= -20.0; - Pab /= 24.0; - Paab /= 60.0; - Pabb /= -60.0; -} - - -void Foam::compFaceIntegrals -( - const pointField& points, - const face& f, - const vector& n, - const scalar w, - const direction A, - const direction B, - const direction C, - - scalar& Fa, - scalar& Fb, - scalar& Fc, - scalar& Faa, - scalar& Fbb, - scalar& Fcc, - scalar& Faaa, - scalar& Fbbb, - scalar& Fccc, - scalar& Faab, - scalar& Fbbc, - scalar& Fcca -) -{ - scalar P1, Pa, Pb, Paa, Pab, Pbb, Paaa, Paab, Pabb, Pbbb; - - compProjectionIntegrals - ( - points, - f, - A, - B, - - P1, - Pa, - Pb, - Paa, - Pab, - Pbb, - Paaa, - Paab, - Pabb, - Pbbb - ); - - scalar k1 = 1 / n[C]; - scalar k2 = k1 * k1; - scalar k3 = k2 * k1; - scalar k4 = k3 * k1; - - Fa = k1 * Pa; - Fb = k1 * Pb; - Fc = -k2 * (n[A]*Pa + n[B]*Pb + w*P1); - - Faa = k1 * Paa; - Fbb = k1 * Pbb; - Fcc = k3 * (sqr(n[A])*Paa + 2*n[A]*n[B]*Pab + sqr(n[B])*Pbb - + w*(2*(n[A]*Pa + n[B]*Pb) + w*P1)); - - Faaa = k1 * Paaa; - Fbbb = k1 * Pbbb; - Fccc = -k4 * (pow3(n[A])*Paaa + 3*sqr(n[A])*n[B]*Paab - + 3*n[A]*sqr(n[B])*Pabb + pow3(n[B])*Pbbb - + 3*w*(sqr(n[A])*Paa + 2*n[A]*n[B]*Pab + sqr(n[B])*Pbb) - + w*w*(3*(n[A]*Pa + n[B]*Pb) + w*P1)); - - Faab = k1 * Paab; - Fbbc = -k2 * (n[A]*Pabb + n[B]*Pbbb + w*Pbb); - Fcca = k3 * (sqr(n[A])*Paaa + 2*n[A]*n[B]*Paab + sqr(n[B])*Pabb - + w*(2*(n[A]*Paa + n[B]*Pab) + w*Pa)); -} - - -void Foam::compVolumeIntegrals -( - const pointField& points, - const faceList& faces, - const cell& cFaces, - const vectorField& fNorm, - const scalarField& fW, - - scalar& T0, - vector& T1, - vector& T2, - vector& TP -) -{ - T0 = 0; - T1 = vector::zero; - T2 = vector::zero; - TP = vector::zero; - - forAll(cFaces, i) - { - const vector& n = fNorm[i]; - - scalar nx = mag(n[0]); - scalar ny = mag(n[1]); - scalar nz = mag(n[2]); - - direction A, B, C; - - if (nx > ny && nx > nz) - { - C = 0; - } - else - { - C = (ny > nz) ? 1 : 2; - } - - A = (C + 1) % 3; - B = (A + 1) % 3; - - scalar Fa, Fb, Fc, Faa, Fbb, Fcc, Faaa, Fbbb, Fccc, Faab, Fbbc, Fcca; - compFaceIntegrals - ( - points, - faces[cFaces[i]], - n, - fW[i], - A, - B, - C, - - Fa, - Fb, - Fc, - Faa, - Fbb, - Fcc, - Faaa, - Fbbb, - Fccc, - Faab, - Fbbc, - Fcca - ); - - T0 += n[0] * ((A == 0) ? Fa : ((B == 0) ? Fb : Fc)); - - T1[A] += n[A] * Faa; - T1[B] += n[B] * Fbb; - T1[C] += n[C] * Fcc; - - T2[A] += n[A] * Faaa; - T2[B] += n[B] * Fbbb; - T2[C] += n[C] * Fccc; - - TP[A] += n[A] * Faab; - TP[B] += n[B] * Fbbc; - TP[C] += n[C] * Fcca; - } - - T1 /= 2; - T2 /= 3; - TP /= 2; -} - - -// Calculate -// - r: centre of mass -// - J: inertia around origin (point 0,0,0) -void Foam::momentOfIntertia -( - const pointField& points, - const faceList& faces, - const cell& cFaces, - point& r, + const pointField& pts, + const triFaceList& triFaces, + scalar density, + scalar& mass, + vector& cM, tensor& J ) { - // Face normals - vectorField fNorm(cFaces.size()); - scalarField fW(cFaces.size()); + // Reimplemented from: Wm4PolyhedralMassProperties.cpp + // File Version: 4.10.0 (2009/11/18) - forAll(cFaces, i) + // Geometric Tools, LC + // Copyright (c) 1998-2010 + // Distributed under the Boost Software License, Version 1.0. + // http://www.boost.org/LICENSE_1_0.txt + // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt + + // Boost Software License - Version 1.0 - August 17th, 2003 + + // Permission is hereby granted, free of charge, to any person or + // organization obtaining a copy of the software and accompanying + // documentation covered by this license (the "Software") to use, + // reproduce, display, distribute, execute, and transmit the + // Software, and to prepare derivative works of the Software, and + // to permit third-parties to whom the Software is furnished to do + // so, all subject to the following: + + // The copyright notices in the Software and this entire + // statement, including the above license grant, this restriction + // and the following disclaimer, must be included in all copies of + // the Software, in whole or in part, and all derivative works of + // the Software, unless such copies or derivative works are solely + // in the form of machine-executable object code generated by a + // source language processor. + + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND + // NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + // ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR + // OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + const scalar r6 = 1.0/6.0; + const scalar r24 = 1.0/24.0; + const scalar r60 = 1.0/60.0; + const scalar r120 = 1.0/120.0; + + // order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx + scalarField integrals(10, 0.0); + + forAll(triFaces, i) { - label faceI = cFaces[i]; + const triFace& tri(triFaces[i]); - const face& f = faces[faceI]; + // vertices of triangle i + vector v0 = pts[tri[0]]; + vector v1 = pts[tri[1]]; + vector v2 = pts[tri[2]]; - fNorm[i] = f.normal(points); - fNorm[i] /= mag(fNorm[i]) + VSMALL; + // cross product of edges + vector eA = v1 - v0; + vector eB = v2 - v0; + vector n = eA ^ eB; - fW[i] = - (fNorm[i] & points[f[0]]); + // compute integral terms + scalar tmp0, tmp1, tmp2; + + scalar f1x, f2x, f3x, g0x, g1x, g2x; + + tmp0 = v0.x() + v1.x(); + f1x = tmp0 + v2.x(); + tmp1 = v0.x()*v0.x(); + tmp2 = tmp1 + v1.x()*tmp0; + f2x = tmp2 + v2.x()*f1x; + f3x = v0.x()*tmp1 + v1.x()*tmp2 + v2.x()*f2x; + g0x = f2x + v0.x()*(f1x + v0.x()); + g1x = f2x + v1.x()*(f1x + v1.x()); + g2x = f2x + v2.x()*(f1x + v2.x()); + + scalar f1y, f2y, f3y, g0y, g1y, g2y; + + tmp0 = v0.y() + v1.y(); + f1y = tmp0 + v2.y(); + tmp1 = v0.y()*v0.y(); + tmp2 = tmp1 + v1.y()*tmp0; + f2y = tmp2 + v2.y()*f1y; + f3y = v0.y()*tmp1 + v1.y()*tmp2 + v2.y()*f2y; + g0y = f2y + v0.y()*(f1y + v0.y()); + g1y = f2y + v1.y()*(f1y + v1.y()); + g2y = f2y + v2.y()*(f1y + v2.y()); + + scalar f1z, f2z, f3z, g0z, g1z, g2z; + + tmp0 = v0.z() + v1.z(); + f1z = tmp0 + v2.z(); + tmp1 = v0.z()*v0.z(); + tmp2 = tmp1 + v1.z()*tmp0; + f2z = tmp2 + v2.z()*f1z; + f3z = v0.z()*tmp1 + v1.z()*tmp2 + v2.z()*f2z; + g0z = f2z + v0.z()*(f1z + v0.z()); + g1z = f2z + v1.z()*(f1z + v1.z()); + g2z = f2z + v2.z()*(f1z + v2.z()); + + // update integrals + integrals[0] += n.x()*f1x; + integrals[1] += n.x()*f2x; + integrals[2] += n.y()*f2y; + integrals[3] += n.z()*f2z; + integrals[4] += n.x()*f3x; + integrals[5] += n.y()*f3y; + integrals[6] += n.z()*f3z; + integrals[7] += n.x()*(v0.y()*g0x + v1.y()*g1x + v2.y()*g2x); + integrals[8] += n.y()*(v0.z()*g0y + v1.z()*g1y + v2.z()*g2y); + integrals[9] += n.z()*(v0.x()*g0z + v1.x()*g1z + v2.x()*g2z); } + integrals[0] *= r6; + integrals[1] *= r24; + integrals[2] *= r24; + integrals[3] *= r24; + integrals[4] *= r60; + integrals[5] *= r60; + integrals[6] *= r60; + integrals[7] *= r120; + integrals[8] *= r120; + integrals[9] *= r120; - scalar T0; - vector T1, T2, TP; + // mass + mass = integrals[0]; - compVolumeIntegrals - ( - points, - faces, - cFaces, - fNorm, - fW, + // center of mass + cM = vector(integrals[1], integrals[2], integrals[3])/mass; - T0, - T1, - T2, - TP - ); + // inertia relative to origin + J.xx() = integrals[5] + integrals[6]; + J.xy() = -integrals[7]; + J.xz() = -integrals[9]; + J.yx() = J.xy(); + J.yy() = integrals[4] + integrals[6]; + J.yz() = -integrals[8]; + J.zx() = J.xz(); + J.zy() = J.yz(); + J.zz() = integrals[4] + integrals[5]; - const scalar density = 1.0; /* assume unit density */ + // inertia relative to center of mass + J -= mass*((cM & cM)*I - cM*cM); - scalar mass = density * T0; - - /* compute center of mass */ - r = T1 / T0; - - /* compute inertia tensor */ - J.xx() = density * (T2[1] + T2[2]); - J.yy() = density * (T2[2] + T2[0]); - J.zz() = density * (T2[0] + T2[1]); - J.xy() = J.yx() = - density * TP[0]; - J.yz() = J.zy() = - density * TP[1]; - J.zx() = J.xz() = - density * TP[2]; - - ///* translate inertia tensor to center of mass */ - //J[XX] -= mass * (r[1]*r[1] + r[2]*r[2]); - //J[YY] -= mass * (r[2]*r[2] + r[0]*r[0]); - //J[ZZ] -= mass * (r[0]*r[0] + r[1]*r[1]); - //J[XY] = J[YX] += mass * r[0] * r[1]; - //J[YZ] = J[ZY] += mass * r[1] * r[2]; - //J[ZX] = J[XZ] += mass * r[2] * r[0]; + // Apply density + mass *= density; + J *= density; } +void Foam::momentOfInertia::massPropertiesShell +( + const pointField& pts, + const triFaceList& triFaces, + scalar density, + scalar& mass, + vector& cM, + tensor& J +) +{ + // Reset properties for accumulation + + mass = 0.0; + cM = vector::zero; + J = tensor::zero; + + // Find centre of mass + + forAll(triFaces, i) + { + const triFace& tri(triFaces[i]); + + triPointRef t + ( + pts[tri[0]], + pts[tri[1]], + pts[tri[2]] + ); + + scalar triMag = t.mag(); + + cM += triMag*t.centre(); + + mass += triMag; + } + + cM /= mass; + + mass *= density; + + // Find inertia around centre of mass + + forAll(triFaces, i) + { + const triFace& tri(triFaces[i]); + + J += triPointRef + ( + pts[tri[0]], + pts[tri[1]], + pts[tri[2]] + ).inertia(cM, density); + } +} + + +void Foam::momentOfInertia::massPropertiesSolid +( + const triSurface& surf, + scalar density, + scalar& mass, + vector& cM, + tensor& J +) +{ + triFaceList faces(surf.size()); + + forAll(surf, i) + { + faces[i] = triFace(surf[i]); + } + + massPropertiesSolid(surf.points(), faces, density, mass, cM, J); +} + + +void Foam::momentOfInertia::massPropertiesShell +( + const triSurface& surf, + scalar density, + scalar& mass, + vector& cM, + tensor& J +) +{ + triFaceList faces(surf.size()); + + forAll(surf, i) + { + faces[i] = triFace(surf[i]); + } + + massPropertiesShell(surf.points(), faces, density, mass, cM, J); +} + + +Foam::tensor Foam::momentOfInertia::applyParallelAxisTheorem +( + scalar mass, + const vector& cM, + const tensor& J, + const vector& refPt +) +{ + // The displacement vector (refPt = cM) is the displacement of the + // new reference point from the centre of mass of the body that + // the inertia tensor applies to. + + vector d = (refPt - cM); + + return J + mass*((d & d)*I - d*d); +} + + +Foam::tmp Foam::momentOfInertia::meshInertia +( + const polyMesh& mesh +) +{ + tmp tTf = tmp(new tensorField(mesh.nCells())); + + tensorField& tf = tTf(); + + forAll(tf, cI) + { + tf[cI] = meshInertia(mesh, cI); + } + + return tTf; +} + + +Foam::tensor Foam::momentOfInertia::meshInertia +( + const polyMesh& mesh, + label cellI +) +{ + List cellTets = polyMeshTetDecomposition::cellTetIndices + ( + mesh, + cellI + ); + + triFaceList faces(cellTets.size()); + + forAll(cellTets, cTI) + { + faces[cTI] = cellTets[cTI].faceTriIs(mesh); + } + + scalar m = 0.0; + vector cM = vector::zero; + tensor J = tensor::zero; + + massPropertiesSolid(mesh.points(), faces, 1.0, m, cM, J); + + return J; +} + // ************************************************************************* // diff --git a/src/meshTools/momentOfInertia/momentOfInertia.H b/src/meshTools/momentOfInertia/momentOfInertia.H index 8ff6209f0b..bb5ffef6a8 100644 --- a/src/meshTools/momentOfInertia/momentOfInertia.H +++ b/src/meshTools/momentOfInertia/momentOfInertia.H @@ -25,6 +25,9 @@ Class momentOfInertia Description + Calculates the inertia tensor and principal axes and moments of a + polyhedra/cells/triSurfaces. Inertia can either be of the solid body or + of a thin shell. SourceFiles momentOfInertia.H @@ -34,34 +37,86 @@ SourceFiles #ifndef momentOfInertia_H #define momentOfInertia_H -#include "tensor.H" -#include "primitiveMesh.H" +#include "tetPointRef.H" +#include "triFaceList.H" +#include "triSurface.H" +#include "polyMesh.H" +#include "polyMeshTetDecomposition.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -////- Moment of inertia around cell centre for single cell. -//tensor momentOfInertia -//( -// const pointField&, -// const faceList&, -// const cell&, -// const point& cc -//); +/*---------------------------------------------------------------------------*\ + Class momentOfInertia Declaration +\*---------------------------------------------------------------------------*/ + +class momentOfInertia +{ + +public: + + static void massPropertiesSolid + ( + const pointField& pts, + const triFaceList& triFaces, + scalar density, + scalar& mass, + vector& cM, + tensor& J + ); + + static void massPropertiesShell + ( + const pointField& pts, + const triFaceList& triFaces, + scalar density, + scalar& mass, + vector& cM, + tensor& J + ); + + static void massPropertiesSolid + ( + const triSurface& surf, + scalar density, + scalar& mass, + vector& cM, + tensor& J + ); + + static void massPropertiesShell + ( + const triSurface& surf, + scalar density, + scalar& mass, + vector& cM, + tensor& J + ); + + static tensor applyParallelAxisTheorem + ( + scalar mass, + const vector& cM, + const tensor& J, + const vector& refPt + ); + + // Calculate the inertia tensor for all cells in the mesh + static tmp meshInertia + ( + const polyMesh& mesh + ); + + // Calculate the inertia tensor the given cell + static tensor meshInertia + ( + const polyMesh& mesh, + label cellI + ); +}; -// Calculate -// - centre of mass -// - inertia tensor around (0,0,0) -void momentOfIntertia -( - const pointField&, - const faceList&, - const cell&, - point& r, - tensor& Jorigin -); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 7bcd87eb868b8edc96aaac45bb7e87021a112d25 Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 15 Dec 2010 17:50:32 +0000 Subject: [PATCH 11/15] ENH: triangle and tetrahedron robustness improvements. Currently very verbose when a degenerate shape is encountered. --- .../tetrahedron/tetrahedronI.H | 67 +++++---- .../primitiveShapes/triangle/triangleI.H | 129 +++++++++++++++--- 2 files changed, 150 insertions(+), 46 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H index 3a670f39a4..46a3adaea7 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H @@ -156,29 +156,12 @@ inline Point tetrahedron::circumCentre() const if (Foam::mag(denom) < ROOTVSMALL) { - // Degenerate tet. Use test of the individual triangles. - { - point triCentre = triPointRef(a_, b_, c_).circumCentre(); - if (magSqr(d_ - triCentre) < magSqr(a_ - triCentre)) - { - return triCentre; - } - } - { - point triCentre = triPointRef(a_, b_, d_).circumCentre(); - if (magSqr(c_ - triCentre) < magSqr(a_ - triCentre)) - { - return triCentre; - } - } - { - point triCentre = triPointRef(a_, c_, d_).circumCentre(); - if (magSqr(b_ - triCentre) < magSqr(a_ - triCentre)) - { - return triCentre; - } - } - return triPointRef(b_, c_, d_).circumCentre(); + WarningIn("Point tetrahedron::circumCentre() const") + << "Degenerate tetrahedron:" << nl << *this << nl + <<"Returning centre instead of circumCentre." + << endl; + + return centre(); } return a_ + 0.5*(a + num/denom); @@ -188,16 +171,43 @@ inline Point tetrahedron::circumCentre() const template inline scalar tetrahedron::circumRadius() const { - return Foam::mag(a_ - circumCentre()); + vector a = b_ - a_; + vector b = c_ - a_; + vector c = d_ - a_; + + scalar lambda = magSqr(c) - (a & c); + scalar mu = magSqr(b) - (a & b); + + vector ba = b ^ a; + vector ca = c ^ a; + + vector num = lambda*ba - mu*ca; + scalar denom = (c & ba); + + if (Foam::mag(denom) < ROOTVSMALL) + { + WarningIn("Point tetrahedron::circumCentre() const") + << "Degenerate tetrahedron:" << nl << *this << nl + << "Returning GREAT for circumRadius." + << endl; + + return GREAT; + } + + return Foam::mag(0.5*(a + num/denom)); } template inline scalar tetrahedron::quality() const { - // Note: 8/(9*sqrt(3)) = 0.5132002393 - - return mag()/(0.5132002393*pow3(min(circumRadius(), GREAT)) + ROOTVSMALL); + return + mag() + /( + 8.0/(9.0*sqrt(3.0)) + *pow3(min(circumRadius(), GREAT)) + + ROOTVSMALL + ); } @@ -266,7 +276,8 @@ scalar tetrahedron::barycentric "const point& pt" ") const" ) - << "Degenerate tetrahedron - returning 1/4 barycentric coordinates." + << "Degenerate tetrahedron:" << nl << *this << nl + << "Returning 1/4 barycentric coordinates." << endl; bary = List(4, 0.25); diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index 7840d8ee7b..b99ba990cd 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -109,9 +109,9 @@ inline vector triangle::normal() const template inline Point triangle::circumCentre() const { - scalar d1 = (c_ - a_)&(b_ - a_); - scalar d2 = -(c_ - b_)&(b_ - a_); - scalar d3 = (c_ - a_)&(c_ - b_); + scalar d1 = (c_ - a_) & (b_ - a_); + scalar d2 = -(c_ - b_) & (b_ - a_); + scalar d3 = (c_ - a_) & (c_ - b_); scalar c1 = d2*d3; scalar c2 = d3*d1; @@ -119,6 +119,16 @@ inline Point triangle::circumCentre() const scalar c = c1 + c2 + c3; + if (Foam::mag(c) < ROOTVSMALL) + { + WarningIn("Point triangle::circumCentre() const") + << "Degenerate triangle:" << nl << *this << nl + << "Returning centre instead of circumCentre." + << endl; + + return centre(); + } + return ( ((c2 + c3)*a_ + (c3 + c1)*b_ + (c1 + c2)*c_)/(2*c) @@ -129,14 +139,19 @@ inline Point triangle::circumCentre() const template inline scalar triangle::circumRadius() const { - scalar d1 = (c_ - a_) & (b_ - a_); - scalar d2 = - (c_ - b_) & (b_ - a_); - scalar d3 = (c_ - a_) & (c_ - b_); + scalar d1 = (c_ - a_) & (b_ - a_); + scalar d2 = -(c_ - b_) & (b_ - a_); + scalar d3 = (c_ - a_) & (c_ - b_); scalar denom = d2*d3 + d3*d1 + d1*d2; if (Foam::mag(denom) < VSMALL) { + WarningIn("scalar triangle::circumRadius() const") + << "Degenerate triangle:" << nl << *this << nl + << "Returning GREAT for circumRadius." + << endl; + return GREAT; } else @@ -151,16 +166,7 @@ inline scalar triangle::circumRadius() const template inline scalar triangle::quality() const { - // Note: 3*sqr(3)/(4*pi) = 0.4134966716 - - return - mag() - / ( - constant::mathematical::pi - *Foam::sqr(circumRadius()) - *0.4134966716 - + VSMALL - ); + return mag()/(Foam::sqr(circumRadius())*3.0*sqrt(3.0)/4.0 + VSMALL); } @@ -264,7 +270,8 @@ scalar triangle::barycentric "const point& pt" ") const" ) - << "Degenerate triangle - returning 1/3 barycentric coordinates." + << "Degenerate triangle:" << nl << *this << nl + << "Returning 1/3 barycentric coordinates." << endl; bary = List(3, 1.0/3.0); @@ -490,7 +497,7 @@ pointHit triangle::nearestPointClassify ) const { // Adapted from: - // Real-time collision detection, Christer Ericson, 2005, 136-142 + // Real-time collision detection, Christer Ericson, 2005, p136-142 // Check if P in vertex region outside A vector ab = b_ - a_; @@ -528,6 +535,27 @@ pointHit triangle::nearestPointClassify if (vc <= 0.0 && d1 >= 0.0 && d3 <= 0.0) { + if ((d1 - d3) < ROOTVSMALL) + { + WarningIn + ( + "pointHit triangle::nearestPointClassify" + "(" + "const point& p," + "label& nearType," + "label& nearLabel" + ") const" + ) + << "Degenerate triangle:" << nl << *this << nl + << "d1, d3: " << d1 << ", " << d3 << endl; + + // For d1 = d3, a_ and b_ are likely coincident. + + nearType = POINT; + nearLabel = 0; + return pointHit(false, a_, Foam::mag(a_ - p), true); + } + // barycentric coordinates (1-v, v, 0) scalar v = d1/(d1 - d3); @@ -556,6 +584,27 @@ pointHit triangle::nearestPointClassify if (vb <= 0.0 && d2 >= 0.0 && d6 <= 0.0) { + if ((d2 - d6) < ROOTVSMALL) + { + WarningIn + ( + "pointHit triangle::nearestPointClassify" + "(" + "const point& p," + "label& nearType," + "label& nearLabel" + ") const" + ) + << "Degenerate triangle:" << nl << *this << nl + << "d2, d6: " << d2 << ", " << d6 << endl; + + // For d2 = d6, a_ and c_ are likely coincident. + + nearType = POINT; + nearLabel = 0; + return pointHit(false, a_, Foam::mag(a_ - p), true); + } + // barycentric coordinates (1-w, 0, w) scalar w = d2/(d2 - d6); @@ -570,6 +619,28 @@ pointHit triangle::nearestPointClassify if (va <= 0.0 && (d4 - d3) >= 0.0 && (d5 - d6) >= 0.0) { + if (((d4 - d3) + (d5 - d6)) < ROOTVSMALL) + { + WarningIn + ( + "pointHit triangle::nearestPointClassify" + "(" + "const point& p," + "label& nearType," + "label& nearLabel" + ") const" + ) + << "Degenerate triangle:" << nl << *this << nl + << "(d4 - d3), (d6 - d5): " << (d4 - d3) << ", " << (d6 - d5) + << endl; + + // For (d4 - d3) = (d6 - d5), b_ and c_ are likely coincident. + + nearType = POINT; + nearLabel = 1; + return pointHit(false, b_, Foam::mag(b_ - p), true); + } + // barycentric coordinates (0, 1-w, w) scalar w = (d4 - d3)/((d4 - d3) + (d5 - d6)); @@ -581,6 +652,28 @@ pointHit triangle::nearestPointClassify // P inside face region. Compute Q through its barycentric // coordinates (u, v, w) + + if ((va + vb + vc) < ROOTVSMALL) + { + WarningIn + ( + "pointHit triangle::nearestPointClassify" + "(" + "const point& p," + "label& nearType," + "label& nearLabel" + ") const" + ) + << "Degenerate triangle:" << nl << *this << nl + << "va, vb, vc: " << va << ", " << vb << ", " << vc + << endl; + + point nearPt = centre(); + nearType = NONE, + nearLabel = -1; + return pointHit(true, nearPt, Foam::mag(nearPt - p), false); + } + scalar denom = 1.0/(va + vb + vc); scalar v = vb * denom; scalar w = vc * denom; From 46ec7d65d5dda9c350ad579db5a47f0e59478ad8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 16 Dec 2010 18:46:26 +0000 Subject: [PATCH 12/15] ENH: extrudeMesh : reorganisation. Added layers. --- .../{extrudeMesh => extrude}/Allwclean | 0 .../{extrudeMesh => extrude}/Allwmake | 0 .../{ => extrude}/extrudeMesh/Make/files | 0 .../{ => extrude}/extrudeMesh/Make/options | 0 .../extrudeMesh/createTimeExtruded.H | 0 .../{ => extrude}/extrudeMesh/extrudeMesh.C | 0 .../extrudeMesh/extrudeMeshDict} | 0 .../extrudeMesh/extrudeModel/Make/files | 0 .../extrudeMesh/extrudeModel/Make/options | 0 .../extrudeModel/extrudeModel/extrudeModel.C | 0 .../extrudeModel/extrudeModel/extrudeModel.H | 0 .../extrudeModel/extrudeModelNew.C | 0 .../linearDirection/linearDirection.C | 0 .../linearDirection/linearDirection.H | 0 .../extrudeModel/linearNormal/linearNormal.C | 0 .../extrudeModel/linearNormal/linearNormal.H | 0 .../extrudeModel/linearRadial/linearRadial.C | 0 .../extrudeModel/linearRadial/linearRadial.H | 0 .../extrudeModel/sigmaRadial/sigmaRadial.C | 0 .../extrudeModel/sigmaRadial/sigmaRadial.H | 0 .../extrudeMesh/extrudeModel/wedge/wedge.C | 0 .../extrudeMesh/extrudeModel/wedge/wedge.H | 0 .../extrudeMesh/extrudedMesh/extrudedMesh.C | 0 .../extrudeMesh/extrudedMesh/extrudedMesh.H | 0 .../extrude/extrudeModel/Make/files | 10 ++ .../extrude/extrudeModel/Make/options | 8 + .../extrudeModel/extrudeModel/extrudeModel.C | 89 +++++++++++ .../extrudeModel/extrudeModel/extrudeModel.H | 143 ++++++++++++++++++ .../extrudeModel/extrudeModelNew.C | 58 +++++++ .../linearDirection/linearDirection.C | 89 +++++++++++ .../linearDirection/linearDirection.H | 98 ++++++++++++ .../extrudeModel/linearNormal/linearNormal.C | 86 +++++++++++ .../extrudeModel/linearNormal/linearNormal.H | 95 ++++++++++++ .../extrudeModel/linearRadial/linearRadial.C | 82 ++++++++++ .../extrudeModel/linearRadial/linearRadial.H | 93 ++++++++++++ .../extrudeModel/sigmaRadial/sigmaRadial.C | 92 +++++++++++ .../extrudeModel/sigmaRadial/sigmaRadial.H | 94 ++++++++++++ .../extrude/extrudeModel/wedge/wedge.C | 125 +++++++++++++++ .../extrude/extrudeModel/wedge/wedge.H | 107 +++++++++++++ .../extrudeToRegionMesh/Make/files | 0 .../extrudeToRegionMesh/Make/options | 0 .../extrudeToRegionMesh/createShellMesh.C | 0 .../extrudeToRegionMesh/createShellMesh.H | 0 .../extrudeToRegionMesh/extrudeToRegionMesh.C | 0 .../extrudeToRegionMeshDict | 78 ++++++++++ .../patchPointEdgeCirculator.C | 0 .../patchPointEdgeCirculator.H | 0 .../patchPointEdgeCirculatorI.H | 0 48 files changed, 1347 insertions(+) rename applications/utilities/mesh/generation/{extrudeMesh => extrude}/Allwclean (100%) rename applications/utilities/mesh/generation/{extrudeMesh => extrude}/Allwmake (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/Make/files (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/Make/options (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/createTimeExtruded.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeMesh.C (100%) rename applications/utilities/mesh/generation/{extrudeMesh/extrudeProperties => extrude/extrudeMesh/extrudeMeshDict} (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/Make/files (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/Make/options (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/linearDirection/linearDirection.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/linearDirection/linearDirection.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/linearNormal/linearNormal.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/linearNormal/linearNormal.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/linearRadial/linearRadial.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/linearRadial/linearRadial.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/wedge/wedge.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudeModel/wedge/wedge.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudedMesh/extrudedMesh.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeMesh/extrudedMesh/extrudedMesh.H (100%) create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/Make/files create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/Make/options create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.H create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModelNew.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.H create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.H create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.H create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.H create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.C create mode 100644 applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.H rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/Make/files (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/Make/options (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/createShellMesh.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/createShellMesh.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/extrudeToRegionMesh.C (100%) create mode 100644 applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/patchPointEdgeCirculator.C (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/patchPointEdgeCirculator.H (100%) rename applications/utilities/mesh/generation/{ => extrude}/extrudeToRegionMesh/patchPointEdgeCirculatorI.H (100%) diff --git a/applications/utilities/mesh/generation/extrudeMesh/Allwclean b/applications/utilities/mesh/generation/extrude/Allwclean similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/Allwclean rename to applications/utilities/mesh/generation/extrude/Allwclean diff --git a/applications/utilities/mesh/generation/extrudeMesh/Allwmake b/applications/utilities/mesh/generation/extrude/Allwmake similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/Allwmake rename to applications/utilities/mesh/generation/extrude/Allwmake diff --git a/applications/utilities/mesh/generation/extrudeMesh/Make/files b/applications/utilities/mesh/generation/extrude/extrudeMesh/Make/files similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/Make/files rename to applications/utilities/mesh/generation/extrude/extrudeMesh/Make/files diff --git a/applications/utilities/mesh/generation/extrudeMesh/Make/options b/applications/utilities/mesh/generation/extrude/extrudeMesh/Make/options similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/Make/options rename to applications/utilities/mesh/generation/extrude/extrudeMesh/Make/options diff --git a/applications/utilities/mesh/generation/extrudeMesh/createTimeExtruded.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/createTimeExtruded.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/createTimeExtruded.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/createTimeExtruded.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeProperties rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/files similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/files diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/options b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/options similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/options rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/options diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearDirection/linearDirection.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.H diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.C diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.H rename to applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.H diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/Make/files b/applications/utilities/mesh/generation/extrude/extrudeModel/Make/files new file mode 100644 index 0000000000..fdd7c3e7b7 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/Make/files @@ -0,0 +1,10 @@ +extrudeModel/extrudeModel.C +extrudeModel/extrudeModelNew.C +linearNormal/linearNormal.C +linearDirection/linearDirection.C +linearRadial/linearRadial.C +sigmaRadial/sigmaRadial.C +wedge/wedge.C + +LIB = $(FOAM_LIBBIN)/libextrudeModel + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/Make/options b/applications/utilities/mesh/generation/extrude/extrudeModel/Make/options new file mode 100644 index 0000000000..3c57befe4f --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/Make/options @@ -0,0 +1,8 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -ldynamicMesh + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.C b/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.C new file mode 100644 index 0000000000..b7b47bd6f2 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.C @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(extrudeModel, 0); + defineRunTimeSelectionTable(extrudeModel, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::extrudeModel::extrudeModel +( + const word& modelType, + const dictionary& dict +) +: + nLayers_(readLabel(dict.lookup("nLayers"))), + expansionRatio_(readScalar(dict.lookup("expansionRatio"))), + dict_(dict), + coeffDict_(dict.subDict(modelType + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::extrudeModel::~extrudeModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::label Foam::extrudeModel::nLayers() const +{ + return nLayers_; +} + + +Foam::scalar Foam::extrudeModel::expansionRatio() const +{ + return expansionRatio_; +} + + +Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const +{ + // 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r) + + if (mag(1.0-expansionRatio_) < SMALL) + { + return scalar(layer)/nLayers_; + } + else + { + return + (1.0-pow(expansionRatio_, layer)) + / (1.0-pow(expansionRatio_, nLayers_)); + } +} + + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.H b/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.H new file mode 100644 index 0000000000..ceeb2975d7 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModel.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::extrudeModel + +Description + Top level extrusion model class + +SourceFiles + extrudeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef extrudeModel_H +#define extrudeModel_H + +#include "dictionary.H" +#include "point.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class extrudeModel Declaration +\*---------------------------------------------------------------------------*/ + +class extrudeModel +{ +protected: + + // Protected data + + const label nLayers_; + + const scalar expansionRatio_; + + const dictionary& dict_; + + const dictionary& coeffDict_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + extrudeModel(const extrudeModel&); + + //- Disallow default bitwise assignment + void operator=(const extrudeModel&); + + +public: + + //- Runtime type information + TypeName("extrudeModel"); + + //- Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + extrudeModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from dictionary + extrudeModel(const word& modelType, const dictionary&); + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary&); + + + //- Destructor + virtual ~extrudeModel(); + + + // Member Functions + + // Access + + label nLayers() const; + + scalar expansionRatio() const; + + + // Member Operators + + //- Helper: calculate cumulative relative thickness for layer. + // (layer=0 -> 0; layer=nLayers -> 1) + scalar sumThickness(const label layer) const; + + virtual point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModelNew.C b/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModelNew.C new file mode 100644 index 0000000000..b2a243d83c --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/extrudeModel/extrudeModelNew.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::extrudeModel::New +( + const dictionary& dict +) +{ + const word modelType(dict.lookup("extrudeModel")); + + Info<< "Selecting extrudeModel " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "extrudeModel::New(const dictionary&)" + ) << "Unknown extrudeModel type " + << modelType << nl << nl + << "Valid extrudeModel types are :" << nl + << dictionaryConstructorTablePtr_->sortedToc() << nl + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.C b/applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.C new file mode 100644 index 0000000000..d3d3d24382 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.C @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "linearDirection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(linearDirection, 0); + +addToRunTimeSelectionTable(extrudeModel, linearDirection, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +linearDirection::linearDirection(const dictionary& dict) +: + extrudeModel(typeName, dict), + direction_(coeffDict_.lookup("direction")), + thickness_(readScalar(coeffDict_.lookup("thickness"))) +{ + direction_ /= mag(direction_); + + if (thickness_ <= 0) + { + FatalErrorIn("linearDirection(const dictionary&)") + << "thickness should be positive : " << thickness_ + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +linearDirection::~linearDirection() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point linearDirection::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + //scalar d = thickness_*layer/nLayers_; + scalar d = thickness_*sumThickness(layer); + return surfacePoint + d*direction_; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.H b/applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.H new file mode 100644 index 0000000000..4d26ee56f5 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/linearDirection/linearDirection.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::extrudeModels::linearDirection + +Description + Extrudes by transforming points in a specified direction by a given distance + +\*---------------------------------------------------------------------------*/ + +#ifndef linearDirection_H +#define linearDirection_H + +#include "point.H" +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class linearDirection Declaration +\*---------------------------------------------------------------------------*/ + +class linearDirection +: + public extrudeModel +{ + // Private data + + //- Extrude direction + vector direction_; + + //- layer thickness + scalar thickness_; + + +public: + + //- Runtime type information + TypeName("linearDirection"); + + // Constructors + + //- Construct from dictionary + linearDirection(const dictionary& dict); + + + //- Destructor + ~linearDirection(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.C b/applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.C new file mode 100644 index 0000000000..34e0ba81cd --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "linearNormal.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(linearNormal, 0); + +addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +linearNormal::linearNormal(const dictionary& dict) +: + extrudeModel(typeName, dict), + thickness_(readScalar(coeffDict_.lookup("thickness"))) +{ + if (thickness_ <= 0) + { + FatalErrorIn("linearNormal(const dictionary&)") + << "thickness should be positive : " << thickness_ + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +linearNormal::~linearNormal() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point linearNormal::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + //scalar d = thickness_*layer/nLayers_; + scalar d = thickness_*sumThickness(layer); + return surfacePoint + d*surfaceNormal; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.H b/applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.H new file mode 100644 index 0000000000..62ae81bffb --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/linearNormal/linearNormal.H @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::extrudeModels::linearNormal + +Description + Extrudes by transforming points normal to the surface by a given distance + +\*---------------------------------------------------------------------------*/ + +#ifndef linearNormal_H +#define linearNormal_H + +#include "point.H" +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class linearNormal Declaration +\*---------------------------------------------------------------------------*/ + +class linearNormal +: + public extrudeModel +{ + // Private data + + //- layer thickness + scalar thickness_; + + +public: + + //- Runtime type information + TypeName("linearNormal"); + + // Constructors + + //- Construct from dictionary + linearNormal(const dictionary& dict); + + + //- Destructor + ~linearNormal(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.C b/applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.C new file mode 100644 index 0000000000..b3a8c1298a --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "linearRadial.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(linearRadial, 0); + +addToRunTimeSelectionTable(extrudeModel, linearRadial, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +linearRadial::linearRadial(const dictionary& dict) +: + extrudeModel(typeName, dict), + R_(readScalar(coeffDict_.lookup("R"))), + Rsurface_(coeffDict_.lookupOrDefault("Rsurface", -1)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +linearRadial::~linearRadial() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point linearRadial::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + // radius of the surface + scalar rs = mag(surfacePoint); + vector rsHat = surfacePoint/rs; + if (Rsurface_ >= 0) rs = Rsurface_; + + scalar r = rs + (R_ - rs)*sumThickness(layer); + return r*rsHat; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.H b/applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.H new file mode 100644 index 0000000000..04f19764ba --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/linearRadial/linearRadial.H @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::extrudeModels::linearRadial + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef linearRadial_H +#define linearRadial_H + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class linearRadial Declaration +\*---------------------------------------------------------------------------*/ + +class linearRadial +: + public extrudeModel +{ + // Private data + + scalar R_; + scalar Rsurface_; + + +public: + + //- Runtime type information + TypeName("linearRadial"); + + // Constructors + + //- Construct from dictionary + linearRadial(const dictionary& dict); + + + //- Destructor + ~linearRadial(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.C b/applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.C new file mode 100644 index 0000000000..c8a8ffe6fb --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "sigmaRadial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(sigmaRadial, 0); + +addToRunTimeSelectionTable(extrudeModel, sigmaRadial, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +sigmaRadial::sigmaRadial(const dictionary& dict) +: + extrudeModel(typeName, dict), + RTbyg_(readScalar(coeffDict_.lookup("RTbyg"))), + pRef_(readScalar(coeffDict_.lookup("pRef"))), + pStrat_(readScalar(coeffDict_.lookup("pStrat"))) +{ + if (mag(expansionRatio() - 1.0) > SMALL) + { + WarningIn("sigmaRadial::sigmaRadial(const dictionary&)") + << "Ignoring expansionRatio setting." << endl; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +sigmaRadial::~sigmaRadial() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point sigmaRadial::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + // radius of the surface + scalar rs = mag(surfacePoint); + vector rsHat = surfacePoint/rs; + + scalar p = pRef_ - layer*(pRef_ - pStrat_)/nLayers_; + scalar r = rs - RTbyg_*log(p/pRef_); + + return r*rsHat; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.H b/applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.H new file mode 100644 index 0000000000..e55c81bfe4 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/sigmaRadial/sigmaRadial.H @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::extrudeModels::sigmaRadial + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef sigmaRadial_H +#define sigmaRadial_H + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class sigmaRadial Declaration +\*---------------------------------------------------------------------------*/ + +class sigmaRadial +: + public extrudeModel +{ + // Private data + + scalar RTbyg_; + scalar pRef_; + scalar pStrat_; + + +public: + + //- Runtime type information + TypeName("sigmaRadial"); + + // Constructors + + //- Construct from dictionary + sigmaRadial(const dictionary& dict); + + + //-Destructor + ~sigmaRadial(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.C new file mode 100644 index 0000000000..02154ffa67 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "wedge.H" +#include "addToRunTimeSelectionTable.H" +#include "unitConversion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(wedge, 0); + +addToRunTimeSelectionTable(extrudeModel, wedge, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +wedge::wedge(const dictionary& dict) +: + extrudeModel(typeName, dict), + axisPt_(coeffDict_.lookup("axisPt")), + axis_(coeffDict_.lookup("axis")), + angle_ + ( + degToRad(readScalar(coeffDict_.lookup("angle"))) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +wedge::~wedge() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point wedge::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + scalar sliceAngle; + // For the case of a single layer extrusion assume a + // symmetric wedge about the reference plane is required + if (nLayers_ == 1) + { + if (layer == 0) + { + sliceAngle = -angle_/2.0; + } + else + { + sliceAngle = angle_/2.0; + } + } + else + { + //sliceAngle = angle_*layer/nLayers_; + sliceAngle = angle_*sumThickness(layer); + } + + // Find projection onto axis (or rather decompose surfacePoint + // into vector along edge (proj), vector normal to edge in plane + // of surface point and surface normal. + point d = surfacePoint - axisPt_; + + d -= (axis_ & d)*axis_; + + scalar dMag = mag(d); + + point edgePt = surfacePoint - d; + + // Rotate point around sliceAngle. + point rotatedPoint = edgePt; + + if (dMag > VSMALL) + { + vector n = (d/dMag) ^ axis_; + + rotatedPoint += + + cos(sliceAngle)*d + - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal + } + + return rotatedPoint; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.H b/applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.H new file mode 100644 index 0000000000..a936e798e4 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeModel/wedge/wedge.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::extrudeModels::wedge + +Description + Extrudes by rotating a surface around an axis + - extrusion is opposite the surface/patch normal so inwards the source + mesh + - axis direction has to be consistent with this. + - use -mergeFaces option if doing full 360 and want to merge front and back + - note direction of axis. This should be consistent with rotating against + the patch normal direction. If you get it wrong you'll see all cells + with extreme aspect ratio and internal faces wrong way around in + checkMesh + +\*---------------------------------------------------------------------------*/ + +#ifndef wedge_H +#define wedge_H + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class wedge Declaration +\*---------------------------------------------------------------------------*/ + +class wedge +: + public extrudeModel +{ + // Private data + + //- Point on axis + const point axisPt_; + + //- Normalized direction of axis + const vector axis_; + + //- Overall angle (radians) + const scalar angle_; + + +public: + + //- Runtime type information + TypeName("wedge"); + + // Constructors + + //- Construct from dictionary + wedge(const dictionary& dict); + + + //- Destrcuctor + ~wedge(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/files b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/files similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/Make/files rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/files diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/options similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/options diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.H b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.H rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.H diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict new file mode 100644 index 0000000000..6f6fc40f17 --- /dev/null +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict @@ -0,0 +1,78 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object extrudeToRegionMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Name of region to create +region liquidFilm; + +// faceZones to extrude +faceZones (f0); + +// Extrude 1D-columns of cells? +oneD false; + +//- Extrusion model to use. The only logical choice is linearNormal? + +//- Linear extrusion in normal direction +extrudeModel linearNormal; + +//- Linear extrusion in specified direction +//extrudeModel linearDirection; + +//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane. +// extrudeModel wedge; + +//- Extrudes into sphere around (0 0 0) +//extrudeModel linearRadial; + +//- Extrudes into sphere with grading according to pressure (atmospherics) +//extrudeModel sigmaRadial; + +nLayers 10; + +expansionRatio 0.9; + +linearNormalCoeffs +{ + thickness 0.05; +} + +wedgeCoeffs +{ + axisPt (0 0.1 -0.05); + axis (-1 0 0); + angle 360; // For nLayers=1 assume symmetry so angle/2 on each side +} + +linearDirectionCoeffs +{ + direction (0 1 0); + thickness 0.05; +} + +linearRadialCoeffs +{ + R 0.1; +} + +sigmaRadialCoeffs +{ + RTbyg 1; + pRef 1; + pStrat 1; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/patchPointEdgeCirculator.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/patchPointEdgeCirculator.C similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/patchPointEdgeCirculator.C rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/patchPointEdgeCirculator.C diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/patchPointEdgeCirculator.H b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/patchPointEdgeCirculator.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/patchPointEdgeCirculator.H rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/patchPointEdgeCirculator.H diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/patchPointEdgeCirculatorI.H b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/patchPointEdgeCirculatorI.H similarity index 100% rename from applications/utilities/mesh/generation/extrudeToRegionMesh/patchPointEdgeCirculatorI.H rename to applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/patchPointEdgeCirculatorI.H From cf47570812ee6d57a930bfc10b17e3f55084857e Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 16 Dec 2010 18:48:14 +0000 Subject: [PATCH 13/15] ENH: extrudeMesh : reorganisation --- .../mesh/generation/extrude/Allwclean | 3 +- .../mesh/generation/extrude/Allwmake | 4 +- .../extrude/extrudeMesh/Make/options | 2 +- .../extrude/extrudeMesh/extrudeMesh.C | 5 +- .../extrude/extrudeMesh/extrudeMeshDict | 2 +- .../extrudeMesh/extrudeModel/Make/files | 10 - .../extrudeMesh/extrudeModel/Make/options | 8 - .../extrudeModel/extrudeModel/extrudeModel.C | 89 ---- .../extrudeModel/extrudeModel/extrudeModel.H | 143 ------- .../extrudeModel/extrudeModelNew.C | 58 --- .../linearDirection/linearDirection.C | 89 ---- .../linearDirection/linearDirection.H | 98 ----- .../extrudeModel/linearNormal/linearNormal.C | 86 ---- .../extrudeModel/linearNormal/linearNormal.H | 95 ----- .../extrudeModel/linearRadial/linearRadial.C | 82 ---- .../extrudeModel/linearRadial/linearRadial.H | 93 ----- .../extrudeModel/sigmaRadial/sigmaRadial.C | 92 ----- .../extrudeModel/sigmaRadial/sigmaRadial.H | 94 ----- .../extrudeMesh/extrudeModel/wedge/wedge.C | 125 ------ .../extrudeMesh/extrudeModel/wedge/wedge.H | 107 ----- .../extrude/extrudeToRegionMesh/Make/options | 2 + .../extrudeToRegionMesh/createShellMesh.C | 387 ++++++++++-------- .../extrudeToRegionMesh/createShellMesh.H | 9 +- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 100 ++--- 24 files changed, 280 insertions(+), 1503 deletions(-) delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/files delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/options delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.H delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.H delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.H delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.C delete mode 100644 applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.H diff --git a/applications/utilities/mesh/generation/extrude/Allwclean b/applications/utilities/mesh/generation/extrude/Allwclean index 3ac620b145..c1c94a806b 100755 --- a/applications/utilities/mesh/generation/extrude/Allwclean +++ b/applications/utilities/mesh/generation/extrude/Allwclean @@ -3,6 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x wclean libso extrudeModel -wclean +wclean extrudeMesh +wclean extrudeToRegionMesh # ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/mesh/generation/extrude/Allwmake b/applications/utilities/mesh/generation/extrude/Allwmake index 871cad2b68..091ec04743 100755 --- a/applications/utilities/mesh/generation/extrude/Allwmake +++ b/applications/utilities/mesh/generation/extrude/Allwmake @@ -3,6 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake libso extrudeModel -wmake +wmake extrudeMesh +wmake extrudeToRegionMesh + # ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/Make/options b/applications/utilities/mesh/generation/extrude/extrudeMesh/Make/options index 1cdc68a2c7..9a10a36f3c 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/Make/options +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/Make/options @@ -1,6 +1,6 @@ EXE_INC = \ -IextrudedMesh \ - -IextrudeModel/lnInclude \ + -I../extrudeModel/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 6de1574703..0b0ad610bc 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -214,9 +214,8 @@ int main(int argc, char *argv[]) ( IOobject ( - "extrudeProperties", - runTimeExtruded.constant(), - regionDir, + "extrudeMeshDict", + runTimeExtruded.system(), runTimeExtruded, IOobject::MUST_READ_IF_MODIFIED ) diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict index c820e3f8a8..a38614047b 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - object extrudeProperties; + object extrudeMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/files b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/files deleted file mode 100644 index fdd7c3e7b7..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/files +++ /dev/null @@ -1,10 +0,0 @@ -extrudeModel/extrudeModel.C -extrudeModel/extrudeModelNew.C -linearNormal/linearNormal.C -linearDirection/linearDirection.C -linearRadial/linearRadial.C -sigmaRadial/sigmaRadial.C -wedge/wedge.C - -LIB = $(FOAM_LIBBIN)/libextrudeModel - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/options b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/options deleted file mode 100644 index 3c57befe4f..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/Make/options +++ /dev/null @@ -1,8 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude - -EXE_LIBS = \ - -lmeshTools \ - -ldynamicMesh - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C deleted file mode 100644 index b7b47bd6f2..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C +++ /dev/null @@ -1,89 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(extrudeModel, 0); - defineRunTimeSelectionTable(extrudeModel, dictionary); -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::extrudeModel::extrudeModel -( - const word& modelType, - const dictionary& dict -) -: - nLayers_(readLabel(dict.lookup("nLayers"))), - expansionRatio_(readScalar(dict.lookup("expansionRatio"))), - dict_(dict), - coeffDict_(dict.subDict(modelType + "Coeffs")) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::extrudeModel::~extrudeModel() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::label Foam::extrudeModel::nLayers() const -{ - return nLayers_; -} - - -Foam::scalar Foam::extrudeModel::expansionRatio() const -{ - return expansionRatio_; -} - - -Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const -{ - // 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r) - - if (mag(1.0-expansionRatio_) < SMALL) - { - return scalar(layer)/nLayers_; - } - else - { - return - (1.0-pow(expansionRatio_, layer)) - / (1.0-pow(expansionRatio_, nLayers_)); - } -} - - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H deleted file mode 100644 index ceeb2975d7..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H +++ /dev/null @@ -1,143 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::extrudeModel - -Description - Top level extrusion model class - -SourceFiles - extrudeModel.C - -\*---------------------------------------------------------------------------*/ - -#ifndef extrudeModel_H -#define extrudeModel_H - -#include "dictionary.H" -#include "point.H" -#include "autoPtr.H" -#include "runTimeSelectionTables.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class extrudeModel Declaration -\*---------------------------------------------------------------------------*/ - -class extrudeModel -{ -protected: - - // Protected data - - const label nLayers_; - - const scalar expansionRatio_; - - const dictionary& dict_; - - const dictionary& coeffDict_; - - - // Private Member Functions - - //- Disallow default bitwise copy construct - extrudeModel(const extrudeModel&); - - //- Disallow default bitwise assignment - void operator=(const extrudeModel&); - - -public: - - //- Runtime type information - TypeName("extrudeModel"); - - //- Declare runtime constructor selection table - - declareRunTimeSelectionTable - ( - autoPtr, - extrudeModel, - dictionary, - ( - const dictionary& dict - ), - (dict) - ); - - - // Constructors - - //- Construct from dictionary - extrudeModel(const word& modelType, const dictionary&); - - - // Selectors - - //- Select null constructed - static autoPtr New(const dictionary&); - - - //- Destructor - virtual ~extrudeModel(); - - - // Member Functions - - // Access - - label nLayers() const; - - scalar expansionRatio() const; - - - // Member Operators - - //- Helper: calculate cumulative relative thickness for layer. - // (layer=0 -> 0; layer=nLayers -> 1) - scalar sumThickness(const label layer) const; - - virtual point operator() - ( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer - ) const = 0; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C deleted file mode 100644 index b2a243d83c..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/extrudeModel/extrudeModelNew.C +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::autoPtr Foam::extrudeModel::New -( - const dictionary& dict -) -{ - const word modelType(dict.lookup("extrudeModel")); - - Info<< "Selecting extrudeModel " << modelType << endl; - - dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(modelType); - - if (cstrIter == dictionaryConstructorTablePtr_->end()) - { - FatalErrorIn - ( - "extrudeModel::New(const dictionary&)" - ) << "Unknown extrudeModel type " - << modelType << nl << nl - << "Valid extrudeModel types are :" << nl - << dictionaryConstructorTablePtr_->sortedToc() << nl - << exit(FatalError); - } - - return autoPtr(cstrIter()(dict)); -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.C deleted file mode 100644 index d3d3d24382..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.C +++ /dev/null @@ -1,89 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "linearDirection.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(linearDirection, 0); - -addToRunTimeSelectionTable(extrudeModel, linearDirection, dictionary); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -linearDirection::linearDirection(const dictionary& dict) -: - extrudeModel(typeName, dict), - direction_(coeffDict_.lookup("direction")), - thickness_(readScalar(coeffDict_.lookup("thickness"))) -{ - direction_ /= mag(direction_); - - if (thickness_ <= 0) - { - FatalErrorIn("linearDirection(const dictionary&)") - << "thickness should be positive : " << thickness_ - << exit(FatalError); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -linearDirection::~linearDirection() -{} - - -// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // - -point linearDirection::operator() -( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer -) const -{ - //scalar d = thickness_*layer/nLayers_; - scalar d = thickness_*sumThickness(layer); - return surfacePoint + d*direction_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.H deleted file mode 100644 index 4d26ee56f5..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearDirection/linearDirection.H +++ /dev/null @@ -1,98 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::extrudeModels::linearDirection - -Description - Extrudes by transforming points in a specified direction by a given distance - -\*---------------------------------------------------------------------------*/ - -#ifndef linearDirection_H -#define linearDirection_H - -#include "point.H" -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -/*---------------------------------------------------------------------------*\ - Class linearDirection Declaration -\*---------------------------------------------------------------------------*/ - -class linearDirection -: - public extrudeModel -{ - // Private data - - //- Extrude direction - vector direction_; - - //- layer thickness - scalar thickness_; - - -public: - - //- Runtime type information - TypeName("linearDirection"); - - // Constructors - - //- Construct from dictionary - linearDirection(const dictionary& dict); - - - //- Destructor - ~linearDirection(); - - - // Member Operators - - point operator() - ( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.C deleted file mode 100644 index 34e0ba81cd..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.C +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "linearNormal.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(linearNormal, 0); - -addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -linearNormal::linearNormal(const dictionary& dict) -: - extrudeModel(typeName, dict), - thickness_(readScalar(coeffDict_.lookup("thickness"))) -{ - if (thickness_ <= 0) - { - FatalErrorIn("linearNormal(const dictionary&)") - << "thickness should be positive : " << thickness_ - << exit(FatalError); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -linearNormal::~linearNormal() -{} - - -// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // - -point linearNormal::operator() -( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer -) const -{ - //scalar d = thickness_*layer/nLayers_; - scalar d = thickness_*sumThickness(layer); - return surfacePoint + d*surfaceNormal; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.H deleted file mode 100644 index 62ae81bffb..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearNormal/linearNormal.H +++ /dev/null @@ -1,95 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::extrudeModels::linearNormal - -Description - Extrudes by transforming points normal to the surface by a given distance - -\*---------------------------------------------------------------------------*/ - -#ifndef linearNormal_H -#define linearNormal_H - -#include "point.H" -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -/*---------------------------------------------------------------------------*\ - Class linearNormal Declaration -\*---------------------------------------------------------------------------*/ - -class linearNormal -: - public extrudeModel -{ - // Private data - - //- layer thickness - scalar thickness_; - - -public: - - //- Runtime type information - TypeName("linearNormal"); - - // Constructors - - //- Construct from dictionary - linearNormal(const dictionary& dict); - - - //- Destructor - ~linearNormal(); - - - // Member Operators - - point operator() - ( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.C deleted file mode 100644 index b3a8c1298a..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.C +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "linearRadial.H" -#include "addToRunTimeSelectionTable.H" - -namespace Foam -{ -namespace extrudeModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(linearRadial, 0); - -addToRunTimeSelectionTable(extrudeModel, linearRadial, dictionary); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -linearRadial::linearRadial(const dictionary& dict) -: - extrudeModel(typeName, dict), - R_(readScalar(coeffDict_.lookup("R"))), - Rsurface_(coeffDict_.lookupOrDefault("Rsurface", -1)) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -linearRadial::~linearRadial() -{} - - -// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // - -point linearRadial::operator() -( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer -) const -{ - // radius of the surface - scalar rs = mag(surfacePoint); - vector rsHat = surfacePoint/rs; - if (Rsurface_ >= 0) rs = Rsurface_; - - scalar r = rs + (R_ - rs)*sumThickness(layer); - return r*rsHat; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.H deleted file mode 100644 index 04f19764ba..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/linearRadial/linearRadial.H +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::extrudeModels::linearRadial - -Description - -\*---------------------------------------------------------------------------*/ - -#ifndef linearRadial_H -#define linearRadial_H - -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -/*---------------------------------------------------------------------------*\ - Class linearRadial Declaration -\*---------------------------------------------------------------------------*/ - -class linearRadial -: - public extrudeModel -{ - // Private data - - scalar R_; - scalar Rsurface_; - - -public: - - //- Runtime type information - TypeName("linearRadial"); - - // Constructors - - //- Construct from dictionary - linearRadial(const dictionary& dict); - - - //- Destructor - ~linearRadial(); - - - // Member Operators - - point operator() - ( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C deleted file mode 100644 index c8a8ffe6fb..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C +++ /dev/null @@ -1,92 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "sigmaRadial.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(sigmaRadial, 0); - -addToRunTimeSelectionTable(extrudeModel, sigmaRadial, dictionary); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -sigmaRadial::sigmaRadial(const dictionary& dict) -: - extrudeModel(typeName, dict), - RTbyg_(readScalar(coeffDict_.lookup("RTbyg"))), - pRef_(readScalar(coeffDict_.lookup("pRef"))), - pStrat_(readScalar(coeffDict_.lookup("pStrat"))) -{ - if (mag(expansionRatio() - 1.0) > SMALL) - { - WarningIn("sigmaRadial::sigmaRadial(const dictionary&)") - << "Ignoring expansionRatio setting." << endl; - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -sigmaRadial::~sigmaRadial() -{} - - -// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // - -point sigmaRadial::operator() -( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer -) const -{ - // radius of the surface - scalar rs = mag(surfacePoint); - vector rsHat = surfacePoint/rs; - - scalar p = pRef_ - layer*(pRef_ - pStrat_)/nLayers_; - scalar r = rs - RTbyg_*log(p/pRef_); - - return r*rsHat; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H deleted file mode 100644 index e55c81bfe4..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H +++ /dev/null @@ -1,94 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::extrudeModels::sigmaRadial - -Description - -\*---------------------------------------------------------------------------*/ - -#ifndef sigmaRadial_H -#define sigmaRadial_H - -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -/*---------------------------------------------------------------------------*\ - Class sigmaRadial Declaration -\*---------------------------------------------------------------------------*/ - -class sigmaRadial -: - public extrudeModel -{ - // Private data - - scalar RTbyg_; - scalar pRef_; - scalar pStrat_; - - -public: - - //- Runtime type information - TypeName("sigmaRadial"); - - // Constructors - - //- Construct from dictionary - sigmaRadial(const dictionary& dict); - - - //-Destructor - ~sigmaRadial(); - - - // Member Operators - - point operator() - ( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.C deleted file mode 100644 index 02154ffa67..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.C +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "wedge.H" -#include "addToRunTimeSelectionTable.H" -#include "unitConversion.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(wedge, 0); - -addToRunTimeSelectionTable(extrudeModel, wedge, dictionary); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -wedge::wedge(const dictionary& dict) -: - extrudeModel(typeName, dict), - axisPt_(coeffDict_.lookup("axisPt")), - axis_(coeffDict_.lookup("axis")), - angle_ - ( - degToRad(readScalar(coeffDict_.lookup("angle"))) - ) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -wedge::~wedge() -{} - - -// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // - -point wedge::operator() -( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer -) const -{ - scalar sliceAngle; - // For the case of a single layer extrusion assume a - // symmetric wedge about the reference plane is required - if (nLayers_ == 1) - { - if (layer == 0) - { - sliceAngle = -angle_/2.0; - } - else - { - sliceAngle = angle_/2.0; - } - } - else - { - //sliceAngle = angle_*layer/nLayers_; - sliceAngle = angle_*sumThickness(layer); - } - - // Find projection onto axis (or rather decompose surfacePoint - // into vector along edge (proj), vector normal to edge in plane - // of surface point and surface normal. - point d = surfacePoint - axisPt_; - - d -= (axis_ & d)*axis_; - - scalar dMag = mag(d); - - point edgePt = surfacePoint - d; - - // Rotate point around sliceAngle. - point rotatedPoint = edgePt; - - if (dMag > VSMALL) - { - vector n = (d/dMag) ^ axis_; - - rotatedPoint += - + cos(sliceAngle)*d - - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal - } - - return rotatedPoint; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.H deleted file mode 100644 index a936e798e4..0000000000 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeModel/wedge/wedge.H +++ /dev/null @@ -1,107 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::extrudeModels::wedge - -Description - Extrudes by rotating a surface around an axis - - extrusion is opposite the surface/patch normal so inwards the source - mesh - - axis direction has to be consistent with this. - - use -mergeFaces option if doing full 360 and want to merge front and back - - note direction of axis. This should be consistent with rotating against - the patch normal direction. If you get it wrong you'll see all cells - with extreme aspect ratio and internal faces wrong way around in - checkMesh - -\*---------------------------------------------------------------------------*/ - -#ifndef wedge_H -#define wedge_H - -#include "extrudeModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace extrudeModels -{ - -/*---------------------------------------------------------------------------*\ - Class wedge Declaration -\*---------------------------------------------------------------------------*/ - -class wedge -: - public extrudeModel -{ - // Private data - - //- Point on axis - const point axisPt_; - - //- Normalized direction of axis - const vector axis_; - - //- Overall angle (radians) - const scalar angle_; - - -public: - - //- Runtime type information - TypeName("wedge"); - - // Constructors - - //- Construct from dictionary - wedge(const dictionary& dict); - - - //- Destrcuctor - ~wedge(); - - - // Member Operators - - point operator() - ( - const point& surfacePoint, - const vector& surfaceNormal, - const label layer - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace extrudeModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/options b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/options index 7c1ab5a64a..abe16677f5 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/options +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/options @@ -1,9 +1,11 @@ EXE_INC = \ + -I../extrudeModel/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude EXE_LIBS = \ + -lextrudeModel \ -lfiniteVolume \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C index 4034428bfb..543e5550a2 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C @@ -93,7 +93,7 @@ void Foam::createShellMesh::calcPointRegions label fp2 = findIndex(f2, pointI); label& region = pointRegions[face2][fp2]; if (region != -1) - { + { FatalErrorIn ( "createShellMesh::calcPointRegions(..)" @@ -185,18 +185,20 @@ Foam::createShellMesh::createShellMesh void Foam::createShellMesh::setRefinement ( - const pointField& thickness, + const pointField& firstLayerDisp, + const scalar expansionRatio, + const label nLayers, const labelList& topPatchID, const labelList& bottomPatchID, const labelListList& extrudeEdgePatches, polyTopoChange& meshMod ) { - if (thickness.size() != regionPoints_.size()) + if (firstLayerDisp.size() != regionPoints_.size()) { FatalErrorIn("createShellMesh::setRefinement(..)") << "nRegions:" << regionPoints_.size() - << " thickness:" << thickness.size() + << " firstLayerDisp:" << firstLayerDisp.size() << exit(FatalError); } @@ -224,30 +226,36 @@ void Foam::createShellMesh::setRefinement // From cell to patch (trivial) - DynamicList