From ec0780b79ecefa80b4682b28cf6a426f254fd68d Mon Sep 17 00:00:00 2001 From: Daniel Bauer <daniel.j.bauer@fau.de> Date: Fri, 18 Jun 2021 10:37:20 +0200 Subject: [PATCH] add note about writing distance octree on root node only --- apps/tutorials/lbm/04_LBComplexGeometry.cpp | 9 +++++++-- apps/tutorials/lbm/04_LBComplexGeometry.dox | 3 +++ src/mesh_common/distance_octree/DistanceOctree.h | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/tutorials/lbm/04_LBComplexGeometry.cpp b/apps/tutorials/lbm/04_LBComplexGeometry.cpp index 9b02de05a..dedc750f8 100644 --- a/apps/tutorials/lbm/04_LBComplexGeometry.cpp +++ b/apps/tutorials/lbm/04_LBComplexGeometry.cpp @@ -162,8 +162,13 @@ int main(int argc, char** argv) WALBERLA_LOG_INFO_ON_ROOT("Octree has height " << distanceOctree->height()) + //! [octreeVTK] // write distance octree to file - distanceOctree->writeVTKOutput("distanceOctree"); + WALBERLA_ROOT_SECTION() + { + distanceOctree->writeVTKOutput("distanceOctree"); + } + //! [octreeVTK] /////////////////////////// /// CREATE BLOCK FOREST /// @@ -325,4 +330,4 @@ int main(int argc, char** argv) } } // namespace walberla -int main(int argc, char** argv) { walberla::main(argc, argv); } \ No newline at end of file +int main(int argc, char** argv) { walberla::main(argc, argv); } diff --git a/apps/tutorials/lbm/04_LBComplexGeometry.dox b/apps/tutorials/lbm/04_LBComplexGeometry.dox index dd1d7e74e..5c8b1fa6a 100644 --- a/apps/tutorials/lbm/04_LBComplexGeometry.dox +++ b/apps/tutorials/lbm/04_LBComplexGeometry.dox @@ -59,6 +59,9 @@ After calling this function, we prepare for building the distance octree by prec From this information we can finally build the distance octree. It stores information about how close or far boundaries are to each other. Later, this information could be used for e.g. adaptive mesh refinement (note that this will not be covered in this tutorial). \snippet 04_LBComplexGeometry.cpp octree +When writing the distance octree to disk (e.g. for debugging purposes), care must be taken to execute the write function only on the root node: +\snippet 04_LBComplexGeometry.cpp octreeVTK + Even though we have successfully loaded the complex geometry and set up the corresponding distance octree, we have not defined our computational LB domain yet. In this tutorial, the LB domain is defined relatively to the loaded geometry. Henceforth, we calculate the axis-aligned bounding box of the geometry and scale it to our needs. Here, we chose our channel to be 10x3x1 times the size of the Stanford Bunny. This scaling is defined in the parameter file (parameter: domainScaling). diff --git a/src/mesh_common/distance_octree/DistanceOctree.h b/src/mesh_common/distance_octree/DistanceOctree.h index ce1a21c16..7e58f969e 100644 --- a/src/mesh_common/distance_octree/DistanceOctree.h +++ b/src/mesh_common/distance_octree/DistanceOctree.h @@ -133,6 +133,20 @@ protected: +//********************************************************************************************************************** +/*! \brief Write the distance octree to a VTK file. + * + * This method should only be called by the root process: + * \code + WALBERLA_ROOT_SECTION() + { + distanceOctree->writeVTKOutput("distanceOctree"); + } + * \endcode + * + * \param filestem name of the VTK file without extension + */ +//********************************************************************************************************************** template <typename MeshType> void DistanceOctree<MeshType>::writeVTKOutput( const std::string & filestem ) const { -- GitLab