mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'merge-foundation' of develop.openfoam.com:Development/OpenFOAM-plus into merge-foundation
Conflicts: src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Creating reaction model\n" << endl;
|
Info<< "Creating reaction model\n" << endl;
|
||||||
|
|
||||||
autoPtr<combustionModels::psiCombustionModel> reaction
|
autoPtr<combustionModels::psiCombustionModel> reaction
|
||||||
|
|||||||
@ -52,7 +52,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Creating reaction model\n" << endl;
|
Info<< "Creating reaction model\n" << endl;
|
||||||
|
|
||||||
autoPtr<combustionModels::rhoCombustionModel> reaction
|
autoPtr<combustionModels::rhoCombustionModel> reaction
|
||||||
|
|||||||
@ -53,7 +53,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Creating reaction model\n" << endl;
|
Info<< "Creating reaction model\n" << endl;
|
||||||
|
|
||||||
autoPtr<combustionModels::rhoCombustionModel> reaction
|
autoPtr<combustionModels::rhoCombustionModel> reaction
|
||||||
|
|||||||
@ -53,7 +53,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Reading thermophysical properties\n" << endl;
|
Info<< "Reading thermophysical properties\n" << endl;
|
||||||
|
|
||||||
autoPtr<psiThermo> pThermo
|
autoPtr<psiThermo> pThermo
|
||||||
|
|||||||
@ -39,6 +39,8 @@ Description
|
|||||||
#include "turbulentFluidThermoModel.H"
|
#include "turbulentFluidThermoModel.H"
|
||||||
#include "fixedRhoFvPatchScalarField.H"
|
#include "fixedRhoFvPatchScalarField.H"
|
||||||
#include "directionInterpolate.H"
|
#include "directionInterpolate.H"
|
||||||
|
#include "localEulerDdtScheme.H"
|
||||||
|
#include "fvcSmooth.H"
|
||||||
#include "motionSolver.H"
|
#include "motionSolver.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -54,7 +54,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
|
|
||||||
turbulence->validate();
|
turbulence->validate();
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Reading thermophysical properties\n" << endl;
|
Info<< "Reading thermophysical properties\n" << endl;
|
||||||
|
|
||||||
autoPtr<psiThermo> pThermo
|
autoPtr<psiThermo> pThermo
|
||||||
|
|||||||
@ -57,7 +57,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createDynamicFvMesh.H"
|
#include "createDynamicFvMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|||||||
@ -56,7 +56,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Global
|
Global
|
||||||
setInitialDeltaT
|
setInitialMultiRegionDeltaT
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Set the initial timestep for the CHT MultiRegion solver.
|
Set the initial timestep for the CHT MultiRegion solver.
|
||||||
@ -48,7 +48,7 @@ if (adjustTimeStep)
|
|||||||
min
|
min
|
||||||
(
|
(
|
||||||
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(),
|
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(),
|
||||||
maxDeltaT
|
min(runTime.deltaTValue(), maxDeltaT)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -63,13 +63,8 @@ adjointOutletPressureFvPatchScalarField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(p, iF)
|
fixedValueFvPatchScalarField(p, iF, dict)
|
||||||
{
|
{}
|
||||||
fvPatchField<scalar>::operator=
|
|
||||||
(
|
|
||||||
scalarField("value", dict, p.size())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::adjointOutletPressureFvPatchScalarField::
|
Foam::adjointOutletPressureFvPatchScalarField::
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -50,10 +50,8 @@ adjointOutletVelocityFvPatchVectorField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(p, iF)
|
fixedValueFvPatchVectorField(p, iF, dict)
|
||||||
{
|
{}
|
||||||
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::adjointOutletVelocityFvPatchVectorField::
|
Foam::adjointOutletVelocityFvPatchVectorField::
|
||||||
|
|||||||
@ -28,8 +28,8 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "makeTurbulenceModel.H"
|
#include "makeTurbulenceModel.H"
|
||||||
|
|
||||||
#include "laminar.H"
|
#include "laminarModel.H"
|
||||||
#include "turbulentTransportModel.H"
|
#include "RASModel.H"
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -52,6 +52,10 @@ makeBaseTurbulenceModel
|
|||||||
singlePhaseTransportModel
|
singlePhaseTransportModel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#define makeLaminarModel(Type) \
|
||||||
|
makeTemplatedTurbulenceModel \
|
||||||
|
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, laminar, Type)
|
||||||
|
|
||||||
#define makeRASModel(Type) \
|
#define makeRASModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, RAS, Type)
|
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, RAS, Type)
|
||||||
@ -60,6 +64,9 @@ makeBaseTurbulenceModel
|
|||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, LES, Type)
|
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, LES, Type)
|
||||||
|
|
||||||
|
#include "Stokes.H"
|
||||||
|
makeLaminarModel(Stokes);
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
makeRASModel(kEpsilon);
|
makeRASModel(kEpsilon);
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
|
|
||||||
Info<< "Creating combustion model\n" << endl;
|
Info<< "Creating combustion model\n" << endl;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I. \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/sampling/lnInclude \
|
-I${LIB_SRC}/sampling/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
@ -25,7 +26,6 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/combustionModels/lnInclude \
|
-I$(LIB_SRC)/combustionModels/lnInclude \
|
||||||
-I$(FOAM_SOLVERS)/combustion/reactingFoam
|
-I$(FOAM_SOLVERS)/combustion/reactingFoam
|
||||||
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lfvOptions \
|
-lfvOptions \
|
||||||
|
|||||||
@ -1 +1,5 @@
|
|||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species()[inertSpecie]);
|
||||||
|
|
||||||
|
const volScalarField& T = thermo.T();
|
||||||
|
const volScalarField& psi = thermo.psi();
|
||||||
|
filmModelType& surfaceFilm = tsurfaceFilm();
|
||||||
|
|||||||
@ -37,8 +37,6 @@ volScalarField rho
|
|||||||
);
|
);
|
||||||
|
|
||||||
volScalarField& p = thermo.p();
|
volScalarField& p = thermo.p();
|
||||||
const volScalarField& T = thermo.T();
|
|
||||||
const volScalarField& psi = thermo.psi();
|
|
||||||
|
|
||||||
Info<< "\nReading field U\n" << endl;
|
Info<< "\nReading field U\n" << endl;
|
||||||
volVectorField U
|
volVectorField U
|
||||||
|
|||||||
@ -3,5 +3,3 @@ Info<< "\nConstructing surface film model" << endl;
|
|||||||
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||||
|
|
||||||
autoPtr<filmModelType> tsurfaceFilm(filmModelType::New(mesh, g));
|
autoPtr<filmModelType> tsurfaceFilm(filmModelType::New(mesh, g));
|
||||||
filmModelType& surfaceFilm = tsurfaceFilm();
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
|
|
||||||
Info<< "Creating combustion model\n" << endl;
|
Info<< "Creating combustion model\n" << endl;
|
||||||
|
|||||||
@ -55,7 +55,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
|
|||||||
@ -28,7 +28,6 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "makeTurbulenceModel.H"
|
#include "makeTurbulenceModel.H"
|
||||||
|
|
||||||
#include "laminar.H"
|
|
||||||
#include "turbulentTransportModel.H"
|
#include "turbulentTransportModel.H"
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
|
|
||||||
@ -50,13 +49,32 @@ makeBaseTurbulenceModel
|
|||||||
immiscibleIncompressibleTwoPhaseMixture
|
immiscibleIncompressibleTwoPhaseMixture
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#define makeLaminarModel(Type) \
|
||||||
|
makeTemplatedTurbulenceModel \
|
||||||
|
( \
|
||||||
|
immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel,\
|
||||||
|
laminar, \
|
||||||
|
Type \
|
||||||
|
)
|
||||||
|
|
||||||
#define makeRASModel(Type) \
|
#define makeRASModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel, RAS, Type)
|
( \
|
||||||
|
immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel,\
|
||||||
|
RAS, \
|
||||||
|
Type \
|
||||||
|
)
|
||||||
|
|
||||||
#define makeLESModel(Type) \
|
#define makeLESModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel, LES, Type)
|
( \
|
||||||
|
immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel,\
|
||||||
|
LES, \
|
||||||
|
Type \
|
||||||
|
)
|
||||||
|
|
||||||
|
#include "Stokes.H"
|
||||||
|
makeLaminarModel(Stokes);
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
makeRASModel(kEpsilon);
|
makeRASModel(kEpsilon);
|
||||||
@ -70,4 +88,5 @@ makeLESModel(kEqn);
|
|||||||
#include "kOmega.H"
|
#include "kOmega.H"
|
||||||
makeRASModel(kOmega);
|
makeRASModel(kOmega);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -28,7 +28,7 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "makeTurbulenceModel.H"
|
#include "makeTurbulenceModel.H"
|
||||||
|
|
||||||
#include "laminar.H"
|
#include "laminarModel.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
|
|
||||||
@ -52,6 +52,14 @@ makeBaseTurbulenceModel
|
|||||||
incompressibleTwoPhaseInteractingMixture
|
incompressibleTwoPhaseInteractingMixture
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#define makeLaminarModel(Type) \
|
||||||
|
makeTemplatedTurbulenceModel \
|
||||||
|
( \
|
||||||
|
incompressibleTwoPhaseInteractingMixtureCompressibleTurbulenceModel, \
|
||||||
|
laminar, \
|
||||||
|
Type \
|
||||||
|
)
|
||||||
|
|
||||||
#define makeRASModel(Type) \
|
#define makeRASModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
( \
|
( \
|
||||||
@ -68,6 +76,9 @@ makeBaseTurbulenceModel
|
|||||||
Type \
|
Type \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#include "Stokes.H"
|
||||||
|
makeLaminarModel(Stokes);
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
makeRASModel(kEpsilon);
|
makeRASModel(kEpsilon);
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Reading field p_rgh\n" << endl;
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
volScalarField p_rgh
|
volScalarField p_rgh
|
||||||
(
|
(
|
||||||
|
|||||||
@ -63,7 +63,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createDyMControls.H"
|
#include "createDyMControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Reading field p_rgh\n" << endl;
|
Info<< "Reading field p_rgh\n" << endl;
|
||||||
volScalarField p_rgh
|
volScalarField p_rgh
|
||||||
(
|
(
|
||||||
|
|||||||
@ -55,7 +55,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
|
|||||||
0
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.C
Executable file → Normal file
0
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.C
Executable file → Normal file
0
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.H
Executable file → Normal file
0
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Beetstra/Beetstra.H
Executable file → Normal file
0
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.C
Executable file → Normal file
0
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.C
Executable file → Normal file
3
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.H
Executable file → Normal file
3
applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/Tenneti/Tenneti.H
Executable file → Normal file
@ -58,6 +58,7 @@ namespace dragModels
|
|||||||
{
|
{
|
||||||
|
|
||||||
class SchillerNaumann;
|
class SchillerNaumann;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class Tenneti Declaration
|
Class Tenneti Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -68,7 +69,7 @@ class Tenneti
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Ergun drag model
|
//- SchillerNaumann drag model
|
||||||
autoPtr<SchillerNaumann> SchillerNaumann_;
|
autoPtr<SchillerNaumann> SchillerNaumann_;
|
||||||
|
|
||||||
//- Residual Reynolds Number
|
//- Residual Reynolds Number
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
#include "readhRef.H"
|
#include "readhRef.H"
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "makeTurbulenceModel.H"
|
#include "makeTurbulenceModel.H"
|
||||||
|
|
||||||
#include "laminar.H"
|
#include "laminarModel.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
|
|
||||||
@ -53,6 +53,10 @@ makeBaseTurbulenceModel
|
|||||||
phaseModel
|
phaseModel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#define makeLaminarModel(Type) \
|
||||||
|
makeTemplatedLaminarModel \
|
||||||
|
(phaseModelPhaseCompressibleTurbulenceModel, laminar, Type)
|
||||||
|
|
||||||
#define makeRASModel(Type) \
|
#define makeRASModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
||||||
@ -61,6 +65,9 @@ makeBaseTurbulenceModel
|
|||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
||||||
|
|
||||||
|
#include "Stokes.H"
|
||||||
|
makeLaminarModel(Stokes);
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
makeRASModel(kEpsilon);
|
makeRASModel(kEpsilon);
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
#include "readhRef.H"
|
#include "readhRef.H"
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "makeTurbulenceModel.H"
|
#include "makeTurbulenceModel.H"
|
||||||
|
|
||||||
#include "laminar.H"
|
#include "laminarModel.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
|
|
||||||
@ -53,6 +53,10 @@ makeBaseTurbulenceModel
|
|||||||
phaseModel
|
phaseModel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#define makeLaminarModel(Type) \
|
||||||
|
makeTemplatedLaminarModel \
|
||||||
|
(phaseModelPhaseCompressibleTurbulenceModel, laminar, Type)
|
||||||
|
|
||||||
#define makeRASModel(Type) \
|
#define makeRASModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
||||||
@ -61,6 +65,9 @@ makeBaseTurbulenceModel
|
|||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
||||||
|
|
||||||
|
#include "Stokes.H"
|
||||||
|
makeLaminarModel(Stokes);
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
makeRASModel(kEpsilon);
|
makeRASModel(kEpsilon);
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ License
|
|||||||
#include "ThermalDiffusivity.H"
|
#include "ThermalDiffusivity.H"
|
||||||
#include "EddyDiffusivity.H"
|
#include "EddyDiffusivity.H"
|
||||||
|
|
||||||
#include "laminar.H"
|
#include "laminarModel.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
|
|
||||||
@ -58,6 +58,10 @@ makeBaseTurbulenceModel
|
|||||||
phaseModel
|
phaseModel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#define makeLaminarModel(Type) \
|
||||||
|
makeTemplatedLaminarModel \
|
||||||
|
(phaseModelPhaseCompressibleTurbulenceModel, laminar, Type)
|
||||||
|
|
||||||
#define makeRASModel(Type) \
|
#define makeRASModel(Type) \
|
||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
||||||
@ -66,6 +70,9 @@ makeBaseTurbulenceModel
|
|||||||
makeTemplatedTurbulenceModel \
|
makeTemplatedTurbulenceModel \
|
||||||
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
||||||
|
|
||||||
|
#include "Stokes.H"
|
||||||
|
makeLaminarModel(Stokes);
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
makeRASModel(kEpsilon);
|
makeRASModel(kEpsilon);
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-namedEnum.C
|
Test-NamedEnum.C
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
|
EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
|
||||||
|
|||||||
114
applications/test/NamedEnum/Test-NamedEnum.C
Normal file
114
applications/test/NamedEnum/Test-NamedEnum.C
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ 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/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
class namedEnumTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum option
|
||||||
|
{
|
||||||
|
a,
|
||||||
|
b,
|
||||||
|
c,
|
||||||
|
d
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Foam::NamedEnum<option, 4> namedEnum;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum<namedEnumTest::option, 4>::names[] =
|
||||||
|
{
|
||||||
|
"a",
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"d"
|
||||||
|
};
|
||||||
|
|
||||||
|
const Foam::NamedEnum<namedEnumTest::option, 4> namedEnumTest::namedEnum;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
const List<namedEnumTest::option> options
|
||||||
|
= namedEnumTest::namedEnum.enums();
|
||||||
|
|
||||||
|
Info<< "enums: " << options << nl;
|
||||||
|
|
||||||
|
Info<< "loop over enums (as list):" << nl;
|
||||||
|
forAll(options, i)
|
||||||
|
{
|
||||||
|
const namedEnumTest::option& opt = options[i];
|
||||||
|
|
||||||
|
Info<< "option[" << opt
|
||||||
|
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __cplusplus > 201100L
|
||||||
|
// C++11
|
||||||
|
Info<< "loop over enums (C++11 for range):" << nl;
|
||||||
|
for (auto const& opt : options)
|
||||||
|
{
|
||||||
|
Info<< "option[" << opt
|
||||||
|
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Info<< "loop over enums (via iterator):" << nl;
|
||||||
|
forAllConstIter(List<namedEnumTest::option>, options, iter)
|
||||||
|
{
|
||||||
|
const namedEnumTest::option& opt = *iter;
|
||||||
|
|
||||||
|
Info<< "option[" << opt
|
||||||
|
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< namedEnumTest::namedEnum["a"] << nl
|
||||||
|
<< namedEnumTest::namedEnum[namedEnumTest::a] << nl;
|
||||||
|
|
||||||
|
Info<< "--- test read construction ---" << endl;
|
||||||
|
|
||||||
|
namedEnumTest::option dummy(namedEnumTest::namedEnum.read(Sin));
|
||||||
|
Info<< namedEnumTest::namedEnum[dummy] << endl;
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -48,14 +48,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
{
|
{
|
||||||
dictionary dict;
|
dictionary dict;
|
||||||
dict.add("aaOPENMPIcc", 1);
|
dict.add(word("aa" + getEnv("WM_MPLIB") + "cc"), 16);
|
||||||
|
|
||||||
string s("DDD${aa${WM_MPLIB}cc}EEE");
|
string s("DDD${aa${WM_MPLIB}cc}EEE");
|
||||||
stringOps::inplaceExpand(s, dict, true, false);
|
stringOps::inplaceExpand(s, dict, true, false);
|
||||||
Info<< "variable expansion:" << s << endl;
|
Info<< "variable expansion:" << s << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
|
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
|
||||||
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
||||||
@ -65,7 +64,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
dictionary dict1(IFstream("testDict")());
|
dictionary dict1(IFstream("testDict")());
|
||||||
Info<< "dict1: " << dict1 << nl
|
dict1.writeEntry("dict1", Info);
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
<< "toc: " << dict1.toc() << nl
|
<< "toc: " << dict1.toc() << nl
|
||||||
<< "keys: " << dict1.keys() << nl
|
<< "keys: " << dict1.keys() << nl
|
||||||
<< "patterns: " << dict1.keys(true) << endl;
|
<< "patterns: " << dict1.keys(true) << endl;
|
||||||
@ -89,14 +90,14 @@ int main(int argc, char *argv[])
|
|||||||
<< "no = " << dict4.name() << " " << dict4.toc() << endl;
|
<< "no = " << dict4.name() << " " << dict4.toc() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IOobject::writeDivider(Info);
|
IOobject::writeDivider(Info);
|
||||||
|
|
||||||
{
|
{
|
||||||
dictionary dict(IFstream("testDictRegex")());
|
dictionary dict(IFstream("testDictRegex")());
|
||||||
dict.add(keyType("fooba[rz]", true), "anything");
|
dict.add(keyType("fooba[rz]", true), "anything");
|
||||||
|
|
||||||
Info<< "dict:" << dict << nl
|
dict.writeEntry("testDictRegex", Info);
|
||||||
|
Info<< nl
|
||||||
<< "toc: " << dict.toc() << nl
|
<< "toc: " << dict.toc() << nl
|
||||||
<< "keys: " << dict.keys() << nl
|
<< "keys: " << dict.keys() << nl
|
||||||
<< "patterns: " << dict.keys(true) << endl;
|
<< "patterns: " << dict.keys(true) << endl;
|
||||||
|
|||||||
3
applications/test/fvc2D/Make/files
Normal file
3
applications/test/fvc2D/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-fvc2D.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-fvc2D
|
||||||
7
applications/test/fvc2D/Make/options
Normal file
7
applications/test/fvc2D/Make/options
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -21,55 +21,51 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
test
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Finite volume method test code for 2-D space.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "NamedEnum.H"
|
#include "fvCFD.H"
|
||||||
#include "IOstreams.H"
|
#include "vector2D.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
class namedEnumTest
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
enum options
|
|
||||||
{
|
|
||||||
a,
|
|
||||||
b,
|
|
||||||
c
|
|
||||||
};
|
|
||||||
|
|
||||||
static const Foam::NamedEnum<options, 3> namedEnum;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
const char* Foam::NamedEnum<namedEnumTest::options, 3>::names[] =
|
|
||||||
{
|
|
||||||
"a",
|
|
||||||
"b",
|
|
||||||
"c"
|
|
||||||
};
|
|
||||||
|
|
||||||
const Foam::NamedEnum<namedEnumTest::options, 3> namedEnumTest::namedEnum;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef GeometricField<vector2D, fvPatchField, volMesh> volVector2DField;
|
||||||
|
|
||||||
|
defineTemplate2TypeNameAndDebug(volVector2DField::Internal, 0);
|
||||||
|
defineTemplateTypeNameAndDebug(volVector2DField, 0);
|
||||||
|
|
||||||
|
typedef fvPatchField<vector2D> fvPatchVector2DField;
|
||||||
|
makeFvPatchField(fvPatchVector2DField)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Info<< namedEnumTest::namedEnum["a"] << endl;
|
#include "setRootCase.H"
|
||||||
Info<< namedEnumTest::namedEnum[namedEnumTest::a] << endl;
|
|
||||||
|
|
||||||
namedEnumTest::options hmm(namedEnumTest::namedEnum.read(Sin));
|
#include "createTime.H"
|
||||||
Info<< namedEnumTest::namedEnum[hmm] << endl;
|
#include "createMesh.H"
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
GeometricField<vector2D, fvPatchField, volMesh> fld
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
return 0;
|
Info<< "end" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3,7 +3,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) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,6 +31,10 @@ Description
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
|
#include "int.H"
|
||||||
|
#include "uint.H"
|
||||||
|
#include "scalar.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -118,6 +122,8 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "after replace: " << test2 << endl;
|
Info<< "after replace: " << test2 << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout<< "\nEnter some string to test:\n";
|
||||||
|
|
||||||
string s;
|
string s;
|
||||||
Sin.getLine(s);
|
Sin.getLine(s);
|
||||||
|
|
||||||
@ -126,7 +132,39 @@ int main(int argc, char *argv[])
|
|||||||
cout<< "output string with " << s2.length() << " characters\n";
|
cout<< "output string with " << s2.length() << " characters\n";
|
||||||
cout<< "ostream<< >" << s2 << "<\n";
|
cout<< "ostream<< >" << s2 << "<\n";
|
||||||
Info<< "Ostream<< >" << s2 << "<\n";
|
Info<< "Ostream<< >" << s2 << "<\n";
|
||||||
Info<< "hash:" << hex << string::hash()(s2) << endl;
|
Info<< "hash:" << hex << string::hash()(s2) << dec << endl;
|
||||||
|
|
||||||
|
cout<< "\ntest Foam::name()\n";
|
||||||
|
|
||||||
|
Info<< "hash: = " << Foam::name("0x%012X", string::hash()(s2)) << endl;
|
||||||
|
|
||||||
|
// test formatting on int
|
||||||
|
{
|
||||||
|
label val = 25;
|
||||||
|
Info<<"val: " << val << "\n";
|
||||||
|
|
||||||
|
Info<< "int " << val << " as word >"
|
||||||
|
<< Foam::name(val) << "< or "
|
||||||
|
<< Foam::name("formatted >%08d<", val) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// test formatting on scalar
|
||||||
|
{
|
||||||
|
scalar val = 3.1415926535897931;
|
||||||
|
Info<< "scalar " << val << " as word >"
|
||||||
|
<< Foam::name(val) << "< or "
|
||||||
|
<< Foam::name("formatted >%.9f<", val) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// test formatting on uint
|
||||||
|
{
|
||||||
|
uint64_t val = 25000000ul;
|
||||||
|
Info<<"val: " << val << "\n";
|
||||||
|
|
||||||
|
Info<< "uint64 " << val << " as word >"
|
||||||
|
<< Foam::name(val) << "< or "
|
||||||
|
<< Foam::name("formatted >%08d<", val) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "\nEnd\n" << endl;
|
Info<< "\nEnd\n" << endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ Description
|
|||||||
Converts a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
|
Converts a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
\b star4ToFoam [OPTION] ccmMesh
|
\b star4ToFoam [OPTION] prostarMesh
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
- \par -ascii
|
- \par -ascii
|
||||||
|
|||||||
@ -8,10 +8,6 @@ wmake -all $targetType extrude
|
|||||||
wmake -all $targetType extrude2DMesh
|
wmake -all $targetType extrude2DMesh
|
||||||
wmake -all $targetType snappyHexMesh
|
wmake -all $targetType snappyHexMesh
|
||||||
|
|
||||||
if [ -n "$FOAMY_HEX_MESH" ]
|
foamyMesh/Allwmake $targetType $*
|
||||||
then
|
|
||||||
foamyMesh/Allwmake $targetType $*
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -86,6 +86,27 @@ int main(int argc, char *argv[])
|
|||||||
"specify alternative dictionary for the blockMesh description"
|
"specify alternative dictionary for the blockMesh description"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"Block description\n"
|
||||||
|
"\n"
|
||||||
|
" For a given block, the correspondence between the ordering of\n"
|
||||||
|
" vertex labels and face labels is shown below.\n"
|
||||||
|
" For vertex numbering in the sequence 0 to 7 (block, centre):\n"
|
||||||
|
" faces 0 (f0) and 1 are left and right, respectively;\n"
|
||||||
|
" faces 2 and 3 are bottom and top;\n"
|
||||||
|
" and faces 4 and 5 are front the back:\n"
|
||||||
|
"\n"
|
||||||
|
" 4 ---- 5\n"
|
||||||
|
" f3 |\\ |\\ f5\n"
|
||||||
|
" | | 7 ---- 6 \\\n"
|
||||||
|
" | 0 |--- 1 | \\\n"
|
||||||
|
" | \\| \\| f4\n"
|
||||||
|
" f2 3 ---- 2\n"
|
||||||
|
"\n"
|
||||||
|
" f0 ----- f1\n"
|
||||||
|
);
|
||||||
|
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -25,8 +25,6 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
-lmpfr \
|
|
||||||
-lboost_thread \
|
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
|
|||||||
@ -97,7 +97,7 @@ Foam::scalarField Foam::cellShapeControl::cellSize
|
|||||||
|
|
||||||
Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
|
Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
|
||||||
{
|
{
|
||||||
scalarList bary;
|
FixedList<scalar, 4> bary;
|
||||||
cellShapeControlMesh::Cell_handle ch;
|
cellShapeControlMesh::Cell_handle ch;
|
||||||
|
|
||||||
shapeControlMesh_.barycentricCoords(pt, bary, ch);
|
shapeControlMesh_.barycentricCoords(pt, bary, ch);
|
||||||
@ -172,7 +172,7 @@ Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
|
|||||||
|
|
||||||
Foam::tensor Foam::cellShapeControl::cellAlignment(const point& pt) const
|
Foam::tensor Foam::cellShapeControl::cellAlignment(const point& pt) const
|
||||||
{
|
{
|
||||||
scalarList bary;
|
FixedList<scalar, 4> bary;
|
||||||
cellShapeControlMesh::Cell_handle ch;
|
cellShapeControlMesh::Cell_handle ch;
|
||||||
|
|
||||||
shapeControlMesh_.barycentricCoords(pt, bary, ch);
|
shapeControlMesh_.barycentricCoords(pt, bary, ch);
|
||||||
@ -244,7 +244,7 @@ void Foam::cellShapeControl::cellSizeAndAlignment
|
|||||||
tensor& alignment
|
tensor& alignment
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalarList bary;
|
FixedList<scalar, 4> bary;
|
||||||
cellShapeControlMesh::Cell_handle ch;
|
cellShapeControlMesh::Cell_handle ch;
|
||||||
|
|
||||||
shapeControlMesh_.barycentricCoords(pt, bary, ch);
|
shapeControlMesh_.barycentricCoords(pt, bary, ch);
|
||||||
|
|||||||
@ -450,7 +450,7 @@ Foam::cellShapeControlMesh::~cellShapeControlMesh()
|
|||||||
void Foam::cellShapeControlMesh::barycentricCoords
|
void Foam::cellShapeControlMesh::barycentricCoords
|
||||||
(
|
(
|
||||||
const Foam::point& pt,
|
const Foam::point& pt,
|
||||||
scalarList& bary,
|
FixedList<scalar, 4>& bary,
|
||||||
Cell_handle& ch
|
Cell_handle& ch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -122,7 +122,7 @@ public:
|
|||||||
void barycentricCoords
|
void barycentricCoords
|
||||||
(
|
(
|
||||||
const Foam::point& pt,
|
const Foam::point& pt,
|
||||||
scalarList& bary,
|
FixedList<scalar, 4>& bary,
|
||||||
Cell_handle& ch
|
Cell_handle& ch
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ Foam::fileControl::~fileControl()
|
|||||||
//
|
//
|
||||||
//Foam::scalar Foam::fileControl::cellSize(const point& pt) const
|
//Foam::scalar Foam::fileControl::cellSize(const point& pt) const
|
||||||
//{
|
//{
|
||||||
// scalarList bary;
|
// FixedList<scalar, 4> bary;
|
||||||
// Cell_handle ch;
|
// Cell_handle ch;
|
||||||
//
|
//
|
||||||
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
|
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
|
||||||
@ -112,7 +112,7 @@ Foam::fileControl::~fileControl()
|
|||||||
////- Return the cell alignment at the given location
|
////- Return the cell alignment at the given location
|
||||||
//Foam::tensor Foam::fileControl::cellAlignment(const point& pt) const
|
//Foam::tensor Foam::fileControl::cellAlignment(const point& pt) const
|
||||||
//{
|
//{
|
||||||
// scalarList bary;
|
// FixedList<scalar, 4> bary;
|
||||||
// Cell_handle ch;
|
// Cell_handle ch;
|
||||||
//
|
//
|
||||||
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
|
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
|
||||||
@ -144,7 +144,7 @@ Foam::fileControl::~fileControl()
|
|||||||
// tensor& alignment
|
// tensor& alignment
|
||||||
//) const
|
//) const
|
||||||
//{
|
//{
|
||||||
// scalarList bary;
|
// FixedList<scalar, 4> bary;
|
||||||
// Cell_handle ch;
|
// Cell_handle ch;
|
||||||
//
|
//
|
||||||
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
|
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
|
||||||
|
|||||||
@ -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) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -118,8 +118,7 @@ Foam::scalar Foam::nonUniformField::interpolate
|
|||||||
pts[faceHitByPt[2]]
|
pts[faceHitByPt[2]]
|
||||||
);
|
);
|
||||||
|
|
||||||
scalarList bary(3, 0.0);
|
FixedList<scalar, 3> bary;
|
||||||
|
|
||||||
tri.barycentric(pt, bary);
|
tri.barycentric(pt, bary);
|
||||||
|
|
||||||
// return pointCellSize_[pMap[faceHitByPt[0]]]*bary[0]
|
// return pointCellSize_[pMap[faceHitByPt[0]]]*bary[0]
|
||||||
|
|||||||
@ -22,9 +22,6 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
-lboost_thread \
|
|
||||||
-lmpfr \
|
|
||||||
-lgmp \
|
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
-ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \
|
-ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \
|
||||||
-ldecompose \
|
-ldecompose \
|
||||||
|
|||||||
@ -3,7 +3,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) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -640,11 +640,14 @@ int main(int argc, char *argv[])
|
|||||||
geometry,
|
geometry,
|
||||||
surfaces
|
surfaces
|
||||||
);
|
);
|
||||||
|
|
||||||
// Patch fields
|
// Patch fields
|
||||||
|
volScalarField::Boundary& cellDistanceBf =
|
||||||
|
cellDistance.boundaryFieldRef();
|
||||||
forAll(fvm.C().boundaryField(), patchi)
|
forAll(fvm.C().boundaryField(), patchi)
|
||||||
{
|
{
|
||||||
const pointField& cc = fvm.C().boundaryField()[patchi];
|
const pointField& cc = fvm.C().boundaryField()[patchi];
|
||||||
fvPatchScalarField& fld = cellDistance.boundaryField()[patchi];
|
fvPatchScalarField& fld = cellDistanceBf[patchi];
|
||||||
scalarField patchDistSqr
|
scalarField patchDistSqr
|
||||||
(
|
(
|
||||||
fld.patch().patchInternalField(distSqr)
|
fld.patch().patchInternalField(distSqr)
|
||||||
|
|||||||
@ -16,8 +16,6 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
$(CGAL_LIBS) \
|
$(CGAL_LIBS) \
|
||||||
-lboost_thread \
|
|
||||||
-lmpfr \
|
|
||||||
-L$(FASTDUALOCTREE_SRC_PATH) -lperf_main \
|
-L$(FASTDUALOCTREE_SRC_PATH) -lperf_main \
|
||||||
-lGL \
|
-lGL \
|
||||||
-lconformalVoronoiMesh \
|
-lconformalVoronoiMesh \
|
||||||
|
|||||||
@ -6,7 +6,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lbarotropicCompressibilityModel \
|
-lbarotropicCompressibilityModel \
|
||||||
|
|||||||
@ -39,34 +39,34 @@ Usage
|
|||||||
Write the cell distribution as a labelList, for use with 'manual'
|
Write the cell distribution as a labelList, for use with 'manual'
|
||||||
decomposition method or as a volScalarField for post-processing.
|
decomposition method or as a volScalarField for post-processing.
|
||||||
|
|
||||||
- \par -region \<regionName\> \n
|
- \par -region \<regionName\>
|
||||||
Decompose named region. Does not check for existence of processor*.
|
Decompose named region. Does not check for existence of processor*.
|
||||||
|
|
||||||
- \par -allRegions \n
|
- \par -allRegions
|
||||||
Decompose all regions in regionProperties. Does not check for
|
Decompose all regions in regionProperties. Does not check for
|
||||||
existence of processor*.
|
existence of processor*.
|
||||||
|
|
||||||
- \par -copyUniform \n
|
- \par -copyUniform
|
||||||
Copy any \a uniform directories too.
|
Copy any \a uniform directories too.
|
||||||
|
|
||||||
- \par -constant
|
- \par -constant
|
||||||
|
|
||||||
- \par -time xxx:yyy \n
|
- \par -time xxx:yyy
|
||||||
Override controlDict settings and decompose selected times. Does not
|
Override controlDict settings and decompose selected times. Does not
|
||||||
re-decompose the mesh i.e. does not handle moving mesh or changing
|
re-decompose the mesh i.e. does not handle moving mesh or changing
|
||||||
mesh cases.
|
mesh cases.
|
||||||
|
|
||||||
- \par -fields \n
|
- \par -fields
|
||||||
Use existing geometry decomposition and convert fields only.
|
Use existing geometry decomposition and convert fields only.
|
||||||
|
|
||||||
- \par -noSets \n
|
- \par -noSets
|
||||||
Skip decomposing cellSets, faceSets, pointSets.
|
Skip decomposing cellSets, faceSets, pointSets.
|
||||||
|
|
||||||
- \par -force \n
|
- \par -force
|
||||||
Remove any existing \a processor subdirectories before decomposing the
|
Remove any existing \a processor subdirectories before decomposing the
|
||||||
geometry.
|
geometry.
|
||||||
|
|
||||||
- \par -ifRequired \n
|
- \par -ifRequired
|
||||||
Only decompose the geometry if the number of domains has changed from a
|
Only decompose the geometry if the number of domains has changed from a
|
||||||
previous decomposition. No \a processor subdirectories will be removed
|
previous decomposition. No \a processor subdirectories will be removed
|
||||||
unless the \a -force option is also specified. This option can be used
|
unless the \a -force option is also specified. This option can be used
|
||||||
|
|||||||
@ -42,7 +42,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
procMesh_(procMesh),
|
procMesh_(procMesh),
|
||||||
positions_(procMesh, cloudName, false),
|
positions_(procMesh, cloudName, IDLList<passiveParticle>()),
|
||||||
particleIndices_(lagrangianPositions.size())
|
particleIndices_(lagrangianPositions.size())
|
||||||
{
|
{
|
||||||
label pi = 0;
|
label pi = 0;
|
||||||
|
|||||||
@ -101,7 +101,6 @@ public:
|
|||||||
const label cloudI,
|
const label cloudI,
|
||||||
const IOobjectList& lagrangianObjects,
|
const IOobjectList& lagrangianObjects,
|
||||||
PtrList<PtrList<IOField<Type>>>& lagrangianFields
|
PtrList<PtrList<IOField<Type>>>& lagrangianFields
|
||||||
// PtrList<IOField<Type>>& lagrangianFields
|
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -113,7 +112,6 @@ public:
|
|||||||
<
|
<
|
||||||
PtrList<CompactIOField<Field<Type>, Type>>
|
PtrList<CompactIOField<Field<Type>, Type>>
|
||||||
>& lagrangianFields
|
>& lagrangianFields
|
||||||
// PtrList<CompactIOField<Field<Type>, Type >>& lagrangianFields
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
itoa.C
|
|
||||||
ensightMesh.C
|
ensightMesh.C
|
||||||
ensightParticlePositions.C
|
ensightCloud.C
|
||||||
foamToEnsight.C
|
foamToEnsight.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToEnsight
|
EXE = $(FOAM_APPBIN)/foamToEnsight
|
||||||
|
|||||||
@ -4,11 +4,13 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
-lfileFormats \
|
-lfileFormats \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields \
|
||||||
-llagrangian
|
-llagrangian \
|
||||||
|
-lconversion
|
||||||
|
|||||||
@ -1,21 +1,33 @@
|
|||||||
// ignore special fields or fields that we don't handle
|
// ignore special fields (_0 fields),
|
||||||
//
|
// ignore fields we don't handle,
|
||||||
bool variableGood = true;
|
// ignore fields that are not available for all time-steps
|
||||||
for (label n1=0; n1<Times.size() && variableGood; ++n1)
|
|
||||||
|
// hash by field-name in fieldsToUse
|
||||||
|
if (!fieldsToUse.found(fieldName))
|
||||||
{
|
{
|
||||||
// ignore _0 fields
|
bool variableGood = false;
|
||||||
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
|
|
||||||
|
forAll(timeDirs, n1)
|
||||||
{
|
{
|
||||||
variableGood = false;
|
variableGood =
|
||||||
}
|
(
|
||||||
else
|
fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
|
||||||
{
|
? false
|
||||||
variableGood = IOobject
|
: IOobject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
Times[n1].name(),
|
timeDirs[n1].name(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
).typeHeaderOk<volScalarField>(false);
|
).typeHeaderOk<volScalarField>(false)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (variableGood)
|
||||||
|
{
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reduce(variableGood, andOp<bool>());
|
||||||
|
fieldsToUse.set(fieldName, variableGood);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,27 +1,50 @@
|
|||||||
// check for "points" in any of the result directories
|
// check for "points" in any of the result directories
|
||||||
|
|
||||||
bool meshMoving = false;
|
bool meshMoving = false;
|
||||||
if (Times.size() > 1)
|
|
||||||
|
if (timeDirs.size() > 1 && Pstream::master())
|
||||||
{
|
{
|
||||||
// We already loaded a mesh (usually from constant). See if any other
|
// We already loaded a mesh (usually from constant).
|
||||||
// points files
|
// See if any other "polyMesh/points" files exist too.
|
||||||
forAll(Times, timeI)
|
|
||||||
|
const fileName& baseDir = mesh.time().path();
|
||||||
|
|
||||||
|
Info<< "Search for moving mesh ... " << flush;
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
if (Times[timeI].name() != mesh.pointsInstance())
|
const word& timeName = timeDirs[timeI].name();
|
||||||
{
|
|
||||||
IOobject io
|
meshMoving =
|
||||||
|
(
|
||||||
|
timeName != mesh.pointsInstance()
|
||||||
|
&& isDir(baseDir/timeName/polyMesh::meshSubDir)
|
||||||
|
&& IOobject
|
||||||
(
|
(
|
||||||
"points",
|
"points",
|
||||||
Times[timeI].name(),
|
timeName,
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false // no register
|
||||||
|
).typeHeaderOk<pointIOField>(true)
|
||||||
);
|
);
|
||||||
if (io.typeHeaderOk<pointIOField>(true))
|
|
||||||
|
if (meshMoving)
|
||||||
{
|
{
|
||||||
meshMoving = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (meshMoving)
|
||||||
|
{
|
||||||
|
Info<< "found." << nl
|
||||||
|
<< " Writing meshes for every timestep." << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "none detected." << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reduce(meshMoving, orOp<bool>());
|
||||||
|
|||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -52,17 +52,17 @@ class ensightAsciiStream
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Description of data_
|
//- Output file stream
|
||||||
OFstream str_;
|
OFstream str_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
ensightAsciiStream(const ensightAsciiStream&);
|
ensightAsciiStream(const ensightAsciiStream&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const ensightAsciiStream&);
|
void operator=(const ensightAsciiStream&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -70,14 +70,14 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
ensightAsciiStream(const fileName& f, const Time& runTime)
|
ensightAsciiStream(const fileName& f)
|
||||||
:
|
:
|
||||||
ensightStream(f),
|
ensightStream(f),
|
||||||
str_
|
str_
|
||||||
(
|
(
|
||||||
f,
|
f,
|
||||||
runTime.writeFormat(),
|
IOstream::ASCII,
|
||||||
runTime.writeVersion(),
|
IOstream::currentVersion,
|
||||||
IOstream::UNCOMPRESSED
|
IOstream::UNCOMPRESSED
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -139,14 +139,6 @@ public:
|
|||||||
<< setw(10) << partI << nl;
|
<< setw(10) << partI << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
// Friend Functions
|
|
||||||
|
|
||||||
// Friend Operators
|
|
||||||
|
|
||||||
// IOstream Operators
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -51,17 +51,17 @@ class ensightBinaryStream
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Description of data_
|
//- Output file stream
|
||||||
autoPtr<std::ofstream> str_;
|
autoPtr<std::ofstream> str_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
ensightBinaryStream(const ensightBinaryStream&);
|
ensightBinaryStream(const ensightBinaryStream&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const ensightBinaryStream&);
|
void operator=(const ensightBinaryStream&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -69,7 +69,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
ensightBinaryStream(const fileName& f, const Time&)
|
ensightBinaryStream(const fileName& f)
|
||||||
:
|
:
|
||||||
ensightStream(f),
|
ensightStream(f),
|
||||||
str_
|
str_
|
||||||
@ -90,11 +90,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
virtual bool ascii() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const char* val)
|
virtual void write(const char* val)
|
||||||
{
|
{
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
@ -141,14 +136,6 @@ public:
|
|||||||
write(partI);
|
write(partI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
// Friend Functions
|
|
||||||
|
|
||||||
// Friend Operators
|
|
||||||
|
|
||||||
// IOstream Operators
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
|
||||||
|
ensightCaseFile.precision(5);
|
||||||
|
|
||||||
ensightCaseFile << nl << "TIME" << nl
|
ensightCaseFile << nl << "TIME" << nl
|
||||||
<< "time set: " << 1 << nl
|
<< "time set: " << 1 << nl
|
||||||
<< "number of steps: " << nTimeSteps << nl
|
<< "number of steps: " << nTimeSteps << nl
|
||||||
@ -8,20 +11,17 @@ if (Pstream::master())
|
|||||||
|
|
||||||
ensightCaseFile << "time values:" << nl;
|
ensightCaseFile << "time values:" << nl;
|
||||||
|
|
||||||
ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
ensightCaseFile.precision(5);
|
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
scalar Tcorr = 0.0;
|
scalar Tcorr = 0.0;
|
||||||
if (Times[0].value() < 0)
|
if (timeDirs[0].value() < 0)
|
||||||
{
|
{
|
||||||
Tcorr = - Times[0].value();
|
Tcorr = -timeDirs[0].value();
|
||||||
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(Times, n)
|
forAll(timeDirs, n)
|
||||||
{
|
{
|
||||||
ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
|
ensightCaseFile << setw(12) << timeDirs[n].value() + Tcorr << " ";
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
if (++count % 6 == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,180 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 "ensightCloud.H"
|
||||||
|
#include "ensightFile.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "passiveParticle.H"
|
||||||
|
#include "Cloud.H"
|
||||||
|
#include "pointList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::ensightParticlePositions
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const fileName& dataDir,
|
||||||
|
const label timeIndex,
|
||||||
|
const word& cloudName,
|
||||||
|
const bool dataExists,
|
||||||
|
IOstream::streamFormat format
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (dataExists)
|
||||||
|
{
|
||||||
|
Info<< " positions";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< " positions{0}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Total number of parcels on all processes
|
||||||
|
label nTotParcels = 0;
|
||||||
|
autoPtr<Cloud<passiveParticle>> cloudPtr;
|
||||||
|
|
||||||
|
if (dataExists)
|
||||||
|
{
|
||||||
|
cloudPtr.reset(new Cloud<passiveParticle>(mesh, cloudName, false));
|
||||||
|
nTotParcels = cloudPtr().size();
|
||||||
|
}
|
||||||
|
reduce(nTotParcels, sumOp<label>());
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
const fileName postFileName =
|
||||||
|
ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/"positions";
|
||||||
|
|
||||||
|
// the ITER/lagrangian subdirectory must exist
|
||||||
|
mkDir(dataDir/postFileName.path());
|
||||||
|
|
||||||
|
ensightFile os(dataDir, postFileName, format);
|
||||||
|
|
||||||
|
// tag binary format (just like geometry files)
|
||||||
|
os.writeBinaryHeader();
|
||||||
|
os.write(postFileName); // description
|
||||||
|
os.newline();
|
||||||
|
os.write("particle coordinates");
|
||||||
|
os.newline();
|
||||||
|
os.write(nTotParcels, 8); // unusual width
|
||||||
|
os.newline();
|
||||||
|
|
||||||
|
if (!nTotParcels)
|
||||||
|
{
|
||||||
|
return; // DONE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format == IOstream::BINARY)
|
||||||
|
{
|
||||||
|
// binary write is Ensight6 - first ids, then positions
|
||||||
|
|
||||||
|
// 1-index
|
||||||
|
for (label parcelId = 0; parcelId < nTotParcels; ++parcelId)
|
||||||
|
{
|
||||||
|
os.write(parcelId+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Master
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||||
|
{
|
||||||
|
const point& p = elmnt().position();
|
||||||
|
|
||||||
|
os.write(p.x());
|
||||||
|
os.write(p.y());
|
||||||
|
os.write(p.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
pointList points(fromSlave);
|
||||||
|
|
||||||
|
forAll(points, pti)
|
||||||
|
{
|
||||||
|
const point& p = points[pti];
|
||||||
|
|
||||||
|
os.write(p.x());
|
||||||
|
os.write(p.y());
|
||||||
|
os.write(p.z());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ASCII id + position together
|
||||||
|
|
||||||
|
label parcelId = 0;
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||||
|
{
|
||||||
|
const point& p = elmnt().position();
|
||||||
|
|
||||||
|
os.write(++parcelId, 8); // unusual width
|
||||||
|
os.write(p.x());
|
||||||
|
os.write(p.y());
|
||||||
|
os.write(p.z());
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
pointList points(fromSlave);
|
||||||
|
|
||||||
|
forAll(points, pti)
|
||||||
|
{
|
||||||
|
const point& p = points[pti];
|
||||||
|
|
||||||
|
os.write(++parcelId, 8); // unusual width
|
||||||
|
os.write(p.x());
|
||||||
|
os.write(p.y());
|
||||||
|
os.write(p.z());
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (nTotParcels)
|
||||||
|
{
|
||||||
|
// SLAVE, and data exist
|
||||||
|
pointList points(cloudPtr().size());
|
||||||
|
|
||||||
|
label pti = 0;
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||||
|
{
|
||||||
|
const point& p = elmnt().position();
|
||||||
|
points[pti++] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,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) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,35 +27,62 @@ InApplication
|
|||||||
Description
|
Description
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
ensightCloudField.C
|
ensightCloud.C
|
||||||
|
ensightCloudTemplates.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ensightCloudField_H
|
#ifndef ensightCloud_H
|
||||||
#define ensightCloudField_H
|
#define ensightCloud_H
|
||||||
|
|
||||||
|
#include "ensightFile.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
void ensightParticlePositions
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const fileName& dataDir,
|
||||||
|
const label timeIndex,
|
||||||
|
const word& cloudName,
|
||||||
|
const bool dataExists,
|
||||||
|
const IOstream::streamFormat format
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightCloudField
|
void ensightCloudField
|
||||||
(
|
(
|
||||||
const IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const fileName& postProcPath,
|
const fileName& dataDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const word& timeFile,
|
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
|
const label cloudNo,
|
||||||
Ostream& ensightCaseFile,
|
Ostream& ensightCaseFile,
|
||||||
const bool dataExists
|
const bool dataExists,
|
||||||
|
const IOstream::streamFormat format
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void writeCloudField
|
||||||
|
(
|
||||||
|
const IOField<Type>& field,
|
||||||
|
ensightFile& os
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "ensightCloudField.C"
|
#include "ensightCloudTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -1,129 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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 "ensightCloudField.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "IOField.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
#include "IOmanip.H"
|
|
||||||
#include "ensightPTraits.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void ensightCloudField
|
|
||||||
(
|
|
||||||
const IOobject& fieldObject,
|
|
||||||
const fileName& postProcPath,
|
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
|
||||||
const word& cloudName,
|
|
||||||
Ostream& ensightCaseFile,
|
|
||||||
const bool dataExists
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (dataExists)
|
|
||||||
{
|
|
||||||
Info<< "Converting cloud " << cloudName
|
|
||||||
<< " field " << fieldObject.name() << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Creating empty cloud " << cloudName
|
|
||||||
<< " field " << fieldObject.name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
|
||||||
|
|
||||||
const Time& runTime = fieldObject.time();
|
|
||||||
|
|
||||||
if (timeIndex == 0 && Pstream::master())
|
|
||||||
{
|
|
||||||
ensightCaseFile
|
|
||||||
<< pTraits<Type>::typeName << " per measured node: 1 ";
|
|
||||||
ensightCaseFile.width(15);
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
ensightCaseFile
|
|
||||||
<< ("c" + fieldObject.name()).c_str()
|
|
||||||
<< (' ' + prepend + "****." + cloudName
|
|
||||||
+ "." + fieldObject.name()).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileName ensightFileName
|
|
||||||
(
|
|
||||||
timeFile + "." + cloudName +"." + fieldObject.name()
|
|
||||||
);
|
|
||||||
|
|
||||||
OFstream ensightFile
|
|
||||||
(
|
|
||||||
postProcPath/ensightFileName,
|
|
||||||
runTime.writeFormat(),
|
|
||||||
runTime.writeVersion(),
|
|
||||||
runTime.writeCompression()
|
|
||||||
);
|
|
||||||
|
|
||||||
ensightFile<< pTraits<Type>::typeName << " values" << nl;
|
|
||||||
|
|
||||||
if (dataExists)
|
|
||||||
{
|
|
||||||
IOField<Type> vf(fieldObject);
|
|
||||||
|
|
||||||
ensightFile.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
ensightFile.precision(5);
|
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
forAll(vf, i)
|
|
||||||
{
|
|
||||||
Type v = vf[i];
|
|
||||||
|
|
||||||
if (mag(v) < 1.0e-90)
|
|
||||||
{
|
|
||||||
v = Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
|
||||||
{
|
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
|
||||||
|
|
||||||
ensightFile << setw(12) << component(v, cmpt);
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
ensightFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((count % 6 != 0) || (count==0))
|
|
||||||
{
|
|
||||||
ensightFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,192 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 "ensightCloud.H"
|
||||||
|
#include "ensightFile.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "IOField.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "IOmanip.H"
|
||||||
|
#include "ensightPTraits.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::writeCloudField
|
||||||
|
(
|
||||||
|
const Foam::IOField<Type>& field,
|
||||||
|
Foam::ensightFile& os
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (returnReduce(field.size(), sumOp<label>()) > 0)
|
||||||
|
{
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// 6 values per line
|
||||||
|
label count = 0;
|
||||||
|
|
||||||
|
// Master
|
||||||
|
forAll(field, i)
|
||||||
|
{
|
||||||
|
Type val = field[i];
|
||||||
|
|
||||||
|
if (mag(val) < 1e-90)
|
||||||
|
{
|
||||||
|
val = Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
|
{
|
||||||
|
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||||
|
os.write(component(val, cmpt));
|
||||||
|
|
||||||
|
if (++count % 6 == 0)
|
||||||
|
{
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
Field<Type> slaveData(fromSlave);
|
||||||
|
|
||||||
|
forAll(slaveData, i)
|
||||||
|
{
|
||||||
|
Type val = slaveData[i];
|
||||||
|
|
||||||
|
if (mag(val) < 1e-90)
|
||||||
|
{
|
||||||
|
val = Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
|
{
|
||||||
|
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||||
|
os.write(component(val, cmpt));
|
||||||
|
|
||||||
|
if (++count % 6 == 0)
|
||||||
|
{
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add final newline if required
|
||||||
|
if (count % 6)
|
||||||
|
{
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ensightCloudField
|
||||||
|
(
|
||||||
|
const Foam::IOobject& fieldObject,
|
||||||
|
const Foam::fileName& dataDir,
|
||||||
|
const Foam::label timeIndex,
|
||||||
|
const Foam::word& cloudName,
|
||||||
|
const Foam::label cloudNo,
|
||||||
|
Foam::Ostream& ensightCaseFile,
|
||||||
|
const bool dataExists,
|
||||||
|
Foam::IOstream::streamFormat format
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const ensight::VarName varName(fieldObject.name());
|
||||||
|
|
||||||
|
if (dataExists)
|
||||||
|
{
|
||||||
|
Info<< ' ' << fieldObject.name();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< ' ' << fieldObject.name() << "{0}"; // ie, empty field
|
||||||
|
}
|
||||||
|
|
||||||
|
ensightFile* filePtr(nullptr);
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
const fileName postFileName =
|
||||||
|
ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/varName;
|
||||||
|
|
||||||
|
// the ITER/lagrangian subdirectory must exist
|
||||||
|
// the ITER/lagrangian subdirectory was already created
|
||||||
|
// when writing positions
|
||||||
|
|
||||||
|
mkDir(dataDir/postFileName.path());
|
||||||
|
|
||||||
|
if (timeIndex == 0)
|
||||||
|
{
|
||||||
|
const fileName dirName =
|
||||||
|
dataDir.name()/ensightFile::mask()/cloud::prefix/cloudName;
|
||||||
|
|
||||||
|
ensightCaseFile.setf(ios_base::left);
|
||||||
|
|
||||||
|
// prefix variables with 'c' (cloud)
|
||||||
|
ensightCaseFile
|
||||||
|
<< ensightPTraits<Type>::typeName << " per "
|
||||||
|
<< setw(20)
|
||||||
|
<< "measured node:"
|
||||||
|
<< " 1 "
|
||||||
|
<< setw(15)
|
||||||
|
<< ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
|
||||||
|
<< (dirName/varName).c_str()
|
||||||
|
<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
filePtr = new ensightFile(dataDir, postFileName, format);
|
||||||
|
// description
|
||||||
|
filePtr->write
|
||||||
|
(
|
||||||
|
string(postFileName + " <" + pTraits<Type>::typeName + ">")
|
||||||
|
);
|
||||||
|
filePtr->newline();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataExists)
|
||||||
|
{
|
||||||
|
IOField<Type> field(fieldObject);
|
||||||
|
writeCloudField(field, *filePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filePtr) // on master only
|
||||||
|
{
|
||||||
|
delete filePtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,12 +23,12 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ensightFile.H"
|
||||||
#include "ensightField.H"
|
#include "ensightField.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "itoa.H"
|
|
||||||
#include "volPointInterpolation.H"
|
#include "volPointInterpolation.H"
|
||||||
#include "ensightBinaryStream.H"
|
#include "ensightBinaryStream.H"
|
||||||
#include "ensightAsciiStream.H"
|
#include "ensightAsciiStream.H"
|
||||||
@ -77,6 +77,8 @@ volField
|
|||||||
|
|
||||||
IOobject io(df);
|
IOobject io(df);
|
||||||
io.readOpt() = IOobject::NO_READ;
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
io.writeOpt() = IOobject::NO_WRITE;
|
||||||
|
io.registerObject() = false;
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
|
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
|
||||||
(
|
(
|
||||||
@ -84,16 +86,17 @@ volField
|
|||||||
(
|
(
|
||||||
io,
|
io,
|
||||||
df.mesh(),
|
df.mesh(),
|
||||||
df.dimensions(),
|
dimensioned<Type>("0", df.dimensions(), Zero),
|
||||||
zeroGradientFvPatchField<scalar>::typeName
|
zeroGradientFvPatchField<Type>::typeName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
tvf.ref().primitiveFieldRef() = df;
|
tvf.ref().primitiveFieldRef() = df;
|
||||||
tvf.ref().correctBoundaryConditions();
|
tvf.ref().correctBoundaryConditions();
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
|
|
||||||
|
|
||||||
if (meshSubsetter.hasSubMesh())
|
if (meshSubsetter.hasSubMesh())
|
||||||
{
|
{
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
|
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
|
||||||
(
|
(
|
||||||
meshSubsetter.interpolate(vf)
|
meshSubsetter.interpolate(vf)
|
||||||
@ -116,10 +119,8 @@ volField
|
|||||||
// const IOobject& io,
|
// const IOobject& io,
|
||||||
// const fvMesh& mesh,
|
// const fvMesh& mesh,
|
||||||
// const ensightMesh& eMesh,
|
// const ensightMesh& eMesh,
|
||||||
// const fileName& postProcPath,
|
// const fileName& dataDir,
|
||||||
// const word& prepend,
|
|
||||||
// const label timeIndex,
|
// const label timeIndex,
|
||||||
// const bool binary,
|
|
||||||
// const bool nodeValues,
|
// const bool nodeValues,
|
||||||
// Ostream& ensightCaseFile
|
// Ostream& ensightCaseFile
|
||||||
//)
|
//)
|
||||||
@ -129,10 +130,8 @@ volField
|
|||||||
// (
|
// (
|
||||||
// volField<typename Container::value_type>(meshSubsetter, fld),
|
// volField<typename Container::value_type>(meshSubsetter, fld),
|
||||||
// eMesh,
|
// eMesh,
|
||||||
// postProcPath,
|
// dataDir,
|
||||||
// prepend,
|
|
||||||
// timeIndex,
|
// timeIndex,
|
||||||
// binary,
|
|
||||||
// nodeValues,
|
// nodeValues,
|
||||||
// ensightCaseFile
|
// ensightCaseFile
|
||||||
// );
|
// );
|
||||||
@ -170,26 +169,26 @@ void writeField
|
|||||||
(
|
(
|
||||||
const char* key,
|
const char* key,
|
||||||
const Field<Type>& vf,
|
const Field<Type>& vf,
|
||||||
ensightStream& ensightFile
|
ensightStream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (returnReduce(vf.size(), sumOp<label>()) > 0)
|
if (returnReduce(vf.size(), sumOp<label>()) > 0)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile.write(key);
|
os.write(key);
|
||||||
|
|
||||||
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
||||||
{
|
{
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
||||||
|
|
||||||
ensightFile.write(vf.component(cmpt));
|
os.write(vf.component(cmpt));
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
scalarField slaveData(fromSlave);
|
scalarField slaveData(fromSlave);
|
||||||
ensightFile.write(slaveData);
|
os.write(slaveData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,35 +214,35 @@ bool writePatchField
|
|||||||
const label ensightPatchi,
|
const label ensightPatchi,
|
||||||
const faceSets& boundaryFaceSet,
|
const faceSets& boundaryFaceSet,
|
||||||
const ensightMesh::nFacePrimitives& nfp,
|
const ensightMesh::nFacePrimitives& nfp,
|
||||||
ensightStream& ensightFile
|
ensightStream& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile.writePartHeader(ensightPatchi);
|
os.writePartHeader(ensightPatchi);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"tria3",
|
"tria3",
|
||||||
Field<Type>(pf, boundaryFaceSet.tris),
|
Field<Type>(pf, boundaryFaceSet.tris),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"quad4",
|
"quad4",
|
||||||
Field<Type>(pf, boundaryFaceSet.quads),
|
Field<Type>(pf, boundaryFaceSet.quads),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"nsided",
|
"nsided",
|
||||||
Field<Type>(pf, boundaryFaceSet.polys),
|
Field<Type>(pf, boundaryFaceSet.polys),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -262,15 +261,11 @@ void writePatchField
|
|||||||
const Field<Type>& pf,
|
const Field<Type>& pf,
|
||||||
const word& patchName,
|
const word& patchName,
|
||||||
const ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const fileName& postProcPath,
|
const fileName& dataDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const Time& runTime = eMesh.mesh().time();
|
|
||||||
|
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
const HashTable<ensightMesh::nFacePrimitives>&
|
||||||
@ -290,53 +285,51 @@ void writePatchField
|
|||||||
ensightPatchi++;
|
ensightPatchi++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensightStream* filePtr(nullptr);
|
||||||
word pfName = patchName + '.' + fieldName;
|
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
|
||||||
|
|
||||||
ensightStream* ensightFilePtr = nullptr;
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
// TODO: verify that these are indeed valid ensight variable names
|
||||||
|
const word varName = patchName + '.' + fieldName;
|
||||||
|
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
||||||
|
|
||||||
|
// the data/ITER subdirectory must exist
|
||||||
|
mkDir(dataDir/postFileName.path());
|
||||||
|
|
||||||
if (timeIndex == 0)
|
if (timeIndex == 0)
|
||||||
{
|
{
|
||||||
ensightCaseFile.setf(ios_base::left);
|
const fileName dirName = dataDir.name()/ensightFile::mask();
|
||||||
|
|
||||||
|
ensightCaseFile.setf(ios_base::left);
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
<< ensightPTraits<Type>::typeName
|
<< ensightPTraits<Type>::typeName << " per "
|
||||||
<< " per element: 1 "
|
<< setw(20)
|
||||||
<< setw(15) << pfName
|
<< "element:"
|
||||||
<< (' ' + prepend + "****." + pfName).c_str()
|
<< " 1 "
|
||||||
|
<< setw(15)
|
||||||
|
<< varName.c_str() << ' '
|
||||||
|
<< (dirName/varName).c_str()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the filename of the ensight file
|
if (eMesh.format() == IOstream::BINARY)
|
||||||
fileName ensightFileName(timeFile + "." + pfName);
|
|
||||||
|
|
||||||
if (binary)
|
|
||||||
{
|
{
|
||||||
ensightFilePtr = new ensightBinaryStream
|
filePtr = new ensightBinaryStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightFileName,
|
dataDir/postFileName
|
||||||
runTime
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ensightFilePtr = new ensightAsciiStream
|
filePtr = new ensightAsciiStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightFileName,
|
dataDir/postFileName
|
||||||
runTime
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filePtr->write(ensightPTraits<Type>::typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensightStream& ensightFile = *ensightFilePtr;
|
ensightStream& os = *filePtr;
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
ensightFile.write(ensightPTraits<Type>::typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (patchi >= 0)
|
if (patchi >= 0)
|
||||||
{
|
{
|
||||||
@ -347,7 +340,7 @@ void writePatchField
|
|||||||
ensightPatchi,
|
ensightPatchi,
|
||||||
boundaryFaceSets[patchi],
|
boundaryFaceSets[patchi],
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -361,13 +354,13 @@ void writePatchField
|
|||||||
ensightPatchi,
|
ensightPatchi,
|
||||||
nullFaceSets,
|
nullFaceSets,
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (filePtr) // on master only
|
||||||
{
|
{
|
||||||
delete ensightFilePtr;
|
delete filePtr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,19 +370,14 @@ void ensightField
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||||
const ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const fileName& postProcPath,
|
const fileName& dataDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Converting field " << vf.name() << endl;
|
Info<< ' ' << vf.name();
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
|
||||||
|
|
||||||
const fvMesh& mesh = eMesh.mesh();
|
const fvMesh& mesh = eMesh.mesh();
|
||||||
const Time& runTime = mesh.time();
|
|
||||||
|
|
||||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||||
@ -409,48 +397,48 @@ void ensightField
|
|||||||
const labelList& hexes = meshCellSets.hexes;
|
const labelList& hexes = meshCellSets.hexes;
|
||||||
const labelList& polys = meshCellSets.polys;
|
const labelList& polys = meshCellSets.polys;
|
||||||
|
|
||||||
ensightStream* ensightFilePtr = nullptr;
|
ensightStream* filePtr(nullptr);
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// set the filename of the ensight file
|
const ensight::VarName varName(vf.name());
|
||||||
fileName ensightFileName(timeFile + "." + vf.name());
|
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
||||||
|
|
||||||
if (binary)
|
// the data/ITER subdirectory must exist
|
||||||
|
mkDir(dataDir/postFileName.path());
|
||||||
|
|
||||||
|
if (timeIndex == 0)
|
||||||
{
|
{
|
||||||
ensightFilePtr = new ensightBinaryStream
|
const fileName dirName = dataDir.name()/ensightFile::mask();
|
||||||
|
|
||||||
|
ensightCaseFile.setf(ios_base::left);
|
||||||
|
ensightCaseFile
|
||||||
|
<< ensightPTraits<Type>::typeName
|
||||||
|
<< " per element: 1 "
|
||||||
|
<< setw(15)
|
||||||
|
<< varName.c_str() << ' '
|
||||||
|
<< (dirName/varName).c_str()
|
||||||
|
<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eMesh.format() == IOstream::BINARY)
|
||||||
|
{
|
||||||
|
filePtr = new ensightBinaryStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightFileName,
|
dataDir/postFileName
|
||||||
runTime
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ensightFilePtr = new ensightAsciiStream
|
filePtr = new ensightAsciiStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightFileName,
|
dataDir/postFileName
|
||||||
runTime
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filePtr->write(ensightPTraits<Type>::typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensightStream& ensightFile = *ensightFilePtr;
|
ensightStream& os = *filePtr;
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
|
|
||||||
ensightCaseFile
|
|
||||||
<< ensightPTraits<Type>::typeName
|
|
||||||
<< " per element: 1 "
|
|
||||||
<< setw(15) << vf.name()
|
|
||||||
<< (' ' + prepend + "****." + vf.name()).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightFile.write(ensightPTraits<Type>::typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (patchNames.empty())
|
if (patchNames.empty())
|
||||||
{
|
{
|
||||||
@ -458,42 +446,42 @@ void ensightField
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile.writePartHeader(1);
|
os.writePartHeader(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"hexa8",
|
"hexa8",
|
||||||
map(vf, hexes, wedges),
|
map(vf, hexes, wedges),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"penta6",
|
"penta6",
|
||||||
Field<Type>(vf, prisms),
|
Field<Type>(vf, prisms),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"pyramid5",
|
"pyramid5",
|
||||||
Field<Type>(vf, pyrs),
|
Field<Type>(vf, pyrs),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"tetra4",
|
"tetra4",
|
||||||
Field<Type>(vf, tets),
|
Field<Type>(vf, tets),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"nfaced",
|
"nfaced",
|
||||||
Field<Type>(vf, polys),
|
Field<Type>(vf, polys),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +504,7 @@ void ensightField
|
|||||||
ensightPatchi,
|
ensightPatchi,
|
||||||
boundaryFaceSets[patchi],
|
boundaryFaceSets[patchi],
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
ensightFile
|
os
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -541,8 +529,7 @@ void ensightField
|
|||||||
|
|
||||||
eMesh.barrier();
|
eMesh.barrier();
|
||||||
|
|
||||||
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||||
|
|
||||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
const faceZone& fz = mesh.faceZones()[zoneID];
|
||||||
|
|
||||||
// Prepare data to write
|
// Prepare data to write
|
||||||
@ -590,7 +577,7 @@ void ensightField
|
|||||||
ensightPatchi,
|
ensightPatchi,
|
||||||
faceZoneFaceSets[zoneID],
|
faceZoneFaceSets[zoneID],
|
||||||
nFaceZonePrims.find(faceZoneName)(),
|
nFaceZonePrims.find(faceZoneName)(),
|
||||||
ensightFile
|
os
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -598,9 +585,10 @@ void ensightField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Pstream::master())
|
|
||||||
|
if (filePtr) // on master only
|
||||||
{
|
{
|
||||||
delete ensightFilePtr;
|
delete filePtr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,65 +598,63 @@ void ensightPointField
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
||||||
const ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const fileName& postProcPath,
|
const fileName& dataDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Converting field " << pf.name() << endl;
|
Info<< ' ' << pf.name();
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
|
||||||
|
|
||||||
const fvMesh& mesh = eMesh.mesh();
|
const fvMesh& mesh = eMesh.mesh();
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||||
const wordHashSet& patchNames = eMesh.patchNames();
|
const wordHashSet& patchNames = eMesh.patchNames();
|
||||||
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
|
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
|
||||||
|
|
||||||
|
ensightStream* filePtr(nullptr);
|
||||||
ensightStream* ensightFilePtr = nullptr;
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// set the filename of the ensight file
|
const ensight::VarName varName(pf.name());
|
||||||
fileName ensightFileName(timeFile + "." + pf.name());
|
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
||||||
|
|
||||||
if (binary)
|
// the data/ITER subdirectory must exist
|
||||||
|
mkDir(dataDir/postFileName.path());
|
||||||
|
|
||||||
|
if (timeIndex == 0)
|
||||||
{
|
{
|
||||||
ensightFilePtr = new ensightBinaryStream
|
const fileName dirName = dataDir.name()/ensightFile::mask();
|
||||||
|
|
||||||
|
ensightCaseFile.setf(ios_base::left);
|
||||||
|
ensightCaseFile
|
||||||
|
<< ensightPTraits<Type>::typeName
|
||||||
|
<< " per "
|
||||||
|
<< setw(20)
|
||||||
|
<< " node:"
|
||||||
|
<< " 1 "
|
||||||
|
<< setw(15)
|
||||||
|
<< varName.c_str() << ' '
|
||||||
|
<< (dirName/varName).c_str()
|
||||||
|
<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eMesh.format() == IOstream::BINARY)
|
||||||
|
{
|
||||||
|
filePtr = new ensightBinaryStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightFileName,
|
dataDir/postFileName
|
||||||
mesh.time()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ensightFilePtr = new ensightAsciiStream
|
filePtr = new ensightAsciiStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightFileName,
|
dataDir/postFileName
|
||||||
mesh.time()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filePtr->write(ensightPTraits<Type>::typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensightStream& ensightFile = *ensightFilePtr;
|
ensightStream& os = *filePtr;
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
|
|
||||||
ensightCaseFile
|
|
||||||
<< ensightPTraits<Type>::typeName
|
|
||||||
<< " per node: 1 "
|
|
||||||
<< setw(15) << pf.name()
|
|
||||||
<< (' ' + prepend + "****." + pf.name()).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightFile.write(ensightPTraits<Type>::typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eMesh.patchNames().empty())
|
if (eMesh.patchNames().empty())
|
||||||
{
|
{
|
||||||
@ -676,14 +662,14 @@ void ensightPointField
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile.writePartHeader(1);
|
os.writePartHeader(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"coordinates",
|
"coordinates",
|
||||||
Field<Type>(pf.primitiveField(), eMesh.uniquePointMap()),
|
Field<Type>(pf.primitiveField(), eMesh.uniquePointMap()),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,11 +685,8 @@ void ensightPointField
|
|||||||
if (patchNames.empty() || patchNames.found(patchName))
|
if (patchNames.empty() || patchNames.found(patchName))
|
||||||
{
|
{
|
||||||
const fvPatch& p = mesh.boundary()[patchi];
|
const fvPatch& p = mesh.boundary()[patchi];
|
||||||
if
|
|
||||||
(
|
if (returnReduce(p.size(), sumOp<label>()) > 0)
|
||||||
returnReduce(p.size(), sumOp<label>())
|
|
||||||
> 0
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Renumber the patch points/faces into unique points
|
// Renumber the patch points/faces into unique points
|
||||||
labelList pointToGlobal;
|
labelList pointToGlobal;
|
||||||
@ -719,14 +702,14 @@ void ensightPointField
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile.writePartHeader(ensightPatchi);
|
os.writePartHeader(ensightPatchi);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
(
|
(
|
||||||
"coordinates",
|
"coordinates",
|
||||||
Field<Type>(pf.primitiveField(), uniqueMeshPointLabels),
|
Field<Type>(pf.primitiveField(), uniqueMeshPointLabels),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
ensightPatchi++;
|
ensightPatchi++;
|
||||||
@ -743,8 +726,7 @@ void ensightPointField
|
|||||||
|
|
||||||
eMesh.barrier();
|
eMesh.barrier();
|
||||||
|
|
||||||
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||||
|
|
||||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
const faceZone& fz = mesh.faceZones()[zoneID];
|
||||||
|
|
||||||
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
|
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
|
||||||
@ -763,7 +745,7 @@ void ensightPointField
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile.writePartHeader(ensightPatchi);
|
os.writePartHeader(ensightPatchi);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeField
|
writeField
|
||||||
@ -774,7 +756,7 @@ void ensightPointField
|
|||||||
pf.primitiveField(),
|
pf.primitiveField(),
|
||||||
uniqueMeshPointLabels
|
uniqueMeshPointLabels
|
||||||
),
|
),
|
||||||
ensightFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
ensightPatchi++;
|
ensightPatchi++;
|
||||||
@ -782,9 +764,9 @@ void ensightPointField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (filePtr) // on master only
|
||||||
{
|
{
|
||||||
delete ensightFilePtr;
|
delete filePtr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,10 +776,8 @@ void ensightField
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||||
const ensightMesh& eMesh,
|
const ensightMesh& eMesh,
|
||||||
const fileName& postProcPath,
|
const fileName& dataDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const bool binary,
|
|
||||||
const bool nodeValues,
|
const bool nodeValues,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
@ -814,10 +794,8 @@ void ensightField
|
|||||||
(
|
(
|
||||||
pfld,
|
pfld,
|
||||||
eMesh,
|
eMesh,
|
||||||
postProcPath,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -827,10 +805,8 @@ void ensightField
|
|||||||
(
|
(
|
||||||
vf,
|
vf,
|
||||||
eMesh,
|
eMesh,
|
||||||
postProcPath,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,10 +69,8 @@ void ensightField
|
|||||||
(
|
(
|
||||||
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
|
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
|
||||||
const Foam::ensightMesh& eMesh,
|
const Foam::ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const Foam::fileName& dataDir,
|
||||||
const Foam::word& prepend,
|
|
||||||
const Foam::label timeIndex,
|
const Foam::label timeIndex,
|
||||||
const bool binary,
|
|
||||||
const bool nodeValues,
|
const bool nodeValues,
|
||||||
Foam::Ostream& ensightCaseFile
|
Foam::Ostream& ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -85,8 +83,7 @@ void writePatchField
|
|||||||
const Foam::Field<Type>& pf,
|
const Foam::Field<Type>& pf,
|
||||||
const Foam::word& patchName,
|
const Foam::word& patchName,
|
||||||
const Foam::ensightMesh& eMesh,
|
const Foam::ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const Foam::fileName& dataDir,
|
||||||
const Foam::word& prepend,
|
|
||||||
const Foam::label timeIndex,
|
const Foam::label timeIndex,
|
||||||
Foam::Ostream& ensightCaseFile
|
Foam::Ostream& ensightCaseFile
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,16 +32,21 @@ License
|
|||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "itoa.H"
|
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
#include "stringListOps.H"
|
#include "stringListOps.H"
|
||||||
|
|
||||||
|
#include "ensightFile.H"
|
||||||
#include "ensightBinaryStream.H"
|
#include "ensightBinaryStream.H"
|
||||||
#include "ensightAsciiStream.H"
|
#include "ensightAsciiStream.H"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const char* Foam::ensightMesh::geometryName = "geometry";
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::ensightMesh::correct()
|
void Foam::ensightMesh::correct()
|
||||||
@ -403,7 +408,7 @@ Foam::ensightMesh::ensightMesh
|
|||||||
const bool faceZones,
|
const bool faceZones,
|
||||||
const wordReList& faceZonePatterns,
|
const wordReList& faceZonePatterns,
|
||||||
|
|
||||||
const bool binary
|
const IOstream::streamFormat format
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
@ -412,7 +417,7 @@ Foam::ensightMesh::ensightMesh
|
|||||||
patchPatterns_(patchPatterns),
|
patchPatterns_(patchPatterns),
|
||||||
faceZones_(faceZones),
|
faceZones_(faceZones),
|
||||||
faceZonePatterns_(faceZonePatterns),
|
faceZonePatterns_(faceZonePatterns),
|
||||||
binary_(binary),
|
format_(format),
|
||||||
meshCellSets_(mesh.nCells())
|
meshCellSets_(mesh.nCells())
|
||||||
{
|
{
|
||||||
correct();
|
correct();
|
||||||
@ -521,7 +526,7 @@ void Foam::ensightMesh::writePrims
|
|||||||
// Create a temp int array
|
// Create a temp int array
|
||||||
if (cellShapes.size())
|
if (cellShapes.size())
|
||||||
{
|
{
|
||||||
if (ensightGeometryFile.ascii())
|
if (format_ == IOstream::ASCII)
|
||||||
{
|
{
|
||||||
// Workaround for paraview issue : write one cell per line
|
// Workaround for paraview issue : write one cell per line
|
||||||
|
|
||||||
@ -1018,63 +1023,56 @@ void Foam::ensightMesh::writeAllPoints
|
|||||||
|
|
||||||
void Foam::ensightMesh::write
|
void Foam::ensightMesh::write
|
||||||
(
|
(
|
||||||
const fileName& postProcPath,
|
const fileName& dataDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const bool meshMoving,
|
const bool meshMoving,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const Time& runTime = mesh_.time();
|
|
||||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||||
|
|
||||||
|
ensightStream* filePtr(nullptr);
|
||||||
word timeFile = prepend;
|
|
||||||
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
timeFile += "0000.";
|
|
||||||
}
|
|
||||||
else if (meshMoving)
|
|
||||||
{
|
|
||||||
timeFile += itoa(timeIndex) + '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the filename of the ensight file
|
|
||||||
fileName ensightGeometryFileName = timeFile + "mesh";
|
|
||||||
|
|
||||||
ensightStream* ensightGeometryFilePtr = nullptr;
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (binary_)
|
// set the filename of the ensight file
|
||||||
|
fileName geoFileName = dataDir.path()/ensightMesh::geometryName;
|
||||||
|
|
||||||
|
if (meshMoving)
|
||||||
{
|
{
|
||||||
ensightGeometryFilePtr = new ensightBinaryStream
|
geoFileName =
|
||||||
|
dataDir/ensightFile::subDir(timeIndex)
|
||||||
|
/ensightMesh::geometryName;
|
||||||
|
|
||||||
|
mkDir(geoFileName.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format_ == IOstream::BINARY)
|
||||||
|
{
|
||||||
|
filePtr = new ensightBinaryStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightGeometryFileName,
|
geoFileName
|
||||||
runTime
|
|
||||||
);
|
);
|
||||||
ensightGeometryFilePtr->write("C binary");
|
filePtr->write("C binary");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ensightGeometryFilePtr = new ensightAsciiStream
|
filePtr = new ensightAsciiStream
|
||||||
(
|
(
|
||||||
postProcPath/ensightGeometryFileName,
|
geoFileName
|
||||||
runTime
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ensightStream& ensightGeometryFile = *ensightGeometryFilePtr;
|
ensightStream& os = *filePtr;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
string desc = string("written by OpenFOAM-") + Foam::FOAMversion;
|
string desc = string("written by OpenFOAM-") + Foam::FOAMversion;
|
||||||
|
|
||||||
ensightGeometryFile.write("EnSight Geometry File");
|
os.write("EnSight Geometry File");
|
||||||
ensightGeometryFile.write(desc.c_str());
|
os.write(desc.c_str());
|
||||||
ensightGeometryFile.write("node id assign");
|
os.write("node id assign");
|
||||||
ensightGeometryFile.write("element id assign");
|
os.write("element id assign");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patchNames_.empty())
|
if (patchNames_.empty())
|
||||||
@ -1089,7 +1087,7 @@ void Foam::ensightMesh::write
|
|||||||
"internalMesh",
|
"internalMesh",
|
||||||
uniquePoints,
|
uniquePoints,
|
||||||
nPoints,
|
nPoints,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllPrims
|
writeAllPrims
|
||||||
@ -1103,7 +1101,7 @@ void Foam::ensightMesh::write
|
|||||||
meshCellSets_.wedges,
|
meshCellSets_.wedges,
|
||||||
pointToGlobal_
|
pointToGlobal_
|
||||||
),
|
),
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllPrims
|
writeAllPrims
|
||||||
@ -1111,7 +1109,7 @@ void Foam::ensightMesh::write
|
|||||||
"penta6",
|
"penta6",
|
||||||
meshCellSets_.nPrisms,
|
meshCellSets_.nPrisms,
|
||||||
map(cellShapes, meshCellSets_.prisms, pointToGlobal_),
|
map(cellShapes, meshCellSets_.prisms, pointToGlobal_),
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllPrims
|
writeAllPrims
|
||||||
@ -1119,7 +1117,7 @@ void Foam::ensightMesh::write
|
|||||||
"pyramid5",
|
"pyramid5",
|
||||||
meshCellSets_.nPyrs,
|
meshCellSets_.nPyrs,
|
||||||
map(cellShapes, meshCellSets_.pyrs, pointToGlobal_),
|
map(cellShapes, meshCellSets_.pyrs, pointToGlobal_),
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllPrims
|
writeAllPrims
|
||||||
@ -1127,13 +1125,13 @@ void Foam::ensightMesh::write
|
|||||||
"tetra4",
|
"tetra4",
|
||||||
meshCellSets_.nTets,
|
meshCellSets_.nTets,
|
||||||
map(cellShapes, meshCellSets_.tets, pointToGlobal_),
|
map(cellShapes, meshCellSets_.tets, pointToGlobal_),
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllPolys
|
writeAllPolys
|
||||||
(
|
(
|
||||||
pointToGlobal_,
|
pointToGlobal_,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1182,7 +1180,7 @@ void Foam::ensightMesh::write
|
|||||||
patchName,
|
patchName,
|
||||||
uniquePoints,
|
uniquePoints,
|
||||||
globalPointsPtr().size(),
|
globalPointsPtr().size(),
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllFacePrims
|
writeAllFacePrims
|
||||||
@ -1191,7 +1189,7 @@ void Foam::ensightMesh::write
|
|||||||
tris,
|
tris,
|
||||||
nfp.nTris,
|
nfp.nTris,
|
||||||
patchFaces,
|
patchFaces,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllFacePrims
|
writeAllFacePrims
|
||||||
@ -1200,7 +1198,7 @@ void Foam::ensightMesh::write
|
|||||||
quads,
|
quads,
|
||||||
nfp.nQuads,
|
nfp.nQuads,
|
||||||
patchFaces,
|
patchFaces,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllNSided
|
writeAllNSided
|
||||||
@ -1208,7 +1206,7 @@ void Foam::ensightMesh::write
|
|||||||
polys,
|
polys,
|
||||||
nfp.nPolys,
|
nfp.nPolys,
|
||||||
patchFaces,
|
patchFaces,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1287,7 +1285,7 @@ void Foam::ensightMesh::write
|
|||||||
faceZoneName,
|
faceZoneName,
|
||||||
uniquePoints,
|
uniquePoints,
|
||||||
globalPointsPtr().size(),
|
globalPointsPtr().size(),
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllFacePrims
|
writeAllFacePrims
|
||||||
@ -1296,7 +1294,7 @@ void Foam::ensightMesh::write
|
|||||||
tris,
|
tris,
|
||||||
nfp.nTris,
|
nfp.nTris,
|
||||||
faceZoneMasterFaces,
|
faceZoneMasterFaces,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllFacePrims
|
writeAllFacePrims
|
||||||
@ -1305,7 +1303,7 @@ void Foam::ensightMesh::write
|
|||||||
quads,
|
quads,
|
||||||
nfp.nQuads,
|
nfp.nQuads,
|
||||||
faceZoneMasterFaces,
|
faceZoneMasterFaces,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllNSided
|
writeAllNSided
|
||||||
@ -1313,14 +1311,14 @@ void Foam::ensightMesh::write
|
|||||||
polys,
|
polys,
|
||||||
nfp.nPolys,
|
nfp.nPolys,
|
||||||
faceZoneMasterFaces,
|
faceZoneMasterFaces,
|
||||||
ensightGeometryFile
|
os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (filePtr) // only on master
|
||||||
{
|
{
|
||||||
delete ensightGeometryFilePtr;
|
delete filePtr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,6 +63,11 @@ class ensightStream;
|
|||||||
class ensightMesh
|
class ensightMesh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- The name for geometry files
|
||||||
|
static const char* geometryName;
|
||||||
|
|
||||||
|
//- Helper class for managing face primitives
|
||||||
class nFacePrimitives
|
class nFacePrimitives
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -97,8 +102,8 @@ private:
|
|||||||
const bool faceZones_;
|
const bool faceZones_;
|
||||||
const wordReList faceZonePatterns_;
|
const wordReList faceZonePatterns_;
|
||||||
|
|
||||||
//- Set binary file output
|
//- Ascii/Binary file output
|
||||||
const bool binary_;
|
const IOstream::streamFormat format_;
|
||||||
|
|
||||||
//- The ensight part id for the first patch
|
//- The ensight part id for the first patch
|
||||||
label patchPartOffset_;
|
label patchPartOffset_;
|
||||||
@ -140,10 +145,10 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
ensightMesh(const ensightMesh&);
|
ensightMesh(const ensightMesh&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const ensightMesh&);
|
void operator=(const ensightMesh&) = delete;
|
||||||
|
|
||||||
void writePoints
|
void writePoints
|
||||||
(
|
(
|
||||||
@ -267,7 +272,7 @@ public:
|
|||||||
const wordReList& patchPatterns,
|
const wordReList& patchPatterns,
|
||||||
const bool faceZones,
|
const bool faceZones,
|
||||||
const wordReList& faceZonePatterns,
|
const wordReList& faceZonePatterns,
|
||||||
const bool binary
|
const IOstream::streamFormat format = IOstream::BINARY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -284,6 +289,11 @@ public:
|
|||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOstream::streamFormat format() const
|
||||||
|
{
|
||||||
|
return format_;
|
||||||
|
}
|
||||||
|
|
||||||
const cellSets& meshCellSets() const
|
const cellSets& meshCellSets() const
|
||||||
{
|
{
|
||||||
return meshCellSets_;
|
return meshCellSets_;
|
||||||
@ -352,8 +362,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
||||||
//- Update for new mesh
|
//- Update for new mesh
|
||||||
@ -371,13 +379,11 @@ public:
|
|||||||
|
|
||||||
void write
|
void write
|
||||||
(
|
(
|
||||||
const fileName& postProcPath,
|
const fileName& ensightDir,
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
const bool meshMoving,
|
const bool meshMoving,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,103 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 "ensightParticlePositions.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "passiveParticle.H"
|
|
||||||
#include "Cloud.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
#include "IOmanip.H"
|
|
||||||
#include "itoa.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void ensightParticlePositions
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const fileName& postProcPath,
|
|
||||||
const word& timeFile,
|
|
||||||
const word& cloudName,
|
|
||||||
const bool dataExists
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (dataExists)
|
|
||||||
{
|
|
||||||
Info<< "Converting cloud " << cloudName << " positions" << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Creating empty cloud " << cloudName << " positions" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Time& runTime = mesh.time();
|
|
||||||
|
|
||||||
fileName ensightFileName(timeFile + "." + cloudName);
|
|
||||||
OFstream ensightFile
|
|
||||||
(
|
|
||||||
postProcPath/ensightFileName,
|
|
||||||
runTime.writeFormat(),
|
|
||||||
runTime.writeVersion(),
|
|
||||||
runTime.writeCompression()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Output header
|
|
||||||
ensightFile
|
|
||||||
<< cloudName.c_str() << nl
|
|
||||||
<< "particle coordinates" << nl;
|
|
||||||
|
|
||||||
if (dataExists)
|
|
||||||
{
|
|
||||||
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
|
||||||
|
|
||||||
// Set Format
|
|
||||||
ensightFile.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
ensightFile.precision(5);
|
|
||||||
|
|
||||||
ensightFile<< setw(8) << parcels.size() << nl;
|
|
||||||
|
|
||||||
label nParcels = 0;
|
|
||||||
|
|
||||||
// Output positions
|
|
||||||
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
|
|
||||||
{
|
|
||||||
const vector& p = elmnt().position();
|
|
||||||
|
|
||||||
ensightFile
|
|
||||||
<< setw(8) << ++nParcels
|
|
||||||
<< setw(12) << p.x() << setw(12) << p.y() << setw(12) << p.z()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label nParcels = 0;
|
|
||||||
ensightFile<< setw(8) << nParcels << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -3,7 +3,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,10 +57,10 @@ class ensightStream
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
ensightStream(const ensightStream&);
|
ensightStream(const ensightStream&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const ensightStream&);
|
void operator=(const ensightStream&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -86,8 +86,6 @@ public:
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool ascii() const = 0;
|
|
||||||
|
|
||||||
virtual void write(const char*) = 0;
|
virtual void write(const char*) = 0;
|
||||||
|
|
||||||
virtual void write(const int) = 0;
|
virtual void write(const int) = 0;
|
||||||
@ -98,8 +96,6 @@ public:
|
|||||||
|
|
||||||
virtual void writePartHeader(const label) = 0;
|
virtual void writePartHeader(const label) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,93 @@
|
|||||||
|
// check all time directories for the following:
|
||||||
|
|
||||||
|
// The fields for each cloud:
|
||||||
|
HashTable<HashTable<word>> cloudFields;
|
||||||
|
|
||||||
|
// Identify if lagrangian data exist at any time step.
|
||||||
|
if (timeDirs.size() && !noLagrangian)
|
||||||
|
{
|
||||||
|
const fileName& baseDir = mesh.time().path();
|
||||||
|
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||||
|
|
||||||
|
Info<< "Searching for lagrangian ... " << flush;
|
||||||
|
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
|
{
|
||||||
|
const word& timeName = timeDirs[timeI].name();
|
||||||
|
|
||||||
|
// DO NOT USE -->> runTime.setTime(timeDirs[timeI], timeI); <<--
|
||||||
|
// It incurs a large overhead when done so frequently.
|
||||||
|
|
||||||
|
fileNameList cloudDirs = readDir
|
||||||
|
(
|
||||||
|
baseDir/timeName/cloudPrefix,
|
||||||
|
fileName::DIRECTORY
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(cloudDirs, cloudI)
|
||||||
|
{
|
||||||
|
const word& cloudName = cloudDirs[cloudI];
|
||||||
|
|
||||||
|
IOobjectList cloudObjs
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
timeName,
|
||||||
|
cloudPrefix/cloudName
|
||||||
|
);
|
||||||
|
|
||||||
|
// clouds always require "positions"
|
||||||
|
if (cloudObjs.found("positions"))
|
||||||
|
{
|
||||||
|
HashTable<HashTable<word>>::iterator cloudIter =
|
||||||
|
cloudFields.find(cloudName);
|
||||||
|
|
||||||
|
if (cloudIter == cloudFields.end())
|
||||||
|
{
|
||||||
|
// A newly discovered cloud
|
||||||
|
cloudFields.insert(cloudName, HashTable<word>());
|
||||||
|
cloudIter = cloudFields.find(cloudName);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
|
||||||
|
{
|
||||||
|
const IOobject obj = *fieldIter();
|
||||||
|
|
||||||
|
// Add field and field type
|
||||||
|
cloudIter().insert
|
||||||
|
(
|
||||||
|
obj.name(),
|
||||||
|
obj.headerClassName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// prune out "positions" again since it gets treated specially
|
||||||
|
forAllIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||||
|
{
|
||||||
|
cloudIter().erase("positions");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cloudFields.empty())
|
||||||
|
{
|
||||||
|
Info<< "none detected." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// sorted list of cloud names
|
||||||
|
const wordList cloudNames(cloudFields.sortedToc());
|
||||||
|
|
||||||
|
if (cloudNames.size())
|
||||||
|
{
|
||||||
|
// complete the echo information
|
||||||
|
Info<< "(";
|
||||||
|
forAll(cloudNames, cloudNo)
|
||||||
|
{
|
||||||
|
Info<< ' ' << cloudNames[cloudNo];
|
||||||
|
}
|
||||||
|
Info<< " ) " << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,22 +39,31 @@ Usage
|
|||||||
- \par -ascii
|
- \par -ascii
|
||||||
Write Ensight data in ASCII format instead of "C Binary"
|
Write Ensight data in ASCII format instead of "C Binary"
|
||||||
|
|
||||||
- \par -patches patchList
|
- \par -noZero
|
||||||
Specify particular patches to write.
|
Exclude the often incomplete initial conditions.
|
||||||
Specifying an empty list suppresses writing the internalMesh.
|
|
||||||
|
- \par -noLagrangian
|
||||||
|
Suppress writing lagrangian positions and fields.
|
||||||
|
|
||||||
- \par -noPatches
|
- \par -noPatches
|
||||||
Suppress writing any patches.
|
Suppress writing any patches.
|
||||||
|
|
||||||
|
- \par -patches patchList
|
||||||
|
Specify particular patches to write.
|
||||||
|
Specifying an empty list suppresses writing the internalMesh.
|
||||||
|
|
||||||
- \par -faceZones zoneList
|
- \par -faceZones zoneList
|
||||||
Specify faceZones to write, with wildcards
|
Specify faceZones to write, with wildcards
|
||||||
|
|
||||||
- \par -cellZone zoneName
|
- \par -cellZone zoneName
|
||||||
Specify single cellZone to write (not lagrangian)
|
Specify single cellZone to write (not lagrangian)
|
||||||
|
|
||||||
|
- \par -width \<n\>
|
||||||
|
Width of EnSight data subdir (default: 8)
|
||||||
|
|
||||||
Note
|
Note
|
||||||
Parallel support for cloud data is not supported
|
Writes to \a EnSight directory to avoid collisions with
|
||||||
- writes to \a EnSight directory to avoid collisions with foamToEnsightParts
|
foamToEnsightParts
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -70,14 +79,12 @@ Note
|
|||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
#include "tensorIOField.H"
|
#include "tensorIOField.H"
|
||||||
|
|
||||||
|
#include "ensightFile.H"
|
||||||
#include "ensightMesh.H"
|
#include "ensightMesh.H"
|
||||||
#include "ensightField.H"
|
#include "ensightField.H"
|
||||||
|
#include "ensightCloud.H"
|
||||||
#include "ensightParticlePositions.H"
|
|
||||||
#include "ensightCloudField.H"
|
|
||||||
|
|
||||||
#include "fvc.H"
|
#include "fvc.H"
|
||||||
|
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "fvMeshSubset.H"
|
#include "fvMeshSubset.H"
|
||||||
|
|
||||||
@ -87,11 +94,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool inFileNameList
|
bool inFileNameList(const fileNameList& nameList, const word& name)
|
||||||
(
|
|
||||||
const fileNameList& nameList,
|
|
||||||
const word& name
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
forAll(nameList, i)
|
forAll(nameList, i)
|
||||||
{
|
{
|
||||||
@ -105,7 +108,6 @@ bool inFileNameList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
timeSelector::addOptions();
|
timeSelector::addOptions();
|
||||||
@ -122,6 +124,11 @@ int main(int argc, char *argv[])
|
|||||||
"write values in nodes"
|
"write values in nodes"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"noLagrangian",
|
||||||
|
"suppress writing lagrangian positions and fields"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noPatches",
|
"noPatches",
|
||||||
"suppress writing any patches"
|
"suppress writing any patches"
|
||||||
@ -151,32 +158,21 @@ int main(int argc, char *argv[])
|
|||||||
"word",
|
"word",
|
||||||
"specify cellZone to write"
|
"specify cellZone to write"
|
||||||
);
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"name",
|
||||||
|
"subdir",
|
||||||
|
"define sub-directory name to use for ensight data "
|
||||||
|
"(default: 'EnSight')"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"width",
|
||||||
|
"n",
|
||||||
|
"width of ensight data subdir"
|
||||||
|
);
|
||||||
|
|
||||||
#include "setRootCase.H"
|
// the volume field types that we handle
|
||||||
|
|
||||||
// Check options
|
|
||||||
const bool binary = !args.optionFound("ascii");
|
|
||||||
const bool nodeValues = args.optionFound("nodeValues");
|
|
||||||
|
|
||||||
cpuTime timer;
|
|
||||||
memInfo mem;
|
|
||||||
Info<< "Initial memory "
|
|
||||||
<< mem.update().size() << " kB" << endl;
|
|
||||||
|
|
||||||
#include "createTime.H"
|
|
||||||
|
|
||||||
instantList Times = timeSelector::select0(runTime, args);
|
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
|
||||||
|
|
||||||
// Mesh instance (region0 gets filtered out)
|
|
||||||
fileName regionPrefix = "";
|
|
||||||
|
|
||||||
if (regionName != polyMesh::defaultRegion)
|
|
||||||
{
|
|
||||||
regionPrefix = regionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label nVolFieldTypes = 10;
|
const label nVolFieldTypes = 10;
|
||||||
const word volFieldTypes[] =
|
const word volFieldTypes[] =
|
||||||
{
|
{
|
||||||
@ -193,38 +189,90 @@ int main(int argc, char *argv[])
|
|||||||
volTensorField::Internal::typeName
|
volTensorField::Internal::typeName
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
// default to binary output, unless otherwise specified
|
||||||
|
const IOstream::streamFormat format =
|
||||||
|
(
|
||||||
|
args.optionFound("ascii")
|
||||||
|
? IOstream::ASCII
|
||||||
|
: IOstream::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
|
const bool nodeValues = args.optionFound("nodeValues");
|
||||||
|
|
||||||
|
cpuTime timer;
|
||||||
|
memInfo mem;
|
||||||
|
Info<< "Initial memory "
|
||||||
|
<< mem.update().size() << " kB" << endl;
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
|
||||||
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
// adjust output width
|
||||||
|
if (args.optionFound("width"))
|
||||||
|
{
|
||||||
|
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// define sub-directory name to use for EnSight data
|
||||||
|
fileName ensightDir = "EnSight";
|
||||||
|
args.optionReadIfPresent("name", ensightDir);
|
||||||
|
|
||||||
// Path to EnSight directory at case level only
|
// Path to EnSight directory at case level only
|
||||||
// - For parallel cases, data only written from master
|
// - For parallel cases, data only written from master
|
||||||
fileName ensightDir = args.rootPath()/args.globalCaseName()/"EnSight";
|
if (!ensightDir.isAbsolute())
|
||||||
|
{
|
||||||
|
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileName dataDir = ensightDir/"data";
|
||||||
|
const fileName dataMask = dataDir.name()/ensightFile::mask();
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
// EnSight and EnSight/data directories must exist
|
||||||
|
// - remove old data for a clean conversion of everything
|
||||||
if (isDir(ensightDir))
|
if (isDir(ensightDir))
|
||||||
{
|
{
|
||||||
rmDir(ensightDir);
|
rmDir(ensightDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
mkDir(ensightDir);
|
mkDir(dataDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
|
// Mesh instance (region0 gets filtered out)
|
||||||
|
fileName regionPrefix;
|
||||||
|
if (regionName != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
regionPrefix = regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start of case file header output
|
// Start of case file header output
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
const word prepend = args.globalCaseName() + '.';
|
OFstream *ensightCaseFilePtr(nullptr);
|
||||||
|
|
||||||
OFstream *ensightCaseFilePtr = nullptr;
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
fileName caseFileName = prepend + "case";
|
fileName caseFileName = args.globalCaseName() + ".case";
|
||||||
Info<< nl << "write case: " << caseFileName.c_str() << endl;
|
|
||||||
|
|
||||||
// the case file is always ASCII
|
Info<< "Converting " << timeDirs.size() << " time steps" << nl
|
||||||
|
<< "Ensight case: " << caseFileName.c_str() << endl;
|
||||||
|
|
||||||
|
// The case file is always ASCII
|
||||||
ensightCaseFilePtr = new OFstream
|
ensightCaseFilePtr = new OFstream
|
||||||
(
|
(
|
||||||
ensightDir/caseFileName,
|
ensightDir/caseFileName,
|
||||||
IOstream::ASCII
|
IOstream::ASCII
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ensightCaseFilePtr->setf(ios_base::left);
|
||||||
|
ensightCaseFilePtr->setf(ios_base::scientific, ios_base::floatfield);
|
||||||
|
ensightCaseFilePtr->precision(5);
|
||||||
|
|
||||||
*ensightCaseFilePtr
|
*ensightCaseFilePtr
|
||||||
<< "FORMAT" << nl
|
<< "FORMAT" << nl
|
||||||
<< "type: ensight gold" << nl << nl;
|
<< "type: ensight gold" << nl << nl;
|
||||||
@ -253,6 +301,8 @@ int main(int argc, char *argv[])
|
|||||||
fieldPatterns = wordReList(args.optionLookup("fields")());
|
fieldPatterns = wordReList(args.optionLookup("fields")());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||||
|
|
||||||
word cellZoneName;
|
word cellZoneName;
|
||||||
const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
|
const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
|
||||||
|
|
||||||
@ -280,133 +330,84 @@ int main(int argc, char *argv[])
|
|||||||
patchPatterns,
|
patchPatterns,
|
||||||
selectedZones,
|
selectedZones,
|
||||||
zonePatterns,
|
zonePatterns,
|
||||||
binary
|
format
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set Time to the last time before looking for the lagrangian objects
|
// Set Time to the last time before looking for the lagrangian objects
|
||||||
runTime.setTime(Times.last(), Times.size()-1);
|
runTime.setTime(timeDirs.last(), timeDirs.size()-1);
|
||||||
|
|
||||||
IOobjectList objects(mesh, runTime.timeName());
|
IOobjectList objects(mesh, runTime.timeName());
|
||||||
|
|
||||||
#include "checkMeshMoving.H"
|
#include "checkMeshMoving.H"
|
||||||
|
#include "findCloudFields.H"
|
||||||
|
|
||||||
if (meshMoving)
|
|
||||||
{
|
|
||||||
Info<< "Detected a moving mesh (multiple polyMesh/points files)."
|
|
||||||
<< " Writing meshes for every timestep." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wordHashSet allCloudNames;
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
word geomFileName = prepend + "0000";
|
// test the pre-check variable if there is a moving mesh
|
||||||
|
// time-set for geometries
|
||||||
|
// TODO: split off into separate time-set,
|
||||||
|
// but need to verify ensight spec
|
||||||
|
|
||||||
// test pre check variable if there is a moving mesh
|
|
||||||
if (meshMoving)
|
if (meshMoving)
|
||||||
{
|
{
|
||||||
geomFileName = prepend + "****";
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
<< "GEOMETRY" << nl
|
<< "GEOMETRY" << nl
|
||||||
<< "model: 1 "
|
<< setw(16) << "model: 1"
|
||||||
<< (geomFileName + ".mesh").c_str() << nl;
|
<< (dataMask/ensightMesh::geometryName).c_str() << nl;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Identify if lagrangian data exists at each time, and add clouds
|
|
||||||
// to the 'allCloudNames' hash set
|
|
||||||
forAll(Times, timeI)
|
|
||||||
{
|
|
||||||
runTime.setTime(Times[timeI], timeI);
|
|
||||||
|
|
||||||
fileNameList cloudDirs = readDir
|
|
||||||
(
|
|
||||||
runTime.timePath()/regionPrefix/cloud::prefix,
|
|
||||||
fileName::DIRECTORY
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(cloudDirs, cloudI)
|
|
||||||
{
|
|
||||||
IOobjectList cloudObjs
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
runTime.timeName(),
|
|
||||||
cloud::prefix/cloudDirs[cloudI]
|
|
||||||
);
|
|
||||||
|
|
||||||
IOobject* positionsPtr = cloudObjs.lookup(word("positions"));
|
|
||||||
|
|
||||||
if (positionsPtr)
|
|
||||||
{
|
|
||||||
allCloudNames.insert(cloudDirs[cloudI]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HashTable<HashTable<word>> allCloudFields;
|
|
||||||
forAllConstIter(wordHashSet, allCloudNames, cloudIter)
|
|
||||||
{
|
|
||||||
// Add the name of the cloud(s) to the case file header
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
{
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
<< (
|
<< "GEOMETRY" << nl
|
||||||
"measured: 1 "
|
<< setw(16) << "model:"
|
||||||
+ prepend
|
<< ensightMesh::geometryName << nl;
|
||||||
+ "****."
|
|
||||||
+ cloudIter.key()
|
|
||||||
).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new hash table for each cloud
|
|
||||||
allCloudFields.insert(cloudIter.key(), HashTable<word>());
|
|
||||||
|
|
||||||
// Identify the new cloud in the hash table
|
// Add the name of the cloud(s) to the case file header
|
||||||
HashTable<HashTable<word>>::iterator newCloudIter =
|
forAll(cloudNames, cloudNo)
|
||||||
allCloudFields.find(cloudIter.key());
|
|
||||||
|
|
||||||
// Loop over all times to build list of fields and field types
|
|
||||||
// for each cloud
|
|
||||||
forAll(Times, timeI)
|
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[timeI], timeI);
|
const word& cloudName = cloudNames[cloudNo];
|
||||||
|
|
||||||
IOobjectList cloudObjs
|
ensightCaseFile
|
||||||
|
<< setw(16) << "measured: 1"
|
||||||
|
<< fileName
|
||||||
(
|
(
|
||||||
mesh,
|
dataMask/cloud::prefix/cloudName/"positions"
|
||||||
runTime.timeName(),
|
).c_str() << nl;
|
||||||
cloud::prefix/cloudIter.key()
|
}
|
||||||
);
|
}
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
|
Info<< "Startup in "
|
||||||
{
|
<< timer.cpuTimeIncrement() << " s, "
|
||||||
const IOobject obj = *fieldIter();
|
<< mem.update().size() << " kB" << nl << endl;
|
||||||
|
|
||||||
if (obj.name() != "positions")
|
// ignore special fields (_0 fields),
|
||||||
{
|
// ignore fields we don't handle,
|
||||||
// Add field and field type
|
// ignore fields that are not available for all time-steps
|
||||||
newCloudIter().insert
|
HashTable<bool> fieldsToUse;
|
||||||
(
|
|
||||||
obj.name(),
|
|
||||||
obj.headerClassName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
label nTimeSteps = 0;
|
label nTimeSteps = 0;
|
||||||
forAll(Times, timeIndex)
|
forAll(timeDirs, timeIndex)
|
||||||
{
|
{
|
||||||
nTimeSteps++;
|
++nTimeSteps;
|
||||||
runTime.setTime(Times[timeIndex], timeIndex);
|
runTime.setTime(timeDirs[timeIndex], timeIndex);
|
||||||
|
|
||||||
word timeName = itoa(timeIndex);
|
Info<< "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||||
word timeFile = prepend + timeName;
|
|
||||||
|
|
||||||
Info<< "Translating time = " << runTime.timeName() << nl;
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// the data/ITER subdirectory must exist
|
||||||
|
// Note that data/ITER is indeed a valid ensight::FileName
|
||||||
|
const fileName subDir = ensightFile::subDir(timeIndex);
|
||||||
|
mkDir(dataDir/subDir);
|
||||||
|
|
||||||
|
// place a timestamp in the directory for future reference
|
||||||
|
OFstream timeStamp(dataDir/subDir/"time");
|
||||||
|
timeStamp
|
||||||
|
<< "# timestep time" << nl
|
||||||
|
<< subDir.c_str() << " " << runTime.timeName() << nl;
|
||||||
|
}
|
||||||
|
|
||||||
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
||||||
if (timeIndex != 0 && meshSubsetter.hasSubMesh())
|
if (timeIndex != 0 && meshSubsetter.hasSubMesh())
|
||||||
@ -420,7 +421,6 @@ int main(int argc, char *argv[])
|
|||||||
meshSubsetter.setLargeCellSubset(c0, 0);
|
meshSubsetter.setLargeCellSubset(c0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (meshState != polyMesh::UNCHANGED)
|
if (meshState != polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
eMesh.correct();
|
eMesh.correct();
|
||||||
@ -430,8 +430,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
eMesh.write
|
eMesh.write
|
||||||
(
|
(
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
meshMoving,
|
meshMoving,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
@ -450,8 +449,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Cell field data output
|
// Cell field data output
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Info<< "Write volume field (";
|
||||||
|
|
||||||
for (label i=0; i<nVolFieldTypes; i++)
|
for (label i=0; i<nVolFieldTypes; ++i)
|
||||||
{
|
{
|
||||||
wordList fieldNames = objects.names(volFieldTypes[i]);
|
wordList fieldNames = objects.names(volFieldTypes[i]);
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "checkData.H"
|
#include "checkData.H"
|
||||||
|
|
||||||
if (!variableGood)
|
if (!fieldsToUse[fieldName])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -491,10 +491,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
volField(meshSubsetter, vf),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -506,10 +504,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
volField(meshSubsetter, vf),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -521,10 +517,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
volField(meshSubsetter, vf),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -536,10 +530,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
volField(meshSubsetter, vf),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -551,10 +543,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
volField(meshSubsetter, vf),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -570,10 +560,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField<scalar>(meshSubsetter, df),
|
volField<scalar>(meshSubsetter, df),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -588,10 +576,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField<vector>(meshSubsetter, df),
|
volField<vector>(meshSubsetter, df),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -607,10 +593,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField<sphericalTensor>(meshSubsetter, df),
|
volField<sphericalTensor>(meshSubsetter, df),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -625,10 +609,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField<symmTensor>(meshSubsetter, df),
|
volField<symmTensor>(meshSubsetter, df),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
@ -643,24 +625,29 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
volField<tensor>(meshSubsetter, df),
|
volField<tensor>(meshSubsetter, df),
|
||||||
eMesh,
|
eMesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
|
||||||
nodeValues,
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Do not currently handle this type - blacklist for the future.
|
||||||
|
fieldsToUse.set(fieldName, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Info<< " )" << nl;
|
||||||
|
|
||||||
|
|
||||||
// Cloud field data output
|
// Cloud field data output
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
forAllConstIter(HashTable<HashTable<word>>, allCloudFields, cloudIter)
|
forAll(cloudNames, cloudNo)
|
||||||
{
|
{
|
||||||
const word& cloudName = cloudIter.key();
|
const word& cloudName = cloudNames[cloudNo];
|
||||||
|
const HashTable<word>& theseCloudFields = cloudFields[cloudName];
|
||||||
|
|
||||||
fileNameList currentCloudDirs = readDir
|
fileNameList currentCloudDirs = readDir
|
||||||
(
|
(
|
||||||
@ -668,17 +655,22 @@ int main(int argc, char *argv[])
|
|||||||
fileName::DIRECTORY
|
fileName::DIRECTORY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< "Write " << cloudName << " (";
|
||||||
|
|
||||||
bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
|
bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
|
||||||
|
reduce(cloudExists, orOp<bool>());
|
||||||
|
|
||||||
ensightParticlePositions
|
ensightParticlePositions
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
ensightDir,
|
dataDir,
|
||||||
timeFile,
|
timeIndex,
|
||||||
cloudName,
|
cloudName,
|
||||||
cloudExists
|
cloudExists,
|
||||||
|
format
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
forAllConstIter(HashTable<word>, theseCloudFields, fieldIter)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldIter.key();
|
const word& fieldName = fieldIter.key();
|
||||||
const word& fieldType = fieldIter();
|
const word& fieldType = fieldIter();
|
||||||
@ -696,17 +688,20 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
reduce(fieldExists, orOp<bool>());
|
||||||
|
|
||||||
if (fieldType == scalarIOField::typeName)
|
if (fieldType == scalarIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightCloudField<scalar>
|
ensightCloudField<scalar>
|
||||||
(
|
(
|
||||||
fieldObject,
|
fieldObject,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
cloudName,
|
cloudName,
|
||||||
|
cloudNo,
|
||||||
ensightCaseFile,
|
ensightCaseFile,
|
||||||
fieldExists
|
fieldExists,
|
||||||
|
format
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (fieldType == vectorIOField::typeName)
|
else if (fieldType == vectorIOField::typeName)
|
||||||
@ -714,37 +709,34 @@ int main(int argc, char *argv[])
|
|||||||
ensightCloudField<vector>
|
ensightCloudField<vector>
|
||||||
(
|
(
|
||||||
fieldObject,
|
fieldObject,
|
||||||
ensightDir,
|
dataDir,
|
||||||
prepend,
|
|
||||||
timeIndex,
|
timeIndex,
|
||||||
cloudName,
|
cloudName,
|
||||||
|
cloudNo,
|
||||||
ensightCaseFile,
|
ensightCaseFile,
|
||||||
fieldExists
|
fieldExists,
|
||||||
|
format
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Unable to convert field type " << fieldType
|
|
||||||
<< " for field " << fieldName << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Info<< " )" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Wrote in "
|
Info<< "Wrote in "
|
||||||
<< timer.cpuTimeIncrement() << " s, "
|
<< timer.cpuTimeIncrement() << " s, "
|
||||||
<< mem.update().size() << " kB" << endl;
|
<< mem.update().size() << " kB" << nl << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "ensightCaseTail.H"
|
#include "ensightCaseTail.H"
|
||||||
|
|
||||||
if (Pstream::master())
|
if (ensightCaseFilePtr) // on master only
|
||||||
{
|
{
|
||||||
delete ensightCaseFilePtr;
|
delete ensightCaseFilePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nEnd: "
|
Info<< "End: "
|
||||||
<< timer.elapsedCpuTime() << " s, "
|
<< timer.elapsedCpuTime() << " s, "
|
||||||
<< mem.update().peak() << " kB (peak)\n" << endl;
|
<< mem.update().peak() << " kB (peak)" << nl << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,47 @@
|
|||||||
// - could restrict to the selected times
|
// - could restrict to the selected times
|
||||||
|
|
||||||
bool hasMovingMesh = false;
|
bool hasMovingMesh = false;
|
||||||
if (timeDirs.size() > 1)
|
|
||||||
|
if (timeDirs.size() > 1 && Pstream::master())
|
||||||
{
|
{
|
||||||
hasMovingMesh = true;
|
// We already loaded a mesh (usually from constant).
|
||||||
for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
|
// See if any other "polyMesh/points" files exist too.
|
||||||
|
|
||||||
|
const fileName& baseDir = mesh.time().path();
|
||||||
|
|
||||||
|
Info<< "Search for moving mesh ... " << flush;
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
hasMovingMesh = IOobject
|
hasMovingMesh =
|
||||||
|
(
|
||||||
|
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
||||||
|
&& IOobject
|
||||||
(
|
(
|
||||||
"points",
|
"points",
|
||||||
timeDirs[i].name(),
|
timeDirs[timeI].name(),
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ,
|
||||||
).typeHeaderOk<pointIOField>(true);
|
IOobject::NO_WRITE,
|
||||||
|
false // no register
|
||||||
|
).typeHeaderOk<pointIOField>(true)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasMovingMesh)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasMovingMesh)
|
||||||
|
{
|
||||||
|
Info<< "found." << nl
|
||||||
|
<< " Writing meshes for every timestep." << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "none detected." << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reduce(hasMovingMesh, orOp<bool>());
|
||||||
|
|||||||
@ -58,27 +58,29 @@ forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
|||||||
|
|
||||||
if (fieldType == volScalarField::typeName)
|
if (fieldType == volScalarField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "scalar";
|
ensightType = ensightPTraits<scalar>::typeName;
|
||||||
}
|
}
|
||||||
else if (fieldType == volVectorField::typeName)
|
else if (fieldType == volVectorField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "vector";
|
ensightType = ensightPTraits<vector>::typeName;
|
||||||
}
|
}
|
||||||
else if (fieldType == volSphericalTensorField::typeName)
|
else if (fieldType == volSphericalTensorField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "tensor symm";
|
ensightType = ensightPTraits<sphericalTensor>::typeName;
|
||||||
}
|
}
|
||||||
else if (fieldType == volSymmTensorField::typeName)
|
else if (fieldType == volSymmTensorField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "tensor symm";
|
ensightType = ensightPTraits<symmTensor>::typeName;
|
||||||
}
|
}
|
||||||
else if (fieldType == volTensorField::typeName)
|
else if (fieldType == volTensorField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "tensor asym";
|
ensightType = ensightPTraits<tensor>::typeName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ensightType.size())
|
|
||||||
{
|
|
||||||
ensightCaseEntry
|
ensightCaseEntry
|
||||||
(
|
(
|
||||||
caseFile,
|
caseFile,
|
||||||
@ -86,7 +88,6 @@ forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
|||||||
fieldName,
|
fieldName,
|
||||||
dataMask
|
dataMask
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,19 +105,21 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
|||||||
|
|
||||||
if (fieldType == scalarIOField::typeName)
|
if (fieldType == scalarIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "scalar";
|
ensightType = ensightPTraits<scalar>::typeName;
|
||||||
}
|
}
|
||||||
else if (fieldType == vectorIOField::typeName)
|
else if (fieldType == vectorIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "vector";
|
ensightType = ensightPTraits<vector>::typeName;
|
||||||
}
|
}
|
||||||
else if (fieldType == tensorIOField::typeName)
|
else if (fieldType == tensorIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightType = "tensor";
|
ensightType = ensightPTraits<tensor>::typeName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ensightType.size())
|
|
||||||
{
|
|
||||||
ensightCaseEntry
|
ensightCaseEntry
|
||||||
(
|
(
|
||||||
caseFile,
|
caseFile,
|
||||||
@ -128,7 +131,6 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
|||||||
2
|
2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
cloudNo++;
|
cloudNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +164,7 @@ if (fieldTimesUsed.size())
|
|||||||
count = 0;
|
count = 0;
|
||||||
forAll(fieldTimesUsed, i)
|
forAll(fieldTimesUsed, i)
|
||||||
{
|
{
|
||||||
const label& index = fieldTimesUsed[i];
|
const label index = fieldTimesUsed[i];
|
||||||
caseFile
|
caseFile
|
||||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||||
|
|
||||||
@ -203,7 +205,7 @@ if (geometryTimesUsed.size())
|
|||||||
count = 0;
|
count = 0;
|
||||||
forAll(geometryTimesUsed, i)
|
forAll(geometryTimesUsed, i)
|
||||||
{
|
{
|
||||||
const label& index = geometryTimesUsed[i];
|
const label index = geometryTimesUsed[i];
|
||||||
caseFile
|
caseFile
|
||||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||||
|
|
||||||
@ -249,7 +251,7 @@ forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
|
|||||||
count = 0;
|
count = 0;
|
||||||
forAll(timesUsed, i)
|
forAll(timesUsed, i)
|
||||||
{
|
{
|
||||||
const label& index = timesUsed[i];
|
const label index = timesUsed[i];
|
||||||
caseFile
|
caseFile
|
||||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ensightOutputFunctions.H"
|
#include "ensightOutputFunctions.H"
|
||||||
|
#include "ensightPTraits.H"
|
||||||
|
|
||||||
#include "passiveParticle.H"
|
#include "passiveParticle.H"
|
||||||
#include "IOField.H"
|
#include "IOField.H"
|
||||||
@ -171,11 +172,8 @@ void Foam::ensightLagrangianField
|
|||||||
// when writing positions
|
// when writing positions
|
||||||
|
|
||||||
ensightFile os(dataDir, postFileName, format);
|
ensightFile os(dataDir, postFileName, format);
|
||||||
os.write
|
|
||||||
(
|
|
||||||
// description
|
// description
|
||||||
string(postFileName + " with " + pTraits<Type>::typeName + " values")
|
os.write(string(postFileName + " <" + pTraits<Type>::typeName + ">"));
|
||||||
);
|
|
||||||
os.newline();
|
os.newline();
|
||||||
|
|
||||||
IOField<Type> field(fieldObject);
|
IOField<Type> field(fieldObject);
|
||||||
@ -187,23 +185,22 @@ void Foam::ensightLagrangianField
|
|||||||
{
|
{
|
||||||
Type val = field[i];
|
Type val = field[i];
|
||||||
|
|
||||||
if (mag(val) < 1.0e-90)
|
if (mag(val) < 1e-90)
|
||||||
{
|
{
|
||||||
val = Zero;
|
val = Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
{
|
{
|
||||||
os.write( component(val, cmpt) );
|
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||||
}
|
os.write(component(val, cmpt));
|
||||||
|
|
||||||
count += pTraits<Type>::nComponents;
|
if (++count % 6 == 0)
|
||||||
|
|
||||||
if (count % 6 == 0)
|
|
||||||
{
|
{
|
||||||
os.newline();
|
os.newline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add final newline if required
|
// add final newline if required
|
||||||
if (count % 6)
|
if (count % 6)
|
||||||
|
|||||||
@ -8,7 +8,10 @@ HashTable<HashTable<word>> cloudFields;
|
|||||||
|
|
||||||
if (timeDirs.size())
|
if (timeDirs.size())
|
||||||
{
|
{
|
||||||
IOobjectList objs(mesh, timeDirs.last().name());
|
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||||
|
const word& lastTimeName = timeDirs.last().name();
|
||||||
|
|
||||||
|
IOobjectList objs(mesh, lastTimeName);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objs, fieldIter)
|
forAllConstIter(IOobjectList, objs, fieldIter)
|
||||||
{
|
{
|
||||||
@ -31,14 +34,17 @@ if (timeDirs.size())
|
|||||||
//
|
//
|
||||||
// now check for lagrangian/<cloudName>
|
// now check for lagrangian/<cloudName>
|
||||||
//
|
//
|
||||||
fileNameList cloudDirs = readDir
|
fileNameList cloudDirs;
|
||||||
|
if (!noLagrangian)
|
||||||
|
{
|
||||||
|
cloudDirs = readDir
|
||||||
(
|
(
|
||||||
runTime.path()
|
runTime.path()
|
||||||
/ timeDirs.last().name()
|
/ lastTimeName
|
||||||
/ regionPrefix
|
/ cloudPrefix,
|
||||||
/ cloud::prefix,
|
|
||||||
fileName::DIRECTORY
|
fileName::DIRECTORY
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
forAll(cloudDirs, cloudI)
|
forAll(cloudDirs, cloudI)
|
||||||
{
|
{
|
||||||
@ -54,8 +60,8 @@ if (timeDirs.size())
|
|||||||
IOobjectList objs
|
IOobjectList objs
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
timeDirs.last().name(),
|
lastTimeName,
|
||||||
cloud::prefix/cloudName
|
cloudPrefix/cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
bool hasPositions = false;
|
bool hasPositions = false;
|
||||||
@ -89,17 +95,27 @@ if (timeDirs.size())
|
|||||||
//
|
//
|
||||||
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
|
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
|
||||||
{
|
{
|
||||||
IOobjectList objs(mesh, timeDirs[i].name());
|
const word& timeName = timeDirs[i].name();
|
||||||
|
|
||||||
forAllIter(HashTable<word>, volumeFields, fieldIter)
|
// Everything is potentially missing, unless we discover otherwise
|
||||||
{
|
wordHashSet missing(volumeFields);
|
||||||
const word& fieldName = fieldIter.key();
|
|
||||||
|
|
||||||
if (!objs.found(fieldName))
|
// Avoid -->> IOobjectList objs(mesh, timeName); <<--
|
||||||
|
// Too much overhead when done so frequently.
|
||||||
|
|
||||||
|
fileNameList contents = readDir
|
||||||
|
(
|
||||||
|
runTime.path()
|
||||||
|
/ timeName,
|
||||||
|
fileName::FILE
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(contents, fileI)
|
||||||
{
|
{
|
||||||
volumeFields.erase(fieldIter);
|
missing.erase(contents[fileI].name());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volumeFields.erase(missing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,13 @@ Usage
|
|||||||
Ignore the time index contained in the time file and use a
|
Ignore the time index contained in the time file and use a
|
||||||
simple indexing when creating the \c Ensight/data/######## files.
|
simple indexing when creating the \c Ensight/data/######## files.
|
||||||
|
|
||||||
|
- \par -noLagrangian
|
||||||
|
Suppress writing lagrangian positions and fields.
|
||||||
|
|
||||||
|
- \par -index \<start\>
|
||||||
|
Ignore the time index contained in the time file and use a
|
||||||
|
simple indexing when creating the \c Ensight/data/######## files.
|
||||||
|
|
||||||
- \par -noMesh
|
- \par -noMesh
|
||||||
Suppress writing the geometry. Can be useful for converting partial
|
Suppress writing the geometry. Can be useful for converting partial
|
||||||
results for a static geometry.
|
results for a static geometry.
|
||||||
@ -83,8 +90,8 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// enable -constant
|
// Enable -constant
|
||||||
// probably don't need -withZero though, since the fields are vetted
|
// Probably don't need -withZero though, since the fields are vetted
|
||||||
// afterwards anyhow
|
// afterwards anyhow
|
||||||
timeSelector::addOptions(true, false);
|
timeSelector::addOptions(true, false);
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
@ -101,6 +108,11 @@ int main(int argc, char *argv[])
|
|||||||
"and use simple indexing when creating the files"
|
"and use simple indexing when creating the files"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"noLagrangian",
|
||||||
|
"suppress writing lagrangian positions and fields"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noMesh",
|
"noMesh",
|
||||||
"suppress writing the geometry. "
|
"suppress writing the geometry. "
|
||||||
@ -120,7 +132,7 @@ int main(int argc, char *argv[])
|
|||||||
"width of Ensight data subdir"
|
"width of Ensight data subdir"
|
||||||
);
|
);
|
||||||
|
|
||||||
// the volume field types that we handle
|
// The volume field types that we handle
|
||||||
wordHashSet volFieldTypes;
|
wordHashSet volFieldTypes;
|
||||||
volFieldTypes.insert(volScalarField::typeName);
|
volFieldTypes.insert(volScalarField::typeName);
|
||||||
volFieldTypes.insert(volVectorField::typeName);
|
volFieldTypes.insert(volVectorField::typeName);
|
||||||
@ -128,7 +140,7 @@ int main(int argc, char *argv[])
|
|||||||
volFieldTypes.insert(volSymmTensorField::typeName);
|
volFieldTypes.insert(volSymmTensorField::typeName);
|
||||||
volFieldTypes.insert(volTensorField::typeName);
|
volFieldTypes.insert(volTensorField::typeName);
|
||||||
|
|
||||||
// the lagrangian field types that we handle
|
// The lagrangian field types that we handle
|
||||||
wordHashSet cloudFieldTypes;
|
wordHashSet cloudFieldTypes;
|
||||||
cloudFieldTypes.insert(scalarIOField::typeName);
|
cloudFieldTypes.insert(scalarIOField::typeName);
|
||||||
cloudFieldTypes.insert(vectorIOField::typeName);
|
cloudFieldTypes.insert(vectorIOField::typeName);
|
||||||
@ -145,30 +157,32 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
// get times list
|
// Get times list
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
// default to binary output, unless otherwise specified
|
// Default to binary output, unless otherwise specified
|
||||||
IOstream::streamFormat format = IOstream::BINARY;
|
const IOstream::streamFormat format =
|
||||||
if (args.optionFound("ascii"))
|
(
|
||||||
{
|
args.optionFound("ascii")
|
||||||
format = IOstream::ASCII;
|
? IOstream::ASCII
|
||||||
}
|
: IOstream::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
// control for renumbering iterations
|
// Control for renumbering iterations
|
||||||
label indexingNumber = 0;
|
label indexingNumber = 0;
|
||||||
bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||||
|
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||||
|
|
||||||
// always write the geometry, unless the -noMesh option is specified
|
// Always write the geometry, unless the -noMesh option is specified
|
||||||
bool optNoMesh = args.optionFound("noMesh");
|
bool optNoMesh = args.optionFound("noMesh");
|
||||||
|
|
||||||
// adjust output width
|
// Adjust output width
|
||||||
if (args.optionFound("width"))
|
if (args.optionFound("width"))
|
||||||
{
|
{
|
||||||
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// define sub-directory name to use for Ensight data
|
// Define sub-directory name to use for Ensight data
|
||||||
fileName ensightDir = "Ensight";
|
fileName ensightDir = "Ensight";
|
||||||
args.optionReadIfPresent("name", ensightDir);
|
args.optionReadIfPresent("name", ensightDir);
|
||||||
|
|
||||||
@ -190,7 +204,7 @@ int main(int argc, char *argv[])
|
|||||||
<< " " << ensightDir << endl;
|
<< " " << ensightDir << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// as per mkdir -p "Ensight/data"
|
// As per mkdir -p "Ensight/data"
|
||||||
mkDir(ensightDir);
|
mkDir(ensightDir);
|
||||||
mkDir(dataDir);
|
mkDir(dataDir);
|
||||||
|
|
||||||
@ -204,10 +218,15 @@ int main(int argc, char *argv[])
|
|||||||
regionPrefix = regionName;
|
regionPrefix = regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
Info<< "Converting " << timeDirs.size() << " time steps" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the list of ensight parts for the entire mesh
|
// Construct the list of ensight parts for the entire mesh
|
||||||
ensightParts partsList(mesh);
|
ensightParts partsList(mesh);
|
||||||
|
|
||||||
// write summary information
|
// Write summary information
|
||||||
{
|
{
|
||||||
OFstream partsInfoFile(ensightDir/"partsInfo");
|
OFstream partsInfoFile(ensightDir/"partsInfo");
|
||||||
|
|
||||||
@ -226,7 +245,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// map times used
|
// Map times used
|
||||||
Map<scalar> timeIndices;
|
Map<scalar> timeIndices;
|
||||||
|
|
||||||
// TODO: Track the time indices used by the geometry
|
// TODO: Track the time indices used by the geometry
|
||||||
@ -244,6 +263,9 @@ int main(int argc, char *argv[])
|
|||||||
cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
|
cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< "Startup in "
|
||||||
|
<< timer.cpuTimeIncrement() << " s, "
|
||||||
|
<< mem.update().size() << " kB" << nl << endl;
|
||||||
|
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
@ -251,15 +273,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "getTimeIndex.H"
|
#include "getTimeIndex.H"
|
||||||
|
|
||||||
// remember the time index for the volume fields
|
// Remember the time index for the volume fields
|
||||||
fieldTimesUsed.append(timeIndex);
|
fieldTimesUsed.append(timeIndex);
|
||||||
|
|
||||||
// the data/ITER subdirectory must exist
|
// The data/ITER subdirectory must exist
|
||||||
// Note that data/ITER is indeed a valid ensight::FileName
|
// Note that data/ITER is indeed a valid ensight::FileName
|
||||||
const fileName subDir = ensightFile::subDir(timeIndex);
|
const fileName subDir = ensightFile::subDir(timeIndex);
|
||||||
mkDir(dataDir/subDir);
|
mkDir(dataDir/subDir);
|
||||||
|
|
||||||
// place a timestamp in the directory for future reference
|
// Place a timestamp in the directory for future reference
|
||||||
{
|
{
|
||||||
OFstream timeStamp(dataDir/subDir/"time");
|
OFstream timeStamp(dataDir/subDir/"time");
|
||||||
timeStamp
|
timeStamp
|
||||||
@ -280,7 +302,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (hasMovingMesh)
|
if (hasMovingMesh)
|
||||||
{
|
{
|
||||||
// remember the time index for the geometry
|
// Remember the time index for the geometry
|
||||||
geometryTimesUsed.append(timeIndex);
|
geometryTimesUsed.append(timeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +316,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "write volume field (" << flush;
|
Info<< "Write volume field (" << flush;
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
||||||
{
|
{
|
||||||
@ -376,19 +398,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
Info<< " )" << endl;
|
Info<< " )" << endl;
|
||||||
|
|
||||||
// check for clouds
|
// Check for clouds
|
||||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||||
{
|
{
|
||||||
const word& cloudName = cloudIter.key();
|
const word& cloudName = cloudIter.key();
|
||||||
|
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||||
|
|
||||||
if
|
if (!isDir(runTime.timePath()/cloudPrefix/cloudName))
|
||||||
(
|
|
||||||
!isDir
|
|
||||||
(
|
|
||||||
runTime.timePath()/regionPrefix/
|
|
||||||
cloud::prefix/cloudName
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -397,13 +413,17 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
cloud::prefix/cloudName
|
cloudPrefix/cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
// check that the positions field is present for this time
|
// Check that the positions field is present for this time
|
||||||
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
|
if (!cloudObjs.found("positions"))
|
||||||
if (positionPtr != nullptr)
|
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Write " << cloudName << " ( positions" << flush;
|
||||||
|
|
||||||
ensightParticlePositions
|
ensightParticlePositions
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
@ -412,13 +432,6 @@ int main(int argc, char *argv[])
|
|||||||
cloudName,
|
cloudName,
|
||||||
format
|
format
|
||||||
);
|
);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "write " << cloudName << " (" << flush;
|
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
||||||
{
|
{
|
||||||
@ -430,7 +443,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!fieldObject)
|
if (!fieldObject)
|
||||||
{
|
{
|
||||||
Info<< "missing "
|
Info<< "missing "
|
||||||
<< runTime.timeName()/cloud::prefix/cloudName
|
<< runTime.timeName()/cloudPrefix/cloudName
|
||||||
/ fieldName
|
/ fieldName
|
||||||
<< endl;
|
<< endl;
|
||||||
continue;
|
continue;
|
||||||
@ -476,7 +489,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< " )" << endl;
|
Info<< " )" << endl;
|
||||||
|
|
||||||
// remember the time index
|
// Remember the time index
|
||||||
cloudTimesUsed[cloudName].append(timeIndex);
|
cloudTimesUsed[cloudName].append(timeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,5 +39,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeIndices.insert(timeIndex, timeDirs[timeI].value());
|
timeIndices.insert(timeIndex, timeDirs[timeI].value());
|
||||||
Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;
|
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ for (label i=0; i < nTypes; i++)
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Cloud<passiveParticle> particles(mesh);
|
Cloud<passiveParticle> particles(mesh, cloud::defaultName);
|
||||||
|
|
||||||
IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
|
IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,71 @@
|
|||||||
|
// check all time directories for the following:
|
||||||
|
|
||||||
|
// Any cloud names:
|
||||||
|
HashSet<fileName> allCloudDirs;
|
||||||
|
|
||||||
|
if (timeDirs.size() && !noLagrangian)
|
||||||
|
{
|
||||||
|
const fileName& baseDir = mesh.time().path();
|
||||||
|
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||||
|
|
||||||
|
Info<< "Searching for lagrangian ... " << flush;
|
||||||
|
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
|
{
|
||||||
|
const word& timeName = timeDirs[timeI].name();
|
||||||
|
|
||||||
|
// DO NOT USE -->> runTime.setTime(timeDirs[timeI], timeI); <<--
|
||||||
|
// It incurs a large overhead when done so frequently.
|
||||||
|
|
||||||
|
fileNameList cloudDirs = readDir
|
||||||
|
(
|
||||||
|
baseDir/timeName/cloudPrefix,
|
||||||
|
fileName::DIRECTORY
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(cloudDirs, cloudI)
|
||||||
|
{
|
||||||
|
const word& cloudName = cloudDirs[cloudI];
|
||||||
|
|
||||||
|
IOobjectList cloudObjs
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
timeName,
|
||||||
|
cloudPrefix/cloudName
|
||||||
|
);
|
||||||
|
|
||||||
|
// clouds always require "positions"
|
||||||
|
if (cloudObjs.found("positions"))
|
||||||
|
{
|
||||||
|
if (allCloudDirs.insert(cloudName))
|
||||||
|
{
|
||||||
|
Info<< "At time: " << timeName
|
||||||
|
<< " detected cloud directory : " << cloudName
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allCloudDirs.empty())
|
||||||
|
{
|
||||||
|
Info<< "none detected." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sorted list of cloud names
|
||||||
|
const fileNameList cloudNames(allCloudDirs.sortedToc());
|
||||||
|
|
||||||
|
if (cloudNames.size())
|
||||||
|
{
|
||||||
|
// complete the echo information
|
||||||
|
Info<< "(";
|
||||||
|
forAll(cloudNames, cloudNo)
|
||||||
|
{
|
||||||
|
Info<< ' ' << cloudNames[cloudNo];
|
||||||
|
}
|
||||||
|
Info<< " ) " << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -72,6 +72,9 @@ Usage
|
|||||||
- \par -noInternal
|
- \par -noInternal
|
||||||
Do not generate file for mesh, only for patches
|
Do not generate file for mesh, only for patches
|
||||||
|
|
||||||
|
- \par -noLagrangian
|
||||||
|
Suppress writing lagrangian positions and fields.
|
||||||
|
|
||||||
- \par -noPointValues
|
- \par -noPointValues
|
||||||
No pointFields
|
No pointFields
|
||||||
|
|
||||||
@ -291,6 +294,12 @@ int main(int argc, char *argv[])
|
|||||||
"noInternal",
|
"noInternal",
|
||||||
"do not generate file for mesh, only for patches"
|
"do not generate file for mesh, only for patches"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"noLagrangian",
|
||||||
|
"suppress writing lagrangian positions and fields"
|
||||||
|
);
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noPointValues",
|
"noPointValues",
|
||||||
@ -337,6 +346,7 @@ int main(int argc, char *argv[])
|
|||||||
const bool doLinks = !args.optionFound("noLinks");
|
const bool doLinks = !args.optionFound("noLinks");
|
||||||
bool binary = !args.optionFound("ascii");
|
bool binary = !args.optionFound("ascii");
|
||||||
const bool useTimeName = args.optionFound("useTimeName");
|
const bool useTimeName = args.optionFound("useTimeName");
|
||||||
|
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||||
|
|
||||||
// Decomposition of polyhedral cells into tets/pyramids cells
|
// Decomposition of polyhedral cells into tets/pyramids cells
|
||||||
vtkTopo::decomposePoly = !args.optionFound("poly");
|
vtkTopo::decomposePoly = !args.optionFound("poly");
|
||||||
@ -409,8 +419,7 @@ int main(int argc, char *argv[])
|
|||||||
fileName fvPath(runTime.path()/"VTK");
|
fileName fvPath(runTime.path()/"VTK");
|
||||||
|
|
||||||
// Directory of mesh (region0 gets filtered out)
|
// Directory of mesh (region0 gets filtered out)
|
||||||
fileName regionPrefix = "";
|
fileName regionPrefix;
|
||||||
|
|
||||||
if (regionName != polyMesh::defaultRegion)
|
if (regionName != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
fvPath = fvPath/regionName;
|
fvPath = fvPath/regionName;
|
||||||
@ -448,43 +457,7 @@ int main(int argc, char *argv[])
|
|||||||
<< timer.cpuTimeIncrement() << " s, "
|
<< timer.cpuTimeIncrement() << " s, "
|
||||||
<< mem.update().size() << " kB" << endl;
|
<< mem.update().size() << " kB" << endl;
|
||||||
|
|
||||||
|
#include "findClouds.H"
|
||||||
// Scan for all possible lagrangian clouds
|
|
||||||
HashSet<fileName> allCloudDirs;
|
|
||||||
forAll(timeDirs, timeI)
|
|
||||||
{
|
|
||||||
runTime.setTime(timeDirs[timeI], timeI);
|
|
||||||
fileNameList cloudDirs
|
|
||||||
(
|
|
||||||
readDir
|
|
||||||
(
|
|
||||||
runTime.timePath()/regionPrefix/cloud::prefix,
|
|
||||||
fileName::DIRECTORY
|
|
||||||
)
|
|
||||||
);
|
|
||||||
forAll(cloudDirs, i)
|
|
||||||
{
|
|
||||||
IOobjectList sprayObjs
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
runTime.timeName(),
|
|
||||||
cloud::prefix/cloudDirs[i]
|
|
||||||
);
|
|
||||||
|
|
||||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
|
||||||
|
|
||||||
if (positionsPtr)
|
|
||||||
{
|
|
||||||
if (allCloudDirs.insert(cloudDirs[i]))
|
|
||||||
{
|
|
||||||
Info<< "At time: " << runTime.timeName()
|
|
||||||
<< " detected cloud directory : " << cloudDirs[i]
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
@ -492,7 +465,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Time: " << runTime.timeName() << endl;
|
Info<< "Time: " << runTime.timeName() << endl;
|
||||||
|
|
||||||
word timeDesc =
|
const word timeDesc =
|
||||||
useTimeName ? runTime.timeName() : Foam::name(runTime.timeIndex());
|
useTimeName ? runTime.timeName() : Foam::name(runTime.timeIndex());
|
||||||
|
|
||||||
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell
|
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell
|
||||||
@ -664,7 +637,7 @@ int main(int argc, char *argv[])
|
|||||||
+ dtf.size();
|
+ dtf.size();
|
||||||
|
|
||||||
|
|
||||||
// Construct pointMesh only if nessecary since constructs edge
|
// Construct pointMesh only if necessary since constructs edge
|
||||||
// addressing (expensive on polyhedral meshes)
|
// addressing (expensive on polyhedral meshes)
|
||||||
if (noPointValues)
|
if (noPointValues)
|
||||||
{
|
{
|
||||||
@ -1152,9 +1125,9 @@ int main(int argc, char *argv[])
|
|||||||
//
|
//
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
forAllConstIter(HashSet<fileName>, allCloudDirs, iter)
|
forAll(cloudNames, cloudNo)
|
||||||
{
|
{
|
||||||
const fileName& cloudName = iter.key();
|
const fileName& cloudName = cloudNames[cloudNo];
|
||||||
|
|
||||||
// Always create the cloud directory.
|
// Always create the cloud directory.
|
||||||
mkDir(fvPath/cloud::prefix/cloudName);
|
mkDir(fvPath/cloud::prefix/cloudName);
|
||||||
@ -1175,9 +1148,7 @@ int main(int argc, char *argv[])
|
|||||||
cloud::prefix/cloudName
|
cloud::prefix/cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
if (sprayObjs.found("positions"))
|
||||||
|
|
||||||
if (positionsPtr)
|
|
||||||
{
|
{
|
||||||
wordList labelNames(sprayObjs.names(labelIOField::typeName));
|
wordList labelNames(sprayObjs.names(labelIOField::typeName));
|
||||||
Info<< " labels :";
|
Info<< " labels :";
|
||||||
|
|||||||
@ -41,31 +41,25 @@ canBuildPlugin()
|
|||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
# major version as per paraview include directory:
|
||||||
|
# Eg, "PREFIX/include/paraview-3.4" -> "3.4"
|
||||||
|
major="${ParaView_INCLUDE_DIR##*-}"
|
||||||
|
|
||||||
case "$ParaView_VERSION" in
|
case "$major" in
|
||||||
3*)
|
3.[0-9]*)
|
||||||
if canBuildPlugin
|
if canBuildPlugin
|
||||||
then
|
then
|
||||||
[ -n "$PV_PLUGIN_PATH" ] || {
|
(
|
||||||
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure CMake gets the correct C/C++ compilers
|
|
||||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
||||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
||||||
|
|
||||||
wmake $targetType vtkPV3Readers
|
wmake $targetType vtkPV3Readers
|
||||||
PV3blockMeshReader/Allwmake $targetType $*
|
PV3blockMeshReader/Allwmake $*
|
||||||
PV3FoamReader/Allwmake $targetType $*
|
PV3FoamReader/Allwmake $*
|
||||||
else
|
)
|
||||||
echo "ERROR: ParaView not found in $ParaView_DIR"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo
|
echo
|
||||||
echo "NOTE: skipping build of ParaView V3 plugin(s)"
|
echo "NOTE: skipping build of ParaView V3 plugin(s)"
|
||||||
echo " different version: ParaView_VERSION=$ParaView_VERSION"
|
echo " include directory was for paraview major version '${major:-none}'"
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@ -42,37 +42,31 @@ canBuildPlugin()
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
case "$ParaView_VERSION" in
|
# major version as per paraview include directory:
|
||||||
4* | 5*)
|
# Eg, "PREFIX/include/paraview-5.0" -> "5.0"
|
||||||
|
major="${ParaView_INCLUDE_DIR##*-}"
|
||||||
|
|
||||||
|
case "$major" in
|
||||||
|
[45].[0-9]*)
|
||||||
if canBuildPlugin
|
if canBuildPlugin
|
||||||
then
|
then
|
||||||
[ -n "$PV_PLUGIN_PATH" ] || {
|
(
|
||||||
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# ensure CMake gets the correct C/C++ compilers
|
|
||||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
||||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
||||||
|
|
||||||
wmake $targetType vtkPVReaders
|
wmake $targetType vtkPVReaders
|
||||||
PVblockMeshReader/Allwmake $targetType $*
|
PVblockMeshReader/Allwmake $*
|
||||||
PVFoamReader/Allwmake $targetType $*
|
PVFoamReader/Allwmake $*
|
||||||
|
|
||||||
# Dummy directory to trigger proper 'wclean all' behaviour
|
# Dummy directory to trigger proper 'wclean all' behaviour
|
||||||
# - the Allwclean will otherwise not be used
|
# - the Allwclean will otherwise not be used
|
||||||
mkdir -p Make
|
mkdir -p Make
|
||||||
else
|
)
|
||||||
echo "ERROR: ParaView not found in $ParaView_DIR"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo
|
echo
|
||||||
echo "NOTE: skipping build of ParaView plugin(s)"
|
echo "NOTE: skipping build of ParaView plugin(s)"
|
||||||
echo " different version: ParaView_VERSION=$ParaView_VERSION"
|
echo " include directory was for paraview major version '${major:-none}'"
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -73,7 +73,7 @@ int USERD_get_maxsize_info
|
|||||||
{
|
{
|
||||||
// Get the maximum number of spray parcels
|
// Get the maximum number of spray parcels
|
||||||
// and store it
|
// and store it
|
||||||
Cloud<passiveParticle> lagrangian(*meshPtr);
|
Cloud<passiveParticle> lagrangian(*meshPtr, cloud::defaultName);
|
||||||
|
|
||||||
if (lagrangian.size() > nMaxParcels)
|
if (lagrangian.size() > nMaxParcels)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -151,7 +151,7 @@ int USERD_set_filenames
|
|||||||
{
|
{
|
||||||
runTime.setTime(timeDirs[n+1], n+1);
|
runTime.setTime(timeDirs[n+1], n+1);
|
||||||
|
|
||||||
Cloud<passiveParticle> lagrangian(*meshPtr);
|
Cloud<passiveParticle> lagrangian(*meshPtr, cloud::defaultName);
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
if (lagrangian.size())
|
if (lagrangian.size())
|
||||||
@ -177,7 +177,7 @@ int USERD_set_filenames
|
|||||||
|
|
||||||
delete sprayPtr;
|
delete sprayPtr;
|
||||||
|
|
||||||
sprayPtr = new Cloud<passiveParticle>(*meshPtr);
|
sprayPtr = new Cloud<passiveParticle>(*meshPtr, cloud::defaultName);
|
||||||
|
|
||||||
IOobjectList objects(*meshPtr, runTime.timeName(), cloud::prefix);
|
IOobjectList objects(*meshPtr, runTime.timeName(), cloud::prefix);
|
||||||
|
|
||||||
|
|||||||
@ -49,9 +49,7 @@ void USERD_set_time_set_and_step
|
|||||||
if (Numparts_available > nPatches+1)
|
if (Numparts_available > nPatches+1)
|
||||||
{
|
{
|
||||||
delete sprayPtr;
|
delete sprayPtr;
|
||||||
sprayPtr = new Cloud<passiveParticle>(*meshPtr);
|
sprayPtr = new Cloud<passiveParticle>(*meshPtr, cloud::defaultName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,17 @@
|
|||||||
Info<< "\nCreate databases as time" << endl;
|
Info<< "\nCreate databases as time" << endl;
|
||||||
|
|
||||||
|
const auto caseDirOrig = getEnv("FOAM_CASE");
|
||||||
|
const auto caseNameOrig = getEnv("FOAM_CASE_NAME");
|
||||||
|
setEnv("FOAM_CASE", rootDirSource/caseDirSource, true);
|
||||||
|
setEnv("FOAM_CASE_NAME", caseDirSource, true);
|
||||||
Time runTimeSource
|
Time runTimeSource
|
||||||
(
|
(
|
||||||
Time::controlDictName,
|
Time::controlDictName,
|
||||||
rootDirSource,
|
rootDirSource,
|
||||||
caseDirSource
|
caseDirSource
|
||||||
);
|
);
|
||||||
|
setEnv("FOAM_CASE", caseDirOrig, true);
|
||||||
|
setEnv("FOAM_CASE_NAME", caseNameOrig, true);
|
||||||
|
|
||||||
Time runTimeTarget
|
Time runTimeTarget
|
||||||
(
|
(
|
||||||
|
|||||||
@ -292,8 +292,8 @@ int main(int argc, char *argv[])
|
|||||||
fileName rootDirTarget(args.rootPath());
|
fileName rootDirTarget(args.rootPath());
|
||||||
fileName caseDirTarget(args.globalCaseName());
|
fileName caseDirTarget(args.globalCaseName());
|
||||||
|
|
||||||
const fileName casePath = args[1];
|
fileName casePath = args[1];
|
||||||
const fileName rootDirSource = casePath.path();
|
const fileName rootDirSource = casePath.path().toAbsolute();
|
||||||
const fileName caseDirSource = casePath.name();
|
const fileName caseDirSource = casePath.name();
|
||||||
|
|
||||||
Info<< "Source: " << rootDirSource << " " << caseDirSource << endl;
|
Info<< "Source: " << rootDirSource << " " << caseDirSource << endl;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user