From 6ecdf4fc4150b31b906e82d3b5f53f095dc7f989 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 9 Mar 2009 15:37:54 +0100 Subject: [PATCH] updated DebugSwitches, surfaceWriter - added obj surfaceWriter - don't bother with prepended field names on obj and stl surfaceWriter. It fills the disk and suggests differences where there are none. --- .../foamDebugSwitches/foamDebugSwitches.C | 111 +++++++++++- .../postProcessing/sampling/sample/sample.C | 1 + .../postProcessing/sampling/sample/sampleDict | 1 + etc/controlDict | 162 ++++++++++++------ src/sampling/Make/files | 1 + .../writers/obj/objSurfaceWriter.C | 120 +++++++++++++ .../writers/obj/objSurfaceWriter.H | 105 ++++++++++++ .../writers/obj/objSurfaceWriterRunTime.C | 44 +++++ .../writers/stl/stlSurfaceWriter.C | 2 +- .../LadenburgJet60psi/system/sampleDict | 28 ++- .../biconic25-55Run35/system/sampleDict | 28 ++- .../shockTube/system/sampleDict | 14 +- .../rhoSonicFoam/shockTube/system/sampleDict | 14 +- .../laminar/shockTube/system/sampleDict | 14 +- .../mhdFoam/hartmann/system/sampleDict | 14 +- .../plateHole/system/sampleDict | 14 +- 16 files changed, 601 insertions(+), 72 deletions(-) create mode 100644 src/sampling/sampledSurface/writers/obj/objSurfaceWriter.C create mode 100644 src/sampling/sampledSurface/writers/obj/objSurfaceWriter.H create mode 100644 src/sampling/sampledSurface/writers/obj/objSurfaceWriterRunTime.C diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C index a910b32057..6854ba0b8d 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C +++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C @@ -29,6 +29,9 @@ Description #include "argList.H" #include "dictionary.H" +#include "IFstream.H" +#include "IOobject.H" +#include "HashSet.H" using namespace Foam; @@ -38,18 +41,108 @@ using namespace Foam; int main(int argc, char *argv[]) { argList::noParallel(); + argList::validOptions.insert("new", ""); + argList::validOptions.insert("old", ""); - wordList ds(debug::debugSwitches().toc()); - sort(ds); - Info<< "debug switches: " << ds << endl; + Foam::argList args(argc, argv); + + wordList currDebug(debug::debugSwitches().toc()); + wordList currInfo(debug::infoSwitches().toc()); + wordList currOpt(debug::optimisationSwitches().toc()); + + if (args.options().found("old") || args.options().found("new")) + { + dictionary controlDict(IFstream(findEtcFile("controlDict", true))()); + + wordHashSet oldDebug + ( + controlDict.subDict("DebugSwitches").toc() + ); + + wordHashSet oldInfo + ( + controlDict.subDict("InfoSwitches").toc() + ); + + wordHashSet oldOpt + ( + controlDict.subDict("OptimisationSwitches").toc() + ); + + + wordHashSet hashset; + wordList listing; + + + // list old switches - but this can't work since the (old) inserted + // switches are in both sets + // Workaround: + // 1. run without any options (get complete list) + // 2. comment out DebugSwitches, run again with -new to find new ones + // and do a diff + if (args.options().found("old")) + { + IOobject::writeDivider(Info); + + hashset = oldDebug; + hashset -= currDebug; + listing = hashset.toc(); + sort(listing); + Info<< "old DebugSwitches: " << listing << endl; + + hashset = oldInfo; + hashset -= currInfo; + listing = hashset.toc(); + sort(listing); + Info<< "old InfoSwitches: " << listing << endl; + + hashset = oldOpt; + hashset -= currOpt; + listing = hashset.toc(); + sort(listing); + Info<< "old OptimisationSwitches: " << listing << endl; + } + + // list new switches + if (args.options().found("new")) + { + IOobject::writeDivider(Info); + + hashset = currDebug; + hashset -= oldDebug; + + listing = hashset.toc(); + sort(listing); + Info<< "new DebugSwitches: " << listing << endl; + + hashset = currInfo; + hashset -= oldInfo; + listing = hashset.toc(); + sort(listing); + Info<< "new InfoSwitches: " << listing << endl; + + hashset = currOpt; + hashset -= oldOpt; + listing = hashset.toc(); + sort(listing); + Info<< "new OptimisationSwitches: " << listing << endl; + } + } + else + { + IOobject::writeDivider(Info); + + sort(currDebug); + Info<< "DebugSwitches: " << currDebug << endl; + + sort(currInfo); + Info<< "InfoSwitches: " << currInfo << endl; + + sort(currOpt); + Info<< "OptimisationSwitches: " << currOpt << endl; + } - wordList is(debug::infoSwitches().toc()); - sort(is); - Info<< "info switches: " << is << endl; - wordList os(debug::optimisationSwitches().toc()); - sort(os); - Info<< "optimisation switches: " << os << endl; Info<< "done" << endl; diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C index 2735ed2dff..2451522ffe 100644 --- a/applications/utilities/postProcessing/sampling/sample/sample.C +++ b/applications/utilities/postProcessing/sampling/sample/sample.C @@ -40,6 +40,7 @@ Description - dx : DX scalar or vector format - vtk : VTK ascii format - raw : x y z value format for use with e.g. gnuplot 'splot'. + - obj : Wavefron stl. Does not contain values! - stl : ascii stl. Does not contain values! @param interpolationScheme : interpolation scheme, choice of \n diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 215add79a7..cf02cac67e 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -30,6 +30,7 @@ setFormat raw; // dx : DX scalar or vector format // vtk : VTK ascii format // raw : x y z value format for use with e.g. gnuplot 'splot'. +// obj : Wavefront obj. Does not contain values! // stl : ascii stl. Does not contain values! surfaceFormat vtk; diff --git a/etc/controlDict b/etc/controlDict index b58b605b3c..5cbe331fe5 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -34,6 +34,7 @@ Documentation DebugSwitches { + Analytical 0; APIdiffCoefFunc 0; Ar 0; BICCG 0; @@ -57,18 +58,25 @@ DebugSwitches C8H18 0; C9H20 0; CH3OH 0; - CallbackRegistry 0; + CH4N2O 0; CarnahanStarling 0; + CallbackRegistry 0; + CentredFitData 0; + CentredFitData 0; + CentredFitData 0; + CentredFitData 0; ChomiakInjector 0; + Cloud 0; + Cloud 0; + Cloud 0; Cloud 0; - Cloud 0; Cloud 0; Cloud 0; - Cloud 0; - Cloud 0; Cloud 0; CoEuler 0; CompositionModel 0; + ConeInjection 0; + Constant 0; ConstantRateDevolatilisation 0; CrankNicholson 0; CrossPowerLaw 0; @@ -77,6 +85,7 @@ DebugSwitches DICGaussSeidel 0; DILU 0; DILUGaussSeidel 0; + DataEntry 0; DeardorffDiffStress 0; DispersionModel 0; DispersionRASModel 0; @@ -107,39 +116,40 @@ DebugSwitches H2O 0; HashTable 0; HeatTransferModel 0; + HerschelBulkley 0; HrenyaSinclair 0; IC8H18 0; ICCG 0; + IDDESDelta 0; IDEA 0; IFstream 0; + IOMap 0; IOPtrList 0; IOPtrList 0; IOPtrList 0; IOPtrList 0; IOobject 0; InjectionModel 0; + IntegrationScheme 0; JohnsonJackson 0; KRR4 0; - KinematicCloud 0; - KinematicCloud 0; - KinematicCloud 0; - KinematicParcel 0; - KinematicParcel 0; + KinematicCloud 0; + KinematicCloud 0; + KinematicCloud 0; + KinematicParcel 0; + KinematicParcel 0; + LESModel 0; LESdelta 0; LESfilter 0; - LESmodel 0; LISA 0; LRR 0; LRRDiffStress 0; LamBremhorstKE 0; LaunderGibsonRSTM 0; LaunderSharmaKE 0; - LduMatrix 1; LienCubicKE 0; LienCubicKELowRe 0; LienLeschzinerLowRe 0; - Lun 0; - LunSavage 0; MB 0; MC 0; MCV 0; @@ -191,11 +201,12 @@ DebugSwitches QUICK 0; QUICKV 0; QZeta 0; + RASModel 0; RK 0; RNGkEpsilon 0; RanzMarshall 0; - ReactingCloud 0; - ReactingParcel 0; + ReactingCloud 0; + ReactingParcel 0; Rebound 0; ReitzDiwakar 0; ReitzKHRT 0; @@ -208,6 +219,8 @@ DebugSwitches SIBS 0; SKA 0; SLTS 0; + SRFModel 0; + SRFVelocity 0; STARCDRotation 0; Schaeffer 0; SchillerNaumann 0; @@ -215,8 +228,9 @@ DebugSwitches SingleKineticRateDevolatilisation 0; SingleMixtureFraction 0; Smagorinsky 0; - SmoothSolver 0; SpalartAllmaras 0; + SpalartAllmarasDDES 0; + SpalartAllmarasIDDES 0; SphereDrag 0; StandardWallInteraction 0; StaticHashTable 0; @@ -228,13 +242,17 @@ DebugSwitches SyamlalOBrien 0; SyamlalRogersOBrien 0; TAB 0; - ThermoCloud 0; - ThermoCloud 0; - ThermoParcel 0; - ThermoParcel 0; + Table 0; + ThermoCloud 0; + ThermoCloud 0; + ThermoParcel 0; + ThermoParcel 0; UMIST 0; UMISTV 0; Unix 0; + UpwindFitData 0; + UpwindFitData 0; + UpwindFitData 0; WallInteractionModel 0; WenYu 0; aC11H10 0; @@ -245,6 +263,9 @@ DebugSwitches addPoint 0; advective 0; algebraicPair 0; + alphaContactAngle 0; + alphaFixedPressure 0; + alphatWallFunction 0; angularOscillatingDisplacement 0; angularOscillatingVelocity 0; anisotropic 0; @@ -252,14 +273,21 @@ DebugSwitches atomizationModel 0; attachDetach 0; autoHexMeshDriver 0; + autoLayerDriver 0; + autoRefineDriver 0; + autoSnapDriver 0; bC11H10 0; backward 0; basePatch 0; basicKinematicCloud 0; + basicKinematicParcel 0; basicMixture 0; basicReactingCloud 0; + basicReactingParcel 0; basicThermo 0; basicThermoCloud 0; + basicThermoParcel 0; + biLinearFit 0; binaryAbsorptionEmission 0; blended 0; blobsSheetAtomization 0; @@ -274,7 +302,6 @@ DebugSwitches boxToPoint 0; breakupModel 0; calculated 0; - cartesian 0; cell 0; cellClassification 0; cellCuts 0; @@ -292,6 +319,8 @@ DebugSwitches cellToFace 0; cellToPoint 0; cellZone 0; + centredCECStencil 0; + centredCFCStencil 0; chemistryReader 0; chemistrySolver 0; chemkinReader 0; @@ -304,24 +333,25 @@ DebugSwitches commSchedule 0; commonRailInjector 0; compound 0; - conductivityModel 0; constInjector 0; constant 0; constantAbsorptionEmission 0; - constantGammaContactAngle 0; + constantAlphaContactAngle 0; constantScatter 0; coordinateRotation 0; coordinateSystem 0; + coordinateSystems 0; corrected 0; coupled 0; cubeRootVol 0; cubic 0; + cubicUpwindFit 0; curve 0; cyclic 0; cyclicLduInterface 0; cyclicLduInterfaceField 0; + cylinderToCell 0; cylindrical 0; - dataSchedule 0; decompositionMethod 0; definedHollowConeInjector 0; definedInjector 0; @@ -332,6 +362,7 @@ DebugSwitches dimensionSet 1; directMapped 0; directMappedPatch 0; + directMappedVelocityFlux 0; directionMixed 0; directional 0; disallowDefaultFvsPatchField 0; @@ -345,6 +376,7 @@ DebugSwitches displacementInterpolation 0; displacementLaplacian 0; displacementSBRStress 0; + distanceSurface 0; downwind 0; dragModel 0; duplicatePoints 0; @@ -352,8 +384,8 @@ DebugSwitches dynMixedSmagorinsky 0; dynOneEqEddy 0; dynSmagorinsky 0; + dynamicAlphaContactAngle 0; dynamicFvMesh 0; - dynamicGammaContactAngle 0; dynamicInkJetFvMesh 0; dynamicMotionSolverFvMesh 0; dynamicRefineFvMesh 0; @@ -363,6 +395,7 @@ DebugSwitches empty 0; engineMesh 0; enrichedPatch 0; + epsilonWallFunction 0; errorDrivenRefinement 0; evaporationModel 0; exponential 0; @@ -387,13 +420,20 @@ DebugSwitches filteredLinear 0; filteredLinear2 0; filteredLinear2V 0; + filteredLinear3 0; + filteredLinear3V 0; fixedEnthalpy 0; fixedFluxBuoyantPressure 0; + fixedFluxBoussinesqBuoyantPressure 0; fixedFluxPressure 0; fixedGradient 0; + fixedInternalEnergy 0; + fixedInternalValue 0; fixedNormalSlip 0; + fixedPressureCompressibleDensity 0; fixedUnburntEnthalpy 0; fixedValue 0; + flowRateInletVelocity 0; fluxCorrectedVelocity 0; foamChemistryReader 0; foamFile 0; @@ -416,8 +456,6 @@ DebugSwitches fvTensorMatrix 0; fvVectorMatrix 0; fvsPatchField 0; - gammaContactAngle 0; - gammaFixedPressure 0; general 0; generic 0; genericPatch 0; @@ -429,6 +467,7 @@ DebugSwitches gnuplot 0; gradientDispersionRAS 0; gradientEnthalpy 0; + gradientInternalEnergy 0; gradientUnburntEnthalpy 0; granularPressureModel 0; hCombustionThermo 0; @@ -459,25 +498,29 @@ DebugSwitches hhuMixtureThermo>>>> 0; hierarchical 0; hollowConeInjector 0; + iC3H8O 0; indexedOctree 0; indexedParticle 0; injectorModel 0; injectorType 0; inletOutlet 0; inletOutletTotalTemperature 0; - inputMode 0; interfaceCompression 0; intersectedSurface 0; inverseDistance 0; inverseFaceDistance 0; inversePointDistance 0; inverseVolume 0; + isoSurface 0; + isoSurfaceCell 0; jplot 0; jumpCyclic 0; kEpsilon 0; + kOmega 0; kOmegaSST 0; + kOmegaSSTSAS 0; + kQRWallFunction 0; kinematicCloud 0; - kinematicParcel 0; labelField 0; labelList 0; labelListList 0; @@ -496,6 +539,7 @@ DebugSwitches leastSquares 0; leastSquaresVectors 0; level 2; + limitWith 0; limited 0; limitedCubic 0; limitedCubic01 0; @@ -510,6 +554,7 @@ DebugSwitches limitedSurfaceInterpolationScheme 0; limitedVanLeer 0; linear 0; + linearFit 0; linearUpwind 0; linearUpwindV 0; liquid 0; @@ -520,7 +565,6 @@ DebugSwitches localPointRegion 0; lowReOneEqEddy 0; manual 0; - massFlowRateInletVelocity 0; meshCutAndRemove 0; meshCutter 0; meshModifier 0; @@ -532,6 +576,7 @@ DebugSwitches midPointAndFace 0; mixed 0; mixedEnthalpy 0; + mixedInternalEnergy 0; mixedSmagorinsky 0; mixedUnburntEnthalpy 0; mixerFvMesh 0; @@ -544,22 +589,32 @@ DebugSwitches motionSolver 0; movingConeTopoFvMesh 0; movingWallVelocity 0; - muSgsWallFunction 0; + muSgsSpalartAllmarasWallFunction 0; multiDirRefinement 0; + multiHoleInjector 0; multivariateSelection 0; - mutStandardRoughWallFunction 0; + mutRoughWallFunction 0; + mutSpalartAllmarasStandardRoughWallFunction 0; + mutSpalartAllmarasStandardWallFunction 0; + mutSpalartAllmarasWallFunction 0; + mutWallFunction 0; + nC3H8O 0; nbrToCell 0; nearestToCell 0; + nearestToPoint 0; noAbsorptionEmission 0; noDragModel 0; noRadiation 0; none 0; normal 0; normalToFace 0; - nuSgsWallFunction 0; - nutStandardRoughWallFunction 0; - nutStandardWallFunction 0; + nuSgsSpalartAllmarasWallFunction 0; + nutRoughWallFunction 0; + nutSpalartAllmarasStandardRoughWallFunction 0; + nutSpalartAllmarasStandardWallFunction 0; + nutSpalartAllmarasWallFunction 0; nutWallFunction 0; + obj 0; objectRegistry 0; octree 0; octreeDataEdges 0; @@ -567,7 +622,7 @@ DebugSwitches octreeDataFaceList 0; octreeDataTriSurface 0; off 0; - offsetTriSurfaceMesh 0; + omegaWallFunction 0; oneEqEddy 0; orientedSurface 0; oscillatingDisplacement 0; @@ -609,11 +664,13 @@ DebugSwitches polyMeshInfo 0; polyTopoChange 0; polyTopoChanger 0; + powerLaw 0; pressureDirectedInletOutletVelocity 0; pressureDirectedInletVelocity 0; pressureInletOutletVelocity 0; pressureInletUniformVelocity 0; pressureInletVelocity 0; + pressureNormalInletOutletVelocity 0; pressureSwirlInjector 0; primitiveMesh 0; primitiveMeshGeometry 0; @@ -625,11 +682,13 @@ DebugSwitches pureMixture>>> 0; pureMixture>>> 0; quadratic 0; - radialModel 0; + quadraticFit 0; + quadraticLinearFit 0; + quadraticLinearUpwindFit 0; + quadraticUpwindFit 0; radiationModel 0; raw 0; reactingCloud 0; - reactingParcel 0; reaction 0; realizableKE 0; refinementHistory 0; @@ -637,6 +696,7 @@ DebugSwitches reflect 0; regIOobject 0; regionSplit 0; + regionToCell 0; remove 0; removeCell 0; removeCells 0; @@ -720,11 +780,12 @@ DebugSwitches tensorAverageField 0; tensorField 0; thermoCloud 0; - thermoParcel 0; thermophysicalFunction 0; time 0; - timeVaryingGammaContactAngle 0; + timeVaryingAlphaContactAngle 0; + timeVaryingFlowRateInletVelocity 0; timeVaryingMappedFixedValue 0; + timeVaryingTotalPressure 0; timeVaryingUniformFixedValue 0; timer 0; topoAction 0; @@ -745,17 +806,19 @@ DebugSwitches treeNode 0; triSurface 0; triSurfaceMesh 0; - triSurfaceMeshes 0; turbulenceModel 0; + turbulentHeatFluxTemperature 0; turbulentInlet 0; turbulentIntensityKineticEnergyInlet 0; turbulentMixingLengthDissipationRateInlet 0; + turbulentMixingLengthFrequencyInlet 0; uncorrected 0; undoableMeshCutter 0; uniform 0; uniformFixedValue 0; unitInjector 0; upwind 0; + upwindCFCStencil 0; value 0; vanAlbada 0; vanAlbadaV 0; @@ -817,31 +880,30 @@ DimensionedConstants // SI units //- Universal gas constant [J/(kmol K)] - R 8314.51; + R 8314.51; //- Standard pressure [Pa] - Pstd 1.0e5; + Pstd 1.0e5; //- Standard temperature [K] - Tstd 298.15; + Tstd 298.15; //- Stefan-Boltzmann constant [J/(K4 m2 s)] - sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08; - + sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08; /* USCS units //- Universal gas constant [lbm ft2/(s2 kmol R)] - R 3406.78; + R 3406.78; //- Standard pressure [lbm/(ft2)] - Pstd 2088.6; + Pstd 2088.6; //- Standard temperature [degR] - Tstd 536.67; + Tstd 536.67; //- Stefan-Boltzmann constant [lbm /(degR4 ft s)] - sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 8.2292e-08; + sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 8.2292e-08; */ } diff --git a/src/sampling/Make/files b/src/sampling/Make/files index c528032519..07b2d37be5 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -41,6 +41,7 @@ $(surfWriters)/dx/dxSurfaceWriterRunTime.C $(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C $(surfWriters)/null/nullSurfaceWriterRunTime.C $(surfWriters)/raw/rawSurfaceWriterRunTime.C +$(surfWriters)/obj/objSurfaceWriterRunTime.C $(surfWriters)/stl/stlSurfaceWriterRunTime.C $(surfWriters)/vtk/vtkSurfaceWriterRunTime.C diff --git a/src/sampling/sampledSurface/writers/obj/objSurfaceWriter.C b/src/sampling/sampledSurface/writers/obj/objSurfaceWriter.C new file mode 100644 index 0000000000..f5aaebd39f --- /dev/null +++ b/src/sampling/sampledSurface/writers/obj/objSurfaceWriter.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "objSurfaceWriter.H" +#include "fileName.H" +#include "OFstream.H" +#include "faceList.H" +#include "OSspecific.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::objSurfaceWriter::objSurfaceWriter() +: + surfaceWriter() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::objSurfaceWriter::~objSurfaceWriter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::objSurfaceWriter::write +( + const fileName& samplePath, + const fileName& timeDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const fileName& fieldName, + const Field& values, + const bool verbose +) const +{ + fileName surfaceDir(samplePath/timeDir); + + if (!isDir(surfaceDir)) + { + mkDir(surfaceDir); + } + + fileName fName(surfaceDir/surfaceName + ".obj"); + + if (verbose) + { + Info<< "Writing field " << fieldName << " to " << fName << endl; + } + + // this is a quick hack + OFstream os(fName); + + os << "# Wavefront OBJ file" << nl + << "o " << os.name().lessExt().name() << nl + << nl + << "# points : " << points.size() << nl + << "# faces : " << faces.size() << nl + << "# no zones " << nl; + + os << nl + << "# " << endl; + + // Write vertex coords + forAll(points, ptI) + { + os << "v " << points[ptI].x() + << ' ' << points[ptI].y() + << ' ' << points[ptI].z() << nl; + } + + os << "# " << nl + << nl + << "# " << endl; + + forAll(faces, i) + { + const face& f = faces[i]; + + os << 'f'; + forAll(f, fp) + { + os << ' ' << f[fp] + 1; + } + os << nl; + + } + + os << "# " << endl; +} + + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/obj/objSurfaceWriter.H b/src/sampling/sampledSurface/writers/obj/objSurfaceWriter.H new file mode 100644 index 0000000000..72af4b89f2 --- /dev/null +++ b/src/sampling/sampledSurface/writers/obj/objSurfaceWriter.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::objSurfaceWriter + +Description + +SourceFiles + objSurfaceWriter.C + +\*---------------------------------------------------------------------------*/ + +#ifndef objSurfaceWriter_H +#define objSurfaceWriter_H + +#include "surfaceWriter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class objSurfaceWriter Declaration +\*---------------------------------------------------------------------------*/ + +template +class objSurfaceWriter +: + public surfaceWriter +{ + +public: + + //- Runtime type information + TypeName("obj"); + + + // Constructors + + //- Construct null + objSurfaceWriter(); + + + // Destructor + + virtual ~objSurfaceWriter(); + + + // Member Functions + + // Write + + //- Writes single surface to file. + virtual void write + ( + const fileName& samplePath, + const fileName& timeDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const fileName& fieldName, + const Field& values, + const bool verbose = false + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "objSurfaceWriter.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/obj/objSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/obj/objSurfaceWriterRunTime.C new file mode 100644 index 0000000000..6eefc30024 --- /dev/null +++ b/src/sampling/sampledSurface/writers/obj/objSurfaceWriterRunTime.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "objSurfaceWriter.H" +#include "surfaceWriters.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeSurfaceWriters(objSurfaceWriter); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/stl/stlSurfaceWriter.C b/src/sampling/sampledSurface/writers/stl/stlSurfaceWriter.C index c3ef53df85..ef109072da 100644 --- a/src/sampling/sampledSurface/writers/stl/stlSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/stl/stlSurfaceWriter.C @@ -69,7 +69,7 @@ void Foam::stlSurfaceWriter::write mkDir(surfaceDir); } - fileName fName(surfaceDir/fieldName + '_' + surfaceName + ".stl"); + fileName fName(surfaceDir/surfaceName + ".stl"); if (verbose) { diff --git a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/system/sampleDict b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/system/sampleDict index 39efd421b7..2c124296c5 100644 --- a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/system/sampleDict +++ b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/system/sampleDict @@ -19,7 +19,33 @@ interpolationScheme cellPointFace; writeFormat raw; -sampleSets ( face { name cone25 ; axis x ; start ( 0 0 0 ) ; end ( 0.09208087 0.042939 0 ) ; nPoints 92 ; } face { name cone55 ; axis x ; start ( 0.09208087 0.042939 0 ) ; end ( 0.153683 0.13092 0 ) ; nPoints 61 ; } face { name base ; axis x ; start ( 0.153683 0.13092 0 ) ; end ( 0.193675 0.13092 0 ) ; nPoints 40 ; } ); +sampleSets +( + face + { + name cone25; + axis x; + start ( 0 0 0 ); + end ( 0.09208087 0.042939 0 ); + nPoints 92; + } + face + { + name cone55; + axis x; + start ( 0.09208087 0.042939 0 ); + end ( 0.153683 0.13092 0 ); + nPoints 61; + } + face + { + name base; + axis x; + start ( 0.153683 0.13092 0 ); + end ( 0.193675 0.13092 0 ); + nPoints 40; + } +); fields ( p wallHeatTransRate ); diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/sampleDict b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/sampleDict index d578a3cadd..9e80185a57 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/sampleDict +++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/sampleDict @@ -21,7 +21,33 @@ setFormat raw; surfaceFormat vtk; -sets ( cone25 { type face ; axis x ; start ( 0 0 0 ) ; end ( 0.09208087 0.042939 0 ) ; nPoints 92 ; } cone55 { type face ; axis x ; start ( 0.09208087 0.042939 0 ) ; end ( 0.153683 0.13092 0 ) ; nPoints 61 ; } base { type face ; axis x ; start ( 0.153683 0.13092 0 ) ; end ( 0.193675 0.13092 0 ) ; nPoints 40 ; } ); +sets +( + cone25 + { + type face; + axis x; + start ( 0 0 0 ); + end ( 0.09208087 0.042939 0 ); + nPoints 92; + } + cone55 + { + type face; + axis x; + start ( 0.09208087 0.042939 0 ); + end ( 0.153683 0.13092 0 ); + nPoints 61; + } + base + { + type face; + axis x; + start ( 0.153683 0.13092 0 ); + end ( 0.193675 0.13092 0 ); + nPoints 40; + } +); surfaces ( ); diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/system/sampleDict b/tutorials/compressible/rhoCentralFoam/shockTube/system/sampleDict index d8e4f7301d..f8985b2632 100644 --- a/tutorials/compressible/rhoCentralFoam/shockTube/system/sampleDict +++ b/tutorials/compressible/rhoCentralFoam/shockTube/system/sampleDict @@ -21,9 +21,19 @@ setFormat raw; surfaceFormat vtk; -sets ( line { type face ; axis x ; start ( -5 0 0 ) ; end ( 5 0 0 ) ; nPoints 100 ; } ); +sets +( + line + { + type face; + axis x; + start ( -5 0 0 ); + end ( 5 0 0 ); + nPoints 100; + } +); -surfaces ( ); +surfaces (); fields ( p U.component(0) T rho ); diff --git a/tutorials/compressible/rhoSonicFoam/shockTube/system/sampleDict b/tutorials/compressible/rhoSonicFoam/shockTube/system/sampleDict index 9d71da62e2..5f44c51ade 100644 --- a/tutorials/compressible/rhoSonicFoam/shockTube/system/sampleDict +++ b/tutorials/compressible/rhoSonicFoam/shockTube/system/sampleDict @@ -19,9 +19,19 @@ interpolationScheme cellPoint; setFormat raw; -sets ( data { type uniform ; axis x ; start ( -4.995 0 0 ) ; end ( 4.995 0 0 ) ; nPoints 1000 ; } ); +sets +( + data + { + type uniform; + axis x; + start ( -4.995 0 0 ); + end ( 4.995 0 0 ); + nPoints 1000; + } +); -surfaces ( ); +surfaces (); fields ( T magU p ); diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/system/sampleDict b/tutorials/compressible/sonicFoam/laminar/shockTube/system/sampleDict index 9d71da62e2..5f44c51ade 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/system/sampleDict +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/system/sampleDict @@ -19,9 +19,19 @@ interpolationScheme cellPoint; setFormat raw; -sets ( data { type uniform ; axis x ; start ( -4.995 0 0 ) ; end ( 4.995 0 0 ) ; nPoints 1000 ; } ); +sets +( + data + { + type uniform; + axis x; + start ( -4.995 0 0 ); + end ( 4.995 0 0 ); + nPoints 1000; + } +); -surfaces ( ); +surfaces (); fields ( T magU p ); diff --git a/tutorials/electromagnetics/mhdFoam/hartmann/system/sampleDict b/tutorials/electromagnetics/mhdFoam/hartmann/system/sampleDict index 9fa14b4919..f107f4f0eb 100644 --- a/tutorials/electromagnetics/mhdFoam/hartmann/system/sampleDict +++ b/tutorials/electromagnetics/mhdFoam/hartmann/system/sampleDict @@ -19,9 +19,19 @@ interpolationScheme cellPoint; setFormat raw; -sets ( line_centreProfile { type uniform ; axis distance ; start ( 10.001 -1 0.01 ) ; end ( 10.001 1 0.01 ) ; nPoints 100 ; } ); +sets +( + line_centreProfile + { + type uniform; + axis distance; + start ( 10.001 -1 0.01 ); + end ( 10.001 1 0.01 ); + nPoints 100; + } +); -surfaces ( ); +surfaces (); fields ( Ux ); diff --git a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/sampleDict b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/sampleDict index db2a9715f2..b956f363f9 100644 --- a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/sampleDict +++ b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/sampleDict @@ -19,9 +19,19 @@ interpolationScheme cellPoint; setFormat raw; -sets ( leftPatch { type uniform ; axis y ; start ( 0 0.5 0.25 ) ; end ( 0 2 0.25 ) ; nPoints 100 ; } ); +sets +( + leftPatch + { + type uniform; + axis y; + start ( 0 0.5 0.25 ); + end ( 0 2 0.25 ); + nPoints 100; + } +); -surfaces ( ); +surfaces (); fields ( sigmaxx );