10#ifdef MOOSE_KOKKOS_ENABLED
132#include "libmesh/exodusII_io.h"
133#include "libmesh/quadrature.h"
134#include "libmesh/coupling_matrix.h"
135#include "libmesh/nonlinear_solver.h"
136#include "libmesh/sparse_matrix.h"
137#include "libmesh/string_to_enum.h"
138#include "libmesh/fe_interface.h"
139#include "libmesh/enum_norm_type.h"
140#include "libmesh/petsc_solver_exception.h"
142#include "metaphysicl/dualnumber.h"
168 bool have_constraint_rows = !
mesh.get_constraint_rows().empty();
170 mesh.comm().max(have_constraint_rows);
174 bool returnval =
false;
175 if (have_constraint_rows)
177 for (
const auto & elem :
mesh.active_local_element_ptr_range())
185 mesh.comm().max(returnval);
204 es.
parameters.
get<Real>(
"nonlinear solver relative residual tolerance");
220 params.
addParam<
unsigned int>(
"null_space_dimension", 0,
"The dimension of the nullspace");
222 "transpose_null_space_dimension", 0,
"The dimension of the transpose nullspace");
224 "near_null_space_dimension", 0,
"The dimension of the near nullspace");
227 "Whether or not to actually solve the Nonlinear system. "
228 "This is handy in the case that all you want to do is "
229 "execute AuxKernels, Transfers, etc. without actually "
231 params.
addParam<
bool>(
"use_nonlinear",
233 "Determines whether to use a Nonlinear vs a "
234 "Eigenvalue system (Automatically determined based "
236 params.
addParam<
bool>(
"error_on_jacobian_nonzero_reallocation",
237 "This causes PETSc to error if it had to reallocate memory in the Jacobian "
238 "matrix due to not having enough nonzeros");
239 params.
addParam<
bool>(
"ignore_zeros_in_jacobian",
241 "Do not explicitly store zero values in "
242 "the Jacobian matrix if true");
243 params.
addParam<
bool>(
"force_restart",
245 "EXPERIMENTAL: If true, a sub_app may use a "
246 "restart file instead of using of using the master "
250 "True to skip additional data in equation system for restart.",
251 "This parameter is no longer used, as we do not load additional "
252 "vectors by default with restart");
253 params.
addParam<
bool>(
"skip_nl_system_check",
255 "True to skip the NonlinearSystem check for work to do (e.g. Make sure "
256 "that there are variables to solve for).");
257 params.
addParam<
bool>(
"allow_initial_conditions_with_restart",
259 "True to allow the user to specify initial conditions when restarting. "
260 "Initial conditions can override any restarted field");
262 auto coverage_check_description = [](std::string scope, std::string list_param_name)
264 return "Controls, if and how a " + scope +
265 " subdomain coverage check is performed. "
266 "With 'TRUE' or 'ON' all subdomains are checked (the default). Setting 'FALSE' or 'OFF' "
267 "will disable the check for all subdomains. "
268 "To exclude a predefined set of subdomains 'SKIP_LIST' is to "
269 "be used, while the subdomains to skip are to be defined in the parameter '" +
271 "'. To limit the check to a list of subdomains, 'ONLY_LIST' is to "
272 "be used (again, using the parameter '" +
273 list_param_name +
"').";
276 params.
addParam<std::vector<SubdomainName>>(
279 "List of subdomains for kernel coverage and material coverage checks. Setting this parameter "
280 "is equivalent to setting 'kernel_coverage_block_list' and 'material_coverage_block_list' as "
281 "well as using 'ONLY_LIST' as the coverage check mode.");
283 MooseEnum kernel_coverage_check_modes(
"FALSE TRUE OFF ON SKIP_LIST ONLY_LIST",
"TRUE");
285 kernel_coverage_check_modes,
286 coverage_check_description(
"kernel",
"kernel_coverage_block_list"));
287 params.
addParam<std::vector<SubdomainName>>(
288 "kernel_coverage_block_list",
290 "List of subdomains for kernel coverage check. The meaning of this list is controlled by the "
291 "parameter 'kernel_coverage_check' (whether this is the list of subdomains to be checked, "
292 "not to be checked or not taken into account).");
294 "boundary_restricted_node_integrity_check",
296 "Set to false to disable checking of boundary restricted nodal object variable dependencies, "
297 "e.g. are the variable dependencies defined on the selected boundaries?");
298 params.
addParam<
bool>(
"boundary_restricted_elem_integrity_check",
300 "Set to false to disable checking of boundary restricted elemental object "
301 "variable dependencies, e.g. are the variable dependencies defined on the "
302 "selected boundaries?");
304 "side_uo_interface_mat_prop_integrity_check",
306 "Set to false to disable checking that side user objects do not consume material "
307 "properties declared by interface materials on the same boundary.");
308 MooseEnum material_coverage_check_modes(
"FALSE TRUE OFF ON SKIP_LIST ONLY_LIST",
"TRUE");
310 "material_coverage_check",
311 material_coverage_check_modes,
312 coverage_check_description(
"material",
"material_coverage_block_list"));
313 params.
addParam<std::vector<SubdomainName>>(
314 "material_coverage_block_list",
316 "List of subdomains for material coverage check. The meaning of this list is controlled by "
317 "the parameter 'material_coverage_check' (whether this is the list of subdomains to be "
318 "checked, not to be checked or not taken into account).");
320 params.
addParam<
bool>(
"fv_bcs_integrity_check",
322 "Set to false to disable checking of overlapping Dirichlet and Flux BCs "
323 "and/or multiple DirichletBCs per sideset");
326 "fv_face_integrity_check",
328 "Set to false to disable checking that FV flux boundary conditions and FV interface "
329 "kernels are applied to faces with valid variable ownership and interface topology.");
332 "material_dependency_check",
true,
"Set to false to disable material dependency check");
333 params.
addParam<
bool>(
"parallel_barrier_messaging",
335 "Displays messaging from parallel "
336 "barrier notifications when executing "
337 "or transferring to/from Multiapps "
340 "num_concurrent_multiapps",
342 "Set greater than 1 to solve the multiapps sharing an 'execution_order_group' "
343 "concurrently. Each such multiapp is assigned a disjoint subset of the MPI ranks "
344 "(partitioned using their 'min_procs_per_app'/'max_procs_per_app', otherwise evenly), so "
345 "they solve at the same time on different ranks. The specific value only acts as an "
346 "on/off switch; the number that run at once is set by the ranks available.");
348 MooseEnum verbosity(
"false true extra",
"false");
351 "Set to 'true' to have the problem report on any object created. Set "
352 "to 'extra' to also display all parameters.");
353 params.
addParam<
bool>(
"verbose_multiapps",
355 "Set to True to enable verbose screen printing related to MultiApps");
359 "Set to True to enable verbose screen printing related to solution restoration");
361 params.
addParam<FileNameNoExtension>(
"restart_file_base",
362 "File base name used for restart (e.g. "
363 "<path>/<filebase> or <path>/LATEST to "
364 "grab the latest file available)");
366 params.
addParam<std::vector<std::vector<TagName>>>(
369 "Extra vectors to add to the system that can be filled by objects which compute residuals "
370 "and Jacobians (Kernels, BCs, etc.) by setting tags on them. The outer index is for which "
371 "nonlinear system the extra tag vectors should be added for");
373 params.
addParam<std::vector<std::vector<TagName>>>(
374 "not_zeroed_tag_vectors",
376 "Extra vector tags which the sytem will not zero when other vector tags are zeroed. "
377 "The outer index is for which nonlinear system the extra tag vectors should be added for");
379 params.
addParam<std::vector<std::vector<TagName>>>(
380 "extra_tag_matrices",
382 "Extra matrices to add to the system that can be filled "
383 "by objects which compute residuals and Jacobians "
384 "(Kernels, BCs, etc.) by setting tags on them. The outer index is for which "
385 "nonlinear system the extra tag vectors should be added for");
387 params.
addParam<std::vector<TagName>>(
388 "extra_tag_solutions",
390 "Extra solution vectors to add to the system that can be used by "
391 "objects for coupling variable values stored in them.");
393 params.
addParam<
bool>(
"previous_nl_solution_required",
395 "True to indicate that this calculation requires a solution vector for "
396 "storing the previous nonlinear iteration.");
398 params.
addParam<std::vector<NonlinearSystemName>>(
399 "nl_sys_names", std::vector<NonlinearSystemName>{
"nl0"},
"The nonlinear system names");
401 params.
addParam<std::vector<LinearSystemName>>(
"linear_sys_names", {},
"The linear system names");
403 params.
addParam<
bool>(
"check_uo_aux_state",
405 "True to turn on a check that no state presents during the evaluation of "
406 "user objects and aux kernels");
413 "allow_invalid_solution",
415 "Set to true to allow convergence even though the solution has been marked as 'invalid'");
416 params.
addParam<
bool>(
"show_invalid_solution_console",
418 "Set to true to show the invalid solution occurrence summary in console");
419 params.
addParam<
bool>(
"immediately_print_invalid_solution",
421 "Whether or not to report invalid solution warnings at the time the "
422 "warning is produced instead of after the calculation");
425 "identify_variable_groups_in_nl",
427 "Whether to identify variable groups in nonlinear systems. This affects dof ordering");
430 "regard_general_exceptions_as_errors",
432 "If we catch an exception during residual/Jacobian evaluaton for which we don't have "
433 "specific handling, immediately error instead of allowing the time step to be cut");
435 params.
addParam<
bool>(
"use_hash_table_matrix_assembly",
437 "Whether to assemble matrices using hash tables instead of preallocating "
438 "matrix memory. This can be a good option if the sparsity pattern changes "
439 "throughout the course of the simulation.");
441 "restore_original_nonzero_pattern",
442 "Whether we should reset matrix memory for every Jacobian evaluation. This option is useful "
443 "if the sparsity pattern is constantly changing and you are using hash table assembly or if "
444 "you wish to continually restore the matrix to the originally preallocated sparsity pattern "
445 "computed by relationship managers.");
448 "skip_nl_system_check kernel_coverage_check kernel_coverage_block_list "
449 "boundary_restricted_node_integrity_check "
450 "boundary_restricted_elem_integrity_check "
451 "side_uo_interface_mat_prop_integrity_check material_coverage_check "
452 "material_coverage_block_list fv_bcs_integrity_check fv_face_integrity_check "
453 "material_dependency_check check_uo_aux_state error_on_jacobian_nonzero_reallocation",
454 "Simulation checks");
456 "ignore_zeros_in_jacobian identify_variable_groups_in_nl "
457 "use_hash_table_matrix_assembly restore_original_nonzero_pattern",
458 "Nonlinear system(s)");
460 "restart_file_base force_restart allow_initial_conditions_with_restart",
"Restart");
462 "verbose_setup verbose_multiapps verbose_restore parallel_barrier_messaging",
"Verbosity");
464 "null_space_dimension transpose_null_space_dimension near_null_space_dimension",
465 "Null space removal");
467 "extra_tag_vectors extra_tag_matrices extra_tag_solutions not_zeroed_tag_vectors",
468 "Contribution to tagged field data");
470 "allow_invalid_solution show_invalid_solution_console immediately_print_invalid_solution",
471 "Solution validity control");
479 _mesh(*getCheckedPointerParam<
MooseMesh *>(
"mesh")),
481 "equation_systems", nullptr, _mesh)),
483 _solve(getParam<bool>(
"solve")),
485 _time(declareRestartableData<Real>(
"time")),
486 _time_old(declareRestartableData<Real>(
"time_old")),
487 _time_older(declareRestartableData<Real>(
"time_older")),
488 _t_step(declareRecoverableData<
int>(
"t_step")),
489 _dt(declareRestartableData<Real>(
"dt")),
490 _dt_old(declareRestartableData<Real>(
"dt_old")),
491 _need_to_add_default_nonlinear_convergence(false),
492 _need_to_add_default_multiapp_fixed_point_convergence(false),
493 _need_to_add_default_steady_state_convergence(false),
494 _linear_sys_names(getParam<
std::vector<LinearSystemName>>(
"linear_sys_names")),
495 _num_linear_sys(_linear_sys_names.size()),
496 _linear_systems(_num_linear_sys, nullptr),
497 _current_linear_sys(nullptr),
498 _using_default_nl(!isParamSetByUser(
"nl_sys_names")),
499 _nl_sys_names(!_using_default_nl || (_using_default_nl && !_linear_sys_names.size())
500 ? getParam<
std::vector<NonlinearSystemName>>(
"nl_sys_names")
501 :
std::vector<NonlinearSystemName>()),
502 _num_nl_sys(_nl_sys_names.size()),
503 _nl(_num_nl_sys, nullptr),
504 _current_nl_sys(nullptr),
505 _solver_systems(_num_nl_sys + _num_linear_sys, nullptr),
507 _coupling(
Moose::COUPLING_DIAG),
508#ifdef MOOSE_KOKKOS_ENABLED
509 _kokkos_assembly(*this),
511 _mesh_divisions(numThreads()),
512 _functions(numThreads()),
513#ifdef MOOSE_KOKKOS_ENABLED
514 _kokkos_functions(numThreads()),
516 _convergences(numThreads()),
517 _nonlocal_kernels(numThreads()),
518 _nonlocal_integrated_bcs(numThreads()),
520 _fv_ics(numThreads()),
522 "material_props", &_mesh, _material_prop_registry, *this)),
524 "bnd_material_props", &_mesh, _material_prop_registry, *this)),
526 "neighbor_material_props", &_mesh, _material_prop_registry, *this)),
527#ifdef MOOSE_KOKKOS_ENABLED
528 _kokkos_material_props(
530 "kokkos_material_props", &_mesh, _material_prop_registry, *this)),
531 _kokkos_bnd_material_props(
533 "kokkos_bnd_material_props", &_mesh, _material_prop_registry, *this)),
534 _kokkos_neighbor_material_props(
536 "kokkos_neighbor_material_props", &_mesh, _material_prop_registry, *this)),
538 _materials(numThreads()),
539 _interface_materials(numThreads()),
540 _discrete_materials(numThreads()),
541 _all_materials(numThreads()),
542#ifdef MOOSE_KOKKOS_ENABLED
543 _kokkos_materials(numThreads()),
545 _indicators(numThreads()),
546 _internal_side_indicators(numThreads()),
547 _markers(numThreads()),
548 _reporter_data(_app),
549 _multi_apps(_app.getExecuteOnEnum(), numThreads()),
550 _transient_multi_apps(_app.getExecuteOnEnum(), numThreads()),
551 _transfers(_app.getExecuteOnEnum(), 1),
552 _to_multi_app_transfers(_app.getExecuteOnEnum(), 1),
553 _from_multi_app_transfers(_app.getExecuteOnEnum(), 1),
554 _between_multi_app_transfers(_app.getExecuteOnEnum(), 1),
555 _num_concurrent_multiapps(getParam<unsigned
int>(
"num_concurrent_multiapps")),
556#ifdef LIBMESH_ENABLE_AMR
558 _cycles_completed(0),
560 _displaced_mesh(nullptr),
561 _geometric_search_data(*this, _mesh),
563 _reinit_displaced_elem(false),
564 _reinit_displaced_face(false),
565 _reinit_displaced_neighbor(false),
566 _input_file_saved(false),
568 _has_constraints(false),
569 _snesmf_reuse_base(true),
570 _skip_exception_check(false),
571 _snesmf_reuse_base_set_by_user(false),
572 _has_initialized_stateful(false),
573 _const_jacobian(false),
574 _has_jacobian(false),
575 _needs_old_newton_iter(false),
576 _previous_nl_solution_required(getParam<bool>(
"previous_nl_solution_required")),
577 _previous_multiapp_fp_nl_solution_required(_num_nl_sys + _num_linear_sys, false),
578 _previous_multiapp_fp_aux_solution_required(false),
579 _previous_multisystem_fp_nl_solution_required(_num_nl_sys + _num_linear_sys, false),
580 _previous_multisystem_fp_aux_solution_required(false),
581 _has_nonlocal_coupling(false),
582 _calculate_jacobian_in_uo(false),
583 _kernel_coverage_check(
585 _kernel_coverage_blocks(getParam<
std::vector<SubdomainName>>(
"kernel_coverage_block_list")),
586 _boundary_restricted_node_integrity_check(
587 getParam<bool>(
"boundary_restricted_node_integrity_check")),
588 _boundary_restricted_elem_integrity_check(
589 getParam<bool>(
"boundary_restricted_elem_integrity_check")),
590 _side_uo_interface_mat_prop_integrity_check(
591 getParam<bool>(
"side_uo_interface_mat_prop_integrity_check")),
592 _material_coverage_check(
594 _material_coverage_blocks(getParam<
std::vector<SubdomainName>>(
"material_coverage_block_list")),
595 _fv_bcs_integrity_check(getParam<bool>(
"fv_bcs_integrity_check")),
596 _fv_face_integrity_check(getParam<bool>(
"fv_face_integrity_check")),
597 _material_dependency_check(getParam<bool>(
"material_dependency_check")),
598 _uo_aux_state_check(getParam<bool>(
"check_uo_aux_state")),
600 _check_residual_for_nans(false),
602 _max_qps(
std::numeric_limits<unsigned
int>::max()),
603 _max_scalar_order(INVALID_ORDER),
604 _has_time_integrator(false),
605 _has_exception(false),
606 _parallel_barrier_messaging(getParam<bool>(
"parallel_barrier_messaging")),
607 _verbose_setup(getParam<
MooseEnum>(
"verbose_setup")),
608 _verbose_multiapps(getParam<bool>(
"verbose_multiapps")),
609 _verbose_restore(getParam<bool>(
"verbose_restore")),
611 _control_warehouse(_app.getExecuteOnEnum(), 1),
612 _is_petsc_options_inserted(false),
613 _line_search(nullptr),
614 _using_ad_mat_props(false),
615 _current_ic_state(0),
616 _use_hash_table_matrix_assembly(getParam<bool>(
"use_hash_table_matrix_assembly")),
617 _error_on_jacobian_nonzero_reallocation(
618 isParamValid(
"error_on_jacobian_nonzero_reallocation")
619 ? getParam<bool>(
"error_on_jacobian_nonzero_reallocation")
620 : _app.errorOnJacobianNonzeroReallocation()),
621 _restore_original_nonzero_pattern(isParamValid(
"restore_original_nonzero_pattern")
622 ? getParam<bool>(
"restore_original_nonzero_pattern")
623 : _use_hash_table_matrix_assembly),
624 _ignore_zeros_in_jacobian(getParam<bool>(
"ignore_zeros_in_jacobian")),
625 _preserve_matrix_sparsity_pattern(true),
626 _force_restart(getParam<bool>(
"force_restart")),
627 _allow_ics_during_restart(getParam<bool>(
"allow_initial_conditions_with_restart")),
628 _skip_nl_system_check(getParam<bool>(
"skip_nl_system_check")),
629 _fail_next_system_convergence_check(false),
630 _allow_invalid_solution(getParam<bool>(
"allow_invalid_solution")),
631 _show_invalid_solution_console(getParam<bool>(
"show_invalid_solution_console")),
632 _immediately_print_invalid_solution(getParam<bool>(
"immediately_print_invalid_solution")),
633 _started_initial_setup(false),
634 _has_internal_edge_residual_objects(false),
635 _u_dot_requested(false),
636 _u_dotdot_requested(false),
637 _u_dot_old_requested(false),
638 _u_dotdot_old_requested(false),
641 _print_execution_on(),
642 _identify_variable_groups_in_nl(getParam<bool>(
"identify_variable_groups_in_nl")),
643 _regard_general_exceptions_as_errors(getParam<bool>(
"regard_general_exceptions_as_errors")),
644 _requires_nonlocal_coupling(false)
646 auto checkCoverageCheckConflict =
647 [
this](
const std::string & coverage_check,
649 const std::vector<SubdomainName> & coverage_blocks) ->
void
653 if (coverage_blocks.size() > 1)
654 if (std::find(coverage_blocks.begin(), coverage_blocks.end(),
"ANY_BLOCK_ID") !=
655 coverage_blocks.end())
657 "The list of blocks used for ",
659 " cannot contain 'ANY_BLOCK_ID' along with other blocks. ");
662 checkCoverageCheckConflict(
664 checkCoverageCheckConflict(
670 ADReal::do_derivatives =
true;
711 _zero.resize(n_threads);
735 std::string restart_file_base = getParam<FileNameNoExtension>(
"restart_file_base");
742 if (restart_file_base.size())
760#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
779 mooseWarning(
"Displaced mesh was requested but the displaced problem does not exist. "
780 "Regular mesh will be returned");
788 mooseWarning(
"Displaced mesh was requested but the displaced problem does not exist. "
789 "Regular mesh will be returned");
797 auto & vectors = getParam<std::vector<std::vector<TagName>>>(
"extra_tag_vectors");
798 for (
const auto sys_num : index_range(vectors))
799 for (
auto & vector : vectors[sys_num])
805 auto & not_zeroed_vectors = getParam<std::vector<std::vector<TagName>>>(
"not_zeroed_tag_vectors");
806 for (
const auto sys_num : index_range(not_zeroed_vectors))
807 for (
auto & vector : not_zeroed_vectors[sys_num])
818 auto & matrices = getParam<std::vector<std::vector<TagName>>>(
"extra_tag_matrices");
819 for (
const auto sys_num : index_range(matrices))
820 for (
auto & matrix : matrices[sys_num])
827 sys->sizeVariableMatrixData();
828 _aux->sizeVariableMatrixData();
834 for (
auto & vector : getParam<std::vector<TagName>>(
"extra_tag_solutions"))
854 _aux->associateVectorToTag(*
_aux->system().current_local_solution.get(), tag);
861 sys->needSolutionState(state, iteration_type);
862 _aux->needSolutionState(state, iteration_type);
869 bool has_solution_state =
false;
871 has_solution_state |= sys->hasSolutionState(state, iteration_type);
872 has_solution_state |=
_aux->hasSolutionState(state, iteration_type);
873 return has_solution_state;
882 for (
const auto i : make_range(n_threads))
884 _assembly[i].resize(solver_systems.size());
885 for (
const auto j : index_range(solver_systems))
886 _assembly[i][j] = std::make_unique<Assembly>(*solver_systems[j], i);
892 std::vector<std::shared_ptr<NonlinearSystemBase>> & nls)
894 TIME_SECTION(
"initNullSpaceVectors", 5,
"Initializing Null Space Vectors");
896 unsigned int dimNullSpace =
parameters.
get<
unsigned int>(
"null_space_dimension");
897 unsigned int dimTransposeNullSpace =
898 parameters.
get<
unsigned int>(
"transpose_null_space_dimension");
899 unsigned int dimNearNullSpace =
parameters.
get<
unsigned int>(
"near_null_space_dimension");
900 for (
unsigned int i = 0; i < dimNullSpace; ++i)
902 std::ostringstream oss;
906 for (
auto & nl : nls)
910 for (
unsigned int i = 0; i < dimTransposeNullSpace; ++i)
912 std::ostringstream oss;
916 for (
auto & nl : nls)
920 for (
unsigned int i = 0; i < dimNearNullSpace; ++i)
922 std::ostringstream oss;
926 for (
auto & nl : nls)
941 for (
unsigned int i = 0; i < n_threads; i++)
957#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
962 CHKERRABORT(this->
comm().get(), ierr);
971 TIME_SECTION(
"setCoordSystem", 5,
"Setting Coordinate System");
981const ConstElemRange &
986 std::vector<const DofMap *> dof_maps(
es().n_systems());
987 for (
const auto i : make_range(
es().n_systems()))
993 std::make_unique<ConstElemRange>(
_mesh.
getMesh().multi_evaluable_elements_begin(dof_maps),
994 _mesh.
getMesh().multi_evaluable_elements_end(dof_maps));
999const ConstElemRange &
1004 std::vector<const DofMap *> dof_maps(
_nl.size());
1005 for (
const auto i : index_range(dof_maps))
1006 dof_maps[i] = &
_nl[i]->dofMap();
1008 std::make_unique<ConstElemRange>(
_mesh.
getMesh().multi_evaluable_elements_begin(dof_maps),
1009 _mesh.
getMesh().multi_evaluable_elements_end(dof_maps));
1018 TIME_SECTION(
"initialSetup", 2,
"Performing Initial Setup");
1023 mooseError(
"Checkpoint recovery and restart and exodus restart are all mutually exclusive.");
1026 mooseWarning(
"MOOSE may fail to catch an exception when the \"skip_exception_check\" parameter "
1027 "is used. If you receive a terse MPI error during execution, remove this "
1028 "parameter and rerun your simulation");
1043 _aux->initSolutionState();
1049 dof_id_type global_max_var_n_dofs_per_elem = 0;
1053 dof_id_type max_var_n_dofs_per_elem;
1054 dof_id_type max_var_n_dofs_per_node;
1056 TIME_SECTION(
"computingMaxDofs", 3,
"Computing Max Dofs Per Element");
1060 max_var_n_dofs_per_elem = mvndpe.
max();
1065 max_var_n_dofs_per_node = mvndpn.max();
1067 global_max_var_n_dofs_per_elem =
1068 std::max(global_max_var_n_dofs_per_elem, max_var_n_dofs_per_elem);
1072 TIME_SECTION(
"assignMaxDofs", 5,
"Assigning Maximum Dofs Per Elem");
1074 sys.assignMaxVarNDofsPerElem(max_var_n_dofs_per_elem);
1077 displaced_problem->solverSys(i).assignMaxVarNDofsPerElem(max_var_n_dofs_per_elem);
1079 sys.assignMaxVarNDofsPerNode(max_var_n_dofs_per_node);
1081 displaced_problem->solverSys(i).assignMaxVarNDofsPerNode(max_var_n_dofs_per_node);
1086 TIME_SECTION(
"resizingVarValues", 5,
"Resizing Variable Values");
1088 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
1090 _phi_zero[tid].resize(global_max_var_n_dofs_per_elem, std::vector<Real>(
getMaxQps(), 0.));
1111 props->setRecovering();
1113#ifdef MOOSE_KOKKOS_ENABLED
1116 props->setRecovering();
1120 TIME_SECTION(
"restore", 3,
"Restoring from backup");
1150 TIME_SECTION(
"copyingFromExodus", 3,
"Copying Variables From Exodus");
1153 sys->copyVars(*reader);
1154 _aux->copyVars(*reader);
1159 mooseError(
"Need Exodus reader to restart variables but the reader is not available\n"
1160 "Use either FileMesh with an Exodus mesh file or FileMeshGenerator with an "
1161 "Exodus mesh file and with use_for_exodus_restart equal to true");
1177 mooseError(
"Stateful neighbor material properties do not work with mesh adaptivity");
1193 "Doing extra refinements when restarting is NOT supported for sub-apps of a MultiApp");
1203 TIME_SECTION(
"convergenceInitialSetup", 5,
"Initializing Convergence objects");
1211 std::set<std::string> depend_objects_aux =
_aux->getDependObjects();
1213 std::map<int, std::vector<UserObjectBase *>> group_userobjs;
1217 std::vector<UserObjectBase *> userobjs;
1222 for (
auto obj : userobjs)
1223 group_userobjs[obj->
getParam<
int>(
"execution_order_group")].push_back(obj);
1225#ifdef MOOSE_KOKKOS_ENABLED
1229 std::vector<UserObjectBase *> userobjs;
1234 for (
auto obj : userobjs)
1235 group_userobjs[obj->
getParam<
int>(
"execution_order_group")].push_back(obj);
1239 for (
auto & [group, objs] : group_userobjs)
1240 for (auto obj : objs)
1253 TIME_SECTION(
"initializingFunctions", 5,
"Initializing Functions");
1263#ifdef MOOSE_KOKKOS_ENABLED
1269 TIME_SECTION(
"initializingRandomObjects", 5,
"Initializing Random Objects");
1281 TIME_SECTION(
"ICinitialSetup", 5,
"Setting Up Initial Conditions");
1298 TIME_SECTION(
"materialInitialSetup", 3,
"Setting Up Materials");
1319#ifdef MOOSE_KOKKOS_ENABLED
1324 TIME_SECTION(
"computingInitialStatefulProps", 3,
"Computing Initial Material Values");
1331#ifdef MOOSE_KOKKOS_ENABLED
1346 props->setRestartInPlace();
1347 props->setRecovering();
1358#ifdef LIBMESH_ENABLE_AMR
1364 mooseError(
"Cannot perform initial adaptivity during restart on sub-apps of a MultiApp!");
1380 unsigned short ic_state_max = 0;
1382 auto findMax = [&ic_state_max](
const auto & obj_list)
1384 for (
auto ic : obj_list.getActiveObjects())
1385 ic_state_max =
std::
max(ic_state_max, ic->getState());
1392 if (ic_state_max > 0)
1396 std::vector<std::unique_ptr<NumericVector<Real>>> state0_sys_buffers(
_solver_systems.size());
1397 std::unique_ptr<NumericVector<Real>> state0_aux_buffer;
1403 state0_aux_buffer =
_aux->solutionState(0).clone();
1424 _aux->solutionState(0) = *state0_aux_buffer;
1425 _aux->solutionState(0).close();
1441 _aux->initialSetup();
1448 sys->setSolution(*(sys->system().current_local_solution.
get()));
1478 const auto & tis = sys->getTimeIntegrators();
1481 TIME_SECTION(
"timeIntegratorInitialSetup", 5,
"Initializing Time Integrator");
1482 for (
auto & ti : tis)
1493 TIME_SECTION(
"initialSetupMultiApps", 2,
"Initializing MultiApps",
false);
1502 TIME_SECTION(
"initialSetupTransfers", 2,
"Initializing Transfers");
1508 for (
const auto & transfer : to_multi_app_objects)
1511 transfer->initialSetup();
1516 for (
const auto & transfer : from_multi_app_objects)
1519 transfer->initialSetup();
1524 for (
const auto & transfer : between_multi_app_objects)
1527 transfer->initialSetup();
1533 TIME_SECTION(
"BoundaryRestrictedNodeIntegrityCheck", 5);
1541 for (
auto & nl :
_nl)
1543 const auto & nodal_bcs = nl->getNodalBCWarehouse();
1544 if (!nodal_bcs.hasBoundaryObjects())
1547 for (
const auto & bnode : bnd_nodes)
1549 const auto boundary_id = bnode->_bnd_id;
1550 const Node *
const node = bnode->_node;
1552 if (node->processor_id() != this->processor_id())
1558 if (!nodal_bcs.hasBoundaryObjects(boundary_id))
1561 const auto & bnd_objects = nodal_bcs.getBoundaryObjects(boundary_id);
1562 for (
const auto & bnd_object : bnd_objects)
1564 const auto & bnd_variable = bnd_object->variable();
1569 if (!bnd_object->requiresGeometricSearch() &&
1570 bnd_object->checkVariableBoundaryIntegrity() &&
1571 node->n_dofs(nl->number(), bnd_variable.number()))
1573 std::set<MooseVariableFieldBase *> vars_to_omit = {
1574 &cast_ref<MooseVariableFieldBase &>(
const_cast<MooseVariableBase &
>(bnd_variable))};
1577 *bnd_object, bnd_object->checkAllVariables(*node, vars_to_omit), bnd_name);
1586 TIME_SECTION(
"BoundaryRestrictedElemIntegrityCheck", 5);
1596 TIME_SECTION(
"FVFaceIntegrityCheck", 5);
1598 auto check_fv_face_integrity = [
this](
MooseMesh & fv_mesh,
const bool on_displaced)
1603 .condition<AttribDisplaced>(on_displaced)
1610 .condition<AttribDisplaced>(on_displaced)
1613 interface_kernel_base_query);
1615 std::vector<FVFluxBC *> flux_bcs;
1616 std::vector<FVInterfaceKernel *> interface_kernels;
1623 for (
const auto boundary_id : fi.boundaryIDs())
1625 auto boundary_key = std::make_tuple(boundary_id,
false);
1627 flux_bc_query.queryInto(flux_bcs, boundary_key);
1628 for (
const auto *
const flux_bc : flux_bcs)
1629 if (flux_bc->checkVariableBoundaryIntegrity())
1630 flux_bc->checkFaceIntegrity(fi);
1632 interface_kernel_query.queryInto(interface_kernels, boundary_key);
1633 for (
const auto *
const interface_kernel : interface_kernels)
1634 interface_kernel->checkFaceIntegrity(fi);
1640 check_fv_face_integrity(
mesh(),
false);
1650 mooseError(
"failed to converge initial MultiApp");
1683 TIME_SECTION(
"computeMaterials", 2,
"Computing Initial Material Properties");
1687#ifdef MOOSE_KOKKOS_ENABLED
1692 TIME_SECTION(
"computeMaterials", 2,
"Computing Initial Material Properties");
1704 for (
unsigned int tid = 0; tid <
n_threads; tid++)
1722 TIME_SECTION(
"lineSearchInitialSetup", 5,
"Initializing Line Search");
1744 "\" has the same name as a scalar variable in the system.");
1755 std::unique_ptr<libMesh::MeshRefinement> displaced_mesh_refinement(
nullptr);
1757 displaced_mesh_refinement = std::make_unique<libMesh::MeshRefinement>(*
_displaced_mesh);
1773 displaced_mesh_refinement->uniformly_coarsen();
1816 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
1822#ifdef MOOSE_KOKKOS_ENABLED
1826 _aux->timestepSetup();
1828 sys->timestepSetup();
1834 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
1841 std::vector<UserObject *> userobjs;
1843 for (
auto obj : userobjs)
1844 obj->timestepSetup();
1846#ifdef MOOSE_KOKKOS_ENABLED
1848 std::vector<UserObjectBase *> userobjs;
1850 for (
auto obj : userobjs)
1851 obj->timestepSetup();
1866 if (
_max_qps == std::numeric_limits<unsigned int>::max())
1880 TIME_SECTION(
"checkNonlocalCoupling", 5,
"Checking Nonlocal Coupling");
1883 for (
auto & nl :
_nl)
1885 const auto & all_kernels = nl->getKernelWarehouse();
1886 const auto & kernels = all_kernels.getObjects(tid);
1887 for (
const auto & kernel : kernels)
1889 std::shared_ptr<NonlocalKernel> nonlocal_kernel =
1890 std::dynamic_pointer_cast<NonlocalKernel>(kernel);
1891 if (nonlocal_kernel)
1899 nl->getIntegratedBCWarehouse();
1900 const auto & integrated_bcs = all_integrated_bcs.
getObjects(tid);
1901 for (
const auto & integrated_bc : integrated_bcs)
1903 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
1904 std::dynamic_pointer_cast<NonlocalIntegratedBC>(integrated_bc);
1905 if (nonlocal_integrated_bc)
1918 std::set<const MooseVariableFEBase *> uo_jacobian_moose_vars;
1920 std::vector<ShapeElementUserObject *> objs;
1924 .condition<AttribThread>(tid)
1927 for (
const auto & uo : objs)
1930 const auto & mv_deps = uo->jacobianMooseVariables();
1931 uo_jacobian_moose_vars.insert(mv_deps.begin(), mv_deps.end());
1935 std::vector<ShapeSideUserObject *> objs;
1939 .condition<AttribThread>(tid)
1941 for (
const auto & uo : objs)
1944 const auto & mv_deps = uo->jacobianMooseVariables();
1945 uo_jacobian_moose_vars.insert(mv_deps.begin(), mv_deps.end());
1957 for (
unsigned int i = 0; i < moose_vars.size(); ++i)
1959 VariableName var_name = moose_vars[i]->name();
1961 sys->setVariableGlobalDoFs(var_name);
1979 _assembly[tid][i]->prepareJacobianBlock();
2002 for (
auto & nl :
_nl)
2003 nl->prepareFace(tid,
true);
2004 _aux->prepareFace(tid,
false);
2014 const std::vector<dof_id_type> & dof_indices,
2017 for (
const auto i : index_range(
_nl))
2020 _nl[i]->prepare(tid);
2025 _assembly[tid][current_nl_sys_num]->prepareBlock(ivar, jvar, dof_indices);
2030 _assembly[tid][current_nl_sys_num]->prepareBlockNonlocal(
2052 _assembly[tid][i]->setCurrentSubdomainID(did);
2062 SubdomainID did = elem->neighbor_ptr(side)->subdomain_id();
2063 for (
const auto i : index_range(
_nl))
2065 _assembly[tid][i]->setCurrentNeighborSubdomainID(did);
2076 for (
const auto i : index_range(
_nl))
2078 _assembly[tid][i]->setCurrentNeighborSubdomainID(did);
2182 std::vector<VectorTag> extra_residual_vector_tags;
2187 if (vector_tag._id != time_tag && vector_tag._id != non_time_tag)
2188 extra_residual_vector_tags.push_back(vector_tag);
2195 extra_residual_vector_tags);
2304 const DofMap & dof_map,
2305 std::vector<dof_id_type> & dof_indices,
2306 const std::set<TagID> & tags,
2329 _displaced_problem->addJacobianBlockTags(jacobian, ivar, jvar, dof_map, dof_indices, tags, tid);
2335 jacobian, ivar, jvar, dof_map, dof_indices, jv.
allDofIndices(), tags, tid);
2344 const DofMap & dof_map,
2345 std::vector<dof_id_type> & dof_indices,
2346 std::vector<dof_id_type> & neighbor_dof_indices,
2347 const std::set<TagID> & tags,
2355 neighbor_dof_indices,
2360 jacobian, ivar, jvar, dof_map, dof_indices, neighbor_dof_indices, tags, tid);
2399 TIME_SECTION(
"ghostGhostedBoundaries", 3,
"Ghosting Ghosted Boundaries");
2411 "This function is deprecated and no longer performs any function. Please do not call it."));
2419 unsigned int n_points = points.size();
2432 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
2436 _zero[tid].resize(max_qpts, 0);
2437 _grad_zero[tid].resize(max_qpts, RealGradient(0.));
2444 for (
const auto i : index_range(
_nl))
2446 _assembly[tid][i]->reinitAtPhysical(elem, points);
2447 _nl[i]->prepare(tid);
2458 bool have_points = n_points > 0;
2473 sys->reinitElem(elem, tid);
2474 _aux->reinitElem(elem, tid);
2482 const std::vector<Point> & phys_points_in_elem,
2486 "Are you calling this method with a displaced mesh element?");
2490 _assembly[tid][i]->reinitAtPhysical(elem, phys_points_in_elem);
2503 const unsigned int side,
2508 "reinitElemFace with a BoundaryID argument is deprecated because the boundary id was never "
2509 "used. Please call reinitElemFace without the BoundaryID argument instead");
2522 _aux->reinitElemFace(elem, side, tid);
2531 const std::vector<Point> *
const pts,
2532 const std::vector<Real> *
const weights)
2547 for (
const auto i : index_range(
_nl))
2550 _nl[i]->reinitNode(node, tid);
2552 _aux->reinitNode(node, tid);
2561 for (
const auto i : index_range(
_nl))
2564 _nl[i]->reinitNodeFace(node, bnd_id, tid);
2566 _aux->reinitNodeFace(node, bnd_id, tid);
2572 TIME_SECTION(
"reinitScalars", 3,
"Reinitializing Scalar Variables");
2577 for (
auto & nl :
_nl)
2578 nl->reinitScalars(tid, reinit_for_derivative_reordering);
2579 _aux->reinitScalars(tid, reinit_for_derivative_reordering);
2599 const Elem * neighbor = elem->neighbor_ptr(side);
2600 unsigned int neighbor_side = neighbor->which_neighbor_am_i(elem);
2602 for (
const auto i : index_range(
_nl))
2604 _assembly[tid][i]->reinitElemAndNeighbor(elem, side, neighbor, neighbor_side);
2605 _nl[i]->prepareNeighbor(tid);
2609 _aux->prepareNeighbor(tid);
2611 for (
auto & nl :
_nl)
2613 nl->reinitElemFace(elem, side, tid);
2614 nl->reinitNeighborFace(neighbor, neighbor_side, tid);
2616 _aux->reinitElemFace(elem, side, tid);
2617 _aux->reinitNeighborFace(neighbor, neighbor_side, tid);
2626 const auto & displaced_ref_pts =
_assembly[tid][0]->qRuleNeighbor()->get_points();
2646 auto & neighbor =
_assembly[tid][0]->neighbor();
2647 auto & neighbor_side =
_assembly[tid][0]->neighborSide();
2649 if (lower_d_elem_neighbor &&
2652 auto qps =
_assembly[tid][0]->qPointsFaceNeighbor().stdVector();
2653 std::vector<Point> reference_points;
2655 lower_d_elem_neighbor->dim(), lower_d_elem_neighbor, qps, reference_points);
2667 unsigned int neighbor_side,
2668 const std::vector<Point> & physical_points,
2672 "Are you calling this method with a displaced mesh element?");
2674 for (
const auto i : index_range(
_nl))
2677 _assembly[tid][i]->reinitNeighborAtPhysical(neighbor, neighbor_side, physical_points);
2680 _nl[i]->prepareNeighbor(tid);
2682 _aux->prepareNeighbor(tid);
2688 for (
auto & nl :
_nl)
2689 nl->reinitNeighborFace(neighbor, neighbor_side, tid);
2690 _aux->reinitNeighborFace(neighbor, neighbor_side, tid);
2695 const std::vector<Point> & physical_points,
2699 "Are you calling this method with a displaced mesh element?");
2701 for (
const auto i : index_range(
_nl))
2704 _assembly[tid][i]->reinitNeighborAtPhysical(neighbor, physical_points);
2707 _nl[i]->prepareNeighbor(tid);
2709 _aux->prepareNeighbor(tid);
2715 for (
auto & nl :
_nl)
2716 nl->reinitNeighbor(neighbor, tid);
2717 _aux->reinitNeighbor(neighbor, tid);
2728 std::set<const Elem *> displaced_elements;
2733 for (
const auto & elem : displaced_elements)
2756 for (
auto & nl :
_nl)
2757 nl->subdomainSetup(subdomain, tid);
2771 const std::string & name,
2774#ifdef MOOSE_KOKKOS_ENABLED
2779 parallel_object_only();
2796 mooseError(
"Unrecognized function functor type");
2802 const std::string & name,
2805 parallel_object_only();
2817 const std::string class_name =
"DefaultNonlinearConvergence";
2821 params.
set<
bool>(
"added_as_default") =
true;
2829 const std::string class_name =
"DefaultMultiAppFixedPointConvergence";
2833 params.
set<
bool>(
"added_as_default") =
true;
2840 const std::string class_name =
"DefaultSteadyStateConvergence";
2844 params.
set<
bool>(
"added_as_default") =
true;
2864 std::istringstream ss(
name);
2868 if (ss >> real_value && ss.eof())
2871 params.
set<Real>(
"value") = real_value;
2872 addFunction(
"ConstantFunction", ss.str(), params);
2877 std::string
vars =
"x,y,z,t,NaN,pi,e";
2882 params.
set<std::string>(
"expression") =
name;
2890 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_function"),
2891 "getFunction() was called before Functions have been constructed. The requested "
2893 name +
"' may exist in the input file, but Functions are not available yet.");
2917 mooseError(
"The Convergence object '",
name,
"' does not exist.");
2922const std::vector<std::shared_ptr<Convergence>> &
2930 const std::string & name,
2933 parallel_object_only();
2948 mooseError(
"No MeshDivision object named ",
name,
" of appropriate type");
2961 mooseDeprecated(
"FEProblemBase::getNonlinearSystem() is deprecated, please use "
2962 "FEProblemBase::getNonlinearSystemBase() \n");
2964 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
2965 auto nl_sys = std::dynamic_pointer_cast<NonlinearSystem>(
_nl[sys_num]);
2975 const std::string & name,
2985 std::vector<Distribution *> objs;
2989 .condition<AttribName>(
name)
2991 return !objs.empty();
2997 std::vector<Distribution *> objs;
3001 .condition<AttribName>(
name)
3005 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_distribution"),
3006 "A Distribution getter was called before Distributions have been constructed. "
3007 "If you are attempting to access this object in the constructor of another object "
3008 "then make sure that the Distribution is constructed before the object using it.");
3009 mooseError(
"Unable to find Distribution with name '" +
name +
"'");
3016 const std::string & name,
3020 for (
auto & sampler : samplers)
3027 std::vector<Sampler *> objs;
3031 .condition<AttribThread>(tid)
3036 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_sampler"),
3037 "A Sampler getter was called before Samplers have been constructed. "
3038 "If you are attempting to access this object in the constructor of another object "
3039 "then make sure that the Sampler is constructed before the object using it.");
3042 "Unable to find Sampler with name '" +
name +
3043 "', if you are attempting to access this object in the constructor of another object then "
3044 "make sure that the Sampler is constructed before the object using it.");
3051 const FEType & type,
3053 const std::set<SubdomainID> *
const active_subdomains)
3055 std::set<SubdomainID> subdomainIDs;
3056 if (active_subdomains->size() == 0)
3059 subdomainIDs.insert(subdomains.begin(), subdomains.end());
3062 subdomainIDs.insert(active_subdomains->begin(), active_subdomains->end());
3068 std::string error_prefix =
"";
3071 curr_sys_ptr =
_aux.get();
3072 other_sys_ptr = sys.get();
3073 error_prefix =
"aux";
3077 mooseError(
"Cannot have an auxiliary variable and a solver variable with the same name: ",
3087 mooseError(
"Mismatching types are specified for ",
3089 "variable with name '",
3101 std::set<SubdomainID> varSubdomainIDs;
3102 if (varActiveSubdomains.size() == 0)
3105 varSubdomainIDs.insert(subdomains.begin(), subdomains.end());
3108 varSubdomainIDs.insert(varActiveSubdomains.begin(), varActiveSubdomains.end());
3112 const auto isSubset = std::includes(varSubdomainIDs.begin(),
3113 varSubdomainIDs.end(),
3114 subdomainIDs.begin(),
3115 subdomainIDs.end());
3120 const auto stringifySubdomains = [
this](std::set<SubdomainID> subdomainIDs)
3122 std::stringstream s;
3123 for (
auto const i : subdomainIDs)
3131 if (subdomainName.empty())
3134 s << subdomainName <<
" (" << i <<
")";
3139 const std::string msg =
"Mismatching block-restrictions are specified for " +
3140 error_prefix +
"variable with name '" + var_name +
"': {" +
3141 stringifySubdomains(varSubdomainIDs) +
"} and {" +
3142 stringifySubdomains(subdomainIDs) +
"}";
3157 const std::string & var_name,
3160 parallel_object_only();
3164 const auto active_subdomains_vector =
3166 const std::set<SubdomainID> active_subdomains(active_subdomains_vector.begin(),
3167 active_subdomains_vector.end());
3174 SolverSystemName sys_name = params.
get<SolverSystemName>(
"solver_sys");
3176 const auto solver_system_number =
solverSysNum(sys_name);
3177 logAdd(
"Variable", var_name, var_type, params);
3178 _solver_systems[solver_system_number]->addVariable(var_type, var_name, params);
3186std::pair<bool, unsigned int>
3188 const bool error_if_not_found)
const
3195 "If the variable is in our FEProblem solver system map, then it must be in the "
3196 "solver system we expect");
3197 else if (error_if_not_found)
3199 if (
_aux->hasVariable(var_name) ||
_aux->hasScalarVariable(var_name))
3202 " found. Did you specify an auxiliary variable when you meant to specify a "
3203 "solver variable?");
3207 "'. It does not exist in the solver system(s) or auxiliary system");
3215 const std::string & name,
3217 const unsigned int nl_sys_num,
3218 const std::string & base_name,
3219 bool & reinit_displaced)
3225 reinit_displaced =
true;
3248 const std::string & name,
3250 const std::string & base_name)
3257 if (!
parameters.
get<std::vector<BoundaryName>>(
"boundary").empty())
3284 const std::string & name,
3287#ifdef MOOSE_KOKKOS_ENABLED
3292 parallel_object_only();
3295 mooseError(
"You are trying to add a Kernel to a linear variable/system, which is not "
3296 "supported at the moment!");
3305 const std::string & name,
3308 parallel_object_only();
3311 mooseError(
"You are trying to add a HDGKernel to a linear variable/system, which is not "
3312 "supported at the moment!");
3321 const std::string & name,
3324#ifdef MOOSE_KOKKOS_ENABLED
3329 parallel_object_only();
3359 const std::string & name,
3362 parallel_object_only();
3366 mooseError(
"You are trying to add a ScalarKernel to a linear variable/system, which is not "
3367 "supported at the moment!");
3396 const std::string & name,
3399#ifdef MOOSE_KOKKOS_ENABLED
3404 parallel_object_only();
3409 "You are trying to add a BoundaryCondition to a linear variable/system, which is not "
3410 "supported at the moment!");
3419 const std::string & name,
3422 parallel_object_only();
3426 auto determine_var_param_name = [&
parameters,
this]()
3435 if (!has_secondary_var && !has_primary_var)
3437 "Either a 'secondary_variable' or 'primary_variable' parameter must be supplied for '",
3440 return has_secondary_var ?
"secondary_variable" :
"primary_variable";
3444 const auto nl_sys_num =
3447 mooseError(
"You are trying to add a Constraint to a linear variable/system, which is not "
3448 "supported at the moment!");
3472 const std::string & var_name,
3475 parallel_object_only();
3479 const auto active_subdomains_vector =
3481 const std::set<SubdomainID> active_subdomains(active_subdomains_vector.begin(),
3482 active_subdomains_vector.end());
3490 logAdd(
"AuxVariable", var_name, var_type, params);
3491 _aux->addVariable(var_type, var_name, params);
3499 const std::string & var_name,
3507 const FEType & type,
3508 const std::set<SubdomainID> *
const active_subdomains)
3510 parallel_object_only();
3512 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3517 std::string var_type;
3518 if (
type.order == CONSTANT &&
type.family == MONOMIAL && !
type.p_refinement)
3519 var_type =
"MooseVariableConstMonomial";
3520 else if (
type.family == SCALAR)
3521 var_type =
"MooseVariableScalar";
3523 var_type =
"VectorMooseVariable";
3525 var_type =
"MooseVariable";
3532 params.
set<
bool>(
"p_refinement") =
type.p_refinement;
3534 if (active_subdomains)
3536 params.set<
std::vector<SubdomainName>>(
"block").push_back(
Moose::stringify(id));
3538 logAdd(
"AuxVariable", var_name, var_type, params);
3539 _aux->addVariable(var_type, var_name, params);
3546 const FEType & type,
3547 unsigned int components,
3548 const std::set<SubdomainID> *
const active_subdomains)
3550 parallel_object_only();
3552 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3562 params.
set<
bool>(
"p_refinement") =
type.p_refinement;
3563 params.
set<
unsigned int>(
"components") = components;
3565 if (active_subdomains)
3569 logAdd(
"Variable", var_name,
"ArrayMooseVariable", params);
3570 _aux->addVariable(
"ArrayMooseVariable", var_name, params);
3579 const std::set<SubdomainID> *
const active_subdomains)
3581 parallel_object_only();
3583 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3588 FEType
type(order, SCALAR);
3598 params.
set<std::vector<Real>>(
"scaling") = std::vector<Real>{1};
3599 if (active_subdomains)
3603 logAdd(
"ScalarVariable", var_name,
"MooseVariableScalar", params);
3604 _aux->addVariable(
"MooseVariableScalar", var_name, params);
3611 const std::string & name,
3614#ifdef MOOSE_KOKKOS_ENABLED
3619 parallel_object_only();
3628 const std::string & name,
3631 parallel_object_only();
3660 const std::string & name,
3663 parallel_object_only();
3667 mooseError(
"You are trying to add a DiracKernel to a linear variable/system, which is not "
3668 "supported at the moment!");
3700 const std::string & name,
3703 parallel_object_only();
3707 mooseError(
"You are trying to add a DGKernel to a linear variable/system, which is not "
3708 "supported at the moment!");
3740 const std::string & name,
3754 const std::string & name,
3762 const std::string & name,
3767 addObject<FVInterfaceKernel>(
3773 const std::string & name,
3776#ifdef MOOSE_KOKKOS_ENABLED
3786 const std::string & name,
3789#ifdef MOOSE_KOKKOS_ENABLED
3801 const std::string & name,
3804 parallel_object_only();
3808 mooseError(
"You are trying to add a InterfaceKernel to a linear variable/system, which is not "
3809 "supported at the moment!");
3841 const std::string & name,
3842 const VariableName & var_name)
3846 std::string restart_method =
"";
3849 "a checkpoint restart, by IC object '" + ic_name +
"' for variable '" +
name +
"'";
3855 restarted_vars.insert(restarted_vars.end(), nodal_vars.begin(), nodal_vars.end());
3856 restarted_vars.insert(restarted_vars.end(), global_vars.begin(), global_vars.end());
3858 if (std::find(restarted_vars.begin(), restarted_vars.end(), var_name) != restarted_vars.end())
3859 restart_method =
"an Exodus restart, by IC object '" + ic_name +
"' for variable '" +
name +
3860 "' that is also being restarted";
3862 if (!restart_method.empty())
3864 "Initial conditions have been specified during ",
3866 ".\nThis is only allowed if you specify 'allow_initial_conditions_with_restart' to "
3867 "the [Problem], as initial conditions can override restarted fields");
3873 const std::string & name,
3876 parallel_object_only();
3880 const std::string & var_name =
parameters.
get<VariableName>(
"variable");
3895 std::shared_ptr<InitialConditionBase> ic;
3907 mooseError(
"Your FE variable in initial condition ",
3909 " must be either of scalar or vector type");
3920 std::shared_ptr<ScalarInitialCondition> ic =
3928 "Variable '", var_name,
"' requested in initial condition '",
name,
"' does not exist.");
3933 const std::string & name,
3936 parallel_object_only();
3940 const std::string & var_name =
parameters.
get<VariableName>(
"variable");
3955 std::shared_ptr<FVInitialConditionBase> ic;
3960 "Your variable for an FVInitialCondition needs to be an a finite volume variable!");
3967 "' requested in finite volume initial condition '",
3969 "' does not exist.");
3975 TIME_SECTION(
"projectSolution", 2,
"Projecting Initial Solutions")
3984 using ElemInfoRange = StoredRange<MooseMesh::const_elem_info_iterator, const ElemInfo *>;
3992 for (
auto & nl :
_nl)
3993 nl->solution().close();
3994 _aux->solution().close();
4000 for (
auto & nl :
_nl)
4001 nl->solution().close();
4002 _aux->solution().close();
4010 for (
const auto & ic : ics)
4015 DenseVector<Number> vals(var.
order());
4018 const unsigned int n_scalar_dofs = var.
dofIndices().size();
4019 for (
unsigned int i = 0; i < n_scalar_dofs; i++)
4021 const auto global_index = var.
dofIndices()[i];
4029 bool solve_for_spline_dofs = shouldSolveForSplineDofs(
_mesh.
getMesh());
4034 if (solve_for_spline_dofs)
4035 solveForSplineDofs(*sys);
4039 _aux->solution().close();
4040 if (solve_for_spline_dofs)
4041 solveForSplineDofs(*
_aux);
4042 _aux->solution().localize(*
_aux->sys().current_local_solution,
_aux->dofMap().get_send_list());
4047 ConstElemRange & elem_range,
4049 const std::optional<std::set<VariableName>> & target_vars)
4063 for (
auto & nl :
_nl)
4064 nl->solution().close();
4065 _aux->solution().close();
4078 for (
auto & nl :
_nl)
4079 nl->solution().close();
4080 _aux->solution().close();
4088 for (
const auto & ic : ics)
4092 if (target_vars && !target_vars->count(var.
name()))
4097 DenseVector<Number> vals(var.
order());
4100 const unsigned int n_scalar_dofs = var.
dofIndices().size();
4101 for (
unsigned int i = 0; i < n_scalar_dofs; i++)
4103 const auto global_index = var.
dofIndices()[i];
4111 bool solve_for_spline_dofs = shouldSolveForSplineDofs(
_mesh.
getMesh());
4113 for (
auto & nl :
_nl)
4115 nl->solution().close();
4116 if (solve_for_spline_dofs)
4117 solveForSplineDofs(*nl);
4118 nl->solution().localize(*nl->system().current_local_solution, nl->dofMap().get_send_list());
4121 _aux->solution().close();
4122 if (solve_for_spline_dofs)
4123 solveForSplineDofs(*
_aux);
4124 _aux->solution().localize(*
_aux->sys().current_local_solution,
_aux->dofMap().get_send_list());
4129 Number (*func)(
const Point &,
4131 const std::string &,
4132 const std::string &),
4133 Gradient (*func_grad)(
const Point &,
4135 const std::string &,
4136 const std::string &),
4138 const std::vector<VariableName> & target_vars)
4141 "We're performing a projection based on data from just the thread 0 variable, so any "
4142 "modifications to the variable solution must have been thread joined already");
4144 std::unordered_map<unsigned int, std::vector<unsigned int>> sys_to_var_nums;
4146 for (
const auto & target_var : target_vars)
4150 sys_to_var_nums[sn].push_back(var.number());
4153 for (
const auto & [sys_num, var_nums] : sys_to_var_nums)
4156 libmesh_sys.
project_solution(func, func_grad, params, elem_range, var_nums);
4160std::shared_ptr<MaterialBase>
4169 name +=
"_neighbor";
4182 "), but its compute flag is set to true. This indicates that MOOSE is "
4183 "computing this property which may not be desired and produce un-expected "
4212 mooseError(
"FEProblemBase::getMaterialData(): Invalid MaterialDataType ",
type);
4215const std::set<const MooseObject *> &
4230 mooseError(
"FEProblemBase::getMaterialPropertyStorageConsumers(): Invalid MaterialDataType ",
4239 "ignore_zeros_in_jacobian",
4240 "We likely cannot preserve the sparsity pattern if ignoring zeros in the Jacobian, which "
4241 "leads to removing those entries from the Jacobian sparsity pattern");
4254 const std::string & name,
4257 parallel_object_only();
4259 auto add_functor_materials = [&](
const auto &
parameters,
const auto &
name)
4264 std::shared_ptr<MaterialBase> material =
4278 add_functor_materials(disp_params,
name +
"_displaced");
4284 const std::string & name,
4287#ifdef MOOSE_KOKKOS_ENABLED
4297 const std::string & name,
4305 const std::string & mat_name,
4306 const std::string & name,
4309 parallel_object_only();
4333#ifdef MOOSE_KOKKOS_ENABLED
4338 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
4341 std::shared_ptr<MaterialBase> material =
4344 bool discrete = !material->getParam<
bool>(
"compute");
4348 if (material->boundaryRestricted() ||
dynamic_cast<FunctorMaterial *
>(material.get()))
4354 for (
auto && warehouse : warehouses)
4355 warehouse->addObject(material, tid);
4367 std::string object_name;
4376 object_name =
name +
"_face";
4377 std::shared_ptr<MaterialBase> face_material =
4383 current_parameters.
set<
bool>(
"_neighbor") =
true;
4384 object_name =
name +
"_neighbor";
4385 std::shared_ptr<MaterialBase> neighbor_material =
4394 for (
auto && warehouse : warehouses)
4395 warehouse->addObjects(material, neighbor_material, face_material, tid);
4400 const auto param_names =
4405 for (
const auto & p_name : param_names)
4408 p_name.parameter());
4410 p_name.parameter());
4412 p_name.parameter());
4414 primary_name, face_name,
false);
4416 primary_name, neighbor_name,
false);
4427 std::set<MooseVariableFEBase *> needed_moose_vars;
4428 std::unordered_set<unsigned int> needed_mat_props;
4437 for (
const auto id : ids)
4444 needed_moose_vars.insert(current_active_elemental_moose_variables.begin(),
4445 current_active_elemental_moose_variables.end());
4447 needed_mat_props.insert(consumer_needed_mat_props.begin(), consumer_needed_mat_props.end());
4458 auto && elem =
_assembly[tid][0]->elem();
4459 unsigned int n_points =
_assembly[tid][0]->qRule()->n_points();
4462 material_data.
resize(n_points);
4466 material_data.swap(*elem);
4479 const bool swap_stateful,
4480 const std::deque<MaterialBase *> *
const reinit_mats)
4486 auto && elem =
_assembly[tid][0]->elem();
4487 unsigned int side =
_assembly[tid][0]->side();
4488 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4491 bnd_material_data.
resize(n_points);
4493 if (swap_stateful && !bnd_material_data.isSwapped())
4494 bnd_material_data.swap(*elem, side);
4497 bnd_material_data.reset(
4501 bnd_material_data.reinit(*reinit_mats);
4503 bnd_material_data.reinit(
4512 const bool swap_stateful,
4513 const std::deque<MaterialBase *> *
const reinit_mats)
4519 const auto *
const elem =
_assembly[tid][0]->elem();
4520 unsigned int side =
_assembly[tid][0]->side();
4521 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4524 bnd_material_data.
resize(n_points);
4526 if (swap_stateful && !bnd_material_data.isSwapped())
4527 bnd_material_data.swap(*elem, side);
4530 bnd_material_data.reset(
4534 bnd_material_data.reinit(*reinit_mats);
4536 bnd_material_data.reinit(
4546 const bool swap_stateful,
4547 const std::deque<MaterialBase *> *
const reinit_mats)
4561 const bool swap_stateful,
4562 const std::deque<MaterialBase *> *
const reinit_mats)
4569 const Elem * neighbor =
_assembly[tid][0]->neighbor();
4570 unsigned int neighbor_side = neighbor->which_neighbor_am_i(
_assembly[tid][0]->elem());
4572 mooseAssert(neighbor,
"neighbor should be non-null");
4573 mooseAssert(blk_id == neighbor->subdomain_id(),
4574 "The provided blk_id " << blk_id <<
" and neighbor subdomain ID "
4575 << neighbor->subdomain_id() <<
" do not match.");
4577 unsigned int n_points =
_assembly[tid][0]->qRuleNeighbor()->n_points();
4580 neighbor_material_data.
resize(n_points);
4584 neighbor_material_data.swap(*neighbor, neighbor_side);
4587 neighbor_material_data.reset(
4591 neighbor_material_data.reinit(*reinit_mats);
4593 neighbor_material_data.reinit(
4601 const bool swap_stateful,
4602 const std::deque<MaterialBase *> *
const reinit_mats)
4606 auto && elem =
_assembly[tid][0]->elem();
4607 unsigned int side =
_assembly[tid][0]->side();
4608 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4611 bnd_material_data.
resize(n_points);
4613 if (swap_stateful && !bnd_material_data.isSwapped())
4614 bnd_material_data.swap(*elem, side);
4620 bnd_material_data.reinit(*reinit_mats);
4633 const Elem *
const & elem =
_assembly[tid][0]->elem();
4634 unsigned int side =
_assembly[tid][0]->side();
4635 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4638 bnd_material_data.
resize(n_points);
4640 if (swap_stateful && !bnd_material_data.isSwapped())
4641 bnd_material_data.swap(*elem, side);
4651 auto && elem =
_assembly[tid][0]->elem();
4658 auto && elem =
_assembly[tid][0]->elem();
4659 unsigned int side =
_assembly[tid][0]->side();
4667 const Elem * neighbor =
_assembly[tid][0]->neighbor();
4668 unsigned int neighbor_side =
4682 neighbor_side =
_assembly[tid][0]->side();
4683 mooseAssert(neighbor,
"We should have an appropriate value for elem coming from Assembly");
4694 const std::string & name,
4695 const std::string & type,
4699 _console <<
"[DBG] Adding " << system <<
" '" <<
name <<
"' of type " <<
type << std::endl;
4706 const std::string & object_name,
4707 const std::string & var_param_name)
4713 unsigned int sys_num = 0;
4722 const auto var_sys_num = sys_num;
4725 mooseError(
"We dont support setting 'variable' to a variable that is not set to the same "
4726 "system as the 'solver_sys' parameter");
4733 if (sys_num ==
_aux->number())
4749 if (sys_num ==
_aux->number())
4758 const std::string & type)
const
4763 " already exists. You may not add a ",
4765 " by the same name.");
4767#ifdef MOOSE_KOKKOS_ENABLED
4771 " already exists. You may not add a ",
4773 " by the same name.");
4779 const std::string & name,
4782#ifdef MOOSE_KOKKOS_ENABLED
4794 const std::string & name,
4797#ifdef MOOSE_KOKKOS_ENABLED
4809 const std::string & name,
4812#ifdef MOOSE_KOKKOS_ENABLED
4822std::vector<std::shared_ptr<UserObject>>
4824 const std::string & name,
4827#ifdef MOOSE_KOKKOS_ENABLED
4835 parallel_object_only();
4837 std::vector<std::shared_ptr<UserObject>> uos;
4842 for (
const auto tid : make_range(
numThreads()))
4845 std::shared_ptr<UserObject> user_object =
4848 uos.push_back(user_object);
4851 user_object->setPrimaryThreadCopy(uos[0].get());
4856 auto euo = std::dynamic_pointer_cast<ElementUserObject>(user_object);
4857 auto suo = std::dynamic_pointer_cast<SideUserObject>(user_object);
4858 auto isuo = std::dynamic_pointer_cast<InternalSideUserObject>(user_object);
4859 auto iuo = std::dynamic_pointer_cast<InterfaceUserObjectBase>(user_object);
4860 auto nuo = std::dynamic_pointer_cast<NodalUserObject>(user_object);
4861 auto duo = std::dynamic_pointer_cast<DomainUserObject>(user_object);
4862 auto guo = std::dynamic_pointer_cast<GeneralUserObject>(user_object);
4863 auto tguo = std::dynamic_pointer_cast<ThreadedGeneralUserObject>(user_object);
4864 auto muo = std::dynamic_pointer_cast<MortarUserObject>(user_object);
4877 if (euo || nuo || duo)
4879 if (suo || duo || isuo || iuo)
4881 if (iuo || duo || isuo)
4886 if ((guo && !tguo) || muo)
4893 for (
const auto tid : make_range(
numThreads()))
4895 const decltype(uos)::size_type uo_index = uos.front()->needThreadedCopy() ? tid : 0;
4909 const std::string & name,
4912 parallel_object_only();
4916 for (
const auto tid : make_range(
numThreads()))
4926 const std::string & name,
4929 parallel_object_only();
4944 std::vector<UserObject *> objs;
4948 .condition<AttribThread>(tid)
4953 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_user_object"),
4954 "A UserObject getter was called before UserObjects have been constructed. The "
4955 "requested UserObject '" +
4956 name +
"' may exist in the input file, but UserObjects are not available yet.");
4958 mooseError(
"Unable to find user object with name '" +
name +
"'");
4960 mooseAssert(objs.size() == 1,
"Should only find one UO");
4967 std::vector<Positions *> objs;
4971 .condition<AttribName>(
name)
4974 mooseError(
"Unable to find Positions object with name '" +
name +
"'");
4975 mooseAssert(objs.size() == 1,
"Should only find one Positions");
4982 std::vector<UserObject *> objs;
4986 .condition<AttribThread>(0)
4989 return !objs.empty();
4995 std::vector<FVGradientMethod *> methods;
4999 .condition<AttribThread>(tid)
5001 .queryInto(methods);
5003 if (methods.empty())
5004 mooseError(
"Unable to find FVGradientMethod with name '",
name,
"'");
5006 mooseAssert(methods.size() == 1,
"Expected a single FVGradientMethod per thread");
5007 return *(methods[0]);
5020 std::vector<FVGradientMethod *> methods;
5024 .condition<AttribThread>(0)
5026 .queryInto(methods);
5027 return !methods.empty();
5034 std::vector<FVInterpolationMethod *> methods;
5038 .condition<AttribThread>(tid)
5040 .queryInto(methods);
5042 if (methods.empty())
5044 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_interpolation_method"),
5045 "An FVInterpolationMethod getter was called before FVInterpolationMethods have "
5046 "been constructed. If you are attempting to access this object in the constructor "
5047 "of another object then make sure that the FVInterpolationMethod is constructed "
5048 "before the object using it.");
5050 mooseError(
"Unable to find FVInterpolationMethod with name '",
name,
"'");
5053 mooseAssert(methods.size() == 1,
"Expected a single FVInterpolationMethod per thread");
5054 return *(methods[0]);
5069 ") is not a scalar face interpolation method.");
5071 return *face_method;
5081 if (!advected_method)
5086 ") is not an advected interpolation method.");
5088 return *advected_method;
5094 std::vector<FVInterpolationMethod *> methods;
5098 .condition<AttribThread>(0)
5100 .queryInto(methods);
5101 return !methods.empty();
5114 std::vector<Postprocessor *> objs;
5118 .condition<AttribThread>(tid)
5123 mooseError(
"Unable to find Postprocessor with name '", object_name,
"'");
5124 mooseAssert(objs.size() == 1,
5125 "We shouldn't find more than one postprocessor object for a given name");
5131 std::size_t t_index)
const
5140 std::size_t t_index)
5149 mooseDeprecated(
"FEProblemBase::hasPostprocssor is being removed; use "
5150 "hasPostprocessorValueByName instead.");
5156 const std::string & vector_name,
5157 std::size_t t_index)
const
5165 const std::string & vector_name,
5167 std::size_t t_index)
5177 std::vector<VectorPostprocessor *> objs;
5181 .condition<AttribThread>(tid)
5188 getMooseApp().actionWarehouse().isTaskComplete(
"add_vector_postprocessor"),
5189 "A VectorPostprocessor getter was called before VectorPostprocessors have been "
5190 "constructed. The requested VectorPostprocessor '" +
5192 "' may exist in the input file, but VectorPostprocessors are not available yet.");
5194 mooseError(
"Unable to find VectorPostprocessor with name '", object_name,
"'");
5196 mooseAssert(objs.size() == 1,
5197 "We shouldn't find more than one vector postprocessor object for a given name");
5206 const auto & objects = it.second.getActiveObjects();
5207 for (
const auto & obj : objects)
5208 obj->parentOutputPositionChanged();
5225 TIME_SECTION(
"computeIndicators", 1,
"Computing Indicators");
5229 const auto old_do_derivatives = ADReal::do_derivatives;
5230 ADReal::do_derivatives =
false;
5232 std::vector<std::string> fields;
5236 for (
const auto & indicator : indicators)
5237 fields.push_back(indicator->name());
5241 for (
const auto & internal_indicator : internal_indicators)
5242 fields.push_back(internal_indicator->name());
5244 _aux->zeroVariables(fields);
5249 _aux->solution().close();
5254 _aux->solution().close();
5257 ADReal::do_derivatives = old_do_derivatives;
5266 TIME_SECTION(
"computeMarkers", 1,
"Computing Markers");
5268 std::vector<std::string> fields;
5272 for (
const auto & marker : markers)
5273 fields.push_back(marker->name());
5275 _aux->zeroVariables(fields);
5282 for (
const auto & marker : markers)
5283 marker->markerSetup();
5289 _aux->solution().close();
5320 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
5326#ifdef MOOSE_KOKKOS_ENABLED
5330 _aux->customSetup(exec_type);
5331 for (
auto & nl :
_nl)
5332 nl->customSetup(exec_type);
5337 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
5344 std::vector<UserObject *> userobjs;
5346 for (
auto obj : userobjs)
5347 obj->customSetup(exec_type);
5349#ifdef MOOSE_KOKKOS_ENABLED
5351 std::vector<UserObjectBase *> userobjs;
5353 for (
auto obj : userobjs)
5354 obj->customSetup(exec_type);
5402 std::unique_ptr<NumericVector<Number>> x =
_aux->currentSolution()->clone();
5410 const Real check_tol = 1e-8;
5412 const Real xnorm = x->l2_norm();
5413 *x -= *
_aux->currentSolution();
5414 if (x->l2_norm() > check_tol * xnorm)
5418 std::multimap<Real, std::string, std::greater<Real>> ordered_map;
5419 for (
const auto i : make_range(
n_vars))
5425 std::ostringstream oss;
5426 for (
const auto & [error_norm, var_name] : ordered_map)
5427 oss <<
" {" << var_name <<
", " << error_norm <<
"},\n";
5429 mooseError(
"Aux kernels, user objects appear to have states for aux variables on ",
5431 ".\nVariable error norms in descending order:\n",
5436 if (pp_values.size() != new_pp_values.size())
5437 mooseError(
"Second execution for uo/aux state check should not change the number of "
5438 "real reporter values");
5440 const Real ppnorm = pp_values.l2_norm();
5441 pp_values -= new_pp_values;
5442 if (pp_values.l2_norm() > check_tol * ppnorm)
5445 std::multimap<Real, std::string, std::greater<Real>> ordered_map;
5446 for (
const auto i : index_range(pp_names))
5447 ordered_map.emplace(std::abs(pp_values(i)), pp_names[i]);
5449 std::ostringstream oss;
5450 for (
const auto & [error_norm, pp_name] : ordered_map)
5451 oss <<
" {" << pp_name <<
", " << error_norm <<
"},\n";
5453 mooseError(
"Aux kernels, user objects appear to have states for real reporter values on ",
5455 ".\nErrors of real reporter values in descending order:\n",
5465 std::vector<UserObject *> objs;
5466 query.queryInto(objs);
5471 for (
auto obj : objs)
5472 if (obj->primaryThreadCopy())
5473 obj->primaryThreadCopy()->threadJoin(*obj);
5479 for (
auto obj : objs)
5487 _console <<
"[DBG] Initializing, executing & finalizing general UO '" << obj->name()
5512 auto reporter =
dynamic_cast<Reporter *
>(obj);
5538 std::set<int> & execution_groups)
const
5540 std::vector<UserObjectBase *> uos;
5541 query.queryIntoUnsorted(uos);
5542 for (
const auto & uo : uos)
5543 execution_groups.insert(uo->getParam<
int>(
"execution_order_group"));
5549 const std::string & name)
5554 std::set<int> execution_groups;
5556#ifdef MOOSE_KOKKOS_ENABLED
5565 for (
const auto execution_group : execution_groups)
5567#ifdef MOOSE_KOKKOS_ENABLED
5582 std::set<int> execution_groups;
5584#ifdef MOOSE_KOKKOS_ENABLED
5592 for (
const auto execution_group : execution_groups)
5594#ifdef MOOSE_KOKKOS_ENABLED
5616 TIME_SECTION(
"computeUserObjects", 1,
"Computing User Objects");
5618 std::vector<GeneralUserObject *> genobjs;
5621 std::vector<UserObject *> userobjs;
5626 .queryInto(userobjs);
5628 std::vector<UserObject *> tgobjs;
5633 std::vector<UserObject *> nodal;
5636 std::vector<MortarUserObject *> mortar;
5639 if (userobjs.empty() && genobjs.empty() && tgobjs.empty() && nodal.empty() && mortar.empty())
5648 for (
auto obj : userobjs)
5649 obj->residualSetup();
5650 for (
auto obj : nodal)
5651 obj->residualSetup();
5652 for (
auto obj : mortar)
5653 obj->residualSetup();
5654 for (
auto obj : tgobjs)
5655 obj->residualSetup();
5656 for (
auto obj : genobjs)
5657 obj->residualSetup();
5661 for (
auto obj : userobjs)
5662 obj->jacobianSetup();
5663 for (
auto obj : nodal)
5664 obj->jacobianSetup();
5665 for (
auto obj : mortar)
5666 obj->jacobianSetup();
5667 for (
auto obj : tgobjs)
5668 obj->jacobianSetup();
5669 for (
auto obj : genobjs)
5670 obj->jacobianSetup();
5673 for (
auto obj : userobjs)
5677 if (!userobjs.empty())
5696 for (
const auto & uo : userobjs)
5700 _aux->solution().close();
5701 _aux->system().update();
5709 for (
auto obj : nodal)
5719 for (
const auto & uo : nodal)
5723 _aux->solution().close();
5724 _aux->system().update();
5730 for (
auto obj : mortar)
5732 if (!mortar.empty())
5734 auto create_and_run_mortar_functors = [
this,
type, &mortar](
const bool displaced)
5738 for (
const auto & [primary_secondary_boundary_pair, interface_config] : mortar_interfaces)
5740 auto mortar_uos_to_execute =
5742 primary_secondary_boundary_pair.second,
5746 auto *
const subproblem = displaced ? cast_ptr<SubProblem *>(
_displaced_problem.get())
5747 : cast_ptr<SubProblem *>(
this);
5749 *interface_config.amg,
5753 subproblem->assembly(0, 0));
5759 create_and_run_mortar_functors(
false);
5761 create_and_run_mortar_functors(
true);
5763 for (
auto obj : mortar)
5768 for (
auto obj : tgobjs)
5770 std::vector<GeneralUserObject *> tguos_zero;
5774 .queryInto(tguos_zero);
5775 for (
auto obj : tguos_zero)
5777 std::vector<GeneralUserObject *> tguos;
5778 auto q =
query.clone()
5808 TIME_SECTION(
"executeControls", 1,
"Executing Controls");
5814 for (
const auto & it : controls_wh.getActiveObjects())
5819 std::vector<std::string> & dependent_controls = it->getDependencies();
5820 for (
const auto & depend_name : dependent_controls)
5822 if (controls_wh.hasActiveObject(depend_name))
5824 auto dep_control = controls_wh.getActiveObject(depend_name);
5825 resolver.
addEdge(dep_control, it);
5830 "\" was not created, did you make a "
5831 "spelling mistake or forget to include it "
5832 "in your input file?");
5838 if (!ordered_controls.empty())
5845 for (
const auto & control : ordered_controls)
5858 std::vector<Sampler *> objects;
5862 .condition<AttribThread>(tid)
5864 .queryInto(objects);
5866 if (!objects.empty())
5868 TIME_SECTION(
"executeSamplers", 1,
"Executing Samplers");
5869 FEProblemBase::objectSetupHelper<Sampler>(objects, exec_type);
5870 FEProblemBase::objectExecuteHelper<Sampler>(objects);
5878 TIME_SECTION(
"updateActiveObjects", 5,
"Updating Active Objects");
5882 for (
auto & nl :
_nl)
5883 nl->updateActive(tid);
5884 _aux->updateActive(tid);
5901#ifdef MOOSE_KOKKOS_ENABLED
5915 TIME_SECTION(
"reinitBecauseOfGhostingOrNewGeomObjects",
5917 "Reinitializing Because of Geometric Search Objects");
5926 (
_mortar_data->hasDisplacedObjects() && mortar_changed)));
5941 const std::string & name,
5944 parallel_object_only();
5946 const auto nl_sys_num =
5952 mooseError(
"You are trying to add a DGKernel to a linear variable/system, which is not "
5953 "supported at the moment!");
5966 for (
auto & nl :
_nl)
5972 const std::string & name,
5975 parallel_object_only();
6001 std::shared_ptr<Indicator> indicator =
6004 std::shared_ptr<InternalSideIndicatorBase> isi =
6005 std::dynamic_pointer_cast<InternalSideIndicatorBase>(indicator);
6015 const std::string & name,
6018 parallel_object_only();
6052 const std::string & name,
6055 parallel_object_only();
6083 multi_app->possiblyCreateChildApplications();
6088 std::shared_ptr<TransientMultiApp> trans_multi_app =
6089 std::dynamic_pointer_cast<TransientMultiApp>(multi_app);
6090 if (trans_multi_app)
6106std::shared_ptr<MultiApp>
6110 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_multi_app"),
6111 "A MultiApp getter was called before MultiApps have been constructed. "
6112 "If you are attempting to access this object in the constructor of another object "
6113 "then make sure that the MultiApp is constructed before the object using it.");
6121 const MultiAppName & source_app)
6124 bool is_executing_a_transfer =
false;
6129 std::string string_direction;
6130 std::string additional_source_info =
"";
6132 string_direction =
" To ";
6133 else if (from_multiapp)
6134 string_direction =
" From ";
6136 string_direction =
" Between ";
6137 if (!source_app.empty())
6138 additional_source_info =
" from app '" + source_app +
"'";
6141 auto executeThisTransfer = [
this, &direction, &source_app, &
type](
auto & transfer)
6143 mooseAssert(transfer->getExecuteOnEnum().contains(
type),
"Should execute on this schedule");
6149 if (transfer->getFromName() == source_app && transfer->executeAfterSiblingSourceApp())
6151 libmesh_ignore(
this);
6152 mooseAssert(this->
getMultiApp(transfer->getFromName())->getExecuteOnEnum().contains(
type),
6153 "from_multiapp should also execute on this schedule");
6159 if ((source_app.empty() && (!transfer->executeAfterSiblingSourceApp() ||
6160 !transfer->getFromMultiApp()->getExecuteOnEnum().contains(
type))) ||
6161 (transfer->getFromName() == source_app && transfer->executeAfterSiblingSourceApp()))
6172 TIME_SECTION(
"execMultiAppTransfers", 1,
"Executing Transfers");
6179 {
"Name",
"Type",
"From",
"To"});
6182 for (
const auto & transfer : transfers)
6187 if (!executeThisTransfer(multiapp_transfer))
6190 is_executing_a_transfer =
true;
6191 table.addRow(multiapp_transfer->name(),
6192 multiapp_transfer->type(),
6193 multiapp_transfer->getFromName(),
6194 multiapp_transfer->getToName());
6198 if (is_executing_a_transfer)
6201 <<
"MultiApps" << additional_source_info << COLOR_DEFAULT <<
":" << std::endl;
6207 for (
const auto & transfer : transfers)
6209 auto multiapp_transfer = libMesh::cast_ptr<MultiAppTransfer *>(transfer.get());
6210 if (!executeThisTransfer(multiapp_transfer))
6213 transfer->setCurrentDirection(direction);
6214 transfer->execute();
6221 << COLOR_DEFAULT << std::endl;
6227 << COLOR_DEFAULT << std::endl;
6230std::vector<std::shared_ptr<Transfer>>
6241std::vector<std::shared_ptr<Transfer>>
6271 std::map<unsigned int, std::vector<std::shared_ptr<MultiApp>>> groups;
6273 if (multi_app->usingPositions())
6274 groups[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(multi_app);
6282 std::map<unsigned int, std::vector<std::shared_ptr<MultiApp>>> check_groups;
6284 check_groups[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(multi_app);
6285 for (
const auto & [group_id, group] : check_groups)
6286 for (
const auto & multi_app : group)
6287 if (group.size() > 1 && !multi_app->usingPositions())
6288 multi_app->paramError(
6289 "execution_order_group",
6290 "This MultiApp must be placed in its own execution order group as concurrent execution "
6291 "has not been implemented for this type of app at this time");
6296 for (
const auto & [group_id, group] : groups)
6299 if (group.size() < 2)
6306 std::vector<processor_id_type>
count(group.size());
6307 std::vector<processor_id_type> caps(group.size());
6308 std::vector<processor_id_type> mins(group.size());
6309 std::vector<processor_id_type> maxs(group.size());
6310 processor_id_type min_total = 0;
6311 for (
const auto m : index_range(group))
6314 mins[m] = group[m]->getParam<processor_id_type>(
"min_procs_per_app");
6315 maxs[m] = group[m]->getParam<processor_id_type>(
"max_procs_per_app");
6316 const auto n_apps_m = cast_int<processor_id_type>(group[m]->numGlobalApps());
6317 caps[m] = (maxs[m] >= n_procs) ? n_procs : std::min(n_procs, n_apps_m * maxs[m]);
6319 min_total += mins[m];
6322 if (min_total > n_procs)
6323 mooseError(
"Not enough MPI ranks to run the ",
6325 " multiapps of 'execution_order_group' ",
6327 " concurrently: they need at least ",
6329 " ranks (from 'min_procs_per_app') but only ",
6331 " are available. Reduce the number of concurrent multiapps, lower "
6332 "'min_procs_per_app', or run with more processors.");
6335 processor_id_type remaining = n_procs - min_total;
6336 bool progress =
true;
6337 while (remaining > 0 && progress)
6340 for (
const auto m : index_range(group))
6341 if (remaining > 0 &&
count[m] < caps[m])
6352 processor_id_type offset = 0;
6353 for (
const auto m : index_range(group))
6356 if (my_rank >= offset && my_rank < offset +
count[m])
6358 my_rank - offset,
count[m], group[m]->numGlobalApps(), mins[m], maxs[m],
false);
6359 group[m]->init(group[m]->numGlobalApps(), cfg);
6369 const std::vector<MooseSharedPointer<MultiApp>> & multi_apps =
6373 for (
const auto & multi_app : multi_apps)
6374 multi_app->preTransfer(
_dt,
_time);
6387 std::map<unsigned int, std::vector<MooseSharedPointer<MultiApp>>> ordered_multi_apps;
6389 for (
const auto & multi_app : multi_apps)
6390 ordered_multi_apps[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(
6396 bool has_concurrent_apps =
false;
6397 for (
const auto & [group, multi_app_group] : ordered_multi_apps)
6398 if (multi_app_group.size() > 1)
6399 has_concurrent_apps =
true;
6400 if (!has_concurrent_apps)
6402 "num_concurrent_multiapps",
6403 "Due to the specified multiapp execution groups, or differences in execution schedules, "
6404 "concurrent multiapps are not actually used on " +
6409 if (multi_apps.size())
6411 TIME_SECTION(
"execMultiApps", 1,
"Executing MultiApps",
false);
6415 << COLOR_DEFAULT << std::endl;
6417 bool success =
true;
6419 for (
const auto & [group_id, multi_app_group] : ordered_multi_apps)
6421 bool group_success =
true;
6424 << COLOR_DEFAULT << std::endl;
6429 _console << COLOR_CYAN <<
"\nConcurrent MultiApps: " << std::endl;
6430 for (
const auto & multi_app : multi_app_group)
6431 _console << multi_app->name() <<
" ";
6432 _console << COLOR_DEFAULT << std::endl;
6441 for (
const auto & multi_app : multi_app_group)
6442 if (!multi_app->solveStep(
_dt,
_time, auto_advance))
6443 group_success =
false;
6457 for (
const auto & multi_app : multi_app_group)
6470 << COLOR_DEFAULT << std::endl;
6485 for (
const auto & multi_app : multi_apps)
6486 multi_app->finalize();
6494 for (
const auto & multi_app : multi_apps)
6495 multi_app->postExecute();
6503 if (multi_apps.size())
6504 for (
const auto & multi_app : multi_apps)
6505 multi_app->incrementTStep(
_time);
6513 if (multi_apps.size())
6516 _console << COLOR_CYAN <<
"\nAdvancing MultiApps on " <<
type.name() << COLOR_DEFAULT
6519 for (
const auto & multi_app : multi_apps)
6520 multi_app->finishStep(recurse_through_multiapp_levels);
6525 _console << COLOR_CYAN <<
"Finished Advancing MultiApps on " <<
type.name() <<
"\n"
6526 << COLOR_DEFAULT << std::endl;
6535 if (multi_apps.size())
6537 TIME_SECTION(
"backupMultiApps", 5,
"Backing Up MultiApp");
6540 _console << COLOR_CYAN <<
"\nBacking Up MultiApps on " <<
type.name() << COLOR_DEFAULT
6543 for (
const auto & multi_app : multi_apps)
6544 multi_app->backup();
6549 _console << COLOR_CYAN <<
"Finished Backing Up MultiApps on " <<
type.name() <<
"\n"
6550 << COLOR_DEFAULT << std::endl;
6559 if (multi_apps.size())
6564 _console << COLOR_CYAN <<
"\nRestoring Multiapps on " <<
type.name()
6565 <<
" because of solve failure!" << COLOR_DEFAULT << std::endl;
6567 _console << COLOR_CYAN <<
"\nRestoring MultiApps on " <<
type.name() << COLOR_DEFAULT
6571 for (
const auto & multi_app : multi_apps)
6572 multi_app->restore(force);
6577 _console << COLOR_CYAN <<
"Finished Restoring MultiApps on " <<
type.name() <<
"\n"
6578 << COLOR_DEFAULT << std::endl;
6587 Real smallest_dt = std::numeric_limits<Real>::max();
6589 for (
const auto & multi_app : multi_apps)
6590 smallest_dt = std::min(smallest_dt, multi_app->computeDT());
6597 const std::string & name,
6600 parallel_object_only();
6631 std::shared_ptr<MultiApp> multiapp;
6644 exec_enum = multiapp->getParam<
ExecFlagEnum>(
"execute_on");
6652 std::shared_ptr<MultiAppTransfer> multi_app_transfer =
6653 std::dynamic_pointer_cast<MultiAppTransfer>(transfer);
6654 if (multi_app_transfer)
6671 if (sys->hasVariable(var_name))
6673 if (
_aux->hasVariable(var_name))
6683 if (sys->hasVariable(var_name))
6691 const std::string & var_name,
6703 if (sys->hasVariable(var_name))
6704 return sys->getFieldVariable<Real>(tid, var_name);
6705 if (
_aux->hasVariable(var_name))
6706 return _aux->getFieldVariable<Real>(tid, var_name);
6715 if (sys->hasVariable(var_name))
6716 return sys->getActualFieldVariable<Real>(tid, var_name);
6717 if (
_aux->hasVariable(var_name))
6718 return _aux->getActualFieldVariable<Real>(tid, var_name);
6727 if (sys->hasVariable(var_name))
6728 return sys->getFieldVariable<RealVectorValue>(tid, var_name);
6729 if (
_aux->hasVariable(var_name))
6730 return _aux->getFieldVariable<RealVectorValue>(tid, var_name);
6739 if (sys->hasVariable(var_name))
6740 return sys->getFieldVariable<RealEigenVector>(tid, var_name);
6741 if (
_aux->hasVariable(var_name))
6742 return _aux->getFieldVariable<RealEigenVector>(tid, var_name);
6751 if (sys->hasScalarVariable(var_name))
6753 if (
_aux->hasScalarVariable(var_name))
6763 if (sys->hasScalarVariable(var_name))
6764 return sys->getScalarVariable(tid, var_name);
6765 if (
_aux->hasScalarVariable(var_name))
6766 return _aux->getScalarVariable(tid, var_name);
6777 else if (
_aux->hasVariable(var_name) ||
_aux->hasScalarVariable(var_name))
6778 return _aux->system();
6780 mooseError(
"Unable to find a system containing the variable " + var_name);
6888 mat->setActiveProperties(mat_prop_ids);
6890 mat->setActiveProperties(mat_prop_ids);
6892 mat->setActiveProperties(mat_prop_ids);
6912#ifdef LIBMESH_ENABLE_AMR
6922 const std::string & redistributer_name,
6923 const bool use_displaced_mesh)
6927 redistribute_params.
set<std::string>(
"for_whom") = this->
name();
6931 redistribute_params.
set<
bool>(
"use_displaced_mesh") = use_displaced_mesh;
6934 std::shared_ptr<RedistributeProperties> redistributer =
6936 "RedistributeProperties", redistributer_name, redistribute_params);
6947 mesh.
getMesh().add_ghosting_functor(redistributer);
6950 add_redistributer(
_mesh,
"mesh_property_redistributer",
false);
6952 add_redistributer(
_displaced_problem->mesh(),
"displaced_mesh_property_redistributer",
true);
6974 mooseError(
"Max quadrature points per element assumptions made in some code (e.g. Coupleable ",
6975 "and MaterialPropertyInterface classes) have been violated.\n",
6976 "Complain to Moose developers to have constMaxQpsPerElem increased from ",
6980 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
6984 _zero[tid].resize(max_qpts, 0);
6986 _grad_zero[tid].resize(max_qpts, RealGradient(0.));
6998 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
6999 for (
const auto i : index_range(
_nl))
7011 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7012 for (
const auto i : index_range(
_nl))
7027 const bool allow_negative_qweights)
7029 if (order == INVALID_ORDER)
7033 for (
const auto i : make_range(std::size_t(1),
_solver_systems.size()))
7036 if (order < _aux->getMinQuadratureOrder())
7037 order =
_aux->getMinQuadratureOrder();
7040 if (volume_order == INVALID_ORDER)
7041 volume_order = order;
7043 if (face_order == INVALID_ORDER)
7046 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7049 type, order, volume_order, face_order, block, allow_negative_qweights);
7053 type, order, volume_order, face_order, block, allow_negative_qweights);
7064 mooseError(
"Someone told us (the FEProblemBase) to trust the user coupling matrix, but we "
7065 "haven't been provided a coupling matrix!");
7086 _cm[i] = std::move(cm);
7093 mooseError(
"Someone told us (the FEProblemBase) to trust the user coupling matrix, but we "
7094 "haven't been provided a coupling matrix!");
7102 TIME_SECTION(
"setNonlocalCouplingMatrix", 5,
"Setting Nonlocal Coupling Matrix");
7105 mooseError(
"Nonlocal kernels are weirdly stored on the FEProblem so we don't currently support "
7106 "multiple nonlinear systems with nonlocal kernels.");
7108 for (
const auto nl_sys_num : index_range(
_nl))
7110 auto & nl =
_nl[nl_sys_num];
7112 unsigned int n_vars = nl->nVariables();
7113 nonlocal_cm.resize(
n_vars);
7114 const auto &
vars = nl->getVariables(0);
7117 for (
const auto & ivar :
vars)
7119 for (
const auto & kernel : nonlocal_kernel)
7121 for (
unsigned int i = ivar->number(); i < ivar->number() + ivar->count(); ++i)
7122 if (i == kernel->variable().number())
7123 for (
const auto & jvar :
vars)
7128 unsigned int j = jvar->number();
7129 nonlocal_cm(i, j) = 1;
7133 for (
const auto & integrated_bc : nonlocal_integrated_bc)
7135 for (
unsigned int i = ivar->number(); i < ivar->number() + ivar->count(); ++i)
7136 if (i == integrated_bc->variable().number())
7137 for (
const auto & jvar :
vars)
7142 unsigned int j = jvar->number();
7143 nonlocal_cm(i, j) = 1;
7153 const unsigned int jvar,
7154 const unsigned int nl_sys)
const
7156 return (*
_cm[nl_sys])(ivar, jvar);
7159std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
7162 return _assembly[tid][nl_sys]->couplingEntries();
7165std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
7168 return _assembly[tid][nl_sys]->nonlocalCouplingEntries();
7171const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
7174 return _assembly[tid][nl_sys]->fieldScalarCouplingEntries();
7183 TIME_SECTION(
"init", 2,
"Initializing");
7194 for (
const auto i : index_range(
_nl))
7199 unsigned int n_vars = nl->nVariables();
7201 TIME_SECTION(
"fillCouplingMatrix", 3,
"Filling Coupling Matrix");
7206 cm = std::make_unique<CouplingMatrix>(
n_vars);
7207 for (
unsigned int i = 0; i <
n_vars; i++)
7213 cm = std::make_unique<CouplingMatrix>(
n_vars);
7214 for (
unsigned int i = 0; i <
n_vars; i++)
7215 for (
unsigned int j = 0; j <
n_vars; j++)
7225 nl->dofMap()._dof_coupling = cm.get();
7231 nl->dofMap()._dof_coupling =
nullptr;
7233 nl->dofMap().attach_extra_sparsity_function(&
extraSparsity, nl.get());
7234 nl->dofMap().attach_extra_send_list_function(&
extraSendList, nl.get());
7238 mooseError(
"No variables specified in nonlinear system '", nl->name(),
"'.");
7260 for (
auto & nl :
_nl)
7262 nl->turnOffJacobian();
7280 TIME_SECTION(
"EquationSystems::Init", 2,
"Initializing Equation Systems");
7298 for (
const auto i : index_range(
_nl))
7302 "Coupling matrix not set for system "
7304 <<
". This should only happen if a preconditioner was not setup for this system");
7311#ifdef MOOSE_KOKKOS_ENABLED
7322 std::istringstream ss(nl_sys_name);
7323 unsigned int nl_sys_num;
7324 if (!(ss >> nl_sys_num) || !ss.eof())
7333 std::istringstream ss(linear_sys_name);
7334 unsigned int linear_sys_num;
7335 if (!(ss >> linear_sys_num) || !ss.eof())
7338 return linear_sys_num;
7344 std::istringstream ss(solver_sys_name);
7345 unsigned int solver_sys_num;
7346 if (!(ss >> solver_sys_num) || !ss.eof())
7350 mooseError(
"The solver system number was requested for system '" + solver_sys_name,
7351 "' but this system does not exist in the Problem. Systems can be added to the "
7352 "problem using the 'nl_sys_names'/'linear_sys_names' parameter.\nSystems in the "
7355 solver_sys_num = search->second;
7358 return solver_sys_num;
7365 if (solver_sys->hasVariable(variable_name))
7366 return solver_sys->number();
7367 mooseAssert(
_aux,
"Should have an auxiliary system");
7368 if (
_aux->hasVariable(variable_name))
7369 return _aux->number();
7373 "' was not found in any solver (nonlinear/linear) or auxiliary system");
7379 TIME_SECTION(
"solve", 1,
"Solving",
false);
7393#if PETSC_RELEASE_LESS_THAN(3, 12, 0)
7432#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
7434 LibmeshPetscCall(PetscOptionsPop());
7451 TIME_SECTION(
"checkExceptionAndStopSolve", 5);
7471 <<
"To recover, the solution will fail and then be re-attempted with a reduced time "
7486 _aux->solution().close();
7500 mooseError(
"The following parallel-communicated exception was detected during " +
7503 "\nBecause this did not occur during residual evaluation, there"
7504 " is no way to handle this, so the solution is aborting.\n");
7512 ADReal::do_derivatives =
true;
7537 TIME_SECTION(
"solve", 1,
"Solving",
false);
7547#if PETSC_RELEASE_LESS_THAN(3, 12, 0)
7549 options, solver_params));
7567#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
7569 LibmeshPetscCall(PetscOptionsPop());
7585 return _nl[nl_sys_num]->nNonlinearIterations();
7591 return _nl[nl_sys_num]->nLinearIterations();
7597 return _nl[nl_sys_num]->finalNonlinearResidual();
7603 return _nl[nl_sys_num]->computingPreSMOResidual();
7609 TIME_SECTION(
"copySolutionsBackwards", 3,
"Copying Solutions Backward");
7612 sys->copyStateHistoryBackwards();
7613 _aux->copyStateHistoryBackwards();
7620 sys->skipNextSolutionToOldCopy();
7621 _aux->skipNextSolutionToOldCopy();
7627 TIME_SECTION(
"advanceState", 5,
"Advancing State");
7653#ifdef MOOSE_KOKKOS_ENABLED
7688 TIME_SECTION(
"restoreSolutions", 5,
"Restoring Solutions");
7692 "There is currently no way to restore not-zeroed vectors.");
7697 _console <<
"Restoring solutions on system " << sys->
name() <<
"..." << std::endl;
7698 sys->restoreStateHistory();
7702 _console <<
"Restoring solutions on Auxiliary system..." << std::endl;
7703 _aux->restoreStateHistory();
7706 _console <<
"Restoring postprocessor, vector-postprocessor, and reporter data..." << std::endl;
7716 TIME_SECTION(
"saveOldSolutions", 5,
"Saving Old Solutions");
7719 sys->saveOldSolutions();
7720 _aux->saveOldSolutions();
7726 TIME_SECTION(
"restoreOldSolutions", 5,
"Restoring Old Solutions");
7729 sys->restoreOldSolutions();
7730 _aux->restoreOldSolutions();
7736 TIME_SECTION(
"outputStep", 1,
"Outputting");
7773 TIME_SECTION(
"onTimestepBegin", 2);
7775 for (
auto & nl :
_nl)
7776 nl->onTimestepBegin();
7792 switch (state.
state)
7804 mooseError(
"Unhandled state ", state.
state,
" in FEProblemBase::getTimeFromStateArg");
7810 const std::string & name,
7813 parallel_object_only();
7825 _aux->addDotVectors();
7826 for (
auto & nl :
_nl)
7828 nl->addDotVectors();
7830 auto tag_udot = nl->getTimeIntegrators()[0]->uDotFactorTag();
7831 if (!nl->hasVector(tag_udot))
7832 nl->associateVectorToTag(*nl->solutionUDot(), tag_udot);
7833 auto tag_udotdot = nl->getTimeIntegrators()[0]->uDotDotFactorTag();
7835 nl->associateVectorToTag(*nl->solutionUDotDot(), tag_udotdot);
7845 const std::string & name,
7848 parallel_object_only();
7851 mooseError(
"Vector bounds cannot be used with LinearSystems!");
7857 for (
auto & nl :
_nl)
7858 nl->setPredictor(predictor);
7882 residual->scale(-1.0);
7884 return residual->l2_norm();
7890 TIME_SECTION(
"computeResidualL2Norm", 2,
"Computing L2 Norm of Residual");
7894 for (
auto sys :
_nl)
7897 l2_norm += norm * norm;
7903 l2_norm += norm * norm;
7906 return std::sqrt(l2_norm);
7911 const NumericVector<Number> & soln,
7912 NumericVector<Number> & residual)
7914 parallel_object_only();
7916 TIME_SECTION(
"computeResidualSys", 5);
7925 const NumericVector<Number> & soln,
7926 NumericVector<Number> & residual)
7935 NumericVector<Number> & residual,
7936 const unsigned int nl_sys_num)
7945 mooseAssert(
_fe_vector_tags.empty(),
"This should be empty indicating a clean starting state");
7956 NumericVector<Number> & residual,
7957 SparseMatrix<Number> & jacobian)
7968 "This should be empty indicating a clean starting state");
7980 for (
auto & tag : tags)
7998 for (
auto index : make_range(matrix.row_start(), matrix.row_stop()))
7999 matrix.add(index, index, 0);
8002 _aux->zeroVariablesForResidual();
8024 for (
unsigned int tid = 0; tid < n_threads; tid++)
8029 _aux->residualSetup();
8039 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8045#ifdef MOOSE_KOKKOS_ENABLED
8088 NumericVector<Number> & residual,
8110 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8111 "contact the MOOSE team for assistance.");
8117 NumericVector<Number> & residual,
8118 const std::set<TagID> & tags)
8120 parallel_object_only();
8122 TIME_SECTION(
"computeResidualInternal", 1);
8143 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8144 "contact the MOOSE team for assistance.");
8150 NumericVector<Number> & residual,
8153 TIME_SECTION(
"computeResidualType", 5);
8174 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8175 "contact the MOOSE team for assistance.");
8182 auto create_exception_message =
8183 [&calling_method](
const std::string & exception_type,
const auto & exception)
8185 return std::string(
"A " + exception_type +
" was raised during FEProblemBase::" +
8186 calling_method +
"\n" + std::string(exception.what()));
8195 setException(create_exception_message(
"MooseException", e));
8197 catch (
const MetaPhysicL::LogicError & e)
8213 mooseError(create_exception_message(
"libMesh::PetscSolverException", e));
8215 catch (
const std::exception & e)
8218 if (strstr(e.
what(),
"Jacobian") || strstr(e.
what(),
"singular") ||
8219 strstr(e.
what(),
"det != 0"))
8220 setException(create_exception_message(
"libMesh DegenerateMap", e));
8223 const auto message = create_exception_message(
"std::exception", e);
8237 parallel_object_only();
8243 TIME_SECTION(
"computeResidualTags", 5,
"Computing Residual");
8245 ADReal::do_derivatives =
false;
8249 _aux->zeroVariablesForResidual();
8269 for (
unsigned int tid = 0; tid < n_threads; tid++)
8274 _aux->residualSetup();
8284 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8290#ifdef MOOSE_KOKKOS_ENABLED
8326 const NumericVector<Number> & soln,
8327 SparseMatrix<Number> & jacobian)
8336 SparseMatrix<Number> & jacobian,
8350 SparseMatrix<Number> & jacobian,
8351 const unsigned int nl_sys_num)
8358 for (
auto & tag : tags)
8366 SparseMatrix<Number> & jacobian,
8367 const std::set<TagID> & tags)
8369 TIME_SECTION(
"computeJacobianInternal", 1);
8389 TIME_SECTION(
"computeJacobianTags", 5,
"Computing Jacobian");
8391 for (
auto tag : tags)
8403 for (
auto index : make_range(matrix.row_start(), matrix.row_stop()))
8404 matrix.add(index, index, 0);
8407 _aux->zeroVariablesForJacobian();
8422 for (
unsigned int tid = 0; tid < n_threads; tid++)
8427 _aux->jacobianSetup();
8442 for (
unsigned int tid = 0; tid < n_threads; tid++)
8448#ifdef MOOSE_KOKKOS_ENABLED
8493 const unsigned int nl_sys_num)
8495 TIME_SECTION(
"computeTransientImplicitJacobian", 2);
8517 JacobianBlock jac_block(precond_system, jacobian, ivar, jvar);
8518 std::vector<JacobianBlock *>
blocks = {&jac_block};
8525 NumericVector<Number> & lower,
8526 NumericVector<Number> & upper)
8533 "I expect these system numbers to be the same");
8538 TIME_SECTION(
"computeBounds", 1,
"Computing Bounds");
8547 _aux->residualSetup();
8569 SparseMatrix<Number> & system_matrix,
8570 NumericVector<Number> & rhs,
8571 const bool compute_gradients)
8573 TIME_SECTION(
"computeLinearSystemSys", 5);
8606 const std::set<TagID> & vector_tags,
8607 const std::set<TagID> & matrix_tags,
8608 const bool compute_gradients)
8610 TIME_SECTION(
"computeLinearSystemTags", 5,
"Computing Linear System");
8614 for (
auto tag : matrix_tags)
8632 _aux->jacobianSetup();
8634 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8639#ifdef MOOSE_KOKKOS_ENABLED
8649 _console <<
"\nA MooseException was raised during Auxiliary variable computation.\n"
8650 <<
"The next solve will fail, the timestep will be reduced, and we will try again.\n"
8677 std::vector<NumericVector<Number> *> & sp)
8680 "I expect these system numbers to be the same");
8683 for (
unsigned int i = 0; i <
subspaceDim(
"NearNullSpace"); ++i)
8685 std::stringstream postfix;
8686 postfix <<
"_" << i;
8687 std::string modename =
"NearNullSpace" + postfix.str();
8694 std::vector<NumericVector<Number> *> & sp)
8697 "I expect these system numbers to be the same");
8699 for (
unsigned int i = 0; i <
subspaceDim(
"NullSpace"); ++i)
8701 std::stringstream postfix;
8702 postfix <<
"_" << i;
8709 std::vector<NumericVector<Number> *> & sp)
8712 "I expect these system numbers to be the same");
8714 for (
unsigned int i = 0; i <
subspaceDim(
"TransposeNullSpace"); ++i)
8716 std::stringstream postfix;
8717 postfix <<
"_" << i;
8724 const NumericVector<Number> & old_soln,
8725 NumericVector<Number> & search_direction,
8726 NumericVector<Number> & new_soln,
8727 bool & changed_search_direction,
8728 bool & changed_new_soln)
8731 "I expect these system numbers to be the same");
8742 TIME_SECTION(
"computePostCheck", 2,
"Computing Post Check");
8757 std::unique_ptr<NumericVector<Number>> ghosted_solution =
8758 sys.current_local_solution->zero_clone(),
8759 ghosted_search_direction =
8760 sys.current_local_solution->zero_clone();
8763 *ghosted_solution = new_soln;
8764 *ghosted_search_direction = search_direction;
8769 Real damping =
computeDamping(*ghosted_solution, *ghosted_search_direction);
8775 new_soln = old_soln;
8776 new_soln.add(-damping, search_direction);
8777 changed_new_soln =
true;
8784 if (changed_new_soln)
8785 *ghosted_solution = new_soln;
8787 bool updated_solution =
updateSolution(new_soln, *ghosted_solution);
8788 if (updated_solution)
8789 changed_new_soln =
true;
8796 _aux->copyCurrentIntoPreviousNL();
8800 changed_search_direction =
false;
8807 const NumericVector<Number> & update)
8814 TIME_SECTION(
"computeDamping", 1,
"Computing Damping");
8842 NumericVector<Number> & )
8855 parallel_object_only();
8864 TIME_SECTION(
"updateGeometricSearch", 3,
"Updating Geometric Search");
8875 TIME_SECTION(
"updateMortarMesh", 5,
"Updating Mortar Mesh");
8893 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
8894 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
8898 const bool correct_edge_dropping,
8899 const Real minimum_projection_angle,
8900 const Mortar3DSubpatchPlane mortar_3d_subpatch_plane,
8902 const bool triangulate_triangles,
8903 const Mortar3DQuadraturePointMapping mortar_3d_qp_mapping)
8908 return _mortar_data->createMortarInterface(primary_secondary_boundary_pair,
8909 primary_secondary_subdomain_pair,
8914 correct_edge_dropping,
8915 minimum_projection_angle,
8916 mortar_3d_subpatch_plane,
8918 triangulate_triangles,
8919 mortar_3d_qp_mapping);
8921 return _mortar_data->createMortarInterface(primary_secondary_boundary_pair,
8922 primary_secondary_subdomain_pair,
8927 correct_edge_dropping,
8928 minimum_projection_angle,
8929 mortar_3d_subpatch_plane,
8931 triangulate_triangles,
8932 mortar_3d_qp_mapping);
8937 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
8938 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
8939 bool on_displaced)
const
8942 primary_secondary_boundary_pair, primary_secondary_subdomain_pair, on_displaced);
8947 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
8948 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
8952 primary_secondary_boundary_pair, primary_secondary_subdomain_pair, on_displaced);
8960 TIME_SECTION(
"possiblyRebuildGeomSearchPatches", 5,
"Rebuilding Geometric Search Patches");
8994 libmesh_fallthrough();
9000 _console <<
"\n\nUpdating geometric search patches\n" << std::endl;
9016#ifdef LIBMESH_ENABLE_AMR
9025 mooseError(
"HFEM does not support mesh adaptivity currently.");
9027 TIME_SECTION(
"initialAdaptMesh", 2,
"Performing Initial Adaptivity");
9029 for (
unsigned int i = 0; i < n; i++)
9046 _console <<
"Mesh unchanged, skipping remaining steps..." << std::endl;
9062 TIME_SECTION(
"adaptMesh", 3,
"Adapting Mesh");
9066 bool mesh_changed =
false;
9068 for (
unsigned int i = 0; i < cycles_per_step; ++i)
9071 mooseError(
"HFEM does not support mesh adaptivity currently.");
9077 bool mesh_changed_this_step;
9080 if (mesh_changed_this_step)
9082 mesh_changed =
true;
9095 _console <<
"Mesh unchanged, skipping remaining steps..." << std::endl;
9111 return mesh_changed;
9125 std::vector<MaterialData *> data(
numThreads());
9126 for (
const auto tid : make_range(
numThreads()))
9127 data[tid] = &storage.getMaterialData(tid);
9134 for (
unsigned int i = 0; i < n_threads; ++i)
9135 for (
const auto nl_sys_num : index_range(
_nl))
9146 TIME_SECTION(
"updateMeshXFEM", 5,
"Updating XFEM");
9148 bool updated =
false;
9151 if (
_xfem->updateHeal())
9156 false,
true,
false);
9162 false,
true,
false);
9165 _console <<
"\nXFEM update complete: Mesh modified" << std::endl;
9168 _console <<
"\nXFEM update complete: Mesh not modified" << std::endl;
9175 const bool contract_mesh,
9176 const bool clean_refinement_flags)
9178 TIME_SECTION(
"meshChanged", 3,
"Handling Mesh Changes");
9200 if (intermediate_change)
9205 if (should_contract)
9208 if (clean_refinement_flags)
9216 if (!intermediate_change)
9252 mooseError(
"Disabling mesh contraction is not implemented when a displaced problem is used. "
9254 "developer of this application to discuss the combination of these features.");
9272 for (
auto & nl_sys :
_nl)
9273 nl_sys->reinitMortarFunctors();
9298 for (
const auto & elem : range)
9315 for (
const auto & elem : range)
9318 for (
auto && child : coarsened_children)
9354 mdi->meshDisplaced();
9365 cmt(elem_range,
true);
9367#ifdef MOOSE_KOKKOS_ENABLED
9376 TIME_SECTION(
"checkProblemIntegrity", 5);
9379 const auto & subdomain_names = getParam<std::vector<SubdomainName>>(
"block");
9381 std::set<SubdomainID> mesh_subdomains(mesh_subdomains_vec.begin(), mesh_subdomains_vec.end());
9387 std::set<SubdomainID>
blocks;
9390 blocks = mesh_subdomains;
9393 blocks = mesh_subdomains;
9401 "\" not found in mesh.");
9413 "\" not found in mesh.");
9417 for (
auto & nl :
_nl)
9418 nl->checkKernelCoverage(
blocks);
9423#ifdef LIBMESH_ENABLE_AMR
9428 _console <<
"Using EXPERIMENTAL Stateful Material Property projection with Adaptivity!\n"
9433 std::set<SubdomainID> local_mesh_subs(mesh_subdomains);
9442 bool check_material_coverage =
false;
9444 for (
const auto &
id : ids)
9446 local_mesh_subs.erase(
id);
9447 check_material_coverage =
true;
9458 "Subdomain \"" + subdomain_name +
"\" not found in mesh.");
9459 local_mesh_subs.erase(
id);
9464 std::set<SubdomainID>
blocks(local_mesh_subs);
9470 "Subdomain \"" + subdomain_name +
"\" not found in mesh.");
9473 for (
const auto id :
blocks)
9474 local_mesh_subs.erase(
id);
9478 auto && mortar_subdomain_ids =
_mortar_data->getMortarSubdomainIDs();
9479 for (
auto subdomain_id : mortar_subdomain_ids)
9480 local_mesh_subs.erase(subdomain_id);
9483 if (check_material_coverage && !local_mesh_subs.empty())
9485 std::stringstream extra_subdomain_ids;
9487 std::copy(local_mesh_subs.begin(),
9488 local_mesh_subs.end(),
9489 std::ostream_iterator<unsigned int>(extra_subdomain_ids,
" "));
9491 std::vector<SubdomainID> local_mesh_subs_vec(local_mesh_subs.begin(),
9492 local_mesh_subs.end());
9494 mooseError(
"The following blocks from your input mesh do not contain an active material: " +
9495 extra_subdomain_ids.str() +
9497 ")\nWhen ANY mesh block contains a Material object, "
9498 "all blocks must contain a Material object.\n");
9508 for (
const auto & material : materials)
9509 material->checkStatefulSanity();
9531 mooseError(
"Coordinate transformation parameters, listed below, are only to be used in the "
9532 "context of application to application field transfers at this time. The mesh is "
9533 "not modified by these parameters within an application.\n"
9534 "You should likely use a 'TransformGenerator' in the [Mesh] block to achieve the "
9535 "desired mesh modification.\n\n",
9552 bool mesh_has_second_order_elements =
false;
9556 if (elem->default_order() == SECOND)
9558 mesh_has_second_order_elements =
true;
9568 if (mesh_has_second_order_elements)
9570 const std::vector<std::string> & displacement_variables =
9573 for (
const auto & var_name : displacement_variables)
9580 if (mv.
order() != SECOND)
9581 mooseError(
"Error: mesh has SECOND order elements, so all displacement variables must be "
9593 std::set<SubdomainID> user_objects_blocks;
9597 std::set<std::string> names;
9599 std::vector<UserObjectBase *> objects;
9602 for (
const auto & obj : objects)
9603 names.insert(obj->name());
9606 std::set<SubdomainID> difference;
9607 std::set_difference(user_objects_blocks.begin(),
9608 user_objects_blocks.end(),
9609 mesh_subdomains.begin(),
9610 mesh_subdomains.end(),
9611 std::inserter(difference, difference.end()));
9613 if (!difference.empty())
9615 std::ostringstream oss;
9616 oss <<
"One or more UserObjects is referencing a nonexistent block:\n";
9617 for (
const auto &
id : difference)
9626 std::vector<FVGradientMethod *> methods;
9628 for (
auto * method : methods)
9629 method->resolveGradientMethodDependencies(*
this);
9634 const std::map<
SubdomainID, std::vector<std::shared_ptr<MaterialBase>>> & materials_map)
9636 for (
const auto & it : materials_map)
9639 std::set<std::string> block_depend_props, block_supplied_props;
9641 for (
const auto & mat1 : it.second)
9643 auto & alldeps = mat1->getMatPropDependencies();
9644 for (
auto & dep : alldeps)
9648 for (
const auto & mat2 : it.second)
9650 const std::set<std::string> & supplied_props = mat2->MaterialBase::getSuppliedItems();
9651 block_supplied_props.insert(supplied_props.begin(), supplied_props.end());
9660 std::set<std::string> difference;
9661 std::set_difference(block_depend_props.begin(),
9662 block_depend_props.end(),
9663 block_supplied_props.begin(),
9664 block_supplied_props.end(),
9665 std::inserter(difference, difference.end()));
9667 if (!difference.empty())
9669 std::ostringstream oss;
9670 oss <<
"One or more Material Properties were not supplied on block ";
9672 if (subdomain_name.length() > 0)
9673 oss << subdomain_name <<
" (" << it.first <<
")";
9677 for (
const auto &
name : difference)
9678 oss <<
name <<
"\n";
9684 for (
const auto & it : materials_map)
9686 const auto & materials = it.second;
9687 std::set<std::string> inner_supplied, outer_supplied;
9689 for (
const auto & outer_mat : materials)
9692 outer_supplied = outer_mat->getSuppliedItems();
9693 inner_supplied.clear();
9696 std::map<std::string, std::set<std::string>> prop_to_mat;
9697 for (
const auto &
name : outer_supplied)
9698 prop_to_mat[
name].insert(outer_mat->name());
9700 for (
const auto & inner_mat : materials)
9702 if (outer_mat == inner_mat)
9706 auto outer_mat_type = outer_mat->type();
9707 auto inner_mat_type = inner_mat->type();
9712 if (outer_mat_type == inner_mat_type && outer_mat_type != outer_mat->type() &&
9713 inner_mat_type != inner_mat->type())
9716 inner_supplied.insert(inner_mat->getSuppliedItems().begin(),
9717 inner_mat->getSuppliedItems().end());
9719 for (
const auto & inner_supplied_name : inner_supplied)
9720 prop_to_mat[inner_supplied_name].insert(inner_mat->name());
9724 std::set<std::string> intersection;
9725 std::set_intersection(outer_supplied.begin(),
9726 outer_supplied.end(),
9727 inner_supplied.begin(),
9728 inner_supplied.end(),
9729 std::inserter(intersection, intersection.end()));
9731 if (!intersection.empty())
9733 std::ostringstream oss;
9734 oss <<
"The following material properties are declared on block " << it.first
9735 <<
" by multiple materials:\n";
9737 <<
"Material Objects\n";
9738 for (
const auto & outer_name : intersection)
9741 for (
const auto & inner_name : prop_to_mat[outer_name])
9742 oss << inner_name <<
" ";
9764 mooseInfo(
"Restart file ", file_name,
" is NOT being used since we are performing recovery.");
9770 mooseInfo(
"Using ", file_name,
" for restart.");
9774std::vector<VariableName>
9777 std::vector<VariableName> names;
9781 const std::vector<VariableName> & var_names = sys->getVariableNames();
9782 names.insert(names.end(), var_names.begin(), var_names.end());
9785 const std::vector<VariableName> & aux_var_names =
_aux->getVariableNames();
9786 names.insert(names.end(), aux_var_names.begin(), aux_var_names.end());
9795 "Solver system number '" << solver_sys_num <<
"' is out of bounds. We have '"
9812 auto random_data_ptr = insert_pair.first->second.get();
9822 bnd_mat_side_cache =
false;
9825 if (
_aux->needMaterialOnSide(bnd_id))
9827 bnd_mat_side_cache =
true;
9830 for (
auto & nl :
_nl)
9831 if (nl->needBoundaryMaterialOnSide(bnd_id, tid))
9833 bnd_mat_side_cache =
true;
9847 bnd_mat_side_cache =
true;
9861 interface_mat_side_cache =
false;
9864 for (
auto & nl :
_nl)
9865 if (nl->needInterfaceMaterialOnSide(bnd_id, tid))
9867 interface_mat_side_cache =
true;
9880 interface_mat_side_cache =
true;
9885 interface_mat_side_cache =
true;
9899 for (
auto & nl :
_nl)
9900 if (nl->needInternalNeighborSideMaterial(subdomain_id, tid))
9933 mooseError(
"Previous nonlinear solution is required but not added through "
9934 "Problem/previous_nl_solution_required=true");
9939 const unsigned int solver_sys_num)
9946 const unsigned int solver_sys_num)
const
9965 bool needed,
const unsigned int solver_sys_num)
9972 const unsigned int solver_sys_num)
const
10003 const std::string & object_name,
10006 parallel_object_only();
10013 mooseError(
"The name '", object_name,
"' is a reserved name for output objects");
10017 if (output_warehouse.
hasOutput(object_name))
10018 mooseError(
"An output object named '", object_name,
"' already exists");
10024 if (object_type ==
"Console" &&
_app.
getParam<
bool>(
"show_input") &&
10042 if (object_type ==
"XDR")
10044 else if (object_type ==
"XDA")
10048 if (object_name ==
"auto_recovery_checkpoint")
10080 else if (sys_name ==
"aux0")
10083 mooseError(
"System '" + sys_name +
"' was requested from problem but does not exist.");
10098 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
10099 return *
_nl[sys_num];
10105 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
10106 return *
_nl[sys_num];
10113 "System number greater than the number of linear systems");
10121 "System number greater than the number of linear systems");
10129 "System number greater than the number of solver systems");
10137 "System number greater than the number of solver systems");
10156 parallel_object_only();
10184 false,
true,
true);
10200 const std::vector<Point> *
const pts,
10201 const std::vector<Real> *
const weights,
10213 unsigned int neighbor_side,
10215 const std::vector<Point> *
const pts,
10216 const std::vector<Real> *
const weights,
10229 std::vector<std::shared_ptr<MaterialBase>> & face_materials,
10230 std::vector<std::shared_ptr<MaterialBase>> & neighbor_materials,
10231 std::set<MooseVariableFieldBase *> & variables,
10236 auto & this_face_mats =
10238 for (std::shared_ptr<MaterialBase> face_mat : this_face_mats)
10239 if (face_mat->ghostable())
10241 face_materials.push_back(face_mat);
10242 auto & var_deps = face_mat->getMooseVariableDependencies();
10243 for (
auto * var : var_deps)
10247 "Ghostable materials should only have finite volume variables coupled into them.");
10248 else if (face_mat->hasStatefulProperties())
10249 mooseError(
"Finite volume materials do not currently support stateful properties.");
10250 variables.insert(var);
10257 auto & this_neighbor_mats =
10259 for (std::shared_ptr<MaterialBase> neighbor_mat : this_neighbor_mats)
10260 if (neighbor_mat->ghostable())
10262 neighbor_materials.push_back(neighbor_mat);
10264 auto & var_deps = neighbor_mat->getMooseVariableDependencies();
10265 for (
auto * var : var_deps)
10269 "Ghostable materials should only have finite volume variables coupled into them.");
10270 else if (neighbor_mat->hasStatefulProperties())
10271 mooseError(
"Finite volume materials do not currently support stateful properties.");
10272 auto pr = variables.insert(var);
10273 mooseAssert(!pr.second,
10274 "We should not have inserted any new variables dependencies from our "
10275 "neighbor materials that didn't exist for our face materials");
10284 const unsigned int nqp,
10295 "There must be one convergence object per nonlinear system");
10300 _nl[i]->setConvergenceName(convergence_names[i]);
10315const std::vector<ConvergenceName> &
10320 mooseError(
"The nonlinear system convergence name(s) have not been set.");
10335 paramError(
"linear_convergence",
"There must be one convergence object per linear system");
10339const std::vector<ConvergenceName> &
10344 mooseError(
"The linear convergence name(s) have not been set.");
10347const ConvergenceName &
10353 mooseError(
"The fixed point convergence name has not been set.");
10356const ConvergenceName &
10362 mooseError(
"The steady convergence name has not been set.");
10407 return current_nl_sys_num;
10418 return current_linear_sys_num;
10435std::vector<MortarUserObject *>
10438 const bool displaced,
10439 const std::vector<MortarUserObject *> & mortar_uo_superset)
10441 std::vector<MortarUserObject *> mortar_uos;
10442 auto *
const subproblem =
10443 displaced ? cast_ptr<SubProblem *>(
_displaced_problem.get()) : cast_ptr<SubProblem *>(
this);
10444 for (
auto *
const obj : mortar_uo_superset)
10445 if (obj->onInterface(primary_boundary_id, secondary_boundary_id) &&
10446 (&obj->getSubProblem() == subproblem))
10447 mortar_uos.push_back(obj);
10452std::vector<MortarUserObject *>
10455 const bool displaced)
10457 std::vector<MortarUserObject *> mortar_uos;
10461 .queryInto(mortar_uos);
10462 return getMortarUserObjects(primary_boundary_id, secondary_boundary_id, displaced, mortar_uos);
10468 const bool displaced)
10470 const auto mortar_uos =
10472 for (
auto *
const mortar_uo : mortar_uos)
10474 mortar_uo->setNormals();
10475 mortar_uo->reinit();
10507 mooseAssert(nl_sys_num <
_nl.size(),
10508 "System number greater than the number of nonlinear systems");
10517 "System number greater than the number of linear systems");
10535const ConstElemRange &
10543const ConstNodeRange &
10612 return solver_params;
10630 return _mortar_data->getMortarInterfaces(on_displaced);
@ ThreadedGeneralUserObject
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
void boundaryIntegrityCheckError(const MooseObject &object, const std::set< MooseVariableFieldBase * > &variables, const BoundaryName &boundary_name)
Compose boundary restricted error message for the provided object, variables, and boundary_name if th...
StoredRange< std::vector< GeneralUserObject * >::iterator, GeneralUserObject * > GeneralUserObjectRange
void groupUserObjects(TheWarehouse &w, AuxiliarySystem &aux, const ExecFlagEnum &execute_flags, const std::vector< T * > &objs, const std::set< std::string > &ic_deps)
Threads::spin_mutex get_function_mutex
void mooseInfo(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
libMesh::TensorValue< ADReal > ADRealTensorValue
Real PostprocessorValue
various MOOSE typedefs
std::vector< Real > VectorPostprocessorValue
ADRealVectorValue ADRealGradient
void removeSubstring(std::string &main, const std::string &sub)
const ExecFlagType EXEC_SUBDOMAIN
const ExecFlagType EXEC_TIMESTEP_BEGIN
const ExecFlagType EXEC_SAME_AS_MULTIAPP
const ExecFlagType EXEC_POSTCHECK
const ExecFlagType EXEC_ALWAYS
const ExecFlagType EXEC_POST_ADAPTIVITY
std::pair< typename M::iterator, bool > moose_try_emplace(M &m, const typename M::key_type &k, Args &&... args)
Function to mirror the behavior of the C++17 std::map::try_emplace() method (no hint).
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
const ExecFlagType EXEC_NONE
const ExecFlagType EXEC_PRE_DISPLACE
LocalRankConfig rankConfig(processor_id_type rank, processor_id_type nprocs, dof_id_type napps, processor_id_type min_app_procs, processor_id_type max_app_procs, bool batch_mode=false)
Returns app partitioning information relevant to the given rank for a multiapp scenario with the give...
std::shared_ptr< DisplacedProblem > displaced_problem
for(PetscInt i=0;i< nvars;++i)
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
void extraSendList(std::vector< dof_id_type > &send_list, void *context)
///< Type of coordinate system
void extraSparsity(libMesh::SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz, void *context)
Free function used for a libMesh callback.
void ErrorVector unsigned int
unsigned int getCyclesPerStep() const
Pull out the number of cycles_per_step previously set through the AdaptivityAction.
bool initialAdaptMesh()
Used during initial adaptivity.
void uniformRefineWithProjection()
Performs uniform refinement on the meshes in the current object.
static void uniformRefine(MooseMesh *mesh, unsigned int level=libMesh::invalid_uint)
Performs uniform refinement of the passed Mesh object.
bool getRecomputeMarkersFlag() const
Pull out the _recompute_markers_during_cycles flag previously set through the AdaptivityAction.
bool adaptMesh(std::string marker_name=std::string())
Adapts the mesh based on the error estimator used.
bool isAdaptivityDue()
Query if an adaptivity step should be performed at the current time / time step.
bool isOn()
Is adaptivity on?
void updateErrorVectors()
Update the ErrorVectors that have been requested through calls to getErrorVector().
unsigned int getInitialSteps() const
Pull out the number of initial steps previously set by calling init()
Key structure for APIs manipulating global vectors/matrices.
AttribBoundaries tracks all boundary IDs associated with an object.
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
TODO: delete this later - it is a temporary hack for dealing with inter-system dependencies.
This class is a container/interface for the objects involved in automatic generation of mortar spaces...
void copyValuesBack()
Copies current chain control data values into old values.
Thread to compute threaded general user objects.
Class for threaded computation of UserObjects.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Base class for convergence criteria.
bool hasWritableCoupledVariables() const
Checks whether the object has any writable coupled variables.
Class that represents the dependecy as a graph.
void addItem(const T &value)
Add an independent item to the set.
const std::vector< T > & getSortedValues()
This function also returns dependency resolved values but with a simpler single vector interface.
void addEdge(const T &a, const T &b)
Add an edge between nodes 'a' and 'b'.
void clearPoints()
Remove all of the current points and elements.
std::set< const Elem * > & getElements()
Returns a writeable reference to the _elements container.
MultiPointMap & getPoints()
Returns a writeable reference to the _points container.
void updatePointLocator(const MooseMesh &mesh)
Called during FEProblemBase::meshChanged() to update the PointLocator object used by the DiracKernels...
All Distributions should inherit from this class.
A MultiMooseEnum object to hold "execute_on" flags.
A class for storing MooseObjects based on execution flag.
void updateActive(THREAD_ID tid=0) override
Updates the active objects storage.
void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
void setup(const ExecFlagType &exec_flag, THREAD_ID tid=0) const
virtual void preProblemInit()
Perform initializations during executing actions right before init_problem task.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void addJacobianScalar(const THREAD_ID tid=0)
virtual bool reinitDirac(const Elem *elem, const THREAD_ID tid) override
Returns true if the Problem has Dirac kernels it needs to compute on elem.
virtual void addJacobianLowerD(const THREAD_ID tid) override
const FVInterpolationMethod & getFVInterpolationMethod(const InterpolationMethodName &name, const THREAD_ID tid=0) const
Retrieve an FV interpolation method.
virtual void addKokkosAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
MaterialData & getMaterialData(Moose::MaterialDataType type, const THREAD_ID tid=0, const MooseObject *object=nullptr) const
std::unique_ptr< libMesh::ConstElemRange > _nl_evaluable_local_elem_range
bool _previous_nl_solution_required
Indicates we need to save the previous NL iteration variable values.
virtual void addKokkosBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters ¶meters)
std::shared_ptr< AuxiliarySystem > _aux
The auxiliary system.
std::vector< SubdomainName > _material_coverage_blocks
bool hasLinearConvergenceObjects() const
Whether we have linear convergence objects.
bool hasPostprocessor(const std::string &name) const
Deprecated.
std::vector< VariablePhiSecond > _second_phi_zero
unsigned int subspaceDim(const std::string &prefix) const
Dimension of the subspace spanned by vectors with a given prefix.
MooseObjectWarehouse< IntegratedBCBase > _nonlocal_integrated_bcs
nonlocal integrated_bcs
virtual void clearDiracInfo() override
Gets called before Dirac Kernels are asked to add the points they are supposed to be evaluated in.
MaterialWarehouse _materials
virtual void addJacobianBlockTags(libMesh::SparseMatrix< libMesh::Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, const std::set< TagID > &tags, const THREAD_ID tid)
LinearSystem * _current_linear_sys
The current linear system that we are solving.
std::set< TagID > _fe_vector_tags
std::vector< VariablePhiGradient > _grad_phi_zero
virtual void computeJacobian(const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, const unsigned int nl_sys_num)
Form a Jacobian matrix with the default tag (system).
virtual void computeNearNullSpace(libMesh::NonlinearImplicitSystem &sys, std::vector< NumericVector< libMesh::Number > * > &sp)
ExecuteMooseObjectWarehouse< Transfer > _between_multi_app_transfers
Transfers executed just before MultiApps to transfer data between them.
bool _trust_user_coupling_matrix
Whether to trust the user coupling matrix no matter what.
virtual Sampler & getSampler(const std::string &name, const THREAD_ID tid=0)
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid) override
virtual void init() override
virtual const std::vector< std::shared_ptr< Convergence > > & getConvergenceObjects(const THREAD_ID tid=0) const
Gets the Convergence objects.
SolverSystem * _current_solver_sys
The current solver system.
void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
Declare that we need up to old (1) or older (2) solution states for a given type of iteration.
virtual void cacheResidual(const THREAD_ID tid) override
void checkDependMaterialsHelper(const std::map< SubdomainID, std::vector< std::shared_ptr< MaterialBase > > > &materials_map)
Helper method for checking Material object dependency.
virtual void addMaterialHelper(std::vector< MaterialWarehouse * > warehouse, const std::string &material_name, const std::string &name, InputParameters ¶meters)
const std::vector< ConvergenceName > & getNonlinearConvergenceNames() const
Gets the nonlinear system convergence object name(s).
void resizeMaterialData(Moose::MaterialDataType data_type, unsigned int nqp, const THREAD_ID tid)
Resize material data.
bool needsPreviousMultiAppFixedPointIterationAuxiliary() const
Check to see whether we need to compute the variable values of the previous multiapp fixed point iter...
virtual void checkProblemIntegrity()
Method called to perform a series of sanity checks before a simulation is run.
void setCouplingMatrix(std::unique_ptr< libMesh::CouplingMatrix > cm, const unsigned int nl_sys_num)
Set custom coupling matrix.
unsigned int getMaxQps() const
void setLinearConvergenceNames(const std::vector< ConvergenceName > &convergence_names)
Sets the linear convergence object name(s) if there is one.
std::string _exception_message
The error message to go with an exception.
std::vector< MooseArray< ADRealVectorValue > > _ad_grad_zero
bool hasJacobian() const
Returns _has_jacobian.
virtual void onTimestepEnd() override
const bool _skip_nl_system_check
std::vector< std::unordered_map< SubdomainID, bool > > _block_mat_side_cache
Cache for calculating materials on side.
std::vector< SolverParams > _solver_params
virtual NonlinearSystem & getNonlinearSystem(const unsigned int sys_num)
ScalarInitialConditionWarehouse _scalar_ics
virtual void addJacobianNeighbor(const THREAD_ID tid) override
virtual ArrayMooseVariable & getArrayVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested ArrayMooseVariable which may be in any system.
void createTagVectors()
Create extra tagged vectors and matrices.
bool hasKokkosUserObject(const std::string &name) const
Check if there if a Kokkos user object of given name.
virtual void addResidualLower(const THREAD_ID tid) override
virtual void lineSearch()
execute MOOSE line search
bool _verbose_multiapps
Whether or not to be verbose with multiapps.
TheWarehouse::Query getUOQuery(const std::string &system, const ExecFlagType &type, const Moose::AuxGroup &group) const
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
virtual void addPredictor(const std::string &type, const std::string &name, InputParameters ¶meters)
const VectorPostprocessor & getVectorPostprocessorObjectByName(const std::string &object_name, const THREAD_ID tid=0) const
Return the VPP object given the name.
void clearCurrentJacobianMatrixTags()
Clear the current Jacobian matrix tag data structure ... if someone creates it.
virtual void addDistribution(const std::string &type, const std::string &name, InputParameters ¶meters)
The following functions will enable MOOSE to have the capability to import distributions.
virtual void setActiveScalarVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid) override
const AutomaticMortarGeneration & getMortarInterface(const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced) const
Return the undisplaced or displaced mortar generation object associated with the provided boundaries ...
const bool & _solve
Whether or not to actually solve the nonlinear system.
bool _parallel_barrier_messaging
Whether or not information about how many transfers have completed is printed.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided.
void skipNextForwardSolutionCopyToOld()
Prevents the copy of the solution vector to the old solution vector in each system.
MaterialWarehouse _interface_materials
void addObjectParamsHelper(InputParameters ¶ms, const std::string &object_name, const std::string &var_param_name="variable")
Helper for setting the "_subproblem" and "_sys" parameters in addObject() and in addUserObject().
const Postprocessor & getPostprocessorObjectByName(const PostprocessorName &object_name, const THREAD_ID tid=0) const
Return the Postprocessor object registered under the supplied object name.
void reportMooseObjectDependency(MooseObject *a, MooseObject *b)
Register a MOOSE object dependency so we can either order operations properly or report when we canno...
void checkDisplacementOrders()
Verify that SECOND order mesh uses SECOND order displacements.
std::unique_ptr< MortarInterfaceWarehouse > _mortar_data
void customSetup(const ExecFlagType &exec_type) override
virtual void computeResidualTags(const std::set< TagID > &tags)
Form multiple residual vectors and each is associated with one tag.
virtual void reinitElemFaceRef(const Elem *elem, unsigned int side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0) override
reinitialize FE objects on a given element on a given side at a given set of reference points and the...
bool _has_dampers
Whether or not this system has any Dampers associated with it.
virtual void computeUserObjects(const ExecFlagType &type, const Moose::AuxGroup &group)
Call compute methods on UserObjects.
std::shared_ptr< MultiApp > getMultiApp(const std::string &multi_app_name) const
Get a MultiApp object by name.
bool _checking_uo_aux_state
Flag used to indicate whether we are doing the uo/aux state check in execute.
bool needInternalNeighborSideMaterial(SubdomainID subdomain_id, const THREAD_ID tid)
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested MooseVariable which may be in any system.
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
virtual bool hasDistribution(const std::string &name) const
void restoreGeometricSearchState()
Restore geometric search state captured by the most recent backupGeometricSearchState().
virtual std::size_t numLinearSystems() const override
void createTagMatrices(CreateTaggedMatrixKey)
bool hasFVInterpolationMethod(const InterpolationMethodName &name) const
Check if an FV interpolation method with a given name exists.
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
Moose::Kokkos::MaterialPropertyStorage & _kokkos_neighbor_material_props
libMesh::Order getMaxScalarOrder() const
void reinitMaterialsFace(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase * > *reinit_mats=nullptr)
reinit materials on element faces
virtual void addSampler(const std::string &type, const std::string &name, InputParameters ¶meters)
The following functions will enable MOOSE to have the capability to import Samplers.
void notifyWhenMeshDisplaces(MeshDisplacedInterface *mdi)
Register an object that derives from MeshDisplacedInterface to be notified when the displaced mesh ge...
void jacobianSetup() override
virtual bool updateMeshXFEM()
Update the mesh due to changing XFEM cuts.
virtual void prepareFaceShapes(unsigned int var, const THREAD_ID tid) override
virtual void resetState()
Reset state of this object in preparation for the next evaluation.
virtual unsigned int currentLinearSysNum() const override
bool areCoupled(const unsigned int ivar, const unsigned int jvar, const unsigned int nl_sys_num) const
virtual void addResidual(const THREAD_ID tid) override
virtual void addInterfaceMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
MooseObjectWarehouse< KernelBase > _nonlocal_kernels
nonlocal kernels
ReporterData _reporter_data
const ConvergenceName & getSteadyStateConvergenceName() const
Gets the steady-state detection convergence object name.
std::vector< VariableGradient > _grad_zero
virtual void addConvergence(const std::string &type, const std::string &name, InputParameters ¶meters)
Adds a Convergence object.
virtual bool allowMeshContractionAfterMeshChanged() const
Whether meshChanged() should allow the mesh to be contracted (deletes children of coarsened elements ...
virtual libMesh::EquationSystems & es() override
bool needInterfaceMaterialOnSide(BoundaryID bnd_id, const THREAD_ID tid)
void setCurrentAlgebraicNodeRange(libMesh::ConstNodeRange *range)
ExecuteMooseObjectWarehouse< MultiApp > _multi_apps
MultiApp Warehouse.
std::vector< bool > _previous_multisystem_fp_nl_solution_required
Indicates we need to save the previous multi-system fixed-point iteration solver variable values.
const FVFaceInterpolationMethod & getFVFaceInterpolationMethod(const InterpolationMethodName &name, const THREAD_ID tid=0) const
Retrieve a scalar face interpolation method.
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly
virtual void addResidualScalar(const THREAD_ID tid=0)
void projectInitialConditionOnCustomRange(libMesh::ConstElemRange &elem_range, ConstBndNodeRange &bnd_node_range, const std::optional< std::set< VariableName > > &target_vars=std::nullopt)
Project initial conditions for custom elem_range and bnd_node_range This is needed when elements/boun...
const bool _boundary_restricted_node_integrity_check
whether to perform checking of boundary restricted nodal object variable dependencies,...
virtual void addHDGKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
std::shared_ptr< LineSearch > _line_search
virtual void prepareShapes(unsigned int var, const THREAD_ID tid) override
std::vector< VariableSecond > _second_zero
virtual void addCachedResidual(const THREAD_ID tid) override
AuxiliarySystem & getAuxiliarySystem()
MaterialPropertyStorage & _material_props
void trustUserCouplingMatrix()
Whether to trust the user coupling matrix even if we want to do things like be paranoid and create a ...
void joinAndFinalize(TheWarehouse::Query query, bool isgen=false)
void setAxisymmetricCoordAxis(const MooseEnum &rz_coord_axis)
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
virtual void neighborSubdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
virtual const libMesh::CouplingMatrix & nonlocalCouplingMatrix(const unsigned i) const override
const RestartableEquationSystems & getRestartableEquationSystems() const
Get the RestartableEquationSystems object.
void setNonlinearConvergenceNames(const std::vector< ConvergenceName > &convergence_names)
Sets the nonlinear convergence object name(s) if there is one.
bool haveXFEM()
Find out whether the current analysis is using XFEM.
virtual std::size_t numSolverSystems() const override
bool needsPreviousNewtonIteration() const
Check to see whether we need to compute the variable values of the previous Newton iterate.
bool _reinit_displaced_neighbor
Whether to call DisplacedProblem::reinitNeighbor when this->reinitNeighbor is called.
virtual void cacheJacobianNeighbor(const THREAD_ID tid) override
virtual void addResidualNeighbor(const THREAD_ID tid) override
virtual const SystemBase & systemBaseAuxiliary() const override
Return the auxiliary system object as a base class reference.
std::vector< libMesh::CouplingMatrix > _nonlocal_cm
nonlocal coupling matrix
unsigned int systemNumForVariable(const VariableName &variable_name) const
virtual void sizeZeroes(unsigned int size, const THREAD_ID tid)
MaterialPropertyStorage & _neighbor_material_props
virtual void addCachedJacobian(const THREAD_ID tid) override
virtual const SystemBase & systemBaseLinear(unsigned int sys_num) const override
Get a constant base class reference to a linear system.
virtual void addGhostedElem(dof_id_type elem_id) override
Will make sure that all dofs connected to elem_id are ghosted to this processor.
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
virtual bool shouldUpdateSolution()
Check to see whether the problem should update the solution.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class,...
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
virtual void addTimeIntegrator(const std::string &type, const std::string &name, InputParameters ¶meters)
virtual std::size_t numNonlinearSystems() const override
unsigned short getCurrentICState()
Retrieves the current initial condition state.
std::vector< std::shared_ptr< LinearSystem > > _linear_systems
The vector of linear systems.
ExecuteMooseObjectWarehouse< Transfer > _to_multi_app_transfers
Transfers executed just before MultiApps to transfer data to them.
std::optional< ConvergenceName > _multiapp_fixed_point_convergence_name
MultiApp fixed point convergence name.
void addAnyRedistributers()
void initElementStatefulProps(const libMesh::ConstElemRange &elem_range, const bool threaded)
Initialize stateful properties for elements in a specific elem_range This is needed when elements/bou...
virtual void addLinearFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
ExecuteMooseObjectWarehouse< Transfer > _transfers
Normal Transfers.
virtual const std::vector< VectorTag > & currentResidualVectorTags() const override
Return the residual vector tags we are currently computing.
void setRestartFile(const std::string &file_name)
Communicate to the Resurector the name of the restart filer.
MooseVariableFieldBase & getActualFieldVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested MooseVariableField which may be in any system.
virtual void computeResidualInternal(const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, const std::set< TagID > &tags)
Form a residual vector for a set of tags.
virtual void updateActiveObjects()
Update the active objects in the warehouses.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
virtual VectorMooseVariable & getVectorVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested VectorMooseVariable which may be in any system.
void computeSystems(const ExecFlagType &type)
Do generic system computations.
void incrementMultiAppTStep(ExecFlagType type)
Advance the MultiApps t_step (incrementStepOrReject) associated with the ExecFlagType.
virtual void computeLinearSystemSys(libMesh::LinearImplicitSystem &sys, libMesh::SparseMatrix< libMesh::Number > &system_matrix, NumericVector< libMesh::Number > &rhs, const bool compute_gradients=true)
Assemble both the right hand side and the system matrix of a given linear system.
std::unique_ptr< libMesh::ConstElemRange > _current_algebraic_elem_range
virtual void addElementalFieldVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
Add an elemental field variable for use in the adaptivity system.
virtual void clearActiveFEVariableCoupleableVectorTags(const THREAD_ID tid) override
void setCurrentAlgebraicElementRange(libMesh::ConstElemRange *range)
These functions allow setting custom ranges for the algebraic elements, nodes, and boundary nodes tha...
virtual void computeJacobianSys(libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian)
Form a Jacobian matrix.
std::map< NonlinearSystemName, unsigned int > _nl_sys_name_to_num
Map from nonlinear system name to number.
bool _has_kokkos_objects
Whether we have any Kokkos objects.
std::vector< std::unique_ptr< libMesh::CouplingMatrix > > _cm
Coupling matrix for variables.
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
virtual void cacheJacobian(const THREAD_ID tid) override
virtual void swapBackMaterialsFace(const THREAD_ID tid)
const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name, std::size_t t_index=0) const
Get a read-only reference to the value associated with a Postprocessor that exists.
virtual void addJacobian(const THREAD_ID tid) override
std::vector< VectorVariableValue > _vector_zero
void checkNonlocalCoupling()
virtual void possiblyRebuildGeomSearchPatches()
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
Canonical method for adding a non-linear variable.
LinearSystem & currentLinearSystem()
Get a non-constant reference to the current linear system.
virtual void addJacobianOffDiagScalar(unsigned int ivar, const THREAD_ID tid=0)
ExecuteMooseObjectWarehouse< Control > _control_warehouse
The control logic warehouse.
virtual void addFunction(const std::string &type, const std::string &name, InputParameters ¶meters)
void residualSetup() override
virtual void setActiveFEVariableCoupleableMatrixTags(std::set< TagID > &mtags, const THREAD_ID tid) override
void setSteadyStateConvergenceName(const ConvergenceName &convergence_name)
Sets the steady-state detection convergence object name if there is one.
bool _preserve_matrix_sparsity_pattern
Whether to preserve the system matrix / Jacobian sparsity pattern, using 0-valued entries usually.
virtual Real computeDamping(const NumericVector< libMesh::Number > &soln, const NumericVector< libMesh::Number > &update)
virtual void addKokkosPostprocessor(const std::string &pp_name, const std::string &name, InputParameters ¶meters)
virtual bool updateSolution(NumericVector< libMesh::Number > &vec_solution, NumericVector< libMesh::Number > &ghosted_solution)
Update the solution.
std::vector< VariablePhiValue > _phi_zero
bool acceptInvalidSolution() const
Whether or not to accept the solution based on its invalidity.
libMesh::Order _max_scalar_order
Maximum scalar variable order.
bool hasPostprocessorValueByName(const PostprocessorName &name) const
Whether or not a Postprocessor value exists by a given name.
CoverageCheckMode _kernel_coverage_check
Determines whether and which subdomains are to be checked to ensure that they have an active kernel.
std::set< TagID > _linear_vector_tags
Temporary storage for filtered vector tags for linear systems.
GeometricSearchData _geometric_search_data
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
ExecFlagType _current_execute_on_flag
Current execute_on flag.
void setCoordSystem(const std::vector< SubdomainName > &blocks, const MultiMooseEnum &coord_sys)
ExecuteMooseObjectWarehouse< TransientMultiApp > _transient_multi_apps
Storage for TransientMultiApps (only needed for calling 'computeDT')
const ExecuteMooseObjectWarehouse< Transfer > & getMultiAppTransferWarehouse(Transfer::DIRECTION direction) const
Return the complete warehouse for MultiAppTransfer object for the given direction.
Moose::Kokkos::MaterialPropertyStorage & _kokkos_bnd_material_props
void bumpVolumeQRuleOrder(libMesh::Order order, SubdomainID block)
Increases the element/volume quadrature order for the specified mesh block if and only if the current...
void clearCurrentResidualVectorTags()
Clear the current residual vector tag data structure.
virtual void addInitialCondition(const std::string &ic_name, const std::string &name, InputParameters ¶meters)
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual void computeUserObjectByName(const ExecFlagType &type, const Moose::AuxGroup &group, const std::string &name)
Compute an user object with the given name.
virtual void addFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters ¶meters)
virtual void addTransfer(const std::string &transfer_name, const std::string &name, InputParameters ¶meters)
Add a Transfer to the problem.
std::shared_ptr< MaterialBase > getMaterial(std::string name, Moose::MaterialDataType type, const THREAD_ID tid=0, bool no_warn=false)
Return a pointer to a MaterialBase object.
virtual void addFVGradientMethod(const std::string &method_type, const std::string &name, InputParameters ¶meters)
Add an FV gradient method.
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
virtual void restoreOldSolutions()
Restore old solutions from the backup vectors and deallocate them.
std::map< std::string, unsigned int > _subspace_dim
Dimension of the subspace spanned by the vectors with a given prefix.
virtual void predictorCleanup(NumericVector< libMesh::Number > &ghosted_solution)
Perform cleanup tasks after application of predictor to solution vector.
virtual void addKokkosUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
virtual void getDiracElements(std::set< const Elem * > &elems) override
Fills "elems" with the elements that should be looped over for Dirac Kernels.
bool _ignore_zeros_in_jacobian
Whether to ignore zeros in the Jacobian, thereby leading to a reduced sparsity pattern.
unsigned int _num_grid_steps
Number of steps in a grid sequence.
std::shared_ptr< XFEMInterface > _xfem
Pointer to XFEM controller.
void checkUserObjectNameCollision(const std::string &name, const std::string &type) const
Check for name collision between different user objects.
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
void registerRandomInterface(RandomInterface &random_interface, const std::string &name)
virtual void addVectorPostprocessor(const std::string &pp_name, const std::string &name, InputParameters ¶meters)
void reinitBecauseOfGhostingOrNewGeomObjects(bool mortar_changed=false)
Call when it is possible that the needs for ghosted elements has changed.
MooseObjectWarehouse< Indicator > _indicators
void setCoupling(Moose::CouplingType type)
Set the coupling between variables TODO: allow user-defined coupling.
std::map< SolverSystemName, unsigned int > _solver_sys_name_to_num
Map connecting solver system names with their respective systems.
void setAuxKernelParamsAndLog(const std::string &ak_name, const std::string &name, InputParameters ¶meters, const std::string &base_name)
Set the subproblem and system parameters for auxiliary kernels and log their addition.
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters ¶meters)
std::map< std::string, std::unique_ptr< RandomData > > _random_data_objects
A map of objects that consume random numbers.
void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
void parentOutputPositionChanged()
Calls parentOutputPositionChanged() on all sub apps.
bool hasSolverVariable(const std::string &var_name) const
virtual void newAssemblyArray(std::vector< std::shared_ptr< SolverSystem > > &solver_systems)
bool hasSolutionState(unsigned int state, Moose::SolutionIterationType iteration_type) const
Whether we need up to old (1) or older (2) solution states for a given type of iteration.
bool isSolverSystemNonlinear(const unsigned int sys_num)
Check if the solver system is nonlinear.
std::set< TagID > _fe_matrix_tags
FVGradientMethod & getFVGradientMethod(const GradientMethodName &name, const THREAD_ID tid=0)
Retrieve a writable FV gradient method owned by this problem.
std::vector< MeshDisplacedInterface * > _notify_when_mesh_displaces
Objects to be notified when the mesh displaces.
bool _has_nonlocal_coupling
Indicates if nonlocal coupling is required/exists.
virtual bool solverSystemConverged(const unsigned int solver_sys_num) override
bool hasFVGradientMethod(const GradientMethodName &name) const
Check if an FV gradient method with a given name exists.
virtual void addAuxScalarVariable(const std::string &var_name, libMesh::Order order, Real scale_factor=1., const std::set< SubdomainID > *const active_subdomains=NULL)
virtual void addJacobianNeighborLowerD(const THREAD_ID tid) override
bool needsPreviousMultiSystemFixedPointIterationAuxiliary() const
Check to see whether we need to compute the variable values of the previous multi-system fixed point ...
void getFVMatsAndDependencies(SubdomainID block_id, std::vector< std::shared_ptr< MaterialBase > > &face_materials, std::vector< std::shared_ptr< MaterialBase > > &neighbor_materials, std::set< MooseVariableFieldBase * > &variables, const THREAD_ID tid)
Get the materials and variables potentially needed for FV.
Restartable::ManagedValue< RestartableEquationSystems > _req
The EquationSystems object, wrapped for restart.
const bool _force_restart
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep.
virtual bool uDotDotRequested()
Get boolean flag to check whether solution second time derivative needs to be stored.
virtual void restoreSolutions()
virtual void solveLinearSystem(const unsigned int linear_sys_num, const Moose::PetscSupport::PetscOptions *po=nullptr)
Build and solve a linear system.
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void addFVInterpolationMethod(const std::string &method_type, const std::string &name, InputParameters ¶meters)
Add an FV interpolation method.
const bool _material_dependency_check
Determines whether a check to verify material dependencies on every subdomain.
const Positions & getPositionsObject(const std::string &name) const
Get the Positions object by its name.
virtual void executeAllObjects(const ExecFlagType &exec_type)
void executeControls(const ExecFlagType &exec_type)
Performs setup and execute calls for Control objects.
virtual void postExecute()
Method called at the end of the simulation.
virtual void addNodalKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
void setVerboseProblem(bool verbose)
Make the problem be verbose.
const bool _regard_general_exceptions_as_errors
If we catch an exception during residual/Jacobian evaluaton for which we don't have specific handling...
std::vector< std::shared_ptr< Transfer > > getTransfers(ExecFlagType type, Transfer::DIRECTION direction) const
Get Transfers by ExecFlagType and direction.
bool hasMultiApps() const
Returns whether or not the current simulation has any multiapps.
void setCurrentNonlinearSystem(const unsigned int nl_sys_num)
void addOutput(const std::string &, const std::string &, InputParameters &)
Adds an Output object.
virtual void addKokkosLinearFVBC(const std::string &bc_name, const std::string &name, InputParameters ¶meters)
const std::vector< LinearSystemName > _linear_sys_names
The linear system names.
MaterialWarehouse _discrete_materials
virtual void computeJacobianBlock(libMesh::SparseMatrix< libMesh::Number > &jacobian, libMesh::System &precond_system, unsigned int ivar, unsigned int jvar)
Really not a good idea to use this.
Real computeMultiAppsDT(ExecFlagType type)
Find the smallest timestep over all MultiApps.
bool _skip_exception_check
If or not skip 'exception and stop solve'.
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
void setCurrentLinearSystem(unsigned int sys_num)
Set the current linear system pointer.
std::vector< std::vector< std::unique_ptr< Assembly > > > _assembly
The Assembly objects.
unsigned short _current_ic_state
std::map< LinearSystemName, unsigned int > _linear_sys_name_to_num
Map from linear system name to number.
virtual Convergence & getConvergence(const std::string &name, const THREAD_ID tid=0) const
Gets a Convergence object.
virtual void computeNullSpace(libMesh::NonlinearImplicitSystem &sys, std::vector< NumericVector< libMesh::Number > * > &sp)
virtual void reinitElemNeighborAndLowerD(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
void computeLinearSystemTags(const NumericVector< libMesh::Number > &soln, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, const bool compute_gradients=true)
Assemble the current linear system given a set of vector and matrix tags.
const std::size_t _num_linear_sys
The number of linear systems.
void handleException(const std::string &calling_method)
Handle exceptions.
virtual void addPostprocessor(const std::string &pp_name, const std::string &name, InputParameters ¶meters)
void setNonlocalCouplingMatrix()
Set custom coupling matrix for variables requiring nonlocal contribution.
unsigned int solverSysNum(const SolverSystemName &solver_sys_name) const override
Moose::Kokkos::MaterialPropertyStorage & _kokkos_material_props
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
std::map< SolverVariableName, unsigned int > _solver_var_to_sys_num
Map connecting variable names with their respective solver systems.
virtual void setActiveScalarVariableCoupleableMatrixTags(std::set< TagID > &mtags, const THREAD_ID tid) override
MooseObjectWarehouse< InternalSideIndicatorBase > _internal_side_indicators
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
bool _requires_nonlocal_coupling
nonlocal coupling requirement flag
const bool _restore_original_nonzero_pattern
Whether we should restore the original nonzero pattern for every Jacobian evaluation.
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase * > *reinit_mats=nullptr)
reinit materials on the neighboring element face
const VectorPostprocessorValue & getVectorPostprocessorValueByName(const std::string &object_name, const std::string &vector_name, std::size_t t_index=0) const
Get a read-only reference to the vector value associated with the VectorPostprocessor.
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
void clearActiveMaterialProperties(const THREAD_ID tid)
Clear the active material properties.
virtual void clearActiveElementalMooseVariables(const THREAD_ID tid) override
Clear the active elemental MooseVariableFEBase.
void setMultiAppFixedPointConvergenceName(const ConvergenceName &convergence_name)
Sets the MultiApp fixed point convergence object name if there is one.
bool _fail_next_system_convergence_check
bool hasUserObject(const std::string &name) const
Check if there if a user object of given name.
bool _reinit_displaced_elem
Whether to call DisplacedProblem::reinitElem when this->reinitElem is called.
std::vector< VariableValue > _scalar_zero
unsigned int linearSysNum(const LinearSystemName &linear_sys_name) const override
bool _const_jacobian
true if the Jacobian is constant
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
virtual void reinitNode(const Node *node, const THREAD_ID tid) override
void createMortarInterface(const std::pair< BoundaryID, BoundaryID > &primary_secondary_boundary_pair, const std::pair< SubdomainID, SubdomainID > &primary_secondary_subdomain_pair, bool on_displaced, bool periodic, const bool debug, const bool correct_edge_dropping, const Real minimum_projection_angle, const Mortar3DSubpatchPlane mortar_3d_subpatch_plane, const MooseEnum &triangulation, const bool triangulate_triangles, const Mortar3DQuadraturePointMapping mortar_3d_qp_mapping=Mortar3DQuadraturePointMapping::NORMAL_PROJECTION)
virtual void addKokkosReporter(const std::string &type, const std::string &name, InputParameters ¶meters)
bool _has_internal_edge_residual_objects
Whether the problem has dgkernels or interface kernels.
virtual void addGhostedBoundary(BoundaryID boundary_id) override
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
const libMesh::ConstElemRange & getEvaluableElementRange()
In general, {evaluable elements} >= {local elements} U {algebraic ghosting elements}.
virtual void addAuxScalarKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void addKokkosMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
std::unique_ptr< libMesh::ConstNodeRange > _current_algebraic_node_range
virtual void addDGKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
void setCurrentAlgebraicBndNodeRange(ConstBndNodeRange *range)
virtual void prepareFace(const Elem *elem, const THREAD_ID tid) override
const FVAdvectedInterpolationMethod & getFVAdvectedInterpolationMethod(const InterpolationMethodName &name, const THREAD_ID tid=0) const
Retrieve an advected interpolation method.
virtual void addKokkosKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
void prepareMaterials(const std::unordered_set< unsigned int > &consumer_needed_mat_props, const SubdomainID blk_id, const THREAD_ID tid)
Add the MooseVariables and the material properties that the current materials depend on to the depend...
void checkCoordinateSystems()
Verify that there are no element type/coordinate type conflicts.
MaterialPropertyStorage & _bnd_material_props
void logAdd(const std::string &system, const std::string &name, const std::string &type, const InputParameters ¶ms) const
Output information about the object just added to the problem.
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
void initKokkos()
Construct Kokkos assembly and systems and allocate Kokkos material property storages.
virtual void initNullSpaceVectors(const InputParameters ¶meters, std::vector< std::shared_ptr< NonlinearSystemBase > > &nl)
void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID, const THREAD_ID tid)
unsigned int _max_qps
Maximum number of quadrature points used in the problem.
void checkDuplicatePostprocessorVariableNames()
virtual void reinitLowerDElem(const Elem *lower_d_elem, const THREAD_ID tid, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
virtual void addDiracKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
void forceOutput()
Indicates that the next call to outputStep should be forced.
void backupGeometricSearchState()
Snapshot geometric search state (both on the regular and, if present, the displaced mesh) so it can b...
virtual void solve(const unsigned int nl_sys_num)
std::optional< ConvergenceName > _steady_state_convergence_name
Steady-state detection convergence name.
virtual void addDefaultNonlinearConvergence(const InputParameters ¶ms)
Adds the default nonlinear Convergence associated with the problem.
const std::unordered_map< std::pair< BoundaryID, BoundaryID >, MortarInterfaceConfig > & getMortarInterfaces(bool on_displaced) const
void setVariableAllDoFMap(const std::vector< const MooseVariableFEBase * > &moose_vars)
FEProblemBase(const InputParameters ¶meters)
void projectFunctionOnCustomRange(ConstElemRange &elem_range, Number(*func)(const Point &, const libMesh::Parameters &, const std::string &, const std::string &), Gradient(*func_grad)(const Point &, const libMesh::Parameters &, const std::string &, const std::string &), const libMesh::Parameters ¶ms, const std::vector< VariableName > &target_vars)
Project a function onto a range of elements for a given variable.
InitialConditionWarehouse _ics
virtual void checkExceptionAndStopSolve(bool print_message=true)
Check to see if an exception has occurred on any processor and, if possible, force the solve to fail,...
NonlinearSystemBase & currentNonlinearSystem()
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
void checkUserObjectJacobianRequirement(THREAD_ID tid)
bool duplicateVariableCheck(const std::string &var_name, const libMesh::FEType &type, bool is_aux, const std::set< SubdomainID > *const active_subdomains)
Helper to check for duplicate variable names across systems or within a single system.
void restoreMultiApps(ExecFlagType type, bool force=false)
Restore the MultiApps associated with the ExecFlagType.
void needsPreviousMultiAppFixedPointIterationSolution(bool needed, const unsigned int solver_sys_num)
Set a flag that indicated that user required values for the previous multiapp fixed point iterate for...
virtual unsigned int currentNlSysNum() const override
bool execMultiApps(ExecFlagType type, bool auto_advance=true)
Execute the MultiApps associated with the ExecFlagType.
void setPostprocessorValueByName(const PostprocessorName &name, const PostprocessorValue &value, std::size_t t_index=0)
Set the value of a PostprocessorValue.
void computeResidual(libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
This function is called by Libmesh to form a residual.
virtual Real & timeOld() const
virtual void computeBounds(libMesh::NonlinearImplicitSystem &sys, NumericVector< libMesh::Number > &lower, NumericVector< libMesh::Number > &upper)
MaterialWarehouse _all_materials
void setVectorPostprocessorValueByName(const std::string &object_name, const std::string &vector_name, const VectorPostprocessorValue &value, std::size_t t_index=0)
Set the value of a VectorPostprocessor vector.
virtual unsigned int nlSysNum(const NonlinearSystemName &nl_sys_name) const override
const libMesh::ConstElemRange & getNonlinearEvaluableElementRange()
PetscOptions _petsc_option_data_base
virtual unsigned int nNonlinearIterations(const unsigned int nl_sys_num) const override
void setPreserveMatrixSparsityPattern(bool preserve)
Set whether the sparsity pattern of the matrices being formed during the solve (usually the Jacobian)...
bool _has_time_integrator
Indicates whether or not this executioner has a time integrator (during setup)
void computeResidualAndJacobian(const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, libMesh::SparseMatrix< libMesh::Number > &jacobian)
Form a residual and Jacobian with default tags.
void timestepSetup() override
virtual void computeIndicators()
virtual void onTimestepBegin() override
virtual MooseMesh & mesh() override
MaterialWarehouse _kokkos_materials
virtual void setResidualNeighbor(NumericVector< libMesh::Number > &residual, const THREAD_ID tid) override
void setCurrentResidualVectorTags(const std::set< TagID > &vector_tags)
Set the current residual vector tag data structure based on the passed in tag IDs.
virtual void addIndicator(const std::string &indicator_name, const std::string &name, InputParameters ¶meters)
bool _previous_multiapp_fp_aux_solution_required
Indicates we need to save the previous multiapp fixed-point iteration auxiliary variable values.
std::set< TagID > _linear_matrix_tags
Temporary storage for filtered matrix tags for linear systems.
std::vector< std::unordered_map< BoundaryID, bool > > _interface_mat_side_cache
Cache for calculating materials on interface.
virtual void createQRules(libMesh::QuadratureType type, libMesh::Order order, libMesh::Order volume_order=libMesh::INVALID_ORDER, libMesh::Order face_order=libMesh::INVALID_ORDER, SubdomainID block=Moose::ANY_BLOCK_ID, bool allow_negative_qweights=true)
MooseObjectWarehouse< MeshDivision > _mesh_divisions
Warehouse to store mesh divisions NOTE: this could probably be moved to the MooseMesh instead of the ...
virtual void computePostCheck(libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &old_soln, NumericVector< libMesh::Number > &search_direction, NumericVector< libMesh::Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln)
Real getTimeFromStateArg(const Moose::StateArg &state) const
Returns the time associated with the requested state.
void setActiveMaterialProperties(const std::unordered_set< unsigned int > &mat_prop_ids, const THREAD_ID tid)
Record and set the material properties required by the current computing thread.
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
Get the user object by its name.
std::optional< std::vector< ConvergenceName > > _linear_convergence_names
Linear system(s) convergence name(s) (if any)
MooseObjectWarehouse< Moose::FunctionBase > _kokkos_functions
MooseEnum _verbose_setup
Whether or not to be verbose during setup.
void addDefaultSteadyStateConvergence(const InputParameters ¶ms)
Adds the default steady-state detection Convergence.
virtual void reinitNeighborFaceRef(const Elem *neighbor_elem, unsigned int neighbor_side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0) override
reinitialize FE objects on a given neighbor element on a given side at a given set of reference point...
FVInitialConditionWarehouse _fv_ics
virtual void addDisplacedProblem(std::shared_ptr< DisplacedProblem > displaced_problem)
const bool _boundary_restricted_elem_integrity_check
whether to perform checking of boundary restricted elemental object variable dependencies,...
virtual void addKokkosFunction(const std::string &type, const std::string &name, InputParameters ¶meters)
Add a Kokkos function to the problem.
virtual void updateMortarMesh()
virtual bool hasFunction(const std::string &name, const THREAD_ID tid=0)
bool computingNonlinearResid() const
Returns true if the problem is in the process of computing the nonlinear residual.
virtual void computeResidualTag(const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)
Form a residual vector for a given tag.
std::vector< std::unordered_map< BoundaryID, bool > > _bnd_mat_side_cache
Cache for calculating materials on side.
void reinitMaterialsFaceOnBoundary(const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const reinit_mats=nullptr)
reinit materials on element faces on a boundary (internal or external) This specific routine helps us...
NonlinearSystemBase * _current_nl_sys
The current nonlinear system that we are solving.
const bool _uo_aux_state_check
Whether or not checking the state of uo/aux evaluation.
bool _started_initial_setup
At or beyond initialSteup stage.
std::vector< SolverSystemName > _solver_sys_names
The union of nonlinear and linear system names.
void reinitMaterialsBoundary(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase * > *reinit_mats=nullptr)
reinit materials on a boundary
virtual void addLinearFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters ¶meters)
virtual void saveOldSolutions()
Allocate vectors and save old solutions into them.
const std::vector< ConvergenceName > & getLinearConvergenceNames() const
Gets the linear convergence object name(s).
void checkICRestartError(const std::string &ic_name, const std::string &name, const VariableName &var_name)
Checks if the variable of the initial condition is getting restarted and errors for specific cases.
std::vector< MeshChangedInterface * > _notify_when_mesh_changes
Objects to be notified when the mesh changes.
virtual void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
Canonical method for adding an auxiliary variable.
std::shared_ptr< DisplacedProblem > _displaced_problem
void computeUserObjectsInternal(const ExecFlagType &type, TheWarehouse::Query &query)
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFEBase * > &moose_vars, const THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
bool _verbose_restore
Whether or not to be verbose on solution restoration post a failed time step.
virtual void computeJacobianBlocks(std::vector< JacobianBlock * > &blocks, const unsigned int nl_sys_num)
Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditio...
void reinitMortarUserObjects(BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id, bool displaced)
Call reinit on mortar user objects with matching primary boundary ID, secondary boundary ID,...
bool haveADObjects() const
Method for reading wehther we have any ad objects.
virtual void swapBackMaterials(const THREAD_ID tid)
virtual void initialAdaptMesh()
void executeSamplers(const ExecFlagType &exec_type)
Performs setup and execute calls for Sampler objects.
void backupMultiApps(ExecFlagType type)
Backup the MultiApps associated with the ExecFlagType.
const std::size_t _num_nl_sys
The number of nonlinear systems.
virtual std::string solverTypeString(unsigned int solver_sys_num=0)
Return solver type as a human readable string.
virtual void clearActiveScalarVariableCoupleableMatrixTags(const THREAD_ID tid) override
std::vector< VectorVariableCurl > _vector_curl_zero
virtual bool checkNonlocalCouplingRequirement() const override
void setCurrentExecuteOnFlag(const ExecFlagType &)
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid) override
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
bool _has_mortar
Whether the simulation requires mortar coupling.
std::vector< bool > _previous_multiapp_fp_nl_solution_required
Indicates we need to save the previous multiapp fixed-point iteration solver variable values.
virtual void addAuxArrayVariable(const std::string &var_name, const libMesh::FEType &type, unsigned int components, const std::set< SubdomainID > *const active_subdomains=NULL)
void setCurrentlyComputingResidual(bool currently_computing_residual) final
Set whether or not the problem is in the process of computing the residual.
const unsigned int _num_concurrent_multiapps
Number of concurrent applications being solved at the same time.
virtual std::vector< VariableName > getVariableNames()
Returns a list of all the variables in the problem (both from the NL and Aux systems.
virtual void updateGeomSearch(GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
Update this object's geometric search data as well as the displaced problem's if it exists.
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
void partitionConcurrentMultiApps()
Assign each multiapp that shares an 'execution_order_group' with others a disjoint subset of the rank...
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
bool _calculate_jacobian_in_uo
MeshDivision & getMeshDivision(const std::string &name, const THREAD_ID tid=0) const
Get a MeshDivision.
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
bool _reinit_displaced_face
Whether to call DisplacedProblem::reinitElemFace when this->reinitElemFace is called.
bool _has_initialized_stateful
Whether nor not stateful materials have been initialized.
bool _has_constraints
Whether or not this system has any Constraints.
std::vector< MortarUserObject * > getMortarUserObjects(BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id, bool displaced, const std::vector< MortarUserObject * > &mortar_uo_superset)
Helper for getting mortar objects corresponding to primary boundary ID, secondary boundary ID,...
std::vector< std::shared_ptr< NonlinearSystemBase > > _nl
The nonlinear systems.
void finishMultiAppStep(ExecFlagType type, bool recurse_through_multiapp_levels=false)
Finish the MultiApp time step (endStep, postStep) associated with the ExecFlagType.
virtual void addKokkosLinearFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void computeJacobianTags(const std::set< TagID > &tags)
Form multiple matrices, and each is associated with a tag.
Moose::PetscSupport::PetscOptions _petsc_options
PETSc option storage.
void checkGradientMethods()
Let every FVGradientMethod resolve its dependencies on other gradient methods.
virtual void addMultiApp(const std::string &multi_app_name, const std::string &name, InputParameters ¶meters)
Add a MultiApp to the problem.
void setResidualObjectParamsAndLog(const std::string &ro_name, const std::string &name, InputParameters ¶meters, const unsigned int nl_sys_num, const std::string &base_name, bool &reinit_displaced)
Set the subproblem and system parameters for residual objects and log their addition.
virtual void addMarker(const std::string &marker_name, const std::string &name, InputParameters ¶meters)
bool needBoundaryMaterialOnSide(BoundaryID bnd_id, const THREAD_ID tid)
These methods are used to determine whether stateful material properties need to be stored on interna...
virtual Distribution & getDistribution(const std::string &name)
TheWarehouse & theWarehouse() const
const bool & currentlyComputingResidual() const
Returns true if the problem is in the process of computing the residual.
virtual void addScalarKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void addKokkosNodalKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual Real finalNonlinearResidual(const unsigned int nl_sys_num) const override
MooseObjectWarehouse< Convergence > _convergences
convergence warehouse
virtual bool hasConvergence(const std::string &name, const THREAD_ID tid=0) const
Returns true if the problem has a Convergence object of the given name.
virtual Real & time() const
bool _has_jacobian
Indicates if the Jacobian was computed.
virtual const SystemBase & systemBaseSolver(const unsigned int sys_num) const override
Return the solver system object as a base class reference given the system number.
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
virtual void addFVInterfaceKernel(const std::string &fv_ik_name, const std::string &name, InputParameters ¶meters)
void bumpAllQRuleOrder(libMesh::Order order, SubdomainID block)
virtual void addFVInitialCondition(const std::string &ic_name, const std::string &name, InputParameters ¶meters)
Add an initial condition for a finite volume variables.
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > & fieldScalarCouplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num) const
std::vector< std::vector< const MooseVariableFEBase * > > _uo_jacobian_moose_vars
Adaptivity & adaptivity()
virtual void computeResidualType(const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual, TagID tag)
Form a residual vector for a given tag and "residual" tag.
virtual Real & timeOlder() const
The time two steps back.
void reinitMaterialsNeighborOnBoundary(const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const reinit_mats=nullptr)
reinit materials on neighbor element (usually faces) on a boundary (internal or external) This specif...
virtual void addInterfaceKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void addReporter(const std::string &type, const std::string &name, InputParameters ¶meters)
Add a Reporter object to the simulation.
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
std::vector< unsigned char > _has_active_material_properties
Whether there are active material properties on each thread.
void execMultiAppTransfers(ExecFlagType type, Transfer::DIRECTION direction, const MultiAppName &source_app="")
Execute MultiAppTransfers associated with execution flag and direction.
Moose::CouplingType _coupling
Type of variable coupling.
bool _has_exception
Whether or not an exception has occurred.
MooseAppCoordTransform & coordTransform()
virtual void copySolutionsBackwards()
std::vector< Real > _real_zero
Convenience zeros.
void reinitMaterialsInterface(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true)
virtual void addConstraint(const std::string &c_name, const std::string &name, InputParameters ¶meters)
virtual void setCurrentLowerDElem(const Elem *const lower_d_elem, const THREAD_ID tid) override
Set the current lower dimensional element.
virtual void initPetscOutputAndSomeSolverSettings()
Reinitialize PETSc output for proper linear/nonlinear iteration display.
void allowOutput(bool state)
Ability to enable/disable all output calls.
void computeKokkosUserObjectsInternal(const ExecFlagType &type, TheWarehouse::Query &query)
bool hasMultiApp(const std::string &name) const
virtual void meshDisplaced()
Update data after a mesh displaced.
std::unique_ptr< libMesh::ConstElemRange > _evaluable_local_elem_range
std::vector< MooseArray< ADRealTensorValue > > _ad_second_zero
virtual void setResidual(NumericVector< libMesh::Number > &residual, const THREAD_ID tid) override
void initKokkosStatefulProps()
virtual bool isTransient() const override
virtual void addCachedResidualDirectly(NumericVector< libMesh::Number > &residual, const THREAD_ID tid)
Allows for all the residual contributions that are currently cached to be added directly into the vec...
virtual void addFunctorMaterial(const std::string &functor_material_name, const std::string &name, InputParameters ¶meters)
virtual void addDamper(const std::string &damper_name, const std::string &name, InputParameters ¶meters)
virtual void computeMarkers()
const ConvergenceName & getMultiAppFixedPointConvergenceName() const
Gets the MultiApp fixed point convergence object name.
static SolverParams makeLinearSolverParams()
Make basic solver params for linear solves.
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
unsigned int _cycles_completed
ExecFlagEnum _print_execution_on
When to print the execution of loops.
virtual void clearActiveScalarVariableCoupleableVectorTags(const THREAD_ID tid) override
std::vector< Point > _point_zero
std::vector< MooseArray< ADReal > > _ad_zero
virtual void computeJacobianTag(const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, TagID tag)
Form a Jacobian matrix for a given tag.
void createTagSolutions()
Create extra tagged solution vectors.
virtual void prepareAssemblyNeighbor(const THREAD_ID tid)
Begin a fresh neighbor accumulation phase by sizing and zeroing the neighbor blocks.
MooseObjectWarehouse< Function > _functions
functions
virtual const SystemBase & systemBaseNonlinear(const unsigned int sys_num) const override
Return the nonlinear system object as a base class reference given the system number.
CoverageCheckMode _material_coverage_check
Determines whether and which subdomains are to be checked to ensure that they have an active material...
const std::set< const MooseObject * > & getMaterialPropertyStorageConsumers(Moose::MaterialDataType type) const
virtual void clearActiveFEVariableCoupleableMatrixTags(const THREAD_ID tid) override
virtual const SystemBase & getSystemBase(const unsigned int sys_num) const
Get constant reference to a system in this problem.
bool allowInvalidSolution() const
Whether to accept / allow an invalid solution.
void needsPreviousMultiSystemFixedPointIterationSolution(bool needed, const unsigned int solver_sys_num)
Set a flag that indicates that user requires values for the previous multi-system fixed point iterate...
void addDefaultMultiAppFixedPointConvergence(const InputParameters ¶ms)
Adds the default fixed point Convergence associated with the problem.
bool hasActiveMaterialProperties(const THREAD_ID tid) const
Method to check whether or not a list of active material roperties has been set.
virtual unsigned int nLinearIterations(const unsigned int nl_sys_num) const override
std::optional< std::vector< ConvergenceName > > _nonlinear_convergence_names
Nonlinear system(s) convergence name(s)
virtual Real computeResidualL2Norm()
Computes the residual using whatever is sitting in the current solution vector then returns the L2 no...
std::unique_ptr< ConstBndNodeRange > _current_algebraic_bnd_node_range
virtual void addFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void computeTransposeNullSpace(libMesh::NonlinearImplicitSystem &sys, std::vector< NumericVector< libMesh::Number > * > &sp)
void initialSetup() override
bool _previous_multisystem_fp_aux_solution_required
Indicates we need to save the previous multi-system fixed-point iteration auxiliary variable values.
std::vector< VariableValue > _zero
virtual void outputStep(ExecFlagType type)
Output the current step.
MooseObjectWarehouse< Marker > _markers
std::vector< std::shared_ptr< SolverSystem > > _solver_systems
Combined container to base pointer of every solver system.
void getUOExecutionGroups(TheWarehouse::Query &query, std::set< int > &execution_groups) const
bool _is_petsc_options_inserted
If or not PETSc options have been added to database.
void notifyWhenMeshChanges(MeshChangedInterface *mci)
Register an object that derives from MeshChangedInterface to be notified when the mesh changes.
virtual void ghostGhostedBoundaries() override
Causes the boundaries added using addGhostedBoundary to actually be ghosted.
virtual void computeJacobianInternal(const NumericVector< libMesh::Number > &soln, libMesh::SparseMatrix< libMesh::Number > &jacobian, const std::set< TagID > &tags)
Form a Jacobian matrix for multiple tags.
virtual void cacheResidualNeighbor(const THREAD_ID tid) override
virtual void computeResidualSys(libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
This function is called by Libmesh to form a residual.
virtual void computeIndicatorsAndMarkers()
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
const std::vector< NonlinearSystemName > _nl_sys_names
The nonlinear system names.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
const bool _fv_face_integrity_check
Whether to check FV boundary and interface objects against the faces on which they execute.
virtual void meshChanged()
Deprecated.
virtual std::pair< bool, unsigned int > determineSolverSystem(const std::string &var_name, bool error_if_not_found=false) const override
Determine what solver system the provided variable name lies in.
virtual libMesh::System & getSystem(const std::string &var_name) override
Returns the equation system containing the variable provided.
void uniformRefine()
uniformly refine the problem mesh(es).
MooseMesh * _displaced_mesh
ExecuteMooseObjectWarehouse< Transfer > _from_multi_app_transfers
Transfers executed just after MultiApps to transfer data from them.
void initXFEM(std::shared_ptr< XFEMInterface > xfem)
Create XFEM controller object.
std::vector< SubdomainName > _kernel_coverage_blocks
static InputParameters validParams()
MaterialPropertyRegistry _material_prop_registry
virtual bool computingPreSMOResidual(const unsigned int nl_sys_num) const override
Returns true if the problem is in the process of computing it's initial residual.
bool automaticScaling() const
Automatic scaling getter.
bool constJacobian() const
Returns _const_jacobian (whether a MOOSE object has specified that the Jacobian is the same as the pr...
virtual void addMeshDivision(const std::string &type, const std::string &name, InputParameters ¶ms)
Add a MeshDivision.
virtual void prepareNeighborShapes(unsigned int var, const THREAD_ID tid) override
const bool _allow_ics_during_restart
virtual void addKokkosVectorPostprocessor(const std::string &pp_name, const std::string &name, InputParameters ¶meters)
Interface for interpolation methods that provide matrix and RHS contributions for advected face value...
Abstract base class for interpolation methods that produce a scalar face value from adjacent cell val...
Base class for linear finite-volume cell-gradient methods.
This is a template class that implements the workhorse compute and computeNodal methods.
void initialSetup(THREAD_ID tid)
Initial setup.
void addObject(std::shared_ptr< FVInitialConditionBase > object, THREAD_ID tid, bool recurse=true)
Add object to the warehouse.
Registered base class for linear FV interpolation objects.
This data structure is used to store geometric and variable related metadata about each cell face in ...
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters ¶meters, THREAD_ID tid=0, bool print_deprecated=true)
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Scope guard for starting and stopping Floating Point Exception Trapping.
Base class for function objects.
FunctorMaterials compute functor material properties.
void reinit()
Completely redo all geometric search objects.
void restore()
Restore the PenetrationLocators' state captured by the most recent backup().
GeometricSearchType
Used to select groups of geometric search objects to update.
std::map< std::pair< BoundaryID, BoundaryID >, NearestNodeLocator * > _nearest_node_locators
void clearNearestNodeLocators()
Clear out the Penetration Locators so they will redo the search.
void updateGhostedElems()
Updates the list of ghosted elements at the start of each time step for the nonlinear iteration patch...
void update(GeometricSearchType type=ALL)
Update all of the search objects.
void backup()
Snapshot the PenetrationLocators' restartable state (the same state used for restart/recover),...
This is a template class that implements the workhorse compute and computeNodal methods.
std::set< std::string > getDependObjects() const
Get a list of dependent UserObjects for this exec type.
void addObject(std::shared_ptr< InitialConditionBase > object, THREAD_ID tid, bool recurse=true)
Add object to the warehouse.
void initialSetup(THREAD_ID tid)
Initial setup.
Helper class for holding the preconditioning blocks to fill.
Linear system to be solved.
virtual void stopSolve(const ExecFlagType &exec_flag, const std::set< TagID > &vector_tags_to_close) override
Quit the current solve as soon as possible.
TagID rightHandSideVectorTag() const
virtual TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
NumericVector< Number > & getRightHandSideVector()
Fetching the right hand side vector from the libmesh system.
SparseMatrix< Number > & getSystemMatrix()
Fetching the system matrix from the libmesh system.
libMesh::LinearImplicitSystem & linearImplicitSystem()
Return a reference to the stored linear implicit system.
void computeLinearSystemTags(const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, const bool compute_gradients=true)
Compute the right hand side and the system matrix of the system for given tags.
virtual void compute(ExecFlagType type) override
Compute time derivatives, auxiliary variables, etc.
virtual void solve() override
Solve the system (using libMesh magic)
MaterialBases compute MaterialProperties.
Proxy for accessing MaterialPropertyStorage.
void resize(unsigned int n_qpoints)
Resize the data to hold properties for n_qpoints quadrature points.
void swapBack(const Elem &elem, unsigned int side=0)
material properties for given element (and possible side)
const std::string & getName(const unsigned int id) const
Stores the stateful material properties computed by materials.
bool hasStatefulProperties() const
const std::set< const MooseObject * > & getConsumers(Moose::MaterialDataType type) const
void eraseProperty(const Elem *elem)
Remove the property storage and element pointer from internal data structures Use this when elements ...
void shift()
Shift the material properties in time.
void addConsumer(Moose::MaterialDataType type, const MooseObject *object)
Add object as the consumer of storage of type type.
const MaterialData & getMaterialData(const THREAD_ID tid) const
virtual void jacobianSetup(THREAD_ID tid=0) const override
void addObjects(std::shared_ptr< MaterialBase > block, std::shared_ptr< MaterialBase > neighbor, std::shared_ptr< MaterialBase > face, THREAD_ID tid=0)
A special method unique to this class for adding Block, Neighbor, and Face material objects.
virtual void updateActive(THREAD_ID tid=0) override
Update the active status of Kernels.
void sort(THREAD_ID tid=0, bool sort_all_objects=false)
By default, this method only sorts block and boundary-wise object storages that are used by the MOOSE...
virtual void subdomainSetup(THREAD_ID tid=0) const override
virtual void neighborSubdomainSetup(THREAD_ID tid=0) const
virtual void residualSetup(THREAD_ID tid=0) const override
virtual void timestepSetup(THREAD_ID tid=0) const override
virtual void initialSetup(THREAD_ID tid=0) const override
Convenience methods for calling object setup methods that handle the extra neighbor and face objects.
This class determines the maximum number of Quadrature Points and Shape Functions used for a given si...
Interface for notifications that the mesh has changed.
Interface for objects acting when the mesh has been displaced.
Base class for MeshDivision objects.
Base class for MOOSE-based applications.
bool restoredInitialBackupMesh() const
Whether this app has restored mesh topology from its initial Backup object.
void restoreFromInitialBackup(const bool for_restart)
Restores from a "initial" backup, that is, one set in _initial_backup.
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
bool hasStartTime() const
void setRestart(bool value)
Sets the restart/recover flags.
bool isRestarting() const
Whether or not this is a "restart" calculation.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
ChainControlDataSystem & getChainControlDataSystem()
Gets the system that manages the ChainControls.
std::unique_ptr< Backup > finalizeRestore()
Finalizes (closes) the restoration process done in restore().
void setRestartRecoverFileBase(const std::string &file_base)
mutator for recover_base (set by RecoverBaseAction)
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
void restore(const std::filesystem::path &folder_base, const bool for_restart)
Restore an application from file.
std::string getRestartRecoverFileBase() const
The file_base for the recovery file.
const ExecFlagEnum & getExecuteOnEnum() const
Return the app level ExecFlagEnum, this contains all the available flags for the app.
bool getExodusFileRestart() const
Whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh.
bool isRecovering() const
Whether or not this is a "recover" calculation.
libMesh::ExodusII_IO * getExReaderForRestart() const
Get the Exodus reader to restart variables from an Exodus mesh file.
bool hasInitialBackup() const
Real getStartTime() const
std::filesystem::path restartFolderBase(const std::filesystem::path &folder_base) const
The file suffix for restartable data.
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
void markMeshChangedForBackup()
Mark this app as requiring mesh topology data in its next Backup object.
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.
void paramInfo(const std::string ¶m, Args... args) const
Emits an informational message prefixed with the file and line number of the given param (from the in...
std::string typeAndName() const
Get the class's combined type and name; useful in error handling.
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
const std::string & _type
The type of this class.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
static const std::string app_param
The name of the parameter that contains the MooseApp.
Class for containing MooseEnum item information.
const std::string & name() const
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Provides a way for users to bail out of the current solve.
virtual const char * what() const
Get out the error message.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
const Moose::PatchUpdateType & getPatchUpdateStrategy() const
Get the current patch update strategy.
void setupFiniteVolumeMeshData() const
Sets up the additional data needed for finite volume computations.
const std::set< BoundaryID > & getSubdomainBoundaryIds(const SubdomainID subdomain_id) const
Get the list of boundary ids associated with the given subdomain id.
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
face_info_iterator ownedFaceInfoEnd()
void meshChanged()
Declares that the MooseMesh has changed, invalidates cached data and rebuilds caches.
virtual const Node & nodeRef(const dof_id_type i) const
const std::vector< const Elem * > & coarsenedElementChildren(const Elem *elem) const
Get the newly removed children element ids for an element that was just coarsened.
unsigned int uniformRefineLevel() const
Returns the level of uniform refinement requested (zero if AMR is disabled).
elem_info_iterator ownedElemInfoEnd()
virtual Elem * elemPtr(const dof_id_type i)
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
void buildRefinementAndCoarseningMaps(Assembly *assembly)
Create the refinement and coarsening maps necessary for projection of stateful material properties wh...
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
const std::string & getBoundaryName(const BoundaryID boundary_id) const
Return the name of the boundary given the id.
MooseAppCoordTransform & coordTransform()
void addGhostedBoundary(BoundaryID boundary_id)
This will add the boundary ids to be ghosted to this processor.
ConstElemPointerRange * refinedElementRange() const
Return a range that is suitable for threaded execution over elements that were just refined.
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
libMesh::ConstNodeRange * getLocalNodeRange()
elem_info_iterator ownedElemInfoBegin()
Iterators to owned faceInfo objects.
void ghostGhostedBoundaries()
Actually do the ghosting of boundaries that need to be ghosted to this processor.
void updateActiveSemiLocalNodeRange(std::set< dof_id_type > &ghosted_elems)
Clears the "semi-local" node list and rebuilds it.
void checkCoordinateSystems()
Performs a sanity check for every element in the mesh.
bool isFiniteVolumeInfoDirty() const
virtual Elem * queryElemPtr(const dof_id_type i)
void cacheChangedLists()
Cache information about what elements were refined and coarsened in the previous step.
const std::set< SubdomainID > & interiorLowerDBlocks() const
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
ConstElemPointerRange * coarsenedElementRange() const
Return a range that is suitable for threaded execution over elements that were just coarsened.
const std::string & getSubdomainName(SubdomainID subdomain_id) const
Return the name of a block given an id.
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
void setCoordSystem(const std::vector< SubdomainName > &blocks, const MultiMooseEnum &coord_sys)
Set the coordinate system for the provided blocks to coord_sys.
const MeshBase::element_iterator activeLocalElementsEnd()
void doingPRefinement(bool doing_p_refinement)
Indicate whether the kind of adaptivity we're doing includes p-refinement.
void setAxisymmetricCoordAxis(const MooseEnum &rz_coord_axis)
For axisymmetric simulations, set the symmetry coordinate axis.
const libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems,...
const std::set< SubdomainID > & boundaryLowerDBlocks() const
libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
MeshBase::element_iterator activeLocalElementsBegin()
Calls active_local_nodes_begin/end() on the underlying libMesh mesh object.
void buildPRefinementAndCoarseningMaps(Assembly *assembly)
A class for storing the names of MooseObject by tag and object name.
A class for storing an input parameter name.
void updateVariableDependency(std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
Update variable dependency vector.
std::shared_ptr< T > getActiveObject(const std::string &name, THREAD_ID tid=0) const
std::set< SubdomainID > getActiveBlocks(THREAD_ID tid=0) const
Return a set of active SubdomainsIDs.
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
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.
bool hasActiveObject(const std::string &name, THREAD_ID tid=0) const
Convenience functions for checking/getting specific objects.
void sort(THREAD_ID tid=0)
Sort the objects using the DependencyResolver.
void updateBlockMatPropDependency(SubdomainID id, std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true)
Adds an object to the storage structure.
void updateBoundaryVariableDependency(std::set< MooseVariableFieldBase * > &needed_moose_vars, THREAD_ID tid=0) const
bool hasActiveObjects(THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
void updateBoundaryMatPropDependency(std::unordered_set< unsigned int > &needed_mat_props, THREAD_ID tid=0, const bool producer_only=false) const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasObjects(THREAD_ID tid=0) const
Convenience functions for determining if objects exist.
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread.
std::shared_ptr< T > getObject(const std::string &name, THREAD_ID tid=0) const
A storage container for MooseObjects that inherit from SetupInterface.
virtual void timestepSetup(THREAD_ID tid=0) const
virtual void customSetup(const ExecFlagType &exec_type, THREAD_ID tid=0) const
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
virtual void residualSetup(THREAD_ID tid=0) const
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
virtual void updateActive(THREAD_ID tid=0) override
Update the active status of Kernels.
virtual void jacobianSetup(THREAD_ID tid=0) const
Every object that can be built by the factory should be derived from this class.
MooseApp & _app
The MOOSE application this is associated with.
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
SystemBase & sys()
Get the system this variable is part of.
const std::vector< dof_id_type > & allDofIndices() const
Get all global dofindices for the variable.
libMesh::Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int.
unsigned int number() const
Get variable number coming from libMesh.
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual void insert(libMesh::NumericVector< libMesh::Number > &vector)=0
Insert the currently cached degree of freedom values into the provided vector.
virtual void prepare()=0
Prepare the elemental degrees of freedom.
Class for scalar variables (they are different).
void setValue(unsigned int i, Number value)
Set the nodal value for this variable (to keep everything up to date.
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
Base class template for functor objects.
void shift()
Shift current, old, and older material property data storages.
A struct for storing the various types of petsc options and values.
Base class for all MultiAppTransfer objects.
A MultiApp represents one or more MOOSE applications that are running simultaneously.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
A user object that runs over all the nodes and does an aggregation step to compute a single value.
Nonlinear system to be solved.
TagID timeVectorTag() const override
Ideally, we should not need this API.
void computeResidualTags(const std::set< TagID > &tags)
Form multiple tag-associated residual vectors for all the given tags.
Real computeDamping(const NumericVector< Number > &solution, const NumericVector< Number > &update)
Compute damping.
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
virtual NumericVector< Number > & RHS()=0
virtual void setPreviousNewtonSolution(const NumericVector< Number > &soln)
void computeJacobianBlocks(std::vector< JacobianBlock * > &blocks)
Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditio...
virtual void solve() override=0
Solve the system (using libMesh magic)
void computeJacobianTags(const std::set< TagID > &tags)
Computes multiple (tag associated) Jacobian matricese.
TagID nonTimeVectorTag() const override
virtual libMesh::System & system() override
Get the reference to the libMesh system.
void setupDM()
Setup the PETSc DM object (when appropriate)
void computeResidualAndJacobianTags(const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
Form possibly multiple tag-associated vectors and matrices.
TagID residualVectorTag() const override
Nonlinear system to be solved.
Class for storing and utilizing output objects.
const InputParameters * getCommonParameters() const
Get a reference to the common output parameters.
bool isReservedName(const std::string &name)
Test if the given name is reserved.
void solveSetup()
Calls the timestepSetup function for each of the output objects.
void jacobianSetup()
Calls the jacobianSetup function for each of the output objects.
void forceOutput()
Indicates that the next call to outputStep should be forced This is private, users should utilize FEP...
void timestepSetup()
Calls the timestepSetup function for each of the output objects.
void initialSetup()
Calls the initialSetup function for each of the output objects.
void customSetup(const ExecFlagType &exec_type)
Calls the setup function for each of the output objects.
bool hasOutput(const std::string &name) const
Returns true if the output object exists.
void subdomainSetup()
Calls the subdomainSetup function for each of the output objects.
void mooseConsole()
Send current output buffer to Console output objects.
void residualSetup()
Calls the residualSetup function for each of the output objects.
void outputStep(ExecFlagType type)
Calls the outputStep method for each output object.
void allowOutput(bool state)
Ability to enable/disable output calls This is private, users should utilize FEProblemBase::allowOutp...
void addOutput(std::shared_ptr< Output > output)
Adds an existing output object to the warehouse.
Based class for output objects.
Positions objects are under the hood Reporters.
A ReporterName that represents a Postprocessor.
Base class for all Postprocessors.
Base class for predictors.
Interface for objects that need parallel consistent random numbers without patterns over the course o...
void setRandomDataPointer(RandomData *random_data)
RedistributeProperties is used for its redistribute() callback, which ensures that any stateful prope...
static InputParameters validParams()
void addMaterialPropertyStorage(MaterialPropertyStorage &mat_props)
Pushes the given pair ( mat_data , mat_props ) onto our list of _materials data to redistribute each ...
std::vector< std::string > getAllRealReporterFullNames() const
Get full names of all real reporter values Note: For a postprocessor, the full name is the postproces...
DenseVector< Real > getAllRealReporterValues() const
Get all real reporter values including postprocessor and vector postprocessor values into a dense vec...
void check() const
Perform integrity check for get/declare calls.
void copyValuesBack()
At the end of a timestep this method is called to copy the values back in time in preparation for the...
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
void setReporterValue(const ReporterName &reporter_name, const T &value, const std::size_t time_index=0)
Method for setting Reporter values that already exist.
void restoreState(bool verbose=false)
When a time step fails, this method is called to revert the current reporter values to their old stat...
const T & getReporterValue(const ReporterName &reporter_name, const MooseObject &consumer, const ReporterMode &mode, const std::size_t time_index=0) const
Method for returning read only references to Reporter values.
std::set< std::string > getPostprocessorNames() const
Return a list of all postprocessor names.
void finalize(const std::string &object_name)
Helper function for performing post calculation actions via the ReporterContext objects.
Reporter objects allow for the declaration of arbitrary data types that are aggregate values for a si...
Wrapper class that owns a libMesh EquationSystem and adds advanced restart capability to it.
void setLoadAllVectors(const bool load_all_vectors)
Sets whether or not all vectors are to be loaded.
const T & get() const
Get the restartable value.
A class for creating restricted objects.
This is the base class for Samplers as used within the Stochastic Tools module.
void initialSetup()
Initial setup.
InitialConditions are objects that set the initial value of variables.
void paramWarning(const std::string ¶m, Args... args) const
bool hasInvalidSolutionError() const
Whether or not an invalid solution was encountered that was an error.
void resetIterationOccurences()
Reset the number of solution invalid occurrences back to zero.
Moose::LineSearchType _line_search
virtual void stopSolve(const ExecFlagType &exec_flag, const std::set< TagID > &vector_tags_to_close)=0
Quit the current solve as soon as possible.
void setSolution(const NumericVector< Number > &soln)
Set the solution to a given vector.
virtual const NumericVector< Number > *const & currentSolution() const override final
The solution vector that is currently being operated on.
Generic class for solving transient nonlinear problems.
bool _safe_access_tagged_vectors
Is it safe to retrieve data from tagged vectors.
virtual void clearActiveFEVariableCoupleableVectorTags(const THREAD_ID tid)
THREAD_ID numThreads() const
virtual void checkBoundaryMatProps()
Checks boundary material properties integrity.
virtual void cacheJacobianNeighbor(const THREAD_ID tid)
const bool & currentlyComputingJacobian() const
Returns true if the problem is in the process of computing the Jacobian.
virtual void checkBlockMatProps()
Checks block material properties integrity.
virtual void clearActiveFEVariableCoupleableMatrixTags(const THREAD_ID tid)
bool _currently_computing_residual
Whether the residual is being evaluated.
bool _computing_nonlinear_residual
Whether the non-linear residual is being evaluated.
void clearAllDofIndices()
Clear dof indices from variables in nl and aux systems.
virtual void reinitElemFaceRef(const Elem *elem, unsigned int side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0)
reinitialize FE objects on a given element on a given side at a given set of reference points and the...
virtual const VectorTag & getVectorTag(const TagID tag_id) const
Get a VectorTag from a TagID.
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
std::map< std::string, std::vector< dof_id_type > > _var_dof_map
virtual void customSetup(const ExecFlagType &exec_type)
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid)
sets the current boundary ID in assembly
virtual void cacheResidual(const THREAD_ID tid)
virtual void jacobianSetup()
virtual void initialSetup()
virtual void cacheJacobian(const THREAD_ID tid)
Factory & _factory
The Factory for building objects.
std::vector< VectorTag > getVectorTags(const std::set< TagID > &tag_ids) const
bool doingPRefinement() const
void setCurrentlyComputingJacobian(const bool currently_computing_jacobian)
Set whether or not the problem is in the process of computing the Jacobian.
void preparePRefinement()
Prepare DofMap and Assembly classes with our p-refinement information.
static InputParameters validParams()
virtual void setActiveScalarVariableCoupleableMatrixTags(std::set< TagID > &mtags, const THREAD_ID tid)
virtual void reinitNeighborFaceRef(const Elem *neighbor_elem, unsigned int neighbor_side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr, const THREAD_ID tid=0)
reinitialize FE objects on a given neighbor element on a given side at a given set of reference point...
std::map< SubdomainID, std::set< MaterialPropertyName > > _zero_block_material_props
Set of properties returned as zero properties.
void addNotZeroedVectorTag(const TagID tag)
Adds a vector tag to the list of vectors that will not be zeroed when other tagged vectors are.
DiracKernelInfo _dirac_kernel_info
bool _safe_access_tagged_matrices
Is it safe to retrieve data from tagged matrices.
virtual void setActiveFEVariableCoupleableMatrixTags(std::set< TagID > &mtags, const THREAD_ID tid)
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
std::unordered_set< TagID > _not_zeroed_tagged_vectors
the list of vector tags that will not be zeroed when all other tags are
static void selectVectorTagsFromSystem(const SystemBase &system, const std::vector< VectorTag > &input_vector_tags, std::set< TagID > &selected_tags)
Select the vector tags which belong to a specific system.
virtual void setActiveScalarVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid)
virtual void clearActiveScalarVariableCoupleableVectorTags(const THREAD_ID tid)
std::set< dof_id_type > _ghosted_elems
Elements that should have Dofs ghosted to the local processor.
virtual void setActiveFEVariableCoupleableVectorTags(std::set< TagID > &vtags, const THREAD_ID tid)
virtual void clearActiveElementalMooseVariables(const THREAD_ID tid)
Clear the active elemental MooseVariableFieldBase.
static void selectMatrixTagsFromSystem(const SystemBase &system, const std::map< TagName, TagID > &input_matrix_tags, std::set< TagID > &selected_tags)
Select the matrix tags which belong to a specific system.
virtual bool converged(const unsigned int sys_num)
Eventually we want to convert this virtual over to taking a solver system number argument.
virtual void clearActiveScalarVariableCoupleableMatrixTags(const THREAD_ID tid)
virtual void setCurrentLowerDElem(const Elem *const lower_d_elem, const THREAD_ID tid)
Set the current lower dimensional element.
void setCurrentlyComputingResidualAndJacobian(bool currently_computing_residual_and_jacobian)
Set whether or not the problem is in the process of computing the Jacobian.
MooseVariableFieldBase & getVariableHelper(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type, Moose::VarFieldType expected_var_field_type, const std::vector< T > &nls, const SystemBase &aux) const
Helper function called by getVariable that handles the logic for checking whether Variables of the re...
virtual void addCachedResidual(const THREAD_ID tid)
virtual void addCachedJacobian(const THREAD_ID tid)
virtual TagID addMatrixTag(TagName tag_name)
Create a Tag.
bool _currently_computing_jacobian
Flag to determine whether the problem is currently computing Jacobian.
virtual std::map< TagName, TagID > & getMatrixTags()
Return all matrix tags in the system, where a tag is represented by a map from name to ID.
virtual void setActiveElementalMooseVariables(const std::set< MooseVariableFieldBase * > &moose_vars, const THREAD_ID tid)
Set the MOOSE variables to be reinited on each element.
virtual void timestepSetup()
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
virtual void cacheResidualNeighbor(const THREAD_ID tid)
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
add a functor to the problem functor container
virtual void residualSetup()
bool _have_ad_objects
AD flag indicating whether any AD objects have been added.
bool automaticScaling() const
Automatic scaling getter.
virtual void reinitLowerDElem(const Elem *lower_d_elem, const THREAD_ID tid, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)
Base class for a system (of equations)
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
unsigned int number() const
Gets the number of this system.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
NumericVector< Number > & solution()
void update()
Update the system (doing libMesh magic)
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
void max(const T &r, T &o, Request &req) const
void maxloc(T &r, unsigned int &max_id) const
processor_id_type rank() const
void min(const T &r, T &o, Request &req) const
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
QueryCache is a convenient way to construct and pass around (possible partially constructed) warehous...
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
QueryCache clone() const
clone creates and returns an independent copy of the query in its current state.
std::vector< T * > & queryInto(std::vector< T * > &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse.
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
An instance of this object type has one copy per thread that runs on each thread.
Base class for all Transfer objects.
Base class for user-specific data.
A class for "pretty printing" a table of data.
A ReporterName that represents a VectorPostprocessor.
Base class for Postprocessors that produce a vector of values.
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
virtual void reinit_systems()
const T_sys & get_system(std::string_view name) const
void disable_refine_in_reinit()
const std::vector< std::string > & get_global_var_names()
const std::vector< std::string > & get_elem_var_names()
const std::vector< std::string > & get_nodal_var_names()
NumericVector< Number > * rhs
SparseMatrix< Number > * matrix
void uniformly_coarsen(unsigned int n=1)
void clean_refinement_flags()
virtual void set(const numeric_index_type i, const T value)=0
virtual void swap(NumericVector< T > &v)
virtual Real l2_norm() const=0
virtual std::unique_ptr< NumericVector< T > > clone() const=0
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
T & set(const std::string &)
const T & get(std::string_view) const
virtual void restore_original_nonzero_pattern()
const std::string & name() const
void solve_for_unconstrained_dofs(NumericVector< Number > &, int is_adjoint=-1) const
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, std::optional< ConstElemRange > active_local_range=std::nullopt, std::optional< std::vector< unsigned int > > variable_numbers=std::nullopt) const
std::unique_ptr< NumericVector< Number > > current_local_solution
const Variable & variable(unsigned int var) const
std::unique_ptr< NumericVector< Number > > solution
const std::string & variable_name(const unsigned int i) const
unsigned int variable_number(std::string_view var) const
bool has_static_condensation() const
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
unsigned int n_vars() const
const DofMap & get_dof_map() const
unsigned int number() const
const EquationSystems & get_equation_systems() const
const std::set< subdomain_id_type > & active_subdomains() const
const FEType & type() const
void fill_data(std::map< processor_id_type, std::vector< std::set< unsigned int > > > &data, int M)
auto max(const L &left, const R &right)
std::string indent(unsigned int spaces)
Create empty string for indenting.
std::vector< subdomain_id_type > getSubdomainIDs(const libMesh::MeshBase &mesh, const std::vector< SubdomainName > &subdomain_name)
Get the associated subdomainIDs for the subdomain names that are passed in.
libMesh::FEType variableFEType(const InputParameters ¶ms)
std::string convertLatestCheckpoint(std::string orig)
void parallelBarrierNotify(const Parallel::Communicator &comm, bool messaging)
void petscSetOptions(const PetscOptions &po, const SolverParams &solver_params, FEProblemBase *const problem=nullptr)
A function for setting the PETSc options in PETSc from the options supplied to MOOSE.
void petscSetDefaults(FEProblemBase &problem)
Sets the default options for PETSc.
void setSinglePetscOption(const std::string &name, const std::string &value="", FEProblemBase *const problem=nullptr)
A wrapper function for dealing with different versions of PetscOptionsSetValue.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
bool isSolverExecFlag(const ExecFlagType &exec_flag)
@ ST_LINEAR
Solving a linear problem.
@ ST_JFNK
Jacobian-Free Newton Krylov.
AuxGroup
Flag for AuxKernel related execution type.
constexpr std::size_t constMaxQpsPerElem
This is used for places where we initialize some qp-sized data structures that would end up being siz...
const TagName PREVIOUS_NL_SOLUTION_TAG
std::string stringify(const T &t)
conversion to string
RelationshipManagerType
Main types of Relationship Managers.
MaterialDataType
MaterialData types.
@ INTERFACE_MATERIAL_DATA
VarKindType
Framework-wide stuff.
const SubdomainID INVALID_BLOCK_ID
bool globalADIndexing()
Whether we are using global AD indexing.
const TagName SOLUTION_TAG
const Elem & get(const ElemType type_in)
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
auto index_range(const T &sizable)
const unsigned int invalid_uint
RealTensorValue RealTensor
RealVectorValue RealGradient
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error
Holds app partitioning information relevant to the a particular rank for a multiapp scenario.
State argument for evaluating functors.
SolutionIterationType iteration_type
The solution iteration type, e.g. time or nonlinear.
unsigned int state
The state.
Per-mortar-interface configuration.