OGS
ProcessOutput.cpp File Reference

Detailed Description

Definition in file ProcessOutput.cpp.

Include dependency graph for ProcessOutput.cpp:

Go to the source code of this file.

Namespaces

 ProcessLib
 

Functions

static void addOgsVersion (MeshLib::Mesh &mesh)
 
static void addSecondaryVariableNodes (double const t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, ProcessLib::SecondaryVariable const &var, std::string const &output_name, MeshLib::Mesh &mesh)
 
static void addSecondaryVariableResiduals (double const t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, ProcessLib::SecondaryVariable const &var, std::string const &output_name, MeshLib::Mesh &mesh)
 
void ProcessLib::addProcessDataToMesh (const double t, std::vector< GlobalVector * > const &x, int const process_id, MeshLib::Mesh &mesh, [[maybe_unused]] std::vector< NumLib::LocalToGlobalIndexMap const * > const &bulk_dof_tables, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< std::reference_wrapper< ProcessVariable >> const &process_variables, SecondaryVariableCollection const &secondary_variables, bool const output_secondary_variable, std::vector< std::unique_ptr< IntegrationPointWriter >> const *const integration_point_writer, OutputDataSpecification const &process_output)
 
void ProcessLib::makeOutput (std::string const &file_name, MeshLib::Mesh const &mesh, bool const compress_output, int const data_mode)
 

Function Documentation

◆ addOgsVersion()

static void addOgsVersion ( MeshLib::Mesh mesh)
static

Copies the ogs_version string containing the release number and the git hash.

Definition at line 29 of file ProcessOutput.cpp.

30 {
31  auto& ogs_version_field = *MeshLib::getOrCreateMeshProperty<char>(
34 
35  ogs_version_field.assign(GitInfoLib::GitInfo::ogs_version.begin(),
37 }
const std::string OGS_VERSION
Definition: GitInfo.cpp:20
GITINFOLIB_EXPORT const std::string ogs_version

References MeshLib::IntegrationPoint, GitInfoLib::GitInfo::OGS_VERSION, and GitInfoLib::GitInfo::ogs_version.

Referenced by ProcessLib::addProcessDataToMesh().

◆ addSecondaryVariableNodes()

static void addSecondaryVariableNodes ( double const  t,
std::vector< GlobalVector * > const &  x,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_table,
ProcessLib::SecondaryVariable const &  var,
std::string const &  output_name,
MeshLib::Mesh mesh 
)
static

Definition at line 39 of file ProcessOutput.cpp.

46 {
47  DBUG(" secondary variable {:s}", output_name);
48 
49  auto& nodal_values_mesh = *MeshLib::getOrCreateMeshProperty<double>(
50  mesh, output_name, MeshLib::MeshItemType::Node,
51  var.fcts.num_components);
52  if (nodal_values_mesh.size() !=
53  mesh.getNumberOfNodes() * var.fcts.num_components)
54  {
55  OGS_FATAL(
56  "Nodal property `{:s}' does not have the right number of "
57  "components. Expected: {:d}, actual: {:d}",
58  output_name,
59  mesh.getNumberOfNodes() * var.fcts.num_components,
60  nodal_values_mesh.size());
61  }
62 
63  std::unique_ptr<GlobalVector> result_cache;
64  auto const& nodal_values =
65  var.fcts.eval_field(t, x, dof_table, result_cache);
66 #ifdef USE_PETSC
67  std::size_t const global_vector_size =
68  nodal_values.getLocalSize() + nodal_values.getGhostSize();
69 #else
70  std::size_t const global_vector_size = nodal_values.size();
71 #endif
72  if (nodal_values_mesh.size() != global_vector_size)
73  {
74  OGS_FATAL(
75  "Secondary variable `{:s}' did not evaluate to the right number of "
76  "components. Expected: {:d}, actual: {:d}.",
77  var.name, nodal_values_mesh.size(), global_vector_size);
78  }
79 
80  // Copy result
81  nodal_values.copyValues(nodal_values_mesh);
82 }
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:89

References DBUG(), ProcessLib::SecondaryVariableFunctions::eval_field, ProcessLib::SecondaryVariable::fcts, MeshLib::Mesh::getNumberOfNodes(), ProcessLib::SecondaryVariable::name, MeshLib::Node, ProcessLib::SecondaryVariableFunctions::num_components, and OGS_FATAL.

Referenced by ProcessLib::addProcessDataToMesh().

◆ addSecondaryVariableResiduals()

static void addSecondaryVariableResiduals ( double const  t,
std::vector< GlobalVector * > const &  x,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_table,
ProcessLib::SecondaryVariable const &  var,
std::string const &  output_name,
MeshLib::Mesh mesh 
)
static

Definition at line 84 of file ProcessOutput.cpp.

91 {
92  if (!var.fcts.eval_residuals)
93  {
94  return;
95  }
96 
97  DBUG(" secondary variable {:s} residual", output_name);
98  auto const& property_name_res = output_name + "_residual";
99 
100  auto& residuals_mesh = *MeshLib::getOrCreateMeshProperty<double>(
101  mesh, property_name_res, MeshLib::MeshItemType::Cell,
102  var.fcts.num_components);
103  if (residuals_mesh.size() !=
104  mesh.getNumberOfElements() * var.fcts.num_components)
105  {
106  OGS_FATAL(
107  "Cell property `{:s}' does not have the right number of "
108  "components. Expected: {:d}, actual: {:d}",
109  property_name_res,
110  mesh.getNumberOfElements() * var.fcts.num_components,
111  residuals_mesh.size());
112  }
113 
114  std::unique_ptr<GlobalVector> result_cache;
115  auto const& residuals =
116  var.fcts.eval_residuals(t, x, dof_table, result_cache);
117 #ifdef USE_PETSC
118  std::size_t const global_vector_size =
119  residuals.getLocalSize() + residuals.getGhostSize();
120 #else
121  std::size_t const global_vector_size = residuals.size();
122 #endif
123  if (residuals_mesh.size() != global_vector_size)
124  {
125  OGS_FATAL(
126  "The residual of secondary variable `{:s}' did not evaluate to the "
127  "right number of components. Expected: {:d}, actual: {:d}.",
128  var.name, residuals_mesh.size(), global_vector_size);
129  }
130 
131  // Copy result
132  residuals.copyValues(residuals_mesh);
133 }
std::size_t getNumberOfElements() const
Get the number of elements.
Definition: Mesh.h:86

References MeshLib::Cell, DBUG(), ProcessLib::SecondaryVariableFunctions::eval_residuals, ProcessLib::SecondaryVariable::fcts, MeshLib::Mesh::getNumberOfElements(), ProcessLib::SecondaryVariable::name, ProcessLib::SecondaryVariableFunctions::num_components, and OGS_FATAL.

Referenced by ProcessLib::addProcessDataToMesh().