mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote branch 'OpenCFD/master' into olesenm
Conflicts: applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C applications/utilities/surface/surfaceCheck/surfaceCheck.C src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C NOTE: also needed to strip trailing space/lines in various files
This commit is contained in:
@ -184,6 +184,8 @@
|
|||||||
+ =setSet=: allows time range (e.g. 0:100) in combination with -batch argument
|
+ =setSet=: allows time range (e.g. 0:100) in combination with -batch argument
|
||||||
to execute the commands for multiple times.
|
to execute the commands for multiple times.
|
||||||
* Post-processing
|
* Post-processing
|
||||||
|
+ =paraFoam=, =foamToVTK=: full support for polyhedral cell type in recent
|
||||||
|
Paraview versions.
|
||||||
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
|
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
|
||||||
field data.
|
field data.
|
||||||
+ =singleCellMesh=: new utility to convert mesh and fields to a single cell
|
+ =singleCellMesh=: new utility to convert mesh and fields to a single cell
|
||||||
|
|||||||
@ -27,6 +27,7 @@ PDRModels/XiGModels/basicXiSubG/basicXiSubG.C
|
|||||||
|
|
||||||
laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C
|
laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C
|
||||||
|
|
||||||
|
/* PDRFoamAutoRefine.C */
|
||||||
PDRFoam.C
|
PDRFoam.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/PDRFoam
|
EXE = $(FOAM_APPBIN)/PDRFoam
|
||||||
|
|||||||
@ -25,8 +25,8 @@ Application
|
|||||||
PDRFoam
|
PDRFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Compressible premixed/partially-premixed combustion solver with turbulence
|
Solver for compressible premixed/partially-premixed combustion with
|
||||||
modelling.
|
turbulence modelling.
|
||||||
|
|
||||||
Combusting RANS code using the b-Xi two-equation model.
|
Combusting RANS code using the b-Xi two-equation model.
|
||||||
Xi may be obtained by either the solution of the Xi transport
|
Xi may be obtained by either the solution of the Xi transport
|
||||||
@ -35,7 +35,7 @@ Description
|
|||||||
to be appropriate by comparison with the results from the
|
to be appropriate by comparison with the results from the
|
||||||
spectral model.
|
spectral model.
|
||||||
|
|
||||||
Strain effects are encorporated directly into the Xi equation
|
Strain effects are incorporated directly into the Xi equation
|
||||||
but not in the algebraic approximation. Further work need to be
|
but not in the algebraic approximation. Further work need to be
|
||||||
done on this issue, particularly regarding the enhanced removal rate
|
done on this issue, particularly regarding the enhanced removal rate
|
||||||
caused by flame compression. Analysis using results of the spectral
|
caused by flame compression. Analysis using results of the spectral
|
||||||
@ -78,9 +78,9 @@ int main(int argc, char *argv[])
|
|||||||
#include "readCombustionProperties.H"
|
#include "readCombustionProperties.H"
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "readPISOControls.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
|
#include "CourantNo.H"
|
||||||
#include "setInitialDeltaT.H"
|
#include "setInitialDeltaT.H"
|
||||||
|
|
||||||
scalar StCoNum = 0.0;
|
scalar StCoNum = 0.0;
|
||||||
@ -94,7 +94,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
#include "readPISOControls.H"
|
#include "readPISOControls.H"
|
||||||
#include "CourantNo.H"
|
#include "CourantNo.H"
|
||||||
|
|
||||||
#include "setDeltaT.H"
|
#include "setDeltaT.H"
|
||||||
|
|
||||||
runTime++;
|
runTime++;
|
||||||
|
|||||||
@ -185,7 +185,7 @@ int main(int argc, char *argv[])
|
|||||||
+ aSf*p_pos - aSf*p_neg
|
+ aSf*p_pos - aSf*p_neg
|
||||||
);
|
);
|
||||||
|
|
||||||
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
|
volTensorField tauMC("tauMC", mu*dev2(Foam::T(fvc::grad(U))));
|
||||||
|
|
||||||
// --- Solve density
|
// --- Solve density
|
||||||
Info<< max(rho) << " " << min(rho) << endl;
|
Info<< max(rho) << " " << min(rho) << endl;
|
||||||
|
|||||||
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
|||||||
+ aSf*p_pos - aSf*p_neg
|
+ aSf*p_pos - aSf*p_neg
|
||||||
);
|
);
|
||||||
|
|
||||||
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
|
volTensorField tauMC("tauMC", mu*dev2(Foam::T(fvc::grad(U))));
|
||||||
|
|
||||||
// --- Solve density
|
// --- Solve density
|
||||||
solve(fvm::ddt(rho) + fvc::div(phi));
|
solve(fvm::ddt(rho) + fvc::div(phi));
|
||||||
|
|||||||
@ -5,6 +5,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
tmp<volScalarField> trho = thermo.rho();
|
tmp<volScalarField> trho = thermo.rho();
|
||||||
const volScalarField& rho = trho();
|
const volScalarField& rho = trho();
|
||||||
|
|
||||||
tmp<volScalarField> tcp = thermo.cp();
|
tmp<volScalarField> tcp = thermo.Cp();
|
||||||
const volScalarField& cp = tcp();
|
const volScalarField& cp = tcp();
|
||||||
|
|
||||||
tmp<volScalarField> tK = thermo.K();
|
tmp<volScalarField> tK = thermo.K();
|
||||||
|
|||||||
@ -4,11 +4,12 @@
|
|||||||
tmp<volScalarField> trho = thermo.rho();
|
tmp<volScalarField> trho = thermo.rho();
|
||||||
const volScalarField& rho = trho();
|
const volScalarField& rho = trho();
|
||||||
|
|
||||||
tmp<volScalarField> tcp = thermo.cp();
|
tmp<volScalarField> tcp = thermo.Cp();
|
||||||
const volScalarField& cp = tcp();
|
const volScalarField& cp = tcp();
|
||||||
|
|
||||||
tmp<volScalarField> tK = thermo.K();
|
tmp<volScalarField> tK = thermo.K();
|
||||||
//tmp<volSymmTensorField> tK = thermo.directionalK();
|
//tmp<volSymmTensorField> tK = thermo.directionalK();
|
||||||
const volScalarField& K = tK();
|
const volScalarField& K = tK();
|
||||||
|
//const volSymmTensorField& K = tK();
|
||||||
|
|
||||||
volScalarField& T = thermo.T();
|
volScalarField& T = thermo.T();
|
||||||
|
|||||||
@ -57,4 +57,35 @@ Foam::scalar Foam::solidRegionDiffNo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar Foam::solidRegionDiffNo
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const Time& runTime,
|
||||||
|
const volScalarField& Cprho,
|
||||||
|
const volSymmTensorField& Kdirectional
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar DiNum = 0.0;
|
||||||
|
scalar meanDiNum = 0.0;
|
||||||
|
|
||||||
|
volScalarField K = mag(Kdirectional);
|
||||||
|
|
||||||
|
//- Take care: can have fluid domains with 0 cells so do not test for
|
||||||
|
// zero internal faces.
|
||||||
|
surfaceScalarField KrhoCpbyDelta =
|
||||||
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
|
* fvc::interpolate(K)
|
||||||
|
/ fvc::interpolate(Cprho);
|
||||||
|
|
||||||
|
DiNum = gMax(KrhoCpbyDelta.internalField())*runTime.deltaT().value();
|
||||||
|
|
||||||
|
meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
|
||||||
|
|
||||||
|
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
|
||||||
|
<< " max: " << DiNum << endl;
|
||||||
|
|
||||||
|
return DiNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -41,6 +41,15 @@ namespace Foam
|
|||||||
const volScalarField& Cprho,
|
const volScalarField& Cprho,
|
||||||
const volScalarField& K
|
const volScalarField& K
|
||||||
);
|
);
|
||||||
|
|
||||||
|
scalar solidRegionDiffNo
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const Time& runTime,
|
||||||
|
const volScalarField& Cprho,
|
||||||
|
const volSymmTensorField& K
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -18,6 +18,8 @@ if (finalIter)
|
|||||||
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thermo.correct();
|
||||||
|
|
||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data::remove("finalIteration");
|
mesh.data::remove("finalIteration");
|
||||||
|
|||||||
@ -10,8 +10,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
@ -33,8 +33,8 @@ EXE_LIBS = \
|
|||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
-lliquids \
|
-lliquids \
|
||||||
-lliquidMixture \
|
-lliquidMixture \
|
||||||
-lsolids \
|
-lpointSolids \
|
||||||
-lsolidMixture \
|
-lpointSolidMixture \
|
||||||
-lthermophysicalFunctions \
|
-lthermophysicalFunctions \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
|
|||||||
@ -10,8 +10,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
@ -32,8 +32,8 @@ EXE_LIBS = \
|
|||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
-lliquids \
|
-lliquids \
|
||||||
-lliquidMixture \
|
-lliquidMixture \
|
||||||
-lsolids \
|
-lpointSolids \
|
||||||
-lsolidMixture \
|
-lpointSolidMixture \
|
||||||
-lthermophysicalFunctions \
|
-lthermophysicalFunctions \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
|
|||||||
@ -5,8 +5,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||||
@ -26,8 +26,8 @@ EXE_LIBS = \
|
|||||||
-lcompressibleLESModels \
|
-lcompressibleLESModels \
|
||||||
-lspecie \
|
-lspecie \
|
||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
-lsolids \
|
-lpointSolids \
|
||||||
-lsolidMixture \
|
-lpointSolidMixture \
|
||||||
-lthermophysicalFunctions \
|
-lthermophysicalFunctions \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
|
|||||||
@ -9,8 +9,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
@ -31,8 +31,8 @@ EXE_LIBS = \
|
|||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
-lliquids \
|
-lliquids \
|
||||||
-lliquidMixture \
|
-lliquidMixture \
|
||||||
-lsolids \
|
-lpointSolids \
|
||||||
-lsolidMixture \
|
-lpointSolidMixture \
|
||||||
-lthermophysicalFunctions \
|
-lthermophysicalFunctions \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
|
|||||||
@ -10,8 +10,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
@ -32,8 +32,8 @@ EXE_LIBS = \
|
|||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
-lliquids \
|
-lliquids \
|
||||||
-lliquidMixture \
|
-lliquidMixture \
|
||||||
-lsolids \
|
-lpointSolids \
|
||||||
-lsolidMixture \
|
-lpointSolidMixture \
|
||||||
-lthermophysicalFunctions \
|
-lthermophysicalFunctions \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
|
|||||||
@ -218,7 +218,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
|
|||||||
// The solution is higly unstable close to the packing limit.
|
// The solution is higly unstable close to the packing limit.
|
||||||
gs0_ = radialModel_->g0
|
gs0_ = radialModel_->g0
|
||||||
(
|
(
|
||||||
min(max(alpha_, 1e-6), alphaMax_ - 0.01),
|
min(max(alpha_, scalar(1e-6)), alphaMax_ - 0.01),
|
||||||
alphaMax_
|
alphaMax_
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
|
|||||||
volScalarField J2
|
volScalarField J2
|
||||||
(
|
(
|
||||||
0.25*sqr(betaPrim)*da_*sqr(Ur)
|
0.25*sqr(betaPrim)*da_*sqr(Ur)
|
||||||
/ (max(alpha_, 1e-6)*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt))
|
/(max(alpha_, scalar(1e-6))*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt))
|
||||||
);
|
);
|
||||||
|
|
||||||
// bulk viscosity p. 45 (Lun et al. 1984).
|
// bulk viscosity p. 45 (Lun et al. 1984).
|
||||||
@ -321,7 +321,13 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
|
|||||||
volScalarField t1(K1*alpha_ + rhoa_);
|
volScalarField t1(K1*alpha_ + rhoa_);
|
||||||
volScalarField l1(-t1*trD);
|
volScalarField l1(-t1*trD);
|
||||||
volScalarField l2(sqr(t1)*tr2D);
|
volScalarField l2(sqr(t1)*tr2D);
|
||||||
volScalarField l3(4.0*K4*max(alpha_, 1e-6)*(2.0*K3*trD2 + K2*tr2D));
|
volScalarField l3
|
||||||
|
(
|
||||||
|
4.0
|
||||||
|
*K4
|
||||||
|
*max(alpha_, scalar(1e-6))
|
||||||
|
*(2.0*K3*trD2 + K2*tr2D)
|
||||||
|
);
|
||||||
|
|
||||||
Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4));
|
Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lmeshTools
|
-lmeshTools
|
||||||
|
|||||||
@ -26,180 +26,38 @@ Application
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Calculates the inertia tensor and principal axes and moments of a
|
Calculates the inertia tensor and principal axes and moments of a
|
||||||
test face and tetrahedron.
|
test face, tetrahedron and mesh.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetPointRef.H"
|
||||||
#include "triFaceList.H"
|
#include "triFaceList.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
|
#include "momentOfInertia.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
void massPropertiesSolid
|
|
||||||
(
|
|
||||||
const pointField& pts,
|
|
||||||
const triFaceList triFaces,
|
|
||||||
scalar density,
|
|
||||||
scalar& mass,
|
|
||||||
vector& cM,
|
|
||||||
tensor& J
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Reimplemented from: Wm4PolyhedralMassProperties.cpp
|
|
||||||
// File Version: 4.10.0 (2009/11/18)
|
|
||||||
|
|
||||||
// Geometric Tools, LC
|
|
||||||
// Copyright (c) 1998-2010
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt
|
|
||||||
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
|
|
||||||
|
|
||||||
// Boost Software License - Version 1.0 - August 17th, 2003
|
|
||||||
|
|
||||||
// Permission is hereby granted, free of charge, to any person or
|
|
||||||
// organization obtaining a copy of the software and accompanying
|
|
||||||
// documentation covered by this license (the "Software") to use,
|
|
||||||
// reproduce, display, distribute, execute, and transmit the
|
|
||||||
// Software, and to prepare derivative works of the Software, and
|
|
||||||
// to permit third-parties to whom the Software is furnished to do
|
|
||||||
// so, all subject to the following:
|
|
||||||
|
|
||||||
// The copyright notices in the Software and this entire
|
|
||||||
// statement, including the above license grant, this restriction
|
|
||||||
// and the following disclaimer, must be included in all copies of
|
|
||||||
// the Software, in whole or in part, and all derivative works of
|
|
||||||
// the Software, unless such copies or derivative works are solely
|
|
||||||
// in the form of machine-executable object code generated by a
|
|
||||||
// source language processor.
|
|
||||||
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
|
||||||
// NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
|
||||||
// ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
|
|
||||||
// OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
const scalar r6 = 1.0/6.0;
|
|
||||||
const scalar r24 = 1.0/24.0;
|
|
||||||
const scalar r60 = 1.0/60.0;
|
|
||||||
const scalar r120 = 1.0/120.0;
|
|
||||||
|
|
||||||
// order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx
|
|
||||||
scalarField integrals(10, 0.0);
|
|
||||||
|
|
||||||
forAll(triFaces, i)
|
|
||||||
{
|
|
||||||
const triFace& tri(triFaces[i]);
|
|
||||||
|
|
||||||
// vertices of triangle i
|
|
||||||
vector v0 = pts[tri[0]];
|
|
||||||
vector v1 = pts[tri[1]];
|
|
||||||
vector v2 = pts[tri[2]];
|
|
||||||
|
|
||||||
// cross product of edges
|
|
||||||
vector eA = v1 - v0;
|
|
||||||
vector eB = v2 - v0;
|
|
||||||
vector n = eA ^ eB;
|
|
||||||
|
|
||||||
// compute integral terms
|
|
||||||
scalar tmp0, tmp1, tmp2;
|
|
||||||
|
|
||||||
scalar f1x, f2x, f3x, g0x, g1x, g2x;
|
|
||||||
|
|
||||||
tmp0 = v0.x() + v1.x();
|
|
||||||
f1x = tmp0 + v2.x();
|
|
||||||
tmp1 = v0.x()*v0.x();
|
|
||||||
tmp2 = tmp1 + v1.x()*tmp0;
|
|
||||||
f2x = tmp2 + v2.x()*f1x;
|
|
||||||
f3x = v0.x()*tmp1 + v1.x()*tmp2 + v2.x()*f2x;
|
|
||||||
g0x = f2x + v0.x()*(f1x + v0.x());
|
|
||||||
g1x = f2x + v1.x()*(f1x + v1.x());
|
|
||||||
g2x = f2x + v2.x()*(f1x + v2.x());
|
|
||||||
|
|
||||||
scalar f1y, f2y, f3y, g0y, g1y, g2y;
|
|
||||||
|
|
||||||
tmp0 = v0.y() + v1.y();
|
|
||||||
f1y = tmp0 + v2.y();
|
|
||||||
tmp1 = v0.y()*v0.y();
|
|
||||||
tmp2 = tmp1 + v1.y()*tmp0;
|
|
||||||
f2y = tmp2 + v2.y()*f1y;
|
|
||||||
f3y = v0.y()*tmp1 + v1.y()*tmp2 + v2.y()*f2y;
|
|
||||||
g0y = f2y + v0.y()*(f1y + v0.y());
|
|
||||||
g1y = f2y + v1.y()*(f1y + v1.y());
|
|
||||||
g2y = f2y + v2.y()*(f1y + v2.y());
|
|
||||||
|
|
||||||
scalar f1z, f2z, f3z, g0z, g1z, g2z;
|
|
||||||
|
|
||||||
tmp0 = v0.z() + v1.z();
|
|
||||||
f1z = tmp0 + v2.z();
|
|
||||||
tmp1 = v0.z()*v0.z();
|
|
||||||
tmp2 = tmp1 + v1.z()*tmp0;
|
|
||||||
f2z = tmp2 + v2.z()*f1z;
|
|
||||||
f3z = v0.z()*tmp1 + v1.z()*tmp2 + v2.z()*f2z;
|
|
||||||
g0z = f2z + v0.z()*(f1z + v0.z());
|
|
||||||
g1z = f2z + v1.z()*(f1z + v1.z());
|
|
||||||
g2z = f2z + v2.z()*(f1z + v2.z());
|
|
||||||
|
|
||||||
// update integrals
|
|
||||||
integrals[0] += n.x()*f1x;
|
|
||||||
integrals[1] += n.x()*f2x;
|
|
||||||
integrals[2] += n.y()*f2y;
|
|
||||||
integrals[3] += n.z()*f2z;
|
|
||||||
integrals[4] += n.x()*f3x;
|
|
||||||
integrals[5] += n.y()*f3y;
|
|
||||||
integrals[6] += n.z()*f3z;
|
|
||||||
integrals[7] += n.x()*(v0.y()*g0x + v1.y()*g1x + v2.y()*g2x);
|
|
||||||
integrals[8] += n.y()*(v0.z()*g0y + v1.z()*g1y + v2.z()*g2y);
|
|
||||||
integrals[9] += n.z()*(v0.x()*g0z + v1.x()*g1z + v2.x()*g2z);
|
|
||||||
}
|
|
||||||
|
|
||||||
integrals[0] *= r6;
|
|
||||||
integrals[1] *= r24;
|
|
||||||
integrals[2] *= r24;
|
|
||||||
integrals[3] *= r24;
|
|
||||||
integrals[4] *= r60;
|
|
||||||
integrals[5] *= r60;
|
|
||||||
integrals[6] *= r60;
|
|
||||||
integrals[7] *= r120;
|
|
||||||
integrals[8] *= r120;
|
|
||||||
integrals[9] *= r120;
|
|
||||||
|
|
||||||
// mass
|
|
||||||
mass = integrals[0];
|
|
||||||
|
|
||||||
// center of mass
|
|
||||||
cM = vector(integrals[1], integrals[2], integrals[3])/mass;
|
|
||||||
|
|
||||||
// inertia relative to origin
|
|
||||||
J.xx() = integrals[5] + integrals[6];
|
|
||||||
J.xy() = -integrals[7];
|
|
||||||
J.xz() = -integrals[9];
|
|
||||||
J.yx() = J.xy();
|
|
||||||
J.yy() = integrals[4] + integrals[6];
|
|
||||||
J.yz() = -integrals[8];
|
|
||||||
J.zx() = J.xz();
|
|
||||||
J.zy() = J.yz();
|
|
||||||
J.zz() = integrals[4] + integrals[5];
|
|
||||||
|
|
||||||
// inertia relative to center of mass
|
|
||||||
J -= mass*((cM & cM)*I - cM*cM);
|
|
||||||
|
|
||||||
// Apply density
|
|
||||||
mass *= density;
|
|
||||||
J *= density;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"cell",
|
||||||
|
"label",
|
||||||
|
"cell to use for inertia calculation, defaults to 0"
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createPolyMesh.H"
|
||||||
|
|
||||||
scalar density = 1.0;
|
scalar density = 1.0;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -286,16 +144,7 @@ int main(int argc, char *argv[])
|
|||||||
vector cM = vector::zero;
|
vector cM = vector::zero;
|
||||||
tensor J = tensor::zero;
|
tensor J = tensor::zero;
|
||||||
|
|
||||||
massPropertiesSolid
|
momentOfInertia::massPropertiesSolid(pts, tetFaces, density, m, cM, J);
|
||||||
(
|
|
||||||
|
|
||||||
pts,
|
|
||||||
tetFaces,
|
|
||||||
density,
|
|
||||||
m,
|
|
||||||
cM,
|
|
||||||
J
|
|
||||||
);
|
|
||||||
|
|
||||||
vector eVal = eigenValues(J);
|
vector eVal = eigenValues(J);
|
||||||
|
|
||||||
@ -344,7 +193,50 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
str << "l " << nPts + 1 << ' ' << i + 1 << endl;
|
str << "l " << nPts + 1 << ' ' << i + 1 << endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const label cellI = args.optionLookupOrDefault("cell", 0);
|
||||||
|
|
||||||
|
tensorField mI = momentOfInertia::meshInertia(mesh);
|
||||||
|
|
||||||
|
tensor& J = mI[cellI];
|
||||||
|
|
||||||
|
vector eVal = eigenValues(J);
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< "Inertia tensor of cell " << cellI << " " << J << nl
|
||||||
|
<< "eigenValues (principal moments) " << eVal << endl;
|
||||||
|
|
||||||
|
J /= cmptMax(eVal);
|
||||||
|
|
||||||
|
tensor eVec = eigenVectors(J);
|
||||||
|
|
||||||
|
Info<< "eigenVectors (principal axes, from normalised inertia) " << eVec
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
OFstream str("cell_" + name(cellI) + "_inertia.obj");
|
||||||
|
|
||||||
|
Info<< nl << "Writing scaled principal axes of cell " << cellI << " to "
|
||||||
|
<< str.name() << endl;
|
||||||
|
|
||||||
|
const point& cC = mesh.cellCentres()[cellI];
|
||||||
|
|
||||||
|
scalar scale = mag
|
||||||
|
(
|
||||||
|
(cC - mesh.faceCentres()[mesh.cells()[cellI][0]])
|
||||||
|
/eVal.component(findMin(eVal))
|
||||||
|
);
|
||||||
|
|
||||||
|
meshTools::writeOBJ(str, cC);
|
||||||
|
meshTools::writeOBJ(str, cC + scale*eVal.x()*eVec.x());
|
||||||
|
meshTools::writeOBJ(str, cC + scale*eVal.y()*eVec.y());
|
||||||
|
meshTools::writeOBJ(str, cC + scale*eVal.z()*eVec.z());
|
||||||
|
|
||||||
|
for (label i = 1; i < 4; i++)
|
||||||
|
{
|
||||||
|
str << "l " << 1 << ' ' << i + 1 << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << "End" << nl << endl;
|
Info<< nl << "End" << nl << endl;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
wclean libso extrudeModel
|
wclean libso extrudeModel
|
||||||
wclean
|
wclean extrudeMesh
|
||||||
|
wclean extrudeToRegionMesh
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
@ -3,6 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
wmake libso extrudeModel
|
wmake libso extrudeModel
|
||||||
wmake
|
wmake extrudeMesh
|
||||||
|
wmake extrudeToRegionMesh
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
@ -1,4 +1,3 @@
|
|||||||
extrudeMesh.C
|
extrudeMesh.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/extrudeMesh
|
EXE = $(FOAM_APPBIN)/extrudeMesh
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-IextrudedMesh \
|
-IextrudedMesh \
|
||||||
-IextrudeModel/lnInclude \
|
-I../extrudeModel/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
@ -12,4 +12,3 @@ EXE_LIBS = \
|
|||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
-lextrudeModel
|
-lextrudeModel
|
||||||
|
|
||||||
@ -218,9 +218,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"extrudeProperties",
|
"extrudeMeshDict",
|
||||||
runTimeExtruded.constant(),
|
runTimeExtruded.system(),
|
||||||
regionDir,
|
|
||||||
runTimeExtruded,
|
runTimeExtruded,
|
||||||
IOobject::MUST_READ_IF_MODIFIED
|
IOobject::MUST_READ_IF_MODIFIED
|
||||||
)
|
)
|
||||||
@ -10,7 +10,7 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
object extrudeProperties;
|
object extrudeMeshDict;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -94,4 +94,3 @@ mergeFaces false; //true;
|
|||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -381,4 +381,3 @@ Foam::extrudedMesh::extrudedMesh
|
|||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -124,4 +124,3 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -7,4 +7,3 @@ sigmaRadial/sigmaRadial.C
|
|||||||
wedge/wedge.C
|
wedge/wedge.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
||||||
|
|
||||||
@ -5,4 +5,3 @@ EXE_INC = \
|
|||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh
|
-ldynamicMesh
|
||||||
|
|
||||||
@ -86,4 +86,3 @@ Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
|
|||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -86,4 +86,3 @@ point linearDirection::operator()
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~linearDirection();
|
virtual ~linearDirection();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -95,4 +95,3 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -83,4 +83,3 @@ point linearNormal::operator()
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~linearNormal();
|
virtual ~linearNormal();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -92,4 +92,3 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -79,4 +79,3 @@ point linearRadial::operator()
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~linearRadial();
|
virtual ~linearRadial();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -90,4 +90,3 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -89,4 +89,3 @@ point sigmaRadial::operator()
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//-Destructor
|
//-Destructor
|
||||||
~sigmaRadial();
|
virtual ~sigmaRadial();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -91,4 +91,3 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ public:
|
|||||||
wedge(const dictionary& dict);
|
wedge(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destrcuctor
|
//- Destructor
|
||||||
~wedge();
|
virtual ~wedge();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -3,5 +3,3 @@ createShellMesh.C
|
|||||||
extrudeToRegionMesh.C
|
extrudeToRegionMesh.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/extrudeToRegionMesh
|
EXE = $(FOAM_APPBIN)/extrudeToRegionMesh
|
||||||
|
|
||||||
|
|
||||||
@ -1,10 +1,11 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I../extrudeModel/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
|
-lextrudeModel \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh
|
-ldynamicMesh
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -93,7 +93,7 @@ void Foam::createShellMesh::calcPointRegions
|
|||||||
label fp2 = findIndex(f2, pointI);
|
label fp2 = findIndex(f2, pointI);
|
||||||
label& region = pointRegions[face2][fp2];
|
label& region = pointRegions[face2][fp2];
|
||||||
if (region != -1)
|
if (region != -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"createShellMesh::calcPointRegions(..)"
|
"createShellMesh::calcPointRegions(..)"
|
||||||
@ -185,18 +185,20 @@ Foam::createShellMesh::createShellMesh
|
|||||||
|
|
||||||
void Foam::createShellMesh::setRefinement
|
void Foam::createShellMesh::setRefinement
|
||||||
(
|
(
|
||||||
const pointField& thickness,
|
const pointField& firstLayerDisp,
|
||||||
|
const scalar expansionRatio,
|
||||||
|
const label nLayers,
|
||||||
const labelList& topPatchID,
|
const labelList& topPatchID,
|
||||||
const labelList& bottomPatchID,
|
const labelList& bottomPatchID,
|
||||||
const labelListList& extrudeEdgePatches,
|
const labelListList& extrudeEdgePatches,
|
||||||
polyTopoChange& meshMod
|
polyTopoChange& meshMod
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (thickness.size() != regionPoints_.size())
|
if (firstLayerDisp.size() != regionPoints_.size())
|
||||||
{
|
{
|
||||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||||
<< "nRegions:" << regionPoints_.size()
|
<< "nRegions:" << regionPoints_.size()
|
||||||
<< " thickness:" << thickness.size()
|
<< " firstLayerDisp:" << firstLayerDisp.size()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,30 +226,36 @@ void Foam::createShellMesh::setRefinement
|
|||||||
|
|
||||||
|
|
||||||
// From cell to patch (trivial)
|
// From cell to patch (trivial)
|
||||||
DynamicList<label> cellToFaceMap(patch_.size());
|
DynamicList<label> cellToFaceMap(nLayers*patch_.size());
|
||||||
// From face to patch+turning index
|
// From face to patch+turning index
|
||||||
DynamicList<label> faceToFaceMap(2*patch_.size()+patch_.nEdges());
|
DynamicList<label> faceToFaceMap
|
||||||
|
(
|
||||||
|
(nLayers+1)*(patch_.size()+patch_.nEdges())
|
||||||
|
);
|
||||||
// From face to patch edge index
|
// From face to patch edge index
|
||||||
DynamicList<label> faceToEdgeMap(patch_.nEdges()+patch_.nEdges());
|
DynamicList<label> faceToEdgeMap(nLayers*(patch_.nEdges()+patch_.nEdges()));
|
||||||
// From point to patch point index
|
// From point to patch point index
|
||||||
DynamicList<label> pointToPointMap(2*patch_.nPoints());
|
DynamicList<label> pointToPointMap((nLayers+1)*patch_.nPoints());
|
||||||
|
|
||||||
|
|
||||||
// Introduce new cell for every face
|
// Introduce new cell for every face
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
labelList addedCells(patch_.size());
|
labelList addedCells(nLayers*patch_.size());
|
||||||
forAll(patch_, faceI)
|
forAll(patch_, faceI)
|
||||||
{
|
{
|
||||||
addedCells[faceI] = meshMod.addCell
|
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||||
(
|
{
|
||||||
-1, // masterPointID
|
addedCells[nLayers*faceI+layerI] = meshMod.addCell
|
||||||
-1, // masterEdgeID
|
(
|
||||||
-1, // masterFaceID
|
-1, // masterPointID
|
||||||
cellToFaceMap.size(), // masterCellID
|
-1, // masterEdgeID
|
||||||
-1 // zoneID
|
-1, // masterFaceID
|
||||||
);
|
cellToFaceMap.size(), // masterCellID
|
||||||
cellToFaceMap.append(faceI);
|
-1 // zoneID
|
||||||
|
);
|
||||||
|
cellToFaceMap.append(faceI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -261,7 +269,7 @@ void Foam::createShellMesh::setRefinement
|
|||||||
meshMod.addPoint
|
meshMod.addPoint
|
||||||
(
|
(
|
||||||
patch_.localPoints()[pointI], // point
|
patch_.localPoints()[pointI], // point
|
||||||
pointToPointMap.size(), // masterPointID
|
pointToPointMap.size(), // masterPointID
|
||||||
-1, // zoneID
|
-1, // zoneID
|
||||||
true // inCell
|
true // inCell
|
||||||
);
|
);
|
||||||
@ -277,25 +285,28 @@ void Foam::createShellMesh::setRefinement
|
|||||||
// Introduce new points (one for every region)
|
// Introduce new points (one for every region)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
labelList addedPoints(regionPoints_.size());
|
labelList addedPoints(nLayers*regionPoints_.size());
|
||||||
forAll(regionPoints_, regionI)
|
forAll(regionPoints_, regionI)
|
||||||
{
|
{
|
||||||
label pointI = regionPoints_[regionI];
|
label pointI = regionPoints_[regionI];
|
||||||
point extrudedPt = patch_.localPoints()[pointI] + thickness[regionI];
|
|
||||||
|
|
||||||
addedPoints[regionI] = meshMod.addPoint
|
point pt = patch_.localPoints()[pointI];
|
||||||
(
|
point disp = firstLayerDisp[regionI];
|
||||||
extrudedPt, // point
|
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||||
pointToPointMap.size(), // masterPointID - used only addressing
|
{
|
||||||
-1, // zoneID
|
pt += disp;
|
||||||
true // inCell
|
|
||||||
);
|
|
||||||
pointToPointMap.append(pointI);
|
|
||||||
|
|
||||||
//Pout<< "Added top point " << addedPoints[regionI]
|
addedPoints[nLayers*regionI+layerI] = meshMod.addPoint
|
||||||
// << " at " << extrudedPt
|
(
|
||||||
// << " from point " << pointI
|
pt, // point
|
||||||
// << endl;
|
pointToPointMap.size(), // masterPointID - used only addressing
|
||||||
|
-1, // zoneID
|
||||||
|
true // inCell
|
||||||
|
);
|
||||||
|
pointToPointMap.append(pointI);
|
||||||
|
|
||||||
|
disp *= expansionRatio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -305,61 +316,84 @@ void Foam::createShellMesh::setRefinement
|
|||||||
meshMod.addFace
|
meshMod.addFace
|
||||||
(
|
(
|
||||||
patch_.localFaces()[faceI].reverseFace(),// vertices
|
patch_.localFaces()[faceI].reverseFace(),// vertices
|
||||||
addedCells[faceI], // own
|
addedCells[nLayers*faceI], // own
|
||||||
-1, // nei
|
-1, // nei
|
||||||
-1, // masterPointID
|
-1, // masterPointID
|
||||||
-1, // masterEdgeID
|
-1, // masterEdgeID
|
||||||
faceToFaceMap.size(), // masterFaceID : current faceI
|
faceToFaceMap.size(), // masterFaceID : current faceI
|
||||||
true, // flipFaceFlux
|
true, // flipFaceFlux
|
||||||
bottomPatchID[faceI],// patchID
|
bottomPatchID[faceI], // patchID
|
||||||
-1, // zoneID
|
-1, // zoneID
|
||||||
false // zoneFlip
|
false // zoneFlip
|
||||||
);
|
);
|
||||||
faceToFaceMap.append(-faceI-1); // points to flipped original face
|
faceToFaceMap.append(-faceI-1); // points to flipped original face
|
||||||
faceToEdgeMap.append(-1);
|
faceToEdgeMap.append(-1);
|
||||||
|
|
||||||
|
//const face newF(patch_.localFaces()[faceI].reverseFace());
|
||||||
//Pout<< "Added bottom face "
|
//Pout<< "Added bottom face "
|
||||||
// << patch_.localFaces()[faceI].reverseFace()
|
// << newF
|
||||||
|
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
|
||||||
// << " own " << addedCells[faceI]
|
// << " own " << addedCells[faceI]
|
||||||
|
// << " patch:" << bottomPatchID[faceI]
|
||||||
// << " at " << patch_.faceCentres()[faceI]
|
// << " at " << patch_.faceCentres()[faceI]
|
||||||
// << endl;
|
// << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add face on top
|
// Add inbetween faces and face on top
|
||||||
forAll(patch_.localFaces(), faceI)
|
forAll(patch_.localFaces(), faceI)
|
||||||
{
|
{
|
||||||
// Get face in original ordering
|
// Get face in original ordering
|
||||||
const face& f = patch_.localFaces()[faceI];
|
const face& f = patch_.localFaces()[faceI];
|
||||||
|
|
||||||
// Pick up point based on region
|
|
||||||
face newF(f.size());
|
face newF(f.size());
|
||||||
forAll(f, fp)
|
|
||||||
|
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||||
{
|
{
|
||||||
label region = pointRegions_[faceI][fp];
|
// Pick up point based on region and layer
|
||||||
newF[fp] = addedPoints[region];
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
label region = pointRegions_[faceI][fp];
|
||||||
|
newF[fp] = addedPoints[region*nLayers+layerI];
|
||||||
|
}
|
||||||
|
|
||||||
|
label own = addedCells[faceI*nLayers+layerI];
|
||||||
|
label nei;
|
||||||
|
label patchI;
|
||||||
|
if (layerI == nLayers-1)
|
||||||
|
{
|
||||||
|
nei = -1;
|
||||||
|
patchI = topPatchID[faceI];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nei = addedCells[faceI*nLayers+layerI+1];
|
||||||
|
patchI = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
meshMod.addFace
|
||||||
|
(
|
||||||
|
newF, // vertices
|
||||||
|
own, // own
|
||||||
|
nei, // nei
|
||||||
|
-1, // masterPointID
|
||||||
|
-1, // masterEdgeID
|
||||||
|
faceToFaceMap.size(), // masterFaceID : current faceI
|
||||||
|
false, // flipFaceFlux
|
||||||
|
patchI, // patchID
|
||||||
|
-1, // zoneID
|
||||||
|
false // zoneFlip
|
||||||
|
);
|
||||||
|
faceToFaceMap.append(faceI+1); // unflipped
|
||||||
|
faceToEdgeMap.append(-1);
|
||||||
|
|
||||||
|
//Pout<< "Added inbetween face " << newF
|
||||||
|
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
|
||||||
|
// << " at layer " << layerI
|
||||||
|
// << " own " << own
|
||||||
|
// << " nei " << nei
|
||||||
|
// << " at " << patch_.faceCentres()[faceI]
|
||||||
|
// << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
meshMod.addFace
|
|
||||||
(
|
|
||||||
newF, // vertices
|
|
||||||
addedCells[faceI], // own
|
|
||||||
-1, // nei
|
|
||||||
-1, // masterPointID
|
|
||||||
-1, // masterEdgeID
|
|
||||||
faceToFaceMap.size(), // masterFaceID : current faceI
|
|
||||||
false, // flipFaceFlux
|
|
||||||
topPatchID[faceI], // patchID
|
|
||||||
-1, // zoneID
|
|
||||||
false // zoneFlip
|
|
||||||
);
|
|
||||||
faceToFaceMap.append(faceI+1); // unflipped
|
|
||||||
faceToEdgeMap.append(-1);
|
|
||||||
|
|
||||||
//Pout<< "Added top face " << newF
|
|
||||||
// << " own " << addedCells[faceI]
|
|
||||||
// << " at " << patch_.faceCentres()[faceI]
|
|
||||||
// << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -376,8 +410,7 @@ void Foam::createShellMesh::setRefinement
|
|||||||
|
|
||||||
if (ePatches.size() == 0)
|
if (ePatches.size() == 0)
|
||||||
{
|
{
|
||||||
// internal face.
|
// Internal face
|
||||||
|
|
||||||
if (eFaces.size() != 2)
|
if (eFaces.size() != 2)
|
||||||
{
|
{
|
||||||
FatalErrorIn("createShellMesh::setRefinement(..)")
|
FatalErrorIn("createShellMesh::setRefinement(..)")
|
||||||
@ -385,61 +418,6 @@ void Foam::createShellMesh::setRefinement
|
|||||||
<< " not internal but does not have side-patches defined."
|
<< " not internal but does not have side-patches defined."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extrude
|
|
||||||
|
|
||||||
// Make face pointing in to eFaces[0] so out of new master face
|
|
||||||
const face& f = patch_.localFaces()[eFaces[0]];
|
|
||||||
const edge& e = patch_.edges()[edgeI];
|
|
||||||
|
|
||||||
label fp0 = findIndex(f, e[0]);
|
|
||||||
label fp1 = f.fcIndex(fp0);
|
|
||||||
|
|
||||||
if (f[fp1] != e[1])
|
|
||||||
{
|
|
||||||
fp1 = fp0;
|
|
||||||
fp0 = f.rcIndex(fp1);
|
|
||||||
}
|
|
||||||
|
|
||||||
face newF(4);
|
|
||||||
newF[0] = f[fp0];
|
|
||||||
newF[1] = f[fp1];
|
|
||||||
newF[2] = addedPoints[pointRegions_[eFaces[0]][fp1]];
|
|
||||||
newF[3] = addedPoints[pointRegions_[eFaces[0]][fp0]];
|
|
||||||
|
|
||||||
label minCellI = addedCells[eFaces[0]];
|
|
||||||
label maxCellI = addedCells[eFaces[1]];
|
|
||||||
|
|
||||||
if (minCellI > maxCellI)
|
|
||||||
{
|
|
||||||
// Swap
|
|
||||||
Swap(minCellI, maxCellI);
|
|
||||||
newF.flip();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Pout<< "for internal edge:" << e
|
|
||||||
// << " at:" << patch_.localPoints()[e[0]]
|
|
||||||
// << patch_.localPoints()[e[1]]
|
|
||||||
// << " adding face:" << newF
|
|
||||||
// << " from f:" << f
|
|
||||||
// << " inbetween " << minCellI << " and " << maxCellI << endl;
|
|
||||||
|
|
||||||
// newF already outwards pointing.
|
|
||||||
meshMod.addFace
|
|
||||||
(
|
|
||||||
newF, // vertices
|
|
||||||
minCellI, // own
|
|
||||||
maxCellI, // nei
|
|
||||||
-1, // masterPointID
|
|
||||||
-1, // masterEdgeID
|
|
||||||
faceToFaceMap.size(), // masterFaceID
|
|
||||||
false, // flipFaceFlux
|
|
||||||
-1, // patchID
|
|
||||||
-1, // zoneID
|
|
||||||
false // zoneFlip
|
|
||||||
);
|
|
||||||
faceToFaceMap.append(0);
|
|
||||||
faceToEdgeMap.append(edgeI);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -451,52 +429,91 @@ void Foam::createShellMesh::setRefinement
|
|||||||
<< " but only " << ePatches.size()
|
<< " but only " << ePatches.size()
|
||||||
<< " boundary faces defined." << exit(FatalError);
|
<< " boundary faces defined." << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Extrude eFaces[0]
|
|
||||||
label minFaceI = eFaces[0];
|
|
||||||
|
|
||||||
// Make face pointing in to eFaces[0] so out of new master face
|
// Make face pointing in to eFaces[0] so out of new master face
|
||||||
const face& f = patch_.localFaces()[minFaceI];
|
const face& f = patch_.localFaces()[eFaces[0]];
|
||||||
|
const edge& e = patch_.edges()[edgeI];
|
||||||
|
|
||||||
const edge& e = patch_.edges()[edgeI];
|
label fp0 = findIndex(f, e[0]);
|
||||||
label fp0 = findIndex(f, e[0]);
|
label fp1 = f.fcIndex(fp0);
|
||||||
label fp1 = f.fcIndex(fp0);
|
|
||||||
|
|
||||||
if (f[fp1] != e[1])
|
if (f[fp1] != e[1])
|
||||||
|
{
|
||||||
|
fp1 = fp0;
|
||||||
|
fp0 = f.rcIndex(fp1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face newF(4);
|
||||||
|
|
||||||
|
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||||
|
{
|
||||||
|
label region0 = pointRegions_[eFaces[0]][fp0];
|
||||||
|
label region1 = pointRegions_[eFaces[0]][fp1];
|
||||||
|
|
||||||
|
if (layerI == 0)
|
||||||
{
|
{
|
||||||
fp1 = fp0;
|
newF[0] = f[fp0];
|
||||||
fp0 = f.rcIndex(fp1);
|
newF[1] = f[fp1];
|
||||||
|
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||||
|
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newF[0] = addedPoints[nLayers*region0+layerI-1];
|
||||||
|
newF[1] = addedPoints[nLayers*region1+layerI-1];
|
||||||
|
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||||
|
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||||
}
|
}
|
||||||
|
|
||||||
face newF(4);
|
label minCellI = addedCells[nLayers*eFaces[0]+layerI];
|
||||||
newF[0] = f[fp0];
|
label maxCellI;
|
||||||
newF[1] = f[fp1];
|
label patchI;
|
||||||
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]];
|
if (ePatches.size() == 0)
|
||||||
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]];
|
{
|
||||||
|
maxCellI = addedCells[nLayers*eFaces[1]+layerI];
|
||||||
|
if (minCellI > maxCellI)
|
||||||
|
{
|
||||||
|
// Swap
|
||||||
|
Swap(minCellI, maxCellI);
|
||||||
|
newF = newF.reverseFace();
|
||||||
|
}
|
||||||
|
patchI = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxCellI = -1;
|
||||||
|
patchI = ePatches[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//{
|
||||||
//Pout<< "for external edge:" << e
|
// Pout<< "Adding from face:" << patch_.faceCentres()[eFaces[0]]
|
||||||
// << " at:" << patch_.localPoints()[e[0]]
|
// << " from edge:"
|
||||||
// << patch_.localPoints()[e[1]]
|
// << patch_.localPoints()[f[fp0]]
|
||||||
// << " adding first patch face:" << newF
|
// << patch_.localPoints()[f[fp1]]
|
||||||
// << " from:" << f
|
// << " at layer:" << layerI
|
||||||
// << " into patch:" << ePatches[0]
|
// << " with new points:" << newF
|
||||||
// << " own:" << addedCells[minFaceI]
|
// << " locations:"
|
||||||
// << endl;
|
// << UIndirectList<point>(meshMod.points(), newF)
|
||||||
|
// << " own:" << minCellI
|
||||||
|
// << " nei:" << maxCellI
|
||||||
|
// << endl;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
// newF already outwards pointing.
|
// newF already outwards pointing.
|
||||||
meshMod.addFace
|
meshMod.addFace
|
||||||
(
|
(
|
||||||
newF, // vertices
|
newF, // vertices
|
||||||
addedCells[minFaceI], // own
|
minCellI, // own
|
||||||
-1, // nei
|
maxCellI, // nei
|
||||||
-1, // masterPointID
|
-1, // masterPointID
|
||||||
-1, // masterEdgeID
|
-1, // masterEdgeID
|
||||||
faceToFaceMap.size(), // masterFaceID
|
faceToFaceMap.size(), // masterFaceID
|
||||||
false, // flipFaceFlux
|
false, // flipFaceFlux
|
||||||
ePatches[0], // patchID
|
patchI, // patchID
|
||||||
-1, // zoneID
|
-1, // zoneID
|
||||||
false // zoneFlip
|
false // zoneFlip
|
||||||
);
|
);
|
||||||
@ -532,35 +549,57 @@ void Foam::createShellMesh::setRefinement
|
|||||||
}
|
}
|
||||||
|
|
||||||
face newF(4);
|
face newF(4);
|
||||||
newF[0] = f[fp0];
|
for (label layerI = 0; layerI < nLayers; layerI++)
|
||||||
newF[1] = f[fp1];
|
{
|
||||||
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]];
|
label region0 = pointRegions_[minFaceI][fp0];
|
||||||
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]];
|
label region1 = pointRegions_[minFaceI][fp1];
|
||||||
|
|
||||||
//Pout<< "for external edge:" << e
|
if (layerI == 0)
|
||||||
// << " at:" << patch_.localPoints()[e[0]]
|
{
|
||||||
// << patch_.localPoints()[e[1]]
|
newF[0] = f[fp0];
|
||||||
// << " adding patch face:" << newF
|
newF[1] = f[fp1];
|
||||||
// << " from:" << f
|
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||||
// << " into patch:" << ePatches[i]
|
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||||
// << endl;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newF[0] = addedPoints[nLayers*region0+layerI-1];
|
||||||
|
newF[1] = addedPoints[nLayers*region1+layerI-1];
|
||||||
|
newF[2] = addedPoints[nLayers*region1+layerI];
|
||||||
|
newF[3] = addedPoints[nLayers*region0+layerI];
|
||||||
|
}
|
||||||
|
|
||||||
// newF already outwards pointing.
|
////if (ePatches.size() == 0)
|
||||||
meshMod.addFace
|
//{
|
||||||
(
|
// Pout<< "Adding from MULTI face:"
|
||||||
newF, // vertices
|
// << patch_.faceCentres()[minFaceI]
|
||||||
addedCells[minFaceI], // own
|
// << " from edge:"
|
||||||
-1, // nei
|
// << patch_.localPoints()[f[fp0]]
|
||||||
-1, // masterPointID
|
// << patch_.localPoints()[f[fp1]]
|
||||||
-1, // masterEdgeID
|
// << " at layer:" << layerI
|
||||||
faceToFaceMap.size(), // masterFaceID
|
// << " with new points:" << newF
|
||||||
false, // flipFaceFlux
|
// << " locations:"
|
||||||
ePatches[i], // patchID
|
// << UIndirectList<point>(meshMod.points(), newF)
|
||||||
-1, // zoneID
|
// << endl;
|
||||||
false // zoneFlip
|
//}
|
||||||
);
|
|
||||||
faceToFaceMap.append(0);
|
// newF already outwards pointing.
|
||||||
faceToEdgeMap.append(edgeI);
|
meshMod.addFace
|
||||||
|
(
|
||||||
|
newF, // vertices
|
||||||
|
addedCells[nLayers*minFaceI+layerI], // own
|
||||||
|
-1, // nei
|
||||||
|
-1, // masterPointID
|
||||||
|
-1, // masterEdgeID
|
||||||
|
faceToFaceMap.size(), // masterFaceID
|
||||||
|
false, // flipFaceFlux
|
||||||
|
ePatches[i], // patchID
|
||||||
|
-1, // zoneID
|
||||||
|
false // zoneFlip
|
||||||
|
);
|
||||||
|
faceToFaceMap.append(0);
|
||||||
|
faceToEdgeMap.append(edgeI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -109,7 +109,8 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- From region cell to patch face
|
//- From region cell to patch face. Consecutively added so
|
||||||
|
// cell at layerI is at patchFaceI*nLayers+layerI
|
||||||
const labelList& cellToFaceMap() const
|
const labelList& cellToFaceMap() const
|
||||||
{
|
{
|
||||||
return cellToFaceMap_;
|
return cellToFaceMap_;
|
||||||
@ -120,7 +121,7 @@ public:
|
|||||||
// be in top patch
|
// be in top patch
|
||||||
// < 0 : face in opposite orientation as patch face. face will
|
// < 0 : face in opposite orientation as patch face. face will
|
||||||
// be in bottom patch
|
// be in bottom patch
|
||||||
// = 0 : for all side faces
|
// = 0 : for all side and internal faces
|
||||||
const labelList& faceToFaceMap() const
|
const labelList& faceToFaceMap() const
|
||||||
{
|
{
|
||||||
return faceToFaceMap_;
|
return faceToFaceMap_;
|
||||||
@ -153,7 +154,9 @@ public:
|
|||||||
//- Play commands into polyTopoChange to create layer mesh.
|
//- Play commands into polyTopoChange to create layer mesh.
|
||||||
void setRefinement
|
void setRefinement
|
||||||
(
|
(
|
||||||
const pointField& thickness,
|
const pointField& firstLayerThickness,
|
||||||
|
const scalar expansionRatio,
|
||||||
|
const label nLayers,
|
||||||
const labelList& topPatchID,
|
const labelList& topPatchID,
|
||||||
const labelList& bottomPatchID,
|
const labelList& bottomPatchID,
|
||||||
const labelListList& extrudeEdgePatches,
|
const labelListList& extrudeEdgePatches,
|
||||||
@ -133,6 +133,7 @@ Usage
|
|||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
#include "nonuniformTransformCyclicPolyPatch.H"
|
#include "nonuniformTransformCyclicPolyPatch.H"
|
||||||
|
#include "extrudeModel.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -689,39 +690,6 @@ void countExtrudePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Lexical ordering for vectors.
|
|
||||||
bool lessThan(const point& x, const point& y)
|
|
||||||
{
|
|
||||||
for (direction dir = 0; dir < point::nComponents; dir++)
|
|
||||||
{
|
|
||||||
if (x[dir] < y[dir]) return true;
|
|
||||||
if (x[dir] > y[dir]) return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Combine vectors
|
|
||||||
class minEqVectorOp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void operator()(vector& x, const vector& y) const
|
|
||||||
{
|
|
||||||
if (y != vector::zero)
|
|
||||||
{
|
|
||||||
if (x == vector::zero)
|
|
||||||
{
|
|
||||||
x = y;
|
|
||||||
}
|
|
||||||
else if (lessThan(y, x))
|
|
||||||
{
|
|
||||||
x = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Constrain&sync normals on points that are on coupled patches to make sure
|
// Constrain&sync normals on points that are on coupled patches to make sure
|
||||||
// the face extruded from the edge has a valid normal with its coupled
|
// the face extruded from the edge has a valid normal with its coupled
|
||||||
// equivalent.
|
// equivalent.
|
||||||
@ -846,14 +814,14 @@ void constrainCoupledNormals
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
edgeNormals0,
|
edgeNormals0,
|
||||||
minEqVectorOp(),
|
maxMagSqrEqOp<vector>(),
|
||||||
vector::zero // nullValue
|
vector::zero // nullValue
|
||||||
);
|
);
|
||||||
syncTools::syncEdgeList
|
syncTools::syncEdgeList
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
edgeNormals1,
|
edgeNormals1,
|
||||||
minEqVectorOp(),
|
maxMagSqrEqOp<vector>(),
|
||||||
vector::zero // nullValue
|
vector::zero // nullValue
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -951,14 +919,9 @@ tmp<pointField> calcOffset
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.append("shellRegion");
|
argList::addNote
|
||||||
argList::validArgs.append("faceZones");
|
|
||||||
argList::validArgs.append("thickness");
|
|
||||||
|
|
||||||
Foam::argList::addBoolOption
|
|
||||||
(
|
(
|
||||||
"oneD",
|
"Create region mesh by extruding a faceZone"
|
||||||
"generate columns of 1D cells"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
@ -966,19 +929,34 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
const word oldInstance = mesh.pointsInstance();
|
const word oldInstance = mesh.pointsInstance();
|
||||||
|
|
||||||
word shellRegionName = args.additionalArgs()[0];
|
|
||||||
const wordList zoneNames(IStringStream(args.additionalArgs()[1])());
|
|
||||||
scalar thickness = readScalar(IStringStream(args.additionalArgs()[2])());
|
|
||||||
bool overwrite = args.optionFound("overwrite");
|
bool overwrite = args.optionFound("overwrite");
|
||||||
bool oneD = args.optionFound("oneD");
|
|
||||||
|
|
||||||
|
IOdictionary dict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"extrudeToRegionMeshDict",
|
||||||
|
runTime.system(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Point generator
|
||||||
|
autoPtr<extrudeModel> model(extrudeModel::New(dict));
|
||||||
|
|
||||||
|
|
||||||
|
// Region
|
||||||
|
const word shellRegionName(dict.lookup("region"));
|
||||||
|
const wordList zoneNames(dict.lookup("faceZones"));
|
||||||
|
const Switch oneD(dict.lookup("oneD"));
|
||||||
|
const Switch adaptMesh(dict.lookup("adaptMesh"));
|
||||||
|
|
||||||
Info<< "Extruding zones " << zoneNames
|
Info<< "Extruding zones " << zoneNames
|
||||||
<< " on mesh " << regionName
|
<< " on mesh " << regionName
|
||||||
<< " into shell mesh " << shellRegionName
|
<< " into shell mesh " << shellRegionName
|
||||||
<< " of thickness " << thickness << nl
|
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
if (shellRegionName == regionName)
|
if (shellRegionName == regionName)
|
||||||
@ -1081,7 +1059,6 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check whether the zone is internal or external faces to determine
|
// Check whether the zone is internal or external faces to determine
|
||||||
// what patch type to insert. Cannot be mixed
|
// what patch type to insert. Cannot be mixed
|
||||||
// since then how to couple? - directMapped only valid for a whole patch.
|
// since then how to couple? - directMapped only valid for a whole patch.
|
||||||
@ -1119,6 +1096,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Add interface patches
|
// Add interface patches
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// Note that these actually get added to the original mesh
|
||||||
|
// so the shell mesh creation copies them. They then get removed
|
||||||
|
// from the original mesh.
|
||||||
|
|
||||||
Info<< "Adding coupling patches:" << nl << nl
|
Info<< "Adding coupling patches:" << nl << nl
|
||||||
<< "patchID\tpatch\ttype" << nl
|
<< "patchID\tpatch\ttype" << nl
|
||||||
@ -1437,6 +1417,8 @@ int main(int argc, char *argv[])
|
|||||||
// Calculate a normal per region
|
// Calculate a normal per region
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
vectorField regionNormals(regionPoints.size(), vector::zero);
|
vectorField regionNormals(regionPoints.size(), vector::zero);
|
||||||
|
vectorField regionCentres(regionPoints.size(), vector::zero);
|
||||||
|
labelList nRegionFaces(regionPoints.size(), 0);
|
||||||
|
|
||||||
forAll(pointRegions, faceI)
|
forAll(pointRegions, faceI)
|
||||||
{
|
{
|
||||||
@ -1446,9 +1428,15 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
label region = pointRegions[faceI][fp];
|
label region = pointRegions[faceI][fp];
|
||||||
regionNormals[region] += extrudePatch.faceNormals()[faceI];
|
regionNormals[region] += extrudePatch.faceNormals()[faceI];
|
||||||
|
regionCentres[region] += extrudePatch.faceCentres()[faceI];
|
||||||
|
nRegionFaces[region]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
regionNormals /= mag(regionNormals);
|
regionNormals /= mag(regionNormals);
|
||||||
|
forAll(regionCentres, regionI)
|
||||||
|
{
|
||||||
|
regionCentres[regionI] /= nRegionFaces[regionI];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Constrain&sync normals on points that are on coupled patches.
|
// Constrain&sync normals on points that are on coupled patches.
|
||||||
@ -1463,10 +1451,13 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
// For debugging: dump hedgehog plot of normals
|
// For debugging: dump hedgehog plot of normals
|
||||||
|
if (false)
|
||||||
{
|
{
|
||||||
OFstream str(runTime.path()/"regionNormals.obj");
|
OFstream str(runTime.path()/"regionNormals.obj");
|
||||||
label vertI = 0;
|
label vertI = 0;
|
||||||
|
|
||||||
|
scalar thickness = model().sumThickness(1);
|
||||||
|
|
||||||
forAll(pointRegions, faceI)
|
forAll(pointRegions, faceI)
|
||||||
{
|
{
|
||||||
const face& f = extrudeFaces[faceI];
|
const face& f = extrudeFaces[faceI];
|
||||||
@ -1486,6 +1477,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Use model to create displacements of first layer
|
||||||
|
vectorField firstDisp(regionNormals.size());
|
||||||
|
forAll(firstDisp, regionI)
|
||||||
|
{
|
||||||
|
const point& regionPt = regionCentres[regionI];
|
||||||
|
const vector& n = regionNormals[regionI];
|
||||||
|
firstDisp[regionI] = model()(regionPt, n, 1) - regionPt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create a new mesh
|
// Create a new mesh
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
@ -1500,7 +1501,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
extruder.setRefinement
|
extruder.setRefinement
|
||||||
(
|
(
|
||||||
thickness*regionNormals,
|
firstDisp, // first displacement
|
||||||
|
model().expansionRatio(),
|
||||||
|
model().nLayers(), // nLayers
|
||||||
extrudeTopPatchID,
|
extrudeTopPatchID,
|
||||||
extrudeBottomPatchID,
|
extrudeBottomPatchID,
|
||||||
extrudeEdgePatches,
|
extrudeEdgePatches,
|
||||||
@ -1707,6 +1710,8 @@ int main(int argc, char *argv[])
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
autoPtr<mapPolyMesh> addBafflesMap;
|
autoPtr<mapPolyMesh> addBafflesMap;
|
||||||
|
|
||||||
|
if (adaptMesh)
|
||||||
{
|
{
|
||||||
polyTopoChange meshMod(mesh);
|
polyTopoChange meshMod(mesh);
|
||||||
|
|
||||||
@ -1817,6 +1822,7 @@ int main(int argc, char *argv[])
|
|||||||
// Change master and slave boundary conditions on originating mesh
|
// Change master and slave boundary conditions on originating mesh
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
if (adaptMesh)
|
||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
List<polyPatch*> newPatches(patches.size());
|
List<polyPatch*> newPatches(patches.size());
|
||||||
@ -1878,22 +1884,26 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
mesh.removeFvBoundary();
|
mesh.removeFvBoundary();
|
||||||
mesh.addFvPatches(newPatches, true);
|
mesh.addFvPatches(newPatches, true);
|
||||||
|
|
||||||
|
// Remove any unused patches
|
||||||
deleteEmptyPatches(mesh);
|
deleteEmptyPatches(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Info<< "Writing mesh " << mesh.name()
|
if (adaptMesh)
|
||||||
<< " to " << mesh.facesInstance() << nl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
if (!mesh.write())
|
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
Info<< "Writing mesh " << mesh.name()
|
||||||
<< "Failed writing mesh " << mesh.name()
|
<< " to " << mesh.facesInstance() << nl
|
||||||
<< " at location " << mesh.facesInstance()
|
<< endl;
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!mesh.write())
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Failed writing mesh " << mesh.name()
|
||||||
|
<< " at location " << mesh.facesInstance()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info << "End\n" << endl;
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object extrudeToRegionMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Name of region to create
|
||||||
|
region liquidFilm;
|
||||||
|
|
||||||
|
// FaceZones to extrude
|
||||||
|
faceZones (f0);
|
||||||
|
|
||||||
|
// Adapt the original mesh to have directMapped patches at where the
|
||||||
|
// faceZones are?
|
||||||
|
// If true:
|
||||||
|
// - extruding internal faces: become baffles on directMapped patches
|
||||||
|
// - extruding boundary faces: repatched to be on directMapped patches
|
||||||
|
// If false: leave original mesh intact. Extruded mesh will still have
|
||||||
|
// directMapped patch which might need to be adapted.
|
||||||
|
adaptMesh true;
|
||||||
|
|
||||||
|
// Extrude 1D-columns of cells?
|
||||||
|
oneD false;
|
||||||
|
|
||||||
|
//- Extrusion model to use. The only logical choice is linearNormal?
|
||||||
|
|
||||||
|
//- Linear extrusion in normal direction
|
||||||
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
|
//- Linear extrusion in specified direction
|
||||||
|
//extrudeModel linearDirection;
|
||||||
|
|
||||||
|
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
||||||
|
// extrudeModel wedge;
|
||||||
|
|
||||||
|
//- Extrudes into sphere around (0 0 0)
|
||||||
|
//extrudeModel linearRadial;
|
||||||
|
|
||||||
|
//- Extrudes into sphere with grading according to pressure (atmospherics)
|
||||||
|
//extrudeModel sigmaRadial;
|
||||||
|
|
||||||
|
nLayers 10;
|
||||||
|
|
||||||
|
expansionRatio 0.9;
|
||||||
|
|
||||||
|
linearNormalCoeffs
|
||||||
|
{
|
||||||
|
thickness 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
wedgeCoeffs
|
||||||
|
{
|
||||||
|
axisPt (0 0.1 -0.05);
|
||||||
|
axis (-1 0 0);
|
||||||
|
angle 360; // For nLayers=1 assume symmetry so angle/2 on each side
|
||||||
|
}
|
||||||
|
|
||||||
|
linearDirectionCoeffs
|
||||||
|
{
|
||||||
|
direction (0 1 0);
|
||||||
|
thickness 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
linearRadialCoeffs
|
||||||
|
{
|
||||||
|
R 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sigmaRadialCoeffs
|
||||||
|
{
|
||||||
|
RTbyg 1;
|
||||||
|
pRef 1;
|
||||||
|
pStrat 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -55,23 +55,6 @@ namespace Foam
|
|||||||
defineTemplateTypeNameAndDebug(IOPtrList<dictionary>, 0);
|
defineTemplateTypeNameAndDebug(IOPtrList<dictionary>, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine operator to synchronise points. We choose point nearest to origin so
|
|
||||||
// we can use e.g. great,great,great as null value.
|
|
||||||
class nearestEqOp
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void operator()(vector& x, const vector& y) const
|
|
||||||
{
|
|
||||||
if (magSqr(y) < magSqr(x))
|
|
||||||
{
|
|
||||||
x = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void changePatchID
|
void changePatchID
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -854,7 +837,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
newPoints,
|
newPoints,
|
||||||
nearestEqOp(),
|
minMagSqrEqOp<vector>(),
|
||||||
point(GREAT, GREAT, GREAT)
|
point(GREAT, GREAT, GREAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -482,7 +482,7 @@ bool doCommand
|
|||||||
topoSet& currentSet = currentSetPtr();
|
topoSet& currentSet = currentSetPtr();
|
||||||
|
|
||||||
Info<< " Set:" << currentSet.name()
|
Info<< " Set:" << currentSet.name()
|
||||||
<< " Size:" << currentSet.size()
|
<< " Size:" << returnReduce(currentSet.size(), sumOp<label>())
|
||||||
<< " Action:" << actionName
|
<< " Action:" << actionName
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
@ -579,7 +579,9 @@ bool doCommand
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Writing " << currentSet.name()
|
Info<< " Writing " << currentSet.name()
|
||||||
<< " (size " << currentSet.size() << ") to "
|
<< " (size "
|
||||||
|
<< returnReduce(currentSet.size(), sumOp<label>())
|
||||||
|
<< ") to "
|
||||||
<< currentSet.instance()/currentSet.local()
|
<< currentSet.instance()/currentSet.local()
|
||||||
/currentSet.name()
|
/currentSet.name()
|
||||||
<< " and to vtk file " << vtkName << endl << endl;
|
<< " and to vtk file " << vtkName << endl << endl;
|
||||||
@ -589,7 +591,9 @@ bool doCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< " Writing " << currentSet.name()
|
Info<< " Writing " << currentSet.name()
|
||||||
<< " (size " << currentSet.size() << ") to "
|
<< " (size "
|
||||||
|
<< returnReduce(currentSet.size(), sumOp<label>())
|
||||||
|
<< ") to "
|
||||||
<< currentSet.instance()/currentSet.local()
|
<< currentSet.instance()/currentSet.local()
|
||||||
/currentSet.name() << endl << endl;
|
/currentSet.name() << endl << endl;
|
||||||
}
|
}
|
||||||
@ -642,9 +646,9 @@ enum commandStatus
|
|||||||
void printMesh(const Time& runTime, const polyMesh& mesh)
|
void printMesh(const Time& runTime, const polyMesh& mesh)
|
||||||
{
|
{
|
||||||
Info<< "Time:" << runTime.timeName()
|
Info<< "Time:" << runTime.timeName()
|
||||||
<< " cells:" << mesh.nCells()
|
<< " cells:" << mesh.globalData().nTotalCells()
|
||||||
<< " faces:" << mesh.nFaces()
|
<< " faces:" << mesh.globalData().nTotalFaces()
|
||||||
<< " points:" << mesh.nPoints()
|
<< " points:" << mesh.globalData().nTotalPoints()
|
||||||
<< " patches:" << mesh.boundaryMesh().size()
|
<< " patches:" << mesh.boundaryMesh().size()
|
||||||
<< " bb:" << mesh.bounds() << nl;
|
<< " bb:" << mesh.bounds() << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,9 +47,9 @@ EXE_LIBS = \
|
|||||||
-lrandomProcesses \
|
-lrandomProcesses \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-lsolidMixture \
|
-lpointSolidMixture \
|
||||||
-lsolidParticle \
|
-lsolidParticle \
|
||||||
-lsolids \
|
-lpointSolids \
|
||||||
-lspecie \
|
-lspecie \
|
||||||
-lsurfMesh \
|
-lsurfMesh \
|
||||||
-lsystemCall \
|
-lsystemCall \
|
||||||
|
|||||||
@ -86,51 +86,11 @@ autoPtr<fvMesh> createMesh
|
|||||||
if (!haveMesh)
|
if (!haveMesh)
|
||||||
{
|
{
|
||||||
// Create dummy mesh. Only used on procs that don't have mesh.
|
// Create dummy mesh. Only used on procs that don't have mesh.
|
||||||
|
IOobject noReadIO(io);
|
||||||
{
|
noReadIO.readOpt() = IOobject::NO_READ;
|
||||||
IOdictionary fvSolution
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"fvSolution",
|
|
||||||
runTime.system(),
|
|
||||||
runTime,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
Pout<< "Writing dummy " << fvSolution.objectPath() << endl;
|
|
||||||
fvSolution.regIOobject::write();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IOdictionary fvSchemes
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"fvSchemes",
|
|
||||||
runTime.system(),
|
|
||||||
runTime,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
fvSchemes.add("divSchemes", dictionary());
|
|
||||||
fvSchemes.add("gradSchemes", dictionary());
|
|
||||||
fvSchemes.add("laplacianSchemes", dictionary());
|
|
||||||
Pout<< "Writing dummy " << fvSchemes.objectPath() << endl;
|
|
||||||
fvSchemes.regIOobject::write();
|
|
||||||
}
|
|
||||||
|
|
||||||
Pout<< "Creating dummy mesh from " << io.objectPath() << endl;
|
|
||||||
fvMesh dummyMesh
|
fvMesh dummyMesh
|
||||||
(
|
(
|
||||||
IOobject
|
noReadIO,
|
||||||
(
|
|
||||||
io.name(),
|
|
||||||
io.instance(),
|
|
||||||
io.db(),
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
xferCopy(pointField()),
|
xferCopy(pointField()),
|
||||||
xferCopy(faceList()),
|
xferCopy(faceList()),
|
||||||
xferCopy(labelList()),
|
xferCopy(labelList()),
|
||||||
@ -521,7 +481,7 @@ void compareFields
|
|||||||
{
|
{
|
||||||
if (mag(aBoundary[i] - bBoundary[i]) > tolDim)
|
if (mag(aBoundary[i] - bBoundary[i]) > tolDim)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"compareFields"
|
"compareFields"
|
||||||
"(const scalar, const volVectorField&"
|
"(const scalar, const volVectorField&"
|
||||||
@ -532,7 +492,9 @@ void compareFields
|
|||||||
<< " cc:" << endl
|
<< " cc:" << endl
|
||||||
<< " real :" << aBoundary[i] << endl
|
<< " real :" << aBoundary[i] << endl
|
||||||
<< " mapped :" << bBoundary[i] << endl
|
<< " mapped :" << bBoundary[i] << endl
|
||||||
<< abort(FatalError);
|
<< "This might be just a precision entry"
|
||||||
|
<< " on writing the mesh." << endl;
|
||||||
|
//<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -554,20 +516,16 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
// Create processor directory if non-existing
|
//- Not useful anymore. See above.
|
||||||
if (!Pstream::master() && !isDir(args.path()))
|
//// Create processor directory if non-existing
|
||||||
{
|
//if (!Pstream::master() && !isDir(args.path()))
|
||||||
Pout<< "Creating case directory " << args.path() << endl;
|
//{
|
||||||
mkDir(args.path());
|
// Pout<< "Creating case directory " << args.path() << endl;
|
||||||
}
|
// mkDir(args.path());
|
||||||
|
//}
|
||||||
// Switch timeStamp checking to one which does not do any
|
|
||||||
// parallel sync for same reason
|
|
||||||
regIOobject::fileModificationChecking = regIOobject::timeStamp;
|
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
|
||||||
word regionName = polyMesh::defaultRegion;
|
word regionName = polyMesh::defaultRegion;
|
||||||
fileName meshSubDir;
|
fileName meshSubDir;
|
||||||
|
|
||||||
|
|||||||
@ -36,12 +36,12 @@ using namespace Foam;
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightCloudField
|
void ensightCloudField
|
||||||
(
|
(
|
||||||
const Foam::IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const word& prepend,
|
||||||
const Foam::label timeIndex,
|
const label timeIndex,
|
||||||
const Foam::word& cloudName,
|
const word& cloudName,
|
||||||
Foam::Ostream& ensightCaseFile,
|
Ostream& ensightCaseFile,
|
||||||
const bool dataExists
|
const bool dataExists
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,13 +42,13 @@ SourceFiles
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightCloudField
|
void ensightCloudField
|
||||||
(
|
(
|
||||||
const Foam::IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const word& prepend,
|
||||||
const Foam::label timeIndex,
|
const label timeIndex,
|
||||||
const Foam::word& timeFile,
|
const word& timeFile,
|
||||||
const Foam::word& cloudName,
|
const word& cloudName,
|
||||||
Foam::Ostream& ensightCaseFile,
|
Ostream& ensightCaseFile,
|
||||||
const bool dataExists
|
const bool dataExists
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -105,11 +105,11 @@ void writeField
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
bool writePatchField
|
bool writePatchField
|
||||||
(
|
(
|
||||||
const Foam::Field<Type>& pf,
|
const Field<Type>& pf,
|
||||||
const Foam::label patchi,
|
const label patchi,
|
||||||
const Foam::label ensightPatchI,
|
const label ensightPatchI,
|
||||||
const Foam::faceSets& boundaryFaceSet,
|
const faceSets& boundaryFaceSet,
|
||||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
const ensightMesh::nFacePrimitives& nfp,
|
||||||
ensightStream& ensightFile
|
ensightStream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -153,15 +153,15 @@ bool writePatchField
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void writePatchField
|
void writePatchField
|
||||||
(
|
(
|
||||||
const Foam::word& fieldName,
|
const word& fieldName,
|
||||||
const Foam::Field<Type>& pf,
|
const Field<Type>& pf,
|
||||||
const Foam::word& patchName,
|
const word& patchName,
|
||||||
const Foam::ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const word& prepend,
|
||||||
const Foam::label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
Foam::Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const Time& runTime = eMesh.mesh().time();
|
const Time& runTime = eMesh.mesh().time();
|
||||||
@ -271,12 +271,12 @@ template<class Type>
|
|||||||
void ensightField
|
void ensightField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||||
const Foam::ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const word& prepend,
|
||||||
const Foam::label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
Foam::Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Converting field " << vf.name() << endl;
|
Info<< "Converting field " << vf.name() << endl;
|
||||||
@ -500,12 +500,12 @@ template<class Type>
|
|||||||
void ensightPointField
|
void ensightPointField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
||||||
const Foam::ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const word& prepend,
|
||||||
const Foam::label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
Foam::Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Converting field " << pf.name() << endl;
|
Info<< "Converting field " << pf.name() << endl;
|
||||||
@ -679,14 +679,14 @@ void ensightPointField
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightField
|
void ensightField
|
||||||
(
|
(
|
||||||
const Foam::IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const Foam::ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const word& prepend,
|
||||||
const Foam::label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const bool nodeValues,
|
const bool nodeValues,
|
||||||
Foam::Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Read field
|
// Read field
|
||||||
|
|||||||
@ -37,10 +37,10 @@ using namespace Foam;
|
|||||||
|
|
||||||
void ensightParticlePositions
|
void ensightParticlePositions
|
||||||
(
|
(
|
||||||
const Foam::fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const Foam::fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const Foam::word& timeFile,
|
const word& timeFile,
|
||||||
const Foam::word& cloudName,
|
const word& cloudName,
|
||||||
const bool dataExists
|
const bool dataExists
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,199 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::sumData
|
|
||||||
|
|
||||||
Description
|
|
||||||
Sums data while walking across cells. Used in collapsing fields.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
sumDataI.H
|
|
||||||
sumData.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef sumData_H
|
|
||||||
#define sumData_H
|
|
||||||
|
|
||||||
#include "point.H"
|
|
||||||
#include "tensor.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
class polyPatch;
|
|
||||||
class polyMesh;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class sumData Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class sumData
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Previous face
|
|
||||||
label oldFace_;
|
|
||||||
|
|
||||||
//- summed data
|
|
||||||
scalar sum_;
|
|
||||||
|
|
||||||
//- number of items summed
|
|
||||||
label count_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct null
|
|
||||||
inline sumData();
|
|
||||||
|
|
||||||
//- Construct from count
|
|
||||||
inline sumData
|
|
||||||
(
|
|
||||||
const label oldFace,
|
|
||||||
const scalar sum,
|
|
||||||
const label count
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
inline label oldFace() const
|
|
||||||
{
|
|
||||||
return oldFace_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline scalar sum() const
|
|
||||||
{
|
|
||||||
return sum_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline label count() const
|
|
||||||
{
|
|
||||||
return count_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Needed by FaceCellWave
|
|
||||||
|
|
||||||
//- Check whether origin has been changed at all or
|
|
||||||
// still contains original (invalid) value.
|
|
||||||
inline bool valid() const;
|
|
||||||
|
|
||||||
//- Check for identical geometrical data. Used for cyclics checking.
|
|
||||||
inline bool sameGeometry
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const sumData&,
|
|
||||||
const scalar
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Convert any absolute coordinates into relative to (patch)face
|
|
||||||
// centre
|
|
||||||
inline void leaveDomain
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const polyPatch&,
|
|
||||||
const label patchFaceI,
|
|
||||||
const point& faceCentre
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Reverse of leaveDomain
|
|
||||||
inline void enterDomain
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const polyPatch&,
|
|
||||||
const label patchFaceI,
|
|
||||||
const point& faceCentre
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Apply rotation matrix to any coordinates
|
|
||||||
inline void transform
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const tensor&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Influence of neighbouring face.
|
|
||||||
inline bool updateCell
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const label thisCellI,
|
|
||||||
const label neighbourFaceI,
|
|
||||||
const sumData& neighbourInfo,
|
|
||||||
const scalar tol
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Influence of neighbouring cell.
|
|
||||||
inline bool updateFace
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const label thisFaceI,
|
|
||||||
const label neighbourCellI,
|
|
||||||
const sumData& neighbourInfo,
|
|
||||||
const scalar tol
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Influence of different value on same face.
|
|
||||||
inline bool updateFace
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const label thisFaceI,
|
|
||||||
const sumData& neighbourInfo,
|
|
||||||
const scalar tol
|
|
||||||
);
|
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
// Needed for List IO
|
|
||||||
inline bool operator==(const sumData&) const;
|
|
||||||
|
|
||||||
inline bool operator!=(const sumData&) const;
|
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const sumData&);
|
|
||||||
friend Istream& operator>>(Istream&, sumData&);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "sumDataI.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,226 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "polyMesh.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Null constructor
|
|
||||||
inline Foam::sumData::sumData()
|
|
||||||
:
|
|
||||||
oldFace_(-1),
|
|
||||||
sum_(0.0),
|
|
||||||
count_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
inline Foam::sumData::sumData
|
|
||||||
(
|
|
||||||
const label oldFace,
|
|
||||||
const scalar sum,
|
|
||||||
const label count
|
|
||||||
)
|
|
||||||
:
|
|
||||||
oldFace_(oldFace),
|
|
||||||
sum_(sum),
|
|
||||||
count_(count)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline bool Foam::sumData::valid() const
|
|
||||||
{
|
|
||||||
return oldFace_ != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// No geometric data so never any problem on cyclics
|
|
||||||
inline bool Foam::sumData::sameGeometry
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const sumData&,
|
|
||||||
const scalar
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// No geometric data.
|
|
||||||
inline void Foam::sumData::leaveDomain
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const polyPatch& patch,
|
|
||||||
const label patchFaceI,
|
|
||||||
const point& faceCentre
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// No geometric data.
|
|
||||||
inline void Foam::sumData::transform
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const tensor& rotTensor
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// No geometric data.
|
|
||||||
inline void Foam::sumData::enterDomain
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const polyPatch& patch,
|
|
||||||
const label patchFaceI,
|
|
||||||
const point& faceCentre
|
|
||||||
)
|
|
||||||
{
|
|
||||||
oldFace_ = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update cell with neighbouring face information
|
|
||||||
inline bool Foam::sumData::updateCell
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const label thisCellI,
|
|
||||||
const label neighbourFaceI,
|
|
||||||
const sumData& neighbourInfo,
|
|
||||||
const scalar tol
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!valid())
|
|
||||||
{
|
|
||||||
FatalErrorIn("sumData::updateCell") << "problem"
|
|
||||||
<< abort(FatalError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (count_ == 0)
|
|
||||||
{
|
|
||||||
sum_ += neighbourInfo.sum();
|
|
||||||
count_ = neighbourInfo.count() + 1;
|
|
||||||
oldFace_ = neighbourFaceI;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update face with neighbouring cell information
|
|
||||||
inline bool Foam::sumData::updateFace
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const label thisFaceI,
|
|
||||||
const label neighbourCellI,
|
|
||||||
const sumData& neighbourInfo,
|
|
||||||
const scalar tol
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// From cell to its faces.
|
|
||||||
|
|
||||||
// Check that face is opposite the previous one.
|
|
||||||
const cell& cFaces = mesh.cells()[neighbourCellI];
|
|
||||||
|
|
||||||
label wantedFaceI = cFaces.opposingFaceLabel
|
|
||||||
(
|
|
||||||
neighbourInfo.oldFace(),
|
|
||||||
mesh.faces()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (thisFaceI == wantedFaceI)
|
|
||||||
{
|
|
||||||
if (count_ != 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn("sumData::updateFace") << "problem"
|
|
||||||
<< abort(FatalError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sum_ += neighbourInfo.sum();
|
|
||||||
count_ = neighbourInfo.count();
|
|
||||||
oldFace_ = thisFaceI;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Update face with coupled face information
|
|
||||||
inline bool Foam::sumData::updateFace
|
|
||||||
(
|
|
||||||
const polyMesh&,
|
|
||||||
const label thisFaceI,
|
|
||||||
const sumData& neighbourInfo,
|
|
||||||
const scalar tol
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// From face to face (e.g. coupled faces)
|
|
||||||
if (count_ == 0)
|
|
||||||
{
|
|
||||||
sum_ += neighbourInfo.sum();
|
|
||||||
count_ = neighbourInfo.count();
|
|
||||||
oldFace_ = thisFaceI;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline bool Foam::sumData::operator==(const Foam::sumData& rhs)
|
|
||||||
const
|
|
||||||
{
|
|
||||||
return
|
|
||||||
oldFace() == rhs.oldFace()
|
|
||||||
&& sum() == rhs.sum()
|
|
||||||
&& count() == rhs.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::sumData::operator!=(const Foam::sumData& rhs)
|
|
||||||
const
|
|
||||||
{
|
|
||||||
return !(*this == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: 1.6 |
|
| \\ / O peration | Version: 1.7.1 |
|
||||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -95,18 +95,9 @@ sets
|
|||||||
type face;
|
type face;
|
||||||
axis x;
|
axis x;
|
||||||
|
|
||||||
//- flangeHex
|
|
||||||
//start (0 20 -20);
|
|
||||||
//end (0 20 10);
|
|
||||||
|
|
||||||
//- nablaCavity
|
|
||||||
//start (-1 0.05 0.005);
|
|
||||||
//end ( 1 0.05 0.005);
|
|
||||||
|
|
||||||
//- cavity
|
//- cavity
|
||||||
start (0.001 0.5101 0.00501);
|
start (0.0001 0.0525 0.00501);
|
||||||
end (2.01 0.5101 0.00501);
|
end (0.0999 0.0525 0.00501);
|
||||||
nPoints 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
somePoints
|
somePoints
|
||||||
|
|||||||
@ -209,11 +209,10 @@ int main(int argc, char *argv[])
|
|||||||
// write bounding box corners
|
// write bounding box corners
|
||||||
if (args.optionFound("blockMesh"))
|
if (args.optionFound("blockMesh"))
|
||||||
{
|
{
|
||||||
pointField cornerPts(boundBox(surf.points()).corners());
|
pointField cornerPts(boundBox(surf.points()).points());
|
||||||
|
|
||||||
Info<<"// blockMeshDict info" << nl;
|
Info<<"// blockMeshDict info" << nl
|
||||||
|
<<"vertices\n(" << nl;
|
||||||
Info<<"vertices\n(" << nl;
|
|
||||||
forAll(cornerPts, ptI)
|
forAll(cornerPts, ptI)
|
||||||
{
|
{
|
||||||
Info << " " << cornerPts[ptI] << nl;
|
Info << " " << cornerPts[ptI] << nl;
|
||||||
|
|||||||
@ -33,9 +33,6 @@ Description
|
|||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "face.H"
|
|
||||||
#include "tetPointRef.H"
|
|
||||||
#include "triFaceList.H"
|
|
||||||
#include "triSurface.H"
|
#include "triSurface.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
@ -43,242 +40,12 @@ Description
|
|||||||
#include "transform.H"
|
#include "transform.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "Pair.H"
|
#include "Pair.H"
|
||||||
|
#include "momentOfInertia.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
void massPropertiesSolid
|
|
||||||
(
|
|
||||||
const pointField& pts,
|
|
||||||
const triFaceList triFaces,
|
|
||||||
scalar density,
|
|
||||||
scalar& mass,
|
|
||||||
vector& cM,
|
|
||||||
tensor& J
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Reimplemented from: Wm4PolyhedralMassProperties.cpp
|
|
||||||
// File Version: 4.10.0 (2009/11/18)
|
|
||||||
|
|
||||||
// Geometric Tools, LC
|
|
||||||
// Copyright (c) 1998-2010
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt
|
|
||||||
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
|
|
||||||
|
|
||||||
// Boost Software License - Version 1.0 - August 17th, 2003
|
|
||||||
|
|
||||||
// Permission is hereby granted, free of charge, to any person or
|
|
||||||
// organization obtaining a copy of the software and accompanying
|
|
||||||
// documentation covered by this license (the "Software") to use,
|
|
||||||
// reproduce, display, distribute, execute, and transmit the
|
|
||||||
// Software, and to prepare derivative works of the Software, and
|
|
||||||
// to permit third-parties to whom the Software is furnished to do
|
|
||||||
// so, all subject to the following:
|
|
||||||
|
|
||||||
// The copyright notices in the Software and this entire
|
|
||||||
// statement, including the above license grant, this restriction
|
|
||||||
// and the following disclaimer, must be included in all copies of
|
|
||||||
// the Software, in whole or in part, and all derivative works of
|
|
||||||
// the Software, unless such copies or derivative works are solely
|
|
||||||
// in the form of machine-executable object code generated by a
|
|
||||||
// source language processor.
|
|
||||||
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
|
||||||
// NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
|
||||||
// ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
|
|
||||||
// OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
const scalar r6 = 1.0/6.0;
|
|
||||||
const scalar r24 = 1.0/24.0;
|
|
||||||
const scalar r60 = 1.0/60.0;
|
|
||||||
const scalar r120 = 1.0/120.0;
|
|
||||||
|
|
||||||
// order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx
|
|
||||||
scalarField integrals(10, 0.0);
|
|
||||||
|
|
||||||
forAll(triFaces, i)
|
|
||||||
{
|
|
||||||
const triFace& tri(triFaces[i]);
|
|
||||||
|
|
||||||
// vertices of triangle i
|
|
||||||
vector v0 = pts[tri[0]];
|
|
||||||
vector v1 = pts[tri[1]];
|
|
||||||
vector v2 = pts[tri[2]];
|
|
||||||
|
|
||||||
// cross product of edges
|
|
||||||
vector eA = v1 - v0;
|
|
||||||
vector eB = v2 - v0;
|
|
||||||
vector n = eA ^ eB;
|
|
||||||
|
|
||||||
// compute integral terms
|
|
||||||
scalar tmp0, tmp1, tmp2;
|
|
||||||
|
|
||||||
scalar f1x, f2x, f3x, g0x, g1x, g2x;
|
|
||||||
|
|
||||||
tmp0 = v0.x() + v1.x();
|
|
||||||
f1x = tmp0 + v2.x();
|
|
||||||
tmp1 = v0.x()*v0.x();
|
|
||||||
tmp2 = tmp1 + v1.x()*tmp0;
|
|
||||||
f2x = tmp2 + v2.x()*f1x;
|
|
||||||
f3x = v0.x()*tmp1 + v1.x()*tmp2 + v2.x()*f2x;
|
|
||||||
g0x = f2x + v0.x()*(f1x + v0.x());
|
|
||||||
g1x = f2x + v1.x()*(f1x + v1.x());
|
|
||||||
g2x = f2x + v2.x()*(f1x + v2.x());
|
|
||||||
|
|
||||||
scalar f1y, f2y, f3y, g0y, g1y, g2y;
|
|
||||||
|
|
||||||
tmp0 = v0.y() + v1.y();
|
|
||||||
f1y = tmp0 + v2.y();
|
|
||||||
tmp1 = v0.y()*v0.y();
|
|
||||||
tmp2 = tmp1 + v1.y()*tmp0;
|
|
||||||
f2y = tmp2 + v2.y()*f1y;
|
|
||||||
f3y = v0.y()*tmp1 + v1.y()*tmp2 + v2.y()*f2y;
|
|
||||||
g0y = f2y + v0.y()*(f1y + v0.y());
|
|
||||||
g1y = f2y + v1.y()*(f1y + v1.y());
|
|
||||||
g2y = f2y + v2.y()*(f1y + v2.y());
|
|
||||||
|
|
||||||
scalar f1z, f2z, f3z, g0z, g1z, g2z;
|
|
||||||
|
|
||||||
tmp0 = v0.z() + v1.z();
|
|
||||||
f1z = tmp0 + v2.z();
|
|
||||||
tmp1 = v0.z()*v0.z();
|
|
||||||
tmp2 = tmp1 + v1.z()*tmp0;
|
|
||||||
f2z = tmp2 + v2.z()*f1z;
|
|
||||||
f3z = v0.z()*tmp1 + v1.z()*tmp2 + v2.z()*f2z;
|
|
||||||
g0z = f2z + v0.z()*(f1z + v0.z());
|
|
||||||
g1z = f2z + v1.z()*(f1z + v1.z());
|
|
||||||
g2z = f2z + v2.z()*(f1z + v2.z());
|
|
||||||
|
|
||||||
// update integrals
|
|
||||||
integrals[0] += n.x()*f1x;
|
|
||||||
integrals[1] += n.x()*f2x;
|
|
||||||
integrals[2] += n.y()*f2y;
|
|
||||||
integrals[3] += n.z()*f2z;
|
|
||||||
integrals[4] += n.x()*f3x;
|
|
||||||
integrals[5] += n.y()*f3y;
|
|
||||||
integrals[6] += n.z()*f3z;
|
|
||||||
integrals[7] += n.x()*(v0.y()*g0x + v1.y()*g1x + v2.y()*g2x);
|
|
||||||
integrals[8] += n.y()*(v0.z()*g0y + v1.z()*g1y + v2.z()*g2y);
|
|
||||||
integrals[9] += n.z()*(v0.x()*g0z + v1.x()*g1z + v2.x()*g2z);
|
|
||||||
}
|
|
||||||
|
|
||||||
integrals[0] *= r6;
|
|
||||||
integrals[1] *= r24;
|
|
||||||
integrals[2] *= r24;
|
|
||||||
integrals[3] *= r24;
|
|
||||||
integrals[4] *= r60;
|
|
||||||
integrals[5] *= r60;
|
|
||||||
integrals[6] *= r60;
|
|
||||||
integrals[7] *= r120;
|
|
||||||
integrals[8] *= r120;
|
|
||||||
integrals[9] *= r120;
|
|
||||||
|
|
||||||
// mass
|
|
||||||
mass = integrals[0];
|
|
||||||
|
|
||||||
// center of mass
|
|
||||||
cM = vector(integrals[1], integrals[2], integrals[3])/mass;
|
|
||||||
|
|
||||||
// inertia relative to origin
|
|
||||||
J.xx() = integrals[5] + integrals[6];
|
|
||||||
J.xy() = -integrals[7];
|
|
||||||
J.xz() = -integrals[9];
|
|
||||||
J.yx() = J.xy();
|
|
||||||
J.yy() = integrals[4] + integrals[6];
|
|
||||||
J.yz() = -integrals[8];
|
|
||||||
J.zx() = J.xz();
|
|
||||||
J.zy() = J.yz();
|
|
||||||
J.zz() = integrals[4] + integrals[5];
|
|
||||||
|
|
||||||
// inertia relative to center of mass
|
|
||||||
J -= mass*((cM & cM)*I - cM*cM);
|
|
||||||
|
|
||||||
// Apply density
|
|
||||||
mass *= density;
|
|
||||||
J *= density;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void massPropertiesShell
|
|
||||||
(
|
|
||||||
const pointField& pts,
|
|
||||||
const triFaceList triFaces,
|
|
||||||
scalar density,
|
|
||||||
scalar& mass,
|
|
||||||
vector& cM,
|
|
||||||
tensor& J
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Reset properties for accumulation
|
|
||||||
|
|
||||||
mass = 0.0;
|
|
||||||
cM = vector::zero;
|
|
||||||
J = tensor::zero;
|
|
||||||
|
|
||||||
// Find centre of mass
|
|
||||||
|
|
||||||
forAll(triFaces, i)
|
|
||||||
{
|
|
||||||
const triFace& tri(triFaces[i]);
|
|
||||||
|
|
||||||
triPointRef t
|
|
||||||
(
|
|
||||||
pts[tri[0]],
|
|
||||||
pts[tri[1]],
|
|
||||||
pts[tri[2]]
|
|
||||||
);
|
|
||||||
|
|
||||||
scalar triMag = t.mag();
|
|
||||||
|
|
||||||
cM += triMag*t.centre();
|
|
||||||
|
|
||||||
mass += triMag;
|
|
||||||
}
|
|
||||||
|
|
||||||
cM /= mass;
|
|
||||||
|
|
||||||
mass *= density;
|
|
||||||
|
|
||||||
// Find inertia around centre of mass
|
|
||||||
|
|
||||||
forAll(triFaces, i)
|
|
||||||
{
|
|
||||||
const triFace& tri(triFaces[i]);
|
|
||||||
|
|
||||||
J += triPointRef
|
|
||||||
(
|
|
||||||
pts[tri[0]],
|
|
||||||
pts[tri[1]],
|
|
||||||
pts[tri[2]]
|
|
||||||
).inertia(cM, density);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tensor applyParallelAxisTheorem
|
|
||||||
(
|
|
||||||
scalar m,
|
|
||||||
const vector& cM,
|
|
||||||
const tensor& J,
|
|
||||||
const vector& refPt
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// The displacement vector (refPt = cM) is the displacement of the
|
|
||||||
// new reference point from the centre of mass of the body that
|
|
||||||
// the inertia tensor applies to.
|
|
||||||
|
|
||||||
vector d = (refPt - cM);
|
|
||||||
|
|
||||||
return J + m*((d & d)*I - d*d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
argList::addNote
|
argList::addNote
|
||||||
@ -321,40 +88,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
triSurface surf(surfFileName);
|
triSurface surf(surfFileName);
|
||||||
|
|
||||||
triFaceList faces(surf.size());
|
|
||||||
|
|
||||||
forAll(surf, i)
|
|
||||||
{
|
|
||||||
faces[i] = triFace(surf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
scalar m = 0.0;
|
scalar m = 0.0;
|
||||||
vector cM = vector::zero;
|
vector cM = vector::zero;
|
||||||
tensor J = tensor::zero;
|
tensor J = tensor::zero;
|
||||||
|
|
||||||
if (args.optionFound("shellProperties"))
|
if (args.optionFound("shellProperties"))
|
||||||
{
|
{
|
||||||
massPropertiesShell
|
momentOfInertia::massPropertiesShell(surf, density, m, cM, J);
|
||||||
(
|
|
||||||
surf.points(),
|
|
||||||
faces,
|
|
||||||
density,
|
|
||||||
m,
|
|
||||||
cM,
|
|
||||||
J
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
massPropertiesSolid
|
momentOfInertia::massPropertiesSolid(surf, density, m, cM, J);
|
||||||
(
|
|
||||||
surf.points(),
|
|
||||||
faces,
|
|
||||||
density,
|
|
||||||
m,
|
|
||||||
cM,
|
|
||||||
J
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m < 0)
|
if (m < 0)
|
||||||
@ -583,7 +327,7 @@ int main(int argc, char *argv[])
|
|||||||
showTransform = false;
|
showTransform = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << setprecision(10)
|
Info<< nl << setprecision(12)
|
||||||
<< "Density: " << density << nl
|
<< "Density: " << density << nl
|
||||||
<< "Mass: " << m << nl
|
<< "Mass: " << m << nl
|
||||||
<< "Centre of mass: " << cM << nl
|
<< "Centre of mass: " << cM << nl
|
||||||
@ -615,7 +359,7 @@ int main(int argc, char *argv[])
|
|||||||
if (calcAroundRefPt)
|
if (calcAroundRefPt)
|
||||||
{
|
{
|
||||||
Info<< nl << "Inertia tensor relative to " << refPt << ": " << nl
|
Info<< nl << "Inertia tensor relative to " << refPt << ": " << nl
|
||||||
<< applyParallelAxisTheorem(m, cM, J, refPt)
|
<< momentOfInertia::applyParallelAxisTheorem(m, cM, J, refPt)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -593,6 +593,7 @@ DebugSwitches
|
|||||||
muSgsSpalartAllmarasWallFunction 0;
|
muSgsSpalartAllmarasWallFunction 0;
|
||||||
multiDirRefinement 0;
|
multiDirRefinement 0;
|
||||||
multiHoleInjector 0;
|
multiHoleInjector 0;
|
||||||
|
multiLevel 1;
|
||||||
multivariateSelection 0;
|
multivariateSelection 0;
|
||||||
mutRoughWallFunction 0;
|
mutRoughWallFunction 0;
|
||||||
mutSpalartAllmarasStandardRoughWallFunction 0;
|
mutSpalartAllmarasStandardRoughWallFunction 0;
|
||||||
|
|||||||
@ -259,7 +259,8 @@ unset MPI_ARCH_PATH MPI_HOME
|
|||||||
|
|
||||||
case "$WM_MPLIB" in
|
case "$WM_MPLIB" in
|
||||||
OPENMPI)
|
OPENMPI)
|
||||||
mpi_version=openmpi-1.4.1
|
#mpi_version=openmpi-1.4.1
|
||||||
|
mpi_version=openmpi-1.5
|
||||||
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version
|
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version
|
||||||
|
|
||||||
# Tell OpenMPI where to find its install directory
|
# Tell OpenMPI where to find its install directory
|
||||||
|
|||||||
@ -58,17 +58,17 @@ const scalar
|
|||||||
Foam::KRR4::KRR4(const ODE& ode)
|
Foam::KRR4::KRR4(const ODE& ode)
|
||||||
:
|
:
|
||||||
ODESolver(ode),
|
ODESolver(ode),
|
||||||
yTemp_(n_),
|
yTemp_(n_, 0.0),
|
||||||
dydxTemp_(n_),
|
dydxTemp_(n_, 0.0),
|
||||||
g1_(n_),
|
g1_(n_, 0.0),
|
||||||
g2_(n_),
|
g2_(n_, 0.0),
|
||||||
g3_(n_),
|
g3_(n_, 0.0),
|
||||||
g4_(n_),
|
g4_(n_, 0.0),
|
||||||
yErr_(n_),
|
yErr_(n_, 0.0),
|
||||||
dfdx_(n_),
|
dfdx_(n_, 0.0),
|
||||||
dfdy_(n_, n_),
|
dfdy_(n_, n_, 0.0),
|
||||||
a_(n_, n_),
|
a_(n_, n_, 0.0),
|
||||||
pivotIndices_(n_)
|
pivotIndices_(n_, 0.0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,14 +57,14 @@ const scalar
|
|||||||
Foam::RK::RK(const ODE& ode)
|
Foam::RK::RK(const ODE& ode)
|
||||||
:
|
:
|
||||||
ODESolver(ode),
|
ODESolver(ode),
|
||||||
yTemp_(n_),
|
yTemp_(n_, 0.0),
|
||||||
ak2_(n_),
|
ak2_(n_, 0.0),
|
||||||
ak3_(n_),
|
ak3_(n_, 0.0),
|
||||||
ak4_(n_),
|
ak4_(n_, 0.0),
|
||||||
ak5_(n_),
|
ak5_(n_, 0.0),
|
||||||
ak6_(n_),
|
ak6_(n_, 0.0),
|
||||||
yErr_(n_),
|
yErr_(n_, 0.0),
|
||||||
yTemp2_(n_)
|
yTemp2_(n_, 0.0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,17 +50,17 @@ namespace Foam
|
|||||||
Foam::SIBS::SIBS(const ODE& ode)
|
Foam::SIBS::SIBS(const ODE& ode)
|
||||||
:
|
:
|
||||||
ODESolver(ode),
|
ODESolver(ode),
|
||||||
a_(iMaxX_),
|
a_(iMaxX_, 0.0),
|
||||||
alpha_(kMaxX_, kMaxX_),
|
alpha_(kMaxX_, kMaxX_, 0.0),
|
||||||
d_p_(n_, kMaxX_),
|
d_p_(n_, kMaxX_, 0.0),
|
||||||
x_p_(kMaxX_),
|
x_p_(kMaxX_, 0.0),
|
||||||
err_(kMaxX_),
|
err_(kMaxX_, 0.0),
|
||||||
|
|
||||||
yTemp_(n_),
|
yTemp_(n_, 0.0),
|
||||||
ySeq_(n_),
|
ySeq_(n_, 0.0),
|
||||||
yErr_(n_),
|
yErr_(n_, 0.0),
|
||||||
dfdx_(n_),
|
dfdx_(n_, 0.0),
|
||||||
dfdy_(n_, n_),
|
dfdy_(n_, n_, 0.0),
|
||||||
first_(1),
|
first_(1),
|
||||||
epsOld_(-1.0)
|
epsOld_(-1.0)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -514,8 +514,8 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
|||||||
refCast<const processorPolyPatch>(patch);
|
refCast<const processorPolyPatch>(patch);
|
||||||
|
|
||||||
// Allocate buffers
|
// Allocate buffers
|
||||||
labelList receiveFaces(patch.size());
|
labelList receiveFaces;
|
||||||
List<Type> receiveFacesInfo(patch.size());
|
List<Type> receiveFacesInfo;
|
||||||
|
|
||||||
{
|
{
|
||||||
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||||
@ -673,8 +673,7 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
|||||||
hasCyclicPatches_(hasCyclicPatch()),
|
hasCyclicPatches_(hasCyclicPatch()),
|
||||||
nEvals_(0),
|
nEvals_(0),
|
||||||
nUnvisitedCells_(mesh_.nCells()),
|
nUnvisitedCells_(mesh_.nCells()),
|
||||||
nUnvisitedFaces_(mesh_.nFaces()),
|
nUnvisitedFaces_(mesh_.nFaces())
|
||||||
iter_(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -705,16 +704,15 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
|||||||
hasCyclicPatches_(hasCyclicPatch()),
|
hasCyclicPatches_(hasCyclicPatch()),
|
||||||
nEvals_(0),
|
nEvals_(0),
|
||||||
nUnvisitedCells_(mesh_.nCells()),
|
nUnvisitedCells_(mesh_.nCells()),
|
||||||
nUnvisitedFaces_(mesh_.nFaces()),
|
nUnvisitedFaces_(mesh_.nFaces())
|
||||||
iter_(0)
|
|
||||||
{
|
{
|
||||||
// Copy initial changed faces data
|
// Copy initial changed faces data
|
||||||
setFaceInfo(changedFaces, changedFacesInfo);
|
setFaceInfo(changedFaces, changedFacesInfo);
|
||||||
|
|
||||||
// Iterate until nothing changes
|
// Iterate until nothing changes
|
||||||
iterate(maxIter);
|
label iter = iterate(maxIter);
|
||||||
|
|
||||||
if ((maxIter > 0) && (iter_ >= maxIter))
|
if ((maxIter > 0) && (iter >= maxIter))
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -794,7 +792,7 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Neighbour. Hack for check if face has neighbour.
|
// Neighbour.
|
||||||
if (faceI < nInternalFaces)
|
if (faceI < nInternalFaces)
|
||||||
{
|
{
|
||||||
cellI = neighbour[faceI];
|
cellI = neighbour[faceI];
|
||||||
@ -925,11 +923,13 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::iterate(const label maxIter)
|
|||||||
handleProcPatches();
|
handleProcPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (iter_ < maxIter)
|
label iter = 0;
|
||||||
|
|
||||||
|
while (iter < maxIter)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< " Iteration " << iter_ << endl;
|
Pout<< " Iteration " << iter << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
nEvals_ = 0;
|
nEvals_ = 0;
|
||||||
@ -961,10 +961,10 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::iterate(const label maxIter)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter_;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nUnvisitedCells_;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -114,9 +114,6 @@ class FaceCellWave
|
|||||||
label nUnvisitedCells_;
|
label nUnvisitedCells_;
|
||||||
label nUnvisitedFaces_;
|
label nUnvisitedFaces_;
|
||||||
|
|
||||||
//- Iteration counter
|
|
||||||
label iter_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -340,8 +337,8 @@ public:
|
|||||||
// counted double)
|
// counted double)
|
||||||
label cellToFace();
|
label cellToFace();
|
||||||
|
|
||||||
//- Iterate until no changes or maxIter reached. Returns number of
|
//- Iterate until no changes or maxIter reached. Returns actual
|
||||||
// unset cells (see getUnsetCells)
|
// number of iterations.
|
||||||
label iterate(const label maxIter);
|
label iterate(const label maxIter);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -134,8 +134,8 @@ public:
|
|||||||
return calc_.data();
|
return calc_.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Iterate until no changes or maxIter reached. Returns number of
|
//- Iterate until no changes or maxIter reached. Returns actual
|
||||||
// unset cells (see getUnsetCells)
|
// number of iterations.
|
||||||
label iterate(const label maxIter)
|
label iterate(const label maxIter)
|
||||||
{
|
{
|
||||||
return calc_.iterate(maxIter);
|
return calc_.iterate(maxIter);
|
||||||
|
|||||||
@ -66,6 +66,10 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
|
|||||||
: Pstream::treeCommunication()
|
: Pstream::treeCommunication()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Master reads headerclassname from file. Make sure this gets
|
||||||
|
// transfered as well as contents.
|
||||||
|
Pstream::scatter(comms, const_cast<word&>(headerClassName()));
|
||||||
|
Pstream::scatter(comms, note());
|
||||||
|
|
||||||
// Get my communication order
|
// Get my communication order
|
||||||
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
||||||
|
|||||||
@ -201,6 +201,11 @@ bool Foam::regIOobject::read()
|
|||||||
: Pstream::treeCommunication()
|
: Pstream::treeCommunication()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Master reads headerclassname from file. Make sure this gets
|
||||||
|
// transfered as well as contents.
|
||||||
|
Pstream::scatter(comms, const_cast<word&>(headerClassName()));
|
||||||
|
Pstream::scatter(comms, note());
|
||||||
|
|
||||||
|
|
||||||
// Get my communication order
|
// Get my communication order
|
||||||
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
||||||
|
|||||||
@ -36,6 +36,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
UNARY_FUNCTION(tensor, tensor, T, transform)
|
||||||
UNARY_FUNCTION(scalar, tensor, tr, transform)
|
UNARY_FUNCTION(scalar, tensor, tr, transform)
|
||||||
UNARY_FUNCTION(sphericalTensor, tensor, sph, transform)
|
UNARY_FUNCTION(sphericalTensor, tensor, sph, transform)
|
||||||
UNARY_FUNCTION(symmTensor, tensor, symm, transform)
|
UNARY_FUNCTION(symmTensor, tensor, symm, transform)
|
||||||
|
|||||||
@ -49,6 +49,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
UNARY_FUNCTION(tensor, tensor, T, transform)
|
||||||
UNARY_FUNCTION(scalar, tensor, tr, transform)
|
UNARY_FUNCTION(scalar, tensor, tr, transform)
|
||||||
UNARY_FUNCTION(sphericalTensor, tensor, sph, transform)
|
UNARY_FUNCTION(sphericalTensor, tensor, sph, transform)
|
||||||
UNARY_FUNCTION(symmTensor, tensor, symm, transform)
|
UNARY_FUNCTION(symmTensor, tensor, symm, transform)
|
||||||
|
|||||||
@ -736,7 +736,7 @@ Foam::argList::argList
|
|||||||
{
|
{
|
||||||
Info<< "Slaves : " << slaveProcs << nl;
|
Info<< "Slaves : " << slaveProcs << nl;
|
||||||
if (roots.size())
|
if (roots.size())
|
||||||
{
|
{
|
||||||
Info<< "Roots : " << roots << nl;
|
Info<< "Roots : " << roots << nl;
|
||||||
}
|
}
|
||||||
Info<< "Pstream initialized with:" << nl
|
Info<< "Pstream initialized with:" << nl
|
||||||
@ -770,7 +770,8 @@ Foam::argList::argList
|
|||||||
|
|
||||||
if (bannerEnabled)
|
if (bannerEnabled)
|
||||||
{
|
{
|
||||||
Info<< "Monitoring run-time modified files using "
|
Info<< "fileModificationChecking : "
|
||||||
|
<< "Monitoring run-time modified files using "
|
||||||
<< regIOobject::fileCheckTypesNames
|
<< regIOobject::fileCheckTypesNames
|
||||||
[
|
[
|
||||||
regIOobject::fileModificationChecking
|
regIOobject::fileModificationChecking
|
||||||
|
|||||||
@ -284,10 +284,8 @@ Type Foam::interpolationTable<Type>::rateOfChange(const scalar value) const
|
|||||||
case interpolationTable::REPEAT:
|
case interpolationTable::REPEAT:
|
||||||
{
|
{
|
||||||
// adjust lookupValue to >= minLimit
|
// adjust lookupValue to >= minLimit
|
||||||
while (lookupValue < minLimit)
|
scalar span = maxLimit-minLimit;
|
||||||
{
|
lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
|
||||||
lookupValue += maxLimit;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,10 +323,8 @@ Type Foam::interpolationTable<Type>::rateOfChange(const scalar value) const
|
|||||||
case interpolationTable::REPEAT:
|
case interpolationTable::REPEAT:
|
||||||
{
|
{
|
||||||
// adjust lookupValue <= maxLimit
|
// adjust lookupValue <= maxLimit
|
||||||
while (lookupValue > maxLimit)
|
scalar span = maxLimit-minLimit;
|
||||||
{
|
lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
|
||||||
lookupValue -= maxLimit;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -540,11 +536,9 @@ Type Foam::interpolationTable<Type>::operator()(const scalar value) const
|
|||||||
}
|
}
|
||||||
case interpolationTable::REPEAT:
|
case interpolationTable::REPEAT:
|
||||||
{
|
{
|
||||||
// adjust lookupValue to >= minLimin
|
// adjust lookupValue to >= minLimit
|
||||||
while (lookupValue < minLimit)
|
scalar span = maxLimit-minLimit;
|
||||||
{
|
lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
|
||||||
lookupValue += maxLimit;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -582,10 +576,8 @@ Type Foam::interpolationTable<Type>::operator()(const scalar value) const
|
|||||||
case interpolationTable::REPEAT:
|
case interpolationTable::REPEAT:
|
||||||
{
|
{
|
||||||
// adjust lookupValue <= maxLimit
|
// adjust lookupValue <= maxLimit
|
||||||
while (lookupValue > maxLimit)
|
scalar span = maxLimit-minLimit;
|
||||||
{
|
lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
|
||||||
lookupValue -= maxLimit;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,11 @@ Foam::solution::solution
|
|||||||
dictName,
|
dictName,
|
||||||
obr.time().system(),
|
obr.time().system(),
|
||||||
obr,
|
obr,
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
(
|
||||||
|
obr.readOpt() == IOobject::MUST_READ
|
||||||
|
? IOobject::MUST_READ_IF_MODIFIED
|
||||||
|
: obr.readOpt()
|
||||||
|
),
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@ -94,7 +98,14 @@ Foam::solution::solution
|
|||||||
defaultRelaxationFactor_(0),
|
defaultRelaxationFactor_(0),
|
||||||
solvers_(ITstream("solvers", tokenList())())
|
solvers_(ITstream("solvers", tokenList())())
|
||||||
{
|
{
|
||||||
read(solutionDict());
|
if
|
||||||
|
(
|
||||||
|
readOpt() == IOobject::MUST_READ
|
||||||
|
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
|
||||||
|
)
|
||||||
|
{
|
||||||
|
read(solutionDict());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@ Foam::boundBox::boundBox
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::pointField> Foam::boundBox::corners() const
|
Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
||||||
{
|
{
|
||||||
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
||||||
pointField& pt = tPts();
|
pointField& pt = tPts();
|
||||||
@ -274,7 +274,7 @@ Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
|
|||||||
{
|
{
|
||||||
if (is.format() == IOstream::ASCII)
|
if (is.format() == IOstream::ASCII)
|
||||||
{
|
{
|
||||||
return is >> bb.min_ >> bb.max_;
|
is >> bb.min_ >> bb.max_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -158,7 +158,7 @@ public:
|
|||||||
inline scalar avgDim() const;
|
inline scalar avgDim() const;
|
||||||
|
|
||||||
//- Return corner points in an order corresponding to a 'hex' cell
|
//- Return corner points in an order corresponding to a 'hex' cell
|
||||||
tmp<pointField> corners() const;
|
tmp<pointField> points() const;
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
|
|||||||
@ -165,6 +165,35 @@ const Foam::List<Foam::labelPair>& Foam::mapDistribute::schedule() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mapDistribute::checkReceivedSize
|
||||||
|
(
|
||||||
|
const label procI,
|
||||||
|
const label expectedSize,
|
||||||
|
const label receivedSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (receivedSize != expectedSize)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"template<class T>\n"
|
||||||
|
"void mapDistribute::distribute\n"
|
||||||
|
"(\n"
|
||||||
|
" const Pstream::commsTypes commsType,\n"
|
||||||
|
" const List<labelPair>& schedule,\n"
|
||||||
|
" const label constructSize,\n"
|
||||||
|
" const labelListList& subMap,\n"
|
||||||
|
" const labelListList& constructMap,\n"
|
||||||
|
" List<T>& field\n"
|
||||||
|
")\n"
|
||||||
|
) << "Expected from processor " << procI
|
||||||
|
<< " " << expectedSize << " but received "
|
||||||
|
<< receivedSize << " elements."
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
|
|||||||
@ -93,6 +93,15 @@ class mapDistribute
|
|||||||
mutable autoPtr<List<labelPair> > schedulePtr_;
|
mutable autoPtr<List<labelPair> > schedulePtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
static void checkReceivedSize
|
||||||
|
(
|
||||||
|
const label procI,
|
||||||
|
const label expectedSize,
|
||||||
|
const label receivedSize
|
||||||
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|||||||
@ -111,25 +111,7 @@ void Foam::mapDistribute::distribute
|
|||||||
IPstream fromNbr(Pstream::blocking, domain);
|
IPstream fromNbr(Pstream::blocking, domain);
|
||||||
List<T> subField(fromNbr);
|
List<T> subField(fromNbr);
|
||||||
|
|
||||||
if (subField.size() != map.size())
|
checkReceivedSize(domain, map.size(), subField.size());
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
|
||||||
" const labelListList& subMap,\n"
|
|
||||||
" const labelListList& constructMap,\n"
|
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << domain
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< subField.size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(map, i)
|
forAll(map, i)
|
||||||
{
|
{
|
||||||
@ -160,46 +142,52 @@ void Foam::mapDistribute::distribute
|
|||||||
forAll(schedule, i)
|
forAll(schedule, i)
|
||||||
{
|
{
|
||||||
const labelPair& twoProcs = schedule[i];
|
const labelPair& twoProcs = schedule[i];
|
||||||
|
// twoProcs is a swap pair of processors. The first one is the
|
||||||
|
// one that needs to send first and then receive.
|
||||||
|
|
||||||
label sendProc = twoProcs[0];
|
label sendProc = twoProcs[0];
|
||||||
label recvProc = twoProcs[1];
|
label recvProc = twoProcs[1];
|
||||||
|
|
||||||
if (Pstream::myProcNo() == sendProc)
|
if (Pstream::myProcNo() == sendProc)
|
||||||
{
|
{
|
||||||
// I am sender. Send to recvProc.
|
// I am send first, receive next
|
||||||
OPstream toNbr(Pstream::scheduled, recvProc);
|
{
|
||||||
toNbr << UIndirectList<T>(field, subMap[recvProc]);
|
OPstream toNbr(Pstream::scheduled, recvProc);
|
||||||
|
toNbr << UIndirectList<T>(field, subMap[recvProc]);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IPstream fromNbr(Pstream::scheduled, recvProc);
|
||||||
|
List<T> subField(fromNbr);
|
||||||
|
|
||||||
|
const labelList& map = constructMap[recvProc];
|
||||||
|
|
||||||
|
checkReceivedSize(recvProc, map.size(), subField.size());
|
||||||
|
|
||||||
|
forAll(map, i)
|
||||||
|
{
|
||||||
|
newField[map[i]] = subField[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// I am receiver. Receive from sendProc.
|
// I am receive first, send next
|
||||||
IPstream fromNbr(Pstream::scheduled, sendProc);
|
|
||||||
List<T> subField(fromNbr);
|
|
||||||
|
|
||||||
const labelList& map = constructMap[sendProc];
|
|
||||||
|
|
||||||
if (subField.size() != map.size())
|
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
IPstream fromNbr(Pstream::scheduled, sendProc);
|
||||||
(
|
List<T> subField(fromNbr);
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
const labelList& map = constructMap[sendProc];
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
checkReceivedSize(sendProc, map.size(), subField.size());
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
forAll(map, i)
|
||||||
" const labelListList& subMap,\n"
|
{
|
||||||
" const labelListList& constructMap,\n"
|
newField[map[i]] = subField[i];
|
||||||
" List<T>& field\n"
|
}
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << sendProc
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< subField.size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(map, i)
|
|
||||||
{
|
{
|
||||||
newField[map[i]] = subField[i];
|
OPstream toNbr(Pstream::scheduled, sendProc);
|
||||||
|
toNbr << UIndirectList<T>(field, subMap[sendProc]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,25 +246,7 @@ void Foam::mapDistribute::distribute
|
|||||||
UIPstream str(domain, pBufs);
|
UIPstream str(domain, pBufs);
|
||||||
List<T> recvField(str);
|
List<T> recvField(str);
|
||||||
|
|
||||||
if (recvField.size() != map.size())
|
checkReceivedSize(domain, map.size(), recvField.size());
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
|
||||||
" const labelListList& subMap,\n"
|
|
||||||
" const labelListList& constructMap,\n"
|
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << domain
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< recvField.size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(map, i)
|
forAll(map, i)
|
||||||
{
|
{
|
||||||
@ -379,29 +349,13 @@ void Foam::mapDistribute::distribute
|
|||||||
|
|
||||||
if (domain != Pstream::myProcNo() && map.size())
|
if (domain != Pstream::myProcNo() && map.size())
|
||||||
{
|
{
|
||||||
if (recvFields[domain].size() != map.size())
|
const List<T>& subField = recvFields[domain];
|
||||||
{
|
|
||||||
FatalErrorIn
|
checkReceivedSize(domain, map.size(), subField.size());
|
||||||
(
|
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
|
||||||
" const labelListList& subMap,\n"
|
|
||||||
" const labelListList& constructMap,\n"
|
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << domain
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< recvFields[domain].size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(map, i)
|
forAll(map, i)
|
||||||
{
|
{
|
||||||
field[map[i]] = recvFields[domain][i];
|
field[map[i]] = subField[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -502,25 +456,7 @@ void Foam::mapDistribute::distribute
|
|||||||
IPstream fromNbr(Pstream::blocking, domain);
|
IPstream fromNbr(Pstream::blocking, domain);
|
||||||
List<T> subField(fromNbr);
|
List<T> subField(fromNbr);
|
||||||
|
|
||||||
if (subField.size() != map.size())
|
checkReceivedSize(domain, map.size(), subField.size());
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
|
||||||
" const labelListList& subMap,\n"
|
|
||||||
" const labelListList& constructMap,\n"
|
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << domain
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< subField.size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(map, i)
|
forAll(map, i)
|
||||||
{
|
{
|
||||||
@ -551,46 +487,50 @@ void Foam::mapDistribute::distribute
|
|||||||
forAll(schedule, i)
|
forAll(schedule, i)
|
||||||
{
|
{
|
||||||
const labelPair& twoProcs = schedule[i];
|
const labelPair& twoProcs = schedule[i];
|
||||||
|
// twoProcs is a swap pair of processors. The first one is the
|
||||||
|
// one that needs to send first and then receive.
|
||||||
|
|
||||||
label sendProc = twoProcs[0];
|
label sendProc = twoProcs[0];
|
||||||
label recvProc = twoProcs[1];
|
label recvProc = twoProcs[1];
|
||||||
|
|
||||||
if (Pstream::myProcNo() == sendProc)
|
if (Pstream::myProcNo() == sendProc)
|
||||||
{
|
{
|
||||||
// I am sender. Send to recvProc.
|
// I am send first, receive next
|
||||||
OPstream toNbr(Pstream::scheduled, recvProc);
|
{
|
||||||
toNbr << UIndirectList<T>(field, subMap[recvProc]);
|
OPstream toNbr(Pstream::scheduled, recvProc);
|
||||||
|
toNbr << UIndirectList<T>(field, subMap[recvProc]);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IPstream fromNbr(Pstream::scheduled, recvProc);
|
||||||
|
List<T> subField(fromNbr);
|
||||||
|
const labelList& map = constructMap[recvProc];
|
||||||
|
|
||||||
|
checkReceivedSize(recvProc, map.size(), subField.size());
|
||||||
|
|
||||||
|
forAll(map, i)
|
||||||
|
{
|
||||||
|
cop(newField[map[i]], subField[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// I am receiver. Receive from sendProc.
|
// I am receive first, send next
|
||||||
IPstream fromNbr(Pstream::scheduled, sendProc);
|
|
||||||
List<T> subField(fromNbr);
|
|
||||||
|
|
||||||
const labelList& map = constructMap[sendProc];
|
|
||||||
|
|
||||||
if (subField.size() != map.size())
|
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
IPstream fromNbr(Pstream::scheduled, sendProc);
|
||||||
(
|
List<T> subField(fromNbr);
|
||||||
"template<class T>\n"
|
const labelList& map = constructMap[sendProc];
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
checkReceivedSize(sendProc, map.size(), subField.size());
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
forAll(map, i)
|
||||||
" const label constructSize,\n"
|
{
|
||||||
" const labelListList& subMap,\n"
|
cop(newField[map[i]], subField[i]);
|
||||||
" const labelListList& constructMap,\n"
|
}
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << sendProc
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< subField.size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(map, i)
|
|
||||||
{
|
{
|
||||||
cop(newField[map[i]], subField[i]);
|
OPstream toNbr(Pstream::scheduled, sendProc);
|
||||||
|
toNbr << UIndirectList<T>(field, subMap[sendProc]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,25 +589,7 @@ void Foam::mapDistribute::distribute
|
|||||||
UIPstream str(domain, pBufs);
|
UIPstream str(domain, pBufs);
|
||||||
List<T> recvField(str);
|
List<T> recvField(str);
|
||||||
|
|
||||||
if (recvField.size() != map.size())
|
checkReceivedSize(domain, map.size(), recvField.size());
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
|
||||||
" const labelListList& subMap,\n"
|
|
||||||
" const labelListList& constructMap,\n"
|
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << domain
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< recvField.size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(map, i)
|
forAll(map, i)
|
||||||
{
|
{
|
||||||
@ -769,29 +691,13 @@ void Foam::mapDistribute::distribute
|
|||||||
|
|
||||||
if (domain != Pstream::myProcNo() && map.size())
|
if (domain != Pstream::myProcNo() && map.size())
|
||||||
{
|
{
|
||||||
if (recvFields[domain].size() != map.size())
|
const List<T>& subField = recvFields[domain];
|
||||||
{
|
|
||||||
FatalErrorIn
|
checkReceivedSize(domain, map.size(), subField.size());
|
||||||
(
|
|
||||||
"template<class T>\n"
|
|
||||||
"void mapDistribute::distribute\n"
|
|
||||||
"(\n"
|
|
||||||
" const Pstream::commsTypes commsType,\n"
|
|
||||||
" const List<labelPair>& schedule,\n"
|
|
||||||
" const label constructSize,\n"
|
|
||||||
" const labelListList& subMap,\n"
|
|
||||||
" const labelListList& constructMap,\n"
|
|
||||||
" List<T>& field\n"
|
|
||||||
")\n"
|
|
||||||
) << "Expected from processor " << domain
|
|
||||||
<< " " << map.size() << " but received "
|
|
||||||
<< recvFields[domain].size() << " elements."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(map, i)
|
forAll(map, i)
|
||||||
{
|
{
|
||||||
cop(field[map[i]], recvFields[domain][i]);
|
cop(field[map[i]], subField[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ SourceFiles
|
|||||||
#include "tetPointRef.H"
|
#include "tetPointRef.H"
|
||||||
#include "triPointRef.H"
|
#include "triPointRef.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
#include "triFace.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -146,6 +147,10 @@ public:
|
|||||||
// mesh face for this tet from the supplied mesh
|
// mesh face for this tet from the supplied mesh
|
||||||
inline triPointRef faceTri(const polyMesh& mesh) const;
|
inline triPointRef faceTri(const polyMesh& mesh) const;
|
||||||
|
|
||||||
|
//- Return the point indices corresponding to the tri on the mesh
|
||||||
|
// face for this tet from the supplied mesh
|
||||||
|
inline triFace faceTriIs(const polyMesh& mesh) const;
|
||||||
|
|
||||||
//- Return the geometry corresponding to the tri on the
|
//- Return the geometry corresponding to the tri on the
|
||||||
// mesh face for this tet from the supplied mesh using
|
// mesh face for this tet from the supplied mesh using
|
||||||
// the old position
|
// the old position
|
||||||
|
|||||||
@ -122,6 +122,21 @@ Foam::triPointRef Foam::tetIndices::faceTri(const polyMesh& mesh) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::triFace Foam::tetIndices::faceTriIs(const polyMesh& mesh) const
|
||||||
|
{
|
||||||
|
const faceList& pFaces = mesh.faces();
|
||||||
|
|
||||||
|
const Foam::face& f = pFaces[faceI_];
|
||||||
|
|
||||||
|
return triFace
|
||||||
|
(
|
||||||
|
f[faceBasePtI_],
|
||||||
|
f[facePtAI_],
|
||||||
|
f[facePtBI_]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::triPointRef Foam::tetIndices::oldFaceTri(const polyMesh& mesh) const
|
Foam::triPointRef Foam::tetIndices::oldFaceTri(const polyMesh& mesh) const
|
||||||
{
|
{
|
||||||
const pointField& oldPPts = mesh.oldPoints();
|
const pointField& oldPPts = mesh.oldPoints();
|
||||||
|
|||||||
@ -273,6 +273,30 @@ void Foam::cyclicPolyPatch::calcTransforms
|
|||||||
half1Normals,
|
half1Normals,
|
||||||
half0Tols
|
half0Tols
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1)
|
||||||
|
{
|
||||||
|
const_cast<tensorField&>(forwardT()).setSize(1);
|
||||||
|
const_cast<tensorField&>(reverseT()).setSize(1);
|
||||||
|
const_cast<boolList&>(collocated()).setSize(1);
|
||||||
|
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"cyclicPolyPatch::calcTransforms\n"
|
||||||
|
" (\n"
|
||||||
|
" const primitivePatch&,\n"
|
||||||
|
" const UList<point>&,\n"
|
||||||
|
" const UList<point>&,\n"
|
||||||
|
" const UList<point>&,\n"
|
||||||
|
" const UList<point>&\n"
|
||||||
|
" )"
|
||||||
|
) << "For patch " << name()
|
||||||
|
<< " calculated non-uniform transform tensor even though"
|
||||||
|
<< " the transform type is " << transformTypeNames[transform_]
|
||||||
|
<< ". Setting the transformation tensor to be a uniform"
|
||||||
|
<< " rotation."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,22 +883,6 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledPoints() const
|
|||||||
str<< "l " << vertI-1 << ' ' << vertI << nl;
|
str<< "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any addressing calculated for the coupled edges calculation
|
|
||||||
const_cast<primitivePatch&>
|
|
||||||
(
|
|
||||||
static_cast<const primitivePatch&>
|
|
||||||
(
|
|
||||||
*this
|
|
||||||
)
|
|
||||||
).clearOut();
|
|
||||||
const_cast<primitivePatch&>
|
|
||||||
(
|
|
||||||
static_cast<const primitivePatch&>
|
|
||||||
(
|
|
||||||
neighbPatch()
|
|
||||||
)
|
|
||||||
).clearOut();
|
|
||||||
}
|
}
|
||||||
return *coupledPointsPtr_;
|
return *coupledPointsPtr_;
|
||||||
}
|
}
|
||||||
@ -1014,22 +1022,6 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
|
|||||||
str<< "l " << vertI-1 << ' ' << vertI << nl;
|
str<< "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any addressing calculated for the coupled edges calculation
|
|
||||||
const_cast<primitivePatch&>
|
|
||||||
(
|
|
||||||
static_cast<const primitivePatch&>
|
|
||||||
(
|
|
||||||
*this
|
|
||||||
)
|
|
||||||
).clearOut();
|
|
||||||
const_cast<primitivePatch&>
|
|
||||||
(
|
|
||||||
static_cast<const primitivePatch&>
|
|
||||||
(
|
|
||||||
neighbPatch
|
|
||||||
)
|
|
||||||
).clearOut();
|
|
||||||
}
|
}
|
||||||
return *coupledEdgesPtr_;
|
return *coupledEdgesPtr_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -409,6 +409,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove any addressing used for shared points/edges calculation
|
// Remove any addressing used for shared points/edges calculation
|
||||||
|
// since mostly not needed.
|
||||||
primitivePatch::clearOut();
|
primitivePatch::clearOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,8 +174,6 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
|||||||
// Update underlying cyclic
|
// Update underlying cyclic
|
||||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
|
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
|
||||||
|
|
||||||
Pout<< "updating geometry on refered patch:" << pp.name() << endl;
|
|
||||||
|
|
||||||
pp.calcGeometry
|
pp.calcGeometry
|
||||||
(
|
(
|
||||||
*this,
|
*this,
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "triangle.H"
|
#include "triangle.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
#include "triPointRef.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -150,23 +151,63 @@ inline Point Foam::tetrahedron<Point, PointRef>::circumCentre() const
|
|||||||
vector ba = b ^ a;
|
vector ba = b ^ a;
|
||||||
vector ca = c ^ a;
|
vector ca = c ^ a;
|
||||||
|
|
||||||
return a_ + 0.5*(a + (lambda*ba - mu*ca)/((c & ba) + ROOTVSMALL));
|
vector num = lambda*ba - mu*ca;
|
||||||
|
scalar denom = (c & ba);
|
||||||
|
|
||||||
|
if (Foam::mag(denom) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn("Point tetrahedron<Point, PointRef>::circumCentre() const")
|
||||||
|
<< "Degenerate tetrahedron:" << nl << *this << nl
|
||||||
|
<<"Returning centre instead of circumCentre."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return centre();
|
||||||
|
}
|
||||||
|
|
||||||
|
return a_ + 0.5*(a + num/denom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::circumRadius() const
|
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::circumRadius() const
|
||||||
{
|
{
|
||||||
return Foam::mag(a_ - circumCentre());
|
vector a = b_ - a_;
|
||||||
|
vector b = c_ - a_;
|
||||||
|
vector c = d_ - a_;
|
||||||
|
|
||||||
|
scalar lambda = magSqr(c) - (a & c);
|
||||||
|
scalar mu = magSqr(b) - (a & b);
|
||||||
|
|
||||||
|
vector ba = b ^ a;
|
||||||
|
vector ca = c ^ a;
|
||||||
|
|
||||||
|
vector num = lambda*ba - mu*ca;
|
||||||
|
scalar denom = (c & ba);
|
||||||
|
|
||||||
|
if (Foam::mag(denom) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn("Point tetrahedron<Point, PointRef>::circumCentre() const")
|
||||||
|
<< "Degenerate tetrahedron:" << nl << *this << nl
|
||||||
|
<< "Returning GREAT for circumRadius."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return GREAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Foam::mag(0.5*(a + num/denom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::quality() const
|
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::quality() const
|
||||||
{
|
{
|
||||||
// Note: 8/(9*sqrt(3)) = 0.5132002393
|
return
|
||||||
|
mag()
|
||||||
return mag()/(0.5132002393*pow3(min(circumRadius(), GREAT)) + ROOTVSMALL);
|
/(
|
||||||
|
8.0/(9.0*sqrt(3.0))
|
||||||
|
*pow3(min(circumRadius(), GREAT))
|
||||||
|
+ ROOTVSMALL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -238,7 +279,8 @@ Foam::scalar Foam::tetrahedron<Point, PointRef>::barycentric
|
|||||||
"const point& pt"
|
"const point& pt"
|
||||||
") const"
|
") const"
|
||||||
)
|
)
|
||||||
<< "Degenerate tetrahedron - returning 1/4 barycentric coordinates."
|
<< "Degenerate tetrahedron:" << nl << *this << nl
|
||||||
|
<< "Returning 1/4 barycentric coordinates."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
bary = List<scalar>(4, 0.25);
|
bary = List<scalar>(4, 0.25);
|
||||||
|
|||||||
@ -109,9 +109,9 @@ inline Foam::vector Foam::triangle<Point, PointRef>::normal() const
|
|||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Point Foam::triangle<Point, PointRef>::circumCentre() const
|
inline Point Foam::triangle<Point, PointRef>::circumCentre() const
|
||||||
{
|
{
|
||||||
scalar d1 = (c_ - a_)&(b_ - a_);
|
scalar d1 = (c_ - a_) & (b_ - a_);
|
||||||
scalar d2 = -(c_ - b_)&(b_ - a_);
|
scalar d2 = -(c_ - b_) & (b_ - a_);
|
||||||
scalar d3 = (c_ - a_)&(c_ - b_);
|
scalar d3 = (c_ - a_) & (c_ - b_);
|
||||||
|
|
||||||
scalar c1 = d2*d3;
|
scalar c1 = d2*d3;
|
||||||
scalar c2 = d3*d1;
|
scalar c2 = d3*d1;
|
||||||
@ -119,6 +119,16 @@ inline Point Foam::triangle<Point, PointRef>::circumCentre() const
|
|||||||
|
|
||||||
scalar c = c1 + c2 + c3;
|
scalar c = c1 + c2 + c3;
|
||||||
|
|
||||||
|
if (Foam::mag(c) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn("Point triangle<Point, PointRef>::circumCentre() const")
|
||||||
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "Returning centre instead of circumCentre."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return centre();
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
((c2 + c3)*a_ + (c3 + c1)*b_ + (c1 + c2)*c_)/(2*c)
|
((c2 + c3)*a_ + (c3 + c1)*b_ + (c1 + c2)*c_)/(2*c)
|
||||||
@ -129,14 +139,19 @@ inline Point Foam::triangle<Point, PointRef>::circumCentre() const
|
|||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
|
inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
|
||||||
{
|
{
|
||||||
scalar d1 = (c_ - a_) & (b_ - a_);
|
scalar d1 = (c_ - a_) & (b_ - a_);
|
||||||
scalar d2 = - (c_ - b_) & (b_ - a_);
|
scalar d2 = -(c_ - b_) & (b_ - a_);
|
||||||
scalar d3 = (c_ - a_) & (c_ - b_);
|
scalar d3 = (c_ - a_) & (c_ - b_);
|
||||||
|
|
||||||
scalar denom = d2*d3 + d3*d1 + d1*d2;
|
scalar denom = d2*d3 + d3*d1 + d1*d2;
|
||||||
|
|
||||||
if (Foam::mag(denom) < VSMALL)
|
if (Foam::mag(denom) < VSMALL)
|
||||||
{
|
{
|
||||||
|
WarningIn("scalar triangle<Point, PointRef>::circumRadius() const")
|
||||||
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "Returning GREAT for circumRadius."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
return GREAT;
|
return GREAT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -151,16 +166,7 @@ inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
|
|||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::scalar Foam::triangle<Point, PointRef>::quality() const
|
inline Foam::scalar Foam::triangle<Point, PointRef>::quality() const
|
||||||
{
|
{
|
||||||
// Note: 3*sqr(3)/(4*pi) = 0.4134966716
|
return mag()/(Foam::sqr(circumRadius())*3.0*sqrt(3.0)/4.0 + VSMALL);
|
||||||
|
|
||||||
return
|
|
||||||
mag()
|
|
||||||
/ (
|
|
||||||
constant::mathematical::pi
|
|
||||||
*Foam::sqr(circumRadius())
|
|
||||||
*0.4134966716
|
|
||||||
+ VSMALL
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -267,7 +273,8 @@ Foam::scalar Foam::triangle<Point, PointRef>::barycentric
|
|||||||
"const point& pt"
|
"const point& pt"
|
||||||
") const"
|
") const"
|
||||||
)
|
)
|
||||||
<< "Degenerate triangle - returning 1/3 barycentric coordinates."
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "Returning 1/3 barycentric coordinates."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
bary = List<scalar>(3, 1.0/3.0);
|
bary = List<scalar>(3, 1.0/3.0);
|
||||||
@ -493,7 +500,7 @@ Foam::pointHit Foam::triangle<Point, PointRef>::nearestPointClassify
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Adapted from:
|
// Adapted from:
|
||||||
// Real-time collision detection, Christer Ericson, 2005, 136-142
|
// Real-time collision detection, Christer Ericson, 2005, p136-142
|
||||||
|
|
||||||
// Check if P in vertex region outside A
|
// Check if P in vertex region outside A
|
||||||
vector ab = b_ - a_;
|
vector ab = b_ - a_;
|
||||||
@ -531,6 +538,27 @@ Foam::pointHit Foam::triangle<Point, PointRef>::nearestPointClassify
|
|||||||
|
|
||||||
if (vc <= 0.0 && d1 >= 0.0 && d3 <= 0.0)
|
if (vc <= 0.0 && d1 >= 0.0 && d3 <= 0.0)
|
||||||
{
|
{
|
||||||
|
if ((d1 - d3) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"pointHit triangle<Point, PointRef>::nearestPointClassify"
|
||||||
|
"("
|
||||||
|
"const point& p,"
|
||||||
|
"label& nearType,"
|
||||||
|
"label& nearLabel"
|
||||||
|
") const"
|
||||||
|
)
|
||||||
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "d1, d3: " << d1 << ", " << d3 << endl;
|
||||||
|
|
||||||
|
// For d1 = d3, a_ and b_ are likely coincident.
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
nearLabel = 0;
|
||||||
|
return pointHit(false, a_, Foam::mag(a_ - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
// barycentric coordinates (1-v, v, 0)
|
// barycentric coordinates (1-v, v, 0)
|
||||||
scalar v = d1/(d1 - d3);
|
scalar v = d1/(d1 - d3);
|
||||||
|
|
||||||
@ -559,6 +587,27 @@ Foam::pointHit Foam::triangle<Point, PointRef>::nearestPointClassify
|
|||||||
|
|
||||||
if (vb <= 0.0 && d2 >= 0.0 && d6 <= 0.0)
|
if (vb <= 0.0 && d2 >= 0.0 && d6 <= 0.0)
|
||||||
{
|
{
|
||||||
|
if ((d2 - d6) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"pointHit triangle<Point, PointRef>::nearestPointClassify"
|
||||||
|
"("
|
||||||
|
"const point& p,"
|
||||||
|
"label& nearType,"
|
||||||
|
"label& nearLabel"
|
||||||
|
") const"
|
||||||
|
)
|
||||||
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "d2, d6: " << d2 << ", " << d6 << endl;
|
||||||
|
|
||||||
|
// For d2 = d6, a_ and c_ are likely coincident.
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
nearLabel = 0;
|
||||||
|
return pointHit(false, a_, Foam::mag(a_ - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
// barycentric coordinates (1-w, 0, w)
|
// barycentric coordinates (1-w, 0, w)
|
||||||
scalar w = d2/(d2 - d6);
|
scalar w = d2/(d2 - d6);
|
||||||
|
|
||||||
@ -573,6 +622,28 @@ Foam::pointHit Foam::triangle<Point, PointRef>::nearestPointClassify
|
|||||||
|
|
||||||
if (va <= 0.0 && (d4 - d3) >= 0.0 && (d5 - d6) >= 0.0)
|
if (va <= 0.0 && (d4 - d3) >= 0.0 && (d5 - d6) >= 0.0)
|
||||||
{
|
{
|
||||||
|
if (((d4 - d3) + (d5 - d6)) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"pointHit triangle<Point, PointRef>::nearestPointClassify"
|
||||||
|
"("
|
||||||
|
"const point& p,"
|
||||||
|
"label& nearType,"
|
||||||
|
"label& nearLabel"
|
||||||
|
") const"
|
||||||
|
)
|
||||||
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "(d4 - d3), (d6 - d5): " << (d4 - d3) << ", " << (d6 - d5)
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
// For (d4 - d3) = (d6 - d5), b_ and c_ are likely coincident.
|
||||||
|
|
||||||
|
nearType = POINT;
|
||||||
|
nearLabel = 1;
|
||||||
|
return pointHit(false, b_, Foam::mag(b_ - p), true);
|
||||||
|
}
|
||||||
|
|
||||||
// barycentric coordinates (0, 1-w, w)
|
// barycentric coordinates (0, 1-w, w)
|
||||||
scalar w = (d4 - d3)/((d4 - d3) + (d5 - d6));
|
scalar w = (d4 - d3)/((d4 - d3) + (d5 - d6));
|
||||||
|
|
||||||
@ -584,6 +655,28 @@ Foam::pointHit Foam::triangle<Point, PointRef>::nearestPointClassify
|
|||||||
|
|
||||||
// P inside face region. Compute Q through its barycentric
|
// P inside face region. Compute Q through its barycentric
|
||||||
// coordinates (u, v, w)
|
// coordinates (u, v, w)
|
||||||
|
|
||||||
|
if ((va + vb + vc) < ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"pointHit triangle<Point, PointRef>::nearestPointClassify"
|
||||||
|
"("
|
||||||
|
"const point& p,"
|
||||||
|
"label& nearType,"
|
||||||
|
"label& nearLabel"
|
||||||
|
") const"
|
||||||
|
)
|
||||||
|
<< "Degenerate triangle:" << nl << *this << nl
|
||||||
|
<< "va, vb, vc: " << va << ", " << vb << ", " << vc
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
point nearPt = centre();
|
||||||
|
nearType = NONE,
|
||||||
|
nearLabel = -1;
|
||||||
|
return pointHit(true, nearPt, Foam::mag(nearPt - p), false);
|
||||||
|
}
|
||||||
|
|
||||||
scalar denom = 1.0/(va + vb + vc);
|
scalar denom = 1.0/(va + vb + vc);
|
||||||
scalar v = vb * denom;
|
scalar v = vb * denom;
|
||||||
scalar w = vc * denom;
|
scalar w = vc * denom;
|
||||||
|
|||||||
@ -32,7 +32,37 @@ License
|
|||||||
|
|
||||||
//! @cond fileScope
|
//! @cond fileScope
|
||||||
const char hexChars[] = "0123456789abcdef";
|
const char hexChars[] = "0123456789abcdef";
|
||||||
//! @endcond
|
//! @endcond fileScope
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
unsigned char Foam::SHA1Digest::readHexDigit(Istream& is)
|
||||||
|
{
|
||||||
|
// Takes into account that 'a' (or 'A') is 10
|
||||||
|
static const label alphaOffset = toupper('A') - 10;
|
||||||
|
// Takes into account that '0' is 0
|
||||||
|
static const label zeroOffset = int('0');
|
||||||
|
|
||||||
|
char c = 0;
|
||||||
|
is.read(c);
|
||||||
|
|
||||||
|
if (!isxdigit(c))
|
||||||
|
{
|
||||||
|
FatalIOErrorIn("SHA1Digest::readHexDigit(Istream&)", is)
|
||||||
|
<< "Illegal hex digit: '" << c << "'"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isdigit(c))
|
||||||
|
{
|
||||||
|
return int(c) - zeroOffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return toupper(c) - alphaOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -43,6 +73,12 @@ Foam::SHA1Digest::SHA1Digest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::SHA1Digest::SHA1Digest(Istream& is)
|
||||||
|
{
|
||||||
|
is >> *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::SHA1Digest::clear()
|
void Foam::SHA1Digest::clear()
|
||||||
@ -75,6 +111,23 @@ bool Foam::SHA1Digest::operator!=(const SHA1Digest& rhs) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Istream& Foam::operator>>(Istream& is, SHA1Digest& dig)
|
||||||
|
{
|
||||||
|
unsigned char *v = dig.v_;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < dig.length; ++i)
|
||||||
|
{
|
||||||
|
unsigned char c1 = SHA1Digest::readHexDigit(is);
|
||||||
|
unsigned char c2 = SHA1Digest::readHexDigit(is);
|
||||||
|
|
||||||
|
v[i] = (c1 << 4) + c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
is.check("Istream& operator>>(Istream&, SHA1Digest&)");
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const SHA1Digest& dig)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const SHA1Digest& dig)
|
||||||
{
|
{
|
||||||
const unsigned char *v = dig.v_;
|
const unsigned char *v = dig.v_;
|
||||||
|
|||||||
@ -45,11 +45,13 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class Ostream;
|
class Ostream;
|
||||||
|
class Istream;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
class SHA1;
|
class SHA1;
|
||||||
class SHA1Digest;
|
class SHA1Digest;
|
||||||
Ostream& operator<<(Ostream&, const SHA1Digest&);
|
Ostream& operator<<(Ostream&, const SHA1Digest&);
|
||||||
|
Istream& operator>>(Istream&, SHA1Digest&);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -67,6 +69,9 @@ public:
|
|||||||
//- Construct a zero digest
|
//- Construct a zero digest
|
||||||
SHA1Digest();
|
SHA1Digest();
|
||||||
|
|
||||||
|
//- Construct read a digest
|
||||||
|
SHA1Digest(Istream&);
|
||||||
|
|
||||||
//- Reset the digest to zero
|
//- Reset the digest to zero
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -77,11 +82,14 @@ public:
|
|||||||
bool operator!=(const SHA1Digest&) const;
|
bool operator!=(const SHA1Digest&) const;
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const SHA1Digest&);
|
friend Ostream& operator<<(Ostream&, const SHA1Digest&);
|
||||||
|
friend Istream& operator>>(Istream&, SHA1Digest&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//- The digest contents
|
//- The digest contents
|
||||||
unsigned char v_[length];
|
unsigned char v_[length];
|
||||||
|
|
||||||
|
static unsigned char readHexDigit(Istream&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,8 @@ EqOp(eqMag, x = mag(y))
|
|||||||
EqOp(plusEqMagSqr, x += magSqr(y))
|
EqOp(plusEqMagSqr, x += magSqr(y))
|
||||||
EqOp(maxEq, x = max(x, y))
|
EqOp(maxEq, x = max(x, y))
|
||||||
EqOp(minEq, x = min(x, y))
|
EqOp(minEq, x = min(x, y))
|
||||||
|
EqOp(minMagSqrEq, x = (magSqr(x)<=magSqr(y) ? x : y))
|
||||||
|
EqOp(maxMagSqrEq, x = (magSqr(x)>=magSqr(y) ? x : y))
|
||||||
EqOp(andEq, x = (x && y))
|
EqOp(andEq, x = (x && y))
|
||||||
EqOp(orEq, x = (x || y))
|
EqOp(orEq, x = (x || y))
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ Foam::string& Foam::string::replaceAll
|
|||||||
|
|
||||||
|
|
||||||
// Expand all occurences of environment variables and initial tilde sequences
|
// Expand all occurences of environment variables and initial tilde sequences
|
||||||
Foam::string& Foam::string::expand()
|
Foam::string& Foam::string::expand(const bool recurse)
|
||||||
{
|
{
|
||||||
size_type startEnvar = 0;
|
size_type startEnvar = 0;
|
||||||
|
|
||||||
@ -140,6 +140,10 @@ Foam::string& Foam::string::expand()
|
|||||||
|
|
||||||
if (enVarString.size())
|
if (enVarString.size())
|
||||||
{
|
{
|
||||||
|
if (recurse)
|
||||||
|
{
|
||||||
|
enVarString.expand();
|
||||||
|
}
|
||||||
std::string::replace
|
std::string::replace
|
||||||
(
|
(
|
||||||
startEnvar,
|
startEnvar,
|
||||||
|
|||||||
@ -182,7 +182,7 @@ public:
|
|||||||
//
|
//
|
||||||
// @sa
|
// @sa
|
||||||
// Foam::findEtcFile
|
// Foam::findEtcFile
|
||||||
string& expand();
|
string& expand(const bool recurse=false);
|
||||||
|
|
||||||
//- Remove repeated characters returning true if string changed
|
//- Remove repeated characters returning true if string changed
|
||||||
bool removeRepeated(const char);
|
bool removeRepeated(const char);
|
||||||
|
|||||||
@ -48,9 +48,11 @@ inline tensor rotationTensor
|
|||||||
const vector& n2
|
const vector& n2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const scalar s = n1 & n2;
|
||||||
|
const vector n3 = n1 ^ n2;
|
||||||
return
|
return
|
||||||
(n1 & n2)*I
|
s*I
|
||||||
+ (1 - (n1 & n2))*sqr(n1 ^ n2)/(magSqr(n1 ^ n2) + VSMALL)
|
+ (1 - s)*sqr(n3)/(magSqr(n3) + VSMALL)
|
||||||
+ (n2*n1 - n1*n2);
|
+ (n2*n1 - n1*n2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,8 @@
|
|||||||
(
|
(
|
||||||
dynamicFvMesh::defaultRegion,
|
dynamicFvMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user