https://mooseframework.inl.gov
MeshDiagnosticsGenerator.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MeshGenerator.h"
13 #include "MooseEnum.h"
14 
15 /*
16  * Mesh 'generator' to diagnose potentially unsupported features or miscellaneous issues
17  */
19 {
20 public:
22 
24 
25  std::unique_ptr<MeshBase> generate() override;
26 
27 protected:
29  std::unique_ptr<MeshBase> & _input;
30 
31 private:
33  void checkSidesetsOrientation(const std::unique_ptr<MeshBase> & mesh) const;
35  void checkWatertightSidesets(const std::unique_ptr<MeshBase> & mesh) const;
37  void checkWatertightNodesets(const std::unique_ptr<MeshBase> & mesh) const;
39  std::vector<boundary_id_type>
40  findBoundaryOverlap(const std::vector<boundary_id_type> & watertight_boundaries,
41  std::vector<boundary_id_type> & boundary_ids) const;
43  void checkElementVolumes(const std::unique_ptr<MeshBase> & mesh) const;
45  void checkElementTypes(const std::unique_ptr<MeshBase> & mesh) const;
47  void checkElementOverlap(const std::unique_ptr<MeshBase> & mesh) const;
49  void checkNonPlanarSides(const std::unique_ptr<MeshBase> & mesh) const;
51  void checkNonConformalMesh(const std::unique_ptr<MeshBase> & mesh) const;
53  void checkNonConformalMeshFromAdaptivity(const std::unique_ptr<MeshBase> & mesh) const;
55  void checkLocalJacobians(const std::unique_ptr<MeshBase> & mesh) const;
57  void checkNonMatchingEdges(const std::unique_ptr<MeshBase> & mesh) const;
58 
67  void diagnosticsLog(std::string msg, const MooseEnum & log_level, bool problem_detected) const;
68 
76  std::vector<BoundaryName> _watertight_boundary_names;
78  std::vector<BoundaryID> _watertight_boundaries;
104  const unsigned int _num_outputs;
105 };
void checkNonMatchingEdges(const std::unique_ptr< MeshBase > &mesh) const
void checkWatertightNodesets(const std::unique_ptr< MeshBase > &mesh) const
std::unique_ptr< MeshBase > & _input
the input mesh to be diagnosed
const MooseEnum _check_sidesets_orientation
whether to check that sidesets are consistently oriented using neighbor subdomains ...
const MooseEnum _check_element_types
whether to check different element types in the same sub-domain
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
const unsigned int _num_outputs
number of logs to output at most for each check
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const MooseEnum _check_non_conformal_mesh
whether to check for non-conformal meshes
std::vector< BoundaryID > _watertight_boundaries
IDs of boundaries to be checked in watertight checks.
void checkNonConformalMeshFromAdaptivity(const std::unique_ptr< MeshBase > &mesh) const
Routine to check whether a mesh presents non-conformality born from adaptivity.
MeshDiagnosticsGenerator(const InputParameters &parameters)
const MooseEnum _check_local_jacobian
whether to check for negative jacobians in the domain
static InputParameters validParams()
const Real _non_conformality_tol
tolerance for detecting when meshes are not conformal
std::vector< BoundaryName > _watertight_boundary_names
Names of boundaries to be checked in watertight checks.
void checkLocalJacobians(const std::unique_ptr< MeshBase > &mesh) const
Routine to check whether the Jacobians (elem and side) are not negative.
void checkNonConformalMesh(const std::unique_ptr< MeshBase > &mesh) const
Routine to check whether a mesh presents non-conformality.
void checkElementTypes(const std::unique_ptr< MeshBase > &mesh) const
Routine to check the element types in each subdomain.
const MooseEnum _check_adaptivity_non_conformality
whether to check for the adaptivity of non-conformal meshes
const Real _min_volume
minimum size for element volume to be counted as a tiny element
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
const Real _max_volume
maximum size for element volume to be counted as a big element
void checkElementOverlap(const std::unique_ptr< MeshBase > &mesh) const
Routine to check whether elements overlap in the mesh.
const MooseEnum _check_element_volumes
whether to check element volumes
void checkElementVolumes(const std::unique_ptr< MeshBase > &mesh) const
Routine to check the element volumes.
const MooseEnum _check_watertight_nodesets
whether to check that each external node is assigned to a nodeset
const MooseEnum _check_non_planar_sides
whether to check for elements in different planes (non_planar)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void diagnosticsLog(std::string msg, const MooseEnum &log_level, bool problem_detected) const
Utility routine to output the final diagnostics level in the desired mode.
std::vector< boundary_id_type > findBoundaryOverlap(const std::vector< boundary_id_type > &watertight_boundaries, std::vector< boundary_id_type > &boundary_ids) const
Helper function that finds the intersection between the given vectors.
const MooseEnum _check_watertight_sidesets
whether to check that each external side is assigned to a sideset
void checkSidesetsOrientation(const std::unique_ptr< MeshBase > &mesh) const
Routine to check sideset orientation near subdomains.
const InputParameters & parameters() const
Get the parameters of the object.
const MooseEnum _check_element_overlap
whether to check for intersecting elements
void checkNonPlanarSides(const std::unique_ptr< MeshBase > &mesh) const
Routine to check whether there are non-planar sides in the mesh.
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32
void checkWatertightSidesets(const std::unique_ptr< MeshBase > &mesh) const