10#ifdef MOOSE_KOKKOS_ENABLED
133#include "libmesh/exodusII_io.h"
134#include "libmesh/quadrature.h"
135#include "libmesh/coupling_matrix.h"
136#include "libmesh/nonlinear_solver.h"
137#include "libmesh/sparse_matrix.h"
138#include "libmesh/string_to_enum.h"
139#include "libmesh/fe_interface.h"
140#include "libmesh/enum_norm_type.h"
141#include "libmesh/petsc_solver_exception.h"
142#include "libmesh/remote_elem.h"
144#include "metaphysicl/dualnumber.h"
170 bool have_constraint_rows = !
mesh.get_constraint_rows().empty();
172 mesh.comm().max(have_constraint_rows);
176 bool returnval =
false;
177 if (have_constraint_rows)
179 for (
const auto & elem :
mesh.active_local_element_ptr_range())
187 mesh.comm().max(returnval);
206 es.
parameters.
get<Real>(
"nonlinear solver relative residual tolerance");
222 params.
addParam<
unsigned int>(
"null_space_dimension", 0,
"The dimension of the nullspace");
224 "transpose_null_space_dimension", 0,
"The dimension of the transpose nullspace");
226 "near_null_space_dimension", 0,
"The dimension of the near nullspace");
229 "Whether or not to actually solve the Nonlinear system. "
230 "This is handy in the case that all you want to do is "
231 "execute AuxKernels, Transfers, etc. without actually "
233 params.
addParam<
bool>(
"use_nonlinear",
235 "Determines whether to use a Nonlinear vs a "
236 "Eigenvalue system (Automatically determined based "
238 params.
addParam<
bool>(
"error_on_jacobian_nonzero_reallocation",
239 "This causes PETSc to error if it had to reallocate memory in the Jacobian "
240 "matrix due to not having enough nonzeros");
241 params.
addParam<
bool>(
"ignore_zeros_in_jacobian",
243 "Do not explicitly store zero values in "
244 "the Jacobian matrix if true");
245 params.
addParam<
bool>(
"force_restart",
247 "EXPERIMENTAL: If true, a sub_app may use a "
248 "restart file instead of using of using the master "
252 "True to skip additional data in equation system for restart.",
253 "This parameter is no longer used, as we do not load additional "
254 "vectors by default with restart");
255 params.
addParam<
bool>(
"skip_nl_system_check",
257 "True to skip the NonlinearSystem check for work to do (e.g. Make sure "
258 "that there are variables to solve for).");
259 params.
addParam<
bool>(
"allow_initial_conditions_with_restart",
261 "True to allow the user to specify initial conditions when restarting. "
262 "Initial conditions can override any restarted field");
264 auto coverage_check_description = [](std::string scope, std::string list_param_name)
266 return "Controls, if and how a " + scope +
267 " subdomain coverage check is performed. "
268 "With 'TRUE' or 'ON' all subdomains are checked (the default). Setting 'FALSE' or 'OFF' "
269 "will disable the check for all subdomains. "
270 "To exclude a predefined set of subdomains 'SKIP_LIST' is to "
271 "be used, while the subdomains to skip are to be defined in the parameter '" +
273 "'. To limit the check to a list of subdomains, 'ONLY_LIST' is to "
274 "be used (again, using the parameter '" +
275 list_param_name +
"').";
278 params.
addParam<std::vector<SubdomainName>>(
281 "List of subdomains for kernel coverage and material coverage checks. Setting this parameter "
282 "is equivalent to setting 'kernel_coverage_block_list' and 'material_coverage_block_list' as "
283 "well as using 'ONLY_LIST' as the coverage check mode.");
285 MooseEnum kernel_coverage_check_modes(
"FALSE TRUE OFF ON SKIP_LIST ONLY_LIST",
"TRUE");
287 kernel_coverage_check_modes,
288 coverage_check_description(
"kernel",
"kernel_coverage_block_list"));
289 params.
addParam<std::vector<SubdomainName>>(
290 "kernel_coverage_block_list",
292 "List of subdomains for kernel coverage check. The meaning of this list is controlled by the "
293 "parameter 'kernel_coverage_check' (whether this is the list of subdomains to be checked, "
294 "not to be checked or not taken into account).");
296 "boundary_restricted_node_integrity_check",
298 "Set to false to disable checking of boundary restricted nodal object variable dependencies, "
299 "e.g. are the variable dependencies defined on the selected boundaries?");
300 params.
addParam<
bool>(
"boundary_restricted_elem_integrity_check",
302 "Set to false to disable checking of boundary restricted elemental object "
303 "variable dependencies, e.g. are the variable dependencies defined on the "
304 "selected boundaries?");
305 params.
addParam<
bool>(
"interface_kernel_integrity_check",
307 "Set to false to disable checking that each interface kernel's 'variable' "
308 "is defined on the primary side and 'neighbor_var' on the secondary side "
309 "of each of its boundaries");
311 "side_uo_interface_mat_prop_integrity_check",
313 "Set to false to disable checking that side user objects do not consume material "
314 "properties declared by interface materials on the same boundary.");
315 MooseEnum material_coverage_check_modes(
"FALSE TRUE OFF ON SKIP_LIST ONLY_LIST",
"TRUE");
317 "material_coverage_check",
318 material_coverage_check_modes,
319 coverage_check_description(
"material",
"material_coverage_block_list"));
320 params.
addParam<std::vector<SubdomainName>>(
321 "material_coverage_block_list",
323 "List of subdomains for material coverage check. The meaning of this list is controlled by "
324 "the parameter 'material_coverage_check' (whether this is the list of subdomains to be "
325 "checked, not to be checked or not taken into account).");
327 params.
addParam<
bool>(
"fv_bcs_integrity_check",
329 "Set to false to disable checking of overlapping Dirichlet and Flux BCs "
330 "and/or multiple DirichletBCs per sideset");
333 "fv_face_integrity_check",
335 "Set to false to disable checking that FV flux boundary conditions and FV interface "
336 "kernels are applied to faces with valid variable ownership and interface topology.");
339 "material_dependency_check",
true,
"Set to false to disable material dependency check");
340 params.
addParam<
bool>(
"parallel_barrier_messaging",
342 "Displays messaging from parallel "
343 "barrier notifications when executing "
344 "or transferring to/from Multiapps "
347 "num_concurrent_multiapps",
349 "Set greater than 1 to solve the multiapps sharing an 'execution_order_group' "
350 "concurrently. Each such multiapp is assigned a disjoint subset of the MPI ranks "
351 "(partitioned using their 'min_procs_per_app'/'max_procs_per_app', otherwise evenly), so "
352 "they solve at the same time on different ranks. The specific value only acts as an "
353 "on/off switch; the number that run at once is set by the ranks available.");
355 MooseEnum verbosity(
"false true extra",
"false");
358 "Set to 'true' to have the problem report on any object created. Set "
359 "to 'extra' to also display all parameters.");
360 params.
addParam<
bool>(
"verbose_multiapps",
362 "Set to True to enable verbose screen printing related to MultiApps");
366 "Set to True to enable verbose screen printing related to solution restoration");
368 params.
addParam<FileNameNoExtension>(
"restart_file_base",
369 "File base name used for restart (e.g. "
370 "<path>/<filebase> or <path>/LATEST to "
371 "grab the latest file available)");
373 params.
addParam<std::vector<std::vector<TagName>>>(
376 "Extra vectors to add to the system that can be filled by objects which compute residuals "
377 "and Jacobians (Kernels, BCs, etc.) by setting tags on them. The outer index is for which "
378 "nonlinear system the extra tag vectors should be added for");
380 params.
addParam<std::vector<std::vector<TagName>>>(
381 "not_zeroed_tag_vectors",
383 "Extra vector tags which the sytem will not zero when other vector tags are zeroed. "
384 "The outer index is for which nonlinear system the extra tag vectors should be added for");
386 params.
addParam<std::vector<std::vector<TagName>>>(
387 "extra_tag_matrices",
389 "Extra matrices to add to the system that can be filled "
390 "by objects which compute residuals and Jacobians "
391 "(Kernels, BCs, etc.) by setting tags on them. The outer index is for which "
392 "nonlinear system the extra tag vectors should be added for");
394 params.
addParam<std::vector<TagName>>(
395 "extra_tag_solutions",
397 "Extra solution vectors to add to the system that can be used by "
398 "objects for coupling variable values stored in them.");
400 params.
addParam<
bool>(
"previous_nl_solution_required",
402 "True to indicate that this calculation requires a solution vector for "
403 "storing the previous nonlinear iteration.");
405 params.
addParam<std::vector<NonlinearSystemName>>(
406 "nl_sys_names", std::vector<NonlinearSystemName>{
"nl0"},
"The nonlinear system names");
408 params.
addParam<std::vector<LinearSystemName>>(
"linear_sys_names", {},
"The linear system names");
410 params.
addParam<
bool>(
"check_uo_aux_state",
412 "True to turn on a check that no state presents during the evaluation of "
413 "user objects and aux kernels");
420 "allow_invalid_solution",
422 "Set to true to allow convergence even though the solution has been marked as 'invalid'");
423 params.
addParam<
bool>(
"show_invalid_solution_console",
425 "Set to true to show the invalid solution occurrence summary in console");
426 params.
addParam<
bool>(
"immediately_print_invalid_solution",
428 "Whether or not to report invalid solution warnings at the time the "
429 "warning is produced instead of after the calculation");
432 "identify_variable_groups_in_nl",
434 "Whether to identify variable groups in nonlinear systems. This affects dof ordering");
437 "regard_general_exceptions_as_errors",
439 "If we catch an exception during residual/Jacobian evaluaton for which we don't have "
440 "specific handling, immediately error instead of allowing the time step to be cut");
442 params.
addParam<
bool>(
"use_hash_table_matrix_assembly",
444 "Whether to assemble matrices using hash tables instead of preallocating "
445 "matrix memory. This can be a good option if the sparsity pattern changes "
446 "throughout the course of the simulation.");
448 "restore_original_nonzero_pattern",
449 "Whether we should reset matrix memory for every Jacobian evaluation. This option is useful "
450 "if the sparsity pattern is constantly changing and you are using hash table assembly or if "
451 "you wish to continually restore the matrix to the originally preallocated sparsity pattern "
452 "computed by relationship managers.");
455 "skip_nl_system_check kernel_coverage_check kernel_coverage_block_list "
456 "boundary_restricted_node_integrity_check "
457 "boundary_restricted_elem_integrity_check interface_kernel_integrity_check "
458 "side_uo_interface_mat_prop_integrity_check material_coverage_check "
459 "material_coverage_block_list fv_bcs_integrity_check fv_face_integrity_check "
460 "material_dependency_check check_uo_aux_state error_on_jacobian_nonzero_reallocation",
461 "Simulation checks");
463 "ignore_zeros_in_jacobian identify_variable_groups_in_nl "
464 "use_hash_table_matrix_assembly restore_original_nonzero_pattern",
465 "Nonlinear system(s)");
467 "restart_file_base force_restart allow_initial_conditions_with_restart",
"Restart");
469 "verbose_setup verbose_multiapps verbose_restore parallel_barrier_messaging",
"Verbosity");
471 "null_space_dimension transpose_null_space_dimension near_null_space_dimension",
472 "Null space removal");
474 "extra_tag_vectors extra_tag_matrices extra_tag_solutions not_zeroed_tag_vectors",
475 "Contribution to tagged field data");
477 "allow_invalid_solution show_invalid_solution_console immediately_print_invalid_solution",
478 "Solution validity control");
486 _mesh(*getCheckedPointerParam<
MooseMesh *>(
"mesh")),
488 "equation_systems", nullptr, _mesh)),
490 _solve(getParam<bool>(
"solve")),
492 _time(declareRestartableData<Real>(
"time")),
493 _time_old(declareRestartableData<Real>(
"time_old")),
494 _time_older(declareRestartableData<Real>(
"time_older")),
495 _t_step(declareRecoverableData<
int>(
"t_step")),
496 _dt(declareRestartableData<Real>(
"dt")),
497 _dt_old(declareRestartableData<Real>(
"dt_old")),
498 _need_to_add_default_nonlinear_convergence(false),
499 _need_to_add_default_multiapp_fixed_point_convergence(false),
500 _need_to_add_default_steady_state_convergence(false),
501 _linear_sys_names(getParam<
std::vector<LinearSystemName>>(
"linear_sys_names")),
502 _num_linear_sys(_linear_sys_names.size()),
503 _linear_systems(_num_linear_sys, nullptr),
504 _current_linear_sys(nullptr),
505 _using_default_nl(!isParamSetByUser(
"nl_sys_names")),
506 _nl_sys_names(!_using_default_nl || (_using_default_nl && !_linear_sys_names.size())
507 ? getParam<
std::vector<NonlinearSystemName>>(
"nl_sys_names")
508 :
std::vector<NonlinearSystemName>()),
509 _num_nl_sys(_nl_sys_names.size()),
510 _nl(_num_nl_sys, nullptr),
511 _current_nl_sys(nullptr),
512 _solver_systems(_num_nl_sys + _num_linear_sys, nullptr),
514 _coupling(
Moose::COUPLING_DIAG),
515#ifdef MOOSE_KOKKOS_ENABLED
516 _kokkos_assembly(*this),
518 _mesh_divisions(numThreads()),
519 _functions(numThreads()),
520#ifdef MOOSE_KOKKOS_ENABLED
521 _kokkos_functions(1),
523 _convergences(numThreads()),
524 _nonlocal_kernels(numThreads()),
525 _nonlocal_integrated_bcs(numThreads()),
527 _fv_ics(numThreads()),
529 "material_props", &_mesh, _material_prop_registry, *this)),
531 "bnd_material_props", &_mesh, _material_prop_registry, *this)),
533 "neighbor_material_props", &_mesh, _material_prop_registry, *this)),
534#ifdef MOOSE_KOKKOS_ENABLED
535 _kokkos_material_props(
537 "kokkos_material_props", &_mesh, _material_prop_registry, *this)),
538 _kokkos_bnd_material_props(
540 "kokkos_bnd_material_props", &_mesh, _material_prop_registry, *this)),
541 _kokkos_neighbor_material_props(
543 "kokkos_neighbor_material_props", &_mesh, _material_prop_registry, *this)),
545 _materials(numThreads()),
546 _interface_materials(numThreads()),
547 _discrete_materials(numThreads()),
548 _all_materials(numThreads()),
549#ifdef MOOSE_KOKKOS_ENABLED
550 _kokkos_materials(1),
552 _indicators(numThreads()),
553 _internal_side_indicators(numThreads()),
554 _markers(numThreads()),
555 _reporter_data(_app),
556 _multi_apps(_app.getExecuteOnEnum(), numThreads()),
557 _transient_multi_apps(_app.getExecuteOnEnum(), numThreads()),
558 _transfers(_app.getExecuteOnEnum(), 1),
559 _to_multi_app_transfers(_app.getExecuteOnEnum(), 1),
560 _from_multi_app_transfers(_app.getExecuteOnEnum(), 1),
561 _between_multi_app_transfers(_app.getExecuteOnEnum(), 1),
562 _num_concurrent_multiapps(getParam<unsigned
int>(
"num_concurrent_multiapps")),
563#ifdef LIBMESH_ENABLE_AMR
565 _cycles_completed(0),
567 _displaced_mesh(nullptr),
568 _geometric_search_data(*this, _mesh),
570 _reinit_displaced_elem(false),
571 _reinit_displaced_face(false),
572 _reinit_displaced_neighbor(false),
573 _input_file_saved(false),
575 _has_constraints(false),
576 _snesmf_reuse_base(true),
577 _skip_exception_check(false),
578 _snesmf_reuse_base_set_by_user(false),
579 _has_initialized_stateful(false),
580 _const_jacobian(false),
581 _has_jacobian(false),
582 _needs_old_newton_iter(false),
583 _previous_nl_solution_required(getParam<bool>(
"previous_nl_solution_required")),
584 _previous_multiapp_fp_nl_solution_required(_num_nl_sys + _num_linear_sys, false),
585 _previous_multiapp_fp_aux_solution_required(false),
586 _previous_multisystem_fp_nl_solution_required(_num_nl_sys + _num_linear_sys, false),
587 _previous_multisystem_fp_aux_solution_required(false),
588 _has_nonlocal_coupling(false),
589 _calculate_jacobian_in_uo(false),
590 _kernel_coverage_check(
592 _kernel_coverage_blocks(getParam<
std::vector<SubdomainName>>(
"kernel_coverage_block_list")),
593 _boundary_restricted_node_integrity_check(
594 getParam<bool>(
"boundary_restricted_node_integrity_check")),
595 _boundary_restricted_elem_integrity_check(
596 getParam<bool>(
"boundary_restricted_elem_integrity_check")),
597 _interface_kernel_integrity_check(getParam<bool>(
"interface_kernel_integrity_check")),
598 _side_uo_interface_mat_prop_integrity_check(
599 getParam<bool>(
"side_uo_interface_mat_prop_integrity_check")),
600 _material_coverage_check(
602 _material_coverage_blocks(getParam<
std::vector<SubdomainName>>(
"material_coverage_block_list")),
603 _fv_bcs_integrity_check(getParam<bool>(
"fv_bcs_integrity_check")),
604 _fv_face_integrity_check(getParam<bool>(
"fv_face_integrity_check")),
605 _material_dependency_check(getParam<bool>(
"material_dependency_check")),
606 _uo_aux_state_check(getParam<bool>(
"check_uo_aux_state")),
608 _check_residual_for_nans(false),
610 _max_qps(
std::numeric_limits<unsigned
int>::max()),
611 _max_scalar_order(INVALID_ORDER),
612 _has_time_integrator(false),
613 _has_exception(false),
614 _parallel_barrier_messaging(getParam<bool>(
"parallel_barrier_messaging")),
615 _verbose_setup(getParam<
MooseEnum>(
"verbose_setup")),
616 _verbose_multiapps(getParam<bool>(
"verbose_multiapps")),
617 _verbose_restore(getParam<bool>(
"verbose_restore")),
619 _control_warehouse(_app.getExecuteOnEnum(), 1),
620 _is_petsc_options_inserted(false),
621 _line_search(nullptr),
622 _using_ad_mat_props(false),
623 _current_ic_state(0),
624 _use_hash_table_matrix_assembly(getParam<bool>(
"use_hash_table_matrix_assembly")),
625 _error_on_jacobian_nonzero_reallocation(
626 isParamValid(
"error_on_jacobian_nonzero_reallocation")
627 ? getParam<bool>(
"error_on_jacobian_nonzero_reallocation")
628 : _app.errorOnJacobianNonzeroReallocation()),
629 _restore_original_nonzero_pattern(isParamValid(
"restore_original_nonzero_pattern")
630 ? getParam<bool>(
"restore_original_nonzero_pattern")
631 : _use_hash_table_matrix_assembly),
632 _ignore_zeros_in_jacobian(getParam<bool>(
"ignore_zeros_in_jacobian")),
633 _preserve_matrix_sparsity_pattern(true),
634 _force_restart(getParam<bool>(
"force_restart")),
635 _allow_ics_during_restart(getParam<bool>(
"allow_initial_conditions_with_restart")),
636 _skip_nl_system_check(getParam<bool>(
"skip_nl_system_check")),
637 _fail_next_system_convergence_check(false),
638 _allow_invalid_solution(getParam<bool>(
"allow_invalid_solution")),
639 _show_invalid_solution_console(getParam<bool>(
"show_invalid_solution_console")),
640 _immediately_print_invalid_solution(getParam<bool>(
"immediately_print_invalid_solution")),
641 _started_initial_setup(false),
642 _has_internal_edge_residual_objects(false),
643 _u_dot_requested(false),
644 _u_dotdot_requested(false),
645 _u_dot_old_requested(false),
646 _u_dotdot_old_requested(false),
649 _print_execution_on(),
650 _identify_variable_groups_in_nl(getParam<bool>(
"identify_variable_groups_in_nl")),
651 _regard_general_exceptions_as_errors(getParam<bool>(
"regard_general_exceptions_as_errors")),
652 _requires_nonlocal_coupling(false)
654 auto checkCoverageCheckConflict =
655 [
this](
const std::string & coverage_check,
657 const std::vector<SubdomainName> & coverage_blocks) ->
void
661 if (coverage_blocks.size() > 1)
662 if (std::find(coverage_blocks.begin(), coverage_blocks.end(),
"ANY_BLOCK_ID") !=
663 coverage_blocks.end())
665 "The list of blocks used for ",
667 " cannot contain 'ANY_BLOCK_ID' along with other blocks. ");
670 checkCoverageCheckConflict(
672 checkCoverageCheckConflict(
678 ADReal::do_derivatives =
true;
719 _zero.resize(n_threads);
743 std::string restart_file_base = getParam<FileNameNoExtension>(
"restart_file_base");
750 if (restart_file_base.size())
768#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
787 mooseWarning(
"Displaced mesh was requested but the displaced problem does not exist. "
788 "Regular mesh will be returned");
796 mooseWarning(
"Displaced mesh was requested but the displaced problem does not exist. "
797 "Regular mesh will be returned");
805 auto & vectors = getParam<std::vector<std::vector<TagName>>>(
"extra_tag_vectors");
806 for (
const auto sys_num : index_range(vectors))
807 for (
auto & vector : vectors[sys_num])
813 auto & not_zeroed_vectors = getParam<std::vector<std::vector<TagName>>>(
"not_zeroed_tag_vectors");
814 for (
const auto sys_num : index_range(not_zeroed_vectors))
815 for (
auto & vector : not_zeroed_vectors[sys_num])
826 auto & matrices = getParam<std::vector<std::vector<TagName>>>(
"extra_tag_matrices");
827 for (
const auto sys_num : index_range(matrices))
828 for (
auto & matrix : matrices[sys_num])
835 sys->sizeVariableMatrixData();
836 _aux->sizeVariableMatrixData();
842 for (
auto & vector : getParam<std::vector<TagName>>(
"extra_tag_solutions"))
862 _aux->associateVectorToTag(*
_aux->system().current_local_solution.get(), tag);
869 sys->needSolutionState(state, iteration_type);
870 _aux->needSolutionState(state, iteration_type);
877 bool has_solution_state =
false;
879 has_solution_state |= sys->hasSolutionState(state, iteration_type);
880 has_solution_state |=
_aux->hasSolutionState(state, iteration_type);
881 return has_solution_state;
890 for (
const auto i : make_range(n_threads))
892 _assembly[i].resize(solver_systems.size());
893 for (
const auto j : index_range(solver_systems))
894 _assembly[i][j] = std::make_unique<Assembly>(*solver_systems[j], i);
900 std::vector<std::shared_ptr<NonlinearSystemBase>> & nls)
902 TIME_SECTION(
"initNullSpaceVectors", 5,
"Initializing Null Space Vectors");
904 unsigned int dimNullSpace =
parameters.
get<
unsigned int>(
"null_space_dimension");
905 unsigned int dimTransposeNullSpace =
906 parameters.
get<
unsigned int>(
"transpose_null_space_dimension");
907 unsigned int dimNearNullSpace =
parameters.
get<
unsigned int>(
"near_null_space_dimension");
908 for (
unsigned int i = 0; i < dimNullSpace; ++i)
910 std::ostringstream oss;
914 for (
auto & nl : nls)
918 for (
unsigned int i = 0; i < dimTransposeNullSpace; ++i)
920 std::ostringstream oss;
924 for (
auto & nl : nls)
928 for (
unsigned int i = 0; i < dimNearNullSpace; ++i)
930 std::ostringstream oss;
934 for (
auto & nl : nls)
949 for (
unsigned int i = 0; i < n_threads; i++)
965#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
970 CHKERRABORT(this->
comm().get(), ierr);
979 TIME_SECTION(
"setCoordSystem", 5,
"Setting Coordinate System");
989const ConstElemRange &
994 std::vector<const DofMap *> dof_maps(
es().n_systems());
995 for (
const auto i : make_range(
es().n_systems()))
1001 std::make_unique<ConstElemRange>(
_mesh.
getMesh().multi_evaluable_elements_begin(dof_maps),
1002 _mesh.
getMesh().multi_evaluable_elements_end(dof_maps));
1007const ConstElemRange &
1012 std::vector<const DofMap *> dof_maps(
_nl.size());
1013 for (
const auto i : index_range(dof_maps))
1014 dof_maps[i] = &
_nl[i]->dofMap();
1016 std::make_unique<ConstElemRange>(
_mesh.
getMesh().multi_evaluable_elements_begin(dof_maps),
1017 _mesh.
getMesh().multi_evaluable_elements_end(dof_maps));
1026 TIME_SECTION(
"initialSetup", 2,
"Performing Initial Setup");
1031 mooseError(
"Checkpoint recovery and restart and exodus restart are all mutually exclusive.");
1034 mooseWarning(
"MOOSE may fail to catch an exception when the \"skip_exception_check\" parameter "
1035 "is used. If you receive a terse MPI error during execution, remove this "
1036 "parameter and rerun your simulation");
1051 _aux->initSolutionState();
1057 dof_id_type global_max_var_n_dofs_per_elem = 0;
1061 dof_id_type max_var_n_dofs_per_elem;
1062 dof_id_type max_var_n_dofs_per_node;
1064 TIME_SECTION(
"computingMaxDofs", 3,
"Computing Max Dofs Per Element");
1068 max_var_n_dofs_per_elem = mvndpe.
max();
1073 max_var_n_dofs_per_node = mvndpn.
max();
1075 global_max_var_n_dofs_per_elem =
1076 std::max(global_max_var_n_dofs_per_elem, max_var_n_dofs_per_elem);
1080 TIME_SECTION(
"assignMaxDofs", 5,
"Assigning Maximum Dofs Per Elem");
1082 sys.assignMaxVarNDofsPerElem(max_var_n_dofs_per_elem);
1085 displaced_problem->solverSys(i).assignMaxVarNDofsPerElem(max_var_n_dofs_per_elem);
1087 sys.assignMaxVarNDofsPerNode(max_var_n_dofs_per_node);
1089 displaced_problem->solverSys(i).assignMaxVarNDofsPerNode(max_var_n_dofs_per_node);
1094 TIME_SECTION(
"resizingVarValues", 5,
"Resizing Variable Values");
1096 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
1098 _phi_zero[tid].resize(global_max_var_n_dofs_per_elem, std::vector<Real>(
getMaxQps(), 0.));
1100 std::vector<RealGradient>(
getMaxQps(), RealGradient(0.)));
1102 std::vector<RealTensor>(
getMaxQps(), RealTensor(0.)));
1119 props->setRecovering();
1121#ifdef MOOSE_KOKKOS_ENABLED
1124 props->setRecovering();
1128 TIME_SECTION(
"restore", 3,
"Restoring from backup");
1158 TIME_SECTION(
"copyingFromExodus", 3,
"Copying Variables From Exodus");
1161 sys->copyVars(*reader);
1162 _aux->copyVars(*reader);
1167 mooseError(
"Need Exodus reader to restart variables but the reader is not available\n"
1168 "Use either FileMesh with an Exodus mesh file or FileMeshGenerator with an "
1169 "Exodus mesh file and with use_for_exodus_restart equal to true");
1185 mooseError(
"Stateful neighbor material properties do not work with mesh adaptivity");
1201 "Doing extra refinements when restarting is NOT supported for sub-apps of a MultiApp");
1211 TIME_SECTION(
"convergenceInitialSetup", 5,
"Initializing Convergence objects");
1219 std::set<std::string> depend_objects_aux =
_aux->getDependObjects();
1221 std::map<int, std::vector<UserObjectBase *>> group_userobjs;
1225 std::vector<UserObjectBase *> userobjs;
1230 for (
auto obj : userobjs)
1231 group_userobjs[obj->
getParam<
int>(
"execution_order_group")].push_back(obj);
1233#ifdef MOOSE_KOKKOS_ENABLED
1237 std::vector<UserObjectBase *> userobjs;
1242 for (
auto obj : userobjs)
1243 group_userobjs[obj->
getParam<
int>(
"execution_order_group")].push_back(obj);
1247 for (
auto & [group, objs] : group_userobjs)
1248 for (auto obj : objs)
1261 TIME_SECTION(
"initializingFunctions", 5,
"Initializing Functions");
1271#ifdef MOOSE_KOKKOS_ENABLED
1277 TIME_SECTION(
"initializingRandomObjects", 5,
"Initializing Random Objects");
1289 TIME_SECTION(
"ICinitialSetup", 5,
"Setting Up Initial Conditions");
1306 TIME_SECTION(
"materialInitialSetup", 3,
"Setting Up Materials");
1327#ifdef MOOSE_KOKKOS_ENABLED
1332 TIME_SECTION(
"computingInitialStatefulProps", 3,
"Computing Initial Material Values");
1339#ifdef MOOSE_KOKKOS_ENABLED
1354 props->setRestartInPlace();
1355 props->setRecovering();
1366#ifdef LIBMESH_ENABLE_AMR
1372 mooseError(
"Cannot perform initial adaptivity during restart on sub-apps of a MultiApp!");
1388 unsigned short ic_state_max = 0;
1390 auto findMax = [&ic_state_max](
const auto & obj_list)
1392 for (
auto ic : obj_list.getActiveObjects())
1393 ic_state_max =
std::
max(ic_state_max, ic->getState());
1400 if (ic_state_max > 0)
1404 std::vector<std::unique_ptr<NumericVector<Real>>> state0_sys_buffers(
_solver_systems.size());
1405 std::unique_ptr<NumericVector<Real>> state0_aux_buffer;
1411 state0_aux_buffer =
_aux->solutionState(0).clone();
1432 _aux->solutionState(0) = *state0_aux_buffer;
1433 _aux->solutionState(0).close();
1449 _aux->initialSetup();
1456 sys->setSolution(*(sys->system().current_local_solution.
get()));
1486 const auto & tis = sys->getTimeIntegrators();
1489 TIME_SECTION(
"timeIntegratorInitialSetup", 5,
"Initializing Time Integrator");
1490 for (
auto & ti : tis)
1501 TIME_SECTION(
"initialSetupMultiApps", 2,
"Initializing MultiApps",
false);
1510 TIME_SECTION(
"initialSetupTransfers", 2,
"Initializing Transfers");
1516 for (
const auto & transfer : to_multi_app_objects)
1519 transfer->initialSetup();
1524 for (
const auto & transfer : from_multi_app_objects)
1527 transfer->initialSetup();
1532 for (
const auto & transfer : between_multi_app_objects)
1535 transfer->initialSetup();
1541 TIME_SECTION(
"BoundaryRestrictedNodeIntegrityCheck", 5);
1549 for (
auto & nl :
_nl)
1551 const auto & nodal_bcs = nl->getNodalBCWarehouse();
1552 if (!nodal_bcs.hasBoundaryObjects())
1555 for (
const auto & bnode : bnd_nodes)
1557 const auto boundary_id = bnode->_bnd_id;
1558 const Node *
const node = bnode->_node;
1560 if (node->processor_id() != this->processor_id())
1566 if (!nodal_bcs.hasBoundaryObjects(boundary_id))
1569 const auto & bnd_objects = nodal_bcs.getBoundaryObjects(boundary_id);
1570 for (
const auto & bnd_object : bnd_objects)
1572 const auto & bnd_variable = bnd_object->variable();
1577 if (!bnd_object->requiresGeometricSearch() &&
1578 bnd_object->checkVariableBoundaryIntegrity() &&
1579 node->n_dofs(nl->number(), bnd_variable.number()))
1581 std::set<MooseVariableFieldBase *> vars_to_omit = {
1582 &cast_ref<MooseVariableFieldBase &>(
const_cast<MooseVariableBase &
>(bnd_variable))};
1585 *bnd_object, bnd_object->checkAllVariables(*node, vars_to_omit), bnd_name);
1594 TIME_SECTION(
"BoundaryRestrictedElemIntegrityCheck", 5);
1604 TIME_SECTION(
"InterfaceKernelIntegrityCheck", 5);
1615 std::set<std::tuple<BoundaryID, SubdomainID, SubdomainID, unsigned short>> face_block_pairs;
1616 const auto & boundary_info =
_mesh.
getMesh().get_boundary_info();
1617 for (
const auto & bnd_elem : *
_mesh.getBoundaryElementRange())
1619 if (const auto * const neighbor = bnd_elem->_elem->neighbor_ptr(bnd_elem->_side);
1621 face_block_pairs.emplace(
1623 bnd_elem->_elem->subdomain_id(),
1624 neighbor->subdomain_id(),
1625 boundary_info.has_boundary_id(
1626 neighbor, neighbor->which_neighbor_am_i(bnd_elem->_elem), bnd_elem->_bnd_id));
1629 for (
const auto & nl :
_nl)
1630 for (const auto & ik : nl->getInterfaceKernelWarehouse().getObjects())
1631 for (const auto bnd_id : ik->boundaryIDs())
1633 const auto & var = ik->variable();
1634 const auto & neighbor_var = ik->neighborVariable();
1635 const auto block_name = [
this](
const SubdomainID blk)
1638 return name.empty() ? std::to_string(blk) :
name;
1643 const auto valid = [](
const auto & elem_var,
1644 const auto & neigh_var,
1648 return elem_var.activeOnSubdomain(elem_blk) &&
1649 neigh_var.activeOnSubdomain(neighbor_blk);
1656 std::vector<std::string> failing_pairs;
1657 std::vector<std::string> flipped_pairs;
1658 bool all_flipped =
true;
1659 for (
const auto & [bid, elem_blk, neighbor_blk, two_sided] : face_block_pairs)
1662 const bool flipped_valid =
1663 valid(neighbor_var, var, elem_blk, neighbor_blk) ||
1664 (two_sided &&
valid(neighbor_var, var, neighbor_blk, elem_blk));
1666 all_flipped =
false;
1667 if (!
valid(var, neighbor_var, elem_blk, neighbor_blk) &&
1668 !(two_sided &&
valid(var, neighbor_var, neighbor_blk, elem_blk)))
1670 const auto pair_name = block_name(elem_blk) +
" -> " + block_name(neighbor_blk);
1671 failing_pairs.push_back(pair_name);
1673 flipped_pairs.push_back(pair_name);
1676 if (failing_pairs.empty())
1679 std::string flipped_hint;
1680 if (!flipped_pairs.empty())
1682 "\nThe variables appear to be flipped relative to the boundary "
1683 "orientation on block pair(s) " +
1684 MooseUtils::join(flipped_pairs,
", ") +
1685 (all_flipped ?
"; swap 'variable' and 'neighbor_var', or reverse the "
1686 "orientation of the boundary."
1687 :
"; reverse the orientation of the boundary on those pairs.");
1691 "The interface kernel will not contribute on all or part of boundary '",
1695 ") must be defined on the primary (element) side and 'neighbor_var' (",
1696 neighbor_var.name(),
1697 ") on the secondary (neighbor) side of each face. Failing block pair(s) (primary -> "
1699 MooseUtils::join(failing_pairs,
", "),
1707 TIME_SECTION(
"FVFaceIntegrityCheck", 5);
1709 auto check_fv_face_integrity = [
this](
MooseMesh & fv_mesh,
const bool on_displaced)
1714 .condition<AttribDisplaced>(on_displaced)
1721 .condition<AttribDisplaced>(on_displaced)
1724 interface_kernel_base_query);
1726 std::vector<FVFluxBC *> flux_bcs;
1727 std::vector<FVInterfaceKernel *> interface_kernels;
1734 for (
const auto boundary_id : fi.boundaryIDs())
1736 auto boundary_key = std::make_tuple(boundary_id,
false);
1738 flux_bc_query.queryInto(flux_bcs, boundary_key);
1739 for (
const auto *
const flux_bc : flux_bcs)
1740 if (flux_bc->checkVariableBoundaryIntegrity())
1741 flux_bc->checkFaceIntegrity(fi);
1743 interface_kernel_query.queryInto(interface_kernels, boundary_key);
1744 for (
const auto *
const interface_kernel : interface_kernels)
1745 interface_kernel->checkFaceIntegrity(fi);
1751 check_fv_face_integrity(
mesh(),
false);
1761 mooseError(
"failed to converge initial MultiApp");
1794 TIME_SECTION(
"computeMaterials", 2,
"Computing Initial Material Properties");
1798#ifdef MOOSE_KOKKOS_ENABLED
1803 TIME_SECTION(
"computeMaterials", 2,
"Computing Initial Material Properties");
1815 for (
unsigned int tid = 0; tid <
n_threads; tid++)
1833 TIME_SECTION(
"lineSearchInitialSetup", 5,
"Initializing Line Search");
1855 "\" has the same name as a scalar variable in the system.");
1866 std::unique_ptr<libMesh::MeshRefinement> displaced_mesh_refinement(
nullptr);
1868 displaced_mesh_refinement = std::make_unique<libMesh::MeshRefinement>(*
_displaced_mesh);
1884 displaced_mesh_refinement->uniformly_coarsen();
1933#ifdef MOOSE_KOKKOS_ENABLED
1937 _aux->timestepSetup();
1952 std::vector<UserObject *> userobjs;
1954 for (
auto obj : userobjs)
1957#ifdef MOOSE_KOKKOS_ENABLED
1959 std::vector<UserObjectBase *> userobjs;
1961 for (
auto obj : userobjs)
1977 if (
_max_qps == std::numeric_limits<unsigned int>::max())
1991 TIME_SECTION(
"checkNonlocalCoupling", 5,
"Checking Nonlocal Coupling");
1994 for (
auto & nl :
_nl)
1996 const auto & all_kernels = nl->getKernelWarehouse();
1997 const auto & kernels = all_kernels.getObjects(tid);
1998 for (
const auto & kernel : kernels)
2000 std::shared_ptr<NonlocalKernel> nonlocal_kernel =
2001 std::dynamic_pointer_cast<NonlocalKernel>(kernel);
2002 if (nonlocal_kernel)
2010 nl->getIntegratedBCWarehouse();
2011 const auto & integrated_bcs = all_integrated_bcs.
getObjects(tid);
2012 for (
const auto & integrated_bc : integrated_bcs)
2014 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
2015 std::dynamic_pointer_cast<NonlocalIntegratedBC>(integrated_bc);
2016 if (nonlocal_integrated_bc)
2029 std::set<const MooseVariableFEBase *> uo_jacobian_moose_vars;
2031 std::vector<ShapeElementUserObject *> objs;
2035 .condition<AttribThread>(tid)
2038 for (
const auto & uo : objs)
2041 const auto & mv_deps = uo->jacobianMooseVariables();
2042 uo_jacobian_moose_vars.insert(mv_deps.begin(), mv_deps.end());
2046 std::vector<ShapeSideUserObject *> objs;
2050 .condition<AttribThread>(tid)
2052 for (
const auto & uo : objs)
2055 const auto & mv_deps = uo->jacobianMooseVariables();
2056 uo_jacobian_moose_vars.insert(mv_deps.begin(), mv_deps.end());
2068 for (
unsigned int i = 0; i < moose_vars.size(); ++i)
2070 VariableName var_name = moose_vars[i]->name();
2072 sys->setVariableGlobalDoFs(var_name);
2090 _assembly[tid][i]->prepareJacobianBlock();
2113 for (
auto & nl :
_nl)
2114 nl->prepareFace(tid,
true);
2115 _aux->prepareFace(tid,
false);
2125 const std::vector<dof_id_type> & dof_indices,
2128 for (
const auto i : index_range(
_nl))
2131 _nl[i]->prepare(tid);
2136 _assembly[tid][current_nl_sys_num]->prepareBlock(ivar, jvar, dof_indices);
2141 _assembly[tid][current_nl_sys_num]->prepareBlockNonlocal(
2163 _assembly[tid][i]->setCurrentSubdomainID(did);
2173 SubdomainID did = elem->neighbor_ptr(side)->subdomain_id();
2174 for (
const auto i : index_range(
_nl))
2176 _assembly[tid][i]->setCurrentNeighborSubdomainID(did);
2187 for (
const auto i : index_range(
_nl))
2189 _assembly[tid][i]->setCurrentNeighborSubdomainID(did);
2293 std::vector<VectorTag> extra_residual_vector_tags;
2298 if (vector_tag._id != time_tag && vector_tag._id != non_time_tag)
2299 extra_residual_vector_tags.push_back(vector_tag);
2306 extra_residual_vector_tags);
2415 const DofMap & dof_map,
2416 std::vector<dof_id_type> & dof_indices,
2417 const std::set<TagID> & tags,
2440 _displaced_problem->addJacobianBlockTags(jacobian, ivar, jvar, dof_map, dof_indices, tags, tid);
2446 jacobian, ivar, jvar, dof_map, dof_indices, jv.
allDofIndices(), tags, tid);
2455 const DofMap & dof_map,
2456 std::vector<dof_id_type> & dof_indices,
2457 std::vector<dof_id_type> & neighbor_dof_indices,
2458 const std::set<TagID> & tags,
2466 neighbor_dof_indices,
2471 jacobian, ivar, jvar, dof_map, dof_indices, neighbor_dof_indices, tags, tid);
2510 TIME_SECTION(
"ghostGhostedBoundaries", 3,
"Ghosting Ghosted Boundaries");
2522 "This function is deprecated and no longer performs any function. Please do not call it."));
2530 unsigned int n_points = points.size();
2543 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
2547 _zero[tid].resize(max_qpts, 0);
2548 _grad_zero[tid].resize(max_qpts, RealGradient(0.));
2555 for (
const auto i : index_range(
_nl))
2557 _assembly[tid][i]->reinitAtPhysical(elem, points);
2558 _nl[i]->prepare(tid);
2569 bool have_points = n_points > 0;
2584 sys->reinitElem(elem, tid);
2585 _aux->reinitElem(elem, tid);
2593 const std::vector<Point> & phys_points_in_elem,
2597 "Are you calling this method with a displaced mesh element?");
2601 _assembly[tid][i]->reinitAtPhysical(elem, phys_points_in_elem);
2614 const unsigned int side,
2619 "reinitElemFace with a BoundaryID argument is deprecated because the boundary id was never "
2620 "used. Please call reinitElemFace without the BoundaryID argument instead");
2633 _aux->reinitElemFace(elem, side, tid);
2642 const std::vector<Point> *
const pts,
2643 const std::vector<Real> *
const weights)
2658 for (
const auto i : index_range(
_nl))
2661 _nl[i]->reinitNode(node, tid);
2663 _aux->reinitNode(node, tid);
2672 for (
const auto i : index_range(
_nl))
2675 _nl[i]->reinitNodeFace(node, bnd_id, tid);
2677 _aux->reinitNodeFace(node, bnd_id, tid);
2683 TIME_SECTION(
"reinitScalars", 3,
"Reinitializing Scalar Variables");
2688 for (
auto & nl :
_nl)
2689 nl->reinitScalars(tid, reinit_for_derivative_reordering);
2690 _aux->reinitScalars(tid, reinit_for_derivative_reordering);
2710 const Elem * neighbor = elem->neighbor_ptr(side);
2711 unsigned int neighbor_side = neighbor->which_neighbor_am_i(elem);
2713 for (
const auto i : index_range(
_nl))
2715 _assembly[tid][i]->reinitElemAndNeighbor(elem, side, neighbor, neighbor_side);
2716 _nl[i]->prepareNeighbor(tid);
2720 _aux->prepareNeighbor(tid);
2722 for (
auto & nl :
_nl)
2724 nl->reinitElemFace(elem, side, tid);
2725 nl->reinitNeighborFace(neighbor, neighbor_side, tid);
2727 _aux->reinitElemFace(elem, side, tid);
2728 _aux->reinitNeighborFace(neighbor, neighbor_side, tid);
2737 const auto & displaced_ref_pts =
_assembly[tid][0]->qRuleNeighbor()->get_points();
2757 auto & neighbor =
_assembly[tid][0]->neighbor();
2758 auto & neighbor_side =
_assembly[tid][0]->neighborSide();
2760 if (lower_d_elem_neighbor &&
2763 auto qps =
_assembly[tid][0]->qPointsFaceNeighbor().stdVector();
2764 std::vector<Point> reference_points;
2766 lower_d_elem_neighbor->dim(), lower_d_elem_neighbor, qps, reference_points);
2778 unsigned int neighbor_side,
2779 const std::vector<Point> & physical_points,
2783 "Are you calling this method with a displaced mesh element?");
2785 for (
const auto i : index_range(
_nl))
2788 _assembly[tid][i]->reinitNeighborAtPhysical(neighbor, neighbor_side, physical_points);
2791 _nl[i]->prepareNeighbor(tid);
2793 _aux->prepareNeighbor(tid);
2799 for (
auto & nl :
_nl)
2800 nl->reinitNeighborFace(neighbor, neighbor_side, tid);
2801 _aux->reinitNeighborFace(neighbor, neighbor_side, tid);
2806 const std::vector<Point> & physical_points,
2810 "Are you calling this method with a displaced mesh element?");
2812 for (
const auto i : index_range(
_nl))
2815 _assembly[tid][i]->reinitNeighborAtPhysical(neighbor, physical_points);
2818 _nl[i]->prepareNeighbor(tid);
2820 _aux->prepareNeighbor(tid);
2826 for (
auto & nl :
_nl)
2827 nl->reinitNeighbor(neighbor, tid);
2828 _aux->reinitNeighbor(neighbor, tid);
2839 std::set<const Elem *> displaced_elements;
2844 for (
const auto & elem : displaced_elements)
2867 for (
auto & nl :
_nl)
2868 nl->subdomainSetup(subdomain, tid);
2882 const std::string & name,
2885#ifdef MOOSE_KOKKOS_ENABLED
2890 parallel_object_only();
2907 mooseError(
"Unrecognized function functor type");
2913 const std::string & name,
2916 parallel_object_only();
2928 const std::string class_name =
"DefaultNonlinearConvergence";
2932 params.
set<
bool>(
"added_as_default") =
true;
2940 const std::string class_name =
"DefaultMultiAppFixedPointConvergence";
2944 params.
set<
bool>(
"added_as_default") =
true;
2951 const std::string class_name =
"DefaultSteadyStateConvergence";
2955 params.
set<
bool>(
"added_as_default") =
true;
2975 std::istringstream ss(
name);
2979 if (ss >> real_value && ss.eof())
2982 params.
set<Real>(
"value") = real_value;
2983 addFunction(
"ConstantFunction", ss.str(), params);
2988 std::string
vars =
"x,y,z,t,NaN,pi,e";
2993 params.
set<std::string>(
"expression") =
name;
3001 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_function"),
3002 "getFunction() was called before Functions have been constructed. The requested "
3004 name +
"' may exist in the input file, but Functions are not available yet.");
3028 mooseError(
"The Convergence object '",
name,
"' does not exist.");
3033const std::vector<std::shared_ptr<Convergence>> &
3041 const std::string & name,
3044 parallel_object_only();
3059 mooseError(
"No MeshDivision object named ",
name,
" of appropriate type");
3072 mooseDeprecated(
"FEProblemBase::getNonlinearSystem() is deprecated, please use "
3073 "FEProblemBase::getNonlinearSystemBase() \n");
3075 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
3076 auto nl_sys = std::dynamic_pointer_cast<NonlinearSystem>(
_nl[sys_num]);
3086 const std::string & name,
3096 std::vector<Distribution *> objs;
3100 .condition<AttribName>(
name)
3102 return !objs.empty();
3108 std::vector<Distribution *> objs;
3112 .condition<AttribName>(
name)
3116 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_distribution"),
3117 "A Distribution getter was called before Distributions have been constructed. "
3118 "If you are attempting to access this object in the constructor of another object "
3119 "then make sure that the Distribution is constructed before the object using it.");
3120 mooseError(
"Unable to find Distribution with name '" +
name +
"'");
3127 const std::string & name,
3131 for (
auto & sampler : samplers)
3138 std::vector<Sampler *> objs;
3142 .condition<AttribThread>(tid)
3147 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_sampler"),
3148 "A Sampler getter was called before Samplers have been constructed. "
3149 "If you are attempting to access this object in the constructor of another object "
3150 "then make sure that the Sampler is constructed before the object using it.");
3153 "Unable to find Sampler with name '" +
name +
3154 "', if you are attempting to access this object in the constructor of another object then "
3155 "make sure that the Sampler is constructed before the object using it.");
3162 const FEType & type,
3164 const std::set<SubdomainID> *
const active_subdomains)
3166 std::set<SubdomainID> subdomainIDs;
3167 if (active_subdomains->size() == 0)
3170 subdomainIDs.insert(subdomains.begin(), subdomains.end());
3173 subdomainIDs.insert(active_subdomains->begin(), active_subdomains->end());
3179 std::string error_prefix =
"";
3182 curr_sys_ptr =
_aux.get();
3183 other_sys_ptr = sys.get();
3184 error_prefix =
"aux";
3188 mooseError(
"Cannot have an auxiliary variable and a solver variable with the same name: ",
3198 mooseError(
"Mismatching types are specified for ",
3200 "variable with name '",
3212 std::set<SubdomainID> varSubdomainIDs;
3213 if (varActiveSubdomains.size() == 0)
3216 varSubdomainIDs.insert(subdomains.begin(), subdomains.end());
3219 varSubdomainIDs.insert(varActiveSubdomains.begin(), varActiveSubdomains.end());
3223 const auto isSubset = std::includes(varSubdomainIDs.begin(),
3224 varSubdomainIDs.end(),
3225 subdomainIDs.begin(),
3226 subdomainIDs.end());
3231 const auto stringifySubdomains = [
this](std::set<SubdomainID> subdomainIDs)
3233 std::stringstream s;
3234 for (
auto const i : subdomainIDs)
3242 if (subdomainName.empty())
3245 s << subdomainName <<
" (" << i <<
")";
3250 const std::string msg =
"Mismatching block-restrictions are specified for " +
3251 error_prefix +
"variable with name '" + var_name +
"': {" +
3252 stringifySubdomains(varSubdomainIDs) +
"} and {" +
3253 stringifySubdomains(subdomainIDs) +
"}";
3268 const std::string & var_name,
3271 parallel_object_only();
3275 const auto active_subdomains_vector =
3277 const std::set<SubdomainID> active_subdomains(active_subdomains_vector.begin(),
3278 active_subdomains_vector.end());
3285 SolverSystemName sys_name = params.
get<SolverSystemName>(
"solver_sys");
3287 const auto solver_system_number =
solverSysNum(sys_name);
3288 logAdd(
"Variable", var_name, var_type, params);
3289 _solver_systems[solver_system_number]->addVariable(var_type, var_name, params);
3297std::pair<bool, unsigned int>
3299 const bool error_if_not_found)
const
3306 "If the variable is in our FEProblem solver system map, then it must be in the "
3307 "solver system we expect");
3308 else if (error_if_not_found)
3310 if (
_aux->hasVariable(var_name) ||
_aux->hasScalarVariable(var_name))
3313 " found. Did you specify an auxiliary variable when you meant to specify a "
3314 "solver variable?");
3318 "'. It does not exist in the solver system(s) or auxiliary system");
3326 const std::string & name,
3328 const unsigned int nl_sys_num,
3329 const std::string & base_name,
3330 bool & reinit_displaced)
3336 reinit_displaced =
true;
3359 const std::string & name,
3361 const std::string & base_name)
3368 if (!
parameters.
get<std::vector<BoundaryName>>(
"boundary").empty())
3395 const std::string & name,
3398#ifdef MOOSE_KOKKOS_ENABLED
3403 parallel_object_only();
3406 mooseError(
"You are trying to add a Kernel to a linear variable/system, which is not "
3407 "supported at the moment!");
3416 const std::string & name,
3419 parallel_object_only();
3422 mooseError(
"You are trying to add a HDGKernel to a linear variable/system, which is not "
3423 "supported at the moment!");
3432 const std::string & name,
3435#ifdef MOOSE_KOKKOS_ENABLED
3440 parallel_object_only();
3470 const std::string & name,
3473 parallel_object_only();
3477 mooseError(
"You are trying to add a ScalarKernel to a linear variable/system, which is not "
3478 "supported at the moment!");
3507 const std::string & name,
3510#ifdef MOOSE_KOKKOS_ENABLED
3515 parallel_object_only();
3520 "You are trying to add a BoundaryCondition to a linear variable/system, which is not "
3521 "supported at the moment!");
3530 const std::string & name,
3533 parallel_object_only();
3537 auto determine_var_param_name = [&
parameters,
this]()
3546 if (!has_secondary_var && !has_primary_var)
3548 "Either a 'secondary_variable' or 'primary_variable' parameter must be supplied for '",
3551 return has_secondary_var ?
"secondary_variable" :
"primary_variable";
3555 const auto nl_sys_num =
3558 mooseError(
"You are trying to add a Constraint to a linear variable/system, which is not "
3559 "supported at the moment!");
3583 const std::string & var_name,
3586 parallel_object_only();
3590 const auto active_subdomains_vector =
3592 const std::set<SubdomainID> active_subdomains(active_subdomains_vector.begin(),
3593 active_subdomains_vector.end());
3601 logAdd(
"AuxVariable", var_name, var_type, params);
3602 _aux->addVariable(var_type, var_name, params);
3610 const std::string & var_name,
3618 const FEType & type,
3619 const std::set<SubdomainID> *
const active_subdomains)
3621 parallel_object_only();
3623 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3628 std::string var_type;
3629 if (
type.order == CONSTANT &&
type.family == MONOMIAL && !
type.p_refinement)
3630 var_type =
"MooseVariableConstMonomial";
3631 else if (
type.family == SCALAR)
3632 var_type =
"MooseVariableScalar";
3634 var_type =
"VectorMooseVariable";
3636 var_type =
"MooseVariable";
3643 params.
set<
bool>(
"p_refinement") =
type.p_refinement;
3645 if (active_subdomains)
3647 params.set<
std::vector<SubdomainName>>(
"block").push_back(
Moose::stringify(id));
3649 logAdd(
"AuxVariable", var_name, var_type, params);
3650 _aux->addVariable(var_type, var_name, params);
3657 const FEType & type,
3658 unsigned int components,
3659 const std::set<SubdomainID> *
const active_subdomains)
3661 parallel_object_only();
3663 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3673 params.
set<
bool>(
"p_refinement") =
type.p_refinement;
3674 params.
set<
unsigned int>(
"components") = components;
3676 if (active_subdomains)
3680 logAdd(
"Variable", var_name,
"ArrayMooseVariable", params);
3681 _aux->addVariable(
"ArrayMooseVariable", var_name, params);
3690 const std::set<SubdomainID> *
const active_subdomains)
3692 parallel_object_only();
3694 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3699 FEType
type(order, SCALAR);
3709 params.
set<std::vector<Real>>(
"scaling") = std::vector<Real>{1};
3710 if (active_subdomains)
3714 logAdd(
"ScalarVariable", var_name,
"MooseVariableScalar", params);
3715 _aux->addVariable(
"MooseVariableScalar", var_name, params);
3722 const std::string & name,
3725#ifdef MOOSE_KOKKOS_ENABLED
3730 parallel_object_only();
3739 const std::string & name,
3742 parallel_object_only();
3771 const std::string & name,
3774 parallel_object_only();
3778 mooseError(
"You are trying to add a DiracKernel to a linear variable/system, which is not "
3779 "supported at the moment!");
3811 const std::string & name,
3814 parallel_object_only();
3818 mooseError(
"You are trying to add a DGKernel to a linear variable/system, which is not "
3819 "supported at the moment!");
3851 const std::string & name,
3865 const std::string & name,
3873 const std::string & name,
3878 addObject<FVInterfaceKernel>(
3884 const std::string & name,
3887#ifdef MOOSE_KOKKOS_ENABLED
3897 const std::string & name,
3900#ifdef MOOSE_KOKKOS_ENABLED
3912 const std::string & name,
3915 parallel_object_only();
3919 mooseError(
"You are trying to add a InterfaceKernel to a linear variable/system, which is not "
3920 "supported at the moment!");
3952 const std::string & name,
3953 const VariableName & var_name)
3957 std::string restart_method =
"";
3960 "a checkpoint restart, by IC object '" + ic_name +
"' for variable '" +
name +
"'";
3966 restarted_vars.insert(restarted_vars.end(), nodal_vars.begin(), nodal_vars.end());
3967 restarted_vars.insert(restarted_vars.end(), global_vars.begin(), global_vars.end());
3969 if (std::find(restarted_vars.begin(), restarted_vars.end(), var_name) != restarted_vars.end())
3970 restart_method =
"an Exodus restart, by IC object '" + ic_name +
"' for variable '" +
name +
3971 "' that is also being restarted";
3973 if (!restart_method.empty())
3975 "Initial conditions have been specified during ",
3977 ".\nThis is only allowed if you specify 'allow_initial_conditions_with_restart' to "
3978 "the [Problem], as initial conditions can override restarted fields");
3984 const std::string & name,
3987 parallel_object_only();
3991 const std::string & var_name =
parameters.
get<VariableName>(
"variable");
4006 std::shared_ptr<InitialConditionBase> ic;
4018 mooseError(
"Your FE variable in initial condition ",
4020 " must be either of scalar or vector type");
4031 std::shared_ptr<ScalarInitialCondition> ic =
4039 "Variable '", var_name,
"' requested in initial condition '",
name,
"' does not exist.");
4044 const std::string & name,
4047 parallel_object_only();
4051 const std::string & var_name =
parameters.
get<VariableName>(
"variable");
4066 std::shared_ptr<FVInitialConditionBase> ic;
4071 "Your variable for an FVInitialCondition needs to be an a finite volume variable!");
4078 "' requested in finite volume initial condition '",
4080 "' does not exist.");
4086 TIME_SECTION(
"projectSolution", 2,
"Projecting Initial Solutions")
4095 using ElemInfoRange = StoredRange<MooseMesh::const_elem_info_iterator, const ElemInfo *>;
4103 for (
auto & nl :
_nl)
4104 nl->solution().close();
4105 _aux->solution().close();
4111 for (
auto & nl :
_nl)
4112 nl->solution().close();
4113 _aux->solution().close();
4121 for (
const auto & ic : ics)
4126 DenseVector<Number> vals(var.
order());
4129 const unsigned int n_scalar_dofs = var.
dofIndices().size();
4130 for (
unsigned int i = 0; i < n_scalar_dofs; i++)
4132 const auto global_index = var.
dofIndices()[i];
4140 bool solve_for_spline_dofs = shouldSolveForSplineDofs(
_mesh.
getMesh());
4145 if (solve_for_spline_dofs)
4146 solveForSplineDofs(*sys);
4150 _aux->solution().close();
4151 if (solve_for_spline_dofs)
4152 solveForSplineDofs(*
_aux);
4153 _aux->solution().localize(*
_aux->sys().current_local_solution,
_aux->dofMap().get_send_list());
4158 ConstElemRange & elem_range,
4160 const std::optional<std::set<VariableName>> & target_vars)
4174 for (
auto & nl :
_nl)
4175 nl->solution().close();
4176 _aux->solution().close();
4189 for (
auto & nl :
_nl)
4190 nl->solution().close();
4191 _aux->solution().close();
4199 for (
const auto & ic : ics)
4203 if (target_vars && !target_vars->count(var.
name()))
4208 DenseVector<Number> vals(var.
order());
4211 const unsigned int n_scalar_dofs = var.
dofIndices().size();
4212 for (
unsigned int i = 0; i < n_scalar_dofs; i++)
4214 const auto global_index = var.
dofIndices()[i];
4222 bool solve_for_spline_dofs = shouldSolveForSplineDofs(
_mesh.
getMesh());
4224 for (
auto & nl :
_nl)
4226 nl->solution().close();
4227 if (solve_for_spline_dofs)
4228 solveForSplineDofs(*nl);
4229 nl->solution().localize(*nl->system().current_local_solution, nl->dofMap().get_send_list());
4232 _aux->solution().close();
4233 if (solve_for_spline_dofs)
4234 solveForSplineDofs(*
_aux);
4235 _aux->solution().localize(*
_aux->sys().current_local_solution,
_aux->dofMap().get_send_list());
4240 Number (*func)(
const Point &,
4242 const std::string &,
4243 const std::string &),
4244 Gradient (*func_grad)(
const Point &,
4246 const std::string &,
4247 const std::string &),
4249 const std::vector<VariableName> & target_vars)
4252 "We're performing a projection based on data from just the thread 0 variable, so any "
4253 "modifications to the variable solution must have been thread joined already");
4255 std::unordered_map<unsigned int, std::vector<unsigned int>> sys_to_var_nums;
4257 for (
const auto & target_var : target_vars)
4261 sys_to_var_nums[sn].push_back(var.number());
4264 for (
const auto & [sys_num, var_nums] : sys_to_var_nums)
4267 libmesh_sys.
project_solution(func, func_grad, params, elem_range, var_nums);
4271std::shared_ptr<MaterialBase>
4280 name +=
"_neighbor";
4293 "), but its compute flag is set to true. This indicates that MOOSE is "
4294 "computing this property which may not be desired and produce un-expected "
4323 mooseError(
"FEProblemBase::getMaterialData(): Invalid MaterialDataType ",
type);
4326const std::set<const MooseObject *> &
4341 mooseError(
"FEProblemBase::getMaterialPropertyStorageConsumers(): Invalid MaterialDataType ",
4350 "ignore_zeros_in_jacobian",
4351 "We likely cannot preserve the sparsity pattern if ignoring zeros in the Jacobian, which "
4352 "leads to removing those entries from the Jacobian sparsity pattern");
4365 const std::string & name,
4368 parallel_object_only();
4370 auto add_functor_materials = [&](
const auto &
parameters,
const auto &
name)
4375 std::shared_ptr<MaterialBase> material =
4389 add_functor_materials(disp_params,
name +
"_displaced");
4395 const std::string & name,
4398#ifdef MOOSE_KOKKOS_ENABLED
4408 const std::string & name,
4416 const std::string & mat_name,
4417 const std::string & name,
4420 parallel_object_only();
4444#ifdef MOOSE_KOKKOS_ENABLED
4449 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
4452 std::shared_ptr<MaterialBase> material =
4455 bool discrete = !material->getParam<
bool>(
"compute");
4459 if (material->boundaryRestricted() ||
dynamic_cast<FunctorMaterial *
>(material.get()))
4465 for (
auto && warehouse : warehouses)
4466 warehouse->addObject(material, tid);
4478 std::string object_name;
4487 object_name =
name +
"_face";
4488 std::shared_ptr<MaterialBase> face_material =
4494 current_parameters.
set<
bool>(
"_neighbor") =
true;
4495 object_name =
name +
"_neighbor";
4496 std::shared_ptr<MaterialBase> neighbor_material =
4505 for (
auto && warehouse : warehouses)
4506 warehouse->addObjects(material, neighbor_material, face_material, tid);
4511 const auto param_names =
4516 for (
const auto & p_name : param_names)
4519 p_name.parameter());
4521 p_name.parameter());
4523 p_name.parameter());
4525 primary_name, face_name,
false);
4527 primary_name, neighbor_name,
false);
4538 std::set<MooseVariableFEBase *> needed_moose_vars;
4539 std::unordered_set<unsigned int> needed_mat_props;
4548 for (
const auto id : ids)
4555 needed_moose_vars.insert(current_active_elemental_moose_variables.begin(),
4556 current_active_elemental_moose_variables.end());
4558 needed_mat_props.insert(consumer_needed_mat_props.begin(), consumer_needed_mat_props.end());
4569 auto && elem =
_assembly[tid][0]->elem();
4570 unsigned int n_points =
_assembly[tid][0]->qRule()->n_points();
4573 material_data.
resize(n_points);
4577 material_data.swap(*elem);
4590 const bool swap_stateful,
4591 const std::deque<MaterialBase *> *
const reinit_mats)
4597 auto && elem =
_assembly[tid][0]->elem();
4598 unsigned int side =
_assembly[tid][0]->side();
4599 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4602 bnd_material_data.
resize(n_points);
4604 if (swap_stateful && !bnd_material_data.isSwapped())
4605 bnd_material_data.swap(*elem, side);
4608 bnd_material_data.reset(
4612 bnd_material_data.reinit(*reinit_mats);
4614 bnd_material_data.reinit(
4623 const bool swap_stateful,
4624 const std::deque<MaterialBase *> *
const reinit_mats)
4630 const auto *
const elem =
_assembly[tid][0]->elem();
4631 unsigned int side =
_assembly[tid][0]->side();
4632 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4635 bnd_material_data.
resize(n_points);
4637 if (swap_stateful && !bnd_material_data.isSwapped())
4638 bnd_material_data.swap(*elem, side);
4641 bnd_material_data.reset(
4645 bnd_material_data.reinit(*reinit_mats);
4647 bnd_material_data.reinit(
4657 const bool swap_stateful,
4658 const std::deque<MaterialBase *> *
const reinit_mats)
4672 const bool swap_stateful,
4673 const std::deque<MaterialBase *> *
const reinit_mats)
4680 const Elem * neighbor =
_assembly[tid][0]->neighbor();
4681 unsigned int neighbor_side = neighbor->which_neighbor_am_i(
_assembly[tid][0]->elem());
4683 mooseAssert(neighbor,
"neighbor should be non-null");
4684 mooseAssert(blk_id == neighbor->subdomain_id(),
4685 "The provided blk_id " << blk_id <<
" and neighbor subdomain ID "
4686 << neighbor->subdomain_id() <<
" do not match.");
4688 unsigned int n_points =
_assembly[tid][0]->qRuleNeighbor()->n_points();
4691 neighbor_material_data.
resize(n_points);
4695 neighbor_material_data.swap(*neighbor, neighbor_side);
4698 neighbor_material_data.reset(
4702 neighbor_material_data.reinit(*reinit_mats);
4704 neighbor_material_data.reinit(
4712 const bool swap_stateful,
4713 const std::deque<MaterialBase *> *
const reinit_mats)
4717 auto && elem =
_assembly[tid][0]->elem();
4718 unsigned int side =
_assembly[tid][0]->side();
4719 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4722 bnd_material_data.
resize(n_points);
4724 if (swap_stateful && !bnd_material_data.isSwapped())
4725 bnd_material_data.swap(*elem, side);
4731 bnd_material_data.reinit(*reinit_mats);
4744 const Elem *
const & elem =
_assembly[tid][0]->elem();
4745 unsigned int side =
_assembly[tid][0]->side();
4746 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4749 bnd_material_data.
resize(n_points);
4751 if (swap_stateful && !bnd_material_data.isSwapped())
4752 bnd_material_data.swap(*elem, side);
4762 auto && elem =
_assembly[tid][0]->elem();
4769 auto && elem =
_assembly[tid][0]->elem();
4770 unsigned int side =
_assembly[tid][0]->side();
4778 const Elem * neighbor =
_assembly[tid][0]->neighbor();
4779 unsigned int neighbor_side =
4793 neighbor_side =
_assembly[tid][0]->side();
4794 mooseAssert(neighbor,
"We should have an appropriate value for elem coming from Assembly");
4805 const std::string & name,
4806 const std::string & type,
4810 _console <<
"[DBG] Adding " << system <<
" '" <<
name <<
"' of type " <<
type << std::endl;
4817 const std::string & object_name,
4818 const std::string & var_param_name)
4824 unsigned int sys_num = 0;
4833 const auto var_sys_num = sys_num;
4836 mooseError(
"We dont support setting 'variable' to a variable that is not set to the same "
4837 "system as the 'solver_sys' parameter");
4844 if (sys_num ==
_aux->number())
4860 if (sys_num ==
_aux->number())
4869 const std::string & type)
const
4874 " already exists. You may not add a ",
4876 " by the same name.");
4878#ifdef MOOSE_KOKKOS_ENABLED
4882 " already exists. You may not add a ",
4884 " by the same name.");
4890 const std::string & name,
4893#ifdef MOOSE_KOKKOS_ENABLED
4905 const std::string & name,
4908#ifdef MOOSE_KOKKOS_ENABLED
4920 const std::string & name,
4923#ifdef MOOSE_KOKKOS_ENABLED
4933std::vector<std::shared_ptr<UserObject>>
4935 const std::string & name,
4938#ifdef MOOSE_KOKKOS_ENABLED
4946 parallel_object_only();
4948 std::vector<std::shared_ptr<UserObject>> uos;
4953 for (
const auto tid : make_range(
numThreads()))
4956 std::shared_ptr<UserObject> user_object =
4959 uos.push_back(user_object);
4962 user_object->setPrimaryThreadCopy(uos[0].get());
4967 auto euo = std::dynamic_pointer_cast<ElementUserObject>(user_object);
4968 auto suo = std::dynamic_pointer_cast<SideUserObject>(user_object);
4969 auto isuo = std::dynamic_pointer_cast<InternalSideUserObject>(user_object);
4970 auto iuo = std::dynamic_pointer_cast<InterfaceUserObjectBase>(user_object);
4971 auto nuo = std::dynamic_pointer_cast<NodalUserObject>(user_object);
4972 auto duo = std::dynamic_pointer_cast<DomainUserObject>(user_object);
4973 auto guo = std::dynamic_pointer_cast<GeneralUserObject>(user_object);
4974 auto tguo = std::dynamic_pointer_cast<ThreadedGeneralUserObject>(user_object);
4975 auto muo = std::dynamic_pointer_cast<MortarUserObject>(user_object);
4988 if (euo || nuo || duo)
4990 if (suo || duo || isuo || iuo)
4992 if (iuo || duo || isuo)
4997 if ((guo && !tguo) || muo)
5004 for (
const auto tid : make_range(
numThreads()))
5006 const decltype(uos)::size_type uo_index = uos.front()->needThreadedCopy() ? tid : 0;
5020 const std::string & name,
5023 parallel_object_only();
5027 for (
const auto tid : make_range(
numThreads()))
5037 const std::string & name,
5040 parallel_object_only();
5055 std::vector<UserObject *> objs;
5059 .condition<AttribThread>(tid)
5064 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_user_object"),
5065 "A UserObject getter was called before UserObjects have been constructed. The "
5066 "requested UserObject '" +
5067 name +
"' may exist in the input file, but UserObjects are not available yet.");
5069 mooseError(
"Unable to find user object with name '" +
name +
"'");
5071 mooseAssert(objs.size() == 1,
"Should only find one UO");
5078 std::vector<Positions *> objs;
5082 .condition<AttribName>(
name)
5085 mooseError(
"Unable to find Positions object with name '" +
name +
"'");
5086 mooseAssert(objs.size() == 1,
"Should only find one Positions");
5093 std::vector<UserObject *> objs;
5097 .condition<AttribThread>(0)
5100 return !objs.empty();
5106 std::vector<FVGradientMethod *> methods;
5110 .condition<AttribThread>(tid)
5112 .queryInto(methods);
5114 if (methods.empty())
5115 mooseError(
"Unable to find FVGradientMethod with name '",
name,
"'");
5117 mooseAssert(methods.size() == 1,
"Expected a single FVGradientMethod per thread");
5118 return *(methods[0]);
5131 std::vector<FVGradientMethod *> methods;
5135 .condition<AttribThread>(0)
5137 .queryInto(methods);
5138 return !methods.empty();
5145 std::vector<FVInterpolationMethod *> methods;
5149 .condition<AttribThread>(tid)
5151 .queryInto(methods);
5153 if (methods.empty())
5155 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_interpolation_method"),
5156 "An FVInterpolationMethod getter was called before FVInterpolationMethods have "
5157 "been constructed. If you are attempting to access this object in the constructor "
5158 "of another object then make sure that the FVInterpolationMethod is constructed "
5159 "before the object using it.");
5161 mooseError(
"Unable to find FVInterpolationMethod with name '",
name,
"'");
5164 mooseAssert(methods.size() == 1,
"Expected a single FVInterpolationMethod per thread");
5165 return *(methods[0]);
5180 ") is not a scalar face interpolation method.");
5182 return *face_method;
5192 if (!advected_method)
5197 ") is not an advected interpolation method.");
5199 return *advected_method;
5205 std::vector<FVInterpolationMethod *> methods;
5209 .condition<AttribThread>(0)
5211 .queryInto(methods);
5212 return !methods.empty();
5225 std::vector<Postprocessor *> objs;
5229 .condition<AttribThread>(tid)
5234 mooseError(
"Unable to find Postprocessor with name '", object_name,
"'");
5235 mooseAssert(objs.size() == 1,
5236 "We shouldn't find more than one postprocessor object for a given name");
5242 std::size_t t_index)
const
5251 std::size_t t_index)
5260 mooseDeprecated(
"FEProblemBase::hasPostprocssor is being removed; use "
5261 "hasPostprocessorValueByName instead.");
5267 const std::string & vector_name,
5268 std::size_t t_index)
const
5276 const std::string & vector_name,
5278 std::size_t t_index)
5288 std::vector<VectorPostprocessor *> objs;
5292 .condition<AttribThread>(tid)
5299 getMooseApp().actionWarehouse().isTaskComplete(
"add_vector_postprocessor"),
5300 "A VectorPostprocessor getter was called before VectorPostprocessors have been "
5301 "constructed. The requested VectorPostprocessor '" +
5303 "' may exist in the input file, but VectorPostprocessors are not available yet.");
5305 mooseError(
"Unable to find VectorPostprocessor with name '", object_name,
"'");
5307 mooseAssert(objs.size() == 1,
5308 "We shouldn't find more than one vector postprocessor object for a given name");
5317 const auto & objects = it.second.getActiveObjects();
5318 for (
const auto & obj : objects)
5319 obj->parentOutputPositionChanged();
5336 TIME_SECTION(
"computeIndicators", 1,
"Computing Indicators");
5340 const auto old_do_derivatives = ADReal::do_derivatives;
5341 ADReal::do_derivatives =
false;
5343 std::vector<std::string> fields;
5347 for (
const auto & indicator : indicators)
5348 fields.push_back(indicator->name());
5352 for (
const auto & internal_indicator : internal_indicators)
5353 fields.push_back(internal_indicator->name());
5355 _aux->zeroVariables(fields);
5360 _aux->solution().close();
5365 _aux->solution().close();
5368 ADReal::do_derivatives = old_do_derivatives;
5377 TIME_SECTION(
"computeMarkers", 1,
"Computing Markers");
5379 std::vector<std::string> fields;
5383 for (
const auto & marker : markers)
5384 fields.push_back(marker->name());
5386 _aux->zeroVariables(fields);
5393 for (
const auto & marker : markers)
5394 marker->markerSetup();
5400 _aux->solution().close();
5431 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
5437#ifdef MOOSE_KOKKOS_ENABLED
5441 _aux->customSetup(exec_type);
5442 for (
auto & nl :
_nl)
5443 nl->customSetup(exec_type);
5448 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
5455 std::vector<UserObject *> userobjs;
5457 for (
auto obj : userobjs)
5458 obj->customSetup(exec_type);
5460#ifdef MOOSE_KOKKOS_ENABLED
5462 std::vector<UserObjectBase *> userobjs;
5464 for (
auto obj : userobjs)
5465 obj->customSetup(exec_type);
5513 std::unique_ptr<NumericVector<Number>> x =
_aux->currentSolution()->clone();
5521 const Real check_tol = 1e-8;
5523 const Real xnorm = x->l2_norm();
5524 *x -= *
_aux->currentSolution();
5525 if (x->l2_norm() > check_tol * xnorm)
5529 std::multimap<Real, std::string, std::greater<Real>> ordered_map;
5530 for (
const auto i : make_range(
n_vars))
5536 std::ostringstream oss;
5537 for (
const auto & [error_norm, var_name] : ordered_map)
5538 oss <<
" {" << var_name <<
", " << error_norm <<
"},\n";
5540 mooseError(
"Aux kernels, user objects appear to have states for aux variables on ",
5542 ".\nVariable error norms in descending order:\n",
5547 if (pp_values.size() != new_pp_values.size())
5548 mooseError(
"Second execution for uo/aux state check should not change the number of "
5549 "real reporter values");
5551 const Real ppnorm = pp_values.l2_norm();
5552 pp_values -= new_pp_values;
5553 if (pp_values.l2_norm() > check_tol * ppnorm)
5556 std::multimap<Real, std::string, std::greater<Real>> ordered_map;
5557 for (
const auto i : index_range(pp_names))
5558 ordered_map.emplace(std::abs(pp_values(i)), pp_names[i]);
5560 std::ostringstream oss;
5561 for (
const auto & [error_norm, pp_name] : ordered_map)
5562 oss <<
" {" << pp_name <<
", " << error_norm <<
"},\n";
5564 mooseError(
"Aux kernels, user objects appear to have states for real reporter values on ",
5566 ".\nErrors of real reporter values in descending order:\n",
5576 std::vector<UserObject *> objs;
5577 query.queryInto(objs);
5589 for (
auto obj : objs)
5590 if (obj->primaryThreadCopy())
5591 obj->primaryThreadCopy()->threadJoin(*obj);
5599 for (
auto obj : objs)
5607 _console <<
"[DBG] Initializing, executing & finalizing general UO '" << obj->name()
5640 auto reporter =
dynamic_cast<Reporter *
>(obj);
5668 std::set<int> & execution_groups)
const
5670 std::vector<UserObjectBase *> uos;
5671 query.queryIntoUnsorted(uos);
5672 for (
const auto & uo : uos)
5673 execution_groups.insert(uo->getParam<
int>(
"execution_order_group"));
5679 const std::string & name)
5684 std::set<int> execution_groups;
5686#ifdef MOOSE_KOKKOS_ENABLED
5695 for (
const auto execution_group : execution_groups)
5697#ifdef MOOSE_KOKKOS_ENABLED
5712 std::set<int> execution_groups;
5714#ifdef MOOSE_KOKKOS_ENABLED
5722 for (
const auto execution_group : execution_groups)
5724#ifdef MOOSE_KOKKOS_ENABLED
5744 TIME_SECTION(
"computeUserObjects", 1,
"Computing User Objects");
5746 std::vector<GeneralUserObject *> genobjs;
5749 std::vector<UserObject *> userobjs;
5754 .queryInto(userobjs);
5756 std::vector<UserObject *> tgobjs;
5761 std::vector<UserObject *> nodal;
5764 std::vector<MortarUserObject *> mortar;
5767 if (userobjs.empty() && genobjs.empty() && tgobjs.empty() && nodal.empty() && mortar.empty())
5783 for (
auto obj : userobjs)
5784 obj->residualSetup();
5785 for (
auto obj : nodal)
5786 obj->residualSetup();
5787 for (
auto obj : mortar)
5788 obj->residualSetup();
5789 for (
auto obj : tgobjs)
5790 obj->residualSetup();
5791 for (
auto obj : genobjs)
5792 obj->residualSetup();
5796 for (
auto obj : userobjs)
5797 obj->jacobianSetup();
5798 for (
auto obj : nodal)
5799 obj->jacobianSetup();
5800 for (
auto obj : mortar)
5801 obj->jacobianSetup();
5802 for (
auto obj : tgobjs)
5803 obj->jacobianSetup();
5804 for (
auto obj : genobjs)
5805 obj->jacobianSetup();
5808 for (
auto obj : userobjs)
5812 if (!userobjs.empty())
5823 if (!userobjs.empty())
5835 for (
const auto & uo : userobjs)
5839 _aux->solution().close();
5840 _aux->system().update();
5853 for (
auto obj : nodal)
5863 for (
const auto & uo : nodal)
5867 _aux->solution().close();
5868 _aux->system().update();
5873 if (!mortar.empty())
5876 [
this,
type, &mortar]()
5878 for (
auto obj : mortar)
5881 auto create_and_run_mortar_functors = [
this,
type, &mortar](
const bool displaced)
5885 for (
const auto & [primary_secondary_boundary_pair, interface_config] :
5888 auto mortar_uos_to_execute =
5890 primary_secondary_boundary_pair.second,
5894 auto *
const subproblem = displaced ? cast_ptr<SubProblem *>(
_displaced_problem.get())
5895 : cast_ptr<SubProblem *>(
this);
5897 *interface_config.amg,
5901 subproblem->assembly(0, 0));
5907 create_and_run_mortar_functors(
false);
5909 create_and_run_mortar_functors(
true);
5916 for (
auto obj : mortar)
5923 if (!tgobjs.empty())
5928 for (
auto obj : tgobjs)
5933 std::vector<GeneralUserObject *> tguos_zero;
5937 .queryInto(tguos_zero);
5938 for (
auto obj : tguos_zero)
5940 std::vector<GeneralUserObject *> tguos;
5941 auto q =
query.clone()
5971 TIME_SECTION(
"executeControls", 1,
"Executing Controls");
5977 for (
const auto & it : controls_wh.getActiveObjects())
5982 std::vector<std::string> & dependent_controls = it->getDependencies();
5983 for (
const auto & depend_name : dependent_controls)
5985 if (controls_wh.hasActiveObject(depend_name))
5987 auto dep_control = controls_wh.getActiveObject(depend_name);
5988 resolver.
addEdge(dep_control, it);
5993 "\" was not created, did you make a "
5994 "spelling mistake or forget to include it "
5995 "in your input file?");
6001 if (!ordered_controls.empty())
6008 for (
const auto & control : ordered_controls)
6021 std::vector<Sampler *> objects;
6025 .condition<AttribThread>(tid)
6027 .queryInto(objects);
6029 if (!objects.empty())
6031 TIME_SECTION(
"executeSamplers", 1,
"Executing Samplers");
6032 FEProblemBase::objectSetupHelper<Sampler>(objects, exec_type);
6033 FEProblemBase::objectExecuteHelper<Sampler>(objects);
6041 TIME_SECTION(
"updateActiveObjects", 5,
"Updating Active Objects");
6045 for (
auto & nl :
_nl)
6046 nl->updateActive(tid);
6047 _aux->updateActive(tid);
6064#ifdef MOOSE_KOKKOS_ENABLED
6078 TIME_SECTION(
"reinitBecauseOfGhostingOrNewGeomObjects",
6080 "Reinitializing Because of Geometric Search Objects");
6089 (
_mortar_data->hasDisplacedObjects() && mortar_changed)));
6104 const std::string & name,
6107 parallel_object_only();
6109 const auto nl_sys_num =
6115 mooseError(
"You are trying to add a DGKernel to a linear variable/system, which is not "
6116 "supported at the moment!");
6129 for (
auto & nl :
_nl)
6135 const std::string & name,
6138 parallel_object_only();
6164 std::shared_ptr<Indicator> indicator =
6167 std::shared_ptr<InternalSideIndicatorBase> isi =
6168 std::dynamic_pointer_cast<InternalSideIndicatorBase>(indicator);
6178 const std::string & name,
6181 parallel_object_only();
6215 const std::string & name,
6218 parallel_object_only();
6246 multi_app->possiblyCreateChildApplications();
6251 std::shared_ptr<TransientMultiApp> trans_multi_app =
6252 std::dynamic_pointer_cast<TransientMultiApp>(multi_app);
6253 if (trans_multi_app)
6269std::shared_ptr<MultiApp>
6273 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_multi_app"),
6274 "A MultiApp getter was called before MultiApps have been constructed. "
6275 "If you are attempting to access this object in the constructor of another object "
6276 "then make sure that the MultiApp is constructed before the object using it.");
6284 const MultiAppName & source_app)
6287 bool is_executing_a_transfer =
false;
6292 std::string string_direction;
6293 std::string additional_source_info =
"";
6295 string_direction =
" To ";
6296 else if (from_multiapp)
6297 string_direction =
" From ";
6299 string_direction =
" Between ";
6300 if (!source_app.empty())
6301 additional_source_info =
" from app '" + source_app +
"'";
6304 auto executeThisTransfer = [
this, &direction, &source_app, &
type](
auto & transfer)
6306 mooseAssert(transfer->getExecuteOnEnum().contains(
type),
"Should execute on this schedule");
6312 if (transfer->getFromName() == source_app && transfer->executeAfterSiblingSourceApp())
6314 libmesh_ignore(
this);
6315 mooseAssert(this->
getMultiApp(transfer->getFromName())->getExecuteOnEnum().contains(
type),
6316 "from_multiapp should also execute on this schedule");
6322 if ((source_app.empty() && (!transfer->executeAfterSiblingSourceApp() ||
6323 !transfer->getFromMultiApp()->getExecuteOnEnum().contains(
type))) ||
6324 (transfer->getFromName() == source_app && transfer->executeAfterSiblingSourceApp()))
6335 TIME_SECTION(
"execMultiAppTransfers", 1,
"Executing Transfers");
6342 {
"Name",
"Type",
"From",
"To"});
6345 for (
const auto & transfer : transfers)
6350 if (!executeThisTransfer(multiapp_transfer))
6353 is_executing_a_transfer =
true;
6354 table.addRow(multiapp_transfer->name(),
6355 multiapp_transfer->type(),
6356 multiapp_transfer->getFromName(),
6357 multiapp_transfer->getToName());
6361 if (is_executing_a_transfer)
6364 <<
"MultiApps" << additional_source_info << COLOR_DEFAULT <<
":" << std::endl;
6370 for (
const auto & transfer : transfers)
6372 auto multiapp_transfer = libMesh::cast_ptr<MultiAppTransfer *>(transfer.get());
6373 if (!executeThisTransfer(multiapp_transfer))
6376 transfer->setCurrentDirection(direction);
6377 transfer->execute();
6384 << COLOR_DEFAULT << std::endl;
6390 << COLOR_DEFAULT << std::endl;
6393std::vector<std::shared_ptr<Transfer>>
6404std::vector<std::shared_ptr<Transfer>>
6434 std::map<unsigned int, std::vector<std::shared_ptr<MultiApp>>> groups;
6436 if (multi_app->usingPositions())
6437 groups[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(multi_app);
6445 std::map<unsigned int, std::vector<std::shared_ptr<MultiApp>>> check_groups;
6447 check_groups[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(multi_app);
6448 for (
const auto & [group_id, group] : check_groups)
6449 for (
const auto & multi_app : group)
6450 if (group.size() > 1 && !multi_app->usingPositions())
6451 multi_app->paramError(
6452 "execution_order_group",
6453 "This MultiApp must be placed in its own execution order group as concurrent execution "
6454 "has not been implemented for this type of app at this time");
6459 for (
const auto & [group_id, group] : groups)
6462 if (group.size() < 2)
6469 std::vector<processor_id_type>
count(group.size());
6470 std::vector<processor_id_type> caps(group.size());
6471 std::vector<processor_id_type> mins(group.size());
6472 std::vector<processor_id_type> maxs(group.size());
6473 processor_id_type min_total = 0;
6474 for (
const auto m : index_range(group))
6477 mins[m] = group[m]->getParam<processor_id_type>(
"min_procs_per_app");
6478 maxs[m] = group[m]->getParam<processor_id_type>(
"max_procs_per_app");
6479 const auto n_apps_m = cast_int<processor_id_type>(group[m]->numGlobalApps());
6480 caps[m] = (maxs[m] >= n_procs) ? n_procs : std::min(n_procs, n_apps_m * maxs[m]);
6482 min_total += mins[m];
6485 if (min_total > n_procs)
6486 mooseError(
"Not enough MPI ranks to run the ",
6488 " multiapps of 'execution_order_group' ",
6490 " concurrently: they need at least ",
6492 " ranks (from 'min_procs_per_app') but only ",
6494 " are available. Reduce the number of concurrent multiapps, lower "
6495 "'min_procs_per_app', or run with more processors.");
6498 processor_id_type remaining = n_procs - min_total;
6499 bool progress =
true;
6500 while (remaining > 0 && progress)
6503 for (
const auto m : index_range(group))
6504 if (remaining > 0 &&
count[m] < caps[m])
6515 processor_id_type offset = 0;
6516 for (
const auto m : index_range(group))
6519 if (my_rank >= offset && my_rank < offset +
count[m])
6521 my_rank - offset,
count[m], group[m]->numGlobalApps(), mins[m], maxs[m],
false);
6522 group[m]->init(group[m]->numGlobalApps(), cfg);
6532 const std::vector<MooseSharedPointer<MultiApp>> & multi_apps =
6536 for (
const auto & multi_app : multi_apps)
6537 multi_app->preTransfer(
_dt,
_time);
6550 std::map<unsigned int, std::vector<MooseSharedPointer<MultiApp>>> ordered_multi_apps;
6552 for (
const auto & multi_app : multi_apps)
6553 ordered_multi_apps[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(
6559 bool has_concurrent_apps =
false;
6560 for (
const auto & [group, multi_app_group] : ordered_multi_apps)
6561 if (multi_app_group.size() > 1)
6562 has_concurrent_apps =
true;
6563 if (!has_concurrent_apps)
6565 "num_concurrent_multiapps",
6566 "Due to the specified multiapp execution groups, or differences in execution schedules, "
6567 "concurrent multiapps are not actually used on " +
6572 if (multi_apps.size())
6574 TIME_SECTION(
"execMultiApps", 1,
"Executing MultiApps",
false);
6578 << COLOR_DEFAULT << std::endl;
6580 bool success =
true;
6582 for (
const auto & [group_id, multi_app_group] : ordered_multi_apps)
6584 bool group_success =
true;
6587 << COLOR_DEFAULT << std::endl;
6592 _console << COLOR_CYAN <<
"\nConcurrent MultiApps: " << std::endl;
6593 for (
const auto & multi_app : multi_app_group)
6594 _console << multi_app->name() <<
" ";
6595 _console << COLOR_DEFAULT << std::endl;
6604 for (
const auto & multi_app : multi_app_group)
6605 if (!multi_app->solveStep(
_dt,
_time, auto_advance))
6606 group_success =
false;
6620 for (
const auto & multi_app : multi_app_group)
6633 << COLOR_DEFAULT << std::endl;
6648 for (
const auto & multi_app : multi_apps)
6649 multi_app->finalize();
6657 for (
const auto & multi_app : multi_apps)
6658 multi_app->postExecute();
6666 if (multi_apps.size())
6667 for (
const auto & multi_app : multi_apps)
6668 multi_app->incrementTStep(
_time);
6676 if (multi_apps.size())
6679 _console << COLOR_CYAN <<
"\nAdvancing MultiApps on " <<
type.name() << COLOR_DEFAULT
6682 for (
const auto & multi_app : multi_apps)
6683 multi_app->finishStep(recurse_through_multiapp_levels);
6688 _console << COLOR_CYAN <<
"Finished Advancing MultiApps on " <<
type.name() <<
"\n"
6689 << COLOR_DEFAULT << std::endl;
6698 if (multi_apps.size())
6700 TIME_SECTION(
"backupMultiApps", 5,
"Backing Up MultiApp");
6703 _console << COLOR_CYAN <<
"\nBacking Up MultiApps on " <<
type.name() << COLOR_DEFAULT
6706 for (
const auto & multi_app : multi_apps)
6707 multi_app->backup();
6712 _console << COLOR_CYAN <<
"Finished Backing Up MultiApps on " <<
type.name() <<
"\n"
6713 << COLOR_DEFAULT << std::endl;
6722 if (multi_apps.size())
6727 _console << COLOR_CYAN <<
"\nRestoring Multiapps on " <<
type.name()
6728 <<
" because of solve failure!" << COLOR_DEFAULT << std::endl;
6730 _console << COLOR_CYAN <<
"\nRestoring MultiApps on " <<
type.name() << COLOR_DEFAULT
6734 for (
const auto & multi_app : multi_apps)
6735 multi_app->restore(force);
6740 _console << COLOR_CYAN <<
"Finished Restoring MultiApps on " <<
type.name() <<
"\n"
6741 << COLOR_DEFAULT << std::endl;
6750 Real smallest_dt = std::numeric_limits<Real>::max();
6752 for (
const auto & multi_app : multi_apps)
6753 smallest_dt = std::min(smallest_dt, multi_app->computeDT());
6760 const std::string & name,
6763 parallel_object_only();
6794 std::shared_ptr<MultiApp> multiapp;
6807 exec_enum = multiapp->getParam<
ExecFlagEnum>(
"execute_on");
6815 std::shared_ptr<MultiAppTransfer> multi_app_transfer =
6816 std::dynamic_pointer_cast<MultiAppTransfer>(transfer);
6817 if (multi_app_transfer)
6834 if (sys->hasVariable(var_name))
6836 if (
_aux->hasVariable(var_name))
6846 if (sys->hasVariable(var_name))
6854 const std::string & var_name,
6866 if (sys->hasVariable(var_name))
6867 return sys->getFieldVariable<Real>(tid, var_name);
6868 if (
_aux->hasVariable(var_name))
6869 return _aux->getFieldVariable<Real>(tid, var_name);
6878 if (sys->hasVariable(var_name))
6879 return sys->getActualFieldVariable<Real>(tid, var_name);
6880 if (
_aux->hasVariable(var_name))
6881 return _aux->getActualFieldVariable<Real>(tid, var_name);
6890 if (sys->hasVariable(var_name))
6891 return sys->getFieldVariable<RealVectorValue>(tid, var_name);
6892 if (
_aux->hasVariable(var_name))
6893 return _aux->getFieldVariable<RealVectorValue>(tid, var_name);
6902 if (sys->hasVariable(var_name))
6903 return sys->getFieldVariable<RealEigenVector>(tid, var_name);
6904 if (
_aux->hasVariable(var_name))
6905 return _aux->getFieldVariable<RealEigenVector>(tid, var_name);
6914 if (sys->hasScalarVariable(var_name))
6916 if (
_aux->hasScalarVariable(var_name))
6926 if (sys->hasScalarVariable(var_name))
6927 return sys->getScalarVariable(tid, var_name);
6928 if (
_aux->hasScalarVariable(var_name))
6929 return _aux->getScalarVariable(tid, var_name);
6940 else if (
_aux->hasVariable(var_name) ||
_aux->hasScalarVariable(var_name))
6941 return _aux->system();
6943 mooseError(
"Unable to find a system containing the variable " + var_name);
7051 mat->setActiveProperties(mat_prop_ids);
7053 mat->setActiveProperties(mat_prop_ids);
7055 mat->setActiveProperties(mat_prop_ids);
7075#ifdef LIBMESH_ENABLE_AMR
7085 const std::string & redistributer_name,
7086 const bool use_displaced_mesh)
7090 redistribute_params.
set<std::string>(
"for_whom") = this->
name();
7094 redistribute_params.
set<
bool>(
"use_displaced_mesh") = use_displaced_mesh;
7097 std::shared_ptr<RedistributeProperties> redistributer =
7099 "RedistributeProperties", redistributer_name, redistribute_params);
7110 mesh.
getMesh().add_ghosting_functor(redistributer);
7113 add_redistributer(
_mesh,
"mesh_property_redistributer",
false);
7115 add_redistributer(
_displaced_problem->mesh(),
"displaced_mesh_property_redistributer",
true);
7137 mooseError(
"Max quadrature points per element assumptions made in some code (e.g. Coupleable ",
7138 "and MaterialPropertyInterface classes) have been violated.\n",
7139 "Complain to Moose developers to have constMaxQpsPerElem increased from ",
7143 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7147 _zero[tid].resize(max_qpts, 0);
7149 _grad_zero[tid].resize(max_qpts, RealGradient(0.));
7161 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7162 for (
const auto i : index_range(
_nl))
7174 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7175 for (
const auto i : index_range(
_nl))
7190 const bool allow_negative_qweights)
7192 if (order == INVALID_ORDER)
7196 for (
const auto i : make_range(std::size_t(1),
_solver_systems.size()))
7199 if (order < _aux->getMinQuadratureOrder())
7200 order =
_aux->getMinQuadratureOrder();
7203 if (volume_order == INVALID_ORDER)
7204 volume_order = order;
7206 if (face_order == INVALID_ORDER)
7209 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7212 type, order, volume_order, face_order, block, allow_negative_qweights);
7216 type, order, volume_order, face_order, block, allow_negative_qweights);
7227 mooseError(
"Someone told us (the FEProblemBase) to trust the user coupling matrix, but we "
7228 "haven't been provided a coupling matrix!");
7249 _cm[i] = std::move(cm);
7256 mooseError(
"Someone told us (the FEProblemBase) to trust the user coupling matrix, but we "
7257 "haven't been provided a coupling matrix!");
7265 TIME_SECTION(
"setNonlocalCouplingMatrix", 5,
"Setting Nonlocal Coupling Matrix");
7268 mooseError(
"Nonlocal kernels are weirdly stored on the FEProblem so we don't currently support "
7269 "multiple nonlinear systems with nonlocal kernels.");
7271 for (
const auto nl_sys_num : index_range(
_nl))
7273 auto & nl =
_nl[nl_sys_num];
7275 unsigned int n_vars = nl->nVariables();
7276 nonlocal_cm.resize(
n_vars);
7277 const auto &
vars = nl->getVariables(0);
7280 for (
const auto & ivar :
vars)
7282 for (
const auto & kernel : nonlocal_kernel)
7284 for (
unsigned int i = ivar->number(); i < ivar->number() + ivar->count(); ++i)
7285 if (i == kernel->variable().number())
7286 for (
const auto & jvar :
vars)
7291 unsigned int j = jvar->number();
7292 nonlocal_cm(i, j) = 1;
7296 for (
const auto & integrated_bc : nonlocal_integrated_bc)
7298 for (
unsigned int i = ivar->number(); i < ivar->number() + ivar->count(); ++i)
7299 if (i == integrated_bc->variable().number())
7300 for (
const auto & jvar :
vars)
7305 unsigned int j = jvar->number();
7306 nonlocal_cm(i, j) = 1;
7316 const unsigned int jvar,
7317 const unsigned int nl_sys)
const
7319 return (*
_cm[nl_sys])(ivar, jvar);
7322std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
7325 return _assembly[tid][nl_sys]->couplingEntries();
7328std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
7331 return _assembly[tid][nl_sys]->nonlocalCouplingEntries();
7334const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
7337 return _assembly[tid][nl_sys]->fieldScalarCouplingEntries();
7346 TIME_SECTION(
"init", 2,
"Initializing");
7357 for (
const auto i : index_range(
_nl))
7362 unsigned int n_vars = nl->nVariables();
7364 TIME_SECTION(
"fillCouplingMatrix", 3,
"Filling Coupling Matrix");
7369 cm = std::make_unique<CouplingMatrix>(
n_vars);
7370 for (
unsigned int i = 0; i <
n_vars; i++)
7376 cm = std::make_unique<CouplingMatrix>(
n_vars);
7377 for (
unsigned int i = 0; i <
n_vars; i++)
7378 for (
unsigned int j = 0; j <
n_vars; j++)
7388 nl->dofMap()._dof_coupling = cm.get();
7394 nl->dofMap()._dof_coupling =
nullptr;
7396 nl->dofMap().attach_extra_sparsity_function(&
extraSparsity, nl.get());
7397 nl->dofMap().attach_extra_send_list_function(&
extraSendList, nl.get());
7401 mooseError(
"No variables specified in nonlinear system '", nl->name(),
"'.");
7423 for (
auto & nl :
_nl)
7425 nl->turnOffJacobian();
7443 TIME_SECTION(
"EquationSystems::Init", 2,
"Initializing Equation Systems");
7461 for (
const auto i : index_range(
_nl))
7465 "Coupling matrix not set for system "
7467 <<
". This should only happen if a preconditioner was not setup for this system");
7474#ifdef MOOSE_KOKKOS_ENABLED
7485 std::istringstream ss(nl_sys_name);
7486 unsigned int nl_sys_num;
7487 if (!(ss >> nl_sys_num) || !ss.eof())
7496 std::istringstream ss(linear_sys_name);
7497 unsigned int linear_sys_num;
7498 if (!(ss >> linear_sys_num) || !ss.eof())
7501 return linear_sys_num;
7507 std::istringstream ss(solver_sys_name);
7508 unsigned int solver_sys_num;
7509 if (!(ss >> solver_sys_num) || !ss.eof())
7513 mooseError(
"The solver system number was requested for system '" + solver_sys_name,
7514 "' but this system does not exist in the Problem. Systems can be added to the "
7515 "problem using the 'nl_sys_names'/'linear_sys_names' parameter.\nSystems in the "
7518 solver_sys_num = search->second;
7521 return solver_sys_num;
7528 if (solver_sys->hasVariable(variable_name))
7529 return solver_sys->number();
7530 mooseAssert(
_aux,
"Should have an auxiliary system");
7531 if (
_aux->hasVariable(variable_name))
7532 return _aux->number();
7536 "' was not found in any solver (nonlinear/linear) or auxiliary system");
7542 TIME_SECTION(
"solve", 1,
"Solving",
false);
7556#if PETSC_RELEASE_LESS_THAN(3, 12, 0)
7595#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
7597 LibmeshPetscCall(PetscOptionsPop());
7614 TIME_SECTION(
"checkExceptionAndStopSolve", 5);
7634 <<
"To recover, the solution will fail and then be re-attempted with a reduced time "
7649 _aux->solution().close();
7663 mooseError(
"The following parallel-communicated exception was detected during " +
7666 "\nBecause this did not occur during residual evaluation, there"
7667 " is no way to handle this, so the solution is aborting.\n");
7675 ADReal::do_derivatives =
true;
7700 TIME_SECTION(
"solve", 1,
"Solving",
false);
7710#if PETSC_RELEASE_LESS_THAN(3, 12, 0)
7712 options, solver_params));
7730#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
7732 LibmeshPetscCall(PetscOptionsPop());
7748 return _nl[nl_sys_num]->nNonlinearIterations();
7754 return _nl[nl_sys_num]->nLinearIterations();
7760 return _nl[nl_sys_num]->finalNonlinearResidual();
7766 return _nl[nl_sys_num]->computingPreSMOResidual();
7772 TIME_SECTION(
"copySolutionsBackwards", 3,
"Copying Solutions Backward");
7775 sys->copyStateHistoryBackwards();
7776 _aux->copyStateHistoryBackwards();
7783 sys->skipNextSolutionToOldCopy();
7784 _aux->skipNextSolutionToOldCopy();
7790 TIME_SECTION(
"advanceState", 5,
"Advancing State");
7816#ifdef MOOSE_KOKKOS_ENABLED
7851 TIME_SECTION(
"restoreSolutions", 5,
"Restoring Solutions");
7855 "There is currently no way to restore not-zeroed vectors.");
7860 _console <<
"Restoring solutions on system " << sys->
name() <<
"..." << std::endl;
7861 sys->restoreStateHistory();
7865 _console <<
"Restoring solutions on Auxiliary system..." << std::endl;
7866 _aux->restoreStateHistory();
7869 _console <<
"Restoring postprocessor, vector-postprocessor, and reporter data..." << std::endl;
7879 TIME_SECTION(
"saveOldSolutions", 5,
"Saving Old Solutions");
7882 sys->saveOldSolutions();
7883 _aux->saveOldSolutions();
7889 TIME_SECTION(
"restoreOldSolutions", 5,
"Restoring Old Solutions");
7892 sys->restoreOldSolutions();
7893 _aux->restoreOldSolutions();
7899 TIME_SECTION(
"outputStep", 1,
"Outputting");
7936 TIME_SECTION(
"onTimestepBegin", 2);
7938 for (
auto & nl :
_nl)
7939 nl->onTimestepBegin();
7955 switch (state.
state)
7967 mooseError(
"Unhandled state ", state.
state,
" in FEProblemBase::getTimeFromStateArg");
7973 const std::string & name,
7976 parallel_object_only();
7988 _aux->addDotVectors();
7989 for (
auto & nl :
_nl)
7991 nl->addDotVectors();
7993 auto tag_udot = nl->getTimeIntegrators()[0]->uDotFactorTag();
7994 if (!nl->hasVector(tag_udot))
7995 nl->associateVectorToTag(*nl->solutionUDot(), tag_udot);
7996 auto tag_udotdot = nl->getTimeIntegrators()[0]->uDotDotFactorTag();
7998 nl->associateVectorToTag(*nl->solutionUDotDot(), tag_udotdot);
8008 const std::string & name,
8011 parallel_object_only();
8014 mooseError(
"Vector bounds cannot be used with LinearSystems!");
8020 for (
auto & nl :
_nl)
8021 nl->setPredictor(predictor);
8045 residual->scale(-1.0);
8047 return residual->l2_norm();
8053 TIME_SECTION(
"computeResidualL2Norm", 2,
"Computing L2 Norm of Residual");
8057 for (
auto sys :
_nl)
8060 l2_norm += norm * norm;
8066 l2_norm += norm * norm;
8069 return std::sqrt(l2_norm);
8074 const NumericVector<Number> & soln,
8075 NumericVector<Number> & residual)
8077 parallel_object_only();
8079 TIME_SECTION(
"computeResidualSys", 5);
8088 const NumericVector<Number> & soln,
8089 NumericVector<Number> & residual)
8098 NumericVector<Number> & residual,
8099 const unsigned int nl_sys_num)
8108 mooseAssert(
_fe_vector_tags.empty(),
"This should be empty indicating a clean starting state");
8119 NumericVector<Number> & residual,
8120 SparseMatrix<Number> & jacobian)
8131 "This should be empty indicating a clean starting state");
8143 for (
auto & tag : tags)
8161 for (
auto index : make_range(matrix.row_start(), matrix.row_stop()))
8162 matrix.add(index, index, 0);
8165 _aux->zeroVariablesForResidual();
8187 for (
unsigned int tid = 0; tid < n_threads; tid++)
8192 _aux->residualSetup();
8202 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8208#ifdef MOOSE_KOKKOS_ENABLED
8251 NumericVector<Number> & residual,
8273 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8274 "contact the MOOSE team for assistance.");
8280 NumericVector<Number> & residual,
8281 const std::set<TagID> & tags)
8283 parallel_object_only();
8285 TIME_SECTION(
"computeResidualInternal", 1);
8306 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8307 "contact the MOOSE team for assistance.");
8313 NumericVector<Number> & residual,
8316 TIME_SECTION(
"computeResidualType", 5);
8337 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8338 "contact the MOOSE team for assistance.");
8345 auto create_exception_message =
8346 [&calling_method](
const std::string & exception_type,
const auto & exception)
8348 return std::string(
"A " + exception_type +
" was raised during FEProblemBase::" +
8349 calling_method +
"\n" + std::string(exception.what()));
8363 setException(create_exception_message(
"MooseException", e));
8365 catch (
const MetaPhysicL::LogicError & e)
8381 mooseError(create_exception_message(
"libMesh::PetscSolverException", e));
8383 catch (
const std::exception & e)
8386 if (strstr(e.
what(),
"Jacobian") || strstr(e.
what(),
"singular") ||
8387 strstr(e.
what(),
"det != 0"))
8388 setException(create_exception_message(
"libMesh DegenerateMap", e));
8391 const auto message = create_exception_message(
"std::exception", e);
8423 parallel_object_only();
8429 TIME_SECTION(
"computeResidualTags", 5,
"Computing Residual");
8431 ADReal::do_derivatives =
false;
8435 _aux->zeroVariablesForResidual();
8455 for (
unsigned int tid = 0; tid < n_threads; tid++)
8460 _aux->residualSetup();
8470 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8476#ifdef MOOSE_KOKKOS_ENABLED
8512 const NumericVector<Number> & soln,
8513 SparseMatrix<Number> & jacobian)
8522 SparseMatrix<Number> & jacobian,
8536 SparseMatrix<Number> & jacobian,
8537 const unsigned int nl_sys_num)
8544 for (
auto & tag : tags)
8552 SparseMatrix<Number> & jacobian,
8553 const std::set<TagID> & tags)
8555 TIME_SECTION(
"computeJacobianInternal", 1);
8575 TIME_SECTION(
"computeJacobianTags", 5,
"Computing Jacobian");
8577 for (
auto tag : tags)
8589 for (
auto index : make_range(matrix.row_start(), matrix.row_stop()))
8590 matrix.add(index, index, 0);
8593 _aux->zeroVariablesForJacobian();
8608 for (
unsigned int tid = 0; tid < n_threads; tid++)
8613 _aux->jacobianSetup();
8628 for (
unsigned int tid = 0; tid < n_threads; tid++)
8634#ifdef MOOSE_KOKKOS_ENABLED
8679 const unsigned int nl_sys_num)
8681 TIME_SECTION(
"computeTransientImplicitJacobian", 2);
8703 JacobianBlock jac_block(precond_system, jacobian, ivar, jvar);
8704 std::vector<JacobianBlock *>
blocks = {&jac_block};
8711 NumericVector<Number> & lower,
8712 NumericVector<Number> & upper)
8719 "I expect these system numbers to be the same");
8724 TIME_SECTION(
"computeBounds", 1,
"Computing Bounds");
8733 _aux->residualSetup();
8755 SparseMatrix<Number> & system_matrix,
8756 NumericVector<Number> & rhs,
8757 const bool compute_gradients)
8759 TIME_SECTION(
"computeLinearSystemSys", 5);
8792 const std::set<TagID> & vector_tags,
8793 const std::set<TagID> & matrix_tags,
8794 const bool compute_gradients)
8796 TIME_SECTION(
"computeLinearSystemTags", 5,
"Computing Linear System");
8800 for (
auto tag : matrix_tags)
8818 _aux->jacobianSetup();
8820 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8825#ifdef MOOSE_KOKKOS_ENABLED
8835 _console <<
"\nA MooseException was raised during Auxiliary variable computation.\n"
8836 <<
"The next solve will fail, the timestep will be reduced, and we will try again.\n"
8863 std::vector<NumericVector<Number> *> & sp)
8866 "I expect these system numbers to be the same");
8869 for (
unsigned int i = 0; i <
subspaceDim(
"NearNullSpace"); ++i)
8871 std::stringstream postfix;
8872 postfix <<
"_" << i;
8873 std::string modename =
"NearNullSpace" + postfix.str();
8880 std::vector<NumericVector<Number> *> & sp)
8883 "I expect these system numbers to be the same");
8885 for (
unsigned int i = 0; i <
subspaceDim(
"NullSpace"); ++i)
8887 std::stringstream postfix;
8888 postfix <<
"_" << i;
8895 std::vector<NumericVector<Number> *> & sp)
8898 "I expect these system numbers to be the same");
8900 for (
unsigned int i = 0; i <
subspaceDim(
"TransposeNullSpace"); ++i)
8902 std::stringstream postfix;
8903 postfix <<
"_" << i;
8910 const NumericVector<Number> & old_soln,
8911 NumericVector<Number> & search_direction,
8912 NumericVector<Number> & new_soln,
8913 bool & changed_search_direction,
8914 bool & changed_new_soln)
8917 "I expect these system numbers to be the same");
8928 TIME_SECTION(
"computePostCheck", 2,
"Computing Post Check");
8943 std::unique_ptr<NumericVector<Number>> ghosted_solution =
8944 sys.current_local_solution->zero_clone(),
8945 ghosted_search_direction =
8946 sys.current_local_solution->zero_clone();
8949 *ghosted_solution = new_soln;
8950 *ghosted_search_direction = search_direction;
8955 Real damping =
computeDamping(*ghosted_solution, *ghosted_search_direction);
8961 new_soln = old_soln;
8962 new_soln.add(-damping, search_direction);
8963 changed_new_soln =
true;
8970 if (changed_new_soln)
8971 *ghosted_solution = new_soln;
8973 bool updated_solution =
updateSolution(new_soln, *ghosted_solution);
8974 if (updated_solution)
8975 changed_new_soln =
true;
8982 _aux->copyCurrentIntoPreviousNL();
8986 changed_search_direction =
false;
8993 const NumericVector<Number> & update)
9000 TIME_SECTION(
"computeDamping", 1,
"Computing Damping");
9028 NumericVector<Number> & )
9041 parallel_object_only();
9050 TIME_SECTION(
"updateGeometricSearch", 3,
"Updating Geometric Search");
9061 TIME_SECTION(
"updateMortarMesh", 5,
"Updating Mortar Mesh");
9079 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
9080 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
9084 const bool correct_edge_dropping,
9085 const Real minimum_projection_angle,
9086 const Mortar3DSubpatchPlane mortar_3d_subpatch_plane,
9088 const bool triangulate_triangles,
9089 const Mortar3DQuadraturePointMapping mortar_3d_qp_mapping)
9094 return _mortar_data->createMortarInterface(primary_secondary_boundary_pair,
9095 primary_secondary_subdomain_pair,
9100 correct_edge_dropping,
9101 minimum_projection_angle,
9102 mortar_3d_subpatch_plane,
9104 triangulate_triangles,
9105 mortar_3d_qp_mapping);
9107 return _mortar_data->createMortarInterface(primary_secondary_boundary_pair,
9108 primary_secondary_subdomain_pair,
9113 correct_edge_dropping,
9114 minimum_projection_angle,
9115 mortar_3d_subpatch_plane,
9117 triangulate_triangles,
9118 mortar_3d_qp_mapping);
9123 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
9124 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
9125 bool on_displaced)
const
9128 primary_secondary_boundary_pair, primary_secondary_subdomain_pair, on_displaced);
9133 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
9134 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
9138 primary_secondary_boundary_pair, primary_secondary_subdomain_pair, on_displaced);
9146 TIME_SECTION(
"possiblyRebuildGeomSearchPatches", 5,
"Rebuilding Geometric Search Patches");
9180 libmesh_fallthrough();
9186 _console <<
"\n\nUpdating geometric search patches\n" << std::endl;
9202#ifdef LIBMESH_ENABLE_AMR
9211 mooseError(
"HFEM does not support mesh adaptivity currently.");
9213 TIME_SECTION(
"initialAdaptMesh", 2,
"Performing Initial Adaptivity");
9215 for (
unsigned int i = 0; i < n; i++)
9232 _console <<
"Mesh unchanged, skipping remaining steps..." << std::endl;
9248 TIME_SECTION(
"adaptMesh", 3,
"Adapting Mesh");
9252 bool mesh_changed =
false;
9254 for (
unsigned int i = 0; i < cycles_per_step; ++i)
9257 mooseError(
"HFEM does not support mesh adaptivity currently.");
9263 bool mesh_changed_this_step;
9266 if (mesh_changed_this_step)
9268 mesh_changed =
true;
9281 _console <<
"Mesh unchanged, skipping remaining steps..." << std::endl;
9297 return mesh_changed;
9311 std::vector<MaterialData *> data(
numThreads());
9312 for (
const auto tid : make_range(
numThreads()))
9313 data[tid] = &storage.getMaterialData(tid);
9320 for (
unsigned int i = 0; i < n_threads; ++i)
9321 for (
const auto nl_sys_num : index_range(
_nl))
9332 TIME_SECTION(
"updateMeshXFEM", 5,
"Updating XFEM");
9334 bool updated =
false;
9337 if (
_xfem->updateHeal())
9342 false,
true,
false);
9348 false,
true,
false);
9351 _console <<
"\nXFEM update complete: Mesh modified" << std::endl;
9354 _console <<
"\nXFEM update complete: Mesh not modified" << std::endl;
9361 const bool contract_mesh,
9362 const bool clean_refinement_flags)
9364 TIME_SECTION(
"meshChanged", 3,
"Handling Mesh Changes");
9386 if (intermediate_change)
9391 if (should_contract)
9394 if (clean_refinement_flags)
9402 if (!intermediate_change)
9438 mooseError(
"Disabling mesh contraction is not implemented when a displaced problem is used. "
9440 "developer of this application to discuss the combination of these features.");
9458 for (
auto & nl_sys :
_nl)
9459 nl_sys->reinitMortarFunctors();
9484 for (
const auto & elem : range)
9501 for (
const auto & elem : range)
9504 for (
auto && child : coarsened_children)
9540 mdi->meshDisplaced();
9551 cmt(elem_range,
true);
9553#ifdef MOOSE_KOKKOS_ENABLED
9562 TIME_SECTION(
"checkProblemIntegrity", 5);
9565 const auto & subdomain_names = getParam<std::vector<SubdomainName>>(
"block");
9567 std::set<SubdomainID> mesh_subdomains(mesh_subdomains_vec.begin(), mesh_subdomains_vec.end());
9573 std::set<SubdomainID>
blocks;
9576 blocks = mesh_subdomains;
9579 blocks = mesh_subdomains;
9587 "\" not found in mesh.");
9599 "\" not found in mesh.");
9603 for (
auto & nl :
_nl)
9604 nl->checkKernelCoverage(
blocks);
9609#ifdef LIBMESH_ENABLE_AMR
9614 _console <<
"Using EXPERIMENTAL Stateful Material Property projection with Adaptivity!\n"
9619 std::set<SubdomainID> local_mesh_subs(mesh_subdomains);
9628 bool check_material_coverage =
false;
9630 for (
const auto &
id : ids)
9632 local_mesh_subs.erase(
id);
9633 check_material_coverage =
true;
9644 "Subdomain \"" + subdomain_name +
"\" not found in mesh.");
9645 local_mesh_subs.erase(
id);
9650 std::set<SubdomainID>
blocks(local_mesh_subs);
9656 "Subdomain \"" + subdomain_name +
"\" not found in mesh.");
9659 for (
const auto id :
blocks)
9660 local_mesh_subs.erase(
id);
9664 auto && mortar_subdomain_ids =
_mortar_data->getMortarSubdomainIDs();
9665 for (
auto subdomain_id : mortar_subdomain_ids)
9666 local_mesh_subs.erase(subdomain_id);
9669 if (check_material_coverage && !local_mesh_subs.empty())
9671 std::stringstream extra_subdomain_ids;
9673 std::copy(local_mesh_subs.begin(),
9674 local_mesh_subs.end(),
9675 std::ostream_iterator<unsigned int>(extra_subdomain_ids,
" "));
9677 std::vector<SubdomainID> local_mesh_subs_vec(local_mesh_subs.begin(),
9678 local_mesh_subs.end());
9680 mooseError(
"The following blocks from your input mesh do not contain an active material: " +
9681 extra_subdomain_ids.str() +
9683 ")\nWhen ANY mesh block contains a Material object, "
9684 "all blocks must contain a Material object.\n");
9694 for (
const auto & material : materials)
9695 material->checkStatefulSanity();
9717 mooseError(
"Coordinate transformation parameters, listed below, are only to be used in the "
9718 "context of application to application field transfers at this time. The mesh is "
9719 "not modified by these parameters within an application.\n"
9720 "You should likely use a 'TransformGenerator' in the [Mesh] block to achieve the "
9721 "desired mesh modification.\n\n",
9738 bool mesh_has_second_order_elements =
false;
9742 if (elem->default_order() == SECOND)
9744 mesh_has_second_order_elements =
true;
9754 if (mesh_has_second_order_elements)
9756 const std::vector<std::string> & displacement_variables =
9759 for (
const auto & var_name : displacement_variables)
9766 if (mv.
order() != SECOND)
9767 mooseError(
"Error: mesh has SECOND order elements, so all displacement variables must be "
9779 std::set<SubdomainID> user_objects_blocks;
9783 std::set<std::string> names;
9785 std::vector<UserObjectBase *> objects;
9788 for (
const auto & obj : objects)
9789 names.insert(obj->name());
9792 std::set<SubdomainID> difference;
9793 std::set_difference(user_objects_blocks.begin(),
9794 user_objects_blocks.end(),
9795 mesh_subdomains.begin(),
9796 mesh_subdomains.end(),
9797 std::inserter(difference, difference.end()));
9799 if (!difference.empty())
9801 std::ostringstream oss;
9802 oss <<
"One or more UserObjects is referencing a nonexistent block:\n";
9803 for (
const auto &
id : difference)
9812 std::vector<FVGradientMethod *> methods;
9814 for (
auto * method : methods)
9815 method->resolveGradientMethodDependencies(*
this);
9820 const std::map<
SubdomainID, std::vector<std::shared_ptr<MaterialBase>>> & materials_map)
9822 for (
const auto & it : materials_map)
9825 std::set<std::string> block_depend_props, block_supplied_props;
9827 for (
const auto & mat1 : it.second)
9829 auto & alldeps = mat1->getMatPropDependencies();
9830 for (
auto & dep : alldeps)
9834 for (
const auto & mat2 : it.second)
9836 const std::set<std::string> & supplied_props = mat2->MaterialBase::getSuppliedItems();
9837 block_supplied_props.insert(supplied_props.begin(), supplied_props.end());
9846 std::set<std::string> difference;
9847 std::set_difference(block_depend_props.begin(),
9848 block_depend_props.end(),
9849 block_supplied_props.begin(),
9850 block_supplied_props.end(),
9851 std::inserter(difference, difference.end()));
9853 if (!difference.empty())
9855 std::ostringstream oss;
9856 oss <<
"One or more Material Properties were not supplied on block ";
9858 if (subdomain_name.length() > 0)
9859 oss << subdomain_name <<
" (" << it.first <<
")";
9863 for (
const auto &
name : difference)
9864 oss <<
name <<
"\n";
9870 for (
const auto & it : materials_map)
9872 const auto & materials = it.second;
9873 std::set<std::string> inner_supplied, outer_supplied;
9875 for (
const auto & outer_mat : materials)
9878 outer_supplied = outer_mat->getSuppliedItems();
9879 inner_supplied.clear();
9882 std::map<std::string, std::set<std::string>> prop_to_mat;
9883 for (
const auto &
name : outer_supplied)
9884 prop_to_mat[
name].insert(outer_mat->name());
9886 for (
const auto & inner_mat : materials)
9888 if (outer_mat == inner_mat)
9892 auto outer_mat_type = outer_mat->type();
9893 auto inner_mat_type = inner_mat->type();
9898 if (outer_mat_type == inner_mat_type && outer_mat_type != outer_mat->type() &&
9899 inner_mat_type != inner_mat->type())
9902 inner_supplied.insert(inner_mat->getSuppliedItems().begin(),
9903 inner_mat->getSuppliedItems().end());
9905 for (
const auto & inner_supplied_name : inner_supplied)
9906 prop_to_mat[inner_supplied_name].insert(inner_mat->name());
9910 std::set<std::string> intersection;
9911 std::set_intersection(outer_supplied.begin(),
9912 outer_supplied.end(),
9913 inner_supplied.begin(),
9914 inner_supplied.end(),
9915 std::inserter(intersection, intersection.end()));
9917 if (!intersection.empty())
9919 std::ostringstream oss;
9920 oss <<
"The following material properties are declared on block " << it.first
9921 <<
" by multiple materials:\n";
9923 <<
"Material Objects\n";
9924 for (
const auto & outer_name : intersection)
9927 for (
const auto & inner_name : prop_to_mat[outer_name])
9928 oss << inner_name <<
" ";
9950 mooseInfo(
"Restart file ", file_name,
" is NOT being used since we are performing recovery.");
9956 mooseInfo(
"Using ", file_name,
" for restart.");
9960std::vector<VariableName>
9963 std::vector<VariableName> names;
9967 const std::vector<VariableName> & var_names = sys->getVariableNames();
9968 names.insert(names.end(), var_names.begin(), var_names.end());
9971 const std::vector<VariableName> & aux_var_names =
_aux->getVariableNames();
9972 names.insert(names.end(), aux_var_names.begin(), aux_var_names.end());
9981 "Solver system number '" << solver_sys_num <<
"' is out of bounds. We have '"
9998 auto random_data_ptr = insert_pair.first->second.get();
10008 bnd_mat_side_cache =
false;
10011 if (
_aux->needMaterialOnSide(bnd_id))
10013 bnd_mat_side_cache =
true;
10016 for (
auto & nl :
_nl)
10017 if (nl->needBoundaryMaterialOnSide(bnd_id, tid))
10019 bnd_mat_side_cache =
true;
10033 bnd_mat_side_cache =
true;
10047 interface_mat_side_cache =
false;
10050 for (
auto & nl :
_nl)
10051 if (nl->needInterfaceMaterialOnSide(bnd_id, tid))
10053 interface_mat_side_cache =
true;
10066 interface_mat_side_cache =
true;
10071 interface_mat_side_cache =
true;
10085 for (
auto & nl :
_nl)
10086 if (nl->needInternalNeighborSideMaterial(subdomain_id, tid))
10119 mooseError(
"Previous nonlinear solution is required but not added through "
10120 "Problem/previous_nl_solution_required=true");
10125 const unsigned int solver_sys_num)
10132 const unsigned int solver_sys_num)
const
10151 bool needed,
const unsigned int solver_sys_num)
10158 const unsigned int solver_sys_num)
const
10189 const std::string & object_name,
10192 parallel_object_only();
10199 mooseError(
"The name '", object_name,
"' is a reserved name for output objects");
10203 if (output_warehouse.
hasOutput(object_name))
10204 mooseError(
"An output object named '", object_name,
"' already exists");
10210 if (object_type ==
"Console" &&
_app.
getParam<
bool>(
"show_input") &&
10228 if (object_type ==
"XDR")
10230 else if (object_type ==
"XDA")
10234 if (object_name ==
"auto_recovery_checkpoint")
10266 else if (sys_name ==
"aux0")
10269 mooseError(
"System '" + sys_name +
"' was requested from problem but does not exist.");
10284 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
10285 return *
_nl[sys_num];
10291 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
10292 return *
_nl[sys_num];
10299 "System number greater than the number of linear systems");
10307 "System number greater than the number of linear systems");
10315 "System number greater than the number of solver systems");
10323 "System number greater than the number of solver systems");
10342 parallel_object_only();
10370 false,
true,
true);
10386 const std::vector<Point> *
const pts,
10387 const std::vector<Real> *
const weights,
10399 unsigned int neighbor_side,
10401 const std::vector<Point> *
const pts,
10402 const std::vector<Real> *
const weights,
10415 std::vector<std::shared_ptr<MaterialBase>> & face_materials,
10416 std::vector<std::shared_ptr<MaterialBase>> & neighbor_materials,
10417 std::set<MooseVariableFieldBase *> & variables,
10422 auto & this_face_mats =
10424 for (std::shared_ptr<MaterialBase> face_mat : this_face_mats)
10425 if (face_mat->ghostable())
10427 face_materials.push_back(face_mat);
10428 auto & var_deps = face_mat->getMooseVariableDependencies();
10429 for (
auto * var : var_deps)
10433 "Ghostable materials should only have finite volume variables coupled into them.");
10434 else if (face_mat->hasStatefulProperties())
10435 mooseError(
"Finite volume materials do not currently support stateful properties.");
10436 variables.insert(var);
10443 auto & this_neighbor_mats =
10445 for (std::shared_ptr<MaterialBase> neighbor_mat : this_neighbor_mats)
10446 if (neighbor_mat->ghostable())
10448 neighbor_materials.push_back(neighbor_mat);
10450 auto & var_deps = neighbor_mat->getMooseVariableDependencies();
10451 for (
auto * var : var_deps)
10455 "Ghostable materials should only have finite volume variables coupled into them.");
10456 else if (neighbor_mat->hasStatefulProperties())
10457 mooseError(
"Finite volume materials do not currently support stateful properties.");
10458 auto pr = variables.insert(var);
10459 mooseAssert(!pr.second,
10460 "We should not have inserted any new variables dependencies from our "
10461 "neighbor materials that didn't exist for our face materials");
10470 const unsigned int nqp,
10481 "There must be one convergence object per nonlinear system");
10486 _nl[i]->setConvergenceName(convergence_names[i]);
10501const std::vector<ConvergenceName> &
10506 mooseError(
"The nonlinear system convergence name(s) have not been set.");
10521 paramError(
"linear_convergence",
"There must be one convergence object per linear system");
10525const std::vector<ConvergenceName> &
10530 mooseError(
"The linear convergence name(s) have not been set.");
10533const ConvergenceName &
10539 mooseError(
"The fixed point convergence name has not been set.");
10542const ConvergenceName &
10548 mooseError(
"The steady convergence name has not been set.");
10593 return current_nl_sys_num;
10604 return current_linear_sys_num;
10621std::vector<MortarUserObject *>
10624 const bool displaced,
10625 const std::vector<MortarUserObject *> & mortar_uo_superset)
10627 std::vector<MortarUserObject *> mortar_uos;
10628 auto *
const subproblem =
10629 displaced ? cast_ptr<SubProblem *>(
_displaced_problem.get()) : cast_ptr<SubProblem *>(
this);
10630 for (
auto *
const obj : mortar_uo_superset)
10631 if (obj->onInterface(primary_boundary_id, secondary_boundary_id) &&
10632 (&obj->getSubProblem() == subproblem))
10633 mortar_uos.push_back(obj);
10638std::vector<MortarUserObject *>
10641 const bool displaced)
10643 std::vector<MortarUserObject *> mortar_uos;
10647 .queryInto(mortar_uos);
10648 return getMortarUserObjects(primary_boundary_id, secondary_boundary_id, displaced, mortar_uos);
10654 const bool displaced)
10656 const auto mortar_uos =
10658 for (
auto *
const mortar_uo : mortar_uos)
10660 mortar_uo->setNormals();
10661 mortar_uo->reinit();
10693 mooseAssert(nl_sys_num <
_nl.size(),
10694 "System number greater than the number of nonlinear systems");
10703 "System number greater than the number of linear systems");
10721const ConstElemRange &
10729const ConstNodeRange &
10798 return solver_params;
10816 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
void translateUserObjectExceptions(const std::function< void()> &work)
Execute work, user object computations local to this process, and register any exception it raises wi...
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 bool _interface_kernel_integrity_check
Whether to check that interface kernel variables match the orientation of their boundaries.
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)
void translateCaughtException(const std::string &calling_method)
Classify the exception currently being handled and register its message with setException(),...
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.
Thrown by FEProblemBase::checkExceptionAndStopSolve() once an exception has been communicated to all ...
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 set_union(T &data, const unsigned int root_id) 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
std::vector< ElemQuality > valid(const ElemType t)
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
const RemoteElem * remote_elem
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.