Commit 264432b6 authored by Franjo's avatar Franjo
Browse files

Merge branch 'development' into task-qualityControls

parents a6960c7f 87b7c279
#if defined(__GNUC__) ifeq (Gcc,$(findstring Gcc,$(WM_COMPILER)))
# if defined(darwinIntel64) OMP_FLAGS = -DUSE_OMP -fopenmp
OMP_FLAGS = else
# else OMP_FLAGS =
OMP_FLAGS = -DUSE_OMP -fopenmp endif
# endif
#else
OMP_FLAGS =
#endif
EXE_INC = \ EXE_INC = \
$(OMP_FLAGS) \ $(OMP_FLAGS) \
......
...@@ -188,7 +188,7 @@ void cartesian2DMeshGenerator::refBoundaryLayers() ...@@ -188,7 +188,7 @@ void cartesian2DMeshGenerator::refBoundaryLayers()
void cartesian2DMeshGenerator::replaceBoundaries() void cartesian2DMeshGenerator::replaceBoundaries()
{ {
renameBoundaryPatches rbp(mesh_, meshDict_); renameBoundaryPatches rbp(mesh_, meshDict_, true);
} }
void cartesian2DMeshGenerator::renumberMesh() void cartesian2DMeshGenerator::renumberMesh()
...@@ -198,67 +198,53 @@ void cartesian2DMeshGenerator::renumberMesh() ...@@ -198,67 +198,53 @@ void cartesian2DMeshGenerator::renumberMesh()
void cartesian2DMeshGenerator::generateMesh() void cartesian2DMeshGenerator::generateMesh()
{ {
try if( controller_.runCurrentStep("templateGeneration") )
{ {
if( controller_.runCurrentStep("templateGeneration") ) createCartesianMesh();
{ }
createCartesianMesh();
}
if( controller_.runCurrentStep("surfaceTopology") )
{
surfacePreparation();
}
if( controller_.runCurrentStep("surfaceProjection") )
{
mapMeshToSurface();
}
if( controller_.runCurrentStep("patchAssignment") )
{
extractPatches();
}
if( controller_.runCurrentStep("edgeExtraction") )
{
mapEdgesAndCorners();
optimiseMeshSurface();
}
if( controller_.runCurrentStep("boundaryLayerGeneration") ) if( controller_.runCurrentStep("surfaceTopology") )
{ {
generateBoundaryLayers(); surfacePreparation();
} }
if( controller_.runCurrentStep("meshOptimisation") ) if( controller_.runCurrentStep("surfaceProjection") )
{ {
optimiseMeshSurface(); mapMeshToSurface();
} }
if( controller_.runCurrentStep("boundaryLayerRefinement") ) if( controller_.runCurrentStep("patchAssignment") )
{ {
refBoundaryLayers(); extractPatches();
} }
renumberMesh(); if( controller_.runCurrentStep("edgeExtraction") )
{
mapEdgesAndCorners();
replaceBoundaries(); optimiseMeshSurface();
}
controller_.workflowCompleted(); if( controller_.runCurrentStep("boundaryLayerGeneration") )
{
generateBoundaryLayers();
} }
catch(const std::string& message)
if( controller_.runCurrentStep("meshOptimisation") )
{ {
Info << message << endl; optimiseMeshSurface();
} }
catch(...)
if( controller_.runCurrentStep("boundaryLayerRefinement") )
{ {
WarningIn refBoundaryLayers();
(
"void cartesian2DMeshGenerator::generateMesh()"
) << "Meshing process terminated!" << endl;
} }
renumberMesh();
replaceBoundaries();
controller_.workflowCompleted();
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...@@ -283,70 +269,87 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time) ...@@ -283,70 +269,87 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
mesh_(time), mesh_(time),
controller_(mesh_) controller_(mesh_)
{ {
if( true ) try
{ {
checkMeshDict cmd(meshDict_); if( true )
} {
checkMeshDict cmd(meshDict_);
fileName surfaceFile = meshDict_.lookup("surfaceFile"); }
if( Pstream::parRun() )
surfaceFile = ".."/surfaceFile;
surfacePtr_ = new triSurf(db_.path()/surfaceFile); fileName surfaceFile = meshDict_.lookup("surfaceFile");
if( Pstream::parRun() )
surfaceFile = ".."/surfaceFile;
if( true ) surfacePtr_ = new triSurf(db_.path()/surfaceFile);
{
//- save meta data with the mesh (surface mesh + its topology info)
triSurfaceMetaData sMetaData(*surfacePtr_);
const dictionary& surfMetaDict = sMetaData.metaData();
mesh_.metaData().add("surfaceFile", surfaceFile, true); if( true )
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
triSurface2DCheck surfCheck(*surfacePtr_);
if( !surfCheck.is2DSurface() )
{ {
surfCheck.createSubsets(); //- save meta data with the mesh (surface mesh + its topology info)
triSurfaceMetaData sMetaData(*surfacePtr_);
const dictionary& surfMetaDict = sMetaData.metaData();
mesh_.metaData().add("surfaceFile", surfaceFile, true);
mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
triSurface2DCheck surfCheck(*surfacePtr_);
if( !surfCheck.is2DSurface() )
{
surfCheck.createSubsets();
Info << "Writting surface with subsets to file "
<< "badSurfaceWithSubsets.fms" << endl;
surfacePtr_->writeSurface("badSurfaceWithSubsets.fms");
}
}
Info << "Writting surface with subsets to file " if( surfacePtr_->featureEdges().size() != 0 )
<< "badSurfaceWithSubsets.fms" << endl; {
surfacePtr_->writeSurface("badSurfaceWithSubsets.fms"); //- get rid of duplicate triangles as they cause strange problems
triSurfaceCleanupDuplicateTriangles
(
const_cast<triSurf&>(*surfacePtr_)
);
//- create surface patches based on the feature edges
//- and update the meshDict based on the given data
triSurfacePatchManipulator manipulator(*surfacePtr_);
const triSurf* surfaceWithPatches =
manipulator.surfaceWithPatches(&meshDict_);
//- delete the old surface and assign the new one
deleteDemandDrivenData(surfacePtr_);
surfacePtr_ = surfaceWithPatches;
} }
}
if( surfacePtr_->featureEdges().size() != 0 ) if( meshDict_.found("anisotropicSources") )
{ {
//- get rid of duplicate triangles as they cause strange problems surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
triSurfaceCleanupDuplicateTriangles(const_cast<triSurf&>(*surfacePtr_));
//- create surface patches based on the feature edges modSurfacePtr_ = surfMod.modifyGeometry();
//- and update the meshDict based on the given data
triSurfacePatchManipulator manipulator(*surfacePtr_);
const triSurf* surfaceWithPatches = octreePtr_ = new meshOctree(*modSurfacePtr_, true);
manipulator.surfaceWithPatches(&meshDict_); }
else
{
octreePtr_ = new meshOctree(*surfacePtr_, true);
}
//- delete the old surface and assign the new one meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
deleteDemandDrivenData(surfacePtr_);
surfacePtr_ = surfaceWithPatches;
}
if( meshDict_.found("anisotropicSources") ) generateMesh();
}
catch(const std::string& message)
{ {
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_); Info << message << endl;
modSurfacePtr_ = surfMod.modifyGeometry();
octreePtr_ = new meshOctree(*modSurfacePtr_, true);
} }
else catch(...)
{ {
octreePtr_ = new meshOctree(*surfacePtr_, true); WarningIn
(
"cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time&)"
) << "Meshing process terminated!" << endl;
} }
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
......
...@@ -247,69 +247,55 @@ void cartesianMeshGenerator::renumberMesh() ...@@ -247,69 +247,55 @@ void cartesianMeshGenerator::renumberMesh()
void cartesianMeshGenerator::generateMesh() void cartesianMeshGenerator::generateMesh()
{ {
try if( controller_.runCurrentStep("templateGeneration") )
{ {
if( controller_.runCurrentStep("templateGeneration") ) createCartesianMesh();
{ }
createCartesianMesh();
}
if( controller_.runCurrentStep("surfaceTopology") ) if( controller_.runCurrentStep("surfaceTopology") )
{ {
surfacePreparation(); surfacePreparation();
} }
if( controller_.runCurrentStep("surfaceProjection") ) if( controller_.runCurrentStep("surfaceProjection") )
{ {
mapMeshToSurface(); mapMeshToSurface();
} }
if( controller_.runCurrentStep("patchAssignment") ) if( controller_.runCurrentStep("patchAssignment") )
{ {
extractPatches(); extractPatches();
} }
if( controller_.runCurrentStep("edgeExtraction") ) if( controller_.runCurrentStep("edgeExtraction") )
{ {
mapEdgesAndCorners(); mapEdgesAndCorners();
optimiseMeshSurface(); optimiseMeshSurface();
} }
if( controller_.runCurrentStep("boundaryLayerGeneration") ) if( controller_.runCurrentStep("boundaryLayerGeneration") )
{ {
generateBoundaryLayers(); generateBoundaryLayers();
} }
if( controller_.runCurrentStep("meshOptimisation") ) if( controller_.runCurrentStep("meshOptimisation") )
{ {
optimiseFinalMesh(); optimiseFinalMesh();
projectSurfaceAfterBackScaling(); projectSurfaceAfterBackScaling();
} }
if( controller_.runCurrentStep("boundaryLayerRefinement") ) if( controller_.runCurrentStep("boundaryLayerRefinement") )
{ {
refBoundaryLayers(); refBoundaryLayers();
} }
renumberMesh(); renumberMesh();
replaceBoundaries(); replaceBoundaries();
controller_.workflowCompleted(); controller_.workflowCompleted();
}
catch(const std::string& message)
{
Info << message << endl;
}
catch(...)
{
WarningIn
(
"void cartesianMeshGenerator::generateMesh()"
) << "Meshing process terminated!" << endl;
}
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...@@ -334,57 +320,72 @@ cartesianMeshGenerator::cartesianMeshGenerator(const Time& time) ...@@ -334,57 +320,72 @@ cartesianMeshGenerator::cartesianMeshGenerator(const Time& time)
mesh_(time), mesh_(time),
controller_(mesh_) controller_(mesh_)
{ {
if( true ) try
{ {
checkMeshDict cmd(meshDict_); if( true )
} {
checkMeshDict cmd(meshDict_);
}
fileName surfaceFile = meshDict_.lookup("surfaceFile"); fileName surfaceFile = meshDict_.lookup("surfaceFile");
if( Pstream::parRun() ) if( Pstream::parRun() )
surfaceFile = ".."/surfaceFile; surfaceFile = ".."/surfaceFile;
surfacePtr_ = new triSurf(db_.path()/surfaceFile); surfacePtr_ = new triSurf(db_.path()/surfaceFile);
if( true ) if( true )
{ {
//- save meta data with the mesh (surface mesh + its topology info) //- save meta data with the mesh (surface mesh + its topology info)
triSurfaceMetaData sMetaData(*surfacePtr_); triSurfaceMetaData sMetaData(*surfacePtr_);
const dictionary& surfMetaDict = sMetaData.metaData(); const dictionary& surfMetaDict = sMetaData.metaData();
mesh_.metaData().add("surfaceFile", surfaceFile, true); mesh_.metaData().add("surfaceFile", surfaceFile, true);
mesh_.metaData().add("surfaceMeta", surfMetaDict, true); mesh_.metaData().add("surfaceMeta", surfMetaDict, true);
} }
if( surfacePtr_->featureEdges().size() != 0 ) if( surfacePtr_->featureEdges().size() != 0 )
{ {
//- create surface patches based on the feature edges //- create surface patches based on the feature edges
//- and update the meshDict based on the given data //- and update the meshDict based on the given data
triSurfacePatchManipulator manipulator(*surfacePtr_); triSurfacePatchManipulator manipulator(*surfacePtr_);
const triSurf* surfaceWithPatches = const triSurf* surfaceWithPatches =
manipulator.surfaceWithPatches(&meshDict_); manipulator.surfaceWithPatches(&meshDict_);
//- delete the old surface and assign the new one //- delete the old surface and assign the new one
deleteDemandDrivenData(surfacePtr_); deleteDemandDrivenData(surfacePtr_);
surfacePtr_ = surfaceWithPatches; surfacePtr_ = surfaceWithPatches;
} }
if( meshDict_.found("anisotropicSources") ) if( meshDict_.found("anisotropicSources") )
{ {
surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_); surfaceMeshGeometryModification surfMod(*surfacePtr_, meshDict_);
modSurfacePtr_ = surfMod.modifyGeometry(); modSurfacePtr_ = surfMod.modifyGeometry();
octreePtr_ = new meshOctree(*modSurfacePtr_); octreePtr_ = new meshOctree(*modSurfacePtr_);
}
else
{
octreePtr_ = new meshOctree(*surfacePtr_);
}
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
}
catch(const std::string& message)
{
Info << "Here" << endl;
Info << message << endl;
} }
else catch(...)
{ {
octreePtr_ = new meshOctree(*surfacePtr_); WarningIn
(
"cartesianMeshGenerator::cartesianMeshGenerator(const Time&)"
) << "Meshing process terminated!" << endl;
} }
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
......
...@@ -235,69 +235,55 @@ void tetMeshGenerator::renumberMesh() ...@@ -235,69 +235,55 @@ void tetMeshGenerator::renumberMesh()
void tetMeshGenerator::generateMesh() void tetMeshGenerator::generateMesh()
{ {
try if( controller_.runCurrentStep("templateGeneration") )
{ {
if( controller_.runCurrentStep("templateGeneration") ) createTetMesh();
{ }
createTetMesh();
}
if( controller_.runCurrentStep("surfaceTopology") ) if( controller_.runCurrentStep("surfaceTopology") )
{ {
surfacePreparation(); surfacePreparation();
} }
if( controller_.runCurrentStep("surfaceProjection") ) if( controller_.runCurrentStep("surfaceProjection") )
{ {
mapMeshToSurface(); mapMeshToSurface();
} }
if( controller_.runCurrentStep("patchAssignment") ) if( controller_.runCurrentStep("patchAssignment") )
{ {
extractPatches(); extractPatches();
} }
if( controller_.runCurrentStep("edgeExtraction") ) if( controller_.runCurrentStep("edgeExtraction") )
{ {
mapEdgesAndCorners(); mapEdgesAndCorners();
optimiseMeshSurface(); optimiseMeshSurface();
}