32#include "libmesh/string_to_enum.h"
33#include "libmesh/simple_range.h"
41 return std::string(spaces,
' ');
47 std::stringstream oss;
52 oss <<
"Input File(s):\n";
54 oss <<
" " << std::filesystem::absolute(entry).c_str() <<
"\n";
57 const auto & cl = std::as_const(*app.
commandLine());
60 as_range(std::next(cl.getEntries().begin(), app.
multiAppLevel() == 0), cl.getEntries().end());
62 std::stringstream args_oss;
63 for (
const auto & entry : cl_range)
64 if (!entry.hit_param && !entry.subapp_name && entry.name !=
"-i")
65 args_oss <<
" " << cl.formatEntry(entry) <<
"\n";
66 if (args_oss.str().size())
67 oss <<
"Command Line Argument(s):\n" << args_oss.str() <<
"\n";
69 std::stringstream input_args_oss;
70 for (
const auto & entry : cl_range)
71 if (entry.hit_param && !entry.subapp_name)
72 input_args_oss <<
" " << cl.formatEntry(entry) <<
"\n";
73 if (input_args_oss.str().size())
74 oss <<
"Command Line Input Argument(s):\n" << input_args_oss.str() <<
"\n";
77 if (checkpoints.size())
79 oss << std::left <<
"Checkpoint:\n";
84 oss << std::left <<
"Parallelism:\n"
86 <<
" Num Processors: " <<
static_cast<std::size_t
>(app.
n_processors()) <<
'\n'
96 std::stringstream oss;
101 const auto fe_backend = problem.
feBackend();
107 oss <<
" Parallel Type: " << (
mesh.isDistributedMesh() ?
"distributed" :
"replicated");
110 bool forced =
mesh.isParallelTypeForced();
111 bool pre_split =
mesh.isSplit();
112 oss << (forced || pre_split ?
" (" :
"") << (forced ?
"forced" :
"")
113 << (forced && pre_split ?
", " :
"") << (pre_split ?
"pre-split" :
"")
114 << (forced || pre_split ?
")" :
"");
125 if (
mesh.n_processors() > 1)
127 dof_id_type nnodes =
mesh.nNodes();
128 dof_id_type nnodes_local =
mesh.nLocalNodes();
132 dof_id_type min_nnodes = nnodes_local, max_nnodes = nnodes_local;
133 mesh.comm().min(min_nnodes);
134 mesh.comm().max(max_nnodes);
135 if (
mesh.processor_id() == 0)
137 << max_nnodes <<
'/' << nnodes /
mesh.n_processors() <<
'\n';
144 if (
mesh.n_processors() > 1)
146 dof_id_type nelems =
mesh.nActiveElem();
147 dof_id_type nelems_local =
mesh.nActiveLocalElem();
151 dof_id_type min_nelems = nelems_local, max_nelems = nelems_local;
152 mesh.comm().min(min_nelems);
153 mesh.comm().max(max_nelems);
154 if (
mesh.processor_id() == 0)
155 oss << std::setw(
console_field_width) <<
" Min/Max/Avg:" << min_nelems <<
'/' << max_nelems
156 <<
'/' << nelems /
mesh.n_processors() <<
'\n';
164 if (
mesh.maxPLevel() > 0)
166 <<
" Max p-Refinement Level: " <<
static_cast<std::size_t
>(
mesh.maxPLevel()) <<
'\n';
167 if (
mesh.maxHLevel() > 0)
169 <<
" Max h-Refinement Level: " <<
static_cast<std::size_t
>(
mesh.maxHLevel()) <<
'\n';
175 <<
" Num Subdomains: " <<
static_cast<std::size_t
>(
mesh.nSubdomains()) <<
'\n';
179 <<
" Num Partitions: " <<
static_cast<std::size_t
>(
mesh.nPartitions()) <<
'\n'
181 << (
mesh.isPartitionerForced() ?
" (forced) " :
"") <<
'\n';
182 if (
mesh.skipPartitioning())
184 else if (
mesh.skipNoncriticalPartitioning())
210 if (system.n_constrained_dofs())
213 <<
" Num Constrained DOFs: " << system.n_constrained_dofs() <<
'\n'
215 <<
" Local Constrained DOFs: " << system.n_local_constrained_dofs() <<
'\n';
218 std::streampos begin_string_pos = oss.tellp();
219 std::streampos curr_string_pos = begin_string_pos;
221 for (
unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
231 for (
unsigned int vn = 0; vn < 5; vn++)
233 oss <<
"\"" << vg_description.
name(vn) <<
"\" ";
234 curr_string_pos = oss.tellp();
238 curr_string_pos = oss.tellp();
243 oss <<
"\"" << vg_description.
name(vn) <<
"\" ";
244 curr_string_pos = oss.tellp();
249 for (
unsigned int vn = 0; vn < vg_description.
n_variables(); vn++)
251 oss <<
"\"" << vg_description.
name(vn) <<
"\" ";
252 curr_string_pos = oss.tellp();
261 begin_string_pos = oss.tellp();
262 curr_string_pos = begin_string_pos;
264#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
265 for (
unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
268 << libMesh::Utility::enum_to_string<FEFamily>(
269 system.get_dof_map().variable_group(vg).type().family)
271 curr_string_pos = oss.tellp();
276 for (
unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
279 << libMesh::Utility::enum_to_string<FEFamily>(
280 system.get_dof_map().variable_group(vg).type().family)
282 << libMesh::Utility::enum_to_string<FEFamily>(
283 system.get_dof_map().variable_group(vg).type().radial_family)
285 curr_string_pos = oss.tellp();
290 begin_string_pos = oss.tellp();
291 curr_string_pos = begin_string_pos;
293 for (
unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
296 << libMesh::Utility::enum_to_string<InfMapType>(
297 system.get_dof_map().variable_group(vg).type().inf_map)
299 curr_string_pos = oss.tellp();
305 begin_string_pos = oss.tellp();
306 curr_string_pos = begin_string_pos;
308 for (
unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
310#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
312 << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
316 << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
318 << Utility::enum_to_string<Order>(
319 system.get_dof_map().variable_group(vg).type().radial_order)
322 curr_string_pos = oss.tellp();
325 oss <<
"\n" << std::endl;
334 std::stringstream oss;
343 std::stringstream oss;
351 std::stringstream oss;
355 if (info_strings.size())
357 for (
const auto & info_pair : info_strings)
361 << info_pair.second <<
'\n';
372 std::stringstream oss;
377 oss <<
"Execution Information:\n"
381 if (time_stepper !=
"")
384 if (!time_integrator_names.empty())
386 <<
" TimeIntegrator(s): " << MooseUtils::join(time_integrator_names,
" ") <<
'\n';
389 << std::string(
" Solver") +
401 std::vector<std::string> splits = {
""};
404 splits.push_back(
"fieldsplit_" + split->name() +
"_");
406 for (
const std::string & split : splits)
408 std::string pc_desc_split;
410 for (
const auto & entry : std::as_const(*app.
commandLine()).getEntries())
411 if (entry.name == prefix +
"pc_type" || entry.name == prefix +
"sub_pc_type" ||
412 entry.name == prefix +
"pc_hypre_type" || entry.name == prefix +
"pc_fieldsplit_type")
413 pc_desc_split += entry.value ? *entry.value +
" " :
"unspecified ";
415 if (!pc_desc_split.empty() && prefix.size() > 1)
416 pc_desc +=
"[" + prefix.substr(1, prefix.size() - 2) +
"]: ";
417 pc_desc += pc_desc_split;
422 if (!pc_desc.empty())
423 pc_desc +=
"(see input file for unoverridden options)";
429 if (!pc_desc.empty())
432 std::string mpc_desc;
440 mpc_desc += mpc->
type() +
" ";
441 if (mpc->
name().find(
"_moose_auto") != std::string::npos)
442 mpc_desc +=
"(auto) ";
446 if (!mpc_desc.empty())
457 std::stringstream oss;
462 for (
const auto & out : outputs)
470 if (out->isAdvanced())
473 for (
const auto & adv_it : adv_on)
474 if (execute_on != adv_it.second)
476 << adv_it.second <<
"\"" << std::endl;
486 std::stringstream oss;
490 oss <<
"Executioner/use_pre_smo_residual is set to true. The pre-SMO residual will be evaluated "
491 "at the beginning of each time step before executing objects that could modify the "
492 "solution, such as preset BCs, predictors, correctors, constraints, and certain user "
493 "objects. The pre-SMO residuals will be prefixed with * and will be used in the relative "
494 "convergence check.\n";
495 oss << COLOR_DEFAULT;
503 std::stringstream oss;
506 if (app.
parameters().
get<
bool>(
"use_legacy_material_output"))
508 oss << COLOR_RED <<
"LEGACY MODES ENABLED:" << COLOR_DEFAULT <<
'\n';
509 oss <<
" This application uses the legacy material output option: material properties are "
510 "output only on TIMESTEP_END, not INITIAL. To remove this message, set "
511 "'use_legacy_material_output' to false in this application. If there are gold output "
512 "files that contain material property output for which output occurs on INITIAL, then "
513 "these will generate diffs due to zero values being stored, and these tests should be "
515 << COLOR_DEFAULT << std::endl;
518 if (app.
parameters().
get<
bool>(
"use_legacy_initial_residual_evaluation_behavior"))
520 oss << COLOR_RED <<
"LEGACY MODES ENABLED:" << COLOR_DEFAULT <<
'\n';
521 oss <<
" This application uses the legacy initial residual evaluation behavior. The legacy "
522 "behavior performs an often times redundant residual evaluation before the solution "
523 "modifying objects are executed prior to the initial (0th nonlinear iteration) residual "
524 "evaluation. The new behavior skips that redundant residual evaluation unless the "
525 "parameter Executioner/use_pre_smo_residual is set to true. To remove this message and "
526 "enable the new behavior, set the parameter "
527 "'use_legacy_initial_residual_evaluation_behavior' to false in *App.C. Some tests that "
528 "rely on the side effects of the legacy behavior may fail/diff and should be "
530 << COLOR_DEFAULT << std::endl;
539 std::stringstream oss;
540 oss <<
"Data File Paths:\n";
542 oss <<
" " << name <<
": " << path <<
"\n";
543 return oss.str() +
"\n";
549 std::map<std::string, std::string>
values;
552 const auto & params = object_name_params_pair.second;
553 for (
const auto & name_value_pair : *params)
555 const auto & name = name_value_pair.first;
556 if (
const auto path = params->queryDataFileNamePath(name))
557 if (params->getHitNode(name))
558 values.emplace(params->paramFullpath(name), path->path);
562 std::stringstream oss;
563 oss <<
"Data File Parameters:\n";
564 for (
const auto & [param, value] :
values)
565 oss <<
" " << param <<
" = " << value <<
"\n";
566 return oss.str() +
'\n';
570insertNewline(std::stringstream & oss, std::streampos & begin, std::streampos & curr)
584 std::stringstream stream;
585 std::streampos start = stream.tellp();
587 std::streampos end = stream.tellp();
589 auto formatted_string = stream.str();
591 if (formatted_string.back() ==
'\n')
592 formatted_string.pop_back();
593 return formatted_string;
599 std::string object_names =
"";
603 std::vector<std::string> names;
604 names.reserve(objs.size());
605 for (
const auto & obj : objs)
607 mooseAssert(obj,
"Trying to print a null object");
608 names.push_back(obj->name());
611 object_names = MooseUtils::join(names, sep);
std::array< Real, 2 > values
virtual libMesh::System & system() override
Get the reference to the libMesh system.
std::stringstream checkpointInfo() const
Gathers and records information used later for console output.
Executioners are objects that do the actual work of solving your problem.
virtual std::string getTimeStepperName() const
The name of the TimeStepper This is an empty string for non-Transient executioners.
virtual std::vector< std::string > getTimeIntegratorNames() const
The name of the TimeIntegrator This is an empty string for non-Transient executioners.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
AuxiliarySystem & getAuxiliarySystem()
virtual std::size_t numSolverSystems() const override
virtual std::size_t numNonlinearSystems() const override
bool isSolverSystemNonlinear(const unsigned int sys_num)
Check if the solver system is nonlinear.
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
virtual MooseMesh & mesh() override
const std::vector< NonlinearSystemName > & getNonlinearSystemNames() const
SolverSystem & getSolverSystem(unsigned int sys_num)
Get non-constant reference to a solver system.
const std::vector< SolverSystemName > & getSolverSystemNames() const
virtual std::string solverTypeString(unsigned int solver_sys_num=0)
Return solver type as a human readable string.
Moose::PetscSupport::PetscOptions & getPetscOptions()
Retrieve a writable reference the PETSc options (used by PetscSupport)
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
virtual Moose::FEBackend feBackend() const
Base class for MOOSE-based applications.
const std::vector< std::string > & getInputFileNames() const
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
unsigned int multiAppLevel() const
The MultiApp Level.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo() const
Returns the Relationship managers info suitable for printing.
const SystemInfo & getSystemInfo() const
Get SystemInfo object.
std::shared_ptr< CommandLine > commandLine() const
Get the command line.
InputParameterWarehouse & getInputParameterWarehouse()
Get the InputParameterWarehouse for MooseObjects.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
const std::vector< std::shared_ptr< T > > & getObjects(THREAD_ID tid=0) const
Retrieve complete vector to the all/block/boundary restricted objects for a given thread.
Base class for MOOSE preconditioners.
std::string pc_description
Preconditioner description.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
MoosePreconditioner const * getPreconditioner() const
MooseObjectWarehouseBase< Split > & getSplits()
Retrieves all splits.
A helper warehouse class for storing the "execute_on" settings for the various output types.
std::vector< T * > getOutputs(const std::vector< OutputName > &names)
Return a vector of objects by names.
Based class for output objects.
static const std::map< std::string, std::string > & getDataFilePaths()
Returns a map of all registered data file paths (name -> path)
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::string getInfo() const
processor_id_type n_processors() const
unsigned int n_variables() const
const std::string & name(unsigned int v) const
std::string outputOutputInformation(MooseApp &app)
Output the output information.
std::string outputPreSMOResidualInformation()
Output the information about pre-SMO residual evaluation.
std::string outputLegacyInformation(MooseApp &app)
Output the legacy flag information.
std::string outputMeshInformation(FEProblemBase &problem, bool verbose=true)
Output the mesh information.
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...
static const unsigned int console_line_length
Line length for printing simulation information.
std::string mooseObjectVectorToString(const std::vector< MooseObject * > &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
std::string outputSolverSystemInformation(FEProblemBase &problem, const unsigned int solver_sys_num)
Output a solver system information.
std::string outputAuxiliarySystemInformation(FEProblemBase &problem)
Output the Auxiliary system information.
std::string outputDataFilePaths()
Output the registered data paths for searching.
std::string outputExecutionInformation(const MooseApp &app, FEProblemBase &problem)
Output execution information.
static const unsigned int console_field_width
Width used for printing simulation information.
std::string outputDataFileParams(MooseApp &app)
Output the (param path = value) pairs for each DataFileName parameter.
std::string outputRelationshipManagerInformation(const MooseApp &app)
Output action RelationshipManager information.
std::string outputSystemInformationHelper(libMesh::System &system)
Output system information.
std::string outputFrameworkInformation(const MooseApp &app)
Outputs framework information.
void insertNewline(std::stringstream &oss, std::streampos &begin, std::streampos &curr)
Helper function function for stringstream formatting.
std::string indent(unsigned int spaces)
Create empty string for indenting.
void indentMessage(const std::string &prefix, std::string &message, const char *color, bool indent_first_line, const std::string &post_prefix)
std::string toLower(std::string name)
Convert supplied string to lower case.
std::string underscoreToCamelCase(const std::string &underscore_name, bool leading_upper_case)