diff --git a/applications/solvers/combustion/dieselEngineFoam/createSpray.H b/applications/solvers/combustion/dieselEngineFoam/createSpray.H index 6b78689f09094ddcfb160533fb851bc257b9f454..8c6706e0bab890bc943826e3c4aaa5c3fa85499f 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createSpray.H +++ b/applications/solvers/combustion/dieselEngineFoam/createSpray.H @@ -30,7 +30,7 @@ scalar gasMass0 = fvc::domainIntegrate(rho).value(); if (dieselSpray.twoD()) { - gasMass0 *= constant::math::twoPi/dieselSpray.angleOfWedge(); + gasMass0 *= constant::mathematical::twoPi/dieselSpray.angleOfWedge(); } gasMass0 -= diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index 709b70f7a6d73522b135933c7f675a3e4e6c6a3d..eaf3219445e03098bddfc77e624e49b248405543 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -43,7 +43,7 @@ Description #include "OFstream.H" #include "volPointInterpolation.H" #include "thermoPhysicsTypes.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H index 2bacaa91ee922e8b8663a4bc97c2ee76140b2717..5c1e43dc99477f9b880c4663ee3ec89ddfa0be8a 100644 --- a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H +++ b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H @@ -20,7 +20,7 @@ if (dieselSpray.twoD()) { - gasMass *= constant::math::twoPi/dieselSpray.angleOfWedge(); + gasMass *= constant::mathematical::twoPi/dieselSpray.angleOfWedge(); } scalar addedMass = gasMass - gasMass0; diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index 8d5dd0d9facad1d3a6d7a7cca51458c1ab095a4e..63549b99a5911bc109491a398040d2742c0ae59e 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -41,7 +41,7 @@ Description #include "IFstream.H" #include "OFstream.H" #include "Switch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index 8ff998217d3965354de1a5e0dcee81b74f2f953a..dd584d03e2bb8ddb432f6ec13639b93f0778b0cb 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -58,7 +58,7 @@ Description #include "ignition.H" #include "Switch.H" #include "OFstream.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index 276cac6ae01e8fe4c178db15516b490658abd83c..5423a70e3bb8a7a35b925d7ea1b4001a48c32f9e 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -28,7 +28,7 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -182,7 +182,7 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs() } Field<scalar> C2 = pmu/prho - *sqrt(ppsi*constant::math::piByTwo) + *sqrt(ppsi*constant::mathematical::piByTwo) *2.0*gamma_/Pr.value()/(gamma_ + 1.0) *(2.0 - accommodationCoeff_)/accommodationCoeff_; diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index 7cf2ab1f25b8ced12911bbfc8b6f841dc92c14c4..ec8f777542bd6cca2125d8e027d699c1d24dd83f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -28,7 +28,7 @@ Description #include "maxwellSlipUFvPatchVectorField.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "surfaceFields.H" @@ -147,7 +147,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs() const fvPatchField<scalar>& ppsi = patch().lookupPatchField<volScalarField, scalar>("psi"); - Field<scalar> C1 = sqrt(ppsi*constant::math::piByTwo) + Field<scalar> C1 = sqrt(ppsi*constant::mathematical::piByTwo) *(2.0 - accommodationCoeff_)/accommodationCoeff_; Field<scalar> pnu = pmu/prho; diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 4bbb449df7250b144f84ac84ecaed6682c84be12..11768ea2f69f574fe194297a71fc3b8872ccf441 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -21,7 +21,7 @@ fvm::laplacian(rhorUAf, p) == fvc::div(phi) ); - pEqn.setReference(pRefCell, p[pRefCell]); + pEqn.setReference(pRefCell, pRefValue); // retain the residual from the first iteration if (nonOrth == 0) diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index 1826a77217e86ac89941941c2d8e452d783e94fb..7c82fec14467cbda552a300bef51aa382af977af 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -41,24 +41,6 @@ ) ); - Info<< " Adding to KFluid\n" << endl; - KFluid.set - ( - i, - new volScalarField - ( - IOobject - ( - "K", - runTime.timeName(), - fluidRegions[i], - IOobject::NO_READ, - IOobject::NO_WRITE - ), - thermoFluid[i].Cp()*thermoFluid[i].alpha() - ) - ); - Info<< " Adding to UFluid\n" << endl; UFluid.set ( @@ -129,6 +111,24 @@ ).ptr() ); + Info<< " Adding to KFluid\n" << endl; + KFluid.set + ( + i, + new volScalarField + ( + IOobject + ( + "K", + runTime.timeName(), + fluidRegions[i], + IOobject::NO_READ, + IOobject::NO_WRITE + ), + thermoFluid[i].Cp()*turbulence[i].alphaEff() + ) + ); + Info<< " Adding to DpDtFluid\n" << endl; DpDtFluid.set ( diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C index 03e46a5c6332ee36bfca0f7fe4e1154988deb959..7762bcbfc9d05dc792806ca10ae9d7a6925af8b4 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "SchnerrSauer.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -77,7 +77,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb { return pow ( - ((4*constant::math::pi*n_)/3) + ((4*constant::mathematical::pi*n_)/3) *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1), 1.0/3.0 ); @@ -87,7 +87,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb Foam::dimensionedScalar Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const { - dimensionedScalar Vnuc = n_*constant::math::pi*pow3(dNuc_)/6; + dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6; return Vnuc/(1 + Vnuc); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 2ebb83c2fcc092f931a6fb8fc0dc956618488f66..6d32abd9c72689e30301a3e5105014d5beacd9de 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -29,12 +29,12 @@ License #include "Time.H" #include "subCycle.H" #include "fvCFD.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * // const scalar Foam::multiphaseMixture::convertToRad = - Foam::constant::math::pi/180.0; + Foam::constant::mathematical::pi/180.0; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C index fe24603713f2ac3912b10e946f9f9f3e1fc67e64..ce1fff38d7501a67c527a358ac1633a5e542b91e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "GidaspowConductivity.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::GidaspowConductivity::kappa const dimensionedScalar& e ) const { - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); return rhoa*da*sqrt(Theta)* ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C index 2d0acca9fafd49ace0d2f56709e9f42f2e0afa6b..a1a2894ae17f1c02714f0f2a2fd3b2bf212ebdb6 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "HrenyaSinclairConductivity.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -74,7 +74,7 @@ Foam::tmp<Foam::volScalarField> Foam::HrenyaSinclairConductivity::kappa const dimensionedScalar& e ) const { - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); volScalarField lamda = scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C index 40c296f7e0463eb72779c03c04660264bcfa4f0e..f2a4225d718d8fda8feec0e8060879ecfa2fa573 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "SyamlalConductivity.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::SyamlalConductivity::kappa const dimensionedScalar& e ) const { - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); return rhoa*da*sqrt(Theta)* ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index dd3f3451794013a9481b96f54dfae6e5b942e04b..2869cbef77b93001c4b41eacfbe0d7213b258b40 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -26,7 +26,7 @@ License #include "kineticTheoryModel.H" #include "surfaceInterpolate.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "fvCFD.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -204,7 +204,7 @@ void Foam::kineticTheoryModel::solve() volScalarField alpha = alpha_; alpha.max(1.0e-6); - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); surfaceScalarField phi = 1.5*rhoa_*phia_*fvc::interpolate(alpha_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C index 2a1c00b188d1429659ce63b1cca8a997f6f02c8e..a6026440be413d654800fa08cec23898cf0db6ed 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "GidaspowViscosity.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -70,7 +70,7 @@ Foam::kineticTheoryModels::GidaspowViscosity::mua const dimensionedScalar& e ) const { - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); return rhoa*da*sqrt(Theta)* ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C index b5e60e94c26d8fdf077e6ccd46c3289bc99a1112..fb7584d1560ce81dd7d8ff6c3441f67cf4e72ceb 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "HrenyaSinclairViscosity.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -77,7 +77,7 @@ Foam::kineticTheoryModels::HrenyaSinclairViscosity::mua const dimensionedScalar& e ) const { - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); volScalarField lamda = scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C index 892319df6c65ce387ad79148333707d9d07f898d..e913b3562001f99d58ff40d6eee0094e81077760 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "SyamlalViscosity.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModels::SyamlalViscosity::mua const dimensionedScalar& e ) const { - const scalar sqrtPi = sqrt(constant::math::pi); + const scalar sqrtPi = sqrt(constant::mathematical::pi); return rhoa*da*sqrt(Theta)* ( diff --git a/applications/test/FixedList/FixedListTest.C b/applications/test/FixedList/FixedListTest.C index e46e910d3a266ad2359c272ab6d7ce250a13e7e5..97292f13636d07570f9aaef5f4170b4d924467a6 100644 --- a/applications/test/FixedList/FixedListTest.C +++ b/applications/test/FixedList/FixedListTest.C @@ -78,10 +78,7 @@ int main(int argc, char *argv[]) Serr<< "slave sending to master " << Pstream::masterNo() << endl; - OPstream toMaster - ( - Pstream::blocking, Pstream::masterNo(), IOstream::ASCII - ); + OPstream toMaster(Pstream::blocking, Pstream::masterNo()); FixedList<label, 2> list3; list3[0] = 0; @@ -98,10 +95,7 @@ int main(int argc, char *argv[]) ) { Serr << "master receiving from slave " << slave << endl; - IPstream fromSlave - ( - Pstream::blocking, slave, IOstream::ASCII - ); + IPstream fromSlave(Pstream::blocking, slave); FixedList<label, 2> list3(fromSlave); Serr<< list3 << endl; diff --git a/applications/test/graphXi/graphXi.C b/applications/test/graphXi/graphXi.C index c717f6cc1f963f9269da2040b80a0c87c7499246..86f1eb18fd7cbd81d73970acd8f62d201cf97b06 100644 --- a/applications/test/graphXi/graphXi.C +++ b/applications/test/graphXi/graphXi.C @@ -32,7 +32,7 @@ Description #include "graph.H" #include "OFstream.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" using namespace Foam; @@ -50,7 +50,7 @@ int main() scalarField b = 0.5*(1.0 + erf(x)); scalarField c = 1.0 - b; - scalarField gradb = (1/::sqrt(constant::math::pi))*exp(-sqr(x)); + scalarField gradb = (1/::sqrt(constant::mathematical::pi))*exp(-sqr(x)); scalarField lapb = -2*x*gradb; r = lapb*b*c/(gradb*gradb); diff --git a/applications/test/stringList/stringListTest.C b/applications/test/stringList/stringListTest.C index 98391ef5befeca9a19ce85fb157db32fb86d253c..13718be6f06c034b128ce78ef7f7e8a07eb332bf 100644 --- a/applications/test/stringList/stringListTest.C +++ b/applications/test/stringList/stringListTest.C @@ -27,6 +27,7 @@ Description \*---------------------------------------------------------------------------*/ #include "stringListOps.H" +#include "IStringStream.H" #include "IOstreams.H" using namespace Foam; @@ -36,21 +37,59 @@ using namespace Foam; int main(int argc, char *argv[]) { - stringList sl(3); - sl[0] = "hello"; - sl[1] = "heello"; - sl[2] = "heeello"; + stringList strLst + ( + IStringStream + ( + "(" + "\"hello\"" + "\"heello\"" + "\"heeello\"" + "\"bye\"" + "\"bbye\"" + "\"bbbye\"" + "\"okey\"" + "\"okkey\"" + "\"okkkey\"" + ")" + )() + ); - labelList matches = findStrings(".*ee.*", sl); + wordReList reLst(IStringStream("( okey \"[hy]e+.*\" )")()); - Info<< "matches found for regexp .*ee.* : "; + Info<< "stringList " << strLst << nl; + + labelList matches = findStrings(".*ee.*", strLst); + + Info<< "matches found for regexp .*ee.* :" << nl << matches << nl; + forAll(matches, i) + { + Info<< " -> " << strLst[matches[i]] << nl; + } + Info<< endl; + + matches = findStrings(reLst, strLst); + + Info<< "matches found for " << reLst << nl << matches << nl; forAll(matches, i) { - Info<< " " << sl[matches[i]]; + Info<< " -> " << strLst[matches[i]] << nl; } Info<< endl; - Info << "End\n" << endl; + stringList subLst = subsetStrings(".*ee.*", strLst); + Info<< "subset stringList: " << subLst << nl; + + subLst = subsetStrings(reLst, strLst); + Info<< "subset stringList: " << subLst << nl; + + inplaceSubsetStrings(reLst, strLst); + Info<< "subsetted stringList: " << strLst << nl; + + inplaceSubsetStrings(".*l.*", strLst); + Info<< "subsetted stringList: " << strLst << nl; + + Info<< "\nEnd\n" << endl; return 0; } diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index 0905771d199c1d865be6f87e424a5b9b05771ce4..2ce7f8ba80c734caa456aba557739915f918c98f 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -47,7 +47,7 @@ Description #include "polyTopoChanger.H" #include "polyMesh.H" #include "mapPolyMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "PackedBoolList.H" #include "SortableList.H" @@ -467,7 +467,7 @@ int main(int argc, char *argv[]) scalar angle(readScalar(IStringStream(args.additionalArgs()[1])())); bool overwrite = args.optionFound("overwrite"); - scalar maxCos = Foam::cos(angle*180/constant::math::pi); + scalar maxCos = Foam::cos(angle*180/constant::mathematical::pi); Info<< "Merging:" << nl << " edges with length less than " << minLen << " meters" << nl diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index de7af2b077d21defaec9e20829f605c2b14a75db..d16f4f23cce3bcde783777e001f9310a0d426bd6 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -53,7 +53,7 @@ Description #include "removePoints.H" #include "polyMesh.H" #include "mapPolyMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" using namespace Foam; @@ -445,12 +445,12 @@ int main(int argc, char *argv[]) scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0); + scalar minCos = Foam::cos(degToRad(featureAngle)); scalar concaveAngle = defaultConcaveAngle; args.optionReadIfPresent("concaveAngle", concaveAngle); - scalar concaveSin = Foam::sin(concaveAngle*constant::math::pi/180.0); + scalar concaveSin = Foam::sin(degToRad(concaveAngle)); bool snapMeshDict = args.optionFound("snapMesh"); bool overwrite = args.optionFound("overwrite"); diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C index 1d9c0e5b5430df6bd27a9144ef0263544d3d67c3..f9f47c815a90fb4bda00ac188b5328fbec46bb62 100644 --- a/applications/utilities/mesh/advanced/splitCells/splitCells.C +++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C @@ -49,7 +49,7 @@ Description #include "cellSet.H" #include "cellModeller.H" #include "meshCutter.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "geomCellLooper.H" #include "plane.H" #include "edgeVertex.H" @@ -539,9 +539,8 @@ int main(int argc, char *argv[]) scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - scalar radAngle = featureAngle*constant::math::pi/180.0; - scalar minCos = Foam::cos(radAngle); - scalar minSin = Foam::sin(radAngle); + scalar minCos = Foam::cos(degToRad(featureAngle)); + scalar minSin = Foam::sin(degToRad(featureAngle)); bool readSet = args.optionFound("set"); bool geometry = args.optionFound("geometry"); diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C index 996cd67d4ce6735e503482a67d41c64ee102ac2a..1da7ba049e4202ae5e2065fe3f9be3fd0a5502a6 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C +++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C @@ -43,7 +43,7 @@ Description #include "symmetryPolyPatch.H" #include "wedgePolyPatch.H" #include "cyclicPolyPatch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" using namespace Foam; diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H index f1ec25a59c19f67f81fd2edfeb20f0438e36b544..ba2b615df18aa7cc6b32de4133ae0d65be446987 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H @@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size()) { // Distribute the points to be +/- 2.5deg from the x-z plane - scalar tanTheta = Foam::tan(2.5*constant::math::pi/180.0); + scalar tanTheta = Foam::tan(degToRad(2.5)); SLList<face>::iterator iterf = pFaces[WEDGE][0].begin(); SLList<face>::iterator iterb = pFaces[WEDGE][1].begin(); diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index 65dd5c952d93891bcb39ee37c3f6665f2638a82d..af2c429bdc93fa9f922847285dc86127f0255311 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -59,7 +59,7 @@ Usage #include "Time.H" #include "timeSelector.H" #include "fvMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "polyTopoChange.H" #include "mapPolyMesh.H" #include "PackedBoolList.H" @@ -91,7 +91,7 @@ void simpleMarkFeatures labelList& multiCellFeaturePoints ) { - scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0); + scalar minCos = Foam::cos(degToRad(featureAngle)); const polyBoundaryMesh& patches = mesh.boundaryMesh(); @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0); + scalar minCos = Foam::cos(degToRad(featureAngle)); Info<< "Feature:" << featureAngle << endl << "minCos :" << minCos << endl diff --git a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C index 0b135188e00e173b0f92f870698762e535373157..da0f8683887c836e90ad56cfcf9742968c74b310 100644 --- a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C +++ b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C @@ -33,7 +33,7 @@ Description #include "IOmanip.H" #include "boundBox.H" #include "Map.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -99,7 +99,7 @@ void starMesh::createCoupleMatches() << coupleI << ". STAR couple ID: " << couples_[coupleI].coupleID() << endl << "The angle between face normals is " - << Foam::acos(faceAreaAngle)/constant::math::pi*180 + << radToDeg(Foam::acos(faceAreaAngle)) << " deg." << endl << "master cell: " << fp.masterCell() << " STAR number: " << starCellID_[fp.masterCell()] diff --git a/applications/utilities/mesh/generation/blockMesh/Make/files b/applications/utilities/mesh/generation/blockMesh/Make/files index 81f5f3674918295d0a0f8c5c2fcc141e089886e1..74840e97328085d8311cfb901c9311765de142ec 100644 --- a/applications/utilities/mesh/generation/blockMesh/Make/files +++ b/applications/utilities/mesh/generation/blockMesh/Make/files @@ -1,31 +1,3 @@ -curvedEdges = curvedEdges - -$(curvedEdges)/curvedEdge.C -$(curvedEdges)/lineEdge.C -$(curvedEdges)/polyLine.C -$(curvedEdges)/polyLineEdge.C -$(curvedEdges)/arcEdge.C -$(curvedEdges)/spline.C -$(curvedEdges)/BSpline.C -$(curvedEdges)/simpleSplineEdge.C -$(curvedEdges)/polySplineEdge.C -$(curvedEdges)/lineDivide.C - -blockMesh.C -blockDescriptor.C -setEdge.C -block.C -createTopology.C -checkBlockMesh.C -createBlockOffsets.C -createMergeList.C -createPoints.C -createCells.C -createPatches.C -blockPoints.C -blockCells.C -blockBoundary.C - blockMeshApp.C EXE = $(FOAM_APPBIN)/blockMesh diff --git a/applications/utilities/mesh/generation/blockMesh/Make/options b/applications/utilities/mesh/generation/blockMesh/Make/options index a5b85e4298be86801fb2b27b96781019a64704cd..2e07c477da808accff105fbb6ae0922d0768cddc 100644 --- a/applications/utilities/mesh/generation/blockMesh/Make/options +++ b/applications/utilities/mesh/generation/blockMesh/Make/options @@ -1,8 +1,9 @@ EXE_INC = \ - -I$(curvedEdges) \ + -I$(LIB_SRC)/mesh/blockMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude EXE_LIBS = \ + -lblockMesh \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/blockMesh/blockBoundary.C b/applications/utilities/mesh/generation/blockMesh/blockBoundary.C deleted file mode 100644 index 8086aeea546ecba03980fc4bfe20b71aa5c3f194..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/blockMesh/blockBoundary.C +++ /dev/null @@ -1,209 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - private member of block. Creates boundary patches for the block - -\*---------------------------------------------------------------------------*/ - -#include "error.H" -#include "block.H" - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::block::blockBoundary() -{ - label ni = blockDef_.n().x(); - label nj = blockDef_.n().y(); - label nk = blockDef_.n().z(); - - // x-direction - - label wallLabel = 0; - label wallCellLabel = 0; - - // x-min - boundaryPatches_[wallLabel].setSize(nj*nk); - for (label k = 0; k <= nk - 1; k++) - { - for (label j = 0; j <= nj - 1; j++) - { - boundaryPatches_[wallLabel][wallCellLabel].setSize(4); - - // set the points - boundaryPatches_[wallLabel][wallCellLabel][0] = - vtxLabel(0, j, k); - boundaryPatches_[wallLabel][wallCellLabel][1] = - vtxLabel(0, j, k + 1); - boundaryPatches_[wallLabel][wallCellLabel][2] = - vtxLabel(0, j + 1, k + 1); - boundaryPatches_[wallLabel][wallCellLabel][3] = - vtxLabel(0, j + 1, k); - - // update the counter - wallCellLabel++; - } - } - - // x-max - wallLabel++; - wallCellLabel = 0; - - boundaryPatches_[wallLabel].setSize(nj*nk); - - for (label k = 0; k <= nk - 1; k++) - { - for (label j = 0; j <= nj - 1; j++) - { - boundaryPatches_[wallLabel][wallCellLabel].setSize(4); - - // set the points - boundaryPatches_[wallLabel][wallCellLabel][0] = - vtxLabel(ni, j, k); - boundaryPatches_[wallLabel][wallCellLabel][1] = - vtxLabel(ni, j+1, k); - boundaryPatches_[wallLabel][wallCellLabel][2] = - vtxLabel(ni, j+1, k+1); - boundaryPatches_[wallLabel][wallCellLabel][3] = - vtxLabel(ni, j, k+1); - - // update the counter - wallCellLabel++; - } - } - - // y-direction - - // y-min - wallLabel++; - wallCellLabel = 0; - - boundaryPatches_[wallLabel].setSize(ni*nk); - for (label i = 0; i <= ni - 1; i++) - { - for (label k = 0; k <= nk - 1; k++) - { - boundaryPatches_[wallLabel][wallCellLabel].setSize(4); - - // set the points - boundaryPatches_[wallLabel][wallCellLabel][0] = - vtxLabel(i, 0, k); - boundaryPatches_[wallLabel][wallCellLabel][1] = - vtxLabel(i + 1, 0, k); - boundaryPatches_[wallLabel][wallCellLabel][2] = - vtxLabel(i + 1, 0, k + 1); - boundaryPatches_[wallLabel][wallCellLabel][3] = - vtxLabel(i, 0, k + 1); - - // update the counter - wallCellLabel++; - } - } - - // y-max - wallLabel++; - wallCellLabel = 0; - - boundaryPatches_[wallLabel].setSize(ni*nk); - - for (label i = 0; i <= ni - 1; i++) - { - for (label k = 0; k <= nk - 1; k++) - { - boundaryPatches_[wallLabel][wallCellLabel].setSize(4); - - // set the points - boundaryPatches_[wallLabel][wallCellLabel][0] = - vtxLabel(i, nj, k); - boundaryPatches_[wallLabel][wallCellLabel][1] = - vtxLabel(i, nj, k + 1); - boundaryPatches_[wallLabel][wallCellLabel][2] = - vtxLabel(i + 1, nj, k + 1); - boundaryPatches_[wallLabel][wallCellLabel][3] = - vtxLabel(i + 1, nj, k); - - // update the counter - wallCellLabel++; - } - } - - // z-direction - - // z-min - wallLabel++; - wallCellLabel = 0; - - boundaryPatches_[wallLabel].setSize(ni*nj); - - for (label i = 0; i <= ni - 1; i++) - { - for (label j = 0; j <= nj - 1; j++) - { - boundaryPatches_[wallLabel][wallCellLabel].setSize(4); - - // set the points - boundaryPatches_[wallLabel][wallCellLabel][0] = - vtxLabel(i, j, 0); - boundaryPatches_[wallLabel][wallCellLabel][1] = - vtxLabel(i, j + 1, 0); - boundaryPatches_[wallLabel][wallCellLabel][2] = - vtxLabel(i + 1, j + 1, 0); - boundaryPatches_[wallLabel][wallCellLabel][3] = - vtxLabel(i + 1, j, 0); - - // update the counter - wallCellLabel++; - } - } - - // z-max - wallLabel++; - wallCellLabel = 0; - - boundaryPatches_[wallLabel].setSize(ni*nj); - - for (label i = 0; i <= ni - 1; i++) - { - for (label j = 0; j <= nj - 1; j++) - { - boundaryPatches_[wallLabel][wallCellLabel].setSize(4); - - // set the points - boundaryPatches_[wallLabel][wallCellLabel][0] = - vtxLabel(i, j, nk); - boundaryPatches_[wallLabel][wallCellLabel][1] = - vtxLabel(i + 1, j, nk); - boundaryPatches_[wallLabel][wallCellLabel][2] = - vtxLabel(i + 1, j + 1, nk); - boundaryPatches_[wallLabel][wallCellLabel][3] = - vtxLabel(i, j + 1, nk); - - // update the counter - wallCellLabel++; - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockCells.C b/applications/utilities/mesh/generation/blockMesh/blockCells.C deleted file mode 100644 index acecc7170004699a225cbf0df47a07df77b2d564..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/blockMesh/blockCells.C +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - private member of block. Creates cells for the block. - -\*---------------------------------------------------------------------------*/ - -#include "error.H" -#include "block.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::block::blockCells() -{ - label ni = blockDef_.n().x(); - label nj = blockDef_.n().y(); - label nk = blockDef_.n().z(); - - label cellNo = 0; - - for (label k = 0; k <= nk - 1; k++) - { - for (label j = 0; j <= nj - 1; j++) - { - for (label i = 0; i <= ni - 1; i++) - { - cells_[cellNo].setSize(8); - - cells_[cellNo][0] = vtxLabel(i, j, k); - cells_[cellNo][1] = vtxLabel(i+1, j, k); - cells_[cellNo][2] = vtxLabel(i+1, j+1, k); - cells_[cellNo][3] = vtxLabel(i, j+1, k); - cells_[cellNo][4] = vtxLabel(i, j, k+1); - cells_[cellNo][5] = vtxLabel(i+1, j, k+1); - cells_[cellNo][6] = vtxLabel(i+1, j+1, k+1); - cells_[cellNo][7] = vtxLabel(i, j+1, k+1); - cellNo++; - } - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.C b/applications/utilities/mesh/generation/blockMesh/blockDescriptor.C deleted file mode 100644 index 7d40c4d7cb00a53ea8a84cbadf2a4cf69b3f8c5b..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.C +++ /dev/null @@ -1,248 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - -\*---------------------------------------------------------------------------*/ - -#include "error.H" - -#include "blockDescriptor.H" -#include "scalarList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void blockDescriptor::makeBlockEdges() -{ - // for all edges check the list of curved edges. If the edge is curved, - // add it to the list. If the edge is not found, create is as a line - - setEdge(0, 0, 1, n_.x()); - setEdge(1, 3, 2, n_.x()); - setEdge(2, 7, 6, n_.x()); - setEdge(3, 4, 5, n_.x()); - - setEdge(4, 0, 3, n_.y()); - setEdge(5, 1, 2, n_.y()); - setEdge(6, 5, 6, n_.y()); - setEdge(7, 4, 7, n_.y()); - - setEdge(8, 0, 4, n_.z()); - setEdge(9, 1, 5, n_.z()); - setEdge(10, 2, 6, n_.z()); - setEdge(11, 3, 7, n_.z()); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// from components -blockDescriptor::blockDescriptor -( - const cellShape& bshape, - const pointField& blockMeshPoints, - const curvedEdgeList& edges, - const Vector<label>& n, - const scalarList& expand, - const word& zoneName -) -: - blockMeshPoints_(blockMeshPoints), - blockShape_(bshape), - curvedEdges_(edges), - edgePoints_(12), - edgeWeights_(12), - n_(n), - expand_(expand), - zoneName_(zoneName) -{ - if (expand_.size() != 12) - { - FatalErrorIn - ( - "blockDescriptor::blockDescriptor" - "(const cellShape& bshape, const pointField& blockMeshPoints, " - "const curvedEdgeList& edges, label xnum, label ynum, label znum, " - "const scalarList& expand, const word& zoneName)" - ) << "Unknown definition of expansion ratios" - << exit(FatalError); - } - - makeBlockEdges(); -} - - -// from Istream -blockDescriptor::blockDescriptor -( - const pointField& blockMeshPoints, - const curvedEdgeList& edges, - Istream& is -) -: - blockMeshPoints_(blockMeshPoints), - blockShape_(is), - curvedEdges_(edges), - edgePoints_(12), - edgeWeights_(12), - n_(), - expand_(12), - zoneName_() -{ - // Look at first token - token t(is); - is.putBack(t); - - // Optional zone name - if (t.isWord()) - { - zoneName_ = t.wordToken(); - - // Consume zoneName token - is >> t; - - // New look-ahead - is >> t; - is.putBack(t); - } - - if (t.isPunctuation()) - { - if (t.pToken() == token::BEGIN_LIST) - { - is >> n_; - } - else - { - FatalIOErrorIn - ( - "blockDescriptor::blockDescriptor" - "(const pointField&, const curvedEdgeList&, Istream& is)", - is - ) << "incorrect token while reading n, expected '(', found " - << t.info() - << exit(FatalIOError); - } - } - else - { - is >> n_.x() >> n_.y() >> n_.z(); - } - - is >> t; - if (!t.isWord()) - { - is.putBack(t); - } - - scalarList expRatios(is); - - if (expRatios.size() == 3) - { - expand_[0] = expRatios[0]; - expand_[1] = expRatios[0]; - expand_[2] = expRatios[0]; - expand_[3] = expRatios[0]; - - expand_[4] = expRatios[1]; - expand_[5] = expRatios[1]; - expand_[6] = expRatios[1]; - expand_[7] = expRatios[1]; - - expand_[8] = expRatios[2]; - expand_[9] = expRatios[2]; - expand_[10] = expRatios[2]; - expand_[11] = expRatios[2]; - } - else if (expRatios.size() == 12) - { - expand_ = expRatios; - } - else - { - FatalErrorIn - ( - "blockDescriptor::blockDescriptor" - "(const pointField& blockMeshPoints, const curvedEdgeList& edges," - "Istream& is)" - ) << "Unknown definition of expansion ratios" - << exit(FatalError); - } - - // create a list of edges - makeBlockEdges(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const pointField& blockDescriptor::points() const -{ - return blockMeshPoints_; -} - -const cellShape& blockDescriptor::blockShape() const -{ - return blockShape_; -} - -const List<List<point> >& blockDescriptor::blockEdgePoints() const -{ - return edgePoints_; -} - -const scalarListList& blockDescriptor::blockEdgeWeights() const -{ - return edgeWeights_; -} - -const Vector<label>& blockDescriptor::n() const -{ - return n_; -} - -const word& blockDescriptor::zoneName() const -{ - return zoneName_; -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void blockDescriptor::operator=(const blockDescriptor&) -{ - notImplemented("void blockDescriptor::operator=(const blockDescriptor&)"); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index b4bd379d759a4f7f033010b6270efd41baf06559..6cdec703dcd52eae4e0568b5f3babef066a26803 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -146,8 +146,10 @@ int main(int argc, char *argv[]) << exit(FatalError); } - Info<< nl << "Creating block mesh from\n " - << meshDictIoPtr->objectPath() << nl << endl; + Info<< "Creating block mesh from\n " + << meshDictIoPtr->objectPath() << endl; + + blockMesh::verbose(true); IOdictionary meshDict(meshDictIoPtr()); blockMesh blocks(meshDict); @@ -195,8 +197,7 @@ int main(int argc, char *argv[]) } - - Info<< nl << "Creating mesh from block mesh" << endl; + Info<< nl << "Creating polyMesh from blockMesh" << endl; wordList patchNames = blocks.patchNames(); wordList patchTypes = blocks.patchTypes(); @@ -204,6 +205,7 @@ int main(int argc, char *argv[]) word defaultFacesType = emptyPolyPatch::typeName; wordList patchPhysicalTypes = blocks.patchPhysicalTypes(); + preservePatchTypes ( runTime, @@ -339,7 +341,7 @@ int main(int argc, char *argv[]) // Set the precision of the points data to 10 IOstream::defaultPrecision(10); - Info << nl << "Writing polyMesh" << endl; + Info<< nl << "Writing polyMesh" << endl; mesh.removeFiles(); if (!mesh.write()) { @@ -348,6 +350,38 @@ int main(int argc, char *argv[]) << exit(FatalError); } + + // + // write some information + // + { + const polyPatchList& patches = mesh.boundaryMesh(); + + Info<< "----------------" << nl + << "Mesh Information" << nl + << "----------------" << nl + << " " << "boundingBox: " << boundBox(mesh.points()) << nl + << " " << "nPoints: " << mesh.nPoints() << nl + << " " << "nCells: " << mesh.nCells() << nl + << " " << "nFaces: " << mesh.nFaces() << nl + << " " << "nInternalFaces: " << mesh.nInternalFaces() << nl; + + Info<< "----------------" << nl + << "Patches" << nl + << "----------------" << nl; + + forAll(patches, patchI) + { + const polyPatch& p = patches[patchI]; + + Info<< " " << "patch " << patchI + << " (start: " << p.start() + << " size: " << p.size() + << ") name: " << p.name() + << nl; + } + } + Info<< nl << "End" << endl; return 0; diff --git a/applications/utilities/mesh/generation/blockMesh/blockPoints.C b/applications/utilities/mesh/generation/blockMesh/blockPoints.C deleted file mode 100644 index f3026ccad0197572a7e8701e0c86e40f02a081c8..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/blockMesh/blockPoints.C +++ /dev/null @@ -1,232 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - private member of block. Creates vertices for cells filling the block. - -\*---------------------------------------------------------------------------*/ - -#include "error.H" -#include "block.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::block::blockPoints() -{ - // set local variables for mesh specification - const label ni = blockDef_.n().x(); - const label nj = blockDef_.n().y(); - const label nk = blockDef_.n().z(); - - const point p000 = blockDef_.points()[blockDef_.blockShape()[0]]; - const point p100 = blockDef_.points()[blockDef_.blockShape()[1]]; - const point p110 = blockDef_.points()[blockDef_.blockShape()[2]]; - const point p010 = blockDef_.points()[blockDef_.blockShape()[3]]; - - const point p001 = blockDef_.points()[blockDef_.blockShape()[4]]; - const point p101 = blockDef_.points()[blockDef_.blockShape()[5]]; - const point p111 = blockDef_.points()[blockDef_.blockShape()[6]]; - const point p011 = blockDef_.points()[blockDef_.blockShape()[7]]; - - // list of edge point and weighting factors - const List<List<point> >& p = blockDef_.blockEdgePoints(); - const scalarListList& w = blockDef_.blockEdgeWeights(); - - // generate vertices - - for (label k = 0; k <= nk; k++) - { - for (label j = 0; j <= nj; j++) - { - for (label i = 0; i <= ni; i++) - { - label vertexNo = vtxLabel(i, j, k); - - // points on edges - vector edgex1 = p000 + (p100 - p000)*w[0][i]; - vector edgex2 = p010 + (p110 - p010)*w[1][i]; - vector edgex3 = p011 + (p111 - p011)*w[2][i]; - vector edgex4 = p001 + (p101 - p001)*w[3][i]; - - vector edgey1 = p000 + (p010 - p000)*w[4][j]; - vector edgey2 = p100 + (p110 - p100)*w[5][j]; - vector edgey3 = p101 + (p111 - p101)*w[6][j]; - vector edgey4 = p001 + (p011 - p001)*w[7][j]; - - vector edgez1 = p000 + (p001 - p000)*w[8][k]; - vector edgez2 = p100 + (p101 - p100)*w[9][k]; - vector edgez3 = p110 + (p111 - p110)*w[10][k]; - vector edgez4 = p010 + (p011 - p010)*w[11][k]; - - // calculate the importance factors for all edges - // x - direction - scalar impx1 = - ( - (1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k]) - + w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k]) - ); - - scalar impx2 = - ( - (1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k]) - + w[1][i]*w[5][j]*(1.0 - w[10][k]) - ); - - scalar impx3 = - ( - (1.0 - w[2][i])*w[7][j]*w[11][k] - + w[2][i]*w[6][j]*w[10][k] - ); - - - scalar impx4 = - ( - (1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k] - + w[3][i]*(1.0 - w[6][j])*w[9][k] - ); - - scalar magImpx = impx1 + impx2 + impx3 + impx4; - impx1 /= magImpx; - impx2 /= magImpx; - impx3 /= magImpx; - impx4 /= magImpx; - - - // y - direction - scalar impy1 = - ( - (1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k]) - + w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k]) - ); - - scalar impy2 = - ( - (1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k]) - + w[5][j]*w[1][i]*(1.0 - w[10][k]) - ); - - scalar impy3 = - ( - (1.0 - w[6][j])*w[3][i]*w[9][k] - + w[6][j]*w[2][i]*w[10][k] - ); - - scalar impy4 = - ( - (1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k] - + w[7][j]*(1.0 - w[2][i])*w[11][k] - ); - - scalar magImpy = impy1 + impy2 + impy3 + impy4; - impy1 /= magImpy; - impy2 /= magImpy; - impy3 /= magImpy; - impy4 /= magImpy; - - - // z - direction - scalar impz1 = - ( - (1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j]) - + w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j]) - ); - - scalar impz2 = - ( - (1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j]) - + w[9][k]*w[3][i]*(1.0 - w[6][j]) - ); - - scalar impz3 = - ( - (1.0 - w[10][k])*w[1][i]*w[5][j] - + w[10][k]*w[2][i]*w[6][j] - ); - - scalar impz4 = - ( - (1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j] - + w[11][k]*(1.0 - w[2][i])*w[7][j] - ); - - scalar magImpz = impz1 + impz2 + impz3 + impz4; - impz1 /= magImpz; - impz2 /= magImpz; - impz3 /= magImpz; - impz4 /= magImpz; - - // calculate the correction vectors - vector corx1 = impx1*(p[0][i] - edgex1); - vector corx2 = impx2*(p[1][i] - edgex2); - vector corx3 = impx3*(p[2][i] - edgex3); - vector corx4 = impx4*(p[3][i] - edgex4); - - vector cory1 = impy1*(p[4][j] - edgey1); - vector cory2 = impy2*(p[5][j] - edgey2); - vector cory3 = impy3*(p[6][j] - edgey3); - vector cory4 = impy4*(p[7][j] - edgey4); - - vector corz1 = impz1*(p[8][k] - edgez1); - vector corz2 = impz2*(p[9][k] - edgez2); - vector corz3 = impz3*(p[10][k] - edgez3); - vector corz4 = impz4*(p[11][k] - edgez4); - - - // multiply by the importance factor - - // x - direction - edgex1 *= impx1; - edgex2 *= impx2; - edgex3 *= impx3; - edgex4 *= impx4; - - // y - direction - edgey1 *= impy1; - edgey2 *= impy2; - edgey3 *= impy3; - edgey4 *= impy4; - - // z - direction - edgez1 *= impz1; - edgez2 *= impz2; - edgez3 *= impz3; - edgez4 *= impz4; - - - // add the contributions - vertices_[vertexNo] = edgex1 + edgex2 + edgex3 + edgex4; - vertices_[vertexNo] += edgey1 + edgey2 + edgey3 + edgey4; - vertices_[vertexNo] += edgez1 + edgez2 + edgez3 + edgez4; - - vertices_[vertexNo] /= 3.0; - - vertices_[vertexNo] += corx1 + corx2 + corx3 + corx4; - vertices_[vertexNo] += cory1 + cory2 + cory3 + cory4; - vertices_[vertexNo] += corz1 + corz2 + corz3 + corz4; - } - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createCells.C b/applications/utilities/mesh/generation/blockMesh/createCells.C deleted file mode 100644 index 70c22f91789e31aea928f18837c49fc50325a8f5..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/blockMesh/createCells.C +++ /dev/null @@ -1,74 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "error.H" - -#include "blockMesh.H" -#include "cellModeller.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::cellShapeList Foam::blockMesh::createCells() -{ - Info<< nl << "Creating cells" << endl; - - PtrList<cellShape> cells(nCells_); - - blockMesh& blocks = *this; - - const cellModel& hex = *(cellModeller::lookup("hex")); - - label cellLabel = 0; - - forAll(blocks, blockLabel) - { - const labelListList& blockCells = blocks[blockLabel].cells(); - - forAll(blockCells, blockCellLabel) - { - labelList cellPoints(blockCells[blockCellLabel].size()); - - forAll(cellPoints, cellPointLabel) - { - cellPoints[cellPointLabel] = - mergeList_ - [ - blockCells[blockCellLabel][cellPointLabel] - + blockOffsets_[blockLabel] - ]; - } - - // Construct collapsed cell and all to list - cells.set(cellLabel, new cellShape(hex, cellPoints, true)); - - cellLabel++; - } - } - - return cells; -} - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createPoints.C b/applications/utilities/mesh/generation/blockMesh/createPoints.C deleted file mode 100644 index cd0d6010df5ae627040fe703b07352fe2e911a49..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/blockMesh/createPoints.C +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - - -\*---------------------------------------------------------------------------*/ - -#include "error.H" -#include "blockMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict) -{ - blockMesh& blocks = *this; - - scalar scaleFactor = 1.0; - - // optional 'convertToMeters' (or 'scale'?) - if (!dict.readIfPresent("convertToMeters", scaleFactor)) - { - dict.readIfPresent("scale", scaleFactor); - } - - Info<< nl << "Creating points with scale " << scaleFactor << endl; - - pointField points(nPoints_); - - forAll(blocks, blockLabel) - { - const pointField& blockPoints = blocks[blockLabel].points(); - - forAll(blockPoints, blockPointLabel) - { - points - [ - mergeList_ - [ - blockPointLabel - + blockOffsets_[blockLabel] - ] - ] = scaleFactor * blockPoints[blockPointLabel]; - } - } - - return points; -} - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C index 07ddf34eaf83b4056d5b4a8f146093ecf4224741..67abf365642afabad71e2d6f14ea9e1fffa391b9 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C @@ -26,7 +26,7 @@ License #include "wedge.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict) axis_(coeffDict_.lookup("axis")), angle_ ( - readScalar(coeffDict_.lookup("angle")) - *constant::math::pi/180.0 + degToRad(readScalar(coeffDict_.lookup("angle"))) ) {} diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index 1c74c3aff57aa36a4bcd788e0aed2d3048c70946..e6db59c8250a374574abe60d32f0445bc89f226a 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -1,7 +1,7 @@ EXE_INC = \ /* -g -DFULLDEBUG -O0 */ \ -I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \ - -I$(LIB_SRC)/autoMesh/lnInclude \ + -I$(LIB_SRC)/mesh/autoMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C index 3c48f6d7d7e86b2fadd1b07dadde324ea0f95534..15affd66e0f447bbc4f193c9f3a9c657bc0215bf 100644 --- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C +++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C @@ -33,7 +33,7 @@ Description #include "Time.H" #include "boundaryMesh.H" #include "repatchPolyTopoChanger.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "OFstream.H" #include "ListOps.H" @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); bool overwrite = args.optionFound("overwrite"); - scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0); + scalar minCos = Foam::cos(degToRad(featureAngle)); Info<< "Feature:" << featureAngle << endl << "minCos :" << minCos << endl diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C index 2a589c1643dc95f63afc26e85223fa1283105a77..96fb76ffe2cfac58730616357f77cc71011c37f2 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C @@ -47,7 +47,7 @@ using namespace Foam; int main(int argc, char *argv[]) { - timeSelector::addOptions(false); // no constant + timeSelector::addOptions(); # include "addRegionOption.H" argList::validOptions.insert("noTopology", ""); argList::validOptions.insert("allGeometry", ""); diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C index c6d7b8f61eeb832985ab9769291a72355af232b6..a76c4ad327b9939e7d26ce5ad7c604aa0602b9c4 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C @@ -67,10 +67,10 @@ Usage #include "transformField.H" #include "transformGeometricField.H" #include "IStringStream.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" using namespace Foam; -using namespace Foam::constant::math; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/miscellaneous/expandDictionary/Make/options b/applications/utilities/miscellaneous/expandDictionary/Make/options index fa15f124528ebfcaf279a88a73a0d7954f2e9dc1..18e6fe47afacb902cddccf82632772447704fd88 100644 --- a/applications/utilities/miscellaneous/expandDictionary/Make/options +++ b/applications/utilities/miscellaneous/expandDictionary/Make/options @@ -1,5 +1,2 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude - -EXE_LIBS = \ - -lfiniteVolume +/* EXE_INC = */ +/* EXE_LIBS = */ diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options index ed65d154376ca5fb02e4738b07af1e0541e0d749..421e59a7f140817e59bae04ae1837f5528023836 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options +++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options @@ -39,4 +39,5 @@ EXE_LIBS = \ -lthermophysicalFunctions \ -ltopoChangerFvMesh \ -ltriSurface \ - -lautoMesh + -lautoMesh \ + -lblockMesh diff --git a/applications/utilities/miscellaneous/foamInfoExec/Make/options b/applications/utilities/miscellaneous/foamInfoExec/Make/options index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..18e6fe47afacb902cddccf82632772447704fd88 100644 --- a/applications/utilities/miscellaneous/foamInfoExec/Make/options +++ b/applications/utilities/miscellaneous/foamInfoExec/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = */ +/* EXE_LIBS = */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 7b61fabb2213ad0e6ead78cf38034c837818e686..e4f2ee2f2573e634e832053536ba858531b5cee3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -113,13 +113,8 @@ int main(int argc, char *argv[]) } // control for renumbering iterations - bool optIndex = false; label indexingNumber = 0; - if (args.optionFound("index")) - { - optIndex = true; - indexingNumber = args.optionRead<label>("index"); - } + bool optIndex = args.optionReadIfPresent("index", indexingNumber); // always write the geometry, unless the -noMesh option is specified bool optNoMesh = args.optionFound("noMesh"); @@ -134,7 +129,7 @@ int main(int argc, char *argv[]) // or a particular time interval if (isDir(ensightDir)) { - Info<<"Warning: reusing existing directory" << nl + Info<<"Warning: re-using existing directory" << nl << " " << ensightDir << endl; } mkDir(ensightDir); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml index ef25ac03786e43e5dd407cd7ef992d6b1c3b91b4..a78bceb7d5495847af7734fe3e896d589fc639d5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml @@ -106,7 +106,7 @@ animateable="0"> <BooleanDomain name="bool"/> <Documentation> - A simple way cause a reader GUI modification. + A simple way to cause a reader GUI modification. </Documentation> </IntVectorProperty> diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 47e919c9c310efda544786f239c8904977f4ee55..55964e95407a3d4bdf6ab2a03075efce68009515 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -385,14 +385,7 @@ int vtkPV3FoamReader::RequestData foamData_->Update(output, output); #endif - if (ShowPatchNames) - { - addPatchNamesToView(); - } - else - { - removePatchNamesFromView(); - } + updatePatchNamesView(ShowPatchNames); #endif @@ -403,27 +396,7 @@ int vtkPV3FoamReader::RequestData } -void vtkPV3FoamReader::addPatchNamesToView() -{ - pqApplicationCore* appCore = pqApplicationCore::instance(); - - // Server manager model for querying items in the server manager - pqServerManagerModel* smModel = appCore->getServerManagerModel(); - - // Get all the pqRenderView instances - QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>(); - - for (int viewI=0; viewI<renderViews.size(); viewI++) - { - foamData_->addPatchNames - ( - renderViews[viewI]->getRenderViewProxy()->GetRenderer() - ); - } -} - - -void vtkPV3FoamReader::removePatchNamesFromView() +void vtkPV3FoamReader::updatePatchNamesView(const bool show) { pqApplicationCore* appCore = pqApplicationCore::instance(); @@ -435,9 +408,10 @@ void vtkPV3FoamReader::removePatchNamesFromView() for (int viewI=0; viewI<renderViews.size(); viewI++) { - foamData_->removePatchNames + foamData_->renderPatchNames ( - renderViews[viewI]->getRenderViewProxy()->GetRenderer() + renderViews[viewI]->getRenderViewProxy()->GetRenderer(), + show ); } } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h index bc21cd8ce816978129720a4822454c455897780d..4a6eb3723edb3d67fc27a876c5cd32613ef72b01 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h @@ -174,11 +174,8 @@ private: //- Disallow default bitwise assignment void operator=(const vtkPV3FoamReader&); - //- Add patch names to the view - void addPatchNamesToView(); - - //- Remove patch names from the view - void removePatchNamesFromView(); + //- Add/remove patch names to/from the view + void updatePatchNamesView(const bool show); int TimeStepRange[2]; int CacheMesh; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files index 9699e3c71ebe3c4159b36ee2f5abb09d9730ab2e..e71b857bb2e229412366860d8eaef07c1192bf3b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files @@ -7,6 +7,6 @@ vtkPV3FoamMeshSet.C vtkPV3FoamMeshVolume.C vtkPV3FoamMeshZone.C vtkPV3FoamUpdateInfo.C -vtkPV3FoamUtilities.C +vtkPV3FoamUtils.C LIB = $(FOAM_LIBBIN)/libvtkPV3Foam diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H similarity index 91% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H index adb4d724b0019f5fd9036b9d667e6ad92ac66969..6e90e75db006f1f4a2cd045ca2e7b26767c650d1 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H @@ -27,15 +27,15 @@ InClass \*---------------------------------------------------------------------------*/ -#ifndef vtkPV3FoamPoints_H -#define vtkPV3FoamPoints_H +#ifndef vtkOpenFOAMPoints_H +#define vtkOpenFOAMPoints_H // VTK includes #include "vtkPoints.h" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline void vtkPV3FoamInsertNextPoint +inline void vtkInsertNextOpenFOAMPoint ( vtkPoints *points, const Foam::point& p @@ -46,7 +46,7 @@ inline void vtkPV3FoamInsertNextPoint #if 0 // this should be faster, but didn't get it working ... -inline void vtkPV3FoamSetPoint +inline void vtkSetOpenFOAMPoint ( vtkPoints *points, const Foam::label id, @@ -58,7 +58,7 @@ inline void vtkPV3FoamSetPoint // Convert Foam mesh vertices to VTK -inline vtkPoints* vtkPV3FoamVTKPoints(const Foam::pointField& points) +inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points) { vtkPoints *vtkpoints = vtkPoints::New(); vtkpoints->SetNumberOfPoints(points.size()); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 34628ac9d1ed1a6afa49ef128625ba8b661c6bf6..6a5ab601fb4be12d8f3d424b4f661bf84da1e51a 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -590,219 +590,203 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) } -void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer) +void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show) { - // Remove any patch names previously added to the renderer - removePatchNames(renderer); + // always remove old actors first - // get the display patches, strip off any suffix - wordHashSet selectedPatches = getSelected - ( - reader_->GetPartSelection(), - partInfoPatches_ - ); - - if (!selectedPatches.size()) + forAll(patchTextActorsPtrs_, patchI) { - return; + renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]); + patchTextActorsPtrs_[patchI]->Delete(); } + patchTextActorsPtrs_.clear(); - if (debug) + if (show) { - Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl - <<"... add patches: " << selectedPatches << endl; - } + // get the display patches, strip off any suffix + wordHashSet selectedPatches = getSelected + ( + reader_->GetPartSelection(), + partInfoPatches_ + ); - const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh(); + if (!selectedPatches.size()) + { + return; + } - // Find the total number of zones - // Each zone will take the patch name - // Number of zones per patch ... zero zones should be skipped - labelList nZones(pbMesh.size(), 0); + const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh(); - // Per global zone number the average face centre position - DynamicList<point> zoneCentre(pbMesh.size()); + // Find the total number of zones + // Each zone will take the patch name + // Number of zones per patch ... zero zones should be skipped + labelList nZones(pbMesh.size(), 0); - if (debug) - { - Info<< "... determining patch zones" << endl; - } + // Per global zone number the average face centre position + DynamicList<point> zoneCentre(pbMesh.size()); - // Loop through all patches to determine zones, and centre of each zone - forAll(pbMesh, patchI) - { - const polyPatch& pp = pbMesh[patchI]; - // Only include the patch if it is selected - if (!selectedPatches.found(pp.name())) + // Loop through all patches to determine zones, and centre of each zone + forAll(pbMesh, patchI) { - continue; - } + const polyPatch& pp = pbMesh[patchI]; - const labelListList& edgeFaces = pp.edgeFaces(); - const vectorField& n = pp.faceNormals(); + // Only include the patch if it is selected + if (!selectedPatches.found(pp.name())) + { + continue; + } - boolList featEdge(pp.nEdges(), false); + const labelListList& edgeFaces = pp.edgeFaces(); + const vectorField& n = pp.faceNormals(); - forAll(edgeFaces, edgeI) - { - const labelList& eFaces = edgeFaces[edgeI]; + boolList featEdge(pp.nEdges(), false); - if (eFaces.size() == 1) + forAll(edgeFaces, edgeI) { - // Note: could also do ones with > 2 faces but this gives - // too many zones for baffles - featEdge[edgeI] = true; + const labelList& eFaces = edgeFaces[edgeI]; + + if (eFaces.size() == 1) + { + // Note: could also do ones with > 2 faces but this gives + // too many zones for baffles + featEdge[edgeI] = true; + } + else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5) + { + featEdge[edgeI] = true; + } } - else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5) - { - featEdge[edgeI] = true; - } - } - // Do topological analysis of patch, find disconnected regions - patchZones pZones(pp, featEdge); + // Do topological analysis of patch, find disconnected regions + patchZones pZones(pp, featEdge); - nZones[patchI] = pZones.nZones(); + nZones[patchI] = pZones.nZones(); - labelList zoneNFaces(pZones.nZones(), 0); + labelList zoneNFaces(pZones.nZones(), 0); - // Save start of information for current patch - label patchStart = zoneCentre.size(); + // Save start of information for current patch + label patchStart = zoneCentre.size(); - // Create storage for additional zone centres - forAll(zoneNFaces, zoneI) - { - zoneCentre.append(vector::zero); - } + // Create storage for additional zone centres + forAll(zoneNFaces, zoneI) + { + zoneCentre.append(vector::zero); + } - // Do averaging per individual zone - forAll(pp, faceI) - { - label zoneI = pZones[faceI]; - zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points()); - zoneNFaces[zoneI]++; - } + // Do averaging per individual zone + forAll(pp, faceI) + { + label zoneI = pZones[faceI]; + zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points()); + zoneNFaces[zoneI]++; + } - for (label i=0; i<nZones[patchI]; i++) - { - zoneCentre[patchStart + i] /= zoneNFaces[i]; + for (label i=0; i<nZones[patchI]; i++) + { + zoneCentre[patchStart + i] /= zoneNFaces[i]; + } } - } - - // Count number of zones we're actually going to display. This is truncated - // to a max per patch - const label MAXPATCHZONES = 20; + // Count number of zones we're actually going to display. This is truncated + // to a max per patch - label displayZoneI = 0; + const label MAXPATCHZONES = 20; - forAll(pbMesh, patchI) - { - displayZoneI += min(MAXPATCHZONES, nZones[patchI]); - } + label displayZoneI = 0; + forAll(pbMesh, patchI) + { + displayZoneI += min(MAXPATCHZONES, nZones[patchI]); + } - zoneCentre.shrink(); - if (debug) - { - Info<< "patch zone centres = " << zoneCentre << nl - << "displayed zone centres = " << displayZoneI << nl - << "zones per patch = " << nZones << endl; - } + zoneCentre.shrink(); - // Set the size of the patch labels to max number of zones - patchTextActorsPtrs_.setSize(displayZoneI); + if (debug) + { + Info<< "patch zone centres = " << zoneCentre << nl + << "displayed zone centres = " << displayZoneI << nl + << "zones per patch = " << nZones << endl; + } - if (debug) - { - Info<< "constructing patch labels" << endl; - } + // Set the size of the patch labels to max number of zones + patchTextActorsPtrs_.setSize(displayZoneI); - // Actor index - displayZoneI = 0; + if (debug) + { + Info<< "constructing patch labels" << endl; + } - // Index in zone centres - label globalZoneI = 0; + // Actor index + displayZoneI = 0; - forAll(pbMesh, patchI) - { - const polyPatch& pp = pbMesh[patchI]; + // Index in zone centres + label globalZoneI = 0; - // Only selected patches will have a non-zero number of zones - label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]); - label increment = 1; - if (nZones[patchI] >= MAXPATCHZONES) + forAll(pbMesh, patchI) { - increment = nZones[patchI]/MAXPATCHZONES; - } + const polyPatch& pp = pbMesh[patchI]; - for (label i = 0; i < nDisplayZones; i++) - { - if (debug) + // Only selected patches will have a non-zero number of zones + label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]); + label increment = 1; + if (nZones[patchI] >= MAXPATCHZONES) { - Info<< "patch name = " << pp.name() << nl - << "anchor = " << zoneCentre[globalZoneI] << nl - << "globalZoneI = " << globalZoneI << endl; + increment = nZones[patchI]/MAXPATCHZONES; } - vtkTextActor* txt = vtkTextActor::New(); - - txt->SetInput(pp.name().c_str()); - - // Set text properties - vtkTextProperty* tprop = txt->GetTextProperty(); - tprop->SetFontFamilyToArial(); - tprop->BoldOff(); - tprop->ShadowOff(); - tprop->SetLineSpacing(1.0); - tprop->SetFontSize(12); - tprop->SetColor(1.0, 0.0, 0.0); - tprop->SetJustificationToCentered(); - - // Set text to use 3-D world co-ordinates - txt->GetPositionCoordinate()->SetCoordinateSystemToWorld(); - - txt->GetPositionCoordinate()->SetValue - ( - zoneCentre[globalZoneI].x(), - zoneCentre[globalZoneI].y(), - zoneCentre[globalZoneI].z() - ); - - // Add text to each renderer - renderer->AddViewProp(txt); - - // Maintain a list of text labels added so that they can be - // removed later - patchTextActorsPtrs_[displayZoneI] = txt; - - globalZoneI += increment; - displayZoneI++; + for (label i = 0; i < nDisplayZones; i++) + { + if (debug) + { + Info<< "patch name = " << pp.name() << nl + << "anchor = " << zoneCentre[globalZoneI] << nl + << "globalZoneI = " << globalZoneI << endl; + } + + vtkTextActor* txt = vtkTextActor::New(); + + txt->SetInput(pp.name().c_str()); + + // Set text properties + vtkTextProperty* tprop = txt->GetTextProperty(); + tprop->SetFontFamilyToArial(); + tprop->BoldOff(); + tprop->ShadowOff(); + tprop->SetLineSpacing(1.0); + tprop->SetFontSize(12); + tprop->SetColor(1.0, 0.0, 0.0); + tprop->SetJustificationToCentered(); + + // Set text to use 3-D world co-ordinates + txt->GetPositionCoordinate()->SetCoordinateSystemToWorld(); + + txt->GetPositionCoordinate()->SetValue + ( + zoneCentre[globalZoneI].x(), + zoneCentre[globalZoneI].y(), + zoneCentre[globalZoneI].z() + ); + + // Add text to each renderer + renderer->AddViewProp(txt); + + // Maintain a list of text labels added so that they can be + // removed later + patchTextActorsPtrs_[displayZoneI] = txt; + + globalZoneI += increment; + displayZoneI++; + } } - } - // Resize the patch names list to the actual number of patch names added - patchTextActorsPtrs_.setSize(displayZoneI); - - if (debug) - { - Info<< "<end> Foam::vtkPV3Foam::addPatchNames" << endl; + // Resize the patch names list to the actual number of patch names added + patchTextActorsPtrs_.setSize(displayZoneI); } } -void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer) -{ - forAll(patchTextActorsPtrs_, patchI) - { - renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]); - patchTextActorsPtrs_[patchI]->Delete(); - } - patchTextActorsPtrs_.clear(); -} - void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 4e203eacec8e83c9f720257c21870c039a9ef5a4..05c84744775953e3672c2805f215b7f2d7b966b3 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -31,7 +31,6 @@ Description SourceFiles vtkPV3Foam.C vtkPV3Foam.H - vtkPV3FoamI.H vtkPV3FoamFields.C vtkPV3FoamMesh.C vtkPV3FoamMeshLagrangian.C @@ -46,7 +45,7 @@ SourceFiles vtkPV3FoamPoints.H vtkPV3FoamUpdateInfo.C vtkPV3FoamUpdateInfoFields.H - vtkPV3FoamUtilities.C + vtkPV3FoamUtils.C vtkPV3FoamVolFields.H vtkPV3FoamAddToSelection.H @@ -316,7 +315,7 @@ class vtkPV3Foam vtkDataSet* dataset, const partInfo&, const label datasetNo, - const string& datasetName + const std::string& datasetName ); // Convenience method use to convert the readers from VTK 5 @@ -627,9 +626,6 @@ class vtkPV3Foam // GUI selection helper functions - //- Extract up to the first non-word characters - inline static word getFirstWord(const char*); - //- Only keep what is listed in hashSet static void pruneObjectList ( @@ -715,11 +711,8 @@ public: // returns the count via the parameter double* findTimes(int& nTimeSteps); - //- Add patch names to the display - void addPatchNames(vtkRenderer* renderer); - - //- Remove patch names from the display - void removePatchNames(vtkRenderer* renderer); + //- Add/remove patch names to/from the view + void renderPatchNames(vtkRenderer*, const bool show); //- set the runTime to the first plausible request time, // returns the timeIndex @@ -751,8 +744,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -# include "vtkPV3FoamI.H" - #endif // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index 07d322d54250876e929526d46274ecf8e3bece92..e653b05adb5ada83590b9d1646f1434c5f2b0b8b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -33,7 +33,7 @@ Description #include "fvMesh.H" #include "IOobjectList.H" #include "passiveParticle.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkCellArray.h" @@ -86,7 +86,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh vtkIdType particleId = 0; forAllConstIter(Cloud<passiveParticle>, parcels, iter) { - vtkPV3FoamInsertNextPoint(vtkpoints, iter().position()); + vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position()); vtkcells->InsertNextCell(1, &particleId); particleId++; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index 29e8d07020852cca5fe2c74fb74438e813a0824f..d7c0f2f013b6ff47eb3e4f5f6d1a03b7e10fce72 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C @@ -31,7 +31,7 @@ Description // Foam includes #include "polyPatch.H" #include "primitivePatch.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkCellArray.h" @@ -60,7 +60,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh vtkpoints->Allocate( points.size() ); forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } vtkmesh->SetPoints(vtkpoints); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C index 7f08a215a3bc6e4db38136383a7d545fb67cca46..f363beae45c2588834788a4ff321b5de064f88e3 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C @@ -31,7 +31,7 @@ Description // Foam includes #include "faceSet.H" #include "pointSet.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkPoints.h" @@ -75,7 +75,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh vtkpoints->Allocate( points.size() ); forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } vtkmesh->SetPoints(vtkpoints); vtkpoints->Delete(); @@ -132,7 +132,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh forAllConstIter(pointSet, pSet, iter) { - vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]); + vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[iter.key()]); } vtkmesh->SetPoints(vtkpoints); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index 49f9016dc1ff2906a8bb5523b69e5b0efd462a8d..e1fd59ccd0d1c50262ac43d7c2d12b22b4b94020 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C @@ -31,7 +31,7 @@ Description // Foam includes #include "fvMesh.H" #include "cellModeller.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkCellArray.h" @@ -143,7 +143,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } @@ -267,7 +267,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh // Insert the new vertex from the cell-centre label newVertexLabel = mesh.nPoints() + addPointI; - vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]); + vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[cellI]); // Whether to insert cell in place of original or not. bool substituteCell = true; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 14c5da92c2ab27bdb462d2acb0b22aa4f5913582..0a21310a633b868c8b489943c749cc3b90c48545 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C @@ -29,7 +29,7 @@ Description #include "vtkPV3Foam.H" // Foam includes -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkPoints.h" @@ -72,7 +72,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh vtkpoints->Allocate( points.size() ); forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } vtkmesh->SetPoints(vtkpoints); @@ -131,7 +131,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh forAll(pointLabels, pointI) { - vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]); + vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[pointLabels[pointI]]); } vtkmesh->SetPoints(vtkpoints); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C similarity index 93% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C index aff0ea4eec14334b336a568665ea4d44d18adb0d..a9d12c303a22b3ea023b3a1c72b23eafc448f09b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C @@ -41,6 +41,34 @@ Description #include "vtkMultiBlockDataSet.h" #include "vtkInformation.h" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + //! @cond fileScope + // Extract up to the first non-word characters + inline word getFirstWord(const char* str) + { + if (str) + { + label n = 0; + while (str[n] && word::valid(str[n])) + { + ++n; + } + return word(str, n, true); + } + else + { + return word::null; + } + + } + //! @endcond fileScope + +} // End namespace Foam + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::vtkPV3Foam::AddToBlock @@ -49,7 +77,7 @@ void Foam::vtkPV3Foam::AddToBlock vtkDataSet* dataset, const partInfo& selector, const label datasetNo, - const string& datasetName + const std::string& datasetName ) { const int blockNo = selector.block(); diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwclean b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwclean new file mode 100755 index 0000000000000000000000000000000000000000..30ee40ddae59aebfc80c648baa6d40ce74204f43 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +rm -rf PV3blockMeshReader/Make +wclean libso vtkPV3blockMesh + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwmake new file mode 100755 index 0000000000000000000000000000000000000000..3e2c407e6e11cf08b9cd62d17f5942a3e2e8d424 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwmake @@ -0,0 +1,21 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] +then + case "$ParaView_VERSION" in + 3*) + wmake libso vtkPV3blockMesh + ( + cd PV3blockMeshReader + mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1 + cd Make/$WM_OPTIONS + cmake ../.. + make + ) + ;; + esac +fi + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc645367f49e1f026c64d4a4a140c486c7d48d7e --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt @@ -0,0 +1,56 @@ +# create a plugin that adds a reader to the ParaView GUI +# it is added in the file dialog when doing opens/saves. + +# The qrc file is processed by Qt's resource compiler (rcc) +# the qrc file must have a resource prefix of "/ParaViewResources" +# and ParaView will read anything contained under that prefix +# the pqReader.xml file contains xml defining readers with their +# file extensions and descriptions. + +cmake_minimum_required(VERSION 2.4) + +FIND_PACKAGE(ParaView REQUIRED) +INCLUDE(${PARAVIEW_USE_FILE}) + +LINK_DIRECTORIES( + $ENV{FOAM_LIBBIN} +) + +INCLUDE_DIRECTORIES( + $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude + $ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude + ${PROJECT_SOURCE_DIR}/../vtkPV3blockMesh +) + +ADD_DEFINITIONS( + -DWM_$ENV{WM_PRECISION_OPTION} +) + +# Set output library destination to plugin folder +SET( + LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH} + CACHE INTERNAL + "Single output directory for building all libraries." +) + +# Build the server-side plugin +ADD_PARAVIEW_PLUGIN( + PV3blockMeshReader_SM "1.0" + SERVER_MANAGER_XML PV3blockMeshReader_SM.xml + SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx +) + +# Build the client-side plugin +ADD_PARAVIEW_PLUGIN( + PV3blockMeshReader + "1.0" + GUI_RESOURCES PV3blockMeshReader.qrc +) + +TARGET_LINK_LIBRARIES( + PV3blockMeshReader_SM + OpenFOAM + blockMesh + vtkPV3blockMesh +) +#----------------------------------------------------------------------------- diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.qrc b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.qrc new file mode 100644 index 0000000000000000000000000000000000000000..5a3d74d0b06982021135362a2b01047409a04f20 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/ParaViewResources" > + <file>PV3blockMeshReader.xml</file> + </qresource> +</RCC> diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.xml b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b97801148105176fe530eb8dd6118235624329d --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.xml @@ -0,0 +1,6 @@ +<ParaViewReaders> + <Reader name="PV3blockMeshReader" + extensions="blockMesh" + file_description="OpenFOAM blockMesh reader"> + </Reader> +</ParaViewReaders> diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml new file mode 100644 index 0000000000000000000000000000000000000000..5eea03fe2bc4515f73cbf713ce20b075c617bc4f --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml @@ -0,0 +1,98 @@ +<ServerManagerConfiguration> + <ProxyGroup name="sources"> + <SourceProxy + name="PV3blockMeshReader" + class="vtkPV3blockMeshReader"> + + <!-- File name - compulsory --> + <StringVectorProperty + name="FileName" + command="SetFileName" + number_of_elements="1" + animateable="0"> + <FileListDomain name="files"/> + <Documentation> + Specifies the filename for the OpenFOAM blockMesh Reader. + </Documentation> + </StringVectorProperty> + + <!-- Global settings --> + + <!-- Show Point Numbers check-box --> + <IntVectorProperty + name="ShowPointNumbers" + command="SetShowPointNumbers" + number_of_elements="1" + default_values="1" + animateable="0"> + <BooleanDomain name="bool"/> + <Documentation> + Show point numbers in render window. + </Documentation> + </IntVectorProperty> + + <!-- Update GUI check box --> + <IntVectorProperty + name="UpdateGUI" + command="SetUpdateGUI" + number_of_elements="1" + default_values="0" + animateable="0"> + <BooleanDomain name="bool"/> + <Documentation> + A simple way to cause a reader GUI modification. + </Documentation> + </IntVectorProperty> + + + <!-- Selections --> + + <!-- Available Parts (blocks) array --> + <StringVectorProperty + name="PartArrayInfo" + information_only="1"> + <ArraySelectionInformationHelper attribute_name="Part"/> + </StringVectorProperty> + <StringVectorProperty + name="PartStatus" + label="Blocks" + command="SetPartArrayStatus" + number_of_elements="0" + repeat_command="1" + number_of_elements_per_command="2" + element_types="2 0" + information_property="PartArrayInfo" + animateable="0"> + <ArraySelectionDomain name="array_list"> + <RequiredProperties> + <Property name="PartArrayInfo" function="ArrayList"/> + </RequiredProperties> + </ArraySelectionDomain> + </StringVectorProperty> + + <!-- Available Parts (blocks) array --> + <StringVectorProperty + name="CurvedEdgesArrayInfo" + information_only="1"> + <ArraySelectionInformationHelper attribute_name="CurvedEdges"/> + </StringVectorProperty> + <StringVectorProperty + name="CurvedEdgesStatus" + label="Curved Edges" + command="SetCurvedEdgesArrayStatus" + number_of_elements="0" + repeat_command="1" + number_of_elements_per_command="2" + element_types="2 0" + information_property="CurvedEdgesArrayInfo" + animateable="0"> + <ArraySelectionDomain name="array_list"> + <RequiredProperties> + <Property name="CurvedEdgesArrayInfo" function="ArrayList"/> + </RequiredProperties> + </ArraySelectionDomain> + </StringVectorProperty> + + </SourceProxy> + </ProxyGroup> +</ServerManagerConfiguration> diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..451c8b5855abc0992d6f501c2c16471a2f8bb705 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx @@ -0,0 +1,381 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: vtkPV3blockMeshReader.cxx,v $ + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#include "vtkPV3blockMeshReader.h" + +#include "pqApplicationCore.h" +#include "pqRenderView.h" +#include "pqServerManagerModel.h" + +// VTK includes +#include "vtkCallbackCommand.h" +#include "vtkDataArraySelection.h" +#include "vtkInformation.h" +#include "vtkInformationVector.h" +#include "vtkMultiBlockDataSet.h" +#include "vtkObjectFactory.h" +#include "vtkSMRenderViewProxy.h" +#include "vtkStreamingDemandDrivenPipeline.h" +#include "vtkStringArray.h" + +// Foam includes +#include "vtkPV3blockMesh.H" + +vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision: 1.5$"); +vtkStandardNewMacro(vtkPV3blockMeshReader); + +vtkPV3blockMeshReader::vtkPV3blockMeshReader() +{ + Debug = 0; + vtkDebugMacro(<<"Constructor"); + + SetNumberOfInputPorts(0); + + FileName = NULL; + foamData_ = NULL; + + ShowPointNumbers = 1; + UpdateGUI = 0; + + PartSelection = vtkDataArraySelection::New(); + CurvedEdgesSelection = vtkDataArraySelection::New(); + + // Setup the selection callback to modify this object when an array + // selection is changed. + SelectionObserver = vtkCallbackCommand::New(); + SelectionObserver->SetCallback + ( + &vtkPV3blockMeshReader::SelectionModifiedCallback + ); + SelectionObserver->SetClientData(this); + + + PartSelection->AddObserver + ( + vtkCommand::ModifiedEvent, + this->SelectionObserver + ); + + CurvedEdgesSelection->AddObserver + ( + vtkCommand::ModifiedEvent, + this->SelectionObserver + ); +} + + +vtkPV3blockMeshReader::~vtkPV3blockMeshReader() +{ + vtkDebugMacro(<<"Deconstructor"); + + delete foamData_; + + if (FileName) + { + delete [] FileName; + } + + PartSelection->RemoveObserver(this->SelectionObserver); + CurvedEdgesSelection->RemoveObserver(this->SelectionObserver); + + SelectionObserver->Delete(); + PartSelection->Delete(); +} + + +// Do everything except set the output info +int vtkPV3blockMeshReader::RequestInformation +( + vtkInformation* vtkNotUsed(request), + vtkInformationVector** vtkNotUsed(inputVector), + vtkInformationVector* outputVector +) +{ + vtkDebugMacro(<<"RequestInformation"); + + if (Foam::vtkPV3blockMesh::debug) + { + cout<<"REQUEST_INFORMATION\n"; + } + + if (!FileName) + { + vtkErrorMacro("FileName has to be specified!"); + return 0; + } + + int nInfo = outputVector->GetNumberOfInformationObjects(); + + if (Foam::vtkPV3blockMesh::debug) + { + cout<<"RequestInformation with " << nInfo << " item(s)\n"; + for (int infoI = 0; infoI < nInfo; ++infoI) + { + outputVector->GetInformationObject(infoI)->Print(cout); + } + } + + if (!foamData_) + { + foamData_ = new Foam::vtkPV3blockMesh(FileName, this); + } + else + { + foamData_->updateInfo(); + } + + // might need some other type of error handling + +// { +// vtkErrorMacro("could not find valid OpenFOAM blockMesh"); +// +// // delete foamData and flag it as fatal error +// delete foamData_; +// foamData_ = NULL; +// return 0; +// } + + + return 1; +} + + +// Set the output info +int vtkPV3blockMeshReader::RequestData +( + vtkInformation* vtkNotUsed(request), + vtkInformationVector** vtkNotUsed(inputVector), + vtkInformationVector* outputVector +) +{ + vtkDebugMacro(<<"RequestData"); + + if (!FileName) + { + vtkErrorMacro("FileName has to be specified!"); + return 0; + } + + // catch previous error + if (!foamData_) + { + vtkErrorMacro("Reader failed - perhaps no mesh?"); + return 0; + } + + int nInfo = outputVector->GetNumberOfInformationObjects(); + + if (Foam::vtkPV3blockMesh::debug) + { + cout<<"RequestData with " << nInfo << " item(s)\n"; + for (int infoI = 0; infoI < nInfo; ++infoI) + { + outputVector->GetInformationObject(infoI)->Print(cout); + } + } + + vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast + ( + outputVector->GetInformationObject(0)->Get + ( + vtkMultiBlockDataSet::DATA_OBJECT() + ) + ); + + if (Foam::vtkPV3blockMesh::debug) + { + cout<< "update output with " + << output->GetNumberOfBlocks() << " blocks\n"; + } + + + foamData_->Update(output); + updatePointNumbersView(ShowPointNumbers); + + // Do any cleanup on the Foam side + foamData_->CleanUp(); + + return 1; +} + + +void vtkPV3blockMeshReader::updatePointNumbersView(const bool show) +{ + pqApplicationCore* appCore = pqApplicationCore::instance(); + + // Server manager model for querying items in the server manager + pqServerManagerModel* smModel = appCore->getServerManagerModel(); + + // Get all the pqRenderView instances + QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>(); + + for (int viewI=0; viewI<renderViews.size(); ++viewI) + { + foamData_->renderPointNumbers + ( + renderViews[viewI]->getRenderViewProxy()->GetRenderer(), + show + ); + } +} + + +void vtkPV3blockMeshReader::PrintSelf(ostream& os, vtkIndent indent) +{ + vtkDebugMacro(<<"PrintSelf"); + + this->Superclass::PrintSelf(os,indent); + os<< indent << "File name: " + << (this->FileName ? this->FileName : "(none)") << "\n"; + + foamData_->PrintSelf(os, indent); +} + + +// ---------------------------------------------------------------------- +// Parts selection list control + +vtkDataArraySelection* vtkPV3blockMeshReader::GetPartSelection() +{ + vtkDebugMacro(<<"GetPartSelection"); + return PartSelection; +} + + +int vtkPV3blockMeshReader::GetNumberOfPartArrays() +{ + vtkDebugMacro(<<"GetNumberOfPartArrays"); + return PartSelection->GetNumberOfArrays(); +} + + +const char* vtkPV3blockMeshReader::GetPartArrayName(int index) +{ + vtkDebugMacro(<<"GetPartArrayName"); + return PartSelection->GetArrayName(index); +} + + +int vtkPV3blockMeshReader::GetPartArrayStatus(const char* name) +{ + vtkDebugMacro(<<"GetPartArrayStatus"); + return PartSelection->ArrayIsEnabled(name); +} + + +void vtkPV3blockMeshReader::SetPartArrayStatus +( + const char* name, + int status +) +{ + vtkDebugMacro(<<"SetPartArrayStatus"); + if (status) + { + PartSelection->EnableArray(name); + } + else + { + PartSelection->DisableArray(name); + } +} + + +// ---------------------------------------------------------------------- +// CurvedEdges selection list control + +vtkDataArraySelection* vtkPV3blockMeshReader::GetCurvedEdgesSelection() +{ + vtkDebugMacro(<<"GetCurvedEdgesSelection"); + return CurvedEdgesSelection; +} + + +int vtkPV3blockMeshReader::GetNumberOfCurvedEdgesArrays() +{ + vtkDebugMacro(<<"GetNumberOfCurvedEdgesArrays"); + return CurvedEdgesSelection->GetNumberOfArrays(); +} + + +const char* vtkPV3blockMeshReader::GetCurvedEdgesArrayName(int index) +{ + vtkDebugMacro(<<"GetCurvedEdgesArrayName"); + return CurvedEdgesSelection->GetArrayName(index); +} + + +int vtkPV3blockMeshReader::GetCurvedEdgesArrayStatus(const char* name) +{ + vtkDebugMacro(<<"GetCurvedEdgesArrayStatus"); + return CurvedEdgesSelection->ArrayIsEnabled(name); +} + + +void vtkPV3blockMeshReader::SetCurvedEdgesArrayStatus +( + const char* name, + int status +) +{ + vtkDebugMacro(<<"SetCurvedEdgesArrayStatus"); + if (status) + { + CurvedEdgesSelection->EnableArray(name); + } + else + { + CurvedEdgesSelection->DisableArray(name); + } +} + + +// ---------------------------------------------------------------------- + +void vtkPV3blockMeshReader::SelectionModifiedCallback +( + vtkObject*, + unsigned long, + void* clientdata, + void* +) +{ + static_cast<vtkPV3blockMeshReader*>(clientdata)->SelectionModified(); +} + + +void vtkPV3blockMeshReader::SelectionModified() +{ + vtkDebugMacro(<<"SelectionModified"); + Modified(); +} + + +int vtkPV3blockMeshReader::FillOutputPortInformation +( + int port, + vtkInformation* info +) +{ + if (port == 0) + { + return this->Superclass::FillOutputPortInformation(port, info); + } + info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet"); + return 1; +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h new file mode 100644 index 0000000000000000000000000000000000000000..b26cde357dd481b37d2b07edbf2a458bfb5a0578 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h @@ -0,0 +1,153 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: vtkPV3blockMeshReader.h,v $ + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +// .NAME vtkPV3blockMeshReader - reads a dataset in OpenFOAM bockMesh format +// .SECTION Description +// vtkPV3blockMeshReader creates an multiblock dataset. +// It uses the OpenFOAM infrastructure (blockMesh). + +#ifndef __vtkPV3blockMeshReader_h +#define __vtkPV3blockMeshReader_h + +// Foam forward declarations +namespace Foam +{ + class vtkPV3blockMesh; +} + +// VTK includes +#include "vtkMultiBlockDataSetAlgorithm.h" + +// VTK forward declarations +class vtkDataArraySelection; +class vtkCallbackCommand; + + +class VTK_IO_EXPORT vtkPV3blockMeshReader +: + public vtkMultiBlockDataSetAlgorithm +{ +public: + vtkTypeRevisionMacro(vtkPV3blockMeshReader,vtkMultiBlockDataSetAlgorithm); + void PrintSelf(ostream&, vtkIndent); + + static vtkPV3blockMeshReader* New(); + + // Description: + // Set/Get the filename. + vtkSetStringMacro(FileName); + vtkGetStringMacro(FileName); + + // Description: + // GUI update control + vtkSetMacro(UpdateGUI, int); + vtkGetMacro(UpdateGUI, int); + + // Description: + // FOAM display patch names control + vtkSetMacro(ShowPointNumbers, int); + vtkGetMacro(ShowPointNumbers, int); + + // Description: + // Parts (blocks) selection list control + vtkDataArraySelection* GetPartSelection(); + int GetNumberOfPartArrays(); + int GetPartArrayStatus(const char*); + void SetPartArrayStatus(const char*, int status); + const char* GetPartArrayName(int index); + + // Description: + // Parts (blocks) selection list control + vtkDataArraySelection* GetCurvedEdgesSelection(); + int GetNumberOfCurvedEdgesArrays(); + int GetCurvedEdgesArrayStatus(const char*); + void SetCurvedEdgesArrayStatus(const char*, int status); + const char* GetCurvedEdgesArrayName(int index); + + // Description: + // Callback registered with the SelectionObserver + // for all the selection lists + static void SelectionModifiedCallback + ( + vtkObject* caller, + unsigned long eid, + void* clientdata, + void* calldata + ); + + void SelectionModified(); + + +protected: + + //- Construct null + vtkPV3blockMeshReader(); + + //- Destructor + ~vtkPV3blockMeshReader(); + + //- Return information about mesh, times, etc without loading anything + virtual int RequestInformation + ( + vtkInformation*, + vtkInformationVector**, + vtkInformationVector* + ); + + //- Get the mesh/fields for a particular time + virtual int RequestData + ( + vtkInformation*, + vtkInformationVector**, + vtkInformationVector* + ); + + //- Fill in additional port information + virtual int FillOutputPortInformation(int, vtkInformation*); + + // The observer to modify this object when array selections are modified + vtkCallbackCommand* SelectionObserver; + + char* FileName; + +private: + + //- Disallow default bitwise copy construct + vtkPV3blockMeshReader(const vtkPV3blockMeshReader&); + + //- Disallow default bitwise assignment + void operator=(const vtkPV3blockMeshReader&); + + //- Add/remove point numbers to/from the view + void updatePointNumbersView(const bool show); + + int ShowPointNumbers; + + //- Dummy variable/switch to invoke a reader update + int UpdateGUI; + + vtkDataArraySelection* PartSelection; + + vtkDataArraySelection* CurvedEdgesSelection; + + //BTX + Foam::vtkPV3blockMesh* foamData_; + //ETX +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/files b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..f084cc9f28fbc5faa5d02b2a857a9e4fc7f5eaf5 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/files @@ -0,0 +1,5 @@ +vtkPV3blockMesh.C +vtkPV3blockMeshConvert.C +vtkPV3blockMeshUtils.C + +LIB = $(FOAM_LIBBIN)/libvtkPV3blockMesh diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/options b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..2e5727ba771c060bb4855afee63eeedc3184a12d --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/mesh/blockMesh/lnInclude \ + -I$(ParaView_DIR)/VTK \ + -I$(ParaView_INST_DIR) \ + -I$(ParaView_INST_DIR)/VTK \ + -I$(ParaView_INST_DIR)/VTK/Common \ + -I$(ParaView_INST_DIR)/VTK/Filtering \ + -I$(ParaView_INST_DIR)/VTK/Rendering \ + -I../PV3blockMeshReader + +LIB_LIBS = \ + -lmeshTools \ + -lblockMesh \ + $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkDataArrayTemplateImplicit.txx b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkDataArrayTemplateImplicit.txx new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H similarity index 80% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H rename to applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H index 626c90a7a425960acd8abc2fef199892cdd70b4b..b6fa0c83b0ed105f9bfaadb8d3cbe30229262365 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H @@ -22,27 +22,30 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +InClass + vtkPV3blockMesh + \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifndef vtkOpenFOAMPoints_H +#define vtkOpenFOAMPoints_H -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// VTK includes +#include "vtkPoints.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str) +inline void vtkInsertNextOpenFOAMPoint +( + vtkPoints *points, + const Foam::point& p +) { - if (str) - { - label n = 0; - while (str[n] && word::valid(str[n])) - { - ++n; - } - return word(str, n, true); - } - else - { - return word::null; - } + points->InsertNextPoint(p.x(), p.y(), p.z()); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C new file mode 100644 index 0000000000000000000000000000000000000000..2dc5bc32e3aff5d092706c7bd263d9f9eed2e857 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C @@ -0,0 +1,433 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "vtkPV3blockMesh.H" +#include "vtkPV3blockMeshReader.h" + +// Foam includes +#include "blockMesh.H" +#include "Time.H" +#include "patchZones.H" +#include "OStringStream.H" + +// VTK includes +#include "vtkDataArraySelection.h" +#include "vtkMultiBlockDataSet.h" +#include "vtkRenderer.h" +#include "vtkTextActor.h" +#include "vtkTextProperty.h" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::vtkPV3blockMesh, 0); + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::vtkPV3blockMesh::resetCounters() +{ + // Reset mesh part ids and sizes + partInfoBlocks_.reset(); + partInfoEdges_.reset(); + partInfoCorners_.reset(); +} + + +void Foam::vtkPV3blockMesh::updateInfoBlocks() +{ + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoBlocks" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl; + } + + vtkDataArraySelection* selection = reader_->GetPartSelection(); + partInfoBlocks_ = selection->GetNumberOfArrays(); + + const blockMesh& blkMesh = *meshPtr_; + const int nBlocks = blkMesh.size(); + for (int blockI = 0; blockI < nBlocks; ++blockI) + { + const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + + word partName = Foam::name(blockI); + + // append the (optional) zone name + if (!blockDef.zoneName().empty()) + { + partName += " - " + blockDef.zoneName(); + } + + // Add blockId and zoneName to GUI list + selection->AddArray(partName.c_str()); + } + + partInfoBlocks_ += nBlocks; + + if (debug) + { + // just for debug info + getSelectedArrayEntries(selection); + + Info<< "<end> Foam::vtkPV3blockMesh::updateInfoBlocks" << endl; + } +} + + +void Foam::vtkPV3blockMesh::updateInfoEdges() +{ + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoEdges" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl; + } + + vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection(); + partInfoEdges_ = selection->GetNumberOfArrays(); + + const blockMesh& blkMesh = *meshPtr_; + const curvedEdgeList& edges = blkMesh.edges(); + + const int nEdges = edges.size(); + forAll(edges, edgeI) + { + OStringStream ostr; + + ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - " + << edges[edgeI].type(); + + // Add "beg:end - type" to GUI list + selection->AddArray(ostr.str().c_str()); + } + + partInfoEdges_ += nEdges; + + if (debug) + { + // just for debug info + getSelectedArrayEntries(selection); + + Info<< "<end> Foam::vtkPV3blockMesh::updateInfoEdges" << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::vtkPV3blockMesh::vtkPV3blockMesh +( + const char* const FileName, + vtkPV3blockMeshReader* reader +) +: + reader_(reader), + dbPtr_(NULL), + meshPtr_(NULL), + partInfoBlocks_("block"), + partInfoEdges_("edges"), + partInfoCorners_("corners") +{ + if (debug) + { + Info<< "Foam::vtkPV3blockMesh::vtkPV3blockMesh - " + << FileName << endl; + } + + // avoid argList and get rootPath/caseName directly from the file + fileName fullCasePath(fileName(FileName).path()); + + if (!isDir(fullCasePath)) + { + return; + } + if (fullCasePath == ".") + { + fullCasePath = cwd(); + } + + // Set the case as an environment variable - some BCs might use this + if (fullCasePath.name().find("processor", 0) == 0) + { + const fileName globalCase = fullCasePath.path(); + + setEnv("FOAM_CASE", globalCase, true); + setEnv("FOAM_CASENAME", globalCase.name(), true); + } + else + { + setEnv("FOAM_CASE", fullCasePath, true); + setEnv("FOAM_CASENAME", fullCasePath.name(), true); + } + + // look for 'case{region}.OpenFOAM' + // could be stringent and insist the prefix match the directory name... + // Note: cannot use fileName::name() due to the embedded '{}' + string caseName(fileName(FileName).lessExt()); + + if (debug) + { + Info<< "fullCasePath=" << fullCasePath << nl + << "FOAM_CASE=" << getEnv("FOAM_CASE") << nl + << "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << endl; + } + + // Create time object + dbPtr_.reset + ( + new Time + ( + Time::controlDictName, + fileName(fullCasePath.path()), + fileName(fullCasePath.name()) + ) + ); + + dbPtr_().functionObjects().off(); + + updateInfo(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::vtkPV3blockMesh::~vtkPV3blockMesh() +{ + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::~vtkPV3blockMesh" << endl; + } + + delete meshPtr_; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::vtkPV3blockMesh::updateInfo() +{ + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::updateInfo" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl; + } + + resetCounters(); + + vtkDataArraySelection* partSelection = reader_->GetPartSelection(); + vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection(); + + // enable 'internalMesh' on the first call + // or preserve the enabled selections + stringList enabledParts; + stringList enabledEdges; + bool firstTime = false; + if (!partSelection->GetNumberOfArrays() && !meshPtr_) + { + firstTime = true; + } + else + { + enabledParts = getSelectedArrayEntries(partSelection); + enabledEdges = getSelectedArrayEntries(edgeSelection); + } + + // Clear current mesh parts list + partSelection->RemoveAllArrays(); + edgeSelection->RemoveAllArrays(); + + // need a blockMesh + updateFoamMesh(); + + // Update mesh parts list + updateInfoBlocks(); + + // Update curved edges list + updateInfoEdges(); + + // restore the enabled selections + if (!firstTime) + { + setSelectedArrayEntries(partSelection, enabledParts); + setSelectedArrayEntries(edgeSelection, enabledEdges); + } + + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::updateInfo" << endl; + } +} + + +void Foam::vtkPV3blockMesh::updateFoamMesh() +{ + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::updateFoamMesh" << endl; + } + + // Check to see if the FOAM mesh has been created + if (!meshPtr_) + { + if (debug) + { + Info<< "Creating blockMesh at time=" << dbPtr_().timeName() + << endl; + } + + IOdictionary meshDict + ( + IOobject + ( + "blockMeshDict", + dbPtr_().constant(), + polyMesh::meshSubDir, + dbPtr_(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + meshPtr_ = new blockMesh(meshDict); + } + + + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::updateFoamMesh" << endl; + } +} + + +void Foam::vtkPV3blockMesh::Update +( + vtkMultiBlockDataSet* output +) +{ + reader_->UpdateProgress(0.1); + + // Set up mesh parts selection(s) + updateBoolListStatus(partStatus_, reader_->GetPartSelection()); + + // Set up curved edges selection(s) + updateBoolListStatus(edgeStatus_, reader_->GetCurvedEdgesSelection()); + + reader_->UpdateProgress(0.2); + + // Update the Foam mesh + updateFoamMesh(); + reader_->UpdateProgress(0.5); + + // Convert mesh elemente + int blockNo = 0; + + convertMeshCorners(output, blockNo); + convertMeshBlocks(output, blockNo); + convertMeshEdges(output, blockNo); + + reader_->UpdateProgress(0.8); + +} + + +void Foam::vtkPV3blockMesh::CleanUp() +{ + reader_->UpdateProgress(1.0); +} + + +void Foam::vtkPV3blockMesh::renderPointNumbers +( + vtkRenderer* renderer, + const bool show +) +{ + // always remove old actors first + + forAll(pointNumberTextActorsPtrs_, pointI) + { + renderer->RemoveViewProp(pointNumberTextActorsPtrs_[pointI]); + pointNumberTextActorsPtrs_[pointI]->Delete(); + } + pointNumberTextActorsPtrs_.clear(); + + if (show && meshPtr_) + { + const pointField& cornerPts = meshPtr_->blockPointField(); + + pointNumberTextActorsPtrs_.setSize(cornerPts.size()); + forAll(cornerPts, pointI) + { + vtkTextActor* txt = vtkTextActor::New(); + + txt->SetInput(Foam::name(pointI).c_str()); + + // Set text properties + vtkTextProperty* tprop = txt->GetTextProperty(); + tprop->SetFontFamilyToArial(); + tprop->BoldOn(); + tprop->ShadowOff(); + tprop->SetLineSpacing(1.0); + tprop->SetFontSize(14); + tprop->SetColor(1.0, 0.0, 1.0); + tprop->SetJustificationToCentered(); + + // Set text to use 3-D world co-ordinates + txt->GetPositionCoordinate()->SetCoordinateSystemToWorld(); + + txt->GetPositionCoordinate()->SetValue + ( + cornerPts[pointI].x(), + cornerPts[pointI].y(), + cornerPts[pointI].z() + ); + + // Add text to each renderer + renderer->AddViewProp(txt); + + // Maintain a list of text labels added so that they can be + // removed later + pointNumberTextActorsPtrs_[pointI] = txt; + } + } +} + + + +void Foam::vtkPV3blockMesh::PrintSelf(ostream& os, vtkIndent indent) const +{ +#if 0 + os << indent << "Number of nodes: " + << (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n"; + + os << indent << "Number of cells: " + << (meshPtr_ ? meshPtr_->nCells() : 0) << "\n"; + + os << indent << "Number of available time steps: " + << (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl; +#endif +} + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..6001267ef86c5d720bd188d7e3d4bab2d152af57 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H @@ -0,0 +1,353 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::vtkPV3blockMesh + +Description + Provides a reader interface for OpenFOAM blockMesh to VTK interaction + +SourceFiles + vtkPV3blockMesh.C + vtkPV3blockMeshConvert.C + vtkPV3blockMeshUpdate.C + vtkPV3blockMeshUtils.C + + // Needed by VTK: + vtkDataArrayTemplateImplicit.txx + +\*---------------------------------------------------------------------------*/ + +#ifndef vtkPV3blockMesh_H +#define vtkPV3blockMesh_H + +// do not include legacy strstream headers +#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS +# define VTK_EXCLUDE_STRSTREAM_HEADERS +#endif + +#include "className.H" +#include "fileName.H" +#include "stringList.H" +#include "wordList.H" + +#include "primitivePatch.H" + +// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // + +class vtkDataArraySelection; +class vtkDataSet; +class vtkPoints; +class vtkPV3blockMeshReader; +class vtkRenderer; +class vtkTextActor; +class vtkMultiBlockDataSet; +class vtkPolyData; +class vtkUnstructuredGrid; +class vtkIndent; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Foam class forward declarations +class argList; +class Time; +class blockMesh; + +template<class Type> class List; + +/*---------------------------------------------------------------------------*\ + Class vtkPV3blockMesh Declaration +\*---------------------------------------------------------------------------*/ + +class vtkPV3blockMesh +{ + // Private classes + + //- Bookkeeping for GUI checklists and the multi-block organization + class partInfo + { + const char *name_; + int block_; + int start_; + int size_; + + public: + + partInfo(const char *name, const int blockNo=0) + : + name_(name), + block_(blockNo), + start_(-1), + size_(0) + {} + + //- Return the block holding these datasets + int block() const + { + return block_; + } + + //- Assign block number, return previous value + int block(int blockNo) + { + int prev = block_; + block_ = blockNo; + return prev; + } + + const char* name() const + { + return name_; + } + + int start() const + { + return start_; + } + + int end() const + { + return start_ + size_; + } + + int size() const + { + return size_; + } + + bool empty() const + { + return !size_; + } + + void reset() + { + start_ = -1; + size_ = 0; + } + + //- Assign new start and reset the size + void operator=(const int i) + { + start_ = i; + size_ = 0; + } + + //- Increment the size + void operator+=(const int n) + { + size_ += n; + } + }; + + + // Private Data + + //- Access to the controlling vtkPV3blockMeshReader + vtkPV3blockMeshReader* reader_; + + //- Foam time control + autoPtr<Time> dbPtr_; + + //- Foam mesh + blockMesh* meshPtr_; + + //- Selected geometrical parts + boolList partStatus_; + + //- Selected curved edges + boolList edgeStatus_; + + //- First instance and size of bleckMesh blocks + // used to index into partStatus_ + partInfo partInfoBlocks_; + + //- First instance and size of CurvedEdges + // only partially used + partInfo partInfoEdges_; + + //- First instance and size of block corners + // only partially used + partInfo partInfoCorners_; + + //- List of point numbers for rendering to window + List<vtkTextActor*> pointNumberTextActorsPtrs_; + + // Private Member Functions + + // Convenience method use to convert the readers from VTK 5 + // multiblock API to the current composite data infrastructure + static void AddToBlock + ( + vtkMultiBlockDataSet* output, + vtkDataSet* dataset, + const partInfo&, + const label datasetNo, + const std::string& datasetName + ); + + // Convenience method use to convert the readers from VTK 5 + // multiblock API to the current composite data infrastructure + static vtkDataSet* GetDataSetFromBlock + ( + vtkMultiBlockDataSet* output, + const partInfo&, + const label datasetNo + ); + + // Convenience method use to convert the readers from VTK 5 + // multiblock API to the current composite data infrastructure + static label GetNumberOfDataSets + ( + vtkMultiBlockDataSet* output, + const partInfo& + ); + + //- Update boolList from GUI selection + static void updateBoolListStatus + ( + boolList&, + vtkDataArraySelection* + ); + + //- Reset data counters + void resetCounters(); + + // Update information helper functions + + //- Internal block info + void updateInfoBlocks(); + + //- block curved edges info + void updateInfoEdges(); + + // Update helper functions + + //- Foam mesh + void updateFoamMesh(); + + // Mesh conversion functions + + //- mesh blocks + void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo); + + //- mesh curved edges + void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo); + + //- mesh corners + void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo); + + + // GUI selection helper functions + + //- Retrieve the current selections + static wordHashSet getSelected(vtkDataArraySelection*); + + //- Retrieve a sub-list of the current selections + static wordHashSet getSelected + ( + vtkDataArraySelection*, + const partInfo& + ); + + //- Retrieve the current selections + static stringList getSelectedArrayEntries(vtkDataArraySelection*); + + //- Retrieve a sub-list of the current selections + static stringList getSelectedArrayEntries + ( + vtkDataArraySelection*, + const partInfo& + ); + + //- Set selection(s) + static void setSelectedArrayEntries + ( + vtkDataArraySelection*, + const stringList& + ); + + + //- Disallow default bitwise copy construct + vtkPV3blockMesh(const vtkPV3blockMesh&); + + //- Disallow default bitwise assignment + void operator=(const vtkPV3blockMesh&); + + +public: + + //- Static data members + + ClassName("vtkPV3blockMesh"); + + + // Constructors + + //- Construct from components + vtkPV3blockMesh + ( + const char* const FileName, + vtkPV3blockMeshReader* reader + ); + + + //- Destructor + + ~vtkPV3blockMesh(); + + + // Member Functions + + //- Update + void updateInfo(); + + void Update(vtkMultiBlockDataSet* output); + + //- Clean any storage + void CleanUp(); + + //- Add/remove point numbers to/from the view + void renderPointNumbers(vtkRenderer*, const bool show); + + // Access + + //- Debug information + void PrintSelf(ostream&, vtkIndent) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C new file mode 100644 index 0000000000000000000000000000000000000000..c163ba14ed479236779910afa39accd1218de037 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C @@ -0,0 +1,318 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + +\*---------------------------------------------------------------------------*/ + +#include "vtkPV3blockMesh.H" +#include "vtkPV3blockMeshReader.h" + +// Foam includes +#include "blockMesh.H" +#include "Time.H" + +#include "vtkOpenFOAMPoints.H" + +// VTK includes +#include "vtkCellArray.h" +#include "vtkDataArraySelection.h" +#include "vtkMultiBlockDataSet.h" +#include "vtkPoints.h" +#include "vtkPolyData.h" +#include "vtkUnstructuredGrid.h" + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::vtkPV3blockMesh::convertMeshBlocks +( + vtkMultiBlockDataSet* output, + int& blockNo +) +{ + vtkDataArraySelection* selection = reader_->GetPartSelection(); + partInfo& selector = partInfoBlocks_; + selector.block(blockNo); // set output block + label datasetNo = 0; // restart at dataset 0 + + const blockMesh& blkMesh = *meshPtr_; + const Foam::pointField& blockPoints = blkMesh.blockPointField(); + + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl; + } + + int blockI = 0; + + for + ( + int partId = selector.start(); + partId < selector.end(); + ++partId, ++blockI + ) + { + if (!partStatus_[partId]) + { + continue; + } + + const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + word partName("block"); + +// // append the (optional) zone name +// if (!blockDef.zoneName().empty()) +// { +// partName += " - " + blockDef.zoneName(); +// } +// + vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New(); + + // Convert Foam mesh vertices to VTK + vtkPoints *vtkpoints = vtkPoints::New(); + vtkpoints->Allocate( blockDef.nPoints() ); + const labelList& blockLabels = blockDef.blockShape(); + + vtkmesh->Allocate(1); + vtkIdType nodeIds[8]; + + forAll(blockLabels, ptI) + { + vtkInsertNextOpenFOAMPoint + ( + vtkpoints, + blockPoints[blockLabels[ptI]] + ); + + nodeIds[ptI] = ptI; + } + + vtkmesh->InsertNextCell + ( + VTK_HEXAHEDRON, + 8, + nodeIds + ); + + vtkmesh->SetPoints(vtkpoints); + vtkpoints->Delete(); + + AddToBlock + ( + output, vtkmesh, selector, datasetNo, + selection->GetArrayName(partId) + ); + + vtkmesh->Delete(); + datasetNo++; + } + + + // anything added? + if (datasetNo) + { + ++blockNo; + } + + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl; + } +} + + +void Foam::vtkPV3blockMesh::convertMeshEdges +( + vtkMultiBlockDataSet* output, + int& blockNo +) +{ + vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection(); + partInfo& selector = partInfoEdges_; + + selector.block(blockNo); // set output block + label datasetNo = 0; // restart at dataset 0 + + const blockMesh& blkMesh = *meshPtr_; + const curvedEdgeList& edges = blkMesh.edges(); + + int edgeI = 0; + + for + ( + int partId = selector.start(); + partId < selector.end(); + ++partId, ++edgeI + ) + { + if (!edgeStatus_[partId]) + { + continue; + } + + OStringStream ostr; + + ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - " + << edges[edgeI].type(); + + // search each block + forAll(blkMesh, blockI) + { + const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + + edgeList blkEdges = blockDef.blockShape().edges(); + + + // find the corresponding edge within the block + + label foundEdgeI = -1; + forAll(blkEdges, blkEdgeI) + { + if (edges[edgeI].compare(blkEdges[blkEdgeI])) + { + foundEdgeI = blkEdgeI; + break; + } + } + + if (foundEdgeI != -1) + { + const List<point>& edgePoints = + blockDef.blockEdgePoints()[foundEdgeI]; + + + vtkPolyData* vtkmesh = vtkPolyData::New(); + vtkPoints* vtkpoints = vtkPoints::New(); + + vtkpoints->Allocate( edgePoints.size() ); + vtkmesh->Allocate(1); + + vtkIdType pointIds[edgePoints.size()]; + forAll(edgePoints, ptI) + { + vtkInsertNextOpenFOAMPoint(vtkpoints, edgePoints[ptI]); + pointIds[ptI] = ptI; + } + + vtkmesh->InsertNextCell + ( + VTK_POLY_LINE, + edgePoints.size(), + pointIds + ); + + vtkmesh->SetPoints(vtkpoints); + vtkpoints->Delete(); + + AddToBlock + ( + output, vtkmesh, selector, datasetNo, + selection->GetArrayName(partId) + ); + + vtkmesh->Delete(); + datasetNo++; + + break; + } + } + } + + + // anything added? + if (datasetNo) + { + ++blockNo; + } + + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::convertMeshEdges" << endl; + } + +} + + +void Foam::vtkPV3blockMesh::convertMeshCorners +( + vtkMultiBlockDataSet* output, + int& blockNo +) +{ + partInfo& selector = partInfoCorners_; + selector.block(blockNo); // set output block + label datasetNo = 0; // restart at dataset 0 + + const pointField& blockPoints = meshPtr_->blockPointField(); + + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshCorners" << endl; + } + + if (true) // or some flag or other condition + { + vtkPolyData* vtkmesh = vtkPolyData::New(); + vtkPoints* vtkpoints = vtkPoints::New(); + vtkCellArray* vtkcells = vtkCellArray::New(); + + vtkpoints->Allocate( blockPoints.size() ); + vtkcells->Allocate( blockPoints.size() ); + + vtkIdType pointId = 0; + forAll(blockPoints, ptI) + { + vtkInsertNextOpenFOAMPoint(vtkpoints, blockPoints[ptI]); + + vtkcells->InsertNextCell(1, &pointId); + pointId++; + } + + vtkmesh->SetPoints(vtkpoints); + vtkpoints->Delete(); + + vtkmesh->SetVerts(vtkcells); + vtkcells->Delete(); + + AddToBlock(output, vtkmesh, selector, datasetNo, partInfoCorners_.name()); + vtkmesh->Delete(); + + datasetNo++; + } + + // anything added? + if (datasetNo) + { + ++blockNo; + } + + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::convertMeshCorners" << endl; + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C new file mode 100644 index 0000000000000000000000000000000000000000..b948c5e97978495ea66de789803e09b352523593 --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C @@ -0,0 +1,358 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Misc helper methods and utilities + +\*---------------------------------------------------------------------------*/ + +#include "vtkPV3blockMesh.H" +#include "vtkPV3blockMeshReader.h" + +// VTK includes +#include "vtkDataArraySelection.h" +#include "vtkDataSet.h" +#include "vtkMultiBlockDataSet.h" +#include "vtkInformation.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + //! @cond fileScope + // Extract up to the first non-word characters + inline word getFirstWord(const char* str) + { + if (str) + { + label n = 0; + while (str[n] && word::valid(str[n])) + { + ++n; + } + return word(str, n, true); + } + else + { + return word::null; + } + + } + //! @endcond fileScope + +} // End namespace Foam + + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::vtkPV3blockMesh::AddToBlock +( + vtkMultiBlockDataSet* output, + vtkDataSet* dataset, + const partInfo& selector, + const label datasetNo, + const std::string& datasetName +) +{ + const int blockNo = selector.block(); + + vtkDataObject* blockDO = output->GetBlock(blockNo); + vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO); + + if (!block) + { + if (blockDO) + { + FatalErrorIn("Foam::vtkPV3blockMesh::AddToBlock") + << "Block already has a vtkDataSet assigned to it" + << endl; + return; + } + + block = vtkMultiBlockDataSet::New(); + output->SetBlock(blockNo, block); + block->Delete(); + } + + if (debug) + { + Info<< "block[" << blockNo << "] has " + << block->GetNumberOfBlocks() + << " datasets prior to adding set " << datasetNo + << " with name: " << datasetName << endl; + } + + block->SetBlock(datasetNo, dataset); + + // name the block when assigning dataset 0 + if (datasetNo == 0) + { + output->GetMetaData(blockNo)->Set + ( + vtkCompositeDataSet::NAME(), + selector.name() + ); + } + + if (datasetName.size()) + { + block->GetMetaData(datasetNo)->Set + ( + vtkCompositeDataSet::NAME(), + datasetName.c_str() + ); + } +} + + +vtkDataSet* Foam::vtkPV3blockMesh::GetDataSetFromBlock +( + vtkMultiBlockDataSet* output, + const partInfo& selector, + const label datasetNo +) +{ + const int blockNo = selector.block(); + + vtkDataObject* blockDO = output->GetBlock(blockNo); + vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO); + + if (block) + { + return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo)); + } + + return 0; +} + + +// ununsed at the moment +Foam::label Foam::vtkPV3blockMesh::GetNumberOfDataSets +( + vtkMultiBlockDataSet* output, + const partInfo& selector +) +{ + const int blockNo = selector.block(); + + vtkDataObject* blockDO = output->GetBlock(blockNo); + vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO); + if (block) + { + return block->GetNumberOfBlocks(); + } + + return 0; +} + + +Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected +( + vtkDataArraySelection* select +) +{ + int nElem = select->GetNumberOfArrays(); + wordHashSet selections(2*nElem); + + for (int elemI=0; elemI < nElem; ++elemI) + { + if (select->GetArraySetting(elemI)) + { + selections.insert(getFirstWord(select->GetArrayName(elemI))); + } + } + + return selections; +} + + +Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected +( + vtkDataArraySelection* select, + const partInfo& selector +) +{ + int nElem = select->GetNumberOfArrays(); + wordHashSet selections(2*nElem); + + for (int elemI = selector.start(); elemI < selector.end(); ++elemI) + { + if (select->GetArraySetting(elemI)) + { + selections.insert(getFirstWord(select->GetArrayName(elemI))); + } + } + + return selections; +} + + +Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries +( + vtkDataArraySelection* select +) +{ + stringList selections(select->GetNumberOfArrays()); + label nElem = 0; + + forAll(selections, elemI) + { + if (select->GetArraySetting(elemI)) + { + selections[nElem++] = select->GetArrayName(elemI); + } + } + selections.setSize(nElem); + + + if (debug) + { + label nElem = select->GetNumberOfArrays(); + Info<< "available("; + for (int elemI = 0; elemI < nElem; ++elemI) + { + Info<< " \"" << select->GetArrayName(elemI) << "\""; + } + Info<< " )\nselected("; + + forAll(selections, elemI) + { + Info<< " " << selections[elemI]; + } + Info<< " )\n"; + } + + return selections; +} + + +Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries +( + vtkDataArraySelection* select, + const partInfo& selector +) +{ + stringList selections(selector.size()); + label nElem = 0; + + for (int elemI = selector.start(); elemI < selector.end(); ++elemI) + { + if (select->GetArraySetting(elemI)) + { + selections[nElem++] = select->GetArrayName(elemI); + } + } + selections.setSize(nElem); + + + if (debug) + { + Info<< "available("; + for (int elemI = selector.start(); elemI < selector.end(); ++elemI) + { + Info<< " \"" << select->GetArrayName(elemI) << "\""; + } + Info<< " )\nselected("; + + forAll(selections, elemI) + { + Info<< " " << selections[elemI]; + } + Info<< " )\n"; + } + + return selections; +} + + +void Foam::vtkPV3blockMesh::setSelectedArrayEntries +( + vtkDataArraySelection* select, + const stringList& selections +) +{ + const int nElem = select->GetNumberOfArrays(); + select->DisableAllArrays(); + + // Loop through entries, setting values from selectedEntries + for (int elemI=0; elemI < nElem; ++elemI) + { + string arrayName(select->GetArrayName(elemI)); + + forAll(selections, elemI) + { + if (selections[elemI] == arrayName) + { + select->EnableArray(arrayName.c_str()); + break; + } + } + } +} + + +void Foam::vtkPV3blockMesh::updateBoolListStatus +( + boolList& status, + vtkDataArraySelection* selection +) +{ + if (debug) + { + Info<< "<beg> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl; + } + + const label nElem = selection->GetNumberOfArrays(); + if (status.size() != nElem) + { + status.setSize(nElem); + status = false; + } + + forAll(status, elemI) + { + const int setting = selection->GetArraySetting(elemI); + + status[elemI] = setting; + + if (debug) + { + Info<< " part[" << elemI << "] = " + << status[elemI] + << " : " << selection->GetArrayName(elemI) << endl; + } + } + if (debug) + { + Info<< "<end> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl; + } +} + + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/files b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..fe66ad822487d44cab4d6b56f3fc3013cb55aca7 --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/files @@ -0,0 +1,3 @@ +foamListTimes.C + +EXE = $(FOAM_APPBIN)/foamListTimes diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/options b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..18e6fe47afacb902cddccf82632772447704fd88 --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = */ +/* EXE_LIBS = */ diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C new file mode 100644 index 0000000000000000000000000000000000000000..0a10a5744fa0eecbcc43217def17dff91e6998db --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + foamListTimes + +Description + List times using timeSelector + +Usage + + - foamListTimes [OPTION] + + @param -processor \n + List times from processor0 directory + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "timeSelector.H" +#include "Time.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + timeSelector::addOptions(); // -constant enabled + argList::noBanner(); + argList::noParallel(); + argList::validOptions.insert("processor", ""); + +# include "setRootCase.H" + + label nProcs = 0; + + // Create the processor databases + PtrList<Time> databases(1); + + if (args.optionFound("processor")) + { + // determine the processor count directly + while (isDir(args.path()/(word("processor") + name(nProcs)))) + { + ++nProcs; + } + + if (!nProcs) + { + FatalErrorIn(args.executable()) + << "No processor* directories found" + << exit(FatalError); + } + + // Create the processor databases + databases.setSize(nProcs); + + forAll(databases, procI) + { + databases.set + ( + procI, + new Time + ( + Time::controlDictName, + args.rootPath(), + args.caseName()/fileName(word("processor") + name(procI)) + ) + ); + } + } + else + { + databases.set + ( + 0, + new Time + ( + Time::controlDictName, + args.rootPath(), + args.caseName() + ) + ); + } + + + // use the times list from the master processor + // and select a subset based on the command-line options + instantList timeDirs = timeSelector::select + ( + databases[0].times(), + args + ); + + forAll(timeDirs, timeI) + { + Info<< timeDirs[timeI].name() << endl; + } + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C index 92e305709398933d4823f398f7122a0b6e9b78c7..089689b47b0ffe6ea3bf9cedc1445d97bb1d1d83 100644 --- a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C +++ b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C @@ -31,7 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - scalar Vphi = (constant::math::pi*swirlRPMRatio*rpm/30).value(); + scalar Vphi = (constant::mathematical::pi*swirlRPMRatio*rpm/30).value(); scalar b1 = j1(swirlProfile).value(); scalar b2 = 2.0*b1/swirlProfile.value() - j0(swirlProfile).value(); diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C index 78716d63c789fd9c9883f23220f128d291d2ac41..1b9fcf0d0a30c0f0f3a00af661464b22484a2931 100644 --- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C +++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C @@ -43,10 +43,10 @@ Description #include "transformField.H" #include "Pair.H" #include "quaternion.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" using namespace Foam; -using namespace Foam::constant::math; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/bin/paraFoam b/bin/paraFoam index 02cbf7a668fa7aa6af78dbd26e3af584add482b6..31d286fcc9fb2835091386548abdbe1587840fe3 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -29,6 +29,8 @@ # Description # start paraview with the OpenFOAM libraries # +# Note +# combining -block and -region options yields undefined behaviour #------------------------------------------------------------------------------ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done @@ -38,6 +40,7 @@ usage: ${0##*/} [OPTION] options: -case dir specify alternative case directory -region name specify mesh region name + -block use blockMesh reader (and .blockMesh file) -touch only create the .OpenFOAM file * start paraview $ParaView_VERSION with the OpenFOAM libraries @@ -48,6 +51,9 @@ USAGE unset regionName touchOnly +# reader extension +reader=OpenFOAM + # parse options while [ "$#" -gt 0 ] do @@ -55,6 +61,10 @@ do -h | -help) usage ;; + -block | -blockMesh) + reader=blockMesh + shift + ;; -case) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" cd "$2" 2>/dev/null || usage "directory does not exist: '$2'" @@ -75,14 +85,14 @@ do esac done -# get a sensible caseName +# get a sensible caseName from the directory name caseName=${PWD##*/} -caseFile="$caseName.OpenFOAM" +caseFile="$caseName.$reader" fvControls="system" if [ -n "$regionName" ] then - caseFile="$caseName{$regionName}.OpenFOAM" + caseFile="$caseName{$regionName}.$reader" fvControls="$fvControls/$regionName" fi @@ -99,12 +109,25 @@ case "$caseName" in *) parentDir="." ;; esac + +# # check existence of essential files -for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution -do - [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" -done +# +case $reader in +blockMesh) + for check in system/controlDict constant/polyMesh/blockMeshDict + do + [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" + done + ;; +OpenFOAM) + for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution + do + [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" + done + ;; +esac case "$ParaView_VERSION" in 2*) diff --git a/etc/settings.csh b/etc/settings.csh index ad327c5e573200059c7a2a3ed661fee9206565ab..1b33c5c42dd0b3f7561bb4198cd3c14620f95f29 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -35,6 +35,8 @@ alias _foamAddPath 'set path=(\!* $path)' # prefix to LD_LIBRARY_PATH alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' +# prefix to MANPATH +alias _foamAddManPath 'setenv MANPATH \!*\:${MANPATH}' # location of the jobControl directory setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl @@ -114,9 +116,10 @@ case OpenFOAM: echo endif - _foamAddPath ${WM_COMPILER_DIR}/bin - _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} - _foamAddLib ${WM_COMPILER_DIR}/lib + _foamAddPath ${WM_COMPILER_DIR}/bin + _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} + _foamAddLib ${WM_COMPILER_DIR}/lib + _foamAddManPath ${WM_COMPILER_DIR}/man breaksw endsw @@ -136,21 +139,22 @@ case OPENMPI: # Tell OpenMPI where to find its install directory setenv OPAL_PREFIX $MPI_ARCH_PATH - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + _foamAddManPath $MPI_ARCH_PATH/man setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version unset mpi_version breaksw case MPICH: - set mpi_version=mpich-1.2.4 + set mpi_version=mpich2-1.1.1p1 setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS - setenv MPICH_ROOT $MPI_ARCH_PATH - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + _foamAddManPath $MPI_ARCH_PATH/share/man setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version unset mpi_version @@ -159,7 +163,6 @@ case MPICH: case MPICH-GM: setenv MPI_ARCH_PATH /opt/mpi setenv MPICH_PATH $MPI_ARCH_PATH - setenv MPICH_ROOT $MPI_ARCH_PATH setenv GM_LIB_PATH /opt/gm/lib64 _foamAddPath $MPI_ARCH_PATH/bin @@ -172,7 +175,6 @@ case MPICH-GM: case HPMPI: setenv MPI_HOME /opt/hpmpi setenv MPI_ARCH_PATH $MPI_HOME - setenv MPICH_ROOT=$MPI_ARCH_PATH _foamAddPath $MPI_ARCH_PATH/bin diff --git a/etc/settings.sh b/etc/settings.sh index 074a21bb17d8a2f45333220bd99f610806c44b0a..f1abf1242394cc69ef4049114a91d12b57c961df 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -51,6 +51,16 @@ _foamAddLib() done } +# prefix to MANPATH +_foamAddManPath() +{ + while [ $# -ge 1 ] + do + export MANPATH=$1:$MANPATH + shift + done +} + # location of the jobControl directory export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl @@ -90,7 +100,7 @@ _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN # Compiler settings # ~~~~~~~~~~~~~~~~~ -unset compilerBin compilerLib +unset compilerBin compilerLib compilerMan # Select compiler installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -133,16 +143,18 @@ OpenFOAM) compilerBin=$WM_COMPILER_DIR/bin compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib + compilerMan=$WM_COMPILER_DIR/man ;; esac if [ -d "$compilerBin" ] then - _foamAddPath $compilerBin - _foamAddLib $compilerLib + _foamAddPath $compilerBin + _foamAddLib $compilerLib + _foamAddManPath $compilerMan fi -unset compilerBin compilerLib compilerInstall +unset compilerBin compilerLib compilerMan compilerInstall # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ @@ -158,21 +170,22 @@ OPENMPI) # Tell OpenMPI where to find its install directory export OPAL_PREFIX=$MPI_ARCH_PATH - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + _foamAddManPath $MPI_ARCH_PATH/man export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version unset mpi_version ;; MPICH) - mpi_version=mpich-1.2.4 + mpi_version=mpich2-1.1.1p1 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS - export MPICH_ROOT=$MPI_ARCH_PATH - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + _foamAddManPath $MPI_ARCH_PATH/share/man export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version unset mpi_version @@ -181,7 +194,6 @@ MPICH) MPICH-GM) export MPI_ARCH_PATH=/opt/mpi export MPICH_PATH=$MPI_ARCH_PATH - export MPICH_ROOT=$MPI_ARCH_PATH export GM_LIB_PATH=/opt/gm/lib64 _foamAddPath $MPI_ARCH_PATH/bin @@ -194,7 +206,6 @@ MPICH-GM) HPMPI) export MPI_HOME=/opt/hpmpi export MPI_ARCH_PATH=$MPI_HOME - export MPICH_ROOT=$MPI_ARCH_PATH _foamAddPath $MPI_ARCH_PATH/bin diff --git a/src/Allwmake b/src/Allwmake index 5d320be01662c7bea12e23ca7302c0cbc9973342..54928685c9dab576b5b1a0f0786114acee360314 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -39,8 +39,6 @@ wmake libso sampling wmake libso dynamicMesh wmake libso dynamicFvMesh wmake libso topoChangerFvMesh -wmake libso fvMotionSolver -wmake libso engine wmake libso ODE wmake libso randomProcesses @@ -51,12 +49,15 @@ turbulenceModels/Allwmake lagrangian/Allwmake postProcessing/Allwmake conversion/Allwmake +mesh/Allwmake -wmake libso autoMesh wmake libso errorEstimation wmake libso conformalVoronoiMesh fvAgglomerationMethods/Allwmake +wmake libso fvMotionSolver +wmake libso engine + # ----------------------------------------------------------------- end-of-file diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 6ba6b90cf116720e24a35025059b46474a946285..2823c2a9ec3f0e45310365741915f3667a3446f9 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -1,6 +1,6 @@ global/global.Cver -global/dimensionedConstants/dimensionedConstants.C -global/dimensionedConstants/constants/constants.C +global/constants/constants.C +global/constants/dimensionedConstants.C global/argList/argList.C global/clock/clock.C diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C index 1cfcd9eec6858db3df29b43106261fb538afe9d9..ab576d0ef44cc3dbe1d274ea471984e9a454de0a 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C @@ -85,7 +85,6 @@ inline void Foam::OPstream::writeToBuffer } - // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // Foam::OPstream::OPstream diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C index bdb31516bac60b06d5e0cf97c183f23b8b018374..213ae54c76151e3352b406d78701099f80d611c0 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C @@ -217,7 +217,7 @@ bool Foam::Pstream::parRun_(false); Foam::List<int> Foam::Pstream::procIDs_(1, 0); // Standard transfer message type -const int Foam::Pstream::msgType_(1); +int Foam::Pstream::msgType_(1); // Linear communication schedule Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::linearCommunication_(0); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H index f54f02b2717b0d41cfa061627207c50ba65b496c..f30caf0d9eb2b4c9d1193e869e32b31fd6fb36e0 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H @@ -163,7 +163,7 @@ private: static bool parRun_; static List<int> procIDs_; - static const int msgType_; + static int msgType_; static List<commsStruct> linearCommunication_; static List<commsStruct> treeCommunication_; @@ -337,11 +337,12 @@ public: } //- Message tag of standard messages - static int msgType() + static int& msgType() { return msgType_; } + //- Get the communications type of the stream commsTypes commsType() const { diff --git a/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C index 223b251c435235dec871dbc96549dc3f15542d6c..34154cce481dd93c72b7ba02e55a513df07c18ae 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C @@ -66,7 +66,9 @@ bool Foam::functionEntries::removeEntry::execute ) { wordList dictKeys = parentDict.toc(); - labelList indices = findStrings<word>(readList<wordRe>(is), dictKeys); + wordReList patterns(is); + + labelList indices = findStrings(patterns, dictKeys); forAll(indices, indexI) { diff --git a/src/OpenFOAM/fields/Fields/symmTransformField/symmTransformField.H b/src/OpenFOAM/fields/Fields/symmTransformField/symmTransformField.H index ba223f7aebce6dc18db3dd3f0563d65bbfbd6a07..891da11fd5676d272393e2a6e98919f1edf3ece8 100644 --- a/src/OpenFOAM/fields/Fields/symmTransformField/symmTransformField.H +++ b/src/OpenFOAM/fields/Fields/symmTransformField/symmTransformField.H @@ -38,6 +38,7 @@ SourceFiles #include "symmTransform.H" #include "symmTensorField.H" +#include "sphericalTensor.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C index 8ab8e646c1414b77ba4991a5d290d1bd6f6f769b..a41fbf5f520668e0e5360d3cb40853e8389e97ce 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C @@ -26,6 +26,7 @@ License #include "basicSymmetryPointPatchField.H" #include "transformField.H" +#include "symmTransformField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -89,7 +90,12 @@ void basicSymmetryPointPatchField<Type>::evaluate(const Pstream::commsTypes) const vectorField& nHat = this->patch().pointNormals(); tmp<Field<Type> > tvalues = - transform(I - nHat*nHat, this->patchInternalField()); + ( + ( + this->patchInternalField() + + transform(I - 2.0*sqr(nHat), this->patchInternalField()) + )/2.0 + ); // Get internal field to insert values into Field<Type>& iF = const_cast<Field<Type>&>(this->internalField()); diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C b/src/OpenFOAM/global/constants/atomic/atomicConstants.C similarity index 96% rename from src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C rename to src/OpenFOAM/global/constants/atomic/atomicConstants.C index 943bdc5c38cd4c9c33a3a35587c50e3f948c5e79..4edebcbe5d159dc89046844df677605b49af028d 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "universalConstants.H" #include "electromagneticConstants.H" #include "atomicConstants.H" @@ -83,7 +83,7 @@ const Foam::dimensionedScalar Foam::constant::atomic::a0 ( "a0", alpha - /(dimensionedScalar("C", dimless, 4.0*constant::math::pi)*Rinf) + /(dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)*Rinf) ) ) ); @@ -100,7 +100,7 @@ const Foam::dimensionedScalar Foam::constant::atomic::re "re", sqr(constant::electromagnetic::e) /( - dimensionedScalar("C", dimless, 4.0*constant::math::pi) + dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi) *constant::electromagnetic::epsilon0 *me *sqr(constant::universal::c) diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H b/src/OpenFOAM/global/constants/atomic/atomicConstants.H similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H rename to src/OpenFOAM/global/constants/atomic/atomicConstants.H index c25737444152aaee517c2790669b83a62d882c7c..b732207d2caa5ce3880a75f7e7694c79542167a4 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::atom + Foam::constant::atomic Description Atomic constants @@ -68,7 +68,7 @@ namespace atomic // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace atomic -} // end namespace constant +} // End namespace constant } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.C b/src/OpenFOAM/global/constants/constants.C similarity index 96% rename from src/OpenFOAM/global/dimensionedConstants/constants/constants.C rename to src/OpenFOAM/global/constants/constants.C index f921cba9836e9bff24bb31ce0fbcd53dc567bba4..079343360f1b08da3d6512da576f1ddd6a313df0 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/constants.C +++ b/src/OpenFOAM/global/constants/constants.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Collection of dimensioned constants - \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.H b/src/OpenFOAM/global/constants/constants.H similarity index 98% rename from src/OpenFOAM/global/dimensionedConstants/constants/constants.H rename to src/OpenFOAM/global/constants/constants.H index 14ab108667e1dcb2f7232fbd31045b1749c6af63..ad66c608aa274f1406103ef6a8417fbe09c31e71 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/constants.H +++ b/src/OpenFOAM/global/constants/constants.H @@ -38,7 +38,7 @@ Description // Dimensionless coefficents // Mathematical constants -#include "mathConstants.H" +#include "mathematicalConstants.H" // Dimensioned constants diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C b/src/OpenFOAM/global/constants/dimensionedConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C rename to src/OpenFOAM/global/constants/dimensionedConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H b/src/OpenFOAM/global/constants/dimensionedConstants.H similarity index 93% rename from src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H rename to src/OpenFOAM/global/constants/dimensionedConstants.H index 989089c0b065fee12857e30b317a445026a8909d..fbba918e249b8b920a55ac2139d16dde4740ce6e 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H +++ b/src/OpenFOAM/global/constants/dimensionedConstants.H @@ -27,9 +27,10 @@ Global Description Dictionary reading and supplying the dimensioned constants used within - OpenFOAM particularly for thermodynamics. The values are read from the - OpenFOAM controlDict and should be changed to run with a different set of - units from the default SI units. + OpenFOAM, particularly for thermodynamics. + + The values are read from the OpenFOAM etc/controlDict and should be + changed to run with a different set of units from the default SI units. SourceFiles dimensionedConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C rename to src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C index 77e2fec40cac3551c3bb9db3a491fd06b79ddeb9..11377233b081b005f2b82270c0fdb0a13ee564ef 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "universalConstants.H" #include "electromagneticConstants.H" #include "atomicConstants.H" @@ -46,7 +46,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0 ( "mu0", dimless, - 4.0*constant::math::pi*1e-07 + 4.0*constant::mathematical::pi*1e-07 ) ) ); @@ -92,7 +92,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::kappa dimensionedScalar ( "kappa", - dimensionedScalar("C", dimless, 1.0/(4.0*constant::math::pi)) + dimensionedScalar("C", dimless, 1.0/(4.0*constant::mathematical::pi)) /epsilon0 ) ) diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H rename to src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H index 54586cda47e7cc185261e8ae2580d78f5b3eb046..0d4cd6df14e48674c098dd41e379d15eacfd1ec5 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::em + Foam::constant::electromagnetic Description Electromagnetic constants @@ -77,7 +77,7 @@ namespace electromagnetic // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace electromagnetic -} // end namespace constant +} // End namespace constant } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C rename to src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H rename to src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H b/src/OpenFOAM/global/constants/math/mathematicalConstants.H similarity index 72% rename from src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H rename to src/OpenFOAM/global/constants/math/mathematicalConstants.H index f18f97d749608843aeb1907e3c2e03aead26579b..64811272d8f074fc2137e4be092c20f4a03f3996 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H +++ b/src/OpenFOAM/global/constants/math/mathematicalConstants.H @@ -23,15 +23,15 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::math + Foam::constant::mathematical Description - mathematical constants + mathematical constants and conversion functions \*---------------------------------------------------------------------------*/ -#ifndef mathConstants_H -#define mathConstants_H +#ifndef mathematicalConstants_H +#define mathematicalConstants_H #include "scalar.H" @@ -41,12 +41,12 @@ namespace Foam { namespace constant { -namespace math +namespace mathematical { // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - static word group = "math"; + static word group = "mathematical"; const scalar e(M_E); const scalar pi(M_PI); @@ -55,15 +55,29 @@ namespace math // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace math -} // end namespace constant -} // End namespace Foam +} // End namespace mathematical +} // End namespace constant // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#endif +//- Conversion from degrees to radians +inline scalar degToRad(const scalar& deg) +{ + return (deg*constant::mathematical::pi/180.0); +} -// ************************************************************************* // +//- Conversion from radians to degrees +inline scalar radToDeg(const scalar& rad) +{ + return (rad*180.0/constant::mathematical::pi); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#endif +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C similarity index 94% rename from src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C rename to src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C index 7446c67d9739924a27a342fbcd26b0b0782baf8e..d7f9b6a0a8fde39d6b36b5bb99480e5224bb29b0 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "universalConstants.H" #include "electromagneticConstants.H" #include "physicoChemicalConstants.H" @@ -75,7 +75,7 @@ const Foam::dimensionedScalar Foam::constant::physicoChemical::sigma dimensionedScalar ( "sigma", - dimensionedScalar("C", dimless, sqr(constant::math::pi)/60.0) + dimensionedScalar("C", dimless, sqr(constant::mathematical::pi)/60.0) *pow4(k)/(pow3(constant::universal::hr)*sqr(constant::universal::c)) ) ) @@ -107,7 +107,7 @@ const Foam::dimensionedScalar Foam::constant::physicoChemical::c1 dimensionedScalar ( "c1", - dimensionedScalar("C", dimless, constant::math::twoPi) + dimensionedScalar("C", dimless, constant::mathematical::twoPi) *constant::universal::h*sqr(constant::universal::c) ) ) diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H rename to src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H index 7f25e0dfb7f0aac5c7914e777b42d5b4cfcdc4fb..920f390e27f2d0b8386aafd08d82171e824af070 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::phys + Foam::constant::physicoChemical Description Physico-chemical constants @@ -71,7 +71,7 @@ namespace physicoChemical // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace physicoChemical -} // end namespace constant +} // End namespace constant } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C b/src/OpenFOAM/global/constants/universal/universalConstants.C similarity index 93% rename from src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C rename to src/OpenFOAM/global/constants/universal/universalConstants.C index 3284c51d4dbe4018d86c48b787b230d839a67113..a8930a3fd406eec813ea0db673e523661bd01846 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C +++ b/src/OpenFOAM/global/constants/universal/universalConstants.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "universalConstants.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "dimensionedConstants.H" @@ -43,7 +43,7 @@ const Foam::dimensionedScalar Foam::constant::universal::hr dimensionedScalar ( "hr", - h/(dimensionedScalar("C", dimless, constant::math::twoPi)) + h/(dimensionedScalar("C", dimless, constant::mathematical::twoPi)) ) ) ); diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H b/src/OpenFOAM/global/constants/universal/universalConstants.H similarity index 98% rename from src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H rename to src/OpenFOAM/global/constants/universal/universalConstants.H index 305e30fe190568c49211730dfc078e327be68eae..85f8f1d9d8d2039320d03d6efddf6c9202d12a5b 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H +++ b/src/OpenFOAM/global/constants/universal/universalConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::uni + Foam::constant::universal Description Universal constants diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index a7bbf88005239266d53604d7aa633c1c1541b50c..55be336fa21d507fb467995251712a1a6e449ead 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -27,7 +27,7 @@ License #include "face.H" #include "triFace.H" #include "triPointRef.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -99,13 +99,13 @@ Foam::label Foam::face::mostConcaveAngle if ((edgeNormal & n) > 0) { // Concave angle. - angle = constant::math::pi + edgeAngle; + angle = constant::mathematical::pi + edgeAngle; } else { // Convex angle. Note '-' to take into account that rightEdge // and leftEdge are head-to-tail connected. - angle = constant::math::pi - edgeAngle; + angle = constant::mathematical::pi - edgeAngle; } if (angle > maxAngle) @@ -214,7 +214,7 @@ Foam::label Foam::face::split label index = fcIndex(fcIndex(startIndex)); label minIndex = index; - scalar minDiff = constant::math::pi; + scalar minDiff = constant::mathematical::pi; for(label i = 0; i < size() - 3; i++) { diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C index c5f9a80250b00e433d139011a9e2d2c7b33b28a3..cf7dfc940059c9e9d5830cbc3afbb5bb12637fd0 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C @@ -159,9 +159,9 @@ Foam::pointHit Foam::face::intersection if (curHit.hit()) { - if (Foam::mag(curHit.distance()) < nearestHitDist) + if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist)) { - nearestHitDist = Foam::mag(curHit.distance()); + nearestHitDist = curHit.distance(); nearest.setHit(); nearest.setPoint(curHit.hitPoint()); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 0d8b6b97e85ac07f84f7cd56cec98d54359234c1..eff7af933cabc52791bcf22958e3dbd29094c5c9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -450,7 +450,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const const polyBoundaryMesh& bm = *this; - bool boundaryError = false; + bool hasError = false; // Collect non-proc patches and check proc patches are last. wordList names(bm.size()); @@ -464,8 +464,8 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const { if (nonProcI != patchI) { - // There is processor patch inbetween normal patches. - boundaryError = true; + // There is processor patch in between normal patches. + hasError = true; if (debug || report) { @@ -508,7 +508,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const || (allTypes[procI] != allTypes[0]) ) { - boundaryError = true; + hasError = true; if (debug || (report && Pstream::master())) { @@ -523,7 +523,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const } } - return boundaryError; + return hasError; } @@ -532,13 +532,13 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const label nextPatchStart = mesh().nInternalFaces(); const polyBoundaryMesh& bm = *this; - bool boundaryError = false; + bool hasError = false; forAll (bm, patchI) { - if (bm[patchI].start() != nextPatchStart && !boundaryError) + if (bm[patchI].start() != nextPatchStart && !hasError) { - boundaryError = true; + hasError = true; Info<< " ****Problem with boundary patch " << patchI << " named " << bm[patchI].name() @@ -553,26 +553,21 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const nextPatchStart += bm[patchI].size(); } - reduce(boundaryError, orOp<bool>()); + reduce(hasError, orOp<bool>()); - if (boundaryError) + if (debug || report) { - if (debug || report) + if (hasError) { Pout << " ***Boundary definition is in error." << endl; } - - return true; - } - else - { - if (debug || report) + else { Info << " Boundary definition OK." << endl; } - - return false; } + + return hasError; } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C index a7672104dab5bdd580848088442ebef2a279cd72..71eea20637d22b33badf8afcb10a72a1f2941334 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C @@ -37,11 +37,11 @@ License namespace Foam { defineTypeNameAndDebug(cellZone, 0); - defineRunTimeSelectionTable(cellZone, dictionary); addToRunTimeSelectionTable(cellZone, cellZone, dictionary); } +const char * const Foam::cellZone::labelsName = "cellLabels"; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -79,7 +79,7 @@ Foam::cellZone::cellZone const cellZoneMesh& zm ) : - zone("cell", name, dict, index), + zone(name, dict, this->labelsName, index), zoneMesh_(zm) {} @@ -140,7 +140,7 @@ void Foam::cellZone::writeDict(Ostream& os) const os << nl << name() << nl << token::BEGIN_BLOCK << nl << " type " << type() << token::END_STATEMENT << nl; - writeEntry("cellLabels", os); + writeEntry(this->labelsName, os); os << token::END_BLOCK << endl; } @@ -148,10 +148,10 @@ void Foam::cellZone::writeDict(Ostream& os) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void Foam::cellZone::operator=(const cellZone& cz) +void Foam::cellZone::operator=(const cellZone& zn) { clearAddressing(); - labelList::operator=(cz); + labelList::operator=(zn); } @@ -164,10 +164,10 @@ void Foam::cellZone::operator=(const labelList& addr) // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& cz) +Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn) { - cz.write(os); - os.check("Ostream& operator<<(Ostream& os, const cellZone& cz"); + zn.write(os); + os.check("Ostream& operator<<(Ostream&, const cellZone&"); return os; } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H index 67c9c2f52f9331a81fbf72b609a41c77b01b593d..661e458a645b0b0241ea084f6eb78481eb6a95c4 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H @@ -81,6 +81,12 @@ protected: public: + // Static data members + + //- The name associated with the zone-labels dictionary entry + static const char * const labelsName; + + //- Runtime type information TypeName("cellZone"); diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C index 796e1cc9101d1703c9598dde880273340ac7b14b..bf4ce6725503c42165164fe17fa2ceccea5d9b1a 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C @@ -42,6 +42,8 @@ namespace Foam addToRunTimeSelectionTable(faceZone, faceZone, dictionary); } +const char* const Foam::faceZone::labelsName = "faceLabels"; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::faceZone::calcFaceZonePatch() const @@ -226,7 +228,7 @@ Foam::faceZone::faceZone const faceZoneMesh& zm ) : - zone("face", name, dict, index), + zone(name, dict, this->labelsName, index), flipMap_(dict.lookup("flipMap")), zoneMesh_(zm), patchPtr_(NULL), @@ -442,7 +444,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const const polyMesh& mesh = zoneMesh().mesh(); const polyBoundaryMesh& bm = mesh.boundaryMesh(); - bool boundaryError = false; + bool hasError = false; // Check that zone faces are synced @@ -479,7 +481,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const // Check face in zone on both sides if (myZoneFace[bFaceI] != neiZoneFace[bFaceI]) { - boundaryError = true; + hasError = true; if (report) { @@ -491,12 +493,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const << " is not consistent with its coupled neighbour." << endl; } + else + { + // w/o report - can stop checking now + break; + } } // Flip state should be opposite. if (myZoneFlip[bFaceI] == neiZoneFlip[bFaceI]) { - boundaryError = true; + hasError = true; if (report) { @@ -509,12 +516,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const << " across coupled faces." << endl; } + else + { + // w/o report - can stop checking now + break; + } } } } } - return returnReduce(boundaryError, orOp<bool>()); + return returnReduce(hasError, orOp<bool>()); } @@ -539,7 +551,7 @@ void Foam::faceZone::writeDict(Ostream& os) const os << nl << name() << nl << token::BEGIN_BLOCK << nl << " type " << type() << token::END_STATEMENT << nl; - writeEntry("faceLabels", os); + writeEntry(this->labelsName, os); flipMap().writeEntry("flipMap", os); os << token::END_BLOCK << endl; @@ -548,10 +560,10 @@ void Foam::faceZone::writeDict(Ostream& os) const // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& fz) +Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& zn) { - fz.write(os); - os.check("Ostream& operator<<(Ostream& os, const faceZone& fz"); + zn.write(os); + os.check("Ostream& operator<<(Ostream&, const faceZone&"); return os; } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H index 7b1b46d2c4d5edffebabcb161f5f46ef1dcfcb89..95e342e2f2037636f6423f8c8b6412a87ebab92c 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H @@ -60,13 +60,17 @@ Ostream& operator<<(Ostream&, const faceZone&); /*---------------------------------------------------------------------------*\ - Class faceZone Declaration + Class faceZone Declaration \*---------------------------------------------------------------------------*/ class faceZone : public zone { + // Private data + + //- The name associated with the zone-labels dictionary entry + static const word labelsName_; protected: @@ -118,6 +122,12 @@ protected: public: + // Static data members + + //- The name associated with the zone-labels dictionary entry + static const char * const labelsName; + + //- Runtime type information TypeName("faceZone"); @@ -283,7 +293,7 @@ public: virtual void movePoints(const pointField&); //- Update for changes in topology - virtual void updateMesh(const mapPolyMesh& mpm); + virtual void updateMesh(const mapPolyMesh&); //- Write virtual void write(Ostream&) const; @@ -291,7 +301,6 @@ public: //- Write dictionary virtual void writeDict(Ostream&) const; - // I-O //- Ostream Operator diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C index c6098a38a2f03ca15165f7bc3e6f18dbf98bd76d..d6f942cdd561cee4d156bc884430952aa5848327 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C @@ -40,6 +40,7 @@ namespace Foam addToRunTimeSelectionTable(pointZone, pointZone, dictionary); } +const char* const Foam::pointZone::labelsName = "pointLabels"; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -77,7 +78,7 @@ Foam::pointZone::pointZone const pointZoneMesh& zm ) : - zone("point", name, dict, index), + zone(name, dict, this->labelsName, index), zoneMesh_(zm) {} @@ -139,7 +140,7 @@ void Foam::pointZone::writeDict(Ostream& os) const os << nl << name_ << nl << token::BEGIN_BLOCK << nl << " type " << type() << token::END_STATEMENT << nl; - writeEntry("pointLabels", os); + writeEntry(this->labelsName, os); os << token::END_BLOCK << endl; } @@ -147,10 +148,10 @@ void Foam::pointZone::writeDict(Ostream& os) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void Foam::pointZone::operator=(const pointZone& pz) +void Foam::pointZone::operator=(const pointZone& zn) { clearAddressing(); - labelList::operator=(pz); + labelList::operator=(zn); } @@ -163,10 +164,10 @@ void Foam::pointZone::operator=(const labelList& addr) // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& pz) +Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn) { - pz.write(os); - os.check("Ostream& operator<<(Ostream& os, const pointZone& pz"); + zn.write(os); + os.check("Ostream& operator<<(Ostream&, const pointZone&"); return os; } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H index 89f8349461b4b4f052dba80c1bf4ecd691aa2a49..32433b968681106602a9e9808b6ce7acce4253a6 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H @@ -58,7 +58,7 @@ Ostream& operator<<(Ostream&, const pointZone&); /*---------------------------------------------------------------------------*\ - Class pointZone Declaration + Class pointZone Declaration \*---------------------------------------------------------------------------*/ class pointZone @@ -68,20 +68,24 @@ class pointZone protected: - // Private data + // Protected data //- Reference to zone list const pointZoneMesh& zoneMesh_; - // Private Member Functions //- Disallow default bitwise copy construct pointZone(const pointZone&); - public: + // Static data members + + //- The name associated with the zone-labels dictionary entry + static const char * const labelsName; + + //- Runtime type information TypeName("pointZone"); diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C index 20195888c57de05076d4a6d2f793b33e3d9b66fb..4f6f6d887a0c7417327ddfef80cac111b5ccbb1d 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C @@ -115,13 +115,13 @@ Foam::zone::zone Foam::zone::zone ( - const word& zoneType, const word& name, const dictionary& dict, + const word& labelsName, const label index ) : - labelList(dict.lookup(zoneType + "Labels")), + labelList(dict.lookup(labelsName)), name_(name), index_(index), lookupMapPtr_(NULL) @@ -193,13 +193,13 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const { const labelList& addr = *this; - bool boundaryError = false; + bool hasError = false; forAll(addr, i) { if (addr[i] < 0 || addr[i] >= maxSize) { - boundaryError = true; + hasError = true; if (report) { @@ -212,10 +212,15 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const << "Valid index labels are 0.." << maxSize-1 << endl; } + else + { + // w/o report - can stop checking now + break; + } } } - return boundaryError; + return hasError; } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H index fb5d2453e653867e92a7dde99eed2eacf52d7218..2bc9acc3497d4dd638e3213269bae7fd6d8654cc 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H @@ -117,9 +117,9 @@ public: //- Construct from dictionary zone ( - const word& zoneType, const word& name, const dictionary&, + const word& labelsName, const label index ); diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 4f347669ad632f7a9978857bc30bc07b3e843218..95fcad6ed80300ca02a5fccd20717f05a37ad801 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -27,7 +27,7 @@ License #include "primitiveMesh.H" #include "pyramidPointFaceRef.H" #include "ListOps.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "SortableList.H" @@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality // Severe nonorthogonality threshold const scalar severeNonorthogonalityThreshold = - ::cos(nonOrthThreshold_/180.0*constant::math::pi); + ::cos(degToRad(nonOrthThreshold_)); scalar minDDotS = GREAT; @@ -472,9 +472,8 @@ bool Foam::primitiveMesh::checkFaceOrthogonality if (debug || report) { Info<< " Mesh non-orthogonality Max: " - << ::acos(minDDotS)/constant::math::pi*180.0 - << " average: " << - ::acos(sumDDotS/neiSize)/constant::math::pi*180.0 + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/neiSize)) << endl; } } @@ -840,7 +839,7 @@ bool Foam::primitiveMesh::checkFaceAngles << exit(FatalError); } - const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi); + const scalar maxSin = Foam::sin(degToRad(maxDeg)); const pointField& p = points(); const faceList& fcs = faces(); @@ -916,8 +915,7 @@ bool Foam::primitiveMesh::checkFaceAngles if (nConcave > 0) { scalar maxConcaveDegr = - Foam::asin(Foam::min(1.0, maxEdgeSin)) - *180.0/constant::math::pi; + radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin))); if (debug || report) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C index 1dafd61f61bdb0819d9bd6465a38abe54a116df5..8fce92f3c808fc7fdb7d9eee19585d4c368da002 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C @@ -31,7 +31,7 @@ Description #include "primitiveMesh.H" #include "pyramidPointFaceRef.H" #include "cell.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -200,7 +200,7 @@ bool Foam::primitiveMesh::checkMeshMotion ) << "Severe non-orthogonality in mesh motion for face " << faceI << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " << ::acos(dDotS)/constant::math::pi*180.0 + << ": Angle = " << radToDeg(::acos(dDotS)) << " deg." << endl; nDotProductErrors++; diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index 881fb1d5202073f820d28c4e8db22703ed139038..40fa909b16633aa89fcc629a672a2197ced9a27f 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -26,7 +26,7 @@ License #include "IOstreams.H" #include "pointHit.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -307,7 +307,7 @@ inline scalar triangle<Point, PointRef>::quality() const return mag() / ( - constant::math::pi + constant::mathematical::pi *Foam::sqr(circumRadius()) *0.413497 + VSMALL diff --git a/src/OpenFOAM/primitives/Lists/stringListOps.H b/src/OpenFOAM/primitives/Lists/stringListOps.H index 253a249c3df6efe6dd19948a107b631ae33283de..493a0cb3d3aaca214f1b9bc9886cb92072bc741e 100644 --- a/src/OpenFOAM/primitives/Lists/stringListOps.H +++ b/src/OpenFOAM/primitives/Lists/stringListOps.H @@ -36,54 +36,262 @@ SourceFiles #ifndef stringListOps_H #define stringListOps_H +#include "regExp.H" #include "labelList.H" #include "stringList.H" #include "wordReList.H" +#include "wordReListMatcher.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + // single-string matches: + + //- Return true if string matches one of the regular expressions + inline bool findStrings + ( + const wordReListMatcher& matcher, + const std::string& str + ) + { + return matcher.match(str); + } + + // multi-string matches: + + //- Return list indices for matching strings + template<class Matcher, class StringType> + labelList findMatchingStrings + ( + const Matcher&, + const UList<StringType>&, + const bool invert=false + ); + //- Return list indices for strings matching the regular expression + // Template partial specialization of findMatchingStrings template<class StringType> labelList findStrings ( - const char* regexpPattern, - const UList<StringType>& - ); + const regExp& re, + const UList<StringType>& lst, + const bool invert=false + ) + { + return findMatchingStrings(re, lst, invert); + } //- Return list indices for strings matching the regular expression + // Template partial specialization of findMatchingStrings template<class StringType> labelList findStrings ( - const std::string& regexpPattern, - const UList<StringType>& - ); + const char* rePattern, + const UList<StringType>& lst, + const bool invert=false + ) + { + return findStrings(regExp(rePattern), lst, invert); + } //- Return list indices for strings matching the regular expression + // Template partial specialization of findMatchingStrings template<class StringType> labelList findStrings ( - const wordRe&, - const UList<StringType>& - ); + const std::string& rePattern, + const UList<StringType>& lst, + const bool invert=false + ) + { + return findMatchingStrings(regExp(rePattern), lst, invert); + } + + //- Return list indices for strings matching the regular expression + // Template partial specialization of findMatchingStrings + template<class StringType> + labelList findStrings + ( + const wordRe& wre, + const UList<StringType>& lst, + const bool invert=false + ) + { + return findMatchingStrings(wre, lst, invert); + } + //- Return list indices for strings matching one of the regular expression + // Template partial specialization of findMatchingStrings template<class StringType> labelList findStrings ( - const UList<wordRe>&, - const UList<StringType>& + const wordReListMatcher& matcher, + const UList<StringType>& lst, + const bool invert=false + ) + { + return findMatchingStrings(matcher, lst, invert); + } + + // subsetting multi-string matches (similar to ListOp): + + //- Extract elements of StringList when regular expression matches + // optionally invert the match + // eg, to extract all selected elements: + // subsetMatchingStrings<regExp, stringList>(myRegExp, lst); + template<class Matcher, class StringListType> + StringListType subsetMatchingStrings + ( + const Matcher&, + const StringListType&, + const bool invert=false ); - //- Return true if string matches one of the regular expressions - template<class StringType> - bool findStrings + //- Extract elements of StringList when regular expression matches + // Template partial specialization of subsetMatchingStrings + template<class StringListType> + StringListType subsetStrings ( - const UList<wordRe>&, - const StringType& str + const regExp& re, + const StringListType& lst, + const bool invert=false + ) + { + return subsetMatchingStrings(re, lst, invert); + } + + //- Extract elements of StringList when regular expression matches + // Template partial specialization of subsetMatchingStrings + template<class StringListType> + StringListType subsetStrings + ( + const char* rePattern, + const StringListType& lst, + const bool invert=false + ) + { + return subsetMatchingStrings(regExp(rePattern), lst, invert); + } + + //- Extract elements of StringList when regular expression matches + // Template partial specialization of subsetMatchingStrings + template<class StringListType> + StringListType subsetStrings + ( + const std::string& rePattern, + const StringListType& lst, + const bool invert=false + ) + { + return subsetMatchingStrings(regExp(rePattern), lst, invert); + } + + //- Extract elements of StringList when regular expression matches + // Template partial specialization of subsetMatchingStrings + template<class StringListType> + StringListType subsetStrings + ( + const wordRe& wre, + const StringListType& lst, + const bool invert=false + ) + { + return subsetMatchingStrings(wre, lst, invert); + } + + //- Extract elements of StringList when regular expression matches + // Template partial specialization of subsetMatchingStrings + template<class StringListType> + StringListType subsetStrings + ( + const wordReListMatcher& matcher, + const StringListType& lst, + const bool invert=false + ) + { + return subsetMatchingStrings(matcher, lst, invert); + } + + + //- Inplace extract elements of StringList when regular expression matches + // optionally invert the match + // eg, to extract all selected elements: + // inplaceSubsetMatchingStrings<regExp, stringList>(myRegExp, lst); + template<class Matcher, class StringListType> + void inplaceSubsetMatchingStrings + ( + const Matcher&, + StringListType&, + const bool invert=false ); + //- Inplace extract elements of StringList when regular expression matches + // Template partial specialization of inplaceSubsetMatchingStrings + template<class StringListType> + void inplaceSubsetStrings + ( + const regExp& re, + StringListType& lst, + const bool invert=false + ) + { + inplaceSubsetMatchingStrings(re, lst, invert); + } + + //- Inplace extract elements of StringList when regular expression matches + // Template partial specialization of inplaceSubsetMatchingStrings + template<class StringListType> + void inplaceSubsetStrings + ( + const char* rePattern, + StringListType& lst, + const bool invert=false + ) + { + inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert); + } + + //- Inplace extract elements of StringList when regular expression matches + // Template partial specialization of inplaceSubsetMatchingStrings + template<class StringListType> + void inplaceSubsetStrings + ( + const std::string& rePattern, + StringListType& lst, + const bool invert=false + ) + { + inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert); + } + + //- Inplace extract elements of StringList when regular expression matches + // Template partial specialization of inplaceSubsetMatchingStrings + template<class StringListType> + void inplaceSubsetStrings + ( + const wordRe& wre, + StringListType& lst, + const bool invert=false + ) + { + inplaceSubsetMatchingStrings(wre, lst, invert); + } + + //- Inplace extract elements of StringList when regular expression matches + // Template partial specialization of inplaceSubsetMatchingStrings + template<class StringListType> + void inplaceSubsetStrings + ( + const wordReListMatcher& matcher, + StringListType& lst, + const bool invert=false + ) + { + inplaceSubsetMatchingStrings(matcher, lst, invert); + } + } diff --git a/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C b/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C index 54f624d60a3d0bf5b8ca53dffec96b6304c3bc94..6489658d531ffad6edddee5974bc8c0672143e6d 100644 --- a/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C +++ b/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C @@ -24,126 +24,73 @@ License \*---------------------------------------------------------------------------*/ -#include "labelList.H" -#include "regExp.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template<class StringType> -Foam::labelList Foam::findStrings -( - const char* pattern, - const UList<StringType>& lst -) -{ - regExp re(pattern); - labelList matched(lst.size()); - - label matchI = 0; - forAll(lst, elemI) - { - if (re.match(lst[elemI])) - { - matched[matchI++] = elemI; - } - } - matched.setSize(matchI); - - return matched; -} - - -template<class StringType> -Foam::labelList Foam::findStrings +template<class Matcher, class StringType> +Foam::labelList Foam::findMatchingStrings ( - const std::string& pattern, - const UList<StringType>& lst + const Matcher& matcher, + const UList<StringType>& lst, + const bool invert ) { - regExp re(pattern); - labelList matched(lst.size()); + labelList indices(lst.size()); - label matchI = 0; + label nElem = 0; forAll(lst, elemI) { - if (re.match(lst[elemI])) + if (matcher.match(lst[elemI]) ? !invert : invert) { - matched[matchI++] = elemI; + indices[nElem++] = elemI; } } - matched.setSize(matchI); + indices.setSize(nElem); - return matched; + return indices; } -template<class StringType> -Foam::labelList Foam::findStrings +template<class Matcher, class StringListType> +StringListType Foam::subsetMatchingStrings ( - const wordRe& wre, - const UList<StringType>& lst + const Matcher& matcher, + const StringListType& lst, + const bool invert ) { - labelList matched(lst.size()); + StringListType newLst(lst.size()); - label matchI = 0; + label nElem = 0; forAll(lst, elemI) { - if (wre.match(lst[elemI])) + if (matcher.match(lst[elemI]) ? !invert : invert) { - matched[matchI++] = elemI; + newLst[nElem++] = lst[elemI]; } } - matched.setSize(matchI); + newLst.setSize(nElem); - return matched; + return newLst; } -template<class StringType> -Foam::labelList Foam::findStrings +template<class Matcher, class StringListType> +void Foam::inplaceSubsetMatchingStrings ( - const UList<wordRe>& wreLst, - const UList<StringType>& lst + const Matcher& matcher, + StringListType& lst, + const bool invert ) { - labelList matched(lst.size()); - - label matchI = 0; + label nElem = 0; forAll(lst, elemI) { - forAll(wreLst, reI) - { - if (wreLst[reI].match(lst[elemI])) - { - matched[matchI++] = elemI; - break; - } - } - } - matched.setSize(matchI); - - return matched; -} - - -template<class StringType> -bool Foam::findStrings -( - const UList<wordRe>& wreLst, - const StringType& str -) -{ - forAll(wreLst, reI) - { - if (wreLst[reI].match(str)) + if (matcher.match(lst[elemI]) ? !invert : invert) { - return true; + lst[nElem++] = lst[elemI]; } } - - return false; + lst.setSize(nElem); } diff --git a/src/OpenFOAM/primitives/Lists/wordReListMatcher.H b/src/OpenFOAM/primitives/Lists/wordReListMatcher.H new file mode 100644 index 0000000000000000000000000000000000000000..fa125048e52454e50cbb40e65387315162185ecd --- /dev/null +++ b/src/OpenFOAM/primitives/Lists/wordReListMatcher.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::wordReListMatcher + +Description + A wrapper for matching a List of wordRe. + +Note + The constructor should remain non-explicit. This allows automatic + conversion from UList\<wordRe\> to wordReListMatcher in search + functions. + +SourceFiles + wordReListMatcherI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef wordReListMatcher_H +#define wordReListMatcher_H + +#include "wordReList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wordReListMatcher Declaration +\*---------------------------------------------------------------------------*/ + +class wordReListMatcher +{ + // Private data + + //- Reference to underlying list + const UList<wordRe>& reList_; + +public: + + // Constructors + + //- Construct from a List of wordRe + inline wordReListMatcher(const UList<wordRe>&); + + + // Member Functions + + // Access + + inline label size() const; + inline bool empty() const; + + //- Return underlying list of wordRe + inline const UList<wordRe>& operator()() const; + + + // Searching + + //- Return true if string matches any of the regular expressions + // Smart match as regular expression or as a string. + // Optionally specify a literal match only. + inline bool match(const string&, bool literalMatch=false) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "wordReListMatcherI.H" + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C b/src/OpenFOAM/primitives/Lists/wordReListMatcherI.H similarity index 61% rename from applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C rename to src/OpenFOAM/primitives/Lists/wordReListMatcherI.H index 214b96bf2658a5cab3ed1fccc82739ddf3995506..4b3774d2d486b651396a44fd7f2ac4608137f475 100644 --- a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C +++ b/src/OpenFOAM/primitives/Lists/wordReListMatcherI.H @@ -22,39 +22,58 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ -#include "error.H" -#include "blockMesh.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +inline Foam::wordReListMatcher::wordReListMatcher +( + const UList<wordRe>& lst +) +: + reList_(lst) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::label Foam::wordReListMatcher::size() const +{ + return reList_.size(); +} + -Foam::labelList Foam::blockMesh::createBlockOffsets() +inline bool Foam::wordReListMatcher::empty() const { - Info<< nl << "Creating block offsets" << endl; + return reList_.empty(); +} - blockMesh& blocks = *this; - nPoints_ = blocks[0].points().size(); - nCells_ = blocks[0].cells().size(); +inline const Foam::UList<Foam::wordRe>& +Foam::wordReListMatcher::operator()() const +{ + return reList_; +} - labelList BlockOffsets(blocks.size()); - BlockOffsets[0] = 0; - label blockLabel; - for (blockLabel=1; blockLabel<blocks.size(); blockLabel++) +inline bool Foam::wordReListMatcher::match +( + const string& str, + bool literalMatch +) const +{ + const label nElem = reList_.size(); + for (label elemI = 0; elemI < nElem; ++elemI) { - nPoints_ += blocks[blockLabel].points().size(); - nCells_ += blocks[blockLabel].cells().size(); - - BlockOffsets[blockLabel] - = BlockOffsets[blockLabel-1] - + blocks[blockLabel-1].points().size(); + if (reList_[elemI].match(str, literalMatch)) + { + return true; + } } - return BlockOffsets; + return false; } + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C index 6ecc1da31351422682e4311569a88b2c9948e7c7..fd573c9fd03bb89d1e7a7d53b8f7b7575e241575 100644 --- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C +++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "tensor.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -150,8 +150,8 @@ vector eigenValues(const tensor& t) scalar aBy3 = a/3; i = m2SqrtQ*cos(theta/3) - aBy3; - ii = m2SqrtQ*cos((theta + constant::math::twoPi)/3) - aBy3; - iii = m2SqrtQ*cos((theta - constant::math::twoPi)/3) - aBy3; + ii = m2SqrtQ*cos((theta + constant::mathematical::twoPi)/3) - aBy3; + iii = m2SqrtQ*cos((theta - constant::mathematical::twoPi)/3) - aBy3; } else { @@ -343,8 +343,8 @@ vector eigenValues(const symmTensor& t) scalar aBy3 = a/3; i = m2SqrtQ*cos(theta/3) - aBy3; - ii = m2SqrtQ*cos((theta + constant::math::twoPi)/3) - aBy3; - iii = m2SqrtQ*cos((theta - constant::math::twoPi)/3) - aBy3; + ii = m2SqrtQ*cos((theta + constant::mathematical::twoPi)/3) - aBy3; + iii = m2SqrtQ*cos((theta - constant::mathematical::twoPi)/3) - aBy3; } else { diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H index d499998145a399b84571decbcfdf843190b9ea55..a0f6c550a1e10ec94dfc588a15c701ae354999fb 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H @@ -170,7 +170,7 @@ public: //- Smart match as regular expression or as a string // Optionally specify a literal match only - inline bool match(const string&, bool literalMatch=false) const; + inline bool match(const std::string&, bool literalMatch=false) const; //- Miscellaneous diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H index 7f242eb2c5ea7f98a936e0f257e52b5ccf923eb1..084fc9c4c8cb0e5a61b71772b2a185460e9a6721 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H @@ -176,12 +176,12 @@ inline void Foam::wordRe::clear() } -inline bool Foam::wordRe::match(const string& str, bool literalMatch) const +inline bool Foam::wordRe::match(const std::string& str, bool literalMatch) const { if (literalMatch || !re_.exists()) { // check as string - return (*this == str); + return (str == *this); } else { diff --git a/src/OpenFOAM/primitives/transform/transform.H b/src/OpenFOAM/primitives/transform/transform.H index 8d6657b41f915e2459ac55d787c1a755d1e4f011..cab0d8901c9509a8916cc3bd04fa4b4dceed7b69 100644 --- a/src/OpenFOAM/primitives/transform/transform.H +++ b/src/OpenFOAM/primitives/transform/transform.H @@ -34,7 +34,7 @@ Description #define transform_H #include "tensor.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -205,11 +205,11 @@ inline scalar pseudoAngle if (sin < -SMALL) { - return (3.0 + cos)*constant::math::piByTwo; + return (3.0 + cos)*constant::mathematical::piByTwo; } else { - return (1.0 - cos)*constant::math::piByTwo; + return (1.0 - cos)*constant::mathematical::piByTwo; } } diff --git a/src/conversion/meshTables/boundaryRegion.C b/src/conversion/meshTables/boundaryRegion.C index b5c278887fa3429bf4831fe25132b2a321e6c7b8..d933007c6e47c86c4ed4ae9fbadc068c1fc3ecfb 100644 --- a/src/conversion/meshTables/boundaryRegion.C +++ b/src/conversion/meshTables/boundaryRegion.C @@ -97,7 +97,7 @@ Foam::Map<Foam::word> Foam::boundaryRegion::names() const Foam::Map<Foam::word> Foam::boundaryRegion::names ( - const List<wordRe>& patterns + const UList<wordRe>& patterns ) const { Map<word> lookup; diff --git a/src/conversion/meshTables/boundaryRegion.H b/src/conversion/meshTables/boundaryRegion.H index 91826b4d58cda4f0621fd15a837e3325f928b90a..32a0d7cba46c9285e3048f257321429db678ce3c 100644 --- a/src/conversion/meshTables/boundaryRegion.H +++ b/src/conversion/meshTables/boundaryRegion.H @@ -112,7 +112,7 @@ public: Map<word> names() const; //- Return a Map of (id => names) selected by patterns - Map<word> names(const List<wordRe>& patterns) const; + Map<word> names(const UList<wordRe>& patterns) const; //- Return a Map of (id => type) Map<word> boundaryTypes() const; diff --git a/src/conversion/meshTables/cellTable.C b/src/conversion/meshTables/cellTable.C index 2d640deb7e92b5f18fb8f4b02918b22310ac19c4..6369f98d9d58ea664675b173ae566296b8bc5a1e 100644 --- a/src/conversion/meshTables/cellTable.C +++ b/src/conversion/meshTables/cellTable.C @@ -169,7 +169,7 @@ Foam::Map<Foam::word> Foam::cellTable::names() const Foam::Map<Foam::word> Foam::cellTable::names ( - const List<wordRe>& patterns + const UList<wordRe>& patterns ) const { Map<word> lookup; diff --git a/src/conversion/meshTables/cellTable.H b/src/conversion/meshTables/cellTable.H index 102a134b8cc458ee91929256cf8fbf88fd44d695..4d0079f032b8c248c8f30a2d743ad7fc5512dc37 100644 --- a/src/conversion/meshTables/cellTable.H +++ b/src/conversion/meshTables/cellTable.H @@ -139,7 +139,7 @@ public: Map<word> names() const; //- Return a Map of (id => names) selected by patterns - Map<word> names(const List<wordRe>& patterns) const; + Map<word> names(const UList<wordRe>& patterns) const; //- Return a Map of (id => name) for materialType (fluid | solid | shell) Map<word> selectType(const word& materialType) const; diff --git a/src/dynamicFvMesh/Make/files b/src/dynamicFvMesh/Make/files index 9e0a498750ba10ad0dc6324bb791cf8fc974cd1e..ca9a99aca6fcaeb8837b1725331977cd89cf075a 100644 --- a/src/dynamicFvMesh/Make/files +++ b/src/dynamicFvMesh/Make/files @@ -10,6 +10,11 @@ solidBodyMotionFunctions = solidBodyMotionFvMesh/solidBodyMotionFunctions $(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunction.C $(solidBodyMotionFunctions)/solidBodyMotionFunction/newSolidBodyMotionFunction.C $(solidBodyMotionFunctions)/SDA/SDA.C -$(solidBodyMotionFunctions)/SKA/SKA.C +$(solidBodyMotionFunctions)/tabulated6DoFMotion/tabulated6DoFMotion.C +$(solidBodyMotionFunctions)/linearMotion/linearMotion.C +$(solidBodyMotionFunctions)/rotatingMotion/rotatingMotion.C +$(solidBodyMotionFunctions)/multiMotion/multiMotion.C +$(solidBodyMotionFunctions)/oscillatingLinearMotion/oscillatingLinearMotion.C +$(solidBodyMotionFunctions)/oscillatingRotatingMotion/oscillatingRotatingMotion.C LIB = $(FOAM_LIBBIN)/libdynamicFvMesh diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C index 5fa27e142a6e5e6d36790663a5d4e22e1f73a048..1e519e4b13283d4bad17b3e52c67b1433904ff18 100644 --- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C +++ b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C @@ -27,7 +27,7 @@ License #include "dynamicInkJetFvMesh.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -90,7 +90,7 @@ Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh() bool Foam::dynamicInkJetFvMesh::update() { scalar scalingFunction = - 0.5*(::cos(constant::math::twoPi*frequency_*time().value()) - 1.0); + 0.5*(::cos(constant::mathematical::twoPi*frequency_*time().value()) - 1.0); Info<< "Mesh scaling. Time = " << time().value() << " scaling: " << scalingFunction << endl; diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C index 1fbd323685f026335b1f1ef9326976fa9195f307..c7f34b90dec252d144f5a42c60b2b3dd76999d81 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C @@ -26,9 +26,9 @@ License #include "SDA.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant::math; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..8fbe323cf551094c0196cbf91e728c6c0462efa0 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "linearMotion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(linearMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + linearMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::linearMotion::linearMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::linearMotion::~linearMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::linearMotion::transformation() const +{ + scalar t = time_.value(); + + // Translation of centre of gravity with constant velocity + const vector displacement = velocity_*t; + + quaternion R(0, 0, 0); + septernion TR(septernion(displacement)*R); + + Info<< "solidBodyMotionFunctions::linearMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::linearMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + SBMFCoeffs_.lookup("velocity") >> velocity_; + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..08668af0e33c05f410fbbb3a9a6eb789d183511a --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::linearMotion + +Description + SolidBodyMotionFvMesh 6DoF motion function. Constant velocity displacement. + +SourceFiles + linearMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linearMotion_H +#define linearMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class linearMotion Declaration +\*---------------------------------------------------------------------------*/ + +class linearMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Linear velocity + vector velocity_; + + + // Private Member Functions + + //- Disallow copy construct + linearMotion(const linearMotion&); + + //- Disallow default bitwise assignment + void operator=(const linearMotion&); + + +public: + + //- Runtime type information + TypeName("linearMotion"); + + + // Constructors + + //- Construct from components + linearMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~linearMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/multiMotion/multiMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/multiMotion/multiMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..028c95ecf7ddb6872c3ccb7215394bc7c0091037 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/multiMotion/multiMotion.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "multiMotion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(multiMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + multiMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::multiMotion::multiMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::multiMotion::~multiMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::multiMotion::transformation() const +{ + scalar t = time_.value(); + + septernion TR = SBMFs_[0].transformation(); + + for (label i = 1; i < SBMFs_.size(); i++) + { + TR *= SBMFs_[i].transformation(); + } + + Info<< "solidBodyMotionFunctions::multiMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::multiMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + label i = 0; + SBMFs_.setSize(SBMFCoeffs_.size()); + + forAllConstIter(IDLList<entry>, SBMFCoeffs_, iter) + { + if (iter().isDict()) + { + SBMFs_.set + ( + i, + solidBodyMotionFunction::New(iter().dict(), time_) + ); + + Info<< "Constructed SBMF " << i << " : " + << iter().keyword() << " of type " + << SBMFs_[i].type() << endl; + + i++; + } + } + SBMFs_.setSize(i); + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/multiMotion/multiMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/multiMotion/multiMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..fea4a1de701554fc64955fa082fb0cf52028fe79 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/multiMotion/multiMotion.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::multiMotion + +Description + Combination of SolidBodyMotionFvMesh 6DoF motion functions. + +SourceFiles + multiMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef multiMotion_H +#define multiMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class multiMotion Declaration +\*---------------------------------------------------------------------------*/ + +class multiMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Motions to combine + PtrList<solidBodyMotionFunction> SBMFs_; + + + // Private Member Functions + + //- Disallow copy construct + multiMotion(const multiMotion&); + + //- Disallow default bitwise assignment + void operator=(const multiMotion&); + + +public: + + //- Runtime type information + TypeName("multiMotion"); + + + // Constructors + + //- Construct from components + multiMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~multiMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..c662b59d9f59ed8660972aaed09e980748ca2128 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "oscillatingLinearMotion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(oscillatingLinearMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + oscillatingLinearMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::oscillatingLinearMotion::oscillatingLinearMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::oscillatingLinearMotion::~oscillatingLinearMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::oscillatingLinearMotion::transformation() const +{ + scalar t = time_.value(); + + const vector displacement = amplitude_*sin(omega_*t); + + quaternion R(0, 0, 0); + septernion TR(septernion(displacement)*R); + + Info<< "solidBodyMotionFunctions::oscillatingLinearMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::oscillatingLinearMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + SBMFCoeffs_.lookup("amplitude") >> amplitude_; + SBMFCoeffs_.lookup("omega") >> omega_; + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..9d4079f4ce97b66e03ec540c37b051dc876331ff --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::oscillatingLinearMotion + +Description + SolidBodyMotionFvMesh 6DoF motion function. Oscillating displacement. + +SourceFiles + oscillatingLinearMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oscillatingLinearMotion_H +#define oscillatingLinearMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class oscillatingLinearMotion Declaration +\*---------------------------------------------------------------------------*/ + +class oscillatingLinearMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Amplitude + vector amplitude_; + + //- Radial velocity + scalar omega_; + + + // Private Member Functions + + //- Disallow copy construct + oscillatingLinearMotion(const oscillatingLinearMotion&); + + //- Disallow default bitwise assignment + void operator=(const oscillatingLinearMotion&); + + +public: + + //- Runtime type information + TypeName("oscillatingLinearMotion"); + + + // Constructors + + //- Construct from components + oscillatingLinearMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~oscillatingLinearMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..39b58706811ae7dd3b5fd83916b55ccf7e5fb78b --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "oscillatingRotatingMotion.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(oscillatingRotatingMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + oscillatingRotatingMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::oscillatingRotatingMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::~oscillatingRotatingMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::transformation() const +{ + scalar t = time_.value(); + + vector eulerAngles = amplitude_*sin(omega_*t); + + // Convert the rotational motion from deg to rad + eulerAngles *= pi/180.0; + + quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z()); + septernion TR(septernion(CofG_)*R*septernion(-CofG_)); + + Info<< "solidBodyMotionFunctions::oscillatingRotatingMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + SBMFCoeffs_.lookup("CofG") >> CofG_; + SBMFCoeffs_.lookup("amplitude") >> amplitude_; + SBMFCoeffs_.lookup("omega") >> omega_; + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..253c7df64d44a3d9327530f952bd6e6355e2c84c --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::oscillatingRotatingMotion + +Description + SolidBodyMotionFvMesh 6DoF motion function. Oscillating rotation. + +SourceFiles + oscillatingRotatingMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oscillatingRotatingMotion_H +#define oscillatingRotatingMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class oscillatingRotatingMotion Declaration +\*---------------------------------------------------------------------------*/ + +class oscillatingRotatingMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Centre of gravity + point CofG_; + + //- Amplitude + vector amplitude_; + + //- Radial velocity + scalar omega_; + + + // Private Member Functions + + //- Disallow copy construct + oscillatingRotatingMotion(const oscillatingRotatingMotion&); + + //- Disallow default bitwise assignment + void operator=(const oscillatingRotatingMotion&); + + +public: + + //- Runtime type information + TypeName("oscillatingRotatingMotion"); + + + // Constructors + + //- Construct from components + oscillatingRotatingMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~oscillatingRotatingMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..b865ceb9306061bbcbb81bd9641f8aa0e1432359 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "rotatingMotion.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(rotatingMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + rotatingMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::rotatingMotion::rotatingMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::rotatingMotion::~rotatingMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const +{ + scalar t = time_.value(); + + // Motion around a centre of gravity + + // Rotation around centre of gravity (in degrees) + vector eulerAngles = radialVelocity_*t; + + // Convert the rotational motion from deg to rad + eulerAngles *= pi/180.0; + + quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z()); + septernion TR(septernion(CofG_)*R*septernion(-CofG_)); + + Info<< "solidBodyMotionFunctions::rotatingMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::rotatingMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + SBMFCoeffs_.lookup("CofG") >> CofG_; + SBMFCoeffs_.lookup("radialVelocity") >> radialVelocity_; + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..da38f673688934f443f4a8e24f903494de68aee3 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rotatingMotion/rotatingMotion.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::rotatingMotion + +Description + SolidBodyMotionFvMesh 6DoF motion function. Constant + velocity rotation around CoG. + +SourceFiles + rotatingMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef rotatingMotion_H +#define rotatingMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class rotatingMotion Declaration +\*---------------------------------------------------------------------------*/ + +class rotatingMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Centre of gravity + point CofG_; + + //- Rotational velocity (deg/s) + vector radialVelocity_; + + + // Private Member Functions + + //- Disallow copy construct + rotatingMotion(const rotatingMotion&); + + //- Disallow default bitwise assignment + void operator=(const rotatingMotion&); + + +public: + + //- Runtime type information + TypeName("rotatingMotion"); + + + // Constructors + + //- Construct from components + rotatingMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~rotatingMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C similarity index 79% rename from src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C rename to src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C index e15523f9832c1c2b7afb69cd1f61d6faf99175eb..c58fa9852e12b2a54976a86e5abf61451c49c01b 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C @@ -24,14 +24,14 @@ License \*---------------------------------------------------------------------------*/ -#include "SKA.H" +#include "tabulated6DoFMotion.H" #include "addToRunTimeSelectionTable.H" #include "Tuple2.H" #include "IFstream.H" #include "interpolateXY.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant::math; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -39,15 +39,20 @@ namespace Foam { namespace solidBodyMotionFunctions { - defineTypeNameAndDebug(SKA, 0); - addToRunTimeSelectionTable(solidBodyMotionFunction, SKA, dictionary); + defineTypeNameAndDebug(tabulated6DoFMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + tabulated6DoFMotion, + dictionary + ); }; }; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidBodyMotionFunctions::SKA::SKA +Foam::solidBodyMotionFunctions::tabulated6DoFMotion::tabulated6DoFMotion ( const dictionary& SBMFCoeffs, const Time& runTime @@ -61,13 +66,14 @@ Foam::solidBodyMotionFunctions::SKA::SKA // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // -Foam::solidBodyMotionFunctions::SKA::~SKA() +Foam::solidBodyMotionFunctions::tabulated6DoFMotion::~tabulated6DoFMotion() {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const +Foam::septernion +Foam::solidBodyMotionFunctions::tabulated6DoFMotion::transformation() const { scalar t = time_.value(); @@ -75,7 +81,7 @@ Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const { FatalErrorIn ( - "solidBodyMotionFunctions::SKA::transformation()" + "solidBodyMotionFunctions::tabulated6DoFMotion::transformation()" ) << "current time (" << t << ") is less than the minimum in the data table (" << times_[0] << ')' @@ -86,7 +92,7 @@ Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const { FatalErrorIn ( - "solidBodyMotionFunctions::SKA::transformation()" + "solidBodyMotionFunctions::tabulated6DoFMotion::transformation()" ) << "current time (" << t << ") is greater than the maximum in the data table (" << times_[times_.size()-1] << ')' @@ -106,14 +112,17 @@ Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const quaternion R(TRV[1].x(), TRV[1].y(), TRV[1].z()); septernion TR(septernion(CofG_ + TRV[0])*R*septernion(-CofG_)); - Info<< "solidBodyMotionFunctions::SKA::transformation(): " + Info<< "solidBodyMotionFunctions::tabulated6DoFMotion::transformation(): " << "Time = " << t << " transformation: " << TR << endl; return TR; } -bool Foam::solidBodyMotionFunctions::SKA::read(const dictionary& SBMFCoeffs) +bool Foam::solidBodyMotionFunctions::tabulated6DoFMotion::read +( + const dictionary& SBMFCoeffs +) { solidBodyMotionFunction::read(SBMFCoeffs); @@ -147,7 +156,8 @@ bool Foam::solidBodyMotionFunctions::SKA::read(const dictionary& SBMFCoeffs) { FatalErrorIn ( - "solidBodyMotionFunctions::SKA::read(const dictionary&)" + "solidBodyMotionFunctions::tabulated6DoFMotion::read" + "(const dictionary&)" ) << "Cannot open time data file " << timeDataFileName_ << exit(FatalError); } diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.H similarity index 87% rename from src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.H rename to src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.H index 539129d2166ffd79eac13feb69f7846a36430633..1b9cd96f1998153bc1931810cb9caa1e5ef21a70 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.H +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.H @@ -23,25 +23,22 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::solidBodyMotionFunctions::SKA + Foam::solidBodyMotionFunctions::tabulated6DoFMotion Description - Sea Keeping Analysis (SKA) 6DoF motion function. + Tabulated 6DoF motion function. Obtained by interpolating tabulated data for surge (x-translation), sway (y-translation), heave (z-translation), roll (rotation about x), pitch (rotation about y) and yaw (rotation about z). -See Also - SDA (Ship design analysis) for 3DoF motion. - SourceFiles - SKA.C + tabulated6DoFMotion.C \*---------------------------------------------------------------------------*/ -#ifndef SKA_H -#define SKA_H +#ifndef tabulated6DoFMotion_H +#define tabulated6DoFMotion_H #include "solidBodyMotionFunction.H" #include "primitiveFields.H" @@ -55,10 +52,10 @@ namespace solidBodyMotionFunctions { /*---------------------------------------------------------------------------*\ - Class SKA Declaration + Class tabulated6DoFMotion Declaration \*---------------------------------------------------------------------------*/ -class SKA +class tabulated6DoFMotion : public solidBodyMotionFunction { @@ -83,22 +80,22 @@ class SKA // Private Member Functions //- Disallow copy construct - SKA(const SKA&); + tabulated6DoFMotion(const tabulated6DoFMotion&); //- Disallow default bitwise assignment - void operator=(const SKA&); + void operator=(const tabulated6DoFMotion&); public: //- Runtime type information - TypeName("SKA"); + TypeName("tabulated6DoFMotion"); // Constructors //- Construct from components - SKA + tabulated6DoFMotion ( const dictionary& SBMFCoeffs, const Time& runTime @@ -107,7 +104,7 @@ public: // Destructor - virtual ~SKA(); + virtual ~tabulated6DoFMotion(); // Member Functions diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C index 7329c1dd905b3f7cc51d6fcdb6b347f1721bb26c..5420ba316453922b395fdf6518c35f00fd6bf6cc 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C @@ -83,14 +83,27 @@ Foam::solidBodyMotionFvMesh::~solidBodyMotionFvMesh() bool Foam::solidBodyMotionFvMesh::update() { + static bool hasWarned = false; + fvMesh::movePoints ( transform(SBMFPtr_().transformation(), undisplacedPoints_) ); - const_cast<volVectorField&>(lookupObject<volVectorField>("U")) - .correctBoundaryConditions(); + if (foundObject<volVectorField>("U")) + { + const_cast<volVectorField&>(lookupObject<volVectorField>("U")) + .correctBoundaryConditions(); + } + else if (!hasWarned) + { + hasWarned = true; + + WarningIn("solidBodyMotionFvMesh::update()") + << "Did not find volVectorField U." + << " Not updating U boundary conditions." << endl; + } return true; } diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C index 8f4a57aca7f2f3dde505f14a508267b1269a8e9e..f17e07c323f3329c5ff16d8282eecb7cdd62ddfe 100644 --- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C @@ -27,7 +27,7 @@ License #include "topoCellLooper.H" #include "cellFeatures.H" #include "polyMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "DynamicList.H" #include "ListOps.H" #include "meshTools.H" @@ -44,8 +44,7 @@ namespace Foam } // Angle for polys to be considered splitHexes. -const Foam::scalar Foam::topoCellLooper::featureCos = - Foam::cos(10.0*constant::math::pi/180.0); +const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0)); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C index 57dd15eb545adb1c5d4477ded509b3796bab3cfb..16606233d04418e686e3730c9849515ab0b51c7b 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C @@ -32,7 +32,7 @@ License #include "cellCuts.H" #include "splitCell.H" #include "mapPolyMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "meshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -192,7 +192,7 @@ Foam::undoableMeshCutter::undoableMeshCutter faceRemover_ ( mesh, - Foam::cos(30.0/180.0*constant::math::pi) + Foam::cos(degToRad(30.0)) ) {} diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C index 4fbd137526c0906aeaeab48818ce9145a0684576..83d0000ea39b1c1ed6ac15ff98a37c3d4c657952 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C @@ -27,7 +27,7 @@ License #include "polyMeshGeometry.H" #include "pyramidPointFaceRef.H" #include "syncTools.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" namespace Foam { @@ -248,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho << " between cells " << mesh.faceOwner()[faceI] << " and " << nei << ": Angle = " - << ::acos(dDotS)/constant::math::pi*180.0 + << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -269,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho << " between cells " << mesh.faceOwner()[faceI] << " and " << nei << ": Angle = " - << ::acos(dDotS)/constant::math::pi*180.0 + << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -368,8 +368,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct const polyBoundaryMesh& patches = mesh.boundaryMesh(); // Severe nonorthogonality threshold - const scalar severeNonorthogonalityThreshold = - ::cos(orthWarn/180.0*constant::math::pi); + const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn)); // Calculate coupled cell centre @@ -504,9 +503,8 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct if (nDDotS > 0) { Info<< "Mesh non-orthogonality Max: " - << ::acos(minDDotS)/constant::math::pi*180.0 - << " average: " << - ::acos(sumDDotS/nDDotS)/constant::math::pi*180.0 + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/nDDotS)) << endl; } } @@ -1258,7 +1256,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles << abort(FatalError); } - const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi); + const scalar maxSin = Foam::sin(degToRad(maxDeg)); const faceList& fcs = mesh.faces(); @@ -1338,8 +1336,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles if (maxEdgeSin > SMALL) { scalar maxConcaveDegr = - Foam::asin(Foam::min(1.0, maxEdgeSin)) - *180.0/constant::math::pi; + radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin))); Info<< "There are " << nConcave << " faces with concave angles between consecutive" diff --git a/src/engine/engineTime/engineTime.C b/src/engine/engineTime/engineTime.C index 8756cff006047d6bd8eb600765fde9a351894d33..8adf64fdcde9238eeea90e21476b437049858154 100644 --- a/src/engine/engineTime/engineTime.C +++ b/src/engine/engineTime/engineTime.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "engineTime.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -123,12 +123,6 @@ bool Foam::engineTime::read() } -Foam::scalar Foam::engineTime::degToRad(const scalar deg) const -{ - return constant::math::pi*deg/180.0; -} - - Foam::scalar Foam::engineTime::degToTime(const scalar theta) const { // 6 * rpm => deg/s diff --git a/src/engine/engineTime/engineTime.H b/src/engine/engineTime/engineTime.H index f97701d2405c6084479e67f8b35b72f549777728..e63a7caa0b5bdfd77a207419487e6bae8c36b584 100644 --- a/src/engine/engineTime/engineTime.H +++ b/src/engine/engineTime/engineTime.H @@ -121,9 +121,6 @@ public: // Conversion - //- Convert degrees to radians - scalar degToRad(const scalar rad) const; - //- Convert degrees to seconds (for given engine speed in RPM) scalar degToTime(const scalar theta) const; diff --git a/src/engine/include/StCorr.H b/src/engine/include/StCorr.H index 21e5491f103048780ceb0a6904e1047b21622162..6e08edcf1997fc1701edc4ab6ecca05956b8a74f 100644 --- a/src/engine/include/StCorr.H +++ b/src/engine/include/StCorr.H @@ -27,11 +27,11 @@ ) ); - Ak = sphereFraction*4.0*constant::math::pi + Ak = sphereFraction*4.0*constant::mathematical::pi *pow ( 3.0*Vk - /(sphereFraction*4.0*constant::math::pi), + /(sphereFraction*4.0*constant::mathematical::pi), 2.0/3.0 ); } @@ -56,11 +56,11 @@ ) ); - Ak = circleFraction*constant::math::pi*thickness + Ak = circleFraction*constant::mathematical::pi*thickness *sqrt ( 4.0*Vk - /(circleFraction*thickness*constant::math::pi) + /(circleFraction*thickness*constant::mathematical::pi) ); } break; diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C index 6eae867a24f72bd53a58db0d7b5374987a2d7afb..32effaa965c7dbd8723b6806003f267673a5fe35 100644 --- a/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C @@ -26,7 +26,7 @@ License #include "rpm.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -56,7 +56,7 @@ Foam::SRF::rpm::rpm rpm_(readScalar(SRFModelCoeffs_.lookup("rpm"))) { // Initialise the angular velocity - omega_.value() = axis_*rpm_*constant::math::twoPi/60.0; + omega_.value() = axis_*rpm_*constant::mathematical::twoPi/60.0; } @@ -76,7 +76,7 @@ bool Foam::SRF::rpm::read() SRFModelCoeffs_.lookup("rpm") >> rpm_; // Update angular velocity - omega_.value() = axis_*rpm_*(constant::math::twoPi/60.0); + omega_.value() = axis_*rpm_*(constant::mathematical::twoPi/60.0); return true; } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C index 2595f36d784c4d2a6049bdcc93b0e2dc0aca29c3..43d4bcd941e4b6a7495f4e65bf5674d593aee02b 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C @@ -95,11 +95,11 @@ basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// return gradient at boundary template<class Type> tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const { vectorField nHat = this->patch().nf(); + return ( transform(I - 2.0*sqr(nHat), this->patchInternalField()) @@ -108,7 +108,6 @@ tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const } -// Evaluate the field on the patch template<class Type> void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes) { @@ -118,6 +117,7 @@ void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes) } vectorField nHat = this->patch().nf(); + Field<Type>::operator= ( ( @@ -130,11 +130,11 @@ void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes) } -// Return defining fields template<class Type> tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGradTransformDiag() const { vectorField nHat = this->patch().nf(); + vectorField diag(nHat.size()); diag.replace(vector::X, mag(nHat.component(vector::X))); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C index 912dbf3ea35b0b129a56db7c438fd25d703010f4..d086a46786cffff23b077c9849d4469fd0a86ed1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "oscillatingFixedValueFvPatchField.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,7 +40,7 @@ scalar oscillatingFixedValueFvPatchField<Type>::currentScale() const return 1.0 + amplitude_ - *sin(constant::math::twoPi*frequency_*this->db().time().value()); + *sin(constant::mathematical::twoPi*frequency_*this->db().time().value()); } diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index b6ead004e7e679f543bd016435144484dadf5337..5bcb692065cec4ca8f64ecdbe0e7cf22035807b7 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -32,7 +32,7 @@ Description #include "surfaceFields.H" #include "demandDrivenData.H" #include "coupledFvPatch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -345,7 +345,8 @@ void surfaceInterpolation::makeCorrectionVectors() const // Calculate the non-orthogonality for meshes with 1 face or more if (returnReduce(magSf.size(), sumOp<label>()) > 0) { - NonOrthogCoeff = + NonOrthogCoeff = radToDeg + ( asin ( min @@ -353,7 +354,8 @@ void surfaceInterpolation::makeCorrectionVectors() const (sum(magSf*mag(corrVecs))/sum(magSf)).value(), 1.0 ) - )*180.0/constant::math::pi; + ) + ); } if (debug) diff --git a/src/fvMotionSolver/Make/files b/src/fvMotionSolver/Make/files index f229ae322ef04b4bf61dd4bb0eb336fed3764e48..fd018a7537f36ed366a281d758e1094f93e098f3 100644 --- a/src/fvMotionSolver/Make/files +++ b/src/fvMotionSolver/Make/files @@ -31,5 +31,10 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C LIB = $(FOAM_LIBBIN)/libfvMotionSolvers diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 966b56964d720cb3acf3a2f006a63d6b14284ef5..9222d5f97c8e43b80117b51b5d21abc1216f2d71 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -2,10 +2,12 @@ EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ LIB_LIBS = \ -ltriSurface \ -lmeshTools \ -ldynamicMesh \ - -lfiniteVolume + -lfiniteVolume \ + -lforces diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..f2a7adb5b6e6efd896e0fe4d3714ad1017703b93 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -0,0 +1,192 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyDisplacementPointPatchVectorField.H" +#include "pointPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "Time.H" +#include "fvMesh.H" +#include "volFields.H" +#include "uniformDimensionedFields.H" +#include "forces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const pointPatch& p, + const DimensionedField<vector, pointMesh>& iF +) +: + fixedValuePointPatchField<vector>(p, iF), + motion_(), + p0_(p.localPoints()), + rhoInf_(1.0) +{} + + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const pointPatch& p, + const DimensionedField<vector, pointMesh>& iF, + const dictionary& dict +) +: + fixedValuePointPatchField<vector>(p, iF, dict), + motion_(dict), + rhoInf_(readScalar(dict.lookup("rhoInf"))) +{ + if (!dict.found("value")) + { + updateCoeffs(); + } + + if (dict.found("p0")) + { + p0_ = vectorField("p0", dict , p.size()); + } + else + { + p0_ = p.localPoints(); + } +} + + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf, + const pointPatch& p, + const DimensionedField<vector, pointMesh>& iF, + const pointPatchFieldMapper& mapper +) +: + fixedValuePointPatchField<vector>(ptf, p, iF, mapper), + motion_(ptf.motion_), + p0_(ptf.p0_), + rhoInf_(ptf.rhoInf_) +{} + + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf, + const DimensionedField<vector, pointMesh>& iF +) +: + fixedValuePointPatchField<vector>(ptf, iF), + motion_(ptf.motion_), + p0_(ptf.p0_), + rhoInf_(ptf.rhoInf_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const polyMesh& mesh = this->dimensionedInternalField().mesh()(); + const Time& t = mesh.time(); + const pointPatch& ptPatch = this->patch(); + + // Patch force data is valid for the current positions, so + // calculate the forces on the motion object from this data, then + // update the positions + + motion_.updatePosition(t.deltaT().value()); + + dictionary forcesDict; + + forcesDict.add("patches", wordList(1, ptPatch.name())); + forcesDict.add("rhoInf", rhoInf_); + forcesDict.add("CofR", motion_.centreOfMass()); + + forces f("forces", db(), forcesDict); + + forces::forcesMoments fm = f.calcForcesMoment(); + + // Get the forces on the patch faces at the current positions + + vector gravity = vector::zero; + + if (db().foundObject<uniformDimensionedVectorField>("g")) + { + uniformDimensionedVectorField g = + db().lookupObject<uniformDimensionedVectorField>("g"); + + gravity = g.value(); + } + + motion_.updateForce + ( + fm.first().first() + fm.first().second() + gravity*motion_.mass(), + fm.second().first() + fm.second().second(), + t.deltaT().value() + ); + + Field<vector>::operator=(motion_.generatePositions(p0_) - p0_); + + fixedValuePointPatchField<vector>::updateCoeffs(); +} + + +void sixDoFRigidBodyDisplacementPointPatchVectorField::write(Ostream& os) const +{ + pointPatchField<vector>::write(os); + motion_.write(os); + os.writeKeyword("rhoInf") + << rhoInf_ << token::END_STATEMENT << nl; + p0_.writeEntry("p0", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePointPatchTypeField +( + pointPatchVectorField, + sixDoFRigidBodyDisplacementPointPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..048fa9f14be951585bc97b611e4d41674daf4009 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sixDoFRigidBodyDisplacementPointPatchVectorField + +Description + Foam::sixDoFRigidBodyDisplacementPointPatchVectorField + +SourceFiles + sixDoFRigidBodyDisplacementPointPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sixDoFRigidBodyDisplacementPointPatchVectorField_H +#define sixDoFRigidBodyDisplacementPointPatchVectorField_H + +#include "fixedValuePointPatchField.H" +#include "sixDoFRigidBodyMotion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class sixDoFRigidBodyDisplacementPointPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class sixDoFRigidBodyDisplacementPointPatchVectorField +: + public fixedValuePointPatchField<vector> +{ + // Private data + + //- Six dof motion object + sixDoFRigidBodyMotion motion_; + + //- Reference positions of points on the patch + pointField p0_; + + //- Reference density required by the forces object for + // incompressible calculations + scalar rhoInf_; + + +public: + + //- Runtime type information + TypeName("sixDoFRigidBodyDisplacement"); + + + // Constructors + + //- Construct from patch and internal field + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const pointPatch&, + const DimensionedField<vector, pointMesh>& + ); + + //- Construct from patch, internal field and dictionary + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const pointPatch&, + const DimensionedField<vector, pointMesh>&, + const dictionary& + ); + + //- Construct by mapping given patchField<vector> onto a new patch + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const sixDoFRigidBodyDisplacementPointPatchVectorField&, + const pointPatch&, + const DimensionedField<vector, pointMesh>&, + const pointPatchFieldMapper& + ); + + //- Construct and return a clone + virtual autoPtr<pointPatchField<vector> > clone() const + { + return autoPtr<pointPatchField<vector> > + ( + new sixDoFRigidBodyDisplacementPointPatchVectorField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const sixDoFRigidBodyDisplacementPointPatchVectorField&, + const DimensionedField<vector, pointMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual autoPtr<pointPatchField<vector> > clone + ( + const DimensionedField<vector, pointMesh>& iF + ) const + { + return autoPtr<pointPatchField<vector> > + ( + new sixDoFRigidBodyDisplacementPointPatchVectorField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..dae1ba9f3df97636cf65b584f6f35e630a192cfd --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotion.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion() +: + motionState_(), + refCentreOfMass_(vector::zero), + momentOfInertia_(diagTensor::one*VSMALL), + mass_(VSMALL) +{} + + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion +( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau, + scalar mass, + const point& refCentreOfMass, + const diagTensor& momentOfInertia +) +: + motionState_ + ( + centreOfMass, + Q, + v, + a, + pi, + tau + ), + refCentreOfMass_(refCentreOfMass), + momentOfInertia_(momentOfInertia), + mass_(mass) +{} + + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict) +: + motionState_(dict), + refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())), + momentOfInertia_(dict.lookup("momentOfInertia")), + mass_(readScalar(dict.lookup("mass"))) +{} + + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion +( + const sixDoFRigidBodyMotion& sDoFRBM +) +: + motionState_(sDoFRBM.motionState()), + refCentreOfMass_(sDoFRBM.refCentreOfMass()), + momentOfInertia_(sDoFRBM.momentOfInertia()), + mass_(sDoFRBM.mass()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotion::~sixDoFRigidBodyMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::sixDoFRigidBodyMotion::updatePosition +( + scalar deltaT +) +{ + // First leapfrog velocity adjust and motion part, required before + // force calculation + + if (Pstream::master()) + { + v() += 0.5*deltaT*a(); + + pi() += 0.5*deltaT*tau(); + + // Leapfrog move part + centreOfMass() += deltaT*v(); + + // Leapfrog orientation adjustment + + tensor R; + + R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorZ(deltaT*pi().z()/momentOfInertia_.zz()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx()); + pi() = pi() & R; + Q() = Q() & R; + + } + + Pstream::scatter(motionState_); +} + + +void Foam::sixDoFRigidBodyMotion::updateForce +( + const vector& fGlobal, + const vector& tauGlobal, + scalar deltaT +) +{ + // Second leapfrog velocity adjust part, required after motion and + // force calculation part + + if (Pstream::master()) + { + a() = fGlobal/mass_; + + tau() = (Q().T() & tauGlobal); + + v() += 0.5*deltaT*a(); + + pi() += 0.5*deltaT*tau(); + } + + Pstream::scatter(motionState_); +} + + +void Foam::sixDoFRigidBodyMotion::updateForce +( + const pointField& positions, + const vectorField& forces, + scalar deltaT +) +{ + // Second leapfrog velocity adjust part, required after motion and + // force calculation part + + if (Pstream::master()) + { + a() = vector::zero; + + tau() = vector::zero; + + forAll(positions, i) + { + const vector& f = forces[i]; + + a() += f/mass_; + + tau() += (positions[i] ^ (Q().T() & f)); + } + + v() += 0.5*deltaT*a(); + + pi() += 0.5*deltaT*tau(); + } + + Pstream::scatter(motionState_); +} + + +Foam::tmp<Foam::pointField> +Foam::sixDoFRigidBodyMotion::generatePositions(const pointField& pts) const +{ + return (centreOfMass() + (Q() & (pts - refCentreOfMass_))); +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..16ea1d42b2cba49d908ed4aadfe896bf4bb937b9 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H @@ -0,0 +1,251 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sixDoFRigidBodyMotion + +Description + Six degree of freedom motion for a rigid body. Angular momentum stored in + body fixed reference frame. Reference orientation of the body must align + with the cartesian axes such that the Inertia tensor is in principle + component form. + + Symplectic motion as per: + + title = {Symplectic splitting methods for rigid body molecular dynamics}, + publisher = {AIP}, + year = {1997}, + journal = {The Journal of Chemical Physics}, + volume = {107}, + number = {15}, + pages = {5840-5851}, + url = {http://link.aip.org/link/?JCP/107/5840/1}, + doi = {10.1063/1.474310} + +SourceFiles + sixDoFRigidBodyMotionI.H + sixDoFRigidBodyMotion.C + sixDoFRigidBodyMotionIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sixDoFRigidBodyMotion_H +#define sixDoFRigidBodyMotion_H + +#include "sixDoFRigidBodyMotionState.H" +#include "pointField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class sixDoFRigidBodyMotion; +Istream& operator>>(Istream&, sixDoFRigidBodyMotion&); +Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&); + + +/*---------------------------------------------------------------------------*\ + Class sixDoFRigidBodyMotion Declaration +\*---------------------------------------------------------------------------*/ + +class sixDoFRigidBodyMotion +{ + // Private data + + // state data object + sixDoFRigidBodyMotionState motionState_; + + //- Centre of mass of reference state + point refCentreOfMass_; + + //- Moment of inertia of the body in reference configuration + diagTensor momentOfInertia_; + + //- Mass of the body + scalar mass_; + + + // Private Member Functions + + //- Calculate the rotation tensor around the body reference + // frame x-axis by the given angle + inline tensor rotationTensorX(scalar deltaT) const; + + //- Calculate the rotation tensor around the body reference + // frame y-axis by the given angle + inline tensor rotationTensorY(scalar deltaT) const; + + //- Calculate the rotation tensor around the body reference + // frame z-axis by the given angle + inline tensor rotationTensorZ(scalar deltaT) const; + + +public: + + // Constructors + + //- Construct null + sixDoFRigidBodyMotion(); + + //- Construct from components + sixDoFRigidBodyMotion + ( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau, + scalar mass, + const point& refCentreOfMass, + const diagTensor& momentOfInertia + ); + + //- Construct from dictionary + sixDoFRigidBodyMotion(const dictionary& dict); + + //- Construct as copy + sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&); + + + //- Destructor + ~sixDoFRigidBodyMotion(); + + + // Member Functions + + void updatePosition + ( + scalar deltaT + ); + + void updateForce + ( + const vector& fGlobal, + const vector& tauGlobal, + scalar deltaT + ); + + void updateForce + ( + const pointField& positions, + const vectorField& forces, + scalar deltaT + ); + + tmp<pointField> generatePositions(const pointField& pts) const; + + // Access + + //- Return access to the motion state + inline const sixDoFRigidBodyMotionState& motionState() const; + + //- Return access to the centre of mass + inline const point& centreOfMass() const; + + //- Return access to the centre of mass + inline const point& refCentreOfMass() const; + + //- Return access to the inertia tensor + inline const diagTensor& momentOfInertia() const; + + //- Return access to the mass + inline scalar mass() const; + + //- Return access to the orientation + inline const tensor& Q() const; + + //- Return access to velocity + inline const vector& v() const; + + //- Return access to acceleration + inline const vector& a() const; + + //- Return access to angular momentum + inline const vector& pi() const; + + //- Return access to torque + inline const vector& tau() const; + + + // Edit + + //- Return non-const access to the centre of mass + inline point& centreOfMass(); + + //- Return access to the centre of mass + inline point& refCentreOfMass(); + + //- Return non-const access to the inertia tensor + inline diagTensor& momentOfInertia(); + + //- Return non-const access to the mass + inline scalar& mass(); + + //- Return non-const access to the orientation + inline tensor& Q(); + + //- Return non-const access to vector + inline vector& v(); + + //- Return non-const access to acceleration + inline vector& a(); + + //- Return non-const access to angular momentum + inline vector& pi(); + + //- Return non-const access to torque + inline vector& tau(); + + + //- Write + void write(Ostream&) const; + + + // IOstream Operators + + friend Istream& operator>>(Istream&, sixDoFRigidBodyMotion&); + friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "sixDoFRigidBodyMotionI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H new file mode 100644 index 0000000000000000000000000000000000000000..aeb75bdea4a0c0e03b00b464e770a9cc856b85b6 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H @@ -0,0 +1,183 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +inline Foam::tensor +Foam::sixDoFRigidBodyMotion::rotationTensorX(scalar phi) const +{ + return tensor + ( + 1, 0, 0, + 0, Foam::cos(phi), -Foam::sin(phi), + 0, Foam::sin(phi), Foam::cos(phi) + ); +} + + +inline Foam::tensor +Foam::sixDoFRigidBodyMotion::rotationTensorY(scalar phi) const +{ + return tensor + ( + Foam::cos(phi), 0, Foam::sin(phi), + 0, 1, 0, + -Foam::sin(phi), 0, Foam::cos(phi) + ); +} + + +inline Foam::tensor +Foam::sixDoFRigidBodyMotion::rotationTensorZ(scalar phi) const +{ + return tensor + ( + Foam::cos(phi), -Foam::sin(phi), 0, + Foam::sin(phi), Foam::cos(phi), 0, + 0, 0, 1 + ); +} + + +inline const Foam::sixDoFRigidBodyMotionState& +Foam::sixDoFRigidBodyMotion::motionState() const +{ + return motionState_; +} + + +inline const Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() const +{ + return motionState_.centreOfMass(); +} + + +inline const Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() const +{ + return refCentreOfMass_; +} + + +inline const Foam::diagTensor& +Foam::sixDoFRigidBodyMotion::momentOfInertia() const +{ + return momentOfInertia_; +} + + +inline Foam::scalar Foam::sixDoFRigidBodyMotion::mass() const +{ + return mass_; +} + + +inline const Foam::tensor& Foam::sixDoFRigidBodyMotion::Q() const +{ + return motionState_.Q(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::v() const +{ + return motionState_.v(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::a() const +{ + return motionState_.a(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::pi() const +{ + return motionState_.pi(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::tau() const +{ + return motionState_.tau(); +} + + +inline Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() +{ + return motionState_.centreOfMass(); +} + + +inline Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() +{ + return refCentreOfMass_; +} + + +inline Foam::diagTensor& Foam::sixDoFRigidBodyMotion::momentOfInertia() +{ + return momentOfInertia_; +} + + +inline Foam::scalar& Foam::sixDoFRigidBodyMotion::mass() +{ + return mass_; +} + + +inline Foam::tensor& Foam::sixDoFRigidBodyMotion::Q() +{ + return motionState_.Q(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::v() +{ + return motionState_.v(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::a() +{ + return motionState_.a(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::pi() +{ + return motionState_.pi(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::tau() +{ + return motionState_.tau(); +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C new file mode 100644 index 0000000000000000000000000000000000000000..005cbbe6aa4fec362797b1a91c0da55123614bee --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotion.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::sixDoFRigidBodyMotion::write(Ostream& os) const +{ + motionState_.write(os); + + os.writeKeyword("refCentreOfMass") + << refCentreOfMass_ << token::END_STATEMENT << nl; + os.writeKeyword("momentOfInertia") + << momentOfInertia_ << token::END_STATEMENT << nl; + os.writeKeyword("mass") + << mass_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, sixDoFRigidBodyMotion& sDoFRBM) +{ + is >> sDoFRBM.motionState_ + >> sDoFRBM.refCentreOfMass_ + >> sDoFRBM.momentOfInertia_ + >> sDoFRBM.mass_; + + // Check state of Istream + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::sixDoFRigidBodyMotion&)" + ); + + return is; +} + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const sixDoFRigidBodyMotion& sDoFRBM +) +{ + os << sDoFRBM.motionState() + << token::SPACE << sDoFRBM.refCentreOfMass() + << token::SPACE << sDoFRBM.momentOfInertia() + << token::SPACE << sDoFRBM.mass() ; + + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " + "const Foam::sixDoFRigidBodyMotion&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C new file mode 100644 index 0000000000000000000000000000000000000000..cd52b1d142a27179e7721e2e33bf6dcc1c88968e --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotionState.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState() +: + centreOfMass_(vector::zero), + Q_(I), + v_(vector::zero), + a_(vector::zero), + pi_(vector::zero), + tau_(vector::zero) +{} + + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState +( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau +) +: + centreOfMass_(centreOfMass), + Q_(Q), + v_(v), + a_(a), + pi_(pi), + tau_(tau) +{} + + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState +( + const dictionary& dict +) +: + centreOfMass_(dict.lookup("centreOfMass")), + Q_(dict.lookupOrDefault("Q", tensor(I))), + v_(dict.lookupOrDefault("v", vector::zero)), + a_(dict.lookupOrDefault("a", vector::zero)), + pi_(dict.lookupOrDefault("pi", vector::zero)), + tau_(dict.lookupOrDefault("tau", vector::zero)) +{} + + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState +( + const sixDoFRigidBodyMotionState& sDoFRBMS +) +: + centreOfMass_(sDoFRBMS.centreOfMass()), + Q_(sDoFRBMS.Q()), + v_(sDoFRBMS.v()), + a_(sDoFRBMS.a()), + pi_(sDoFRBMS.pi()), + tau_(sDoFRBMS.tau()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotionState::~sixDoFRigidBodyMotionState() +{} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H new file mode 100644 index 0000000000000000000000000000000000000000..32cf0be02bc51a452783377fbbd653ad20d14f1f --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sixDoFRigidBodyMotionState + +Description + Holds the motion state of sixDoF object. Wrapped up together + to allow rapid scatter to other processors. The processors must all + maintain exactly the same state data to avoid any drift or inconsistency. + +SourceFiles + sixDoFRigidBodyMotionStateI.H + sixDoFRigidBodyMotionState.C + sixDoFRigidBodyMotionStateIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sixDoFRigidBodyMotionState_H +#define sixDoFRigidBodyMotionState_H + +#include "vector.H" +#include "point.H" +#include "diagTensor.H" +#include "tensor.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class sixDoFRigidBodyMotionState; +Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&); +Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&); + + +/*---------------------------------------------------------------------------*\ + Class sixDoFRigidBodyMotionState Declaration +\*---------------------------------------------------------------------------*/ + +class sixDoFRigidBodyMotionState +{ + // Private data + + //- Current position of the centre of mass of the body + point centreOfMass_; + + //- Orientation, stored as the rotation tensor to transform + // from the body to the global reference frame, i.e.: + // globalVector = Q_ & bodyLocalVector + // bodyLocalVector = Q_.T() & globalVector + tensor Q_; + + // Linear velocity of body + vector v_; + + // Total linear acceleration of body + vector a_; + + //- Angular momentum of body, in body local reference frame + vector pi_; + + //- Total torque on body, in body local reference frame + vector tau_; + + +public: + + // Constructors + + //- Construct null + sixDoFRigidBodyMotionState(); + + //- Construct from components + sixDoFRigidBodyMotionState + ( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau + ); + + //- Construct from dictionary + sixDoFRigidBodyMotionState(const dictionary& dict); + + //- Construct as copy + sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&); + + + //- Destructor + ~sixDoFRigidBodyMotionState(); + + + // Member Functions + + // Access + + //- Return access to the centre of mass + inline const point& centreOfMass() const; + + //- Return access to the orientation + inline const tensor& Q() const; + + //- Return access to velocity + inline const vector& v() const; + + //- Return access to acceleration + inline const vector& a() const; + + //- Return access to angular momentum + inline const vector& pi() const; + + //- Return access to torque + inline const vector& tau() const; + + + // Edit + + //- Return non-const access to the centre of mass + inline point& centreOfMass(); + + //- Return non-const access to the orientation + inline tensor& Q(); + + //- Return non-const access to vector + inline vector& v(); + + //- Return non-const access to acceleration + inline vector& a(); + + //- Return non-const access to angular momentum + inline vector& pi(); + + //- Return non-const access to torque + inline vector& tau(); + + + //- Write + void write(Ostream&) const; + + + // Friend Functions + + // Friend Operators + + // IOstream Operators + + friend Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&); + friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "sixDoFRigidBodyMotionStateI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H new file mode 100644 index 0000000000000000000000000000000000000000..dc6659d0cd78bd1b54a361d4517d86d3ae094e08 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +inline const Foam::point& Foam::sixDoFRigidBodyMotionState::centreOfMass() const +{ + return centreOfMass_; +} + + +inline const Foam::tensor& Foam::sixDoFRigidBodyMotionState::Q() const +{ + return Q_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::v() const +{ + return v_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::a() const +{ + return a_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::pi() const +{ + return pi_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::tau() const +{ + return tau_; +} + + +inline Foam::point& Foam::sixDoFRigidBodyMotionState::centreOfMass() +{ + return centreOfMass_; +} + + +inline Foam::tensor& Foam::sixDoFRigidBodyMotionState::Q() +{ + return Q_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::v() +{ + return v_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::a() +{ + return a_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::pi() +{ + return pi_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::tau() +{ + return tau_; +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C new file mode 100644 index 0000000000000000000000000000000000000000..650a3599910271cef51858af3855c94c576cc34c --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotionState.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::sixDoFRigidBodyMotionState::write(Ostream& os) const +{ + os.writeKeyword("centreOfMass") + << centreOfMass_ << token::END_STATEMENT << nl; + os.writeKeyword("Q") + << Q_ << token::END_STATEMENT << nl; + os.writeKeyword("v") + << v_ << token::END_STATEMENT << nl; + os.writeKeyword("a") + << a_ << token::END_STATEMENT << nl; + os.writeKeyword("pi") + << pi_ << token::END_STATEMENT << nl; + os.writeKeyword("tau") + << tau_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>> +( + Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS +) +{ + is >> sDoFRBMS.centreOfMass_ + >> sDoFRBMS.Q_ + >> sDoFRBMS.v_ + >> sDoFRBMS.a_ + >> sDoFRBMS.pi_ + >> sDoFRBMS.tau_; + + // Check state of Istream + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)" + ); + + return is; +} + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const sixDoFRigidBodyMotionState& sDoFRBMS +) +{ + os << token::SPACE << sDoFRBMS.centreOfMass() + << token::SPACE << sDoFRBMS.Q() + << token::SPACE << sDoFRBMS.v() + << token::SPACE << sDoFRBMS.a() + << token::SPACE << sDoFRBMS.pi() + << token::SPACE << sDoFRBMS.tau(); + + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " + "const Foam::sixDoFRigidBodyMotionState&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C index cdea75f6a4c164996c0a9ad9eb5db6ac9d804f5b..1e9d5858b3b67dd78226101479ca5a009babf388 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "COxidationDiffusionLimitedRate.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -124,7 +124,7 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI]; // Change in C mass [kg] - scalar dmC = 4.0*constant::math::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt; + scalar dmC = 4.0*constant::mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt; // Limit mass transfer by availability of C dmC = min(mass*fComb, dmC); diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C index d2cfccc5a3f00cf0fb2267578f2433920dc93956..4798e63e331f4e85b5a6804b0adede66649d5365 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "COxidationKineticDiffusionLimitedRate.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -138,7 +138,7 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate const scalar Rk = C2_*exp(-E_/(specie::RR*Tc)); // Particle surface area - const scalar Ap = constant::math::pi*sqr(d); + const scalar Ap = constant::mathematical::pi*sqr(d); // Change in C mass [kg] scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk); diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C index 39f4f2d28a762ce9c77c0b5d4f09553de5325b39..b411b3e9c20997dc87dd09dbfd9869d6fb2169b1 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "COxidationMurphyShaddix.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -134,7 +134,7 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate } // Particle surface area [m^2] - const scalar Ap = constant::math::pi*sqr(d); + const scalar Ap = constant::mathematical::pi*sqr(d); // Calculate diffision constant at continuous phase temperature // and density [m^2/s] diff --git a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C index ea3f54f0e01bdb2982b02750f3f414e7bc03076c..72acb4167969fbb2899b004c33ad4d80f1d73863 100644 --- a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C +++ b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C @@ -27,7 +27,7 @@ License #include "commonRailInjector.H" #include "addToRunTimeSelectionTable.H" #include "Random.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam @@ -244,7 +244,7 @@ Foam::vector Foam::commonRailInjector::position { // otherwise, disc injection scalar iRadius = d_*rndGen.scalar01(); - scalar iAngle = constant::math::twoPi*rndGen.scalar01(); + scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01(); return ( @@ -297,7 +297,7 @@ Foam::scalar Foam::commonRailInjector::mass // correct mass if calculation is 2D if (twoD) { - mInj *= 0.5*angleOfWedge/constant::math::pi; + mInj *= 0.5*angleOfWedge/constant::mathematical::pi; } return mInj; @@ -404,7 +404,7 @@ void Foam::commonRailInjector::correctProfiles const scalar referencePressure ) { - scalar A = 0.25*constant::math::pi*sqr(d_); + scalar A = 0.25*constant::mathematical::pi*sqr(d_); scalar pDummy = 1.0e+5; scalar rho = fuel.rho(pDummy, T_, X_); diff --git a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C index a9557c4f09fbab93df6f37e893c94c70b5d81af4..4cd8780535accd344672733b51379515086e9dce 100644 --- a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C +++ b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C @@ -27,7 +27,7 @@ License #include "definedInjector.H" #include "addToRunTimeSelectionTable.H" #include "Random.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam @@ -226,7 +226,7 @@ Foam::vector Foam::definedInjector::position { // otherwise, disc injection scalar iRadius = d_*rndGen.scalar01(); - scalar iAngle = constant::math::twoPi*rndGen.scalar01(); + scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01(); return ( @@ -280,7 +280,7 @@ Foam::scalar Foam::definedInjector::mass // correct mass if calculation is 2D if (twoD) { - mInj *= 0.5*angleOfWedge/constant::math::pi; + mInj *= 0.5*angleOfWedge/constant::mathematical::pi; } return mInj; @@ -374,7 +374,7 @@ void Foam::definedInjector::correctProfiles const scalar referencePressure ) { - scalar A = 0.25*constant::math::pi*sqr(d_); + scalar A = 0.25*constant::mathematical::pi*sqr(d_); scalar pDummy = 1.0e+5; scalar rho = fuel.rho(pDummy, T_, X_); diff --git a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C index 44f963f014ad7a9196a72992eb3940658b675fd8..9f8f595ea5663c082c568c71b05c5a69c0aa2399 100644 --- a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C +++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C @@ -27,7 +27,7 @@ License #include "multiHoleInjector.H" #include "addToRunTimeSelectionTable.H" #include "Random.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam @@ -165,9 +165,8 @@ Foam::multiHoleInjector::~multiHoleInjector() void Foam::multiHoleInjector::setTangentialVectors() { - scalar pi180 = constant::math::pi/180.0; - scalar alpha = xyAngle_*pi180; - scalar phi = zAngle_*pi180; + scalar alpha = degToRad(xyAngle_); + scalar phi = degToRad(zAngle_); vector xp(cos(alpha), sin(alpha), 0.0); vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi)); @@ -184,11 +183,11 @@ void Foam::multiHoleInjector::setTangentialVectors() // Info << "zp = " << zp << endl; scalar angle = 0.0; - scalar u = umbrellaAngle_*pi180/2.0; + scalar u = degToRad(umbrellaAngle_/2.0); for (label i=0; i<nHoles_; i++) { angle += angleSpacing_[i]; - scalar v = angle*pi180; + scalar v = degToRad(angle); direction_[i] = cos(v)*sin(u)*xp + sin(v)*sin(u)*yp + cos(u)*zp; vector dp = direction_[i] - (direction_[i] & zp)*direction_[i]; if (mag(dp) > SMALL) @@ -267,7 +266,7 @@ Foam::vector Foam::multiHoleInjector::position { // otherwise, disc injection scalar iRadius = d_*rndGen.scalar01(); - scalar iAngle = constant::math::twoPi*rndGen.scalar01(); + scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01(); return ( @@ -319,7 +318,7 @@ Foam::scalar Foam::multiHoleInjector::mass // correct mass if calculation is 2D if (twoD) { - mInj *= 0.5*angleOfWedge/constant::math::pi; + mInj *= 0.5*angleOfWedge/constant::mathematical::pi; } return mInj; @@ -429,7 +428,7 @@ void Foam::multiHoleInjector::correctProfiles const scalar referencePressure ) { - scalar A = nHoles_*0.25*constant::math::pi*sqr(d_); + scalar A = nHoles_*0.25*constant::mathematical::pi*sqr(d_); forAll(velocityProfile_, i) { diff --git a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C index 0ade2f8f0503cccc6c7bbcf8b80cc7343fd0f2a8..7d05a29a5c2526006631e75d5567f92e68ee3a2b 100644 --- a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C +++ b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C @@ -27,7 +27,7 @@ License #include "swirlInjector.H" #include "addToRunTimeSelectionTable.H" #include "Random.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -246,7 +246,7 @@ Foam::vector Foam::swirlInjector::position { // otherwise, disc injection scalar iRadius = d_*rndGen.scalar01(); - scalar iAngle = constant::math::twoPi*rndGen.scalar01(); + scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01(); return ( @@ -300,7 +300,7 @@ Foam::scalar Foam::swirlInjector::mass // correct mass if calculation is 2D if (twoD) { - mInj *= 0.5*angleOfWedge/constant::math::pi; + mInj *= 0.5*angleOfWedge/constant::mathematical::pi; } return mInj; @@ -415,7 +415,7 @@ void Foam::swirlInjector::correctProfiles const scalar referencePressure ) { - scalar A = 0.25*constant::math::pi*sqr(d_); + scalar A = 0.25*constant::mathematical::pi*sqr(d_); scalar pDummy = 1.0e+5; scalar rho = fuel.rho(pDummy, T_, X_); diff --git a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C index f6439faf1128547bd28aa4b75d8bfe3976368530..a3a1093eb624a12d152b7c6bee958ba5fe03ce2f 100644 --- a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C +++ b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C @@ -27,7 +27,7 @@ License #include "unitInjector.H" #include "addToRunTimeSelectionTable.H" #include "Random.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -220,7 +220,7 @@ Foam::vector Foam::unitInjector::position { // otherwise, disc injection scalar iRadius = d_*rndGen.scalar01(); - scalar iAngle = constant::math::twoPi*rndGen.scalar01(); + scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01(); return ( @@ -273,7 +273,7 @@ Foam::scalar Foam::unitInjector::mass // correct mass if calculation is 2D if (twoD) { - mInj *= 0.5*angleOfWedge/constant::math::pi; + mInj *= 0.5*angleOfWedge/constant::mathematical::pi; } return mInj; @@ -364,7 +364,7 @@ void Foam::unitInjector::correctProfiles const scalar referencePressure ) { - scalar A = 0.25*constant::math::pi*sqr(d_); + scalar A = 0.25*constant::mathematical::pi*sqr(d_); scalar pDummy = 1.0e+5; forAll(velocityProfile_, i) diff --git a/src/lagrangian/dieselSpray/parcel/parcelFunctions.C b/src/lagrangian/dieselSpray/parcel/parcelFunctions.C index 55647326442908c14c679cc298c1898bccab8cfd..a9ab22d3535b484432a500172658a99877e96f8a 100644 --- a/src/lagrangian/dieselSpray/parcel/parcelFunctions.C +++ b/src/lagrangian/dieselSpray/parcel/parcelFunctions.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "parcel.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -102,13 +102,13 @@ scalar parcel::Pr scalar parcel::N(const scalar rho) const { - return 6.0*m_/(rho*pow3(d_)*constant::math::pi); + return 6.0*m_/(rho*pow3(d_)*constant::mathematical::pi); } scalar parcel::Vd() const { - return pow3(d_)*constant::math::pi/6.0; + return pow3(d_)*constant::mathematical::pi/6.0; } diff --git a/src/lagrangian/dieselSpray/spray/spray.C b/src/lagrangian/dieselSpray/spray/spray.C index f576ba67d966f23163bc139e2e6d04fe36fb9d16..2f24587bb7373c951fc7c82bc978d36b8fc6fa5f 100644 --- a/src/lagrangian/dieselSpray/spray/spray.C +++ b/src/lagrangian/dieselSpray/spray/spray.C @@ -41,7 +41,7 @@ License #include "symmetryPolyPatch.H" #include "wedgePolyPatch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -290,17 +290,17 @@ Foam::spray::spray axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_); scalar arcCos = (v1 & v2)/mag(v1); - angleOfWedge_ = constant::math::pi - acos(arcCos); + angleOfWedge_ = constant::mathematical::pi - acos(arcCos); Info<< "Calculated angle of wedge is " - << angleOfWedge_*180/constant::math::pi << " deg." + << radToDeg(angleOfWedge_) << " deg." << endl; } else { if (symPlaneExist) { - angleOfWedge_ = constant::math::pi; + angleOfWedge_ = constant::mathematical::pi; Info<< "Constructing 180 deg three dimensional spray injection." << endl; } diff --git a/src/lagrangian/dieselSpray/spray/sprayFunctions.C b/src/lagrangian/dieselSpray/spray/sprayFunctions.C index 43b14b477816dde0b3fe2b3bbf07535e15b77d10..fb3e9541b15d0eb6f50acefa228ff1ecb2cee026 100644 --- a/src/lagrangian/dieselSpray/spray/sprayFunctions.C +++ b/src/lagrangian/dieselSpray/spray/sprayFunctions.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "spray.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -106,7 +106,7 @@ scalar spray::liquidMass() const if (twoD()) { - sum *= constant::math::twoPi/angleOfWedge(); + sum *= constant::mathematical::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -148,7 +148,7 @@ scalar spray::liquidEnthalpy() const if (twoD()) { - sum *= constant::math::twoPi/angleOfWedge(); + sum *= constant::mathematical::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -193,7 +193,7 @@ scalar spray::liquidTotalEnthalpy() const if (twoD()) { - sum *= constant::math::twoPi/angleOfWedge(); + sum *= constant::mathematical::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -218,7 +218,7 @@ scalar spray::liquidKineticEnergy() const if (twoD()) { - sum *= constant::math::twoPi/angleOfWedge(); + sum *= constant::mathematical::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C index 36bbbfce715d0622035f5e09b3849a1e12fe5d27..2478061ab1416b29378f6088a8039e5fb5261d9e 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C @@ -27,7 +27,7 @@ License #include "LISA.H" #include "addToRunTimeSelectionTable.H" #include "basicMultiComponentMixture.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "RosinRammler.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -155,7 +155,7 @@ void LISA::atomizeParcel scalar massFlow = it.massFlowRate(max(0.0,elapsedTime-time)); - scalar hSheet = massFlow/(constant::math::pi*d*rhoFuel*mag(p.U())); + scalar hSheet = massFlow/(constant::mathematical::pi*d*rhoFuel*mag(p.U())); p.d() = min(hSheet,p.d()); @@ -249,7 +249,7 @@ void LISA::atomizeParcel scalar kL = 1.0/(dL*sqrt(0.5 + 1.5*muFuel/sqrt(rhoFuel*sigma*dL))); - scalar dD = cbrt(3.0*constant::math::pi*sqr(dL)/kL); + scalar dD = cbrt(3.0*constant::mathematical::pi*sqr(dL)/kL); scalar lisaExp = 0.27; scalar ambientPressure = 1.0e+5; diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C index 371c44cb844673c658777b097756ff6c3adc768b..c98aa9513174790cdd2c3dc8fbf51ce8c85e2c13 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C @@ -27,7 +27,7 @@ License #include "blobsSheetAtomization.H" #include "addToRunTimeSelectionTable.H" #include "basicMultiComponentMixture.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "RosinRammler.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -127,7 +127,7 @@ void blobsSheetAtomization::atomizeParcel scalar lBU = B_*sqrt ( - rhoFuel*sigma*p.d()*cos(angle_*constant::math::pi/360.0) + rhoFuel*sigma*p.d()*cos(angle_*constant::mathematical::pi/360.0) /sqr(rhoAverage*U) ); diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C index bbb079469beb2e8cd31371dee4cf65d8a03b1d6f..db8438ca9af81471b1b92ebacfa34c2dfc9e0ca3 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C @@ -26,7 +26,7 @@ License #include "ETAB.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -128,7 +128,7 @@ void ETAB::breakupParcel scalar quad = -y2/a; if (quad < 0) { - phi = constant::math::twoPi - phit; + phi = constant::mathematical::twoPi - phit; } scalar tb = 0; @@ -139,11 +139,11 @@ void ETAB::breakupParcel if (theta < phi) { - if (constant::math::twoPi - theta >= phi) + if (constant::mathematical::twoPi - theta >= phi) { theta = -theta; } - theta += constant::math::twoPi; + theta += constant::mathematical::twoPi; } tb = (theta-phi)*romega; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C index 879a0e0c893d773c9a1db2681453a6f090e1bd10..8382251ad60d8d3237259a1a79281acc18536e32 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C @@ -26,7 +26,7 @@ License #include "SHF.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -196,7 +196,7 @@ void SHF::breakupParcel px = x - /(2.0*sqrt(constant::math::twoPi)*sigma_) + /(2.0*sqrt(constant::mathematical::twoPi)*sigma_) *exp(-0.5*sqr((x-mu_)/sigma_)); } while (y >= px); @@ -227,7 +227,7 @@ void SHF::breakupParcel px = x - /(2.0*sqrt(constant::math::twoPi)*sigma_) + /(2.0*sqrt(constant::mathematical::twoPi)*sigma_) *exp(-0.5*sqr((x-mu_)/sigma_)); } while (y >= px); diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C index e05b6d1bf1caa5d33d67fff1bef22d8da04522ad..b47bcc968b8674a2b2bbb27c1d649e6a1cec2118 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C @@ -26,7 +26,7 @@ License #include "TAB.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,7 +130,7 @@ void TAB::breakupParcel scalar quad = -y2/a; if (quad < 0) { - phi = constant::math::twoPi - phit; + phi = constant::mathematical::twoPi - phit; } scalar tb = 0; @@ -147,11 +147,11 @@ void TAB::breakupParcel if (theta < phi) { - if (constant::math::twoPi - theta >= phi) + if (constant::mathematical::twoPi - theta >= phi) { theta = -theta; } - theta += constant::math::twoPi; + theta += constant::mathematical::twoPi; } tb = (theta - phi)/omega; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C index 3443e3883ea42c81079faaf84b4d2dab872a97d4..6d9ab7cd8160d451d940de4a37767e0732329816 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C @@ -26,7 +26,7 @@ License #include "reitzKHRT.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -137,7 +137,7 @@ void reitzKHRT::breakupParcel scalar KRT = sqrt(helpVariable/(3.0*sigma + VSMALL)); // wavelength of the fastest growing RT frequency - scalar lambdaRT = constant::math::twoPi*cRT_/(KRT + VSMALL); + scalar lambdaRT = constant::mathematical::twoPi*cRT_/(KRT + VSMALL); // if lambdaRT < diameter, then RT waves are growing on the surface // and we start to keep track of how long they have been growing @@ -170,7 +170,7 @@ void reitzKHRT::breakupParcel // reduce the diameter according to the rate-equation p.d() = (fraction*dc + p.d())/(1.0 + fraction); - scalar ms = rhoLiquid*Np*pow3(dc)*constant::math::pi/6.0; + scalar ms = rhoLiquid*Np*pow3(dc)*constant::mathematical::pi/6.0; p.ms() += ms; // Total number of parcels for the whole injection event diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C index f1983375052067efd94ede19767754300da06b73..24f7565ea05257eba1dbeb1d91fe4272c92d82e5 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C @@ -26,7 +26,7 @@ License #include "ORourkeCollisionModel.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H index 67085739ecbbbe56f5bfc2808bd8b3df1526dc99..12a819a76ab172cd9343a7b3b1640b8e0ebf649b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H @@ -31,7 +31,7 @@ scalar nMin = pMin().N(rhoMin); scalar mdMin = mMin/nMin; -scalar nu0 = 0.25*constant::math::pi*sumD*sumD*magVRel*dt/vols_[cell1]; +scalar nu0 = 0.25*constant::mathematical::pi*sumD*sumD*magVRel*dt/vols_[cell1]; scalar nu = nMin*nu0; scalar collProb = exp(-nu); scalar xx = rndGen_.scalar01(); diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H index fdc520610252cdbd1f4401d7f61e3d21c820c939..b8cecf2f9bc29f86d67b60c50cbc75a8d45400ea 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H @@ -129,7 +129,7 @@ if (vAlign > 0) pMax().d() = pow ( - 6.0*newMaxMass/(rhoMax*constant::math::pi*nMax), + 6.0*newMaxMass/(rhoMax*constant::mathematical::pi*nMax), 1.0/3.0 ); diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C index bda1b361ccaac9e1ea0f828dbc87ab4d4de891ab..3d6be9b7929027427f1b42feb87910b6dbd35cac 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C @@ -26,7 +26,7 @@ License #include "trajectoryModel.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C index fbb7d3447252a7b8b901b8b43e6d6c5a8c44a60b..7ba41141ba35b3840a8a49aad639506e370db833 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C @@ -28,7 +28,7 @@ License #include "RutlandFlashBoil.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -229,7 +229,7 @@ scalar RutlandFlashBoil::boilingTime for (label k=0; k < Niter; k++) { - expSum += exp(sqr(-k*constant::math::pi*sqrt(F)/2.0)); + expSum += exp(sqr(-k*constant::mathematical::pi*sqrt(F)/2.0)); if (mag(expSum-expSumOld)/expSum < 1.0e-3) { break; @@ -257,7 +257,7 @@ scalar RutlandFlashBoil::boilingTime } scalar Gf = - 4.0*alfaS*dTLB*constant::math::pi*sqr(diameter/2.0)/heatOfVapour; + 4.0*alfaS*dTLB*constant::mathematical::pi*sqr(diameter/2.0)/heatOfVapour; // calculation of the heat transfer vapourization at superheated // conditions (temperature>tBoilingSurface) @@ -269,7 +269,7 @@ scalar RutlandFlashBoil::boilingTime mag((vapourFarEnthalpy-vapourSurfaceEnthalpy)/heatOfVapour); // 2.0? or 1.0? try 1! - scalar B = 1.0*constant::math::pi*kappa/cpGas*diameter*NusseltCorr; + scalar B = 1.0*constant::mathematical::pi*kappa/cpGas*diameter*NusseltCorr; scalar nPos = B*log(1.0 + A)/Gf + 1.0; scalar nNeg = (1.0/A)*(exp(Gf/B) - 1.0 - A) + 1.0; @@ -342,7 +342,7 @@ scalar RutlandFlashBoil::boilingTime } } - time = (constant::math::pi*pow3(diameter)/6.0)*liquidDensity/(G + Gf); + time = (constant::mathematical::pi*pow3(diameter)/6.0)*liquidDensity/(G + Gf); time = max(VSMALL, time); } diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C index faedf5d5f92d570626cd3492372ad0d8bba6bea9..5a48bc9fca537473609780e30b5fac2a1531bc52 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C @@ -26,7 +26,7 @@ License #include "Chomiak.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -118,11 +118,11 @@ vector ChomiakInjector::direction scalar angle = (d - dMax)*maxSprayAngle_[n] /(dMin - dMax) - *constant::math::pi/360.0; + *constant::mathematical::pi/360.0; scalar alpha = sin(angle); scalar dcorr = cos(angle); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -132,7 +132,7 @@ vector ChomiakInjector::direction scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/constant::math::pi; + beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/constant::mathematical::pi; beta += reduce*sm_.angleOfWedge(); normal = diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C index 80601db2d1cd73faa039551d7df004593c3c5f18..c78b872e2b1527eed51a9a15b6eb0863ae225610 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C @@ -26,7 +26,7 @@ License #include "blobsSwirlInjector.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -110,9 +110,7 @@ scalar blobsSwirlInjector::d0 scalar c = rndGen_.scalar01(); - angle_ = coneAngle_[n]/2.0 + c*coneInterval_[n]; - - angle_ *= constant::math::pi/180.0; + angle_ = degToRad(coneAngle_[n]/2.0 + c*coneInterval_[n]); scalar injectedMassFlow = it.massFlowRate(t); @@ -144,7 +142,7 @@ vector blobsSwirlInjector::direction { scalar alpha = sin(angle_); scalar dcorr = cos(angle_); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -155,7 +153,7 @@ vector blobsSwirlInjector::direction // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::mathematical::twoPi); beta += reduce*sm_.angleOfWedge(); normal = alpha @@ -240,7 +238,7 @@ void blobsSwirlInjector::calculateHX ( (A_[inj]*cTau_[inj]*muFuel*massFlow*(1.0 + x_)) /( - constant::math::pi + constant::mathematical::pi *injectorDiameter *rhoFuel *dPressure @@ -260,7 +258,7 @@ void blobsSwirlInjector::calculateHX ( (A_[inj]*cTau_[inj]*muFuel*massFlow*(1.0 + x_)) /( - constant::math::pi + constant::mathematical::pi *injectorDiameter *rhoFuel *dPressure diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C index 1b89c250bc26d3fdad6fd9bf626d2aa97400aec0..bc58618be6b4e4f4b242832af42ccaea4d95eaaa 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C @@ -26,7 +26,7 @@ License #include "constInjector.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -133,11 +133,11 @@ vector constInjector::direction v (alpha) */ - scalar angle = rndGen_.scalar01()*sprayAngle_[n]*constant::math::pi/360.0; + scalar angle = rndGen_.scalar01()*sprayAngle_[n]*constant::mathematical::pi/360.0; scalar alpha = sin(angle); scalar dcorr = cos(angle); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -147,7 +147,7 @@ vector constInjector::direction scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0 - 2.0*reduce)*0.5*sm_.angleOfWedge()/constant::math::pi; + beta *= (1.0 - 2.0*reduce)*0.5*sm_.angleOfWedge()/constant::mathematical::pi; beta += reduce*sm_.angleOfWedge(); normal = diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C index 78740f67daebb317404b8168fce8b7c2149005bf..bc5add5df31f8972658707242d00f158acd2d812 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C @@ -26,7 +26,7 @@ License #include "definedHollowCone.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -163,9 +163,9 @@ vector definedHollowConeInjector::direction // use random number to generate angle between inner/outer cone angles scalar angle = angleInner + rndGen_.scalar01()*(angleOuter - angleInner); - scalar alpha = sin(angle*constant::math::pi/360.0); - scalar dcorr = cos(angle*constant::math::pi/360.0); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar alpha = sin(angle*constant::mathematical::pi/360.0); + scalar dcorr = cos(angle*constant::mathematical::pi/360.0); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -176,7 +176,7 @@ vector definedHollowConeInjector::direction // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::mathematical::twoPi); beta += reduce*sm_.angleOfWedge(); normal = alpha diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C index 7257ae0a03304ad1c611a85bc6c9633305e40e55..0308dcb1327fbc99330ff016e7f7ad9d79702ea1 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C @@ -26,7 +26,7 @@ License #include "definedPressureSwirl.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -174,7 +174,7 @@ scalar definedPressureSwirlInjector::d0 // end modifications - angle_ *= constant::math::pi/360.0; + angle_ *= constant::mathematical::pi/360.0; scalar injectedMassFlow = it.massFlowRate(t); @@ -191,7 +191,7 @@ scalar definedPressureSwirlInjector::d0 u_ = v*cosAngle; - scalar A = injectedMassFlow/(constant::math::pi*rhoFuel*u_); + scalar A = injectedMassFlow/(constant::mathematical::pi*rhoFuel*u_); // Not using the authors definition for sheet thickness // modified by multiplying the sheet tickness for the cone angle cosinus. @@ -216,7 +216,7 @@ vector definedPressureSwirlInjector::direction { scalar alpha = sin(angle_); scalar dcorr = cos(angle_); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -227,7 +227,7 @@ vector definedPressureSwirlInjector::direction // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::mathematical::twoPi); beta += reduce*sm_.angleOfWedge(); normal = alpha @@ -296,7 +296,7 @@ scalar definedPressureSwirlInjector::kv scalar coneAngle = it.getTableValue(coneAngle_, t); - coneAngle *= constant::math::pi/360.0; + coneAngle *= constant::mathematical::pi/360.0; scalar cosAngle = cos(coneAngle); scalar Tav = it.integrateTable(it.T())/(it.teoi() - it.tsoi()); @@ -309,7 +309,7 @@ scalar definedPressureSwirlInjector::kv it.getTableValue(maxKv_, t), 4.0*massFlow *sqrt(rhoFuel/2.0/dPressure) - /(constant::math::pi*sqr(injectorDiameter)*rhoFuel*cosAngle) + /(constant::mathematical::pi*sqr(injectorDiameter)*rhoFuel*cosAngle) ); return min(1.0, kv); diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C index 3c89eaba4fae1831d6a46da90bde9ee081cae1d3..3d77b3aed39cf22ae2e4b98b30664cfffa3b6694 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C @@ -26,7 +26,7 @@ License #include "hollowCone.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,9 +130,9 @@ vector hollowConeInjector::direction { scalar angle = innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]); - scalar alpha = sin(angle*constant::math::pi/360.0); - scalar dcorr = cos(angle*constant::math::pi/360.0); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar alpha = sin(angle*constant::mathematical::pi/360.0); + scalar dcorr = cos(angle*constant::mathematical::pi/360.0); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -143,7 +143,7 @@ vector hollowConeInjector::direction // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::mathematical::twoPi); beta += reduce*sm_.angleOfWedge(); normal = alpha diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C index c5510ecc26a829e80a101287176c92ef3d3f9d22..04f5807fe550976174997d0df5ee5c91059a4d3b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C @@ -26,7 +26,7 @@ License #include "pressureSwirlInjector.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -107,7 +107,7 @@ scalar pressureSwirlInjector::d0 scalar c = rndGen_.scalar01(); angle_ = coneAngle_[n] + 2.0*coneInterval_[n]*(0.5 - c); - angle_ *= constant::math::pi/360.0; + angle_ *= constant::mathematical::pi/360.0; scalar injectedMassFlow = it.massFlowRate(t); @@ -122,7 +122,7 @@ scalar pressureSwirlInjector::d0 u_ = v*cosAngle; - scalar A = injectedMassFlow/(constant::math::pi*rhoFuel*u_); + scalar A = injectedMassFlow/(constant::mathematical::pi*rhoFuel*u_); return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0; } @@ -138,7 +138,7 @@ vector pressureSwirlInjector::direction { scalar alpha = sin(angle_); scalar dcorr = cos(angle_); - scalar beta = constant::math::twoPi*rndGen_.scalar01(); + scalar beta = constant::mathematical::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; @@ -149,7 +149,7 @@ vector pressureSwirlInjector::direction // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::mathematical::twoPi); beta += reduce*sm_.angleOfWedge(); normal = alpha @@ -217,7 +217,7 @@ scalar pressureSwirlInjector::kv scalar coneAngle = coneAngle_[inj]; - coneAngle *= constant::math::pi/360.0; + coneAngle *= constant::mathematical::pi/360.0; scalar cosAngle = cos(coneAngle); scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi()); @@ -230,7 +230,7 @@ scalar pressureSwirlInjector::kv maxKv_[inj], 4.0*massFlow *sqrt(rhoFuel/2.0/dPressure) - /(constant::math::pi*sqr(injectorDiameter)*rhoFuel*cosAngle) + /(constant::mathematical::pi*sqr(injectorDiameter)*rhoFuel*cosAngle) ); return min(1.0, kv); diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H index 1c58b87c247623989077ef6bf4897cfc609d1519..58a152acec3e84faa24a09540d722e0518079559 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H @@ -27,6 +27,7 @@ License #include "constants.H" using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -317,7 +318,7 @@ inline Foam::scalar Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed ) const { return - 2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(math::pi*mass)); + 2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(pi*mass)); } @@ -329,7 +330,7 @@ inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed ) const { return - 2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(math::pi*mass)); + 2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(pi*mass)); } diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H index 274d634b3f6d43f0046a582002dca68acb1b4a9e..506ead2510fcc69969f0ef45e97b5ba70949d0b1 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -103,7 +103,7 @@ template <class ParcelType> inline Foam::scalar Foam::DsmcParcel<ParcelType>::constantProperties::sigmaT() const { - return constant::math::pi*d_*d_; + return constant::mathematical::pi*d_*d_; } diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C index e445f7cde5b1dd52b2338078ad947692eadb9e07..277939617eaa70add40abcc905dc9d87f88dffb2 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C @@ -27,7 +27,7 @@ License #include "LarsenBorgnakkeVariableHardSphere.H" #include "constants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -159,7 +159,7 @@ Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79 scalar sigmaTPQ = - math::pi*dPQ*dPQ + pi*dPQ*dPQ *pow(2.0*physicoChemical::k.value()*Tref_/(mR*cR*cR), omegaPQ - 0.5) /exp(Foam::lgamma(2.5 - omegaPQ)); @@ -255,7 +255,7 @@ void Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::collide scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta); - scalar phi = math::twoPi*rndGen.scalar01(); + scalar phi = twoPi*rndGen.scalar01(); vector postCollisionRelU = cR diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C index 3174445ac6f02ad18650addf5bd7291b810c4a4e..7e4830896757934616a7c6b998e997e92dd0f053 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C @@ -27,7 +27,7 @@ License #include "VariableHardSphere.H" #include "constants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -93,7 +93,7 @@ Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79 scalar sigmaTPQ = - math::pi*dPQ*dPQ + pi*dPQ*dPQ *pow(2.0*physicoChemical::k.value()*Tref_/(mR*cR*cR), omegaPQ - 0.5) /exp(Foam::lgamma(2.5 - omegaPQ)); @@ -128,7 +128,7 @@ void Foam::VariableHardSphere<CloudType>::collide scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta); - scalar phi = math::twoPi*rndGen.scalar01(); + scalar phi = twoPi*rndGen.scalar01(); vector postCollisionRelU = cR diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C index e3cc0d0fd836c07162cfe1e1ae81737697b1dd66..03fc89d032ce48bdd93b61763c67cd7781e0a374 100644 --- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C @@ -27,7 +27,7 @@ License #include "FreeStream.H" #include "constants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -133,7 +133,7 @@ void Foam::FreeStream<CloudType>::inflow() Random& rndGen(cloud.rndGen()); - scalar sqrtPi = sqrt(math::pi); + scalar sqrtPi = sqrt(pi); label particlesInserted = 0; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H index 84ccbdec5e46da8947bfabaa52c4751f5b9c8279..f7b485f265025e130432a8e7496c5008ebc445c5 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -24,9 +24,9 @@ License \*---------------------------------------------------------------------------*/ -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -353,7 +353,7 @@ template <class ParcelType> inline Foam::scalar Foam::KinematicParcel<ParcelType>::volume(const scalar d) const { - return math::pi/6.0*pow3(d); + return pi/6.0*pow3(d); } @@ -383,7 +383,7 @@ template <class ParcelType> inline Foam::scalar Foam::KinematicParcel<ParcelType>::areaS(const scalar d) const { - return math::pi*d*d; + return pi*d*d; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index c035ecf2dcb74f8403cc78ffbe427ca3fe79cd59..5c3d3d06856b632567259732526b6344f5907513 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -25,9 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "ReactingMultiphaseParcel.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -497,7 +497,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc } else { - this->d_ = cbrt(mass1/this->rho_*6.0/math::pi); + this->d_ = cbrt(mass1/this->rho_*6.0/pi); } } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 0be19914dc783d079c4b807e13dad469d929a977..f5975720e460357323ad33bc6da09682f785c557 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -25,10 +25,10 @@ License \*---------------------------------------------------------------------------*/ #include "ReactingParcel.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "specie.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -393,7 +393,7 @@ void Foam::ReactingParcel<ParcelType>::calc } else { - this->d_ = cbrt(mass1/this->rho_*6.0/math::pi); + this->d_ = cbrt(mass1/this->rho_*6.0/pi); } } } diff --git a/src/lagrangian/intermediate/particleForces/particleForces.C b/src/lagrangian/intermediate/particleForces/particleForces.C index 5320566c84382e91f744263062c1e2c7b493dd3f..47c65f59d2e5322fc54b17101f105b96f39d0661 100644 --- a/src/lagrangian/intermediate/particleForces/particleForces.C +++ b/src/lagrangian/intermediate/particleForces/particleForces.C @@ -127,6 +127,7 @@ void Foam::particleForces::cacheFields(const bool store) if (gradUPtr_) { delete gradUPtr_; + gradUPtr_ = NULL; } } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C index 3689acf8f4783b985f7e77f8ef37adf591d3f99d..809e05081ebb8886789200dc82ece94aa34ea457 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C @@ -95,11 +95,13 @@ void Foam::DispersionRASModel<CloudType>::cacheFields(const bool store) if (ownK_ && kPtr_) { delete kPtr_; + kPtr_ = NULL; ownK_ = false; } if (ownEpsilon_ && epsilonPtr_) { delete epsilonPtr_; + epsilonPtr_ = NULL; ownEpsilon_ = false; } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C index 7877af745e61c6f51b427b1e9ae39963773414f3..58f0c9a4252e9a867ed77c2cd5a82932bb220c33 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C @@ -72,6 +72,7 @@ void Foam::GradientDispersionRAS<CloudType>::cacheFields(const bool store) if (gradkPtr_) { delete gradkPtr_; + gradkPtr_ = NULL; } } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index dd14fe9240fa41edaf2eb42338317f2da97b0685..b9cbf0f9210c0e056525974d62299b5031fac3bb 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -26,9 +26,9 @@ License #include "ConeInjection.H" #include "DataEntry.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -203,7 +203,7 @@ void Foam::ConeInjection<CloudType>::setProperties ) { // set particle velocity - const scalar deg2Rad = math::pi/180.0; + const scalar deg2Rad = pi/180.0; scalar t = time - this->SOI_; scalar ti = thetaInner_().value(t); @@ -213,7 +213,7 @@ void Foam::ConeInjection<CloudType>::setProperties coneAngle *= deg2Rad; scalar alpha = sin(coneAngle); scalar dcorr = cos(coneAngle); - scalar beta = math::twoPi*this->owner().rndGen().scalar01(); + scalar beta = twoPi*this->owner().rndGen().scalar01(); vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta)); vector dirVec = dcorr*direction_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C index e8eb092a39e15aa27b113b148672601c044a71a8..e59eba322e2c9e7fb50c8550542bef75c3c9d313 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C @@ -26,9 +26,9 @@ License #include "ConeInjectionMP.H" #include "DataEntry.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -249,7 +249,7 @@ void Foam::ConeInjectionMP<CloudType>::setProperties // set particle velocity const label i = parcelI%positions_.size(); - const scalar deg2Rad = math::pi/180.0; + const scalar deg2Rad = pi/180.0; scalar t = time - this->SOI_; scalar ti = thetaInner_().value(t); @@ -259,7 +259,7 @@ void Foam::ConeInjectionMP<CloudType>::setProperties coneAngle *= deg2Rad; scalar alpha = sin(coneAngle); scalar dcorr = cos(coneAngle); - scalar beta = math::twoPi*this->owner().rndGen().scalar01(); + scalar beta = twoPi*this->owner().rndGen().scalar01(); vector normal = alpha*(tanVec1_[i]*cos(beta) + tanVec2_[i]*sin(beta)); vector dirVec = dcorr*axes_[i]; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C index 7e8fc31e187a62a7346a92cc260134069c637ffa..a1353be80c46df3dbd593867192c42e1c17915b6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C @@ -26,9 +26,9 @@ License #include "FieldActivatedInjection.H" #include "volFields.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -130,7 +130,7 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection // Determine total volume of particles to inject this->volumeTotal_ = - nParcelsPerInjector_*sum(pow3(diameters_))*math::pi/6.0; + nParcelsPerInjector_*sum(pow3(diameters_))*pi/6.0; // Set/cache the injector cells forAll(positions_, i) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 7f5f3e6c478272edb9e15c7977bab497c933832a..7ba1e5ca78c674a4512f324400087b2fdaa63cdf 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -25,10 +25,10 @@ License \*---------------------------------------------------------------------------*/ #include "InjectionModel.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "meshTools.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -200,7 +200,7 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles nP = volume/volumeTotal_ *massTotal_/rho - /(parcels*math::pi/6.0*pow3(diameter)); + /(parcels*pi/6.0*pow3(diameter)); break; } case pbNumber: diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index 8ebf75af0b34c1ccc495a6817364ef10a043a8ac..ad829f39788c86207340f6fd44dbdcec16656aea 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -25,9 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "ManualInjection.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -108,7 +108,7 @@ Foam::ManualInjection<CloudType>::ManualInjection } // Determine volume of particles to inject - this->volumeTotal_ = sum(pow3(diameters_))*math::pi/6.0; + this->volumeTotal_ = sum(pow3(diameters_))*pi/6.0; } diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index 25898132890a8a090180b9d56dc996034df50df0..d763866a49ca60bcec630bf42a356009320bf166 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -26,9 +26,9 @@ License #include "LiquidEvaporation.H" #include "specie.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -150,7 +150,7 @@ void Foam::LiquidEvaporation<CloudType>::calculate scalarField Xc = calcXc(cellI); // droplet surface area - scalar A = math::pi*sqr(d); + scalar A = pi*sqr(d); // calculate mass transfer of each specie in liquid forAll(activeLiquids_, i) diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index d51e92f4533b579cc521b55b5b3516218ae6e917..f341267b846c696c5703118c70d57bd1916f8be5 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -26,9 +26,9 @@ License #include "moleculeCloud.H" #include "fvMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" -using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -606,11 +606,11 @@ void Foam::moleculeCloud::initialiseMolecules zoneDict.lookup("orientationAngles") ); - scalar phi(orientationAngles.x()*math::pi/180.0); + scalar phi(orientationAngles.x()*pi/180.0); - scalar theta(orientationAngles.y()*math::pi/180.0); + scalar theta(orientationAngles.y()*pi/180.0); - scalar psi(orientationAngles.z()*math::pi/180.0); + scalar psi(orientationAngles.z()*pi/180.0); const tensor R ( @@ -976,11 +976,11 @@ void Foam::moleculeCloud::createMolecule { pi = equipartitionAngularMomentum(temperature, cP); - scalar phi(rndGen_.scalar01()*math::twoPi); + scalar phi(rndGen_.scalar01()*twoPi); - scalar theta(rndGen_.scalar01()*math::twoPi); + scalar theta(rndGen_.scalar01()*twoPi); - scalar psi(rndGen_.scalar01()*math::twoPi); + scalar psi(rndGen_.scalar01()*twoPi); Q = tensor ( diff --git a/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C index b6f5886f67bd54892a35a6abbc9712cf2d06185f..3fe31364604bd8f9127c73bd34d862d75fd6fbeb 100644 --- a/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C +++ b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C @@ -25,13 +25,13 @@ License \*---------------------------------------------------------------------------*/ #include "electrostaticPotential.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::electrostaticPotential::electrostaticPotential() : - prefactor(1.0/(4.0*constant::math::pi*8.854187817e-12)) + prefactor(1.0/(4.0*constant::mathematical::pi*8.854187817e-12)) {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C index f66971bf8ed8b931474ffd9f30c44db25f68cbe0..856f58f033da0314b8363e2a636ca175dddf8a00 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "coulomb.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,7 @@ addToRunTimeSelectionTable ); scalar coulomb::oneOverFourPiEps0 = - 1.0/(4.0*constant::math::pi*8.854187817e-12); + 1.0/(4.0*constant::mathematical::pi*8.854187817e-12); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C index 5fbf371f6463e1921db0fc9283d02e4891b287a4..da39c0b49fda82cac41f972b5dcffd5d48c2f3b7 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "dampedCoulomb.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,7 @@ addToRunTimeSelectionTable ); scalar dampedCoulomb::oneOverFourPiEps0 = - 1.0/(4.0*constant::math::pi*8.854187817e-12); + 1.0/(4.0*constant::mathematical::pi*8.854187817e-12); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/mesh/Allwmake b/src/mesh/Allwmake new file mode 100755 index 0000000000000000000000000000000000000000..f967335db3b92e201cc3f17fbc5053023da017c1 --- /dev/null +++ b/src/mesh/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake libso autoMesh +wmake libso blockMesh + +# ----------------------------------------------------------------- end-of-file diff --git a/src/autoMesh/Make/files b/src/mesh/autoMesh/Make/files similarity index 100% rename from src/autoMesh/Make/files rename to src/mesh/autoMesh/Make/files diff --git a/src/autoMesh/Make/options b/src/mesh/autoMesh/Make/options similarity index 100% rename from src/autoMesh/Make/options rename to src/mesh/autoMesh/Make/options diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C similarity index 99% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index c9bc6c71697613f50e3e3690eed4e19b8b17d4ef..7799663505090f66e3bffef463a2f39a9ec9cf03 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -34,7 +34,7 @@ Description #include "removePoints.H" #include "pointFields.H" #include "motionSmoother.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "pointSet.H" #include "faceSet.H" #include "cellSet.H" @@ -2480,10 +2480,10 @@ void Foam::autoLayerDriver::mergePatchFacesUndo ) { scalar minCos = - Foam::cos(layerParams.featureAngle()*constant::math::pi/180.0); + Foam::cos(degToRad(layerParams.featureAngle())); scalar concaveCos = - Foam::cos(layerParams.concaveAngle()*constant::math::pi/180.0); + Foam::cos(degToRad(layerParams.concaveAngle())); Info<< nl << "Merging all faces of a cell" << nl @@ -2602,7 +2602,7 @@ void Foam::autoLayerDriver::addLayers ( pp, meshEdges, - layerParams.featureAngle()*constant::math::pi/180.0, + degToRad(layerParams.featureAngle()), patchDisp, patchNLayers, @@ -2688,7 +2688,7 @@ void Foam::autoLayerDriver::addLayers maxPatchNameLen = max(maxPatchNameLen, label(patchName.size())); } - Info<< nl + Info<< nl << setf(ios_base::left) << setw(maxPatchNameLen) << "patch" << setw(0) << " faces layers avg thickness[m]" << nl << setf(ios_base::left) << setw(maxPatchNameLen) << " " @@ -3289,7 +3289,7 @@ void Foam::autoLayerDriver::doLayers << "Doing initial balancing" << nl << "-----------------------" << nl << endl; - + scalarField cellWeights(mesh.nCells(), 1); forAll(numLayers, patchI) { @@ -3302,7 +3302,7 @@ void Foam::autoLayerDriver::doLayers } } } - + // Balance mesh (and meshRefinement). No restriction on face zones // and baffles. autoPtr<mapDistributePolyMesh> map = meshRefiner_.balance @@ -3313,7 +3313,7 @@ void Foam::autoLayerDriver::doLayers decomposer, distributor ); - + //{ // globalIndex globalCells(mesh.nCells()); // diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C similarity index 99% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 41fe3853142d559b3a1245c3c9cf21d59e1739e5..f799881e932c7c8e74e26cdd08a15fc2d0c9457d 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -681,8 +681,8 @@ void Foam::autoRefineDriver::mergePatchFaces meshRefiner_.mergePatchFaces ( - Foam::cos(45*constant::math::pi/180.0), - Foam::cos(45*constant::math::pi/180.0), + Foam::cos(degToRad(45.0)), + Foam::cos(degToRad(45.0)), meshRefiner_.meshedPatches() ); @@ -691,7 +691,7 @@ void Foam::autoRefineDriver::mergePatchFaces meshRefiner_.checkData(); } - meshRefiner_.mergeEdges(Foam::cos(45*constant::math::pi/180.0)); + meshRefiner_.mergeEdges(Foam::cos(degToRad(45.0))); if (debug) { diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C similarity index 96% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index ea57136c1d66f6e859c6336d103d771234f6ceb8..8a71825221cdeaeff2e5e8ce9d4a4498a4bd8793 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C @@ -26,7 +26,7 @@ License #include "layerParameters.H" #include "polyBoundaryMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "refinementSurfaces.H" #include "searchableSurfaces.H" #include "regExp.H" @@ -192,7 +192,7 @@ Foam::layerParameters::layerParameters ), layerTerminationCos_ ( - Foam::cos(0.5*featureAngle_*constant::math::pi/180.0) + Foam::cos(degToRad(0.5*featureAngle_)) ), maxThicknessToMedialRatio_ ( @@ -200,8 +200,7 @@ Foam::layerParameters::layerParameters ), minMedianAxisAngleCos_ ( - Foam::cos(readScalar(dict.lookup("minMedianAxisAngle"))) - *constant::math::pi/180.0 + Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle")))) ), nBufferCellsNoExtrude_ ( @@ -269,7 +268,7 @@ Foam::layerParameters::layerParameters ), layerTerminationCos_ ( - Foam::cos(0.5*featureAngle_*constant::math::pi/180.0) + Foam::cos(degToRad(0.5*featureAngle_)) ), maxThicknessToMedialRatio_ ( @@ -277,8 +276,7 @@ Foam::layerParameters::layerParameters ), minMedianAxisAngleCos_ ( - Foam::cos(readScalar(dict.lookup("minMedianAxisAngle"))) - *constant::math::pi/180.0 + Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle")))) ), nBufferCellsNoExtrude_ ( diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C similarity index 97% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C index 8c79ab9c6c4b30ab37e6e8ff134bf67f3cae2f46..bf1d6ec6c07e43e8b8372bad039cbfe362372928 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "refinementParameters.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "polyMesh.H" #include "globalIndex.H" @@ -65,7 +65,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict) } else { - curvature_ = Foam::cos(featAngle*constant::math::pi/180.0); + curvature_ = Foam::cos(degToRad(featAngle)); } } diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H similarity index 100% rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C similarity index 99% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 1064aa3682347095f87f4b2fa455cf3ac60fcb51..bd5729a1b38545a655df070b5a44cd88709379b5 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -1134,6 +1134,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance } } } + + + // If the faceZones are not synchronised the blockedFace + // might not be synchronised. If you are sure the faceZones + // are synchronised remove below check. + syncTools::syncFaceList + ( + mesh_, + blockedFace, + andEqOp<bool>(), // combine operator + false // separation + ); } reduce(nUnblocked, sumOp<label>()); diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H similarity index 100% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C similarity index 100% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C similarity index 100% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C similarity index 99% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C index 2f3f4e60cafb2f82684a9643faea59ed2bfc551b..f72dcc313116940793884b29acff53100d2d52aa 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -37,7 +37,7 @@ License #include "searchableSurfaces.H" #include "polyMeshGeometry.H" #include "IOmanip.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -247,7 +247,7 @@ Foam::Map<Foam::label> Foam::meshRefinement::findEdgeConnectedProblemCells nearestRegion[i] ); - scalar angle = perpendicularAngle[region]/180.0*constant::math::pi; + scalar angle = degToRad(perpendicularAngle[region]); if (angle >= 0) { diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C similarity index 100% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C similarity index 100% rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C similarity index 100% rename from src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C rename to src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H similarity index 100% rename from src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H rename to src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C similarity index 100% rename from src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C rename to src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H similarity index 100% rename from src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H rename to src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H diff --git a/src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C similarity index 100% rename from src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C diff --git a/src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H b/src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H similarity index 100% rename from src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C similarity index 100% rename from src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H similarity index 100% rename from src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C similarity index 100% rename from src/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C diff --git a/src/mesh/blockMesh/Make/files b/src/mesh/blockMesh/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..cc7a1c1bb5fe8b9db96e92037ca0dced0fe89b86 --- /dev/null +++ b/src/mesh/blockMesh/Make/files @@ -0,0 +1,24 @@ +curvedEdges/curvedEdge.C +curvedEdges/lineEdge.C +curvedEdges/polyLine.C +curvedEdges/polyLineEdge.C +curvedEdges/arcEdge.C +curvedEdges/spline.C +curvedEdges/BSpline.C +curvedEdges/simpleSplineEdge.C +curvedEdges/polySplineEdge.C +curvedEdges/lineDivide.C + +blockDescriptor/blockDescriptor.C +blockDescriptor/blockDescriptorEdges.C + +block/block.C +block/blockCreate.C + +blockMesh/blockMesh.C +blockMesh/blockMeshCreate.C +blockMesh/blockMeshTopology.C +blockMesh/blockMeshCheck.C +blockMesh/blockMeshMerge.C + +LIB = $(FOAM_LIBBIN)/libblockMesh diff --git a/src/mesh/blockMesh/Make/options b/src/mesh/blockMesh/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..1618ab57ec2d869d439de31fd8ead10e6f2b8ae2 --- /dev/null +++ b/src/mesh/blockMesh/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude + +LIB_LIBS = \ + -lmeshTools \ + -ldynamicMesh diff --git a/applications/utilities/mesh/generation/blockMesh/block.C b/src/mesh/blockMesh/block/block.C similarity index 57% rename from applications/utilities/mesh/generation/blockMesh/block.C rename to src/mesh/blockMesh/block/block.C index 4ec1e67434e8074dd979cd7a65bd2f08bf3f584d..094b592bd5ec122ee7a4ead725d356e43952d5e4 100644 --- a/applications/utilities/mesh/generation/blockMesh/block.C +++ b/src/mesh/blockMesh/block/block.C @@ -22,93 +22,87 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "error.H" #include "block.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -label block::vtxLabel(label a, label b, label c) -{ - return (a + b*(blockDef_.n().x() + 1) - + c*(blockDef_.n().x() + 1)*(blockDef_.n().y() + 1)); -} +Foam::block::block +( + const pointField& blockPointField, + const curvedEdgeList& edges, + Istream& is +) +: + blockDescriptor(blockPointField, edges, is), + vertices_(0), + cells_(0), + boundaryPatches_(0) +{} -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from description -block::block(const blockDescriptor& definition) +Foam::block::block(const blockDescriptor& blockDesc) : - blockDef_(definition), - vertices_ - ( - ((blockDef_.n().x() + 1)*(blockDef_.n().y() + 1)*(blockDef_.n().z() + 1)) - ), - cells_ - ( - (blockDef_.n().x()*blockDef_.n().y()*blockDef_.n().z()) - ), - boundaryPatches_(6) -{ - // create points - blockPoints(); + blockDescriptor(blockDesc), + vertices_(0), + cells_(0), + boundaryPatches_(0) +{} - // generate internal cells - blockCells(); - // generate boundary patches - blockBoundary(); -} +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +Foam::block::~block() +{} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const blockDescriptor& block::blockDef() const +const Foam::pointField& Foam::block::points() const { - return blockDef_; -} + if (vertices_.empty()) + { + createPoints(); + } -const pointField& block::points() const -{ return vertices_; } -const labelListList& block::cells() const + +const Foam::labelListList& Foam::block::cells() const { + if (cells_.empty()) + { + createCells(); + } + return cells_; } -const labelListListList& block::boundaryPatches() const + +const Foam::labelListListList& Foam::block::boundaryPatches() const { + if (boundaryPatches_.empty()) + { + createBoundary(); + } + return boundaryPatches_; } // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Ostream& operator<<(Ostream& os, const block& b) +Foam::Ostream& Foam::operator<<(Ostream& os, const block& b) { - os << b.vertices_ << nl - << b.cells_ << nl - << b.boundaryPatches_ << endl; + os << b.points() << nl + << b.cells() << nl + << b.boundaryPatches() << endl; return os; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/blockMesh/block.H b/src/mesh/blockMesh/block/block.H similarity index 57% rename from applications/utilities/mesh/generation/blockMesh/block.H rename to src/mesh/blockMesh/block/block.H index bbec4f081147cd2c2f6573eadb38c1c442c1a234..7d3f908b5e75c70b16ab9ecd6902c9b65c3f8e39 100644 --- a/applications/utilities/mesh/generation/blockMesh/block.H +++ b/src/mesh/blockMesh/block/block.H @@ -26,11 +26,15 @@ Class Foam::block Description - creates a single block of cells from point coordinates, - numbers of cells in each direction and expansion ratio + Creates a single block of cells from point coordinates, numbers of + cells in each direction and an expansion ratio. + +Note + The vertices and cells for filling the block are demand-driven. SourceFiles block.C + blockCreate.C \*---------------------------------------------------------------------------*/ @@ -50,43 +54,63 @@ namespace Foam class Istream; class Ostream; +// Forward declaration of friend functions and operators +class block; +Ostream& operator<<(Ostream&, const block&); + /*---------------------------------------------------------------------------*\ Class block Declaration \*---------------------------------------------------------------------------*/ class block +: + public blockDescriptor { // Private data - //- block definition - blockDescriptor blockDef_; + //- List of vertices + mutable pointField vertices_; - //- list of vertices - pointField vertices_; + //- List of cells + mutable labelListList cells_; - //- list of cells - labelListList cells_; + //- Boundary patches + mutable labelListListList boundaryPatches_; - //- boundary patches - labelListListList boundaryPatches_; + // Private Member Functions - // private member functions + //- Vertex label offset for a particular i,j,k position + label vtxLabel(label i, label j, label k) const; - label vtxLabel(label i, label j, label k); + //- Creates vertices for cells filling the block + void createPoints() const; - void blockPoints(); + //- Creates cells for filling the block + void createCells() const; - void blockCells(); + //- Creates boundary patch faces for the block + void createBoundary() const; - void blockBoundary(); + //- Disallow default bitwise copy construct + block(const block&); + //- Disallow default bitwise assignment + void operator=(const block&); public: // Constructors - //- Construct from the block definition + //- Construct from components with Istream + block + ( + const pointField& blockPointField, + const curvedEdgeList&, + Istream& + ); + + //- Construct from a block definition block(const blockDescriptor&); //- Clone @@ -97,28 +121,41 @@ public: } + //- Destructor + + ~block(); + + // Member Functions // Access - const blockDescriptor& blockDef() const; + //- Return the block definition + inline const blockDescriptor& blockDef() const + { + return *this; + } + + //- Return the points for filling the block const pointField& points() const; + + //- Return the cells for filling the block const labelListList& cells() const; + + //- Return the boundary patch faces for the block const labelListListList& boundaryPatches() const; - // Ostream Operator + // Edit - friend Ostream& operator<<(Ostream&, const block&); -}; + //- Clear geometry (internal points, cells, boundaryPatches) + void clearGeom(); -inline Istream& operator>>(Istream& is, block*) -{ - notImplemented("Istream& operator>>(Istream& is, block*)"); - return is; -} + // Ostream Operator + friend Ostream& operator<<(Ostream&, const block&); +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/block/blockCreate.C b/src/mesh/blockMesh/block/blockCreate.C new file mode 100644 index 0000000000000000000000000000000000000000..3f741fd587d7da95db74385bc9f2090b815fb720 --- /dev/null +++ b/src/mesh/blockMesh/block/blockCreate.C @@ -0,0 +1,478 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "error.H" +#include "block.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::label Foam::block::vtxLabel(label i, label j, label k) const +{ + return + ( + i + + j * (meshDensity().x() + 1) + + k * (meshDensity().x() + 1) * (meshDensity().y() + 1) + ); +} + + +void Foam::block::createPoints() const +{ + // set local variables for mesh specification + const label ni = meshDensity().x(); + const label nj = meshDensity().y(); + const label nk = meshDensity().z(); + + const point& p000 = blockPoint(0); + const point& p100 = blockPoint(1); + const point& p110 = blockPoint(2); + const point& p010 = blockPoint(3); + + const point& p001 = blockPoint(4); + const point& p101 = blockPoint(5); + const point& p111 = blockPoint(6); + const point& p011 = blockPoint(7); + + + // list of edge point and weighting factors + const List< List<point> >& p = blockEdgePoints(); + const scalarListList& w = blockEdgeWeights(); + + // + // generate vertices + // + vertices_.clear(); + vertices_.setSize(nPoints()); + + for (label k = 0; k <= nk; k++) + { + for (label j = 0; j <= nj; j++) + { + for (label i = 0; i <= ni; i++) + { + const label vertexNo = vtxLabel(i, j, k); + + // points on edges + vector edgex1 = p000 + (p100 - p000)*w[0][i]; + vector edgex2 = p010 + (p110 - p010)*w[1][i]; + vector edgex3 = p011 + (p111 - p011)*w[2][i]; + vector edgex4 = p001 + (p101 - p001)*w[3][i]; + + vector edgey1 = p000 + (p010 - p000)*w[4][j]; + vector edgey2 = p100 + (p110 - p100)*w[5][j]; + vector edgey3 = p101 + (p111 - p101)*w[6][j]; + vector edgey4 = p001 + (p011 - p001)*w[7][j]; + + vector edgez1 = p000 + (p001 - p000)*w[8][k]; + vector edgez2 = p100 + (p101 - p100)*w[9][k]; + vector edgez3 = p110 + (p111 - p110)*w[10][k]; + vector edgez4 = p010 + (p011 - p010)*w[11][k]; + + + // calculate the importance factors for all edges + + // x-direction + scalar impx1 = + ( + (1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k]) + + w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k]) + ); + + scalar impx2 = + ( + (1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k]) + + w[1][i]*w[5][j]*(1.0 - w[10][k]) + ); + + scalar impx3 = + ( + (1.0 - w[2][i])*w[7][j]*w[11][k] + + w[2][i]*w[6][j]*w[10][k] + ); + + scalar impx4 = + ( + (1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k] + + w[3][i]*(1.0 - w[6][j])*w[9][k] + ); + + scalar magImpx = impx1 + impx2 + impx3 + impx4; + impx1 /= magImpx; + impx2 /= magImpx; + impx3 /= magImpx; + impx4 /= magImpx; + + + // y-direction + scalar impy1 = + ( + (1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k]) + + w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k]) + ); + + scalar impy2 = + ( + (1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k]) + + w[5][j]*w[1][i]*(1.0 - w[10][k]) + ); + + scalar impy3 = + ( + (1.0 - w[6][j])*w[3][i]*w[9][k] + + w[6][j]*w[2][i]*w[10][k] + ); + + scalar impy4 = + ( + (1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k] + + w[7][j]*(1.0 - w[2][i])*w[11][k] + ); + + scalar magImpy = impy1 + impy2 + impy3 + impy4; + impy1 /= magImpy; + impy2 /= magImpy; + impy3 /= magImpy; + impy4 /= magImpy; + + + // z-direction + scalar impz1 = + ( + (1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j]) + + w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j]) + ); + + scalar impz2 = + ( + (1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j]) + + w[9][k]*w[3][i]*(1.0 - w[6][j]) + ); + + scalar impz3 = + ( + (1.0 - w[10][k])*w[1][i]*w[5][j] + + w[10][k]*w[2][i]*w[6][j] + ); + + scalar impz4 = + ( + (1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j] + + w[11][k]*(1.0 - w[2][i])*w[7][j] + ); + + scalar magImpz = impz1 + impz2 + impz3 + impz4; + impz1 /= magImpz; + impz2 /= magImpz; + impz3 /= magImpz; + impz4 /= magImpz; + + + // calculate the correction vectors + vector corx1 = impx1*(p[0][i] - edgex1); + vector corx2 = impx2*(p[1][i] - edgex2); + vector corx3 = impx3*(p[2][i] - edgex3); + vector corx4 = impx4*(p[3][i] - edgex4); + + vector cory1 = impy1*(p[4][j] - edgey1); + vector cory2 = impy2*(p[5][j] - edgey2); + vector cory3 = impy3*(p[6][j] - edgey3); + vector cory4 = impy4*(p[7][j] - edgey4); + + vector corz1 = impz1*(p[8][k] - edgez1); + vector corz2 = impz2*(p[9][k] - edgez2); + vector corz3 = impz3*(p[10][k] - edgez3); + vector corz4 = impz4*(p[11][k] - edgez4); + + + // multiply by the importance factor + + // x-direction + edgex1 *= impx1; + edgex2 *= impx2; + edgex3 *= impx3; + edgex4 *= impx4; + + // y-direction + edgey1 *= impy1; + edgey2 *= impy2; + edgey3 *= impy3; + edgey4 *= impy4; + + // z-direction + edgez1 *= impz1; + edgez2 *= impz2; + edgez3 *= impz3; + edgez4 *= impz4; + + + // add the contributions + vertices_[vertexNo] = + ( + edgex1 + edgex2 + edgex3 + edgex4 + + edgey1 + edgey2 + edgey3 + edgey4 + + edgez1 + edgez2 + edgez3 + edgez4 + ) / 3.0; + + vertices_[vertexNo] += + ( + corx1 + corx2 + corx3 + corx4 + + cory1 + cory2 + cory3 + cory4 + + corz1 + corz2 + corz3 + corz4 + ); + } + } + } +} + + +void Foam::block::createCells() const +{ + const label ni = meshDensity().x(); + const label nj = meshDensity().y(); + const label nk = meshDensity().z(); + + // + // generate cells + // + cells_.clear(); + cells_.setSize(nCells()); + + label cellNo = 0; + + for (label k = 0; k < nk; k++) + { + for (label j = 0; j < nj; j++) + { + for (label i = 0; i < ni; i++) + { + cells_[cellNo].setSize(8); + + cells_[cellNo][0] = vtxLabel(i, j, k); + cells_[cellNo][1] = vtxLabel(i+1, j, k); + cells_[cellNo][2] = vtxLabel(i+1, j+1, k); + cells_[cellNo][3] = vtxLabel(i, j+1, k); + cells_[cellNo][4] = vtxLabel(i, j, k+1); + cells_[cellNo][5] = vtxLabel(i+1, j, k+1); + cells_[cellNo][6] = vtxLabel(i+1, j+1, k+1); + cells_[cellNo][7] = vtxLabel(i, j+1, k+1); + cellNo++; + } + } + } +} + + +void Foam::block::createBoundary() const +{ + const label ni = meshDensity().x(); + const label nj = meshDensity().y(); + const label nk = meshDensity().z(); + + // + // generate boundaries on each side of the hex + // + boundaryPatches_.clear(); + boundaryPatches_.setSize(6); + + + // x-direction + + label wallLabel = 0; + label wallCellLabel = 0; + + // x-min + boundaryPatches_[wallLabel].setSize(nj*nk); + for (label k = 0; k < nk; k++) + { + for (label j = 0; j < nj; j++) + { + boundaryPatches_[wallLabel][wallCellLabel].setSize(4); + + // set the points + boundaryPatches_[wallLabel][wallCellLabel][0] = + vtxLabel(0, j, k); + boundaryPatches_[wallLabel][wallCellLabel][1] = + vtxLabel(0, j, k + 1); + boundaryPatches_[wallLabel][wallCellLabel][2] = + vtxLabel(0, j + 1, k + 1); + boundaryPatches_[wallLabel][wallCellLabel][3] = + vtxLabel(0, j + 1, k); + + // update the counter + wallCellLabel++; + } + } + + // x-max + wallLabel++; + wallCellLabel = 0; + + boundaryPatches_[wallLabel].setSize(nj*nk); + + for (label k = 0; k < nk; k++) + { + for (label j = 0; j < nj; j++) + { + boundaryPatches_[wallLabel][wallCellLabel].setSize(4); + + // set the points + boundaryPatches_[wallLabel][wallCellLabel][0] = + vtxLabel(ni, j, k); + boundaryPatches_[wallLabel][wallCellLabel][1] = + vtxLabel(ni, j+1, k); + boundaryPatches_[wallLabel][wallCellLabel][2] = + vtxLabel(ni, j+1, k+1); + boundaryPatches_[wallLabel][wallCellLabel][3] = + vtxLabel(ni, j, k+1); + + // update the counter + wallCellLabel++; + } + } + + // y-direction + + // y-min + wallLabel++; + wallCellLabel = 0; + + boundaryPatches_[wallLabel].setSize(ni*nk); + for (label i = 0; i < ni; i++) + { + for (label k = 0; k < nk; k++) + { + boundaryPatches_[wallLabel][wallCellLabel].setSize(4); + + // set the points + boundaryPatches_[wallLabel][wallCellLabel][0] = + vtxLabel(i, 0, k); + boundaryPatches_[wallLabel][wallCellLabel][1] = + vtxLabel(i + 1, 0, k); + boundaryPatches_[wallLabel][wallCellLabel][2] = + vtxLabel(i + 1, 0, k + 1); + boundaryPatches_[wallLabel][wallCellLabel][3] = + vtxLabel(i, 0, k + 1); + + // update the counter + wallCellLabel++; + } + } + + // y-max + wallLabel++; + wallCellLabel = 0; + + boundaryPatches_[wallLabel].setSize(ni*nk); + + for (label i = 0; i < ni; i++) + { + for (label k = 0; k < nk; k++) + { + boundaryPatches_[wallLabel][wallCellLabel].setSize(4); + + // set the points + boundaryPatches_[wallLabel][wallCellLabel][0] = + vtxLabel(i, nj, k); + boundaryPatches_[wallLabel][wallCellLabel][1] = + vtxLabel(i, nj, k + 1); + boundaryPatches_[wallLabel][wallCellLabel][2] = + vtxLabel(i + 1, nj, k + 1); + boundaryPatches_[wallLabel][wallCellLabel][3] = + vtxLabel(i + 1, nj, k); + + // update the counter + wallCellLabel++; + } + } + + // z-direction + + // z-min + wallLabel++; + wallCellLabel = 0; + + boundaryPatches_[wallLabel].setSize(ni*nj); + + for (label i = 0; i < ni; i++) + { + for (label j = 0; j < nj; j++) + { + boundaryPatches_[wallLabel][wallCellLabel].setSize(4); + + // set the points + boundaryPatches_[wallLabel][wallCellLabel][0] = + vtxLabel(i, j, 0); + boundaryPatches_[wallLabel][wallCellLabel][1] = + vtxLabel(i, j + 1, 0); + boundaryPatches_[wallLabel][wallCellLabel][2] = + vtxLabel(i + 1, j + 1, 0); + boundaryPatches_[wallLabel][wallCellLabel][3] = + vtxLabel(i + 1, j, 0); + + // update the counter + wallCellLabel++; + } + } + + // z-max + wallLabel++; + wallCellLabel = 0; + + boundaryPatches_[wallLabel].setSize(ni*nj); + + for (label i = 0; i < ni; i++) + { + for (label j = 0; j < nj; j++) + { + boundaryPatches_[wallLabel][wallCellLabel].setSize(4); + + // set the points + boundaryPatches_[wallLabel][wallCellLabel][0] = + vtxLabel(i, j, nk); + boundaryPatches_[wallLabel][wallCellLabel][1] = + vtxLabel(i + 1, j, nk); + boundaryPatches_[wallLabel][wallCellLabel][2] = + vtxLabel(i + 1, j + 1, nk); + boundaryPatches_[wallLabel][wallCellLabel][3] = + vtxLabel(i, j + 1, nk); + + // update the counter + wallCellLabel++; + } + } +} + + +void Foam::block::clearGeom() +{ + vertices_.clear(); + cells_.clear(); + boundaryPatches_.clear(); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockList.H b/src/mesh/blockMesh/block/blockList.H similarity index 98% rename from applications/utilities/mesh/generation/blockMesh/blockList.H rename to src/mesh/blockMesh/block/blockList.H index 7e6a49a24a1bb9d575166161e4239b5d1b762b01..e17f16db800ac4856bd8ba0ac642c25dcfdef29e 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockList.H +++ b/src/mesh/blockMesh/block/blockList.H @@ -22,13 +22,11 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass +Typedef Foam::blockList Description - -SourceFiles - blockList.C + A PtrList of blocks \*---------------------------------------------------------------------------*/ diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C new file mode 100644 index 0000000000000000000000000000000000000000..599a108c3cbffaf4ef996f89b8afc20e8711e45f --- /dev/null +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C @@ -0,0 +1,318 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "error.H" +#include "blockDescriptor.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blockDescriptor::blockDescriptor +( + const cellShape& bshape, + const pointField& blockPointField, + const curvedEdgeList& edges, + const Vector<label>& meshDensity, + const UList<scalar>& expand, + const word& zoneName +) +: + blockPointField_(blockPointField), + curvedEdges_(edges), + blockShape_(bshape), + meshDensity_(meshDensity), + edgePoints_(12), + edgeWeights_(12), + expand_(expand), + zoneName_(zoneName) +{ + if (expand_.size() != 12) + { + FatalErrorIn + ( + "blockDescriptor::blockDescriptor" + "(const cellShape&, const pointField& blockPointField, " + "const curvedEdgeList&, const Vector<label>& meshDensity, " + "const scalarList& expand, const word& zoneName)" + ) << "Unknown definition of expansion ratios" + << exit(FatalError); + } + + // create a list of edges + makeBlockEdges(); +} + + +Foam::blockDescriptor::blockDescriptor +( + const pointField& blockPointField, + const curvedEdgeList& edges, + Istream& is +) +: + blockPointField_(blockPointField), + curvedEdges_(edges), + blockShape_(is), + meshDensity_(), + edgePoints_(12), + edgeWeights_(12), + expand_(12, 1.0), + zoneName_() +{ + // Examine next token + token t(is); + + // Optional zone name + if (t.isWord()) + { + zoneName_ = t.wordToken(); + + // Get the next token + is >> t; + } + is.putBack(t); + + if (t.isPunctuation()) + { + // new-style: read a list of 3 values + if (t.pToken() == token::BEGIN_LIST) + { + is >> meshDensity_; + } + else + { + FatalIOErrorIn + ( + "blockDescriptor::blockDescriptor" + "(const pointField&, const curvedEdgeList&, Istream&)", + is + ) << "incorrect token while reading n, expected '(', found " + << t.info() + << exit(FatalIOError); + } + } + else + { + // old-style: read three labels + is >> meshDensity_.x() + >> meshDensity_.y() + >> meshDensity_.z(); + } + + is >> t; + if (!t.isWord()) + { + is.putBack(t); + } + + scalarList expRatios(is); + + if (expRatios.size() == 3) + { + // x-direction + expand_[0] = expRatios[0]; + expand_[1] = expRatios[0]; + expand_[2] = expRatios[0]; + expand_[3] = expRatios[0]; + + // y-direction + expand_[4] = expRatios[1]; + expand_[5] = expRatios[1]; + expand_[6] = expRatios[1]; + expand_[7] = expRatios[1]; + + // z-direction + expand_[8] = expRatios[2]; + expand_[9] = expRatios[2]; + expand_[10] = expRatios[2]; + expand_[11] = expRatios[2]; + } + else if (expRatios.size() == 12) + { + expand_ = expRatios; + } + else + { + FatalErrorIn + ( + "blockDescriptor::blockDescriptor" + "(const pointField&, const curvedEdgeList&, Istream&)" + ) << "Unknown definition of expansion ratios: " << expRatios + << exit(FatalError); + } + + // create a list of edges + makeBlockEdges(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::blockDescriptor::~blockDescriptor() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::pointField& Foam::blockDescriptor::blockPointField() const +{ + return blockPointField_; +} + + +const Foam::cellShape& Foam::blockDescriptor::blockShape() const +{ + return blockShape_; +} + + +const Foam::List< Foam::List< Foam::point > >& +Foam::blockDescriptor::blockEdgePoints() const +{ + return edgePoints_; +} + + +const Foam::scalarListList& Foam::blockDescriptor::blockEdgeWeights() const +{ + return edgeWeights_; +} + + +const Foam::Vector<Foam::label>& Foam::blockDescriptor::meshDensity() const +{ + return meshDensity_; +} + + +const Foam::word& Foam::blockDescriptor::zoneName() const +{ + return zoneName_; +} + + +Foam::label Foam::blockDescriptor::nPoints() const +{ + return + ( + (meshDensity_.x() + 1) + * (meshDensity_.y() + 1) + * (meshDensity_.z() + 1) + ); +} + + +Foam::label Foam::blockDescriptor::nCells() const +{ + return + ( + meshDensity_.x() + * meshDensity_.y() + * meshDensity_.z() + ); +} + + +const Foam::point& Foam::blockDescriptor::blockPoint(const label i) const +{ + return blockPointField_[blockShape_[i]]; +} + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd) +{ + const cellShape& bshape = bd.blockShape(); + const labelList& blockLabels = bshape; + + os << bshape.model().name() << " ("; + + forAll(blockLabels, labelI) + { + if (labelI) + { + os << ' '; + } + os << blockLabels[labelI]; + } + os << ')'; + + if (bd.zoneName().size()) + { + os << ' ' << bd.zoneName(); + } + + os << ' ' << bd.meshDensity() + << " simpleGrading ("; + + + const scalarList& expand = bd.expand_; + + // can we use a compact notation? + if + ( + // x-direction + ( + expand[0] == expand[1] + && expand[0] == expand[2] + && expand[0] == expand[3] + ) + && // y-direction + ( + expand[4] == expand[5] + && expand[4] == expand[6] + && expand[4] == expand[7] + ) + && // z-direction + ( + expand[8] == expand[9] + && expand[8] == expand[10] + && expand[8] == expand[11] + ) + ) + { + os << expand[0] << ' ' << expand[4] << ' ' << expand[8]; + } + else + { + forAll(expand, edgeI) + { + if (edgeI) + { + os << ' '; + } + os << expand[edgeI]; + } + } + + + os << ")"; + + return os; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.H b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H similarity index 58% rename from applications/utilities/mesh/generation/blockMesh/blockDescriptor.H rename to src/mesh/blockMesh/blockDescriptor/blockDescriptor.H index df07052afb1f4f93909e20ee1d669cf847f09e0d..4c6b0f526d9838a321fd2b588f14ec4bce141c2f 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.H +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H @@ -26,22 +26,20 @@ Class Foam::blockDescriptor Description - block descriptor. Takes the description of the block and the list - of curved edges and creates a list of points on edges together - with the weighting factors + Takes the description of the block and the list of curved edges and + creates a list of points on edges together with the weighting factors SourceFiles blockDescriptor.C + blockDescriptorEdges.C \*---------------------------------------------------------------------------*/ #ifndef blockDescriptor_H #define blockDescriptor_H -#include "scalar.H" -#include "label.H" -#include "point.H" #include "cellShape.H" +#include "pointField.H" #include "scalarList.H" #include "curvedEdgeList.H" @@ -53,43 +51,56 @@ namespace Foam class Istream; class Ostream; +// Forward declaration of friend functions and operators +class blockMesh; +class blockDescriptor; +Ostream& operator<<(Ostream&, const blockDescriptor&); + /*---------------------------------------------------------------------------*\ - Class blockDescriptor Declaration + Class blockDescriptor Declaration \*---------------------------------------------------------------------------*/ class blockDescriptor { // Private data - //- Block mesh points - const pointField& blockMeshPoints_; + //- Reference to point field defining the block mesh + const pointField& blockPointField_; + + //- Reference to a list of curved edges + const curvedEdgeList& curvedEdges_; - //- block shape + //- Block shape cellShape blockShape_; - // reference to a list of curved edges - const curvedEdgeList& curvedEdges_; + //- The number of cells in the i,j,k directions + Vector<label> meshDensity_; - // block edge points - List<List<point> > edgePoints_; + //- Block edge points + List< List<point> > edgePoints_; - //- block edge weighting factors + //- Block edge weighting factors scalarListList edgeWeights_; - //- number of point in each direction - Vector<label> n_; - - //- expansion ratios in all directions + //- Expansion ratios in all directions scalarList expand_; - //- name of the zone (empty string if none) + //- Name of the zone (empty string if none) word zoneName_; - // Private member functions + // Private Member Functions + //- Set the points/weights for all edges void makeBlockEdges(); - void setEdge(label edge, label start, label end, label dim); + //- Set the edge points/weights + void setEdge(label edgeI, label start, label end, label dim); + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const blockDescriptor&); public: @@ -100,19 +111,19 @@ public: blockDescriptor ( const cellShape&, - const pointField& blockMeshPoints, - const curvedEdgeList& edges, - const Vector<label>& n, - const scalarList& expand, + const pointField& blockPointField, + const curvedEdgeList&, + const Vector<label>& meshDensity, + const UList<scalar>& expand, const word& zoneName = "" ); //- Construct from Istream blockDescriptor ( - const pointField& blockMeshPoints, - const curvedEdgeList& edges, - Istream& is + const pointField& blockPointField, + const curvedEdgeList&, + Istream& ); //- Clone @@ -123,25 +134,42 @@ public: } + // Destructor + + ~blockDescriptor(); + + // Member Functions // Access - const pointField& points() const; + //- Reference to point field defining the block mesh + const pointField& blockPointField() const; + //- Return the block shape const cellShape& blockShape() const; - const List<List<point> >& blockEdgePoints() const; + //- Return the block points along each edge + const List< List<point> >& blockEdgePoints() const; + //- Return the weightings along each edge const scalarListList& blockEdgeWeights() const; - const Vector<label>& n() const; + //- Return the mesh density (number of cells) in the i,j,k directions + const Vector<label>& meshDensity() const; + //- Return the (optional) zone name const word& zoneName() const; - // Member Operators - void operator=(const blockDescriptor&); + //- Return the number of points + label nPoints() const; + + //- Return the number of cells + label nCells() const; + + //- Return block point at local label i + const point& blockPoint(const label i) const; // IOstream Operators @@ -150,13 +178,6 @@ public: }; -inline Istream& operator>>(Istream& is, blockDescriptor*) -{ - notImplemented("Istream& operator>>(Istream& is, blockDescriptor*)"); - return is; -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/applications/utilities/mesh/generation/blockMesh/setEdge.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C similarity index 52% rename from applications/utilities/mesh/generation/blockMesh/setEdge.C rename to src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C index bb8bd8c30506638466caf0c83369ffb25062b0a2..5fcf31f4218935aa34f52339ddc21214022f737b 100644 --- a/applications/utilities/mesh/generation/blockMesh/setEdge.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C @@ -22,16 +22,11 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - from the list of curved edges creates a list - of edges that are not curved. It is assumed - that all other edges are straight lines - \*---------------------------------------------------------------------------*/ #include "error.H" - #include "blockDescriptor.H" + #include "lineEdge.H" #include "lineDivide.H" @@ -39,68 +34,91 @@ Description namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -scalar calcGexp(const scalar expRatio, const label dim) -{ - if (dim == 1) + //! @cond fileScope + // Calculate the geometric expension factor from the expansion ratio + inline scalar calcGexp(const scalar expRatio, const label dim) { - return 0.0; + return dim > 1 ? pow(expRatio, 1.0/(dim - 1)) : 0.0; } - else - { - return pow(expRatio, 1.0/(dim - 1)); - } -} + //! @endcond fileScope + +} // End namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void blockDescriptor::setEdge(label edgeI, label start, label end, label dim) +void Foam::blockDescriptor::makeBlockEdges() { - // for all edges check the list of curved edges. If the edge is curved, - // add it to the list. If the edge is not found, create is as a line + const label ni = meshDensity_.x(); + const label nj = meshDensity_.y(); + const label nk = meshDensity_.z(); + + // these edges correspond to the "hex" cellModel + + // x-direction + setEdge(0, 0, 1, ni); + setEdge(1, 3, 2, ni); + setEdge(2, 7, 6, ni); + setEdge(3, 4, 5, ni); + + // y-direction + setEdge(4, 0, 3, nj); + setEdge(5, 1, 2, nj); + setEdge(6, 5, 6, nj); + setEdge(7, 4, 7, nj); + + // z-direction + setEdge(8, 0, 4, nk); + setEdge(9, 1, 5, nk); + setEdge(10, 2, 6, nk); + setEdge(11, 3, 7, nk); +} - bool found = false; +void Foam::blockDescriptor::setEdge +( + label edgeI, + label start, + label end, + label dim +) +{ // set reference to the list of labels defining the block const labelList& blockLabels = blockShape_; // set reference to global list of points - const pointField blockPoints = blockShape_.points(blockMeshPoints_); + const pointField blockPoints = blockShape_.points(blockPointField_); + + // Set the edge points/weights + // The edge is a straight-line if it is not in the list of curvedEdges - // x1 - found = false; + // calc geometric expension factor from the expansion ratio + const scalar gExp = calcGexp(expand_[edgeI], dim); - forAll (curvedEdges_, nCEI) + forAll(curvedEdges_, cedgeI) { - if (curvedEdges_[nCEI].compare(blockLabels[start], blockLabels[end])) - { - found = true; + const curvedEdge& cedge = curvedEdges_[cedgeI]; + + int cmp = cedge.compare(blockLabels[start], blockLabels[end]); - // check the orientation: - // if the starting point of the curve is the same as the starting - // point of the edge, do the parametrisation and pick up the points - if (blockLabels[start] == curvedEdges_[nCEI].start()) + if (cmp) + { + if (cmp > 0) { - // calculate the geometric expension factor out of the - // expansion ratio - scalar gExp = calcGexp(expand_[edgeI], dim); + // curve has the same orientation // divide the line - lineDivide divEdge(curvedEdges_[nCEI], dim, gExp); + lineDivide divEdge(cedge, dim, gExp); - edgePoints_[edgeI] = divEdge.points(); + edgePoints_[edgeI] = divEdge.points(); edgeWeights_[edgeI] = divEdge.lambdaDivisions(); } else { - // the curve has got the opposite orientation - scalar gExp = calcGexp(expand_[edgeI], dim); + // curve has the opposite orientation // divide the line - lineDivide divEdge(curvedEdges_[nCEI], dim, 1.0/(gExp+SMALL)); + lineDivide divEdge(cedge, dim, 1.0/(gExp+SMALL)); pointField p = divEdge.points(); scalarList d = divEdge.lambdaDivisions(); @@ -109,38 +127,32 @@ void blockDescriptor::setEdge(label edgeI, label start, label end, label dim) edgeWeights_[edgeI].setSize(d.size()); label pMax = p.size() - 1; - forAll (p, pI) + forAll(p, pI) { - edgePoints_[edgeI][pI] = p[pMax - pI]; + edgePoints_[edgeI][pI] = p[pMax - pI]; edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI]; } + } - break; + // found curved-edge: done + return; } } - if (!found) - { - // edge is a straight line - scalar gExp = calcGexp(expand_[edgeI], dim); - - // divide the line - lineDivide divEdge - ( - lineEdge(blockPoints, start, end), - dim, - gExp - ); - - edgePoints_[edgeI] = divEdge.points(); - edgeWeights_[edgeI] = divEdge.lambdaDivisions(); - } -} + // not found: divide the edge as a straight line -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + lineDivide divEdge + ( + lineEdge(blockPoints, start, end), + dim, + gExp + ); + + edgePoints_[edgeI] = divEdge.points(); + edgeWeights_[edgeI] = divEdge.lambdaDivisions(); +} -} // End namespace Foam // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/src/mesh/blockMesh/blockMesh/blockMesh.C similarity index 70% rename from applications/utilities/mesh/generation/blockMesh/blockMesh.C rename to src/mesh/blockMesh/blockMesh/blockMesh.C index 640971ada099b069f25467cf1bb6f97a199bd754..4d499ea943229e5660ab8798f71640345cba17bd 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/src/mesh/blockMesh/blockMesh/blockMesh.C @@ -22,29 +22,25 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Application - blockMesh - -Description - Mesh generator - \*---------------------------------------------------------------------------*/ #include "blockMesh.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +bool Foam::blockMesh::blockMesh::verboseOutput(false); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from IOdictionary -Foam::blockMesh::blockMesh(IOdictionary& meshDescription) +Foam::blockMesh::blockMesh(IOdictionary& dict) : - topologyPtr_(createTopology(meshDescription)), - blockOffsets_(createBlockOffsets()), - mergeList_(createMergeList()), - points_(createPoints(meshDescription)), - cells_(createCells()), - patches_(createPatches()) -{} + blockPointField_(dict.lookup("vertices")), + scaleFactor_(1.0), + topologyPtr_(createTopology(dict)) +{ + calcMergeInfo(); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -57,6 +53,18 @@ Foam::blockMesh::~blockMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::blockMesh::verbose(const bool on) +{ + verboseOutput = on; +} + + +const Foam::pointField& Foam::blockMesh::blockPointField() const +{ + return blockPointField_; +} + + const Foam::polyMesh& Foam::blockMesh::topology() const { if (!topologyPtr_) @@ -70,45 +78,54 @@ const Foam::polyMesh& Foam::blockMesh::topology() const } -Foam::wordList Foam::blockMesh::patchNames() const +const Foam::pointField& Foam::blockMesh::points() const { - const polyPatchList& patchTopologies = topology().boundaryMesh(); - wordList names(patchTopologies.size()); - - forAll (names, patchI) + if (points_.empty()) { - names[patchI] = patchTopologies[patchI].name(); + createPoints(); } - return names; + return points_; } -Foam::wordList Foam::blockMesh::patchTypes() const +const Foam::cellShapeList& Foam::blockMesh::cells() const { - const polyPatchList& patchTopologies = topology().boundaryMesh(); - wordList types(patchTopologies.size()); - - forAll (types, patchI) + if (cells_.empty()) { - types[patchI] = patchTopologies[patchI].type(); + createCells(); } - return types; + return cells_; } -Foam::wordList Foam::blockMesh::patchPhysicalTypes() const +const Foam::faceListList& Foam::blockMesh::patches() const { - const polyPatchList& patchTopologies = topology().boundaryMesh(); - wordList physicalTypes(patchTopologies.size()); - - forAll (physicalTypes, patchI) + if (patches_.empty()) { - physicalTypes[patchI] = patchTopologies[patchI].physicalType(); + createPatches(); } - return physicalTypes; + return patches_; +} + + +Foam::wordList Foam::blockMesh::patchNames() const +{ + return topology().boundaryMesh().names(); +} + + +Foam::wordList Foam::blockMesh::patchTypes() const +{ + return topology().boundaryMesh().types(); +} + + +Foam::wordList Foam::blockMesh::patchPhysicalTypes() const +{ + return topology().boundaryMesh().physicalTypes(); } @@ -118,7 +135,7 @@ Foam::label Foam::blockMesh::numZonedBlocks() const forAll(*this, blockI) { - if (operator[](blockI).blockDef().zoneName().size()) + if (operator[](blockI).zoneName().size()) { num++; } diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H similarity index 68% rename from applications/utilities/mesh/generation/blockMesh/blockMesh.H rename to src/mesh/blockMesh/blockMesh/blockMesh.H index e6b6998c5883d57458a093c5157bebecb81ce9ab..6e67506a798f7d157a01f2c6ed63355e80bc5325 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.H +++ b/src/mesh/blockMesh/blockMesh/blockMesh.H @@ -26,9 +26,17 @@ Class Foam::blockMesh Description + A multi-block mesh generator + +Note + The vertices, cells and patches for filling the blocks are demand-driven. SourceFiles blockMesh.C + blockMeshCheck.C + blockMeshCreate.C + blockMeshMerge.C + blockMeshTopology.C \*---------------------------------------------------------------------------*/ @@ -54,20 +62,36 @@ class blockMesh public blockList { // Private data + static bool verboseOutput; - label nPoints_; - label nCells_; + //- Point field defining the block mesh (corners) + pointField blockPointField_; + //- The list of curved edges curvedEdgeList edges_; + //- The scaling factor to convert to meters + scalar scaleFactor_; + + //- The blocks themselves (the topology) as a polyMesh polyMesh* topologyPtr_; + label nPoints_; + + //- The sum of all cells in each block + label nCells_; + + //- The point offset added to each block labelList blockOffsets_; + + //- The merge points information labelList mergeList_; - pointField points_; - cellShapeList cells_; - faceListList patches_; + mutable pointField points_; + + mutable cellShapeList cells_; + + mutable faceListList patches_; // Private Member Functions @@ -77,26 +101,26 @@ class blockMesh const label blockLabel, const pointField& points, const cellShape& blockShape - ); + ) const; bool patchLabelsOK ( const label patchLabel, const pointField& points, const faceList& patchShapes - ); + ) const; polyMesh* createTopology(IOdictionary&); - void checkBlockMesh(const polyMesh&); + void checkBlockMesh(const polyMesh&) const; - labelList createBlockOffsets(); - labelList createMergeList(); + //- Determine the merge info and the final number of cells/points + void calcMergeInfo(); - pointField createPoints(const dictionary&); - cellShapeList createCells(); + faceList createPatchFaces(const polyPatch& patchTopologyFaces) const; - faceList createPatchFaces(const polyPatch& patchTopologyFaces); - faceListList createPatches(); + void createPoints() const; + void createCells() const; + void createPatches() const; //- as copy (not implemented) blockMesh(const blockMesh&); @@ -119,6 +143,9 @@ public: // Access + //- Reference to point field defining the block mesh + const pointField& blockPointField() const; + const polyMesh& topology() const; const curvedEdgeList& edges() const @@ -126,20 +153,11 @@ public: return edges_; } - const pointField& points() const - { - return points_; - } + const pointField& points() const; - const cellShapeList& cells() const - { - return cells_; - } + const cellShapeList& cells() const; - const faceListList& patches() const - { - return patches_; - } + const faceListList& patches() const; wordList patchNames() const; @@ -151,6 +169,14 @@ public: label numZonedBlocks() const; + // Edit + + //- Clear geometry (internal points, cells, boundaryPatches) + void clearGeom(); + + //- Enable/disable verbose information about the progress + static void verbose(const bool on=true); + // Write //- Writes edges of blockMesh in OBJ format. diff --git a/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C similarity index 52% rename from applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C rename to src/mesh/blockMesh/blockMesh/blockMeshCheck.C index 3abb4a6c71fa83a68a620f52ac034baf16297447..228f41e43c86b3f521141b6aa0dc7d91f19e322c 100644 --- a/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "blockMesh.H" @@ -31,18 +29,21 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Check the blockMesh topology -void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) +void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const { - Info<< nl << "Check block mesh topology" << endl; + if (verboseOutput) + { + Info<< nl << "Check topology" << endl; + } - bool blockMeshOK = true; + bool ok = true; const pointField& points = bm.points(); const faceList& faces = bm.faces(); const cellList& cells = bm.cells(); const polyPatchList& patches = bm.boundaryMesh(); - label nBoundaryFaces=0; + label nBoundaryFaces = 0; forAll(cells, celli) { nBoundaryFaces += cells[celli].nFaces(); @@ -50,35 +51,34 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) nBoundaryFaces -= 2*bm.nInternalFaces(); - label nDefinedBoundaryFaces=0; + label nDefinedBoundaryFaces = 0; forAll(patches, patchi) { nDefinedBoundaryFaces += patches[patchi].size(); } - Info<< nl << tab << "Basic statistics" << endl; - - Info<< tab << tab << "Number of internal faces : " - << bm.nInternalFaces() << endl; - - Info<< tab << tab << "Number of boundary faces : " - << nBoundaryFaces << endl; - - Info<< tab << tab << "Number of defined boundary faces : " - << nDefinedBoundaryFaces << endl; - - Info<< tab << tab << "Number of undefined boundary faces : " - << nBoundaryFaces - nDefinedBoundaryFaces << endl; - - if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0) + if (verboseOutput) { - Info<< tab << tab << tab - << "(Warning : only leave undefined the front and back planes " - << "of 2D planar geometries!)" << endl; - } + Info<< nl << tab << "Basic statistics" << nl + << tab << tab << "Number of internal faces : " + << bm.nInternalFaces() << nl + << tab << tab << "Number of boundary faces : " + << nBoundaryFaces << nl + << tab << tab << "Number of defined boundary faces : " + << nDefinedBoundaryFaces << nl + << tab << tab << "Number of undefined boundary faces : " + << nBoundaryFaces - nDefinedBoundaryFaces << nl; + + if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0) + { + Info<< tab << tab << tab + << "(Warning : only leave undefined the front and back planes " + << "of 2D planar geometries!)" << endl; + } - Info<< nl << tab << "Checking patch -> block consistency" << endl; + Info<< tab << "Checking patch -> block consistency" << endl; + } forAll(patches, patchi) @@ -115,7 +115,7 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) << " points inwards" << endl; - blockMeshOK = false; + ok = false; } } } @@ -129,12 +129,17 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) << " (" << patches[patchi].name() << ")" << " does not match any block faces" << endl; - blockMeshOK = false; + ok = false; } } } - if (!blockMeshOK) + if (verboseOutput) + { + Info<< endl; + } + + if (!ok) { FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)") << "Block mesh topology incorrect, stopping mesh generation!" @@ -142,4 +147,91 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) } } + +bool Foam::blockMesh::blockLabelsOK +( + const label blockLabel, + const pointField& points, + const cellShape& blockShape +) const +{ + bool ok = true; + + forAll(blockShape, blockI) + { + if (blockShape[blockI] < 0) + { + ok = false; + + WarningIn + ( + "bool Foam::blockMesh::blockLabelsOK(...)" + ) << "out-of-range point label " << blockShape[blockI] + << " (min = 0" + << ") in block " << blockLabel << endl; + } + else if (blockShape[blockI] >= points.size()) + { + ok = false; + + WarningIn + ( + "bool Foam::blockMesh::blockLabelsOK(...)" + ) << "out-of-range point label " << blockShape[blockI] + << " (max = " << points.size() - 1 + << ") in block " << blockLabel << endl; + } + } + + return ok; +} + + +bool Foam::blockMesh::patchLabelsOK +( + const label patchLabel, + const pointField& points, + const faceList& patchFaces +) const +{ + bool ok = true; + + forAll(patchFaces, faceI) + { + const labelList& f = patchFaces[faceI]; + + forAll(f, fp) + { + if (f[fp] < 0) + { + ok = false; + + WarningIn + ( + "bool Foam::blockMesh::patchLabelsOK(...)" + ) << "out-of-range point label " << f[fp] + << " (min = 0" + << ") on patch " << patchLabel + << ", face " << faceI << endl; + } + else if (f[fp] >= points.size()) + { + ok = false; + + WarningIn + ( + "bool Foam::blockMesh::patchLabelsOK(...)" + ) << "out-of-range point label " << f[fp] + << " (max = " << points.size() - 1 + << ") on patch " << patchLabel + << ", face " << faceI << endl; + + } + } + } + + return ok; +} + + // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createPatches.C b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C similarity index 59% rename from applications/utilities/mesh/generation/blockMesh/createPatches.C rename to src/mesh/blockMesh/blockMesh/blockMeshCreate.C index 1a670c6578dd27d597b061a1956cc6176feda4db..c825469410b6353fe0c93f7daef8f75b1e28b948 100644 --- a/applications/utilities/mesh/generation/blockMesh/createPatches.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C @@ -22,34 +22,108 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - - \*---------------------------------------------------------------------------*/ +#include "error.H" #include "blockMesh.H" +#include "cellModeller.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::blockMesh::createPoints() const +{ + const blockList& blocks = *this; + + if (verboseOutput) + { + Info<< "Creating points with scale " << scaleFactor_ << endl; + } + + // + // generate points + // + points_.clear(); + points_.setSize(nPoints_); + + forAll(blocks, blockI) + { + const pointField& blockPoints = blocks[blockI].points(); + + forAll(blockPoints, blockPointI) + { + points_ + [ + mergeList_ + [ + blockOffsets_[blockI] + blockPointI + ] + ] = scaleFactor_ * blockPoints[blockPointI]; + } + } +} + + +void Foam::blockMesh::createCells() const +{ + const blockList& blocks = *this; + const cellModel& hex = *(cellModeller::lookup("hex")); + + if (verboseOutput) + { + Info<< "Creating cells" << endl; + } + + // + // generate cells + // + cells_.clear(); + cells_.setSize(nCells_); + + label cellLabel = 0; + + forAll(blocks, blockI) + { + const labelListList& blockCells = blocks[blockI].cells(); + + forAll(blockCells, blockCellI) + { + labelList cellPoints(blockCells[blockCellI].size()); + + forAll(cellPoints, cellPointI) + { + cellPoints[cellPointI] = + mergeList_ + [ + blockCells[blockCellI][cellPointI] + + blockOffsets_[blockI] + ]; + } + + // Construct collapsed cell and add to list + cells_[cellLabel] = cellShape(hex, cellPoints, true); + + cellLabel++; + } + } +} + + Foam::faceList Foam::blockMesh::createPatchFaces ( const polyPatch& patchTopologyFaces -) +) const { - blockMesh& blocks = *this; + const blockList& blocks = *this; labelList blockLabels = patchTopologyFaces.polyPatch::faceCells(); - label nFaces=0; + label nFaces = 0; forAll(patchTopologyFaces, patchTopologyFaceLabel) { - label blockLabel = blockLabels[patchTopologyFaceLabel]; + const label blockI = blockLabels[patchTopologyFaceLabel]; - faceList blockFaces - ( - blocks[blockLabel].blockDef().blockShape().faces() - ); + faceList blockFaces = blocks[blockI].blockShape().faces(); forAll(blockFaces, blockFaceLabel) { @@ -60,7 +134,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces ) { nFaces += - blocks[blockLabel].boundaryPatches()[blockFaceLabel].size(); + blocks[blockI].boundaryPatches()[blockFaceLabel].size(); } } } @@ -72,12 +146,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces forAll(patchTopologyFaces, patchTopologyFaceLabel) { - label blockLabel = blockLabels[patchTopologyFaceLabel]; + const label blockI = blockLabels[patchTopologyFaceLabel]; - faceList blockFaces - ( - blocks[blockLabel].blockDef().blockShape().faces() - ); + faceList blockFaces = blocks[blockI].blockShape().faces(); forAll(blockFaces, blockFaceLabel) { @@ -88,7 +159,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces ) { const labelListList& blockPatchFaces = - blocks[blockLabel].boundaryPatches()[blockFaceLabel]; + blocks[blockI].boundaryPatches()[blockFaceLabel]; forAll(blockPatchFaces, blockFaceLabel) { @@ -99,7 +170,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces mergeList_ [ blockPatchFaces[blockFaceLabel][0] - + blockOffsets_[blockLabel] + + blockOffsets_[blockI] ]; label nUnique = 1; @@ -115,7 +186,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces mergeList_ [ blockPatchFaces[blockFaceLabel][facePointLabel] - + blockOffsets_[blockLabel] + + blockOffsets_[blockI] ]; if (quadFace[nUnique] != quadFace[nUnique-1]) @@ -152,20 +223,38 @@ Foam::faceList Foam::blockMesh::createPatchFaces } -Foam::faceListList Foam::blockMesh::createPatches() +void Foam::blockMesh::createPatches() const { - Info<< "\nCreating patches\n"; + const polyPatchList& topoPatches = topology().boundaryMesh(); - const polyPatchList& patchTopologies = topology().boundaryMesh(); - faceListList patches(patchTopologies.size()); + if (verboseOutput) + { + Info<< "Creating patches" << endl; + } + + // + // generate points + // - forAll(patchTopologies, patchLabel) + patches_.clear(); + patches_.setSize(topoPatches.size()); + + forAll(topoPatches, patchI) { - patches[patchLabel] = - createPatchFaces(patchTopologies[patchLabel]); + patches_[patchI] = createPatchFaces(topoPatches[patchI]); } - return patches; +} + + +void Foam::blockMesh::clearGeom() +{ + blockList& blocks = *this; + + forAll(blocks, blockI) + { + blocks[blockI].clearGeom(); + } } // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createMergeList.C b/src/mesh/blockMesh/blockMesh/blockMeshMerge.C similarity index 85% rename from applications/utilities/mesh/generation/blockMesh/createMergeList.C rename to src/mesh/blockMesh/blockMesh/blockMeshMerge.C index b46317652dcd67df7216af89857591619bcd67b7..3c5ca4ca84fa0efce0a2515926bdaccbf4b19a4d 100644 --- a/applications/utilities/mesh/generation/blockMesh/createMergeList.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshMerge.C @@ -28,13 +28,38 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::labelList Foam::blockMesh::createMergeList() +void Foam::blockMesh::calcMergeInfo() { - Info<< nl << "Creating merge list" << flush; + const blockList& blocks = *this; - labelList MergeList(nPoints_, -1); + if (verboseOutput) + { + Info<< "Creating block offsets" << endl; + } + + blockOffsets_.setSize(blocks.size()); + + nPoints_ = 0; + nCells_ = 0; + + forAll(blocks, blockI) + { + blockOffsets_[blockI] = nPoints_; + + nPoints_ += blocks[blockI].nPoints(); + nCells_ += blocks[blockI].nCells(); + } + + + if (verboseOutput) + { + Info<< "Creating merge list " << flush; + } + + // set unused to -1 + mergeList_.setSize(nPoints_); + mergeList_ = -1; - blockMesh& blocks = *this; const pointField& blockPoints = topology().points(); const cellList& blockCells = topology().cells(); @@ -46,6 +71,7 @@ Foam::labelList Foam::blockMesh::createMergeList() const labelList& faceNeighbourBlocks = topology().faceNeighbour(); + forAll(blockFaces, blockFaceLabel) { label blockPlabel = faceOwnerBlocks[blockFaceLabel]; @@ -74,7 +100,7 @@ Foam::labelList Foam::blockMesh::createMergeList() if (!foundFace) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Cannot find merge face for block " << blockPlabel << exit(FatalError); }; @@ -130,17 +156,17 @@ Foam::labelList Foam::blockMesh::createMergeList() label minPP2 = min(PpointLabel, PpointLabel2); - if (MergeList[PpointLabel] != -1) + if (mergeList_[PpointLabel] != -1) { - minPP2 = min(minPP2, MergeList[PpointLabel]); + minPP2 = min(minPP2, mergeList_[PpointLabel]); } - if (MergeList[PpointLabel2] != -1) + if (mergeList_[PpointLabel2] != -1) { - minPP2 = min(minPP2, MergeList[PpointLabel2]); + minPP2 = min(minPP2, mergeList_[PpointLabel2]); } - MergeList[PpointLabel] = MergeList[PpointLabel2] + mergeList_[PpointLabel] = mergeList_[PpointLabel2] = minPP2; } else @@ -183,7 +209,7 @@ Foam::labelList Foam::blockMesh::createMergeList() if (!foundFace) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Cannot find merge face for block " << blockNlabel << exit(FatalError); }; @@ -193,7 +219,7 @@ Foam::labelList Foam::blockMesh::createMergeList() if (blockPfaceFaces.size() != blockNfaceFaces.size()) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Inconsistent number of faces between block pair " << blockPlabel << " and " << blockNlabel << exit(FatalError); @@ -251,17 +277,17 @@ Foam::labelList Foam::blockMesh::createMergeList() label minPN = min(PpointLabel, NpointLabel); - if (MergeList[PpointLabel] != -1) + if (mergeList_[PpointLabel] != -1) { - minPN = min(minPN, MergeList[PpointLabel]); + minPN = min(minPN, mergeList_[PpointLabel]); } - if (MergeList[NpointLabel] != -1) + if (mergeList_[NpointLabel] != -1) { - minPN = min(minPN, MergeList[NpointLabel]); + minPN = min(minPN, mergeList_[NpointLabel]); } - MergeList[PpointLabel] = MergeList[NpointLabel] + mergeList_[PpointLabel] = mergeList_[NpointLabel] = minPN; } } @@ -271,7 +297,7 @@ Foam::labelList Foam::blockMesh::createMergeList() { if (cp[blockPfaceFacePointLabel] == -1) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Inconsistent point locations between block pair " << blockPlabel << " and " << blockNlabel << nl << " probably due to inconsistent grading." @@ -327,6 +353,8 @@ Foam::labelList Foam::blockMesh::createMergeList() } } +// FIXME? - there seems to be some logic missing here + foundFace = false; label blockNfaceLabel; for @@ -347,6 +375,9 @@ Foam::labelList Foam::blockMesh::createMergeList() } } +// FIXME? - there seems to be some logic missing here + + const labelListList& blockPfaceFaces = blocks[blockPlabel].boundaryPatches()[blockPfaceLabel]; @@ -369,34 +400,41 @@ Foam::labelList Foam::blockMesh::createMergeList() if ( - MergeList[PpointLabel] - != MergeList[NpointLabel] + mergeList_[PpointLabel] + != mergeList_[NpointLabel] ) { changedPointMerge = true; - MergeList[PpointLabel] - = MergeList[NpointLabel] + mergeList_[PpointLabel] + = mergeList_[NpointLabel] = min ( - MergeList[PpointLabel], - MergeList[NpointLabel] + mergeList_[PpointLabel], + mergeList_[NpointLabel] ); } } } } - Info << "." << flush; + if (verboseOutput) + { + Info<< "." << flush; + } if (nPasses > 100) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Point merging failed after max number of passes." << abort(FatalError); } } while (changedPointMerge); - Info << endl; + + if (verboseOutput) + { + Info<< endl; + } forAll(blockInternalFaces, blockFaceLabel) { @@ -431,7 +469,7 @@ Foam::labelList Foam::blockMesh::createMergeList() if (!foundFace) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Cannot find merge face for block " << blockPlabel << exit(FatalError); }; @@ -458,7 +496,7 @@ Foam::labelList Foam::blockMesh::createMergeList() if (!foundFace) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Cannot find merge face for block " << blockNlabel << exit(FatalError); }; @@ -480,9 +518,9 @@ Foam::labelList Foam::blockMesh::createMergeList() blockPfaceFacePoints[blockPfaceFacePointLabel] + blockOffsets_[blockPlabel]; - if (MergeList[PpointLabel] == -1) + if (mergeList_[PpointLabel] == -1) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "Unable to merge point " << blockPfaceFacePointLabel << ' ' << blockPpoints[blockPfaceFacePointLabel] @@ -506,9 +544,9 @@ Foam::labelList Foam::blockMesh::createMergeList() blockNfaceFacePoints[blockNfaceFacePointLabel] + blockOffsets_[blockNlabel]; - if (MergeList[NpointLabel] == -1) + if (mergeList_[NpointLabel] == -1) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "unable to merge point " << blockNfaceFacePointLabel << ' ' << blockNpoints[blockNfaceFacePointLabel] @@ -527,33 +565,31 @@ Foam::labelList Foam::blockMesh::createMergeList() // given old point label label newPointLabel = 0; - forAll(MergeList, pointLabel) + forAll(mergeList_, pointLabel) { - if (MergeList[pointLabel] > pointLabel) + if (mergeList_[pointLabel] > pointLabel) { - FatalErrorIn("blockMesh::createMergeList()") + FatalErrorIn("blockMesh::calcMergeInfo()") << "ouch" << exit(FatalError); } if ( - (MergeList[pointLabel] == -1) - || MergeList[pointLabel] == pointLabel + mergeList_[pointLabel] == -1 + || mergeList_[pointLabel] == pointLabel ) { - MergeList[pointLabel] = newPointLabel; + mergeList_[pointLabel] = newPointLabel; newPointLabel++; } else { - MergeList[pointLabel] = MergeList[MergeList[pointLabel]]; + mergeList_[pointLabel] = mergeList_[mergeList_[pointLabel]]; } } nPoints_ = newPointLabel; - - return MergeList; } // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createTopology.C b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C similarity index 51% rename from applications/utilities/mesh/generation/blockMesh/createTopology.C rename to src/mesh/blockMesh/blockMesh/blockMeshTopology.C index 1593f08d343c89c1d037046b738a27b73d3ed6a8..97ad739d60af056510d09f83571f95a673cdd2f0 100644 --- a/applications/utilities/mesh/generation/blockMesh/createTopology.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C @@ -29,106 +29,14 @@ License #include "preservePatchTypes.H" #include "emptyPolyPatch.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool Foam::blockMesh::blockLabelsOK -( - const label blockLabel, - const pointField& points, - const cellShape& blockShape -) -{ - bool ok = true; - - forAll(blockShape, blockI) - { - if (blockShape[blockI] < 0) - { - ok = false; - - WarningIn - ( - "bool Foam::blockMesh::blockLabelsOK" - "(const label blockLabel, const pointField& points, " - "const cellShape& blockShape)" - ) << "block " << blockLabel - << " point label " << blockShape[blockI] - << " less than zero" << endl; - } - else if (blockShape[blockI] >= points.size()) - { - ok = false; - - WarningIn - ( - "bool Foam::blockMesh::blockLabelsOK" - "(const label blockLabel, const pointField& points, " - "const cellShape& blockShape)" - ) << "block " << blockLabel - << " point label " << blockShape[blockI] - << " larger than " << points.size() - 1 - << " the largest defined point label" << endl; - } - } - - return ok; -} - - -bool Foam::blockMesh::patchLabelsOK -( - const label patchLabel, - const pointField& points, - const faceList& patchFaces -) -{ - bool ok = true; - - forAll(patchFaces, faceI) - { - const labelList& f = patchFaces[faceI]; - - forAll(f, fp) - { - if (f[fp] < 0) - { - ok = false; - - WarningIn - ( - "bool Foam::blockMesh::patchLabelsOK(...)" - ) << "patch " << patchLabel - << " face " << faceI - << " point label " << f[fp] - << " less than zero" << endl; - } - else if (f[fp] >= points.size()) - { - ok = false; - - WarningIn - ( - "bool Foam::blockMesh::patchLabelsOK(...)" - ) << "patch " << patchLabel - << " face " << faceI - << " point label " << f[fp] - << " larger than " << points.size() - 1 - << " the largest defined point label" << endl; - } - } - } - - return ok; -} - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) +Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict) { bool topologyOK = true; - blockMesh& blocks = *this; + blockList& blocks = *this; word defaultPatchName = "defaultFaces"; word defaultPatchType = emptyPolyPatch::typeName; @@ -136,27 +44,35 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) // get names/types for the unassigned patch faces // this is a bit heavy handed (and ugly), but there is currently // no easy way to rename polyMesh patches subsequently - if (const dictionary* dictPtr = meshDescription.subDictPtr("defaultPatch")) + if (const dictionary* dictPtr = dict.subDictPtr("defaultPatch")) { dictPtr->readIfPresent("name", defaultPatchName); dictPtr->readIfPresent("type", defaultPatchType); } - Info<< nl << "Creating blockCorners" << endl; + // optional 'convertToMeters' or 'scale' scaling factor + if (!dict.readIfPresent("convertToMeters", scaleFactor_)) + { + dict.readIfPresent("scale", scaleFactor_); + } - // create blockCorners - pointField tmpBlockPoints(meshDescription.lookup("vertices")); - if (meshDescription.found("edges")) + // + // get the non-linear edges in mesh + // + if (dict.found("edges")) { - // read number of non-linear edges in mesh - Info<< nl << "Creating curved edges" << endl; + if (verboseOutput) + { + Info<< "Creating curved edges" << endl; + } - ITstream& edgesStream(meshDescription.lookup("edges")); + ITstream& is(dict.lookup("edges")); + // read number of edges in mesh label nEdges = 0; - token firstToken(edgesStream); + token firstToken(is); if (firstToken.isLabel()) { @@ -165,20 +81,20 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) } else { - edgesStream.putBack(firstToken); + is.putBack(firstToken); } // Read beginning of edges - edgesStream.readBegin("edges"); + is.readBegin("edges"); nEdges = 0; - token lastToken(edgesStream); + token lastToken(is); while ( - !( - lastToken.isPunctuation() - && lastToken.pToken() == token::END_LIST + !( + lastToken.isPunctuation() + && lastToken.pToken() == token::END_LIST ) ) { @@ -187,37 +103,44 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) edges_.setSize(nEdges + 1); } - edgesStream.putBack(lastToken); + is.putBack(lastToken); edges_.set ( nEdges, - curvedEdge::New(tmpBlockPoints, edgesStream) + curvedEdge::New(blockPointField_, is) ); nEdges++; - edgesStream >> lastToken; + is >> lastToken; } - edgesStream.putBack(lastToken); + is.putBack(lastToken); // Read end of edges - edgesStream.readEnd("edges"); + is.readEnd("edges"); } - else + else if (verboseOutput) { - Info<< nl << "There are no non-linear edges" << endl; + Info<< "No non-linear edges defined" << endl; } - Info<< nl << "Creating blocks" << endl; + // + // Create the blocks + // + if (verboseOutput) { - ITstream& blockDescriptorStream(meshDescription.lookup("blocks")); + Info<< "Creating topology blocks" << endl; + } + + { + ITstream& is(dict.lookup("blocks")); // read number of blocks in mesh label nBlocks = 0; - token firstToken(blockDescriptorStream); + token firstToken(is); if (firstToken.isLabel()) { @@ -226,20 +149,20 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) } else { - blockDescriptorStream.putBack(firstToken); + is.putBack(firstToken); } // Read beginning of blocks - blockDescriptorStream.readBegin("blocks"); + is.readBegin("blocks"); nBlocks = 0; - token lastToken(blockDescriptorStream); + token lastToken(is); while ( - !( - lastToken.isPunctuation() - && lastToken.pToken() == token::END_LIST + !( + lastToken.isPunctuation() + && lastToken.pToken() == token::END_LIST ) ) { @@ -248,53 +171,56 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) blocks.setSize(nBlocks + 1); } - blockDescriptorStream.putBack(lastToken); + is.putBack(lastToken); blocks.set ( nBlocks, new block ( - blockDescriptor - ( - tmpBlockPoints, - edges_, - blockDescriptorStream - ) + blockPointField_, + edges_, + is ) ); topologyOK = topologyOK && blockLabelsOK ( nBlocks, - tmpBlockPoints, - blocks[nBlocks].blockDef().blockShape() + blockPointField_, + blocks[nBlocks].blockShape() ); nBlocks++; - blockDescriptorStream >> lastToken; + is >> lastToken; } - blockDescriptorStream.putBack(lastToken); + is.putBack(lastToken); // Read end of blocks - blockDescriptorStream.readEnd("blocks"); + is.readEnd("blocks"); } - Info<< nl << "Creating patches" << endl; + // + // Create the patches + // + if (verboseOutput) + { + Info<< "Creating topology patches" << endl; + } faceListList tmpBlocksPatches; wordList patchNames; wordList patchTypes; { - ITstream& patchStream(meshDescription.lookup("patches")); + ITstream& is(dict.lookup("patches")); // read number of patches in mesh label nPatches = 0; - token firstToken(patchStream); + token firstToken(is); if (firstToken.isLabel()) { @@ -306,21 +232,21 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) } else { - patchStream.putBack(firstToken); + is.putBack(firstToken); } // Read beginning of blocks - patchStream.readBegin("patches"); + is.readBegin("patches"); nPatches = 0; - token lastToken(patchStream); + token lastToken(is); while ( !( - lastToken.isPunctuation() - && lastToken.pToken() == token::END_LIST - ) + lastToken.isPunctuation() + && lastToken.pToken() == token::END_LIST + ) ) { if (tmpBlocksPatches.size() <= nPatches) @@ -330,9 +256,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) patchTypes.setSize(nPatches + 1); } - patchStream.putBack(lastToken); + is.putBack(lastToken); - patchStream + is >> patchTypes[nPatches] >> patchNames[nPatches] >> tmpBlocksPatches[nPatches]; @@ -347,7 +273,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) ( "blockMesh::createTopology(IOdictionary&)" ) << "Duplicate patch " << patchNames[nPatches] - << " at line " << patchStream.lineNumber() + << " at line " << is.lineNumber() << ". Exiting !" << nl << exit(FatalError); } @@ -356,18 +282,18 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) topologyOK = topologyOK && patchLabelsOK ( nPatches, - tmpBlockPoints, + blockPointField_, tmpBlocksPatches[nPatches] ); nPatches++; - patchStream >> lastToken; + is >> lastToken; } - patchStream.putBack(lastToken); + is.putBack(lastToken); // Read end of blocks - patchStream.readEnd("patches"); + is.readEnd("patches"); } @@ -379,23 +305,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) } - Info<< nl << "Creating block mesh topology" << endl; + // + // Create the topology + // + if (verboseOutput) + { + Info<< "Creating topology mesh" << endl; + } - PtrList<cellShape> tmpBlockCells(blocks.size()); - forAll(blocks, blockLabel) + PtrList<cellShape> tmpBlockShapes(blocks.size()); + forAll(blocks, blockI) { - tmpBlockCells.set + tmpBlockShapes.set ( - blockLabel, - new cellShape(blocks[blockLabel].blockDef().blockShape()) + blockI, + new cellShape(blocks[blockI].blockShape()) ); - if (tmpBlockCells[blockLabel].mag(tmpBlockPoints) < 0.0) + if (tmpBlockShapes[blockI].mag(blockPointField_) < 0.0) { WarningIn ( "blockMesh::createTopology(IOdictionary&)" - ) << "negative volume block : " << blockLabel + ) << "negative volume block : " << blockI << ", probably defined inside-out" << endl; } } @@ -404,8 +336,8 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) preservePatchTypes ( - meshDescription.time(), - meshDescription.time().constant(), + dict.time(), + dict.time().constant(), polyMesh::meshSubDir, patchNames, patchTypes, @@ -414,19 +346,21 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) patchPhysicalTypes ); + + // construct the topology as its own mesh polyMesh* blockMeshPtr = new polyMesh ( IOobject ( "blockMesh", - meshDescription.time().constant(), - meshDescription.time(), + dict.time().constant(), + dict.time(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - xferMove(tmpBlockPoints), - tmpBlockCells, + xferCopy(blockPointField_), // copy these points, do NOT move + tmpBlockShapes, tmpBlocksPatches, patchNames, patchTypes, diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.C b/src/mesh/blockMesh/curvedEdges/BSpline.C similarity index 83% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.C rename to src/mesh/blockMesh/curvedEdges/BSpline.C index 2bb30daf0ea4f25728d461e6abcf65c55efbc06c..56e829eda523e433fa15861b86f67b647b70a828 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.C +++ b/src/mesh/blockMesh/curvedEdges/BSpline.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - BSpline : cubic spline going through all the knots - \*---------------------------------------------------------------------------*/ #include "error.H" @@ -34,10 +31,7 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -pointField BSpline::findKnots +Foam::pointField Foam::BSpline::findKnots ( const pointField& allknots, const vector& fstend, @@ -106,15 +100,13 @@ pointField BSpline::findKnots // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -BSpline::BSpline(const pointField& Knots) +Foam::BSpline::BSpline(const pointField& Knots) : spline(findKnots(Knots)) {} -// Construct from components -BSpline::BSpline +Foam::BSpline::BSpline ( const pointField& Knots, const vector& fstend, @@ -127,32 +119,23 @@ BSpline::BSpline // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Return the real position of a point on the curve given by -// the parameter 0 <= lambda <= 1 -vector BSpline::realPosition(scalar mu) +Foam::vector Foam::BSpline::realPosition(const scalar mu) const { return spline::position(mu); } -//- Return the position of a point on the curve given by -// the parameter 0 <= lambda <= 1 -vector BSpline::position(const scalar mu) const +Foam::vector Foam::BSpline::position(const scalar mu) const { return spline::position((1.0/(nKnots() - 1))*(1.0 + mu*(nKnots() - 3))); } -//- Return the length of the curve -scalar BSpline::length() const +Foam::scalar Foam::BSpline::length() const { notImplemented("BSpline::length() const"); return 1.0; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.H b/src/mesh/blockMesh/curvedEdges/BSpline.H similarity index 90% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.H rename to src/mesh/blockMesh/curvedEdges/BSpline.H index b04f4d18e7ee670adc5411fea0773e6eca722b73..d906e05aa477e33923782889d9c20e2af3477f08 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.H +++ b/src/mesh/blockMesh/curvedEdges/BSpline.H @@ -26,7 +26,7 @@ Class Foam::BSpline Description - BSpline : cubic spline going through all the knots + A cubic spline going through all the knots SourceFiles BSpline.C @@ -51,9 +51,7 @@ class BSpline : public spline { - // Private member functions - - scalar remap(const scalar&); + // Private Member Functions pointField findKnots ( @@ -62,6 +60,12 @@ class BSpline const vector& sndend = vector::zero ); + //- Disallow default bitwise copy construct + BSpline(const BSpline&); + + //- Disallow default bitwise assignment + void operator=(const BSpline&); + public: @@ -83,7 +87,7 @@ public: //- Return the real position of a point on the curve given by // the parameter 0 <= lambda <= 1 - vector realPosition(scalar lambda); + vector realPosition(const scalar lambda) const; //- Return the position of a point on the curve given by // the parameter 0 <= lambda <= 1 diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C b/src/mesh/blockMesh/curvedEdges/arcEdge.C similarity index 85% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C rename to src/mesh/blockMesh/curvedEdges/arcEdge.C index 2039ffb0bbfe18e67da5d6c9b7a6f69e809f07af..985caef831512f7aef6145b95a63849467c2a1df 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C +++ b/src/mesh/blockMesh/curvedEdges/arcEdge.C @@ -22,14 +22,10 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - arcEdge class : defines the arcEdge of a circle in terms of 3 points on its - circumference - \*---------------------------------------------------------------------------*/ #include "arcEdge.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -37,8 +33,6 @@ Description namespace Foam { defineTypeNameAndDebug(arcEdge, 0); - - // Add the curvedEdge constructor functions to the hash tables addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream); } @@ -78,18 +72,24 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle() // find angles scalar tmp = (r3&r1)/(mag(r3)*mag(r1)); - angle_ = acos(tmp)*180.0/constant::math::pi; + angle_ = radToDeg(acos(tmp)); // check if the vectors define an exterior or an interior arcEdge - if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) angle_ = 360 - angle_; + if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) + { + angle_ = 360.0 - angle_; + } - vector tempAxis(0.0,0.0,0.0); + vector tempAxis; if (angle_ <= 180.0) { tempAxis = r1 ^ r3; - if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001) tempAxis = r1 ^ r2; + if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001) + { + tempAxis = r1 ^ r2; + } } else { @@ -105,24 +105,22 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::arcEdge::arcEdge ( const pointField& points, const label start, const label end, - const vector& P2 + const vector& pMid ) : curvedEdge(points, start, end), p1_(points_[start_]), - p2_(P2), + p2_(pMid), p3_(points_[end_]), cs_(calcAngle()) {} -// Construct from Istream Foam::arcEdge::arcEdge(const pointField& points, Istream& is) : curvedEdge(points, is), @@ -159,13 +157,10 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const } -//- Return the length of the curve Foam::scalar Foam::arcEdge::length() const { - return angle_*radius_*constant::math::pi/180.0; + return degToRad(angle_*radius_); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.H b/src/mesh/blockMesh/curvedEdges/arcEdge.H similarity index 89% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.H rename to src/mesh/blockMesh/curvedEdges/arcEdge.H index 3f8a49301e69c719e4900b0cef7f8338ee668dca..da96d150fc0803f0b6fecb6c50d31b072ff17a35 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.H +++ b/src/mesh/blockMesh/curvedEdges/arcEdge.H @@ -26,8 +26,7 @@ Class Foam::arcEdge Description - arcEdge class : defines the arcEdge of a circle in terms of 3 points on its - circumference + Defines the arcEdge of a circle in terms of 3 points on its circumference SourceFiles arcEdge.C @@ -62,6 +61,14 @@ class arcEdge cylindricalCS calcAngle(); + // Private Member Functions + + //- Disallow default bitwise copy construct + arcEdge(const arcEdge&); + + //- Disallow default bitwise assignment + void operator=(const arcEdge&); + public: //- Runtime type information @@ -75,7 +82,7 @@ public: ( const pointField& points, const label start, const label end, - const vector& + const vector& pMid ); //- Construct from Istream setting pointsList diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C b/src/mesh/blockMesh/curvedEdges/curvedEdge.C similarity index 66% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C rename to src/mesh/blockMesh/curvedEdges/curvedEdge.C index 9329c33f6db948de38c13d8e548a334d8649f61e..4b80a221ddd16c78fead7a889344db6d4454b189 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C +++ b/src/mesh/blockMesh/curvedEdges/curvedEdge.C @@ -22,32 +22,24 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - library functions that will define a curvedEdge in space - parameterised for 0<lambda<1 from the beginning - point to the end point. - \*---------------------------------------------------------------------------*/ #include "error.H" - #include "curvedEdge.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(curvedEdge, 0); -defineRunTimeSelectionTable(curvedEdge, Istream); + defineTypeNameAndDebug(curvedEdge, 0); + defineRunTimeSelectionTable(curvedEdge, Istream); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -curvedEdge::curvedEdge +Foam::curvedEdge::curvedEdge ( const pointField& points, const label start, @@ -60,8 +52,7 @@ curvedEdge::curvedEdge {} -// Construct from Istream -curvedEdge::curvedEdge(const pointField& points, Istream& is) +Foam::curvedEdge::curvedEdge(const pointField& points, Istream& is) : points_(points), start_(readLabel(is)), @@ -69,8 +60,7 @@ curvedEdge::curvedEdge(const pointField& points, Istream& is) {} -// Copy construct -curvedEdge::curvedEdge(const curvedEdge& c) +Foam::curvedEdge::curvedEdge(const curvedEdge& c) : points_(c.points_), start_(c.start_), @@ -78,16 +68,18 @@ curvedEdge::curvedEdge(const curvedEdge& c) {} -//- Clone function -autoPtr<curvedEdge> curvedEdge::clone() const +Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::clone() const { notImplemented("curvedEdge::clone() const"); return autoPtr<curvedEdge>(NULL); } -//- New function which constructs and returns pointer to a curvedEdge -autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is) +Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New +( + const pointField& points, + Istream& is +) { if (debug) { @@ -96,16 +88,15 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is) << endl; } - word curvedEdgeType(is); + word edgeType(is); IstreamConstructorTable::iterator cstrIter = - IstreamConstructorTablePtr_ - ->find(curvedEdgeType); + IstreamConstructorTablePtr_->find(edgeType); if (cstrIter == IstreamConstructorTablePtr_->end()) { FatalErrorIn("curvedEdge::New(const pointField&, Istream&)") - << "Unknown curvedEdge type " << curvedEdgeType << endl << endl + << "Unknown curvedEdge type " << edgeType << endl << endl << "Valid curvedEdge types are" << endl << IstreamConstructorTablePtr_->sortedToc() << abort(FatalError); @@ -117,9 +108,7 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Return the complete knotList by adding the start and end points to the -// given list -pointField knotlist +Foam::pointField Foam::curvedEdge::knotlist ( const pointField& points, const label start, @@ -127,31 +116,31 @@ pointField knotlist const pointField& otherknots ) { - label listsize(otherknots.size() + 2); - pointField tmp(listsize); + pointField newPoints(otherknots.size() + 2); - tmp[0] = points[start]; + // start/end knots + newPoints[0] = points[start]; + newPoints[otherknots.size() + 1] = points[end]; - for (register label i=1; i<listsize-1; i++) + // intermediate knots + forAll(otherknots, knotI) { - tmp[i] = otherknots[i-1]; + newPoints[knotI+1] = otherknots[knotI]; } - tmp[listsize-1] = points[end]; - - return tmp; + return newPoints; } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void curvedEdge::operator=(const curvedEdge&) +void Foam::curvedEdge::operator=(const curvedEdge&) { notImplemented("void curvedEdge::operator=(const curvedEdge&)"); } -Ostream& operator<<(Ostream& os, const curvedEdge& p) +Foam::Ostream& Foam::operator<<(Ostream& os, const curvedEdge& p) { os << p.start_ << tab << p.end_ << endl; @@ -159,8 +148,4 @@ Ostream& operator<<(Ostream& os, const curvedEdge& p) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H b/src/mesh/blockMesh/curvedEdges/curvedEdge.H similarity index 71% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H rename to src/mesh/blockMesh/curvedEdges/curvedEdge.H index 5ecf489d38818e2030080246e02f1ca07f5cd919..49ad047e45a759603d41141e38ee6b010ccf9979 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H +++ b/src/mesh/blockMesh/curvedEdges/curvedEdge.H @@ -26,9 +26,8 @@ Class Foam::curvedEdge Description - curvedEdges : library functions that will define a curvedEdge in space - parameterised for 0<lambda<1 from the beginning point to the end point. - This file contains the abstract base class curvedEdge. + Define a curved edge in space that is parameterised for + 0<lambda<1 from the beginning to the end point. SourceFiles curvedEdge.C @@ -38,6 +37,7 @@ SourceFiles #ifndef curvedEdges_H #define curvedEdges_H +#include "edge.H" #include "pointField.H" #include "typeInfo.H" #include "HashTable.H" @@ -49,7 +49,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class curvedEdge Declaration + Class curvedEdge Declaration \*---------------------------------------------------------------------------*/ class curvedEdge @@ -59,14 +59,14 @@ protected: // Protected data const pointField& points_; - const label start_, end_; + const label start_; + const label end_; public: //- Runtime type information TypeName("curvedEdge"); - // Declare run-time constructor selection tables declareRunTimeSelectionTable @@ -113,26 +113,28 @@ public: // Member Functions //- Return label of start point - label start() const - { - return start_; - } + inline label start() const; //- Return label of end point - label end() const - { - return end_; - } - - //- Compare the given start and end points with those of this curve - bool compare(const label start, const label end) const - { - return - ( - (start_ == start && end_ == end) - || (start_ == end && end_ == start) - ); - } + inline label end() const; + + //- Compare the given start and end points with this curve + // - 0: different + // - +1: identical + // - -1: same edge, but different orientation + inline int compare(const curvedEdge&) const; + + //- Compare the given start and end points with this curve + // - 0: different + // - +1: identical + // - -1: same edge, but different orientation + inline int compare(const edge&) const; + + //- Compare the given start and end points with this curve + // - 0: different + // - +1: identical + // - -1: same edge, but different orientation + inline int compare(const label start, const label end) const; //- Return the position of a point on the curve given by // the parameter 0 <= lambda <= 1 @@ -141,6 +143,17 @@ public: //- Return the length of the curve virtual scalar length() const = 0; + //- Return a complete knotList by adding the start/end points + // to the given list + static pointField knotlist + ( + const pointField&, + const label start, + const label end, + const pointField& otherknots + ); + + // Member operators void operator=(const curvedEdge&); @@ -151,20 +164,13 @@ public: }; -//- Return the complete knotList by adding the start and end points to the -// given list -pointField knotlist -( - const pointField& points, - const label start, - const label end, - const pointField& otherknots -); +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +#include "curvedEdgeI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/curvedEdges/curvedEdgeI.H b/src/mesh/blockMesh/curvedEdges/curvedEdgeI.H new file mode 100644 index 0000000000000000000000000000000000000000..6d3de4e554009922cc29918ad31a41d5369a3e62 --- /dev/null +++ b/src/mesh/blockMesh/curvedEdges/curvedEdgeI.H @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::label Foam::curvedEdge::start() const +{ + return start_; +} + + +inline Foam::label Foam::curvedEdge::end() const +{ + return end_; +} + + +inline int Foam::curvedEdge::compare(const label start, const label end) const +{ + if (start_ == start && end_ == end) + { + return 1; + } + else if (start_ == end && end_ == start) + { + return -1; + } + else + { + return 0; + } +} + + +inline int Foam::curvedEdge::compare(const curvedEdge& e) const +{ + return Foam::curvedEdge::compare(e.start(), e.end()); +} + + +inline int Foam::curvedEdge::compare(const edge& e) const +{ + return Foam::curvedEdge::compare(e.start(), e.end()); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdgeList.H b/src/mesh/blockMesh/curvedEdges/curvedEdgeList.H similarity index 98% rename from applications/utilities/mesh/generation/blockMesh/curvedEdgeList.H rename to src/mesh/blockMesh/curvedEdges/curvedEdgeList.H index 3918dded609ac4a62d125d9cf79aae34cc171220..6111d535650046e5c52cc30c971bf82808e7fb55 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdgeList.H +++ b/src/mesh/blockMesh/curvedEdges/curvedEdgeList.H @@ -22,10 +22,11 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass +Typedef Foam::curvedEdgeList Description + A PtrList of curvedEdges \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.C b/src/mesh/blockMesh/curvedEdges/lineDivide.C similarity index 60% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.C rename to src/mesh/blockMesh/curvedEdges/lineDivide.C index 728346542fb9b00bc4d0f36ea964b70900a9a166..ef47bff078f08c4c6d3dbee32286111c57a4f1ab 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.C +++ b/src/mesh/blockMesh/curvedEdges/lineDivide.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - lineDivide class : divides a line into segments - \*---------------------------------------------------------------------------*/ #include "error.H" @@ -32,66 +29,58 @@ Description #include "lineDivide.H" #include "curvedEdge.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -lineDivide::lineDivide(const curvedEdge& bc, const label n, const scalar xratio) +Foam::lineDivide::lineDivide +( + const curvedEdge& cedge, + const label ndiv, + const scalar& xratio +) : - points_(n + 1), - divisions_(n + 1), - noPoints_(n) + points_(ndiv + 1), + divisions_(ndiv + 1) { - scalar np(n); - scalar lambda(0.0); + divisions_[0] = 0.0; + divisions_[ndiv] = 1.0; + // calculate the spacing if (xratio == 1.0) { - scalar y(1.0/np); - for (label i=0; i<=noPoints_; i++) + for (label i=1; i < ndiv; i++) { - lambda = scalar(i)/np; - points_[i] = bc.position(lambda); - divisions_[i] = y*i; + divisions_[i] = scalar(i)/ndiv; } } else { - points_[0] = bc.position(0.0); - divisions_[0] = 0.0; - scalar xrpower = 1.0; - - for (label i=1; i<=noPoints_; i++) + for (label i=1; i < ndiv; i++) { - lambda = (1.0 - pow(xratio, i))/(1.0 - pow(xratio, np)); - points_[i] = bc.position(lambda); - divisions_[i] = lambda; - xrpower *= xratio; + divisions_[i] = (1.0 - pow(xratio, i))/(1.0 - pow(xratio, ndiv)); } } + + // calculate the points + for (label i=0; i <= ndiv; i++) + { + points_[i] = cedge.position(divisions_[i]); + } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const pointField& lineDivide::points() const +const Foam::pointField& Foam::lineDivide::points() const { return points_; } -const scalarList& lineDivide::lambdaDivisions() const +const Foam::scalarList& Foam::lineDivide::lambdaDivisions() const { return divisions_; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.H b/src/mesh/blockMesh/curvedEdges/lineDivide.H similarity index 89% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.H rename to src/mesh/blockMesh/curvedEdges/lineDivide.H index a4a02d7d29d6f1e3e25a23ad6e907876d4e0a43e..8a4c052abab6236cf85129994dd4121df30ad728 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.H +++ b/src/mesh/blockMesh/curvedEdges/lineDivide.H @@ -26,7 +26,7 @@ Class Foam::lineDivide Description - lineDivide class : divides a line into segments + Divides a line into segments SourceFiles lineDivide.C @@ -47,7 +47,7 @@ namespace Foam class curvedEdge; /*---------------------------------------------------------------------------*\ - Class lineDivide Declaration + Class lineDivide Declaration \*---------------------------------------------------------------------------*/ class lineDivide @@ -56,15 +56,19 @@ class lineDivide pointField points_; scalarList divisions_; - label noPoints_; - public: // Constructors //- Construct from components - lineDivide(const curvedEdge&, const label, const scalar = 1.0); + // discretization and expansion ration + lineDivide + ( + const curvedEdge&, + const label ndiv, + const scalar& xratio = 1.0 + ); // Member Functions diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.C b/src/mesh/blockMesh/curvedEdges/lineEdge.C similarity index 75% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.C rename to src/mesh/blockMesh/curvedEdges/lineEdge.C index 5fc557de1f1fb750aa439695bb6fc0f187b14882..72e173ea2ce3e6b88d953b1006de372cc78a9b80 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.C +++ b/src/mesh/blockMesh/curvedEdges/lineEdge.C @@ -22,34 +22,24 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - line class : defines a straight line between the start point and the - end point - \*---------------------------------------------------------------------------*/ #include "error.H" - #include "lineEdge.H" +#include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(lineEdge, 0); - -// Add the curvedEdge constructor functions to the hash tables -curvedEdge::addIstreamConstructorToTable<lineEdge> - addLineEdgeIstreamConstructorToTable_; + defineTypeNameAndDebug(lineEdge, 0); + addToRunTimeSelectionTable(curvedEdge, lineEdge, Istream); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -lineEdge::lineEdge +Foam::lineEdge::lineEdge ( const pointField& points, const label start, @@ -62,8 +52,7 @@ lineEdge::lineEdge {} -// Construct from Istream -lineEdge::lineEdge(const pointField& points, Istream& is) +Foam::lineEdge::lineEdge(const pointField& points, Istream& is) : curvedEdge(points, is), startPoint_(points_[start_]), @@ -73,7 +62,7 @@ lineEdge::lineEdge(const pointField& points, Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -vector lineEdge::position(const scalar lambda) const +Foam::vector Foam::lineEdge::position(const scalar lambda) const { if (lambda < 0 || lambda > 1) { @@ -86,15 +75,10 @@ vector lineEdge::position(const scalar lambda) const } -//- Return the length of the curve -scalar lineEdge::length() const +Foam::scalar Foam::lineEdge::length() const { return mag(direction_); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.H b/src/mesh/blockMesh/curvedEdges/lineEdge.H similarity index 78% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.H rename to src/mesh/blockMesh/curvedEdges/lineEdge.H index a85b6a81c2225d61fcce7176755702ba76a15358..a601830f7f70e6449110a5949ef44cf41a734855 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.H +++ b/src/mesh/blockMesh/curvedEdges/lineEdge.H @@ -26,8 +26,7 @@ Class Foam::lineEdge Description - lineEdge class : defines a straight line between the start point and the - end point + Defines a straight line between the start point and the end point. SourceFiles lineEdge.C @@ -45,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class lineEdge Declaration + Class lineEdge Declaration \*---------------------------------------------------------------------------*/ @@ -55,8 +54,19 @@ class lineEdge { // Private data - vector startPoint_; - vector direction_; + //- Avoid repetitive calculation of the start point + const vector startPoint_; + + //- Avoid repetitive calculation of the direction (end - start) + const vector direction_; + + // Private Member Functions + + //- Disallow default bitwise copy construct + lineEdge(const lineEdge&); + + //- Disallow default bitwise assignment + void operator=(const lineEdge&); public: @@ -67,10 +77,10 @@ public: // Constructors //- Construct from components - lineEdge(const pointField& points, const label start, const label end); + lineEdge(const pointField&, const label start, const label end); //- Construct from Istream setting pointsList - lineEdge(const pointField& points, Istream&); + lineEdge(const pointField&, Istream&); // Destructor diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.C b/src/mesh/blockMesh/curvedEdges/polyLine.C similarity index 75% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.C rename to src/mesh/blockMesh/curvedEdges/polyLine.C index a91ea793c4b76b301462c9642ff6795e380db72b..e8872de6a2b983bddc0fb2c99e9a6cc0ba9f60c7 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.C +++ b/src/mesh/blockMesh/curvedEdges/polyLine.C @@ -22,63 +22,60 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - polyLineEdge class : defines a curvedEdge in terms of a series of - straight line segments - \*---------------------------------------------------------------------------*/ #include "error.H" - #include "polyLine.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // calcDistances generates the distances_ lookup table (cumulative // distance along the line) from the individual vectors to the points -void polyLine::calcDistances() +void Foam::polyLine::calcDistances() { - distances_[0] = 0.0; + distances_.setSize(controlPoints_.size()); - for (label i=1; i<distances_.size(); i++) + if (distances_.size()) { - distances_[i] = - mag(controlPoints_[i] - controlPoints_[i-1]) - + distances_[i-1]; + distances_[0] = 0.0; + + for (label i=1; i<distances_.size(); i++) + { + distances_[i] = distances_[i-1] + + mag(controlPoints_[i] - controlPoints_[i-1]); + } + + // normalize + lineLength_ = distances_[distances_.size()-1]; + for (label i=1; i<distances_.size(); i++) + { + distances_[i] /= lineLength_; + } } - - lineLength_ = distances_[distances_.size()-1]; - - for (label i=1; i<distances_.size(); i++) + else { - distances_[i] /= lineLength_; + lineLength_ = 0.0; } } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -polyLine::polyLine(const pointField& ps) +Foam::polyLine::polyLine(const pointField& ps) : controlPoints_(ps), - distances_(ps.size()) + distances_(0), + lineLength_(0.0) { - if (ps.size()) - { - calcDistances(); - } + calcDistances(); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -vector polyLine::position(const scalar lambda) const +Foam::vector Foam::polyLine::position(const scalar lambda) const { // check range of lambda @@ -124,14 +121,10 @@ vector polyLine::position(const scalar lambda) const } -scalar polyLine::length() const +Foam::scalar Foam::polyLine::length() const { return lineLength_; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.H b/src/mesh/blockMesh/curvedEdges/polyLine.H similarity index 83% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.H rename to src/mesh/blockMesh/curvedEdges/polyLine.H index 3d6d5fb140e354294017be74b5ed256f4e9e645c..4ef97f30525b6368e3f9a0f7ddb6a4ef5107bd5b 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.H +++ b/src/mesh/blockMesh/curvedEdges/polyLine.H @@ -26,9 +26,10 @@ Class Foam::polyLine Description - polyLine class : defines a curvedEdge in terms of a series of straight - line segments. This is the basic polyLine class which implements - just the line (no topology : its not derived from curvedEdge) + Defines a curvedEdge in terms of a series of straight line segments. + + This is the basic polyLine class which implements just the line + (no topology - it is not derived from curvedEdge) SourceFiles polyLine.C @@ -47,12 +48,19 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class polyLine Declaration + Class polyLine Declaration \*---------------------------------------------------------------------------*/ class polyLine { + // Private Member Functions + + //- Disallow default bitwise copy construct + polyLine(const polyLine&); + + //- Disallow default bitwise assignment + void operator=(const polyLine&); protected: @@ -72,7 +80,7 @@ public: // Constructors //- Construct from components - polyLine(const pointField& ps); + polyLine(const pointField&); // Member Functions diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.C b/src/mesh/blockMesh/curvedEdges/polyLineEdge.C similarity index 70% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.C rename to src/mesh/blockMesh/curvedEdges/polyLineEdge.C index f9ab4dabadebcc5296f3163fe2fc3a2aec8cacb4..89029d1af97726cf6895650b32e8baaa8e1bf971 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.C +++ b/src/mesh/blockMesh/curvedEdges/polyLineEdge.C @@ -22,32 +22,24 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "error.H" - #include "polyLineEdge.H" +#include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(polyLineEdge, 0); - -// Add the curvedEdge constructor functions to the hash tables -curvedEdge::addIstreamConstructorToTable<polyLineEdge> - addPolyLineEdgeIstreamConstructorToTable_; + defineTypeNameAndDebug(polyLineEdge, 0); + addToRunTimeSelectionTable(curvedEdge, polyLineEdge, Istream); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -polyLineEdge::polyLineEdge +Foam::polyLineEdge::polyLineEdge ( const pointField& ps, const label start, @@ -56,12 +48,11 @@ polyLineEdge::polyLineEdge ) : curvedEdge(ps, start, end), - polyLine(knotlist(ps,start,end,otherpoints)) + polyLine(knotlist(ps, start, end, otherpoints)) {} -// Construct from Istream -polyLineEdge::polyLineEdge(const pointField& ps, Istream& is) +Foam::polyLineEdge::polyLineEdge(const pointField& ps, Istream& is) : curvedEdge(ps, is), polyLine(knotlist(ps, start_, end_, pointField(is))) @@ -70,23 +61,16 @@ polyLineEdge::polyLineEdge(const pointField& ps, Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Return the position of a point on the curve given by -// the parameter 0 <= lambda <= 1 -vector polyLineEdge::position(const scalar lambda) const +Foam::vector Foam::polyLineEdge::position(const scalar lambda) const { return polyLine::position(lambda); } -//- Return the length of the curve -scalar polyLineEdge::length() const +Foam::scalar Foam::polyLineEdge::length() const { return polyLine::lineLength_; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.H b/src/mesh/blockMesh/curvedEdges/polyLineEdge.H similarity index 83% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.H rename to src/mesh/blockMesh/curvedEdges/polyLineEdge.H index 238dffa9f022e1de307b46acad3f07711326bd84..532a91ad5d50c265ca3b42c76033a0d04fc4725c 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.H +++ b/src/mesh/blockMesh/curvedEdges/polyLineEdge.H @@ -26,8 +26,8 @@ Class Foam::polyLineEdge Description - polyLineEdge class : defines a curvedEdge in terms of a series of straight - line segments. This is the public face of polyLine + Defines a curvedEdge in terms of a series of straight line segments. + This is the public face of polyLine SourceFiles polyLineEdge.C @@ -46,7 +46,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class polyLineEdge Declaration + Class polyLineEdge Declaration \*---------------------------------------------------------------------------*/ class polyLineEdge @@ -54,6 +54,14 @@ class polyLineEdge public curvedEdge, public polyLine { + // Private Member Functions + + //- Disallow default bitwise copy construct + polyLineEdge(const polyLineEdge&); + + //- Disallow default bitwise assignment + void operator=(const polyLineEdge&); + public: @@ -66,14 +74,14 @@ public: //- Construct from components polyLineEdge ( - const pointField& ps, + const pointField&, const label start, const label end, - const pointField& otherpoints + const pointField& otherPoints ); //- Construct from Istream - polyLineEdge(const pointField& ps, Istream&); + polyLineEdge(const pointField&, Istream&); // Destructor diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C b/src/mesh/blockMesh/curvedEdges/polySplineEdge.C similarity index 83% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C rename to src/mesh/blockMesh/curvedEdges/polySplineEdge.C index 7263f7184362126d8bb094cfe6cafa205d3e3d2d..841f6f986a2cdce4b406872b40a4215f5f7fbd38 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C +++ b/src/mesh/blockMesh/curvedEdges/polySplineEdge.C @@ -33,16 +33,27 @@ License namespace Foam { defineTypeNameAndDebug(polySplineEdge, 0); - - // Add the curvedEdge constructor functions to the hash tables addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + //! @cond fileScope + inline label nsize(const label otherKnotsSize, const label nBetweenKnots) + { + return otherKnotsSize*(1 + nBetweenKnots) + nBetweenKnots + 2; + } + //! @endcond fileScope +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // intervening : returns a list of the points making up the polyLineEdge -// which describes the spline. nbetweenKnots is the number of points +// which describes the spline. nBetweenKnots is the number of points // placed between each knot : this ensures that the knot locations // are retained as a subset of the polyLine points. @@ -52,14 +63,14 @@ namespace Foam Foam::pointField Foam::polySplineEdge::intervening ( const pointField& otherknots, - const label nbetweenKnots, + const label nBetweenKnots, const vector& fstend, const vector& sndend ) { BSpline spl(knotlist(points_, start_, end_, otherknots), fstend, sndend); - label nSize(nsize(otherknots.size(), nbetweenKnots)); + label nSize(nsize(otherknots.size(), nBetweenKnots)); pointField ans(nSize); @@ -67,7 +78,7 @@ Foam::pointField Foam::polySplineEdge::intervening scalar init = 1.0/(N - 1); scalar interval = (N - scalar(3))/N; interval /= otherknots.size() + 1; - interval /= nbetweenKnots + 1; + interval /= nBetweenKnots + 1; ans[0] = points_[start_]; @@ -125,11 +136,16 @@ Foam::polySplineEdge::polySplineEdge vector sndend(is); controlPoints_.setSize(nsize(otherKnots_.size(), nInterKnots)); + // why does this need to be here (to avoid a crash)? + // 'intervening' uses BSpline to solve the new points + // it seems to be going badly there distances_.setSize(controlPoints_.size()); controlPoints_ = intervening(otherKnots_, nInterKnots, fstend, sndend); calcDistances(); - Info<< polyLine::controlPoints_ << endl; + + // Info<< "polyLine[" << start_ << " " << end_ + // << "] controlPoints " << controlPoints_ << endl; } diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H b/src/mesh/blockMesh/curvedEdges/polySplineEdge.H similarity index 83% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H rename to src/mesh/blockMesh/curvedEdges/polySplineEdge.H index 1f59d5bf8e71ebf77603ff69d9e0764073648896..b133b9e45dd15de1f261e118593993bb8b2ca02c 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H +++ b/src/mesh/blockMesh/curvedEdges/polySplineEdge.H @@ -26,7 +26,7 @@ Class Foam::polySplineEdge Description - polySplineEdge class : representation of a spline via a polyLine + A spline representation via a polyLine SourceFiles polySplineEdge.C @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class polySplineEdge Declaration + Class polySplineEdge Declaration \*---------------------------------------------------------------------------*/ class polySplineEdge @@ -62,17 +62,12 @@ class polySplineEdge pointField intervening ( - const pointField& otherknots, - const label nbetweenKnots, - const vector&, const vector& + const pointField& otherKnots, + const label nBetweenKnots, + const vector&, + const vector& ); - label nsize(const label otherknotsSize, const label nbetweenKnots) - { - return otherknotsSize*(1 + nbetweenKnots) + nbetweenKnots + 2; - } - - public: //- Runtime type information @@ -84,15 +79,15 @@ public: //- Construct from components polySplineEdge ( - const pointField& ps, + const pointField&, const label start, const label end, - const pointField& otherknots, + const pointField& otherKnots, const label nInterKnots = 20 ); //- Construct from Istream setting pointsList - polySplineEdge(const pointField& points, Istream& is); + polySplineEdge(const pointField&, Istream&); // Destructor diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.C similarity index 73% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C rename to src/mesh/blockMesh/curvedEdges/simpleSplineEdge.C index b45f0ea3c29a68a63573a4838e74fba7456731aa..3132a1f7eaff97f24178dc84aef9d1f774ab12e9 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C +++ b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.C @@ -22,29 +22,24 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - simpleSplineEdge : the actual access class for Bspline - \*---------------------------------------------------------------------------*/ #include "simpleSplineEdge.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(simpleSplineEdge, 0); -addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream); +namespace Foam +{ + defineTypeNameAndDebug(simpleSplineEdge, 0); + addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -simpleSplineEdge::simpleSplineEdge +Foam::simpleSplineEdge::simpleSplineEdge ( const pointField& points, const label start, @@ -57,8 +52,7 @@ simpleSplineEdge::simpleSplineEdge {} -// Construct from components -simpleSplineEdge::simpleSplineEdge +Foam::simpleSplineEdge::simpleSplineEdge ( const pointField& points, const label start, @@ -73,8 +67,7 @@ simpleSplineEdge::simpleSplineEdge {} -// Construct from Istream -simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is) +Foam::simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is) : curvedEdge(points, is), BSpline(knotlist(points, start_, end_, pointField(is))) @@ -83,24 +76,17 @@ simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Return the position of a point on the simple spline curve given by -// the parameter 0 <= lambda <= 1 -vector simpleSplineEdge::position(const scalar mu) const +Foam::vector Foam::simpleSplineEdge::position(const scalar mu) const { return BSpline::position(mu); } -//- Return the length of the simple spline curve -scalar simpleSplineEdge::length() const +Foam::scalar Foam::simpleSplineEdge::length() const { notImplemented("simpleSplineEdge::length() const"); return 1.0; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.H b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.H similarity index 84% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.H rename to src/mesh/blockMesh/curvedEdges/simpleSplineEdge.H index 14c5b8d0e447c4181d9c8bbe70914164b4c4fc48..4c6df2a5095a3893f0a609cb8f4c4134b204b4b8 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.H +++ b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.H @@ -26,7 +26,7 @@ Class Foam::simpleSplineEdge Description - simpleSplineEdge : the actual access class for Bspline + The actual access class for Bspline SourceFiles simpleSplineEdge.C @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class simpleSplineEdge Declaration + Class simpleSplineEdge Declaration \*---------------------------------------------------------------------------*/ class simpleSplineEdge @@ -53,6 +53,14 @@ class simpleSplineEdge public curvedEdge, public BSpline { + // Private Member Functions + + //- Disallow default bitwise copy construct + simpleSplineEdge(const simpleSplineEdge&); + + //- Disallow default bitwise assignment + void operator=(const simpleSplineEdge&); + public: @@ -65,19 +73,19 @@ public: //- Construct from components simpleSplineEdge ( - const pointField& ps, + const pointField&, const label start, const label end, - const pointField& otherknots + const pointField& otherKnots ); //- Construct from components simpleSplineEdge ( - const pointField& points, + const pointField&, const label start, const label end, - const pointField& otherknots, + const pointField& otherKnots, const vector& fstend, const vector& sndend ); @@ -88,7 +96,8 @@ public: // Destructor - virtual ~simpleSplineEdge(){} + virtual ~simpleSplineEdge() + {} // Member Functions diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.C b/src/mesh/blockMesh/curvedEdges/spline.C similarity index 57% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.C rename to src/mesh/blockMesh/curvedEdges/spline.C index 1702c585da9dacefc6cb379b3303c3d35b156289..871c7f7db4007acde385443347701e32e3b83426 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.C +++ b/src/mesh/blockMesh/curvedEdges/spline.C @@ -22,96 +22,72 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - spline class : define a basic spline on nKnots knots - this - does not go anywhere near these knots (will act as a base type for - various splines that will have real uses) - \*---------------------------------------------------------------------------*/ #include "spline.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -spline::spline(const pointField& a) +Foam::spline::spline(const pointField& knotPoints) : - knots_(a) + knots_(knotPoints) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// function B : this is the blending function for constructing the -// spline - -scalar spline::B(const scalar& tau) const +Foam::scalar Foam::spline::B(const scalar& tau) const { - scalar value = 0.0; - - if (tau>=2.0 || tau<=-2.0) + if (tau <= -2.0 || tau >= 2.0) { - value = 0.0; + return 0.0; } - else if (tau<=-1.0) + else if (tau <= -1.0) { - value = pow((2.0 + tau),3.0)/6.0; + return pow((2.0 + tau),3.0)/6.0; } - else if (tau<=0.0) + else if (tau <= 0.0) { - value = (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0; + return (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0; } - else if (tau<=1.0) + else if (tau <= 1.0) { - value = (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0; + return (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0; } - else if (tau<=2.0) + else if (tau <= 2.0) { - value = pow((2.0 - tau),3.0)/6.0; + return pow((2.0 - tau),3.0)/6.0; } else { FatalErrorIn("spline::B(const scalar&)") - << "How the hell did we get here???, " + << "Programming error???, " << "tau = " << tau << abort(FatalError); } - return value; + return 0.0; } -// position : returns the position along the spline corresponding to the -// variable mu1 - -vector spline::position(const scalar mu1) const +Foam::vector Foam::spline::position(const scalar mu1) const { - vector tmp(vector::zero); + vector loc(vector::zero); for (register label i=0; i<knots_.size(); i++) { - tmp += B((knots_.size() - 1)*mu1 - i)*knots_[i]; + loc += B((knots_.size() - 1)*mu1 - i)*knots_[i]; } - return tmp; + return loc; } -//- Return the length of the spline curve -scalar spline::length() const +Foam::scalar Foam::spline::length() const { notImplemented("spline::length() const"); return 1.0; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.H b/src/mesh/blockMesh/curvedEdges/spline.H similarity index 87% rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.H rename to src/mesh/blockMesh/curvedEdges/spline.H index b5c050f3696ab36a6b38bb8db5576d5635c30ead..580877068219ab89c22431ae12699b3d1ce294c4 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.H +++ b/src/mesh/blockMesh/curvedEdges/spline.H @@ -26,9 +26,9 @@ Class Foam::spline Description - spline class : define a basic spline on nKnots knots - this - does not go anywhere near these knots (will act as a base type for - various splines that will have real uses) + Define a basic spline on nKnots knots. + The spline does not go anywhere near these knots + (will act as a base type for various splines that will have real uses) SourceFiles spline.C @@ -56,12 +56,17 @@ class spline //- The knots defining the spline pointField knots_; - - // Private member functions + // Private Member Functions //- Blending function for constructing spline scalar B(const scalar&) const; + //- Disallow default bitwise copy construct + spline(const spline&); + + //- Disallow default bitwise assignment + void operator=(const spline&); + public: diff --git a/src/meshTools/cellQuality/cellQuality.C b/src/meshTools/cellQuality/cellQuality.C index 19bef0e5face5e7cc6a162f1fc4d656e925cac56..dfbab90f055911e7e6272c258f6cd762dd2f870e 100644 --- a/src/meshTools/cellQuality/cellQuality.C +++ b/src/meshTools/cellQuality/cellQuality.C @@ -26,7 +26,7 @@ License \*---------------------------------------------------------------------------*/ #include "cellQuality.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -66,8 +66,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const scalar magS = mag(s); scalar cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::math::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); result[own[faceI]] = max(cosDDotS, result[own[faceI]]); @@ -92,8 +91,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const scalar magS = mag(s); scalar cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::math::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); result[faceCells[faceI]] = max(cosDDotS, result[faceCells[faceI]]); } @@ -207,8 +205,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const scalar magS = mag(s); scalar cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::math::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); result[faceI] = cosDDotS; } @@ -233,8 +230,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const scalar magS = mag(s); scalar cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::math::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); result[globalFaceI++] = cosDDotS; } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C index f3afa950ae436b5c00db0c2cd5a5765a19ba95f5..05842f14f290ceecc50466d59d480ab351e0b80b 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C @@ -27,7 +27,7 @@ License #include "EulerCoordinateRotation.H" #include "Switch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -59,9 +59,9 @@ void Foam::EulerCoordinateRotation::calcTransform if (inDegrees) { - phi *= constant::math::pi/180.0; - theta *= constant::math::pi/180.0; - psi *= constant::math::pi/180.0; + phi *= constant::mathematical::pi/180.0; + theta *= constant::mathematical::pi/180.0; + psi *= constant::mathematical::pi/180.0; } tensor::operator= diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C index 1350ed3bc56a60b8023d50b61a2482badc8a3cff..ade5e0635915a9caec201b96de546775fa14d52f 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C @@ -27,7 +27,7 @@ License #include "STARCDCoordinateRotation.H" #include "Switch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -60,9 +60,9 @@ void Foam::STARCDCoordinateRotation::calcTransform if (inDegrees) { - x *= constant::math::pi/180.0; - y *= constant::math::pi/180.0; - z *= constant::math::pi/180.0; + x *= constant::mathematical::pi/180.0; + y *= constant::mathematical::pi/180.0; + z *= constant::mathematical::pi/180.0; } tensor::operator= diff --git a/src/meshTools/coordinateSystems/cylindricalCS.C b/src/meshTools/coordinateSystems/cylindricalCS.C index 31d8456ec5d76c11c23eea6ebb2d32d4f4c28ac8..b55dadf014bcbd80f7b23fe35b3799fbcda4cae2 100644 --- a/src/meshTools/coordinateSystems/cylindricalCS.C +++ b/src/meshTools/coordinateSystems/cylindricalCS.C @@ -28,7 +28,7 @@ License #include "one.H" #include "Switch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -133,7 +133,7 @@ Foam::vector Foam::cylindricalCS::localToGlobal { scalar theta ( - local.y()*(inDegrees_ ? constant::math::pi/180.0 : 1.0) + local.y()*(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0) ); return coordinateSystem::localToGlobal @@ -153,7 +153,7 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::localToGlobal scalarField theta = ( local.component(vector::Y) - *(inDegrees_ ? constant::math::pi/180.0 : 1.0) + *(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0) ); @@ -181,7 +181,7 @@ Foam::vector Foam::cylindricalCS::globalToLocal ( lc.y(), lc.x() - )*(inDegrees_ ? 180.0/constant::math::pi : 1.0), + )*(inDegrees_ ? 180.0/constant::mathematical::pi : 1.0), lc.z() ); } @@ -212,7 +212,7 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::globalToLocal ( lc.component(vector::Y), lc.component(vector::X) - )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) + )*(inDegrees_ ? 180.0/constant::mathematical::pi : 1.0) ); result.replace(vector::Z, lc.component(vector::Z)); diff --git a/src/meshTools/coordinateSystems/sphericalCS.C b/src/meshTools/coordinateSystems/sphericalCS.C index e36d0e50a78b180cc25a794c4272e5fce8429def..e7edbbf8dccbe771adb22c132435fd15801bea0c 100644 --- a/src/meshTools/coordinateSystems/sphericalCS.C +++ b/src/meshTools/coordinateSystems/sphericalCS.C @@ -28,7 +28,7 @@ License #include "one.H" #include "Switch.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -135,12 +135,12 @@ Foam::vector Foam::sphericalCS::localToGlobal const scalar theta ( local.y() - *(inDegrees_ ? constant::math::pi/180.0 : 1.0) + *(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0) ); const scalar phi ( local.z() - *(inDegrees_ ? constant::math::pi/180.0 : 1.0) + *(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0) ); return coordinateSystem::localToGlobal @@ -161,12 +161,12 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::localToGlobal const scalarField theta ( local.component(vector::Y) - *(inDegrees_ ? constant::math::pi/180.0 : 1.0) + *(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0) ); const scalarField phi ( local.component(vector::Z) - *(inDegrees_ ? constant::math::pi/180.0 : 1.0) + *(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0) ); vectorField lc(local.size()); @@ -193,11 +193,11 @@ Foam::vector Foam::sphericalCS::globalToLocal atan2 ( lc.y(), lc.x() - )*(inDegrees_ ? 180.0/constant::math::pi : 1.0), + )*(inDegrees_ ? 180.0/constant::mathematical::pi : 1.0), acos ( lc.z()/(r + SMALL) - )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) + )*(inDegrees_ ? 180.0/constant::mathematical::pi : 1.0) ); } @@ -227,7 +227,7 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal ( lc.component(vector::Y), lc.component(vector::X) - )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) + )*(inDegrees_ ? 180.0/constant::mathematical::pi : 1.0) ); result.replace @@ -236,7 +236,7 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal acos ( lc.component(vector::Z)/(r + SMALL) - )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) + )*(inDegrees_ ? 180.0/constant::mathematical::pi : 1.0) ); return tresult; diff --git a/src/meshTools/coordinateSystems/toroidalCS.C b/src/meshTools/coordinateSystems/toroidalCS.C index c9d8c82f27011b341f7e97aae29b12fa4a8fd395..3e912007a54c60b2a8e55801a7ecae8ecb028f76 100644 --- a/src/meshTools/coordinateSystems/toroidalCS.C +++ b/src/meshTools/coordinateSystems/toroidalCS.C @@ -26,7 +26,7 @@ License #include "toroidalCS.H" #include "addToRunTimeSelectionTable.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -72,8 +72,8 @@ Foam::vector Foam::toroidalCS::localToGlobal ) const { // Notation: r = local.x() - scalar theta = local.y()*constant::math::pi/180.0; - scalar phi = local.z()*constant::math::pi/180.0; + scalar theta = degToRad(local.y()); + scalar phi = degToRad(local.z()); scalar rprime = radius_ + local.x()*sin(phi); @@ -101,10 +101,10 @@ Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal const scalarField r = local.component(vector::X); const scalarField theta = - local.component(vector::Y)*constant::math::pi/180.0; + local.component(vector::Y)*constant::mathematical::pi/180.0; const scalarField phi = - local.component(vector::Z)*constant::math::pi/180.0; + local.component(vector::Z)*constant::mathematical::pi/180.0; const scalarField rprime = radius_ + r*sin(phi); diff --git a/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C b/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C index 56e878938e6a2e17817c65276ab796cf77bbb9c4..9924eb0a9cb2d245c980874a5960db0af518e685 100644 --- a/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C +++ b/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C @@ -26,7 +26,7 @@ License #include "primitiveMeshGeometry.H" #include "pyramidPointFaceRef.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -271,8 +271,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct const labelList& nei = mesh.faceNeighbour(); // Severe nonorthogonality threshold - const scalar severeNonorthogonalityThreshold = - ::cos(orthWarn/180.0*constant::math::pi); + const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn)); scalar minDDotS = GREAT; @@ -303,8 +302,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct Pout<< "Severe non-orthogonality for face " << faceI << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " - << ::acos(dDotS)/constant::math::pi*180.0 + << ": Angle = " << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -329,8 +327,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct << faceI << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " - << ::acos(dDotS)/constant::math::pi*180.0 + << ": Angle = " << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -376,9 +373,8 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct if (neiSize > 0) { Info<< "Mesh non-orthogonality Max: " - << ::acos(minDDotS)/constant::math::pi*180.0 - << " average: " << - ::acos(sumDDotS/neiSize)/constant::math::pi*180.0 + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/neiSize)) << endl; } } @@ -780,7 +776,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles << abort(FatalError); } - const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi); + const scalar maxSin = Foam::sin(degToRad(maxDeg)); const faceList& fcs = mesh.faces(); @@ -860,8 +856,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles if (maxEdgeSin > SMALL) { scalar maxConcaveDegr = - Foam::asin(Foam::min(1.0, maxEdgeSin)) - *180.0/constant::math::pi; + radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin))); Info<< "There are " << nConcave << " faces with concave angles between consecutive" diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C index 01a4366192dd4f5f6bad3e97d2706f35e0674f24..4d71a1253406747f1fad95b426c5f6f3691e796d 100644 --- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C @@ -1333,7 +1333,20 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh ) : triSurfaceMesh(io, s), - dict_(io, dict) + dict_ + ( + IOobject + ( + searchableSurface::name() + "Dict", + searchableSurface::instance(), + searchableSurface::local(), + searchableSurface::db(), + searchableSurface::NO_READ, + searchableSurface::writeOpt(), + searchableSurface::registerObject() + ), + dict + ) { read(); diff --git a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C index ba460f73813cd85078f7906c88974e6d144c1212..b36997f208ad0256a70a8924b55772176f49eccf 100644 --- a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C +++ b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C @@ -26,7 +26,7 @@ License #include "shapeToCell.H" #include "polyMesh.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "hexMatcher.H" #include "cellFeatures.H" @@ -56,8 +56,7 @@ Foam::topoSetSource::addToUsageTable Foam::shapeToCell::usage_ // Angle for polys to be considered splitHexes. -Foam::scalar Foam::shapeToCell::featureCos = - Foam::cos(10.0*Foam::constant::math::pi/180.0); +Foam::scalar Foam::shapeToCell::featureCos = Foam::cos(degToRad(10.0)); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index 1666da5a8eb8c518f2fe14b2d6310bbc0d45298d..a8a979af4e8ef72bd45052faa28e317a79ce3e6e 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -36,15 +36,14 @@ License #include "meshTools.H" #include "plane.H" #include "Random.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "treeBoundBox.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(Foam::edgeIntersections, 0); -Foam::scalar Foam::edgeIntersections::alignedCos_ = - Foam::cos(89.0*Foam::constant::math::pi/180.0); +Foam::scalar Foam::edgeIntersections::alignedCos_ = Foam::cos(degToRad(89.0)); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index dceed6d2c991f8f9f09bc00296a120d06b81ffd1..4383c30a2f745ff896e6e6d65523f89ceadaeef2 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -33,7 +33,7 @@ License #include "linePointRef.H" #include "OFstream.H" #include "IFstream.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -490,8 +490,7 @@ Foam::labelList Foam::surfaceFeatures::selectFeatureEdges void Foam::surfaceFeatures::findFeatures(const scalar includedAngle) { - scalar minCos = - Foam::cos((180.0 - includedAngle)*constant::math::pi/180.0); + scalar minCos = Foam::cos(degToRad(180.0 - includedAngle)); const labelListList& edgeFaces = surf_.edgeFaces(); const vectorField& faceNormals = surf_.faceNormals(); diff --git a/src/randomProcesses/Kmesh/Kmesh.C b/src/randomProcesses/Kmesh/Kmesh.C index 93091114f19559168748584733ec1f07f564afd8..5ce3c85463ed5a96d166830f17257ddfeef0083f 100644 --- a/src/randomProcesses/Kmesh/Kmesh.C +++ b/src/randomProcesses/Kmesh/Kmesh.C @@ -27,7 +27,7 @@ License #include "Kmesh.H" #include "polyMesh.H" #include "volFields.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -89,15 +89,15 @@ Foam::Kmesh::Kmesh(const fvMesh& mesh) for (i=0; i<NN[0]; i++) { - scalar k1 = (i - NN[0]/2)*constant::math::twoPi/L[0]; + scalar k1 = (i - NN[0]/2)*constant::mathematical::twoPi/L[0]; for (label j=0; j<NN[1]; j++) { - scalar k2 = (j - NN[1]/2)*constant::math::twoPi/L[1]; + scalar k2 = (j - NN[1]/2)*constant::mathematical::twoPi/L[1]; for (label k=0; k<NN[2]; k++) { - scalar k3 = (k - NN[2]/2)*constant::math::twoPi/L[2]; + scalar k3 = (k - NN[2]/2)*constant::mathematical::twoPi/L[2]; (*this)[rep(i, j, k, NN)] = vector(k1, k2, k3); } diff --git a/src/randomProcesses/fft/kShellIntegration.C b/src/randomProcesses/fft/kShellIntegration.C index c007425c810dc4492310cabe2352ce5db739c33c..846de038028f1534a40c5d5b729e398cf164e3c7 100644 --- a/src/randomProcesses/fft/kShellIntegration.C +++ b/src/randomProcesses/fft/kShellIntegration.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "kShellIntegration.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,12 +51,12 @@ graph kShellIntegration // spectra E(k). int E(k) dk is now the total energy in a box // of side 2pi - y *= sqr(x)*4.0*constant::math::pi; + y *= sqr(x)*4.0*constant::mathematical::pi; // now scale this to get the energy in a box of side l0 scalar l0(K.sizeOfBox()[0]*(scalar(K.nn()[0])/(scalar(K.nn()[0]) - 1.0))); - scalar factor = pow3(l0/constant::math::twoPi); + scalar factor = pow3(l0/constant::mathematical::twoPi); y *= factor; diff --git a/src/randomProcesses/noise/noiseFFT.C b/src/randomProcesses/noise/noiseFFT.C index d843e871b72d97bdd38700b37e332aae3b645b68..73d177134014d4ccce2dfec26014c9cacf39774d 100644 --- a/src/randomProcesses/noise/noiseFFT.C +++ b/src/randomProcesses/noise/noiseFFT.C @@ -28,7 +28,7 @@ License #include "IFstream.H" #include "DynamicList.H" #include "fft.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "SubField.H" // * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * // @@ -170,7 +170,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Hanning(const label N) const scalar T = N*deltat_; - return 2*(0.5 - 0.5*cos(constant::math::twoPi*t/T)); + return 2*(0.5 - 0.5*cos(constant::mathematical::twoPi*t/T)); } diff --git a/src/randomProcesses/turbulence/turbGen.C b/src/randomProcesses/turbulence/turbGen.C index 6ac9c90804dab6e86a043e93e13d847f7800f6de..c129c1a0f0338084c74b277e8eac8f833a243b3c 100644 --- a/src/randomProcesses/turbulence/turbGen.C +++ b/src/randomProcesses/turbulence/turbGen.C @@ -29,7 +29,7 @@ License #include "Kmesh.H" #include "primitiveFields.H" #include "Ek.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,8 +70,8 @@ vectorField turbGen::U() complexVectorField up = fft::reverseTransform ( - ComplexField(cos(constant::math::twoPi*rndPhases)*s, - sin(constant::math::twoPi*rndPhases)*s), + ComplexField(cos(constant::mathematical::twoPi*rndPhases)*s, + sin(constant::mathematical::twoPi*rndPhases)*s), K.nn() ); diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index 252bfbde1b4d8675175ccd87a78780e3515c0e7c..42f3ec841d08730c21648297fc46d1bc78c2b8fc 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -33,6 +33,7 @@ License #include "constants.H" using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -84,7 +85,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField patch().lookupPatchField<volScalarField, scalar>(TName_); refValue() = - emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/math::pi; + emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/pi; refGrad() = 0.0; @@ -199,9 +200,7 @@ updateCoeffs() ( Ir*(1.0 - emissivity_) + emissivity_*physicoChemical::sigma.value()*pow4(Tp[faceI]) - ) - /constant::math::pi; - + )/pi; } else { diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index 6201dc66ed12a003f527a45fe5ec57b52301071c..a0a83e9e843d37a36a83f01dc6f6b4d3164e19d2 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -34,6 +34,7 @@ License #include "constants.H" using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -85,7 +86,7 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField patch().lookupPatchField<volScalarField, scalar>(TName_); refValue() = - emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/math::pi; + emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/pi; refGrad() = 0.0; if (dict.found("value")) @@ -197,8 +198,7 @@ updateCoeffs() ( Ir*(1.0 - emissivity_) + emissivity_*Eb[faceI] - ) - /math::pi; + )/pi; } else { diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C index eeec89cef8fc178dfe5cec174c300a3a159976a9..041d0f7b007d701294ddf20723f5bb4ae6925b01 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C @@ -99,7 +99,7 @@ void Foam::radiation::absorptionCoeffs::initialise(const dictionary& dict) { dict.lookup("Tcommon") >> Tcommon_; dict.lookup("Tlow") >> Tlow_; - dict.lookup("Tlow") >> Thigh_; + dict.lookup("Thigh") >> Thigh_; dict.lookup("invTemp") >> invTemp_; dict.lookup("loTcoeffs") >> lowACoeffs_; diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C index 81f8457ba4606ef70acb9748aca658ec28c5a9a1..d57b13866abe422a195317116896fe86512b86a6 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C @@ -26,13 +26,13 @@ License #include "fvDOM.H" #include "addToRunTimeSelectionTable.H" -#include "fvm.H" #include "absorptionEmissionModel.H" #include "scatterModel.H" #include "constants.H" using namespace Foam::constant; +using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -65,7 +65,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh_, dimensionedScalar("G", dimMass/pow3(dimTime), 0.0) @@ -136,8 +136,8 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) { nRay_ = 4*nPhi_*nTheta_; IRay_.setSize(nRay_); - scalar deltaPhi = math::pi/(2.0*nPhi_); - scalar deltaTheta = math::pi/nTheta_; + scalar deltaPhi = pi/(2.0*nPhi_); + scalar deltaTheta = pi/nTheta_; label i = 0; for (label n = 1; n <= nTheta_; n++) { @@ -169,11 +169,11 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) { if (mesh_.nSolutionD() == 2) //2D (X & Y) { - scalar thetai = math::piByTwo; - scalar deltaTheta = math::pi; + scalar thetai = piByTwo; + scalar deltaTheta = pi; nRay_ = 4*nPhi_; IRay_.setSize(nRay_); - scalar deltaPhi = math::pi/(2.0*nPhi_); + scalar deltaPhi = pi/(2.0*nPhi_); label i = 0; for (label m = 1; m <= 4*nPhi_; m++) { @@ -199,11 +199,11 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) } else //1D (X) { - scalar thetai = math::piByTwo; - scalar deltaTheta = math::pi; + scalar thetai = piByTwo; + scalar deltaTheta = pi; nRay_ = 2; IRay_.setSize(nRay_); - scalar deltaPhi = math::pi; + scalar deltaPhi = pi; label i = 0; for (label m = 1; m <= 2; m++) { @@ -347,7 +347,7 @@ Foam::radiation::fvDOM::Ru() const const DimensionedField<scalar, volMesh> a = a_.dimensionedInternalField(); //absorptionEmission_->aCont()() - return a*G - 4.0*E; + return a*G - E; } diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C index cb94ca5f9da71544d7d06787a85902d41fc546af..eac7274d2296945040845e462ea7aa2d17511b2b 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C @@ -27,12 +27,9 @@ License #include "radiativeIntensityRay.H" #include "fvm.H" #include "fvDOM.H" +#include "constants.H" -#include "absorptionEmissionModel.H" -#include "scatterModel.H" -#include "mathConstants.H" -#include "radiationModel.H" -#include "Vector2D.H" +using namespace Foam::constant; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -202,9 +199,9 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct() fvm::div(Ji, ILambda_[lambdaI], "div(Ji,Ii_h)") + fvm::Sp(k*omega_, ILambda_[lambdaI]) == - 1.0/constant::math::pi + 1.0/constant::mathematical::pi*omega_ *( - k*omega_*blackBody_.bLambda(lambdaI) + k*blackBody_.bLambda(lambdaI) + absorptionEmission_.ECont(lambdaI) ) ); diff --git a/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C b/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C index a5c27adac8a13d54dff0f8908ebdb8d8c850cff4..90c7887d71415470185bb07275961c6760845310 100644 --- a/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C @@ -43,19 +43,19 @@ autoPtr<radiationModel> radiationModel::New { word radiationModelTypeName; - // Enclose the creation of the radiationPropertiesDict to ensure it is - // deleted before the radiationModel is created otherwise the dictionary - // is entered in the database twice + // Note: no need to register/keep radiationProperties since models read + // it themselves. { IOdictionary radiationPropertiesDict ( IOobject ( "radiationProperties", - T.mesh().time().constant(), - T.mesh().objectRegistry::db(), + T.time().constant(), + T.mesh(), IOobject::MUST_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + false ) ); diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C index cdb57c0f5397ea63334fca60594b9595c4df2493..6204188f1aa045c098c7516b435a63cb548fbb76 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C @@ -259,10 +259,11 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const ) ); - if (mesh_.foundObject<volScalarField>("hrr")) + if (mesh_.foundObject<volScalarField>("dQ")) { - const volScalarField& hrr = mesh_.lookupObject<volScalarField>("hrr"); - E().internalField() = EhrrCoeff_*hrr.internalField(); + const volScalarField& dQ = + mesh_.lookupObject<volScalarField>("dQ"); + E().internalField() = EhrrCoeff_*dQ; } return E; diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index 22f4da24b3e31445d46ee80963dc7419bb016d75..4e5a8c0116ebd22d2c01c6cf5d7b3968ac5036f2 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -26,7 +26,7 @@ License #include "interfaceProperties.H" #include "alphaContactAngleFvPatchScalarField.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" #include "surfaceInterpolate.H" #include "fvcDiv.H" #include "fvcGrad.H" @@ -35,7 +35,7 @@ License // * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * // const Foam::scalar Foam::interfaceProperties::convertToRad = - Foam::constant::math::pi/180.0; + Foam::constant::mathematical::pi/180.0; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C index 2d3981fdde590b28396716f44f9c5fdc195072d2..52a358f53207abe4be4db19a38d70155ae314a4a 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C @@ -215,6 +215,8 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField tmp<scalarField> turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const { + const fvMesh& mesh = patch().boundaryMesh().mesh(); + if (KName_ == "none") { const compressible::RASModel& model = @@ -227,13 +229,34 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const return talpha().boundaryField()[patch().index()] - *thermo.rho()().boundaryField()[patch().index()] *thermo.Cp()().boundaryField()[patch().index()]; } - else + else if (mesh.objectRegistry::foundObject<volScalarField>(KName_)) { return patch().lookupPatchField<volScalarField, scalar>(KName_); } + else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_)) + { + const symmTensorField& KWall = + patch().lookupPatchField<volSymmTensorField, scalar>(KName_); + + vectorField n = patch().nf(); + + return n & KWall & n; + } + else + { + FatalErrorIn + ( + "turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const" + ) << "Did not find field " << KName_ + << " on mesh " << mesh.name() << " patch " << patch().name() + << endl + << "Please set 'K' to 'none', a valid volScalarField" + << " or a valid volSymmTensorField." << exit(FatalError); + + return scalarField(0); + } } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C index 67353e43198075d5c553e33f66fbd1ca96d2fd84..3452692f0e661a607f40f639046f68089f2b9541 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C @@ -77,7 +77,7 @@ tmp<scalarField> mutkRoughWallFunctionFvPatchScalarField::calcMut() const const scalar Cmu25 = pow025(Cmu_); - tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0)); + tmp<scalarField> tmutw(new scalarField(*this)); scalarField& mutw = tmutw(); forAll(mutw, faceI) diff --git a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C index 0e955075eb6c953943692015d5d27ac163980e6c..f6d778b3a6f68b8762725a8c798bc3c0f926bc56 100644 --- a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C +++ b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C @@ -195,7 +195,7 @@ NonlinearKEShih::NonlinearKEShih Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), fEta_(A2_ + pow(eta_, 3.0)), - nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)), + nut_("nut", Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)), nonlinearStress_ ( @@ -318,9 +318,12 @@ void NonlinearKEShih::correct() // generation term volScalarField S2 = symm(gradU_) && gradU_; - volScalarField G = + volScalarField G + ( + "RASModel::G", Cmu_*sqr(k_)/epsilon_*S2 - - (nonlinearStress_ && gradU_); + - (nonlinearStress_ && gradU_) + ); #include "nonLinearWallFunctionsI.H" diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C index fdd5428a711884cd37865034e77ba51c266adfd2..ce9fe5465ad089598082cef5e807ea99c90eb9d4 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C @@ -76,7 +76,7 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const const scalar Cmu25 = pow025(Cmu_); - tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0)); + tmp<scalarField> tnutw(new scalarField(*this)); scalarField& nutw = tnutw(); forAll(nutw, faceI) diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C index 82454b8c2eb37ac89d03e5c9f197352672619533..bd5f890ee59e8d2f81cca253dc538182dc089117 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C +++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C @@ -43,7 +43,7 @@ Description #include "cellShape.H" #include "cellModeller.H" #include "mergePoints.H" -#include "mathConstants.H" +#include "mathematicalConstants.H" using namespace Foam; @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) fileName pointsFile(runTime.constantPath()/"points.tmp"); OFstream pFile(pointsFile); - scalar a(0.1*constant::math::pi/180.0); + scalar a(degToRad(0.1)); tensor rotateZ = tensor ( diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict index 06c058e8c887ad29006279feef95e813443366d4..da7c7d77e5485b16666cbb2d6053b31cdc440280 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict @@ -86,7 +86,7 @@ dictionaryReplacement } bottomAir_to_leftSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -94,14 +94,14 @@ dictionaryReplacement } bottomAir_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } bottomAir_to_rightSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict index e91d96d9f1dce4a97546bf95c5fb157798779f31..ab50e9946cb7db34c92bcb59fe35d9ede97f7285 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -71,7 +71,7 @@ dictionaryReplacement heater_to_bottomAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -79,21 +79,21 @@ dictionaryReplacement } heater_to_leftSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } heater_to_rightSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } heater_to_topAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index 791a67a8a80a960bd4ca753e84ded349a52ccb90..6e31fefd3edde5988d4d2aec8821c9b267d19cd4 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -61,7 +61,7 @@ dictionaryReplacement } leftSolid_to_bottomAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -69,14 +69,14 @@ dictionaryReplacement } leftSolid_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } leftSolid_to_topAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index 0e7a58677e276e424307546467cf64cffc89a5fb..01590a2df909bc074c0e2d79e6fb742cb519bb8e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -61,21 +61,21 @@ dictionaryReplacement } rightSolid_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } rightSolid_to_bottomAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } rightSolid_to_topAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict index 0af97aeb99b61c5c89fde9cde2e27ab2e76d3bda..8c8d6158784556334c0b95330c153d4a2101c5d7 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict @@ -87,7 +87,7 @@ dictionaryReplacement } topAir_to_leftSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -95,14 +95,14 @@ dictionaryReplacement } topAir_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } topAir_to_rightSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict index f384c1c8f492aa1f5e1c4789958d3a9ce5bd3dc5..b00a478194fa9fb3077bb2f637cef6a13b9822d6 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict @@ -120,21 +120,21 @@ dictionaryReplacement } bottomAir_to_leftSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } bottomAir_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } bottomAir_to_rightSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict index e91d96d9f1dce4a97546bf95c5fb157798779f31..ab50e9946cb7db34c92bcb59fe35d9ede97f7285 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict @@ -71,7 +71,7 @@ dictionaryReplacement heater_to_bottomAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -79,21 +79,21 @@ dictionaryReplacement } heater_to_leftSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } heater_to_rightSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } heater_to_topAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict index 791a67a8a80a960bd4ca753e84ded349a52ccb90..6e31fefd3edde5988d4d2aec8821c9b267d19cd4 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict @@ -61,7 +61,7 @@ dictionaryReplacement } leftSolid_to_bottomAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -69,14 +69,14 @@ dictionaryReplacement } leftSolid_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } leftSolid_to_topAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict index 0e7a58677e276e424307546467cf64cffc89a5fb..01590a2df909bc074c0e2d79e6fb742cb519bb8e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict @@ -61,21 +61,21 @@ dictionaryReplacement } rightSolid_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } rightSolid_to_bottomAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } rightSolid_to_topAir { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict index b247ad67ea91c1a68d066ccc55f3f5799a055a2c..0fb37c441020c85e25d70d233c986beaf709c5f9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict @@ -126,7 +126,7 @@ dictionaryReplacement } topAir_to_leftSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; @@ -134,14 +134,14 @@ dictionaryReplacement } topAir_to_heater { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; } topAir_to_rightSolid { - type turbulentTemperatureCoupledBaffle; + type compressible::turbulentTemperatureCoupledBaffle; neighbourFieldName T; K K; value uniform 300; diff --git a/tutorials/mesh/snappyHexMesh/Allrun b/tutorials/mesh/snappyHexMesh/Allrun index 13813aeae70925c9dd2eaf0e2a50272fbbf1ce7d..90979fcb05013ab6b317c207cd1dee788860bb93 100755 --- a/tutorials/mesh/snappyHexMesh/Allrun +++ b/tutorials/mesh/snappyHexMesh/Allrun @@ -1,2 +1,9 @@ -# These cases are links to solver test cases and are run when the Allrun scripts of those solvers are run. -# This empty Allrun script avoids the meshing of theses cases to be run twice. +#!/bin/sh + +exit 0 + +# These cases are links to solver test cases and are run when the Allrun +# scripts of those solvers are run. + +# This dummy Allrun script avoids meshing these cases twice. + diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..2cd0673fdd5e684d4862ad4f10019588b8c5d95a --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm system/cellSetDict > /dev/null 2>&1 +rm -rf 0 > /dev/null 2>&1 + +cleanCase + diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..1bece85bd98222c0358d809de9c9d3033aeda6c4 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun @@ -0,0 +1,27 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Set application name +application="interDyMFoam" + +makeMeshByCellSet() +{ + while [ $# -ge 1 ] + do + echo "Running cellSet operation $1" + cp system/cellSetDict.$1 system/cellSetDict + cellSet > log.cellSet.$1 2>&1 + shift + done +} + +runApplication blockMesh +makeMeshByCellSet 1 2 +runApplication subsetMesh -overwrite c0 -patch floatingObject +cp -r 0.orig 0 > /dev/null 2>&1 +runApplication setFields +runApplication $application + +# ----------------------------------------------------------------------------- diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..81b1ec9115226882e6e980b8e5f4e19cabb886d9 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..083baf725a14ecb9787708faf739d7e859f6172e --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict @@ -0,0 +1,26 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object motionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMotionSolverFvMesh; + +motionSolverLibs ("libfvMotionSolvers.so"); + +solver displacementLaplacian; + +diffusivity inverseDistance (floatingObject); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..317bdd50defb2d1a2717ce5c7b4467cf9fd14264 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..611466bb780fc9e54585ddbdbe160ad492fde813 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 1) + (1 0 1) + (1 1 1) + (0 1 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (40 40 60) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + wall stationaryWalls + ( + (0 3 2 1) + (2 6 5 1) + (1 5 4 0) + (3 7 6 2) + (0 4 7 3) + ) + patch atmosphere + ( + (4 5 6 7) + ) + wall floatingObject + () +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..62fd629b04d8486450a703d16f705cc5a0a987ac --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +3 +( + stationaryWalls + { + type wall; + nFaces 11200; + startFace 277808; + } + atmosphere + { + type patch; + nFaces 1600; + startFace 289008; + } + floatingObject + { + type wall; + nFaces 672; + startFace 290608; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..6a2e70e1c4280ebd53d4ada91293b41d817271f6 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 998.2; +} + +phase2 +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e94c3c747331a9df223b57641173f3f8e8185a15 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 new file mode 100644 index 0000000000000000000000000000000000000000..90a225e6a9a91a84eb563e3ddfb54503a4b4d8d7 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object cellSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name c0; + +action new; + +topoSetSources +( + boxToCell + { + box (0.35 0.35 0.44) (0.65 0.65 0.56); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 new file mode 100644 index 0000000000000000000000000000000000000000..57cc0658f727238910e5a2351eae60f342221ff0 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object cellSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name c0; + +action invert; + +topoSetSources (); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..efcb76277a25448889bdf8fb1b57de9aebafba0c --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 6; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.025; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 12; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.2; + +maxDeltaT 0.025; + +libs ("libincompressibleRASModels.so" "libfvMotionSolvers.so"); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..2a513989c06496d892c421259c6312431ee03d23 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 2 2 1 ); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights ( 1 1 1 1 ); +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..aa863122a1cd30a7c93ca9c3061035a8b1d02568 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rho*phi,U) Gauss vanLeerV; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss vanLeer; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; + pcorr; + alpha; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..bbe6b39db4c5ac879a9d67cc11fad5888a0bcf90 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution @@ -0,0 +1,129 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + cellDisplacement + { + solver GAMG; + tolerance 1e-08; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pcorr + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-05; + relTol 0; + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nBottomSweeps 2; + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 1e-05; + relTol 0; + maxIter 100; + } + + p + { + solver GAMG; + tolerance 1e-08; + relTol 0.01; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pFinal + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 2e-09; + relTol 0; + nVcycles 2; + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 2e-09; + relTol 0; + maxIter 20; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } + + "(k|epsilon|R|nuTilda)" + { + $U; + tolerance 1e-08; + relTol 0; + } + +} + +PISO +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + nAlphaCorr 1; + nAlphaSubCycles 1; + cAlpha 1.5; + correctPhi no; +} + +relaxationFactors +{ + U 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..3565b89deede7023901256fb0f38769f5094019c --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha1 0 +); + +regions +( + boxToCell + { + box ( -100 -100 -100 ) ( 100 100 0.5368 ); + fieldValues ( volScalarFieldValue alpha1 1 ); + } + + boxToCell + { + box ( 0.7 0.8 -100 ) ( 100 100 0.65 ); + fieldValues ( volScalarFieldValue alpha1 1 ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/U b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/U new file mode 100644 index 0000000000000000000000000000000000000000..a1abb4874af6b1f8edd6e8ecd5344cd643f3cf5e --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/U @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + walls + { + type movingWallVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/alpha1.org b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/alpha1.org new file mode 100644 index 0000000000000000000000000000000000000000..fbbc61ac18ab37928e7755f25d050e956bf28f39 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/alpha1.org @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/p b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/p new file mode 100644 index 0000000000000000000000000000000000000000..dd16aa2b670d12ba08f55fbf4b8e1ced78409351 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/0/p @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type buoyantPressure; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/Allclean b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..069278e17c3f8291ab35612a969daf394bd41af5 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/Allclean @@ -0,0 +1,4 @@ +#!/bin/sh + +foamCleanTutorials cases +rm -rf 0/alpha1.gz diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/Allrun b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..aaf67a1250f3004b76290d95eaf7f5a2bc272dc8 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/Allrun @@ -0,0 +1,8 @@ +#!/bin/sh +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +cp 0/alpha1.org 0/alpha1 +runApplication setFields +runApplication interDyMFoam diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/RASProperties b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..daec182999be86b671bedf5742629f973ceefb51 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel laminar; + +turbulence off; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..7ea26f21d34db111852d5e0ae0b97739cfc8f703 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh solidBodyMotionFvMesh; + +solidBodyMotionFvMeshCoeffs +{ + solidBodyMotionFunction multiMotion; + + multiMotionCoeffs + { + // Table rotating in z axis + rotatingTable + { + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + CofG (0 0.1 0); + radialVelocity (0 0 360); // degrees/s + } + } + + //// Box rotates on rotating table + //rotatingBox + //{ + // solidBodyMotionFunction rotatingMotion; + // rotatingMotionCoeffs + // { + // CofG (0 0 0); + // radialVelocity (720 0 0); // degrees/s + // } + //} + // Tube rocking on rotating table + rotatingBox + { + solidBodyMotionFunction oscillatingRotatingMotion; + oscillatingRotatingMotionCoeffs + { + CofG (0 0 0); + omega 40; // rad/s + amplitude (45 0 0); // 45 degrees max tilt + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/g b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..317bdd50defb2d1a2717ce5c7b4467cf9fd14264 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/polyMesh/blockMeshDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..ed9075c3ac5c9b96088110e814a61e8b83a2fd06 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/polyMesh/blockMeshDict @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.01; + +vertices +( + (-0.5 -5 -0.5) + ( 0.5 -5 -0.5) + ( 0.5 5 -0.5) + (-0.5 5 -0.5) + (-0.5 -5 0.5) + ( 0.5 -5 0.5) + ( 0.5 5 0.5) + (-0.5 5 0.5) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (5 50 5) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + wall walls + ( + (3 7 6 2) + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + (0 3 2 1) + (4 5 6 7) + ) +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/transportProperties b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..6a2e70e1c4280ebd53d4ada91293b41d817271f6 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/transportProperties @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 998.2; +} + +phase2 +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/turbulenceProperties b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..9cfc50a3d927937cf2ce96c64d3c9d6bd3144e2c --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/controlDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..8c4c00f816fdd2d5b610dd310ddd0cd0ef453b77 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/controlDict @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1; + +deltaT 0.0001; + +writeControl adjustableRunTime; + +writeInterval 0.01; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression compressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; + +maxDeltaT 1; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/decomposeParDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..9cbe72150147e49c283d8042b5924dc143772efd --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/decomposeParDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 16; + +method hierarchical; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 4 2 2 ); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights ( 1 1 1 1 ); +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSchemes b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..7c651353ff5bd2258bf2350fa720c3bb622eab32 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSchemes @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rho*phi,U) Gauss vanLeerV; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss vanLeer; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; + pcorr; + alpha; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..ee41a9bc7361aab5d200decd7e87d442cd543a61 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution @@ -0,0 +1,112 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + pcorr + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-05; + relTol 0; + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nBottomSweeps 2; + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 1e-05; + relTol 0; + maxIter 100; + } + + p + { + solver GAMG; + tolerance 1e-08; + relTol 0.01; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pFinal + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 2e-09; + relTol 0; + nVcycles 2; + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 2e-09; + relTol 0; + maxIter 20; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } +} + +PISO +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + nAlphaCorr 1; + nAlphaSubCycles 3; + cAlpha 1.5; + correctPhi no; + + pRefPoint (0.0013 0.0017 0.0017); + pRefValue 1e5; +} + +relaxationFactors +{ + U 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..106b12faa2132793f9dc1876cb86da8423dbe44f --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha1 0 +); + +regions +( + boxToCell + { + box ( -100 -100 -100 ) ( 100 100 -0.0025); + fieldValues ( volScalarFieldValue alpha1 1 ); + } +); + + +// ************************************************************************* // diff --git a/wmake/rules/linux64Gcc/mplibMPICH b/wmake/rules/linux64Gcc/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linux64Gcc/mplibMPICH +++ b/wmake/rules/linux64Gcc/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linux64Gcc42/mplibMPICH b/wmake/rules/linux64Gcc42/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linux64Gcc42/mplibMPICH +++ b/wmake/rules/linux64Gcc42/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linux64Gcc43/mplibMPICH b/wmake/rules/linux64Gcc43/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linux64Gcc43/mplibMPICH +++ b/wmake/rules/linux64Gcc43/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linux64Gcc44/mplibMPICH b/wmake/rules/linux64Gcc44/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linux64Gcc44/mplibMPICH +++ b/wmake/rules/linux64Gcc44/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linux64Icc/mplibMPICH b/wmake/rules/linux64Icc/mplibMPICH index ac17f7c1d2e2665b7372df09fb3fee4d95b85511..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linux64Icc/mplibMPICH +++ b/wmake/rules/linux64Icc/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxGcc/mplibMPICH b/wmake/rules/linuxGcc/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxGcc/mplibMPICH +++ b/wmake/rules/linuxGcc/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxGcc42/mplibMPICH b/wmake/rules/linuxGcc42/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxGcc42/mplibMPICH +++ b/wmake/rules/linuxGcc42/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxGcc43/mplibMPICH b/wmake/rules/linuxGcc43/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxGcc43/mplibMPICH +++ b/wmake/rules/linuxGcc43/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxGcc44/mplibMPICH b/wmake/rules/linuxGcc44/mplibMPICH index cb628e1117e552a394ffdedd8fff5623c7ec578f..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxGcc44/mplibMPICH +++ b/wmake/rules/linuxGcc44/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxIA64Gcc/mplibMPICH b/wmake/rules/linuxIA64Gcc/mplibMPICH index ac17f7c1d2e2665b7372df09fb3fee4d95b85511..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxIA64Gcc/mplibMPICH +++ b/wmake/rules/linuxIA64Gcc/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxIA64Icc/mplibMPICH b/wmake/rules/linuxIA64Icc/mplibMPICH index ac17f7c1d2e2665b7372df09fb3fee4d95b85511..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxIA64Icc/mplibMPICH +++ b/wmake/rules/linuxIA64Icc/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt diff --git a/wmake/rules/linuxIcc/mplibMPICH b/wmake/rules/linuxIcc/mplibMPICH index ac17f7c1d2e2665b7372df09fb3fee4d95b85511..e5a38a8e38159982f4dcbbfd745e9246f343673a 100644 --- a/wmake/rules/linuxIcc/mplibMPICH +++ b/wmake/rules/linuxIcc/mplibMPICH @@ -1,3 +1,3 @@ -PFLAGS = +PFLAGS = -DMPICH_SKIP_MPICXX PINC = -I$(MPI_ARCH_PATH)/include PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpich -lrt