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");
227 params.
addParam<std::vector<VariableName>>(
228 "constant_null_space_variables",
230 "Variables whose constant fields span the nullspace of the Jacobian. Each variable adds one "
231 "mode that is one on the variable's degrees of freedom and zero elsewhere.");
232 params.
addParam<std::vector<VariableName>>(
233 "constant_transpose_null_space_variables",
235 "Variables whose equation residual entries have a sum that is independent of the solution. "
236 "For each variable, the residual-space vector that is one on the variable's equations' "
237 "vector entries and zero elsewhere then spans part of the transpose nullspace of the "
238 "Jacobian. The linear solver removes the component of the residual along this vector. A "
239 "sum that is nonzero beyond round-off means that the nonlinear system has no solution "
240 "without projection.");
243 "Whether or not to actually solve the Nonlinear system. "
244 "This is handy in the case that all you want to do is "
245 "execute AuxKernels, Transfers, etc. without actually "
247 params.
addParam<
bool>(
"use_nonlinear",
249 "Determines whether to use a Nonlinear vs a "
250 "Eigenvalue system (Automatically determined based "
252 params.
addParam<
bool>(
"error_on_jacobian_nonzero_reallocation",
253 "This causes PETSc to error if it had to reallocate memory in the Jacobian "
254 "matrix due to not having enough nonzeros");
255 params.
addParam<
bool>(
"ignore_zeros_in_jacobian",
257 "Do not explicitly store zero values in "
258 "the Jacobian matrix if true");
259 params.
addParam<
bool>(
"force_restart",
261 "EXPERIMENTAL: If true, a sub_app may use a "
262 "restart file instead of using of using the master "
266 "True to skip additional data in equation system for restart.",
267 "This parameter is no longer used, as we do not load additional "
268 "vectors by default with restart");
269 params.
addParam<
bool>(
"skip_nl_system_check",
271 "True to skip the NonlinearSystem check for work to do (e.g. Make sure "
272 "that there are variables to solve for).");
273 params.
addParam<
bool>(
"allow_initial_conditions_with_restart",
275 "True to allow the user to specify initial conditions when restarting. "
276 "Initial conditions can override any restarted field");
278 auto coverage_check_description = [](std::string scope, std::string list_param_name)
280 return "Controls, if and how a " + scope +
281 " subdomain coverage check is performed. "
282 "With 'TRUE' or 'ON' all subdomains are checked (the default). Setting 'FALSE' or 'OFF' "
283 "will disable the check for all subdomains. "
284 "To exclude a predefined set of subdomains 'SKIP_LIST' is to "
285 "be used, while the subdomains to skip are to be defined in the parameter '" +
287 "'. To limit the check to a list of subdomains, 'ONLY_LIST' is to "
288 "be used (again, using the parameter '" +
289 list_param_name +
"').";
292 params.
addParam<std::vector<SubdomainName>>(
295 "List of subdomains for kernel coverage and material coverage checks. Setting this parameter "
296 "is equivalent to setting 'kernel_coverage_block_list' and 'material_coverage_block_list' as "
297 "well as using 'ONLY_LIST' as the coverage check mode.");
299 MooseEnum kernel_coverage_check_modes(
"FALSE TRUE OFF ON SKIP_LIST ONLY_LIST",
"TRUE");
301 kernel_coverage_check_modes,
302 coverage_check_description(
"kernel",
"kernel_coverage_block_list"));
303 params.
addParam<std::vector<SubdomainName>>(
304 "kernel_coverage_block_list",
306 "List of subdomains for kernel coverage check. The meaning of this list is controlled by the "
307 "parameter 'kernel_coverage_check' (whether this is the list of subdomains to be checked, "
308 "not to be checked or not taken into account).");
310 "boundary_restricted_node_integrity_check",
312 "Set to false to disable checking of boundary restricted nodal object variable dependencies, "
313 "e.g. are the variable dependencies defined on the selected boundaries?");
314 params.
addParam<
bool>(
"boundary_restricted_elem_integrity_check",
316 "Set to false to disable checking of boundary restricted elemental object "
317 "variable dependencies, e.g. are the variable dependencies defined on the "
318 "selected boundaries?");
319 params.
addParam<
bool>(
"interface_kernel_integrity_check",
321 "Set to false to disable checking that each interface kernel's 'variable' "
322 "is defined on the primary side and 'neighbor_var' on the secondary side "
323 "of each of its boundaries");
325 "side_uo_interface_mat_prop_integrity_check",
327 "Set to false to disable checking that side user objects do not consume material "
328 "properties declared by interface materials on the same boundary.");
329 MooseEnum material_coverage_check_modes(
"FALSE TRUE OFF ON SKIP_LIST ONLY_LIST",
"TRUE");
331 "material_coverage_check",
332 material_coverage_check_modes,
333 coverage_check_description(
"material",
"material_coverage_block_list"));
334 params.
addParam<std::vector<SubdomainName>>(
335 "material_coverage_block_list",
337 "List of subdomains for material coverage check. The meaning of this list is controlled by "
338 "the parameter 'material_coverage_check' (whether this is the list of subdomains to be "
339 "checked, not to be checked or not taken into account).");
341 params.
addParam<
bool>(
"fv_bcs_integrity_check",
343 "Set to false to disable checking of overlapping Dirichlet and Flux BCs "
344 "and/or multiple DirichletBCs per sideset");
347 "fv_face_integrity_check",
349 "Set to false to disable checking that FV flux boundary conditions and FV interface "
350 "kernels are applied to faces with valid variable ownership and interface topology.");
353 "material_dependency_check",
true,
"Set to false to disable material dependency check");
354 params.
addParam<
bool>(
"parallel_barrier_messaging",
356 "Displays messaging from parallel "
357 "barrier notifications when executing "
358 "or transferring to/from Multiapps "
361 "num_concurrent_multiapps",
363 "Set greater than 1 to solve the multiapps sharing an 'execution_order_group' "
364 "concurrently. Each such multiapp is assigned a disjoint subset of the MPI ranks "
365 "(partitioned using their 'min_procs_per_app'/'max_procs_per_app', otherwise evenly), so "
366 "they solve at the same time on different ranks. The specific value only acts as an "
367 "on/off switch; the number that run at once is set by the ranks available.");
369 MooseEnum verbosity(
"false true extra",
"false");
372 "Set to 'true' to have the problem report on any object created. Set "
373 "to 'extra' to also display all parameters.");
374 params.
addParam<
bool>(
"verbose_multiapps",
376 "Set to True to enable verbose screen printing related to MultiApps");
380 "Set to True to enable verbose screen printing related to solution restoration");
382 params.
addParam<FileNameNoExtension>(
"restart_file_base",
383 "File base name used for restart (e.g. "
384 "<path>/<filebase> or <path>/LATEST to "
385 "grab the latest file available)");
387 params.
addParam<std::vector<std::vector<TagName>>>(
390 "Extra vectors to add to the system that can be filled by objects which compute residuals "
391 "and Jacobians (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<std::vector<TagName>>>(
395 "not_zeroed_tag_vectors",
397 "Extra vector tags which the sytem will not zero when other vector tags are zeroed. "
398 "The outer index is for which nonlinear system the extra tag vectors should be added for");
400 params.
addParam<std::vector<std::vector<TagName>>>(
401 "extra_tag_matrices",
403 "Extra matrices to add to the system that can be filled "
404 "by objects which compute residuals and Jacobians "
405 "(Kernels, BCs, etc.) by setting tags on them. The outer index is for which "
406 "nonlinear system the extra tag vectors should be added for");
408 params.
addParam<std::vector<TagName>>(
409 "extra_tag_solutions",
411 "Extra solution vectors to add to the system that can be used by "
412 "objects for coupling variable values stored in them.");
414 params.
addParam<
bool>(
"previous_nl_solution_required",
416 "True to indicate that this calculation requires a solution vector for "
417 "storing the previous nonlinear iteration.");
419 params.
addParam<std::vector<NonlinearSystemName>>(
420 "nl_sys_names", std::vector<NonlinearSystemName>{
"nl0"},
"The nonlinear system names");
422 params.
addParam<std::vector<LinearSystemName>>(
"linear_sys_names", {},
"The linear system names");
424 params.
addParam<
bool>(
"check_uo_aux_state",
426 "True to turn on a check that no state presents during the evaluation of "
427 "user objects and aux kernels");
434 "allow_invalid_solution",
436 "Set to true to allow convergence even though the solution has been marked as 'invalid'");
437 params.
addParam<
bool>(
"show_invalid_solution_console",
439 "Set to true to show the invalid solution occurrence summary in console");
440 params.
addParam<
bool>(
"immediately_print_invalid_solution",
442 "Whether or not to report invalid solution warnings at the time the "
443 "warning is produced instead of after the calculation");
446 "identify_variable_groups_in_nl",
448 "Whether to identify variable groups in nonlinear systems. This affects dof ordering");
451 "regard_general_exceptions_as_errors",
453 "If we catch an exception during residual/Jacobian evaluaton for which we don't have "
454 "specific handling, immediately error instead of allowing the time step to be cut");
456 params.
addParam<
bool>(
"use_hash_table_matrix_assembly",
458 "Whether to assemble matrices using hash tables instead of preallocating "
459 "matrix memory. This can be a good option if the sparsity pattern changes "
460 "throughout the course of the simulation.");
462 "restore_original_nonzero_pattern",
463 "Whether we should reset matrix memory for every Jacobian evaluation. This option is useful "
464 "if the sparsity pattern is constantly changing and you are using hash table assembly or if "
465 "you wish to continually restore the matrix to the originally preallocated sparsity pattern "
466 "computed by relationship managers.");
469 "skip_nl_system_check kernel_coverage_check kernel_coverage_block_list "
470 "boundary_restricted_node_integrity_check "
471 "boundary_restricted_elem_integrity_check interface_kernel_integrity_check "
472 "side_uo_interface_mat_prop_integrity_check material_coverage_check "
473 "material_coverage_block_list fv_bcs_integrity_check fv_face_integrity_check "
474 "material_dependency_check check_uo_aux_state error_on_jacobian_nonzero_reallocation",
475 "Simulation checks");
477 "ignore_zeros_in_jacobian identify_variable_groups_in_nl "
478 "use_hash_table_matrix_assembly restore_original_nonzero_pattern",
479 "Nonlinear system(s)");
481 "restart_file_base force_restart allow_initial_conditions_with_restart",
"Restart");
483 "verbose_setup verbose_multiapps verbose_restore parallel_barrier_messaging",
"Verbosity");
485 "null_space_dimension transpose_null_space_dimension near_null_space_dimension "
486 "constant_null_space_variables constant_transpose_null_space_variables",
487 "Null space removal");
489 "extra_tag_vectors extra_tag_matrices extra_tag_solutions not_zeroed_tag_vectors",
490 "Contribution to tagged field data");
492 "allow_invalid_solution show_invalid_solution_console immediately_print_invalid_solution",
493 "Solution validity control");
501 _mesh(*getCheckedPointerParam<
MooseMesh *>(
"mesh")),
503 "equation_systems", nullptr, _mesh)),
505 _solve(getParam<bool>(
"solve")),
507 _time(declareRestartableData<Real>(
"time")),
508 _time_old(declareRestartableData<Real>(
"time_old")),
509 _time_older(declareRestartableData<Real>(
"time_older")),
510 _t_step(declareRecoverableData<
int>(
"t_step")),
511 _dt(declareRestartableData<Real>(
"dt")),
512 _dt_old(declareRestartableData<Real>(
"dt_old")),
513 _need_to_add_default_nonlinear_convergence(false),
514 _need_to_add_default_multiapp_fixed_point_convergence(false),
515 _need_to_add_default_steady_state_convergence(false),
516 _linear_sys_names(getParam<
std::vector<LinearSystemName>>(
"linear_sys_names")),
517 _num_linear_sys(_linear_sys_names.size()),
518 _linear_systems(_num_linear_sys, nullptr),
519 _current_linear_sys(nullptr),
520 _using_default_nl(!isParamSetByUser(
"nl_sys_names")),
521 _nl_sys_names(!_using_default_nl || (_using_default_nl && !_linear_sys_names.size())
522 ? getParam<
std::vector<NonlinearSystemName>>(
"nl_sys_names")
523 :
std::vector<NonlinearSystemName>()),
524 _num_nl_sys(_nl_sys_names.size()),
525 _nl(_num_nl_sys, nullptr),
526 _current_nl_sys(nullptr),
527 _solver_systems(_num_nl_sys + _num_linear_sys, nullptr),
529 _coupling(
Moose::COUPLING_DIAG),
530#ifdef MOOSE_KOKKOS_ENABLED
531 _kokkos_assembly(*this),
533 _mesh_divisions(numThreads()),
534 _functions(numThreads()),
535#ifdef MOOSE_KOKKOS_ENABLED
536 _kokkos_functions(1),
538 _convergences(numThreads()),
539 _nonlocal_kernels(numThreads()),
540 _nonlocal_integrated_bcs(numThreads()),
542 _fv_ics(numThreads()),
544 "material_props", &_mesh, _material_prop_registry, *this)),
546 "bnd_material_props", &_mesh, _material_prop_registry, *this)),
548 "neighbor_material_props", &_mesh, _material_prop_registry, *this)),
549#ifdef MOOSE_KOKKOS_ENABLED
550 _kokkos_material_props(
552 "kokkos_material_props", &_mesh, _material_prop_registry, *this)),
553 _kokkos_bnd_material_props(
555 "kokkos_bnd_material_props", &_mesh, _material_prop_registry, *this)),
556 _kokkos_neighbor_material_props(
558 "kokkos_neighbor_material_props", &_mesh, _material_prop_registry, *this)),
560 _materials(numThreads()),
561 _interface_materials(numThreads()),
562 _discrete_materials(numThreads()),
563 _all_materials(numThreads()),
564#ifdef MOOSE_KOKKOS_ENABLED
565 _kokkos_materials(1),
567 _indicators(numThreads()),
568 _internal_side_indicators(numThreads()),
569 _markers(numThreads()),
570 _reporter_data(_app),
571 _multi_apps(_app.getExecuteOnEnum(), numThreads()),
572 _transient_multi_apps(_app.getExecuteOnEnum(), numThreads()),
573 _transfers(_app.getExecuteOnEnum(), 1),
574 _to_multi_app_transfers(_app.getExecuteOnEnum(), 1),
575 _from_multi_app_transfers(_app.getExecuteOnEnum(), 1),
576 _between_multi_app_transfers(_app.getExecuteOnEnum(), 1),
577 _num_concurrent_multiapps(getParam<unsigned
int>(
"num_concurrent_multiapps")),
578#ifdef LIBMESH_ENABLE_AMR
580 _cycles_completed(0),
582 _displaced_mesh(nullptr),
583 _geometric_search_data(*this, _mesh),
585 _reinit_displaced_elem(false),
586 _reinit_displaced_face(false),
587 _reinit_displaced_neighbor(false),
588 _input_file_saved(false),
590 _has_constraints(false),
591 _snesmf_reuse_base(true),
592 _skip_exception_check(false),
593 _snesmf_reuse_base_set_by_user(false),
594 _has_initialized_stateful(false),
595 _const_jacobian(false),
596 _has_jacobian(false),
597 _needs_old_newton_iter(false),
598 _previous_nl_solution_required(getParam<bool>(
"previous_nl_solution_required")),
599 _previous_multiapp_fp_nl_solution_required(_num_nl_sys + _num_linear_sys, false),
600 _previous_multiapp_fp_aux_solution_required(false),
601 _previous_multisystem_fp_nl_solution_required(_num_nl_sys + _num_linear_sys, false),
602 _previous_multisystem_fp_aux_solution_required(false),
603 _has_nonlocal_coupling(false),
604 _calculate_jacobian_in_uo(false),
605 _kernel_coverage_check(
607 _kernel_coverage_blocks(getParam<
std::vector<SubdomainName>>(
"kernel_coverage_block_list")),
608 _boundary_restricted_node_integrity_check(
609 getParam<bool>(
"boundary_restricted_node_integrity_check")),
610 _boundary_restricted_elem_integrity_check(
611 getParam<bool>(
"boundary_restricted_elem_integrity_check")),
612 _interface_kernel_integrity_check(getParam<bool>(
"interface_kernel_integrity_check")),
613 _side_uo_interface_mat_prop_integrity_check(
614 getParam<bool>(
"side_uo_interface_mat_prop_integrity_check")),
615 _material_coverage_check(
617 _material_coverage_blocks(getParam<
std::vector<SubdomainName>>(
"material_coverage_block_list")),
618 _fv_bcs_integrity_check(getParam<bool>(
"fv_bcs_integrity_check")),
619 _fv_face_integrity_check(getParam<bool>(
"fv_face_integrity_check")),
620 _material_dependency_check(getParam<bool>(
"material_dependency_check")),
621 _uo_aux_state_check(getParam<bool>(
"check_uo_aux_state")),
623 _check_residual_for_nans(false),
625 _max_qps(
std::numeric_limits<unsigned
int>::max()),
626 _max_scalar_order(INVALID_ORDER),
627 _has_time_integrator(false),
628 _has_exception(false),
629 _parallel_barrier_messaging(getParam<bool>(
"parallel_barrier_messaging")),
630 _verbose_setup(getParam<
MooseEnum>(
"verbose_setup")),
631 _verbose_multiapps(getParam<bool>(
"verbose_multiapps")),
632 _verbose_restore(getParam<bool>(
"verbose_restore")),
634 _control_warehouse(_app.getExecuteOnEnum(), 1),
635 _is_petsc_options_inserted(false),
636 _line_search(nullptr),
637 _using_ad_mat_props(false),
638 _current_ic_state(0),
639 _constant_null_space_vars(getParam<
std::vector<VariableName>>(
"constant_null_space_variables")),
640 _constant_transpose_null_space_vars(
641 getParam<
std::vector<VariableName>>(
"constant_transpose_null_space_variables")),
642 _use_hash_table_matrix_assembly(getParam<bool>(
"use_hash_table_matrix_assembly")),
643 _error_on_jacobian_nonzero_reallocation(
644 isParamValid(
"error_on_jacobian_nonzero_reallocation")
645 ? getParam<bool>(
"error_on_jacobian_nonzero_reallocation")
646 : _app.errorOnJacobianNonzeroReallocation()),
647 _restore_original_nonzero_pattern(isParamValid(
"restore_original_nonzero_pattern")
648 ? getParam<bool>(
"restore_original_nonzero_pattern")
649 : _use_hash_table_matrix_assembly),
650 _ignore_zeros_in_jacobian(getParam<bool>(
"ignore_zeros_in_jacobian")),
651 _preserve_matrix_sparsity_pattern(true),
652 _force_restart(getParam<bool>(
"force_restart")),
653 _allow_ics_during_restart(getParam<bool>(
"allow_initial_conditions_with_restart")),
654 _skip_nl_system_check(getParam<bool>(
"skip_nl_system_check")),
655 _fail_next_system_convergence_check(false),
656 _allow_invalid_solution(getParam<bool>(
"allow_invalid_solution")),
657 _show_invalid_solution_console(getParam<bool>(
"show_invalid_solution_console")),
658 _immediately_print_invalid_solution(getParam<bool>(
"immediately_print_invalid_solution")),
659 _started_initial_setup(false),
660 _has_internal_edge_residual_objects(false),
661 _u_dot_requested(false),
662 _u_dotdot_requested(false),
663 _u_dot_old_requested(false),
664 _u_dotdot_old_requested(false),
667 _print_execution_on(),
668 _identify_variable_groups_in_nl(getParam<bool>(
"identify_variable_groups_in_nl")),
669 _regard_general_exceptions_as_errors(getParam<bool>(
"regard_general_exceptions_as_errors")),
670 _requires_nonlocal_coupling(false)
672 auto checkCoverageCheckConflict =
673 [
this](
const std::string & coverage_check,
675 const std::vector<SubdomainName> & coverage_blocks) ->
void
679 if (coverage_blocks.size() > 1)
680 if (std::find(coverage_blocks.begin(), coverage_blocks.end(),
"ANY_BLOCK_ID") !=
681 coverage_blocks.end())
683 "The list of blocks used for ",
685 " cannot contain 'ANY_BLOCK_ID' along with other blocks. ");
688 checkCoverageCheckConflict(
690 checkCoverageCheckConflict(
696 ADReal::do_derivatives =
true;
737 _zero.resize(n_threads);
761 std::string restart_file_base = getParam<FileNameNoExtension>(
"restart_file_base");
768 if (restart_file_base.size())
786#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
805 mooseWarning(
"Displaced mesh was requested but the displaced problem does not exist. "
806 "Regular mesh will be returned");
814 mooseWarning(
"Displaced mesh was requested but the displaced problem does not exist. "
815 "Regular mesh will be returned");
823 auto & vectors = getParam<std::vector<std::vector<TagName>>>(
"extra_tag_vectors");
824 for (
const auto sys_num : index_range(vectors))
825 for (
auto & vector : vectors[sys_num])
831 auto & not_zeroed_vectors = getParam<std::vector<std::vector<TagName>>>(
"not_zeroed_tag_vectors");
832 for (
const auto sys_num : index_range(not_zeroed_vectors))
833 for (
auto & vector : not_zeroed_vectors[sys_num])
844 auto & matrices = getParam<std::vector<std::vector<TagName>>>(
"extra_tag_matrices");
845 for (
const auto sys_num : index_range(matrices))
846 for (
auto & matrix : matrices[sys_num])
853 sys->sizeVariableMatrixData();
854 _aux->sizeVariableMatrixData();
860 for (
auto & vector : getParam<std::vector<TagName>>(
"extra_tag_solutions"))
880 _aux->associateVectorToTag(*
_aux->system().current_local_solution.get(), tag);
887 sys->needSolutionState(state, iteration_type);
888 _aux->needSolutionState(state, iteration_type);
895 bool has_solution_state =
false;
897 has_solution_state |= sys->hasSolutionState(state, iteration_type);
898 has_solution_state |=
_aux->hasSolutionState(state, iteration_type);
899 return has_solution_state;
908 for (
const auto i : make_range(n_threads))
910 _assembly[i].resize(solver_systems.size());
911 for (
const auto j : index_range(solver_systems))
912 _assembly[i][j] = std::make_unique<Assembly>(*solver_systems[j], i);
918 std::vector<std::shared_ptr<NonlinearSystemBase>> & nls)
920 TIME_SECTION(
"initNullSpaceVectors", 5,
"Initializing Null Space Vectors");
922 unsigned int dimNullSpace =
parameters.
get<
unsigned int>(
"null_space_dimension");
923 unsigned int dimTransposeNullSpace =
924 parameters.
get<
unsigned int>(
"transpose_null_space_dimension");
925 unsigned int dimNearNullSpace =
parameters.
get<
unsigned int>(
"near_null_space_dimension");
926 for (
unsigned int i = 0; i < dimNullSpace; ++i)
928 std::ostringstream oss;
932 for (
auto & nl : nls)
936 for (
unsigned int i = 0; i < dimTransposeNullSpace; ++i)
938 std::ostringstream oss;
942 for (
auto & nl : nls)
946 for (
unsigned int i = 0; i < dimNearNullSpace; ++i)
948 std::ostringstream oss;
952 for (
auto & nl : nls)
967 for (
unsigned int i = 0; i < n_threads; i++)
983#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
988 CHKERRABORT(this->
comm().get(), ierr);
997 TIME_SECTION(
"setCoordSystem", 5,
"Setting Coordinate System");
1007const ConstElemRange &
1012 std::vector<const DofMap *> dof_maps(
es().n_systems());
1013 for (
const auto i : make_range(
es().n_systems()))
1019 std::make_unique<ConstElemRange>(
_mesh.
getMesh().multi_evaluable_elements_begin(dof_maps),
1020 _mesh.
getMesh().multi_evaluable_elements_end(dof_maps));
1025const ConstElemRange &
1030 std::vector<const DofMap *> dof_maps(
_nl.size());
1031 for (
const auto i : index_range(dof_maps))
1032 dof_maps[i] = &
_nl[i]->dofMap();
1034 std::make_unique<ConstElemRange>(
_mesh.
getMesh().multi_evaluable_elements_begin(dof_maps),
1035 _mesh.
getMesh().multi_evaluable_elements_end(dof_maps));
1044 TIME_SECTION(
"initialSetup", 2,
"Performing Initial Setup");
1049 mooseError(
"Checkpoint recovery and restart and exodus restart are all mutually exclusive.");
1052 mooseWarning(
"MOOSE may fail to catch an exception when the \"skip_exception_check\" parameter "
1053 "is used. If you receive a terse MPI error during execution, remove this "
1054 "parameter and rerun your simulation");
1069 _aux->initSolutionState();
1075 dof_id_type global_max_var_n_dofs_per_elem = 0;
1079 dof_id_type max_var_n_dofs_per_elem;
1080 dof_id_type max_var_n_dofs_per_node;
1082 TIME_SECTION(
"computingMaxDofs", 3,
"Computing Max Dofs Per Element");
1086 max_var_n_dofs_per_elem = mvndpe.max();
1091 max_var_n_dofs_per_node = mvndpn.max();
1093 global_max_var_n_dofs_per_elem =
1094 std::max(global_max_var_n_dofs_per_elem, max_var_n_dofs_per_elem);
1098 TIME_SECTION(
"assignMaxDofs", 5,
"Assigning Maximum Dofs Per Elem");
1100 sys.assignMaxVarNDofsPerElem(max_var_n_dofs_per_elem);
1103 displaced_problem->solverSys(i).assignMaxVarNDofsPerElem(max_var_n_dofs_per_elem);
1105 sys.assignMaxVarNDofsPerNode(max_var_n_dofs_per_node);
1107 displaced_problem->solverSys(i).assignMaxVarNDofsPerNode(max_var_n_dofs_per_node);
1112 TIME_SECTION(
"resizingVarValues", 5,
"Resizing Variable Values");
1114 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
1116 _phi_zero[tid].resize(global_max_var_n_dofs_per_elem, std::vector<Real>(
getMaxQps(), 0.));
1137 props->setRecovering();
1139#ifdef MOOSE_KOKKOS_ENABLED
1142 props->setRecovering();
1146 TIME_SECTION(
"restore", 3,
"Restoring from backup");
1176 TIME_SECTION(
"copyingFromExodus", 3,
"Copying Variables From Exodus");
1179 sys->copyVars(*reader);
1180 _aux->copyVars(*reader);
1185 mooseError(
"Need Exodus reader to restart variables but the reader is not available\n"
1186 "Use either FileMesh with an Exodus mesh file or FileMeshGenerator with an "
1187 "Exodus mesh file and with use_for_exodus_restart equal to true");
1203 mooseError(
"Stateful neighbor material properties do not work with mesh adaptivity");
1219 "Doing extra refinements when restarting is NOT supported for sub-apps of a MultiApp");
1229 TIME_SECTION(
"convergenceInitialSetup", 5,
"Initializing Convergence objects");
1237 std::set<std::string> depend_objects_aux =
_aux->getDependObjects();
1239 std::map<int, std::vector<UserObjectBase *>> group_userobjs;
1243 std::vector<UserObjectBase *> userobjs;
1248 for (
auto obj : userobjs)
1249 group_userobjs[obj->
getParam<
int>(
"execution_order_group")].push_back(obj);
1251#ifdef MOOSE_KOKKOS_ENABLED
1255 std::vector<UserObjectBase *> userobjs;
1260 for (
auto obj : userobjs)
1261 group_userobjs[obj->
getParam<
int>(
"execution_order_group")].push_back(obj);
1265 for (
auto & [group, objs] : group_userobjs)
1266 for (auto obj : objs)
1279 TIME_SECTION(
"initializingFunctions", 5,
"Initializing Functions");
1289#ifdef MOOSE_KOKKOS_ENABLED
1295 TIME_SECTION(
"initializingRandomObjects", 5,
"Initializing Random Objects");
1307 TIME_SECTION(
"ICinitialSetup", 5,
"Setting Up Initial Conditions");
1324 TIME_SECTION(
"materialInitialSetup", 3,
"Setting Up Materials");
1345#ifdef MOOSE_KOKKOS_ENABLED
1350 TIME_SECTION(
"computingInitialStatefulProps", 3,
"Computing Initial Material Values");
1357#ifdef MOOSE_KOKKOS_ENABLED
1372 props->setRestartInPlace();
1373 props->setRecovering();
1384#ifdef LIBMESH_ENABLE_AMR
1390 mooseError(
"Cannot perform initial adaptivity during restart on sub-apps of a MultiApp!");
1406 unsigned short ic_state_max = 0;
1408 auto findMax = [&ic_state_max](
const auto & obj_list)
1410 for (
auto ic : obj_list.getActiveObjects())
1411 ic_state_max =
std::
max(ic_state_max, ic->getState());
1418 if (ic_state_max > 0)
1422 std::vector<std::unique_ptr<NumericVector<Real>>> state0_sys_buffers(
_solver_systems.size());
1423 std::unique_ptr<NumericVector<Real>> state0_aux_buffer;
1429 state0_aux_buffer =
_aux->solutionState(0).clone();
1450 _aux->solutionState(0) = *state0_aux_buffer;
1451 _aux->solutionState(0).close();
1467 _aux->initialSetup();
1474 sys->setSolution(*(sys->system().current_local_solution.
get()));
1504 const auto & tis = sys->getTimeIntegrators();
1507 TIME_SECTION(
"timeIntegratorInitialSetup", 5,
"Initializing Time Integrator");
1508 for (
auto & ti : tis)
1519 TIME_SECTION(
"initialSetupMultiApps", 2,
"Initializing MultiApps",
false);
1528 TIME_SECTION(
"initialSetupTransfers", 2,
"Initializing Transfers");
1534 for (
const auto & transfer : to_multi_app_objects)
1537 transfer->initialSetup();
1542 for (
const auto & transfer : from_multi_app_objects)
1545 transfer->initialSetup();
1550 for (
const auto & transfer : between_multi_app_objects)
1553 transfer->initialSetup();
1559 TIME_SECTION(
"BoundaryRestrictedNodeIntegrityCheck", 5);
1567 for (
auto & nl :
_nl)
1569 const auto & nodal_bcs = nl->getNodalBCWarehouse();
1570 if (!nodal_bcs.hasBoundaryObjects())
1573 for (
const auto & bnode : bnd_nodes)
1575 const auto boundary_id = bnode->_bnd_id;
1576 const Node *
const node = bnode->_node;
1578 if (node->processor_id() != this->processor_id())
1584 if (!nodal_bcs.hasBoundaryObjects(boundary_id))
1587 const auto & bnd_objects = nodal_bcs.getBoundaryObjects(boundary_id);
1588 for (
const auto & bnd_object : bnd_objects)
1590 const auto & bnd_variable = bnd_object->variable();
1595 if (!bnd_object->requiresGeometricSearch() &&
1596 bnd_object->checkVariableBoundaryIntegrity() &&
1597 node->n_dofs(nl->number(), bnd_variable.number()))
1599 std::set<MooseVariableFieldBase *> vars_to_omit = {
1600 &cast_ref<MooseVariableFieldBase &>(
const_cast<MooseVariableBase &
>(bnd_variable))};
1603 *bnd_object, bnd_object->checkAllVariables(*node, vars_to_omit), bnd_name);
1612 TIME_SECTION(
"BoundaryRestrictedElemIntegrityCheck", 5);
1622 TIME_SECTION(
"InterfaceKernelIntegrityCheck", 5);
1633 std::set<std::tuple<BoundaryID, SubdomainID, SubdomainID, unsigned short>> face_block_pairs;
1634 const auto & boundary_info =
_mesh.
getMesh().get_boundary_info();
1635 for (
const auto & bnd_elem : *
_mesh.getBoundaryElementRange())
1637 if (const auto * const neighbor = bnd_elem->_elem->neighbor_ptr(bnd_elem->_side);
1639 face_block_pairs.emplace(
1641 bnd_elem->_elem->subdomain_id(),
1642 neighbor->subdomain_id(),
1643 boundary_info.has_boundary_id(
1644 neighbor, neighbor->which_neighbor_am_i(bnd_elem->_elem), bnd_elem->_bnd_id));
1647 for (
const auto & nl :
_nl)
1648 for (const auto & ik : nl->getInterfaceKernelWarehouse().getObjects())
1649 for (const auto bnd_id : ik->boundaryIDs())
1651 const auto & var = ik->variable();
1652 const auto & neighbor_var = ik->neighborVariable();
1653 const auto block_name = [
this](
const SubdomainID blk)
1656 return name.empty() ? std::to_string(blk) :
name;
1661 const auto valid = [](
const auto & elem_var,
1662 const auto & neigh_var,
1666 return elem_var.activeOnSubdomain(elem_blk) &&
1667 neigh_var.activeOnSubdomain(neighbor_blk);
1674 std::vector<std::string> failing_pairs;
1675 std::vector<std::string> flipped_pairs;
1676 bool all_flipped =
true;
1677 for (
const auto & [bid, elem_blk, neighbor_blk, two_sided] : face_block_pairs)
1680 const bool flipped_valid =
1681 valid(neighbor_var, var, elem_blk, neighbor_blk) ||
1682 (two_sided &&
valid(neighbor_var, var, neighbor_blk, elem_blk));
1684 all_flipped =
false;
1685 if (!
valid(var, neighbor_var, elem_blk, neighbor_blk) &&
1686 !(two_sided &&
valid(var, neighbor_var, neighbor_blk, elem_blk)))
1688 const auto pair_name = block_name(elem_blk) +
" -> " + block_name(neighbor_blk);
1689 failing_pairs.push_back(pair_name);
1691 flipped_pairs.push_back(pair_name);
1694 if (failing_pairs.empty())
1697 std::string flipped_hint;
1698 if (!flipped_pairs.empty())
1700 "\nThe variables appear to be flipped relative to the boundary "
1701 "orientation on block pair(s) " +
1702 MooseUtils::join(flipped_pairs,
", ") +
1703 (all_flipped ?
"; swap 'variable' and 'neighbor_var', or reverse the "
1704 "orientation of the boundary."
1705 :
"; reverse the orientation of the boundary on those pairs.");
1709 "The interface kernel will not contribute on all or part of boundary '",
1713 ") must be defined on the primary (element) side and 'neighbor_var' (",
1714 neighbor_var.name(),
1715 ") on the secondary (neighbor) side of each face. Failing block pair(s) (primary -> "
1717 MooseUtils::join(failing_pairs,
", "),
1725 TIME_SECTION(
"FVFaceIntegrityCheck", 5);
1727 auto check_fv_face_integrity = [
this](
MooseMesh & fv_mesh,
const bool on_displaced)
1732 .condition<AttribDisplaced>(on_displaced)
1739 .condition<AttribDisplaced>(on_displaced)
1742 interface_kernel_base_query);
1744 std::vector<FVFluxBC *> flux_bcs;
1745 std::vector<FVInterfaceKernel *> interface_kernels;
1752 for (
const auto boundary_id : fi.boundaryIDs())
1754 auto boundary_key = std::make_tuple(boundary_id,
false);
1756 flux_bc_query.queryInto(flux_bcs, boundary_key);
1757 for (
const auto *
const flux_bc : flux_bcs)
1758 if (flux_bc->checkVariableBoundaryIntegrity())
1759 flux_bc->checkFaceIntegrity(fi);
1761 interface_kernel_query.queryInto(interface_kernels, boundary_key);
1762 for (
const auto *
const interface_kernel : interface_kernels)
1763 interface_kernel->checkFaceIntegrity(fi);
1769 check_fv_face_integrity(
mesh(),
false);
1779 mooseError(
"failed to converge initial MultiApp");
1812 TIME_SECTION(
"computeMaterials", 2,
"Computing Initial Material Properties");
1816#ifdef MOOSE_KOKKOS_ENABLED
1821 TIME_SECTION(
"computeMaterials", 2,
"Computing Initial Material Properties");
1833 for (
unsigned int tid = 0; tid <
n_threads; tid++)
1851 TIME_SECTION(
"lineSearchInitialSetup", 5,
"Initializing Line Search");
1873 "\" has the same name as a scalar variable in the system.");
1884 std::unique_ptr<libMesh::MeshRefinement> displaced_mesh_refinement(
nullptr);
1886 displaced_mesh_refinement = std::make_unique<libMesh::MeshRefinement>(*
_displaced_mesh);
1902 displaced_mesh_refinement->uniformly_coarsen();
1945 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
1951#ifdef MOOSE_KOKKOS_ENABLED
1955 _aux->timestepSetup();
1957 sys->timestepSetup();
1963 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
1970 std::vector<UserObject *> userobjs;
1972 for (
auto obj : userobjs)
1973 obj->timestepSetup();
1975#ifdef MOOSE_KOKKOS_ENABLED
1977 std::vector<UserObjectBase *> userobjs;
1979 for (
auto obj : userobjs)
1980 obj->timestepSetup();
1995 if (
_max_qps == std::numeric_limits<unsigned int>::max())
2009 TIME_SECTION(
"checkNonlocalCoupling", 5,
"Checking Nonlocal Coupling");
2012 for (
auto & nl :
_nl)
2014 const auto & all_kernels = nl->getKernelWarehouse();
2015 const auto & kernels = all_kernels.getObjects(tid);
2016 for (
const auto & kernel : kernels)
2018 std::shared_ptr<NonlocalKernel> nonlocal_kernel =
2019 std::dynamic_pointer_cast<NonlocalKernel>(kernel);
2020 if (nonlocal_kernel)
2028 nl->getIntegratedBCWarehouse();
2029 const auto & integrated_bcs = all_integrated_bcs.
getObjects(tid);
2030 for (
const auto & integrated_bc : integrated_bcs)
2032 std::shared_ptr<NonlocalIntegratedBC> nonlocal_integrated_bc =
2033 std::dynamic_pointer_cast<NonlocalIntegratedBC>(integrated_bc);
2034 if (nonlocal_integrated_bc)
2047 std::set<const MooseVariableFEBase *> uo_jacobian_moose_vars;
2049 std::vector<ShapeElementUserObject *> objs;
2053 .condition<AttribThread>(tid)
2056 for (
const auto & uo : objs)
2059 const auto & mv_deps = uo->jacobianMooseVariables();
2060 uo_jacobian_moose_vars.insert(mv_deps.begin(), mv_deps.end());
2064 std::vector<ShapeSideUserObject *> objs;
2068 .condition<AttribThread>(tid)
2070 for (
const auto & uo : objs)
2073 const auto & mv_deps = uo->jacobianMooseVariables();
2074 uo_jacobian_moose_vars.insert(mv_deps.begin(), mv_deps.end());
2086 for (
unsigned int i = 0; i < moose_vars.size(); ++i)
2088 VariableName var_name = moose_vars[i]->name();
2090 sys->setVariableGlobalDoFs(var_name);
2108 _assembly[tid][i]->prepareJacobianBlock();
2131 for (
auto & nl :
_nl)
2132 nl->prepareFace(tid,
true);
2133 _aux->prepareFace(tid,
false);
2143 const std::vector<dof_id_type> & dof_indices,
2146 for (
const auto i : index_range(
_nl))
2149 _nl[i]->prepare(tid);
2154 _assembly[tid][current_nl_sys_num]->prepareBlock(ivar, jvar, dof_indices);
2159 _assembly[tid][current_nl_sys_num]->prepareBlockNonlocal(
2181 _assembly[tid][i]->setCurrentSubdomainID(did);
2191 SubdomainID did = elem->neighbor_ptr(side)->subdomain_id();
2192 for (
const auto i : index_range(
_nl))
2194 _assembly[tid][i]->setCurrentNeighborSubdomainID(did);
2205 for (
const auto i : index_range(
_nl))
2207 _assembly[tid][i]->setCurrentNeighborSubdomainID(did);
2311 std::vector<VectorTag> extra_residual_vector_tags;
2316 if (vector_tag._id != time_tag && vector_tag._id != non_time_tag)
2317 extra_residual_vector_tags.push_back(vector_tag);
2324 extra_residual_vector_tags);
2433 const DofMap & dof_map,
2434 std::vector<dof_id_type> & dof_indices,
2435 const std::set<TagID> & tags,
2458 _displaced_problem->addJacobianBlockTags(jacobian, ivar, jvar, dof_map, dof_indices, tags, tid);
2464 jacobian, ivar, jvar, dof_map, dof_indices, jv.
allDofIndices(), tags, tid);
2473 const DofMap & dof_map,
2474 std::vector<dof_id_type> & dof_indices,
2475 std::vector<dof_id_type> & neighbor_dof_indices,
2476 const std::set<TagID> & tags,
2484 neighbor_dof_indices,
2489 jacobian, ivar, jvar, dof_map, dof_indices, neighbor_dof_indices, tags, tid);
2528 TIME_SECTION(
"ghostGhostedBoundaries", 3,
"Ghosting Ghosted Boundaries");
2540 "This function is deprecated and no longer performs any function. Please do not call it."));
2548 unsigned int n_points = points.size();
2561 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
2565 _zero[tid].resize(max_qpts, 0);
2566 _grad_zero[tid].resize(max_qpts, RealGradient(0.));
2573 for (
const auto i : index_range(
_nl))
2575 _assembly[tid][i]->reinitAtPhysical(elem, points);
2576 _nl[i]->prepare(tid);
2587 bool have_points = n_points > 0;
2602 sys->reinitElem(elem, tid);
2603 _aux->reinitElem(elem, tid);
2611 const std::vector<Point> & phys_points_in_elem,
2615 "Are you calling this method with a displaced mesh element?");
2619 _assembly[tid][i]->reinitAtPhysical(elem, phys_points_in_elem);
2632 const unsigned int side,
2637 "reinitElemFace with a BoundaryID argument is deprecated because the boundary id was never "
2638 "used. Please call reinitElemFace without the BoundaryID argument instead");
2651 _aux->reinitElemFace(elem, side, tid);
2660 const std::vector<Point> *
const pts,
2661 const std::vector<Real> *
const weights)
2676 for (
const auto i : index_range(
_nl))
2679 _nl[i]->reinitNode(node, tid);
2681 _aux->reinitNode(node, tid);
2690 for (
const auto i : index_range(
_nl))
2693 _nl[i]->reinitNodeFace(node, bnd_id, tid);
2695 _aux->reinitNodeFace(node, bnd_id, tid);
2701 TIME_SECTION(
"reinitScalars", 3,
"Reinitializing Scalar Variables");
2706 for (
auto & nl :
_nl)
2707 nl->reinitScalars(tid, reinit_for_derivative_reordering);
2708 _aux->reinitScalars(tid, reinit_for_derivative_reordering);
2728 const Elem * neighbor = elem->neighbor_ptr(side);
2729 unsigned int neighbor_side = neighbor->which_neighbor_am_i(elem);
2731 for (
const auto i : index_range(
_nl))
2733 _assembly[tid][i]->reinitElemAndNeighbor(elem, side, neighbor, neighbor_side);
2734 _nl[i]->prepareNeighbor(tid);
2738 _aux->prepareNeighbor(tid);
2740 for (
auto & nl :
_nl)
2742 nl->reinitElemFace(elem, side, tid);
2743 nl->reinitNeighborFace(neighbor, neighbor_side, tid);
2745 _aux->reinitElemFace(elem, side, tid);
2746 _aux->reinitNeighborFace(neighbor, neighbor_side, tid);
2755 const auto & displaced_ref_pts =
_assembly[tid][0]->qRuleNeighbor()->get_points();
2775 auto & neighbor =
_assembly[tid][0]->neighbor();
2776 auto & neighbor_side =
_assembly[tid][0]->neighborSide();
2778 if (lower_d_elem_neighbor &&
2781 auto qps =
_assembly[tid][0]->qPointsFaceNeighbor().stdVector();
2782 std::vector<Point> reference_points;
2784 lower_d_elem_neighbor->dim(), lower_d_elem_neighbor, qps, reference_points);
2796 unsigned int neighbor_side,
2797 const std::vector<Point> & physical_points,
2801 "Are you calling this method with a displaced mesh element?");
2803 for (
const auto i : index_range(
_nl))
2806 _assembly[tid][i]->reinitNeighborAtPhysical(neighbor, neighbor_side, physical_points);
2809 _nl[i]->prepareNeighbor(tid);
2811 _aux->prepareNeighbor(tid);
2817 for (
auto & nl :
_nl)
2818 nl->reinitNeighborFace(neighbor, neighbor_side, tid);
2819 _aux->reinitNeighborFace(neighbor, neighbor_side, tid);
2824 const std::vector<Point> & physical_points,
2828 "Are you calling this method with a displaced mesh element?");
2830 for (
const auto i : index_range(
_nl))
2833 _assembly[tid][i]->reinitNeighborAtPhysical(neighbor, physical_points);
2836 _nl[i]->prepareNeighbor(tid);
2838 _aux->prepareNeighbor(tid);
2844 for (
auto & nl :
_nl)
2845 nl->reinitNeighbor(neighbor, tid);
2846 _aux->reinitNeighbor(neighbor, tid);
2857 std::set<const Elem *> displaced_elements;
2862 for (
const auto & elem : displaced_elements)
2885 for (
auto & nl :
_nl)
2886 nl->subdomainSetup(subdomain, tid);
2900 const std::string & name,
2903#ifdef MOOSE_KOKKOS_ENABLED
2908 parallel_object_only();
2925 mooseError(
"Unrecognized function functor type");
2931 const std::string & name,
2934 parallel_object_only();
2946 const std::string class_name =
"DefaultNonlinearConvergence";
2950 params.
set<
bool>(
"added_as_default") =
true;
2958 const std::string class_name =
"DefaultMultiAppFixedPointConvergence";
2962 params.
set<
bool>(
"added_as_default") =
true;
2969 const std::string class_name =
"DefaultSteadyStateConvergence";
2973 params.
set<
bool>(
"added_as_default") =
true;
2993 std::istringstream ss(
name);
2997 if (ss >> real_value && ss.eof())
3000 params.
set<Real>(
"value") = real_value;
3001 addFunction(
"ConstantFunction", ss.str(), params);
3006 std::string
vars =
"x,y,z,t,NaN,pi,e";
3011 params.
set<std::string>(
"expression") =
name;
3019 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_function"),
3020 "getFunction() was called before Functions have been constructed. The requested "
3022 name +
"' may exist in the input file, but Functions are not available yet.");
3046 mooseError(
"The Convergence object '",
name,
"' does not exist.");
3051const std::vector<std::shared_ptr<Convergence>> &
3059 const std::string & name,
3062 parallel_object_only();
3077 mooseError(
"No MeshDivision object named ",
name,
" of appropriate type");
3090 mooseDeprecated(
"FEProblemBase::getNonlinearSystem() is deprecated, please use "
3091 "FEProblemBase::getNonlinearSystemBase() \n");
3093 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
3094 auto nl_sys = std::dynamic_pointer_cast<NonlinearSystem>(
_nl[sys_num]);
3104 const std::string & name,
3114 std::vector<Distribution *> objs;
3118 .condition<AttribName>(
name)
3120 return !objs.empty();
3126 std::vector<Distribution *> objs;
3130 .condition<AttribName>(
name)
3134 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_distribution"),
3135 "A Distribution getter was called before Distributions have been constructed. "
3136 "If you are attempting to access this object in the constructor of another object "
3137 "then make sure that the Distribution is constructed before the object using it.");
3138 mooseError(
"Unable to find Distribution with name '" +
name +
"'");
3145 const std::string & name,
3149 for (
auto & sampler : samplers)
3156 std::vector<Sampler *> objs;
3160 .condition<AttribThread>(tid)
3165 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_sampler"),
3166 "A Sampler getter was called before Samplers have been constructed. "
3167 "If you are attempting to access this object in the constructor of another object "
3168 "then make sure that the Sampler is constructed before the object using it.");
3171 "Unable to find Sampler with name '" +
name +
3172 "', if you are attempting to access this object in the constructor of another object then "
3173 "make sure that the Sampler is constructed before the object using it.");
3180 const FEType & type,
3182 const std::set<SubdomainID> *
const active_subdomains)
3184 std::set<SubdomainID> subdomainIDs;
3185 if (active_subdomains->size() == 0)
3188 subdomainIDs.insert(subdomains.begin(), subdomains.end());
3191 subdomainIDs.insert(active_subdomains->begin(), active_subdomains->end());
3197 std::string error_prefix =
"";
3200 curr_sys_ptr =
_aux.get();
3201 other_sys_ptr = sys.get();
3202 error_prefix =
"aux";
3206 mooseError(
"Cannot have an auxiliary variable and a solver variable with the same name: ",
3216 mooseError(
"Mismatching types are specified for ",
3218 "variable with name '",
3230 std::set<SubdomainID> varSubdomainIDs;
3231 if (varActiveSubdomains.size() == 0)
3234 varSubdomainIDs.insert(subdomains.begin(), subdomains.end());
3237 varSubdomainIDs.insert(varActiveSubdomains.begin(), varActiveSubdomains.end());
3241 const auto isSubset = std::includes(varSubdomainIDs.begin(),
3242 varSubdomainIDs.end(),
3243 subdomainIDs.begin(),
3244 subdomainIDs.end());
3249 const auto stringifySubdomains = [
this](std::set<SubdomainID> subdomainIDs)
3251 std::stringstream s;
3252 for (
auto const i : subdomainIDs)
3260 if (subdomainName.empty())
3263 s << subdomainName <<
" (" << i <<
")";
3268 const std::string msg =
"Mismatching block-restrictions are specified for " +
3269 error_prefix +
"variable with name '" + var_name +
"': {" +
3270 stringifySubdomains(varSubdomainIDs) +
"} and {" +
3271 stringifySubdomains(subdomainIDs) +
"}";
3286 const std::string & var_name,
3289 parallel_object_only();
3293 const auto active_subdomains_vector =
3295 const std::set<SubdomainID> active_subdomains(active_subdomains_vector.begin(),
3296 active_subdomains_vector.end());
3303 SolverSystemName sys_name = params.
get<SolverSystemName>(
"solver_sys");
3305 const auto solver_system_number =
solverSysNum(sys_name);
3306 logAdd(
"Variable", var_name, var_type, params);
3307 _solver_systems[solver_system_number]->addVariable(var_type, var_name, params);
3315std::pair<bool, unsigned int>
3317 const bool error_if_not_found)
const
3324 "If the variable is in our FEProblem solver system map, then it must be in the "
3325 "solver system we expect");
3326 else if (error_if_not_found)
3328 if (
_aux->hasVariable(var_name) ||
_aux->hasScalarVariable(var_name))
3331 " found. Did you specify an auxiliary variable when you meant to specify a "
3332 "solver variable?");
3336 "'. It does not exist in the solver system(s) or auxiliary system");
3344 const std::string & name,
3346 const unsigned int nl_sys_num,
3347 const std::string & base_name,
3348 bool & reinit_displaced)
3354 reinit_displaced =
true;
3377 const std::string & name,
3379 const std::string & base_name)
3386 if (!
parameters.
get<std::vector<BoundaryName>>(
"boundary").empty())
3413 const std::string & name,
3416#ifdef MOOSE_KOKKOS_ENABLED
3421 parallel_object_only();
3424 mooseError(
"You are trying to add a Kernel to a linear variable/system, which is not "
3425 "supported at the moment!");
3434 const std::string & name,
3437 parallel_object_only();
3440 mooseError(
"You are trying to add a HDGKernel to a linear variable/system, which is not "
3441 "supported at the moment!");
3450 const std::string & name,
3453#ifdef MOOSE_KOKKOS_ENABLED
3458 parallel_object_only();
3488 const std::string & name,
3491 parallel_object_only();
3495 mooseError(
"You are trying to add a ScalarKernel to a linear variable/system, which is not "
3496 "supported at the moment!");
3525 const std::string & name,
3528#ifdef MOOSE_KOKKOS_ENABLED
3533 parallel_object_only();
3538 "You are trying to add a BoundaryCondition to a linear variable/system, which is not "
3539 "supported at the moment!");
3548 const std::string & name,
3551 parallel_object_only();
3555 auto determine_var_param_name = [&
parameters,
this]()
3564 if (!has_secondary_var && !has_primary_var)
3566 "Either a 'secondary_variable' or 'primary_variable' parameter must be supplied for '",
3569 return has_secondary_var ?
"secondary_variable" :
"primary_variable";
3573 const auto nl_sys_num =
3576 mooseError(
"You are trying to add a Constraint to a linear variable/system, which is not "
3577 "supported at the moment!");
3601 const std::string & var_name,
3604 parallel_object_only();
3608 const auto active_subdomains_vector =
3610 const std::set<SubdomainID> active_subdomains(active_subdomains_vector.begin(),
3611 active_subdomains_vector.end());
3619 logAdd(
"AuxVariable", var_name, var_type, params);
3620 _aux->addVariable(var_type, var_name, params);
3628 const std::string & var_name,
3636 const FEType & type,
3637 const std::set<SubdomainID> *
const active_subdomains)
3639 parallel_object_only();
3641 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3646 std::string var_type;
3647 if (
type.order == CONSTANT &&
type.family == MONOMIAL && !
type.p_refinement)
3648 var_type =
"MooseVariableConstMonomial";
3649 else if (
type.family == SCALAR)
3650 var_type =
"MooseVariableScalar";
3652 var_type =
"VectorMooseVariable";
3654 var_type =
"MooseVariable";
3661 params.
set<
bool>(
"p_refinement") =
type.p_refinement;
3663 if (active_subdomains)
3665 params.set<
std::vector<SubdomainName>>(
"block").push_back(
Moose::stringify(id));
3667 logAdd(
"AuxVariable", var_name, var_type, params);
3668 _aux->addVariable(var_type, var_name, params);
3675 const FEType & type,
3676 unsigned int components,
3677 const std::set<SubdomainID> *
const active_subdomains)
3679 parallel_object_only();
3681 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3691 params.
set<
bool>(
"p_refinement") =
type.p_refinement;
3692 params.
set<
unsigned int>(
"components") = components;
3694 if (active_subdomains)
3698 logAdd(
"Variable", var_name,
"ArrayMooseVariable", params);
3699 _aux->addVariable(
"ArrayMooseVariable", var_name, params);
3708 const std::set<SubdomainID> *
const active_subdomains)
3710 parallel_object_only();
3712 mooseDeprecated(
"Please use the addAuxVariable(var_type, var_name, params) API instead");
3717 FEType
type(order, SCALAR);
3727 params.
set<std::vector<Real>>(
"scaling") = std::vector<Real>{1};
3728 if (active_subdomains)
3732 logAdd(
"ScalarVariable", var_name,
"MooseVariableScalar", params);
3733 _aux->addVariable(
"MooseVariableScalar", var_name, params);
3740 const std::string & name,
3743#ifdef MOOSE_KOKKOS_ENABLED
3748 parallel_object_only();
3757 const std::string & name,
3760 parallel_object_only();
3789 const std::string & name,
3792 parallel_object_only();
3796 mooseError(
"You are trying to add a DiracKernel to a linear variable/system, which is not "
3797 "supported at the moment!");
3829 const std::string & name,
3832 parallel_object_only();
3836 mooseError(
"You are trying to add a DGKernel to a linear variable/system, which is not "
3837 "supported at the moment!");
3869 const std::string & name,
3883 const std::string & name,
3891 const std::string & name,
3896 addObject<FVInterfaceKernel>(
3902 const std::string & name,
3905#ifdef MOOSE_KOKKOS_ENABLED
3915 const std::string & name,
3918#ifdef MOOSE_KOKKOS_ENABLED
3930 const std::string & name,
3933 parallel_object_only();
3937 mooseError(
"You are trying to add a InterfaceKernel to a linear variable/system, which is not "
3938 "supported at the moment!");
3970 const std::string & name,
3971 const VariableName & var_name)
3975 std::string restart_method =
"";
3978 "a checkpoint restart, by IC object '" + ic_name +
"' for variable '" +
name +
"'";
3984 restarted_vars.insert(restarted_vars.end(), nodal_vars.begin(), nodal_vars.end());
3985 restarted_vars.insert(restarted_vars.end(), global_vars.begin(), global_vars.end());
3987 if (std::find(restarted_vars.begin(), restarted_vars.end(), var_name) != restarted_vars.end())
3988 restart_method =
"an Exodus restart, by IC object '" + ic_name +
"' for variable '" +
name +
3989 "' that is also being restarted";
3991 if (!restart_method.empty())
3993 "Initial conditions have been specified during ",
3995 ".\nThis is only allowed if you specify 'allow_initial_conditions_with_restart' to "
3996 "the [Problem], as initial conditions can override restarted fields");
4002 const std::string & name,
4005 parallel_object_only();
4009 const std::string & var_name =
parameters.
get<VariableName>(
"variable");
4024 std::shared_ptr<InitialConditionBase> ic;
4036 mooseError(
"Your FE variable in initial condition ",
4038 " must be either of scalar or vector type");
4049 std::shared_ptr<ScalarInitialCondition> ic =
4057 "Variable '", var_name,
"' requested in initial condition '",
name,
"' does not exist.");
4062 const std::string & name,
4065 parallel_object_only();
4069 const std::string & var_name =
parameters.
get<VariableName>(
"variable");
4084 std::shared_ptr<FVInitialConditionBase> ic;
4089 "Your variable for an FVInitialCondition needs to be an a finite volume variable!");
4096 "' requested in finite volume initial condition '",
4098 "' does not exist.");
4104 TIME_SECTION(
"projectSolution", 2,
"Projecting Initial Solutions")
4113 using ElemInfoRange = StoredRange<MooseMesh::const_elem_info_iterator, const ElemInfo *>;
4121 for (
auto & nl :
_nl)
4122 nl->solution().close();
4123 _aux->solution().close();
4129 for (
auto & nl :
_nl)
4130 nl->solution().close();
4131 _aux->solution().close();
4139 for (
const auto & ic : ics)
4144 DenseVector<Number> vals(var.
order());
4147 const unsigned int n_scalar_dofs = var.
dofIndices().size();
4148 for (
unsigned int i = 0; i < n_scalar_dofs; i++)
4150 const auto global_index = var.
dofIndices()[i];
4158 bool solve_for_spline_dofs = shouldSolveForSplineDofs(
_mesh.
getMesh());
4163 if (solve_for_spline_dofs)
4164 solveForSplineDofs(*sys);
4168 _aux->solution().close();
4169 if (solve_for_spline_dofs)
4170 solveForSplineDofs(*
_aux);
4171 _aux->solution().localize(*
_aux->sys().current_local_solution,
_aux->dofMap().get_send_list());
4176 ConstElemRange & elem_range,
4178 const std::optional<std::set<VariableName>> & target_vars)
4192 for (
auto & nl :
_nl)
4193 nl->solution().close();
4194 _aux->solution().close();
4207 for (
auto & nl :
_nl)
4208 nl->solution().close();
4209 _aux->solution().close();
4217 for (
const auto & ic : ics)
4221 if (target_vars && !target_vars->count(var.
name()))
4226 DenseVector<Number> vals(var.
order());
4229 const unsigned int n_scalar_dofs = var.
dofIndices().size();
4230 for (
unsigned int i = 0; i < n_scalar_dofs; i++)
4232 const auto global_index = var.
dofIndices()[i];
4240 bool solve_for_spline_dofs = shouldSolveForSplineDofs(
_mesh.
getMesh());
4242 for (
auto & nl :
_nl)
4244 nl->solution().close();
4245 if (solve_for_spline_dofs)
4246 solveForSplineDofs(*nl);
4247 nl->solution().localize(*nl->system().current_local_solution, nl->dofMap().get_send_list());
4250 _aux->solution().close();
4251 if (solve_for_spline_dofs)
4252 solveForSplineDofs(*
_aux);
4253 _aux->solution().localize(*
_aux->sys().current_local_solution,
_aux->dofMap().get_send_list());
4258 Number (*func)(
const Point &,
4260 const std::string &,
4261 const std::string &),
4262 Gradient (*func_grad)(
const Point &,
4264 const std::string &,
4265 const std::string &),
4267 const std::vector<VariableName> & target_vars)
4270 "We're performing a projection based on data from just the thread 0 variable, so any "
4271 "modifications to the variable solution must have been thread joined already");
4273 std::unordered_map<unsigned int, std::vector<unsigned int>> sys_to_var_nums;
4275 for (
const auto & target_var : target_vars)
4279 sys_to_var_nums[sn].push_back(var.number());
4282 for (
const auto & [sys_num, var_nums] : sys_to_var_nums)
4285 libmesh_sys.
project_solution(func, func_grad, params, elem_range, var_nums);
4289std::shared_ptr<MaterialBase>
4298 name +=
"_neighbor";
4311 "), but its compute flag is set to true. This indicates that MOOSE is "
4312 "computing this property which may not be desired and produce un-expected "
4341 mooseError(
"FEProblemBase::getMaterialData(): Invalid MaterialDataType ",
type);
4344const std::set<const MooseObject *> &
4359 mooseError(
"FEProblemBase::getMaterialPropertyStorageConsumers(): Invalid MaterialDataType ",
4368 "ignore_zeros_in_jacobian",
4369 "We likely cannot preserve the sparsity pattern if ignoring zeros in the Jacobian, which "
4370 "leads to removing those entries from the Jacobian sparsity pattern");
4383 const std::string & name,
4386 parallel_object_only();
4388 auto add_functor_materials = [&](
const auto &
parameters,
const auto &
name)
4393 std::shared_ptr<MaterialBase> material =
4407 add_functor_materials(disp_params,
name +
"_displaced");
4413 const std::string & name,
4416#ifdef MOOSE_KOKKOS_ENABLED
4426 const std::string & name,
4434 const std::string & mat_name,
4435 const std::string & name,
4438 parallel_object_only();
4462#ifdef MOOSE_KOKKOS_ENABLED
4467 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
4470 std::shared_ptr<MaterialBase> material =
4473 bool discrete = !material->getParam<
bool>(
"compute");
4477 if (material->boundaryRestricted() ||
dynamic_cast<FunctorMaterial *
>(material.get()))
4483 for (
auto && warehouse : warehouses)
4484 warehouse->addObject(material, tid);
4496 std::string object_name;
4505 object_name =
name +
"_face";
4506 std::shared_ptr<MaterialBase> face_material =
4512 current_parameters.
set<
bool>(
"_neighbor") =
true;
4513 object_name =
name +
"_neighbor";
4514 std::shared_ptr<MaterialBase> neighbor_material =
4523 for (
auto && warehouse : warehouses)
4524 warehouse->addObjects(material, neighbor_material, face_material, tid);
4529 const auto param_names =
4534 for (
const auto & p_name : param_names)
4537 p_name.parameter());
4539 p_name.parameter());
4541 p_name.parameter());
4543 primary_name, face_name,
false);
4545 primary_name, neighbor_name,
false);
4556 std::set<MooseVariableFEBase *> needed_moose_vars;
4557 std::unordered_set<unsigned int> needed_mat_props;
4566 for (
const auto id : ids)
4573 needed_moose_vars.insert(current_active_elemental_moose_variables.begin(),
4574 current_active_elemental_moose_variables.end());
4576 needed_mat_props.insert(consumer_needed_mat_props.begin(), consumer_needed_mat_props.end());
4587 auto && elem =
_assembly[tid][0]->elem();
4588 unsigned int n_points =
_assembly[tid][0]->qRule()->n_points();
4591 material_data.
resize(n_points);
4595 material_data.swap(*elem);
4608 const bool swap_stateful,
4609 const std::deque<MaterialBase *> *
const reinit_mats)
4615 auto && elem =
_assembly[tid][0]->elem();
4616 unsigned int side =
_assembly[tid][0]->side();
4617 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4620 bnd_material_data.
resize(n_points);
4622 if (swap_stateful && !bnd_material_data.isSwapped())
4623 bnd_material_data.swap(*elem, side);
4626 bnd_material_data.reset(
4630 bnd_material_data.reinit(*reinit_mats);
4632 bnd_material_data.reinit(
4641 const bool swap_stateful,
4642 const std::deque<MaterialBase *> *
const reinit_mats)
4648 const auto *
const elem =
_assembly[tid][0]->elem();
4649 unsigned int side =
_assembly[tid][0]->side();
4650 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4653 bnd_material_data.
resize(n_points);
4655 if (swap_stateful && !bnd_material_data.isSwapped())
4656 bnd_material_data.swap(*elem, side);
4659 bnd_material_data.reset(
4663 bnd_material_data.reinit(*reinit_mats);
4665 bnd_material_data.reinit(
4675 const bool swap_stateful,
4676 const std::deque<MaterialBase *> *
const reinit_mats)
4690 const bool swap_stateful,
4691 const std::deque<MaterialBase *> *
const reinit_mats)
4698 const Elem * neighbor =
_assembly[tid][0]->neighbor();
4699 unsigned int neighbor_side = neighbor->which_neighbor_am_i(
_assembly[tid][0]->elem());
4701 mooseAssert(neighbor,
"neighbor should be non-null");
4702 mooseAssert(blk_id == neighbor->subdomain_id(),
4703 "The provided blk_id " << blk_id <<
" and neighbor subdomain ID "
4704 << neighbor->subdomain_id() <<
" do not match.");
4706 unsigned int n_points =
_assembly[tid][0]->qRuleNeighbor()->n_points();
4709 neighbor_material_data.
resize(n_points);
4713 neighbor_material_data.swap(*neighbor, neighbor_side);
4716 neighbor_material_data.reset(
4720 neighbor_material_data.reinit(*reinit_mats);
4722 neighbor_material_data.reinit(
4730 const bool swap_stateful,
4731 const std::deque<MaterialBase *> *
const reinit_mats)
4735 auto && elem =
_assembly[tid][0]->elem();
4736 unsigned int side =
_assembly[tid][0]->side();
4737 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4740 bnd_material_data.
resize(n_points);
4742 if (swap_stateful && !bnd_material_data.isSwapped())
4743 bnd_material_data.swap(*elem, side);
4749 bnd_material_data.reinit(*reinit_mats);
4762 const Elem *
const & elem =
_assembly[tid][0]->elem();
4763 unsigned int side =
_assembly[tid][0]->side();
4764 unsigned int n_points =
_assembly[tid][0]->qRuleFace()->n_points();
4767 bnd_material_data.
resize(n_points);
4769 if (swap_stateful && !bnd_material_data.isSwapped())
4770 bnd_material_data.swap(*elem, side);
4780 auto && elem =
_assembly[tid][0]->elem();
4787 auto && elem =
_assembly[tid][0]->elem();
4788 unsigned int side =
_assembly[tid][0]->side();
4796 const Elem * neighbor =
_assembly[tid][0]->neighbor();
4797 unsigned int neighbor_side =
4811 neighbor_side =
_assembly[tid][0]->side();
4812 mooseAssert(neighbor,
"We should have an appropriate value for elem coming from Assembly");
4823 const std::string & name,
4824 const std::string & type,
4828 _console <<
"[DBG] Adding " << system <<
" '" <<
name <<
"' of type " <<
type << std::endl;
4835 const std::string & object_name,
4836 const std::string & var_param_name)
4842 unsigned int sys_num = 0;
4851 const auto var_sys_num = sys_num;
4854 mooseError(
"We dont support setting 'variable' to a variable that is not set to the same "
4855 "system as the 'solver_sys' parameter");
4862 if (sys_num ==
_aux->number())
4878 if (sys_num ==
_aux->number())
4887 const std::string & type)
const
4892 " already exists. You may not add a ",
4894 " by the same name.");
4896#ifdef MOOSE_KOKKOS_ENABLED
4900 " already exists. You may not add a ",
4902 " by the same name.");
4908 const std::string & name,
4911#ifdef MOOSE_KOKKOS_ENABLED
4923 const std::string & name,
4926#ifdef MOOSE_KOKKOS_ENABLED
4938 const std::string & name,
4941#ifdef MOOSE_KOKKOS_ENABLED
4951std::vector<std::shared_ptr<UserObject>>
4953 const std::string & name,
4956#ifdef MOOSE_KOKKOS_ENABLED
4964 parallel_object_only();
4966 std::vector<std::shared_ptr<UserObject>> uos;
4971 for (
const auto tid : make_range(
numThreads()))
4974 std::shared_ptr<UserObject> user_object =
4977 uos.push_back(user_object);
4980 user_object->setPrimaryThreadCopy(uos[0].get());
4985 auto euo = std::dynamic_pointer_cast<ElementUserObject>(user_object);
4986 auto suo = std::dynamic_pointer_cast<SideUserObject>(user_object);
4987 auto isuo = std::dynamic_pointer_cast<InternalSideUserObject>(user_object);
4988 auto iuo = std::dynamic_pointer_cast<InterfaceUserObjectBase>(user_object);
4989 auto nuo = std::dynamic_pointer_cast<NodalUserObject>(user_object);
4990 auto duo = std::dynamic_pointer_cast<DomainUserObject>(user_object);
4991 auto guo = std::dynamic_pointer_cast<GeneralUserObject>(user_object);
4992 auto tguo = std::dynamic_pointer_cast<ThreadedGeneralUserObject>(user_object);
4993 auto muo = std::dynamic_pointer_cast<MortarUserObject>(user_object);
5006 if (euo || nuo || duo)
5008 if (suo || duo || isuo || iuo)
5010 if (iuo || duo || isuo)
5015 if ((guo && !tguo) || muo)
5022 for (
const auto tid : make_range(
numThreads()))
5024 const decltype(uos)::size_type uo_index = uos.front()->needThreadedCopy() ? tid : 0;
5038 const std::string & name,
5041 parallel_object_only();
5045 for (
const auto tid : make_range(
numThreads()))
5055 const std::string & name,
5058 parallel_object_only();
5073 std::vector<UserObject *> objs;
5077 .condition<AttribThread>(tid)
5082 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_user_object"),
5083 "A UserObject getter was called before UserObjects have been constructed. The "
5084 "requested UserObject '" +
5085 name +
"' may exist in the input file, but UserObjects are not available yet.");
5087 mooseError(
"Unable to find user object with name '" +
name +
"'");
5089 mooseAssert(objs.size() == 1,
"Should only find one UO");
5096 std::vector<Positions *> objs;
5100 .condition<AttribName>(
name)
5103 mooseError(
"Unable to find Positions object with name '" +
name +
"'");
5104 mooseAssert(objs.size() == 1,
"Should only find one Positions");
5111 std::vector<UserObject *> objs;
5115 .condition<AttribThread>(0)
5118 return !objs.empty();
5124 std::vector<FVGradientMethod *> methods;
5128 .condition<AttribThread>(tid)
5130 .queryInto(methods);
5132 if (methods.empty())
5133 mooseError(
"Unable to find FVGradientMethod with name '",
name,
"'");
5135 mooseAssert(methods.size() == 1,
"Expected a single FVGradientMethod per thread");
5136 return *(methods[0]);
5149 std::vector<FVGradientMethod *> methods;
5153 .condition<AttribThread>(0)
5155 .queryInto(methods);
5156 return !methods.empty();
5163 std::vector<FVInterpolationMethod *> methods;
5167 .condition<AttribThread>(tid)
5169 .queryInto(methods);
5171 if (methods.empty())
5173 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_interpolation_method"),
5174 "An FVInterpolationMethod getter was called before FVInterpolationMethods have "
5175 "been constructed. If you are attempting to access this object in the constructor "
5176 "of another object then make sure that the FVInterpolationMethod is constructed "
5177 "before the object using it.");
5179 mooseError(
"Unable to find FVInterpolationMethod with name '",
name,
"'");
5182 mooseAssert(methods.size() == 1,
"Expected a single FVInterpolationMethod per thread");
5183 return *(methods[0]);
5198 ") is not a scalar face interpolation method.");
5200 return *face_method;
5210 if (!advected_method)
5215 ") is not an advected interpolation method.");
5217 return *advected_method;
5223 std::vector<FVInterpolationMethod *> methods;
5227 .condition<AttribThread>(0)
5229 .queryInto(methods);
5230 return !methods.empty();
5243 std::vector<Postprocessor *> objs;
5247 .condition<AttribThread>(tid)
5252 mooseError(
"Unable to find Postprocessor with name '", object_name,
"'");
5253 mooseAssert(objs.size() == 1,
5254 "We shouldn't find more than one postprocessor object for a given name");
5260 std::size_t t_index)
const
5269 std::size_t t_index)
5278 mooseDeprecated(
"FEProblemBase::hasPostprocssor is being removed; use "
5279 "hasPostprocessorValueByName instead.");
5285 const std::string & vector_name,
5286 std::size_t t_index)
const
5294 const std::string & vector_name,
5296 std::size_t t_index)
5306 std::vector<VectorPostprocessor *> objs;
5310 .condition<AttribThread>(tid)
5317 getMooseApp().actionWarehouse().isTaskComplete(
"add_vector_postprocessor"),
5318 "A VectorPostprocessor getter was called before VectorPostprocessors have been "
5319 "constructed. The requested VectorPostprocessor '" +
5321 "' may exist in the input file, but VectorPostprocessors are not available yet.");
5323 mooseError(
"Unable to find VectorPostprocessor with name '", object_name,
"'");
5325 mooseAssert(objs.size() == 1,
5326 "We shouldn't find more than one vector postprocessor object for a given name");
5335 const auto & objects = it.second.getActiveObjects();
5336 for (
const auto & obj : objects)
5337 obj->parentOutputPositionChanged();
5354 TIME_SECTION(
"computeIndicators", 1,
"Computing Indicators");
5358 const auto old_do_derivatives = ADReal::do_derivatives;
5359 ADReal::do_derivatives =
false;
5361 std::vector<std::string> fields;
5365 for (
const auto & indicator : indicators)
5366 fields.push_back(indicator->name());
5370 for (
const auto & internal_indicator : internal_indicators)
5371 fields.push_back(internal_indicator->name());
5373 _aux->zeroVariables(fields);
5378 _aux->solution().close();
5383 _aux->solution().close();
5386 ADReal::do_derivatives = old_do_derivatives;
5395 TIME_SECTION(
"computeMarkers", 1,
"Computing Markers");
5397 std::vector<std::string> fields;
5401 for (
const auto & marker : markers)
5402 fields.push_back(marker->name());
5404 _aux->zeroVariables(fields);
5411 for (
const auto & marker : markers)
5412 marker->markerSetup();
5418 _aux->solution().close();
5449 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
5455#ifdef MOOSE_KOKKOS_ENABLED
5459 _aux->customSetup(exec_type);
5460 for (
auto & nl :
_nl)
5461 nl->customSetup(exec_type);
5466 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
5473 std::vector<UserObject *> userobjs;
5475 for (
auto obj : userobjs)
5476 obj->customSetup(exec_type);
5478#ifdef MOOSE_KOKKOS_ENABLED
5480 std::vector<UserObjectBase *> userobjs;
5482 for (
auto obj : userobjs)
5483 obj->customSetup(exec_type);
5531 std::unique_ptr<NumericVector<Number>> x =
_aux->currentSolution()->clone();
5539 const Real check_tol = 1e-8;
5541 const Real xnorm = x->l2_norm();
5542 *x -= *
_aux->currentSolution();
5543 if (x->l2_norm() > check_tol * xnorm)
5547 std::multimap<Real, std::string, std::greater<Real>> ordered_map;
5548 for (
const auto i : make_range(
n_vars))
5554 std::ostringstream oss;
5555 for (
const auto & [error_norm, var_name] : ordered_map)
5556 oss <<
" {" << var_name <<
", " << error_norm <<
"},\n";
5558 mooseError(
"Aux kernels, user objects appear to have states for aux variables on ",
5560 ".\nVariable error norms in descending order:\n",
5565 if (pp_values.size() != new_pp_values.size())
5566 mooseError(
"Second execution for uo/aux state check should not change the number of "
5567 "real reporter values");
5569 const Real ppnorm = pp_values.l2_norm();
5570 pp_values -= new_pp_values;
5571 if (pp_values.l2_norm() > check_tol * ppnorm)
5574 std::multimap<Real, std::string, std::greater<Real>> ordered_map;
5575 for (
const auto i : index_range(pp_names))
5576 ordered_map.emplace(std::abs(pp_values(i)), pp_names[i]);
5578 std::ostringstream oss;
5579 for (
const auto & [error_norm, pp_name] : ordered_map)
5580 oss <<
" {" << pp_name <<
", " << error_norm <<
"},\n";
5582 mooseError(
"Aux kernels, user objects appear to have states for real reporter values on ",
5584 ".\nErrors of real reporter values in descending order:\n",
5594 std::vector<UserObject *> objs;
5595 query.queryInto(objs);
5607 for (
auto obj : objs)
5608 if (obj->primaryThreadCopy())
5609 obj->primaryThreadCopy()->threadJoin(*obj);
5617 for (
auto obj : objs)
5625 _console <<
"[DBG] Initializing, executing & finalizing general UO '" << obj->name()
5658 auto reporter =
dynamic_cast<Reporter *
>(obj);
5686 std::set<int> & execution_groups)
const
5688 std::vector<UserObjectBase *> uos;
5689 query.queryIntoUnsorted(uos);
5690 for (
const auto & uo : uos)
5691 execution_groups.insert(uo->getParam<
int>(
"execution_order_group"));
5697 const std::string & name)
5702 std::set<int> execution_groups;
5704#ifdef MOOSE_KOKKOS_ENABLED
5713 for (
const auto execution_group : execution_groups)
5715#ifdef MOOSE_KOKKOS_ENABLED
5730 std::set<int> execution_groups;
5732#ifdef MOOSE_KOKKOS_ENABLED
5740 for (
const auto execution_group : execution_groups)
5742#ifdef MOOSE_KOKKOS_ENABLED
5762 TIME_SECTION(
"computeUserObjects", 1,
"Computing User Objects");
5764 std::vector<GeneralUserObject *> genobjs;
5767 std::vector<UserObject *> userobjs;
5772 .queryInto(userobjs);
5774 std::vector<UserObject *> tgobjs;
5779 std::vector<UserObject *> nodal;
5782 std::vector<MortarUserObject *> mortar;
5785 if (userobjs.empty() && genobjs.empty() && tgobjs.empty() && nodal.empty() && mortar.empty())
5801 for (
auto obj : userobjs)
5802 obj->residualSetup();
5803 for (
auto obj : nodal)
5804 obj->residualSetup();
5805 for (
auto obj : mortar)
5806 obj->residualSetup();
5807 for (
auto obj : tgobjs)
5808 obj->residualSetup();
5809 for (
auto obj : genobjs)
5810 obj->residualSetup();
5814 for (
auto obj : userobjs)
5815 obj->jacobianSetup();
5816 for (
auto obj : nodal)
5817 obj->jacobianSetup();
5818 for (
auto obj : mortar)
5819 obj->jacobianSetup();
5820 for (
auto obj : tgobjs)
5821 obj->jacobianSetup();
5822 for (
auto obj : genobjs)
5823 obj->jacobianSetup();
5826 for (
auto obj : userobjs)
5830 if (!userobjs.empty())
5841 if (!userobjs.empty())
5853 for (
const auto & uo : userobjs)
5857 _aux->solution().close();
5858 _aux->system().update();
5871 for (
auto obj : nodal)
5881 for (
const auto & uo : nodal)
5885 _aux->solution().close();
5886 _aux->system().update();
5891 if (!mortar.empty())
5894 [
this,
type, &mortar]()
5896 for (
auto obj : mortar)
5899 auto create_and_run_mortar_functors = [
this,
type, &mortar](
const bool displaced)
5903 for (
const auto & [primary_secondary_boundary_pair, interface_config] :
5906 auto mortar_uos_to_execute =
5908 primary_secondary_boundary_pair.second,
5912 auto *
const subproblem = displaced ? cast_ptr<SubProblem *>(
_displaced_problem.get())
5913 : cast_ptr<SubProblem *>(
this);
5915 *interface_config.amg,
5919 subproblem->assembly(0, 0));
5925 create_and_run_mortar_functors(
false);
5927 create_and_run_mortar_functors(
true);
5934 for (
auto obj : mortar)
5941 if (!tgobjs.empty())
5946 for (
auto obj : tgobjs)
5951 std::vector<GeneralUserObject *> tguos_zero;
5955 .queryInto(tguos_zero);
5956 for (
auto obj : tguos_zero)
5958 std::vector<GeneralUserObject *> tguos;
5959 auto q =
query.clone()
5989 TIME_SECTION(
"executeControls", 1,
"Executing Controls");
5995 for (
const auto & it : controls_wh.getActiveObjects())
6000 std::vector<std::string> & dependent_controls = it->getDependencies();
6001 for (
const auto & depend_name : dependent_controls)
6003 if (controls_wh.hasActiveObject(depend_name))
6005 auto dep_control = controls_wh.getActiveObject(depend_name);
6006 resolver.
addEdge(dep_control, it);
6011 "\" was not created, did you make a "
6012 "spelling mistake or forget to include it "
6013 "in your input file?");
6019 if (!ordered_controls.empty())
6026 for (
const auto & control : ordered_controls)
6039 std::vector<Sampler *> objects;
6043 .condition<AttribThread>(tid)
6045 .queryInto(objects);
6047 if (!objects.empty())
6049 TIME_SECTION(
"executeSamplers", 1,
"Executing Samplers");
6050 FEProblemBase::objectSetupHelper<Sampler>(objects, exec_type);
6051 FEProblemBase::objectExecuteHelper<Sampler>(objects);
6059 TIME_SECTION(
"updateActiveObjects", 5,
"Updating Active Objects");
6063 for (
auto & nl :
_nl)
6064 nl->updateActive(tid);
6065 _aux->updateActive(tid);
6082#ifdef MOOSE_KOKKOS_ENABLED
6096 TIME_SECTION(
"reinitBecauseOfGhostingOrNewGeomObjects",
6098 "Reinitializing Because of Geometric Search Objects");
6107 (
_mortar_data->hasDisplacedObjects() && mortar_changed)));
6122 const std::string & name,
6125 parallel_object_only();
6127 const auto nl_sys_num =
6133 mooseError(
"You are trying to add a DGKernel to a linear variable/system, which is not "
6134 "supported at the moment!");
6147 for (
auto & nl :
_nl)
6153 const std::string & name,
6156 parallel_object_only();
6182 std::shared_ptr<Indicator> indicator =
6185 std::shared_ptr<InternalSideIndicatorBase> isi =
6186 std::dynamic_pointer_cast<InternalSideIndicatorBase>(indicator);
6196 const std::string & name,
6199 parallel_object_only();
6233 const std::string & name,
6236 parallel_object_only();
6264 multi_app->possiblyCreateChildApplications();
6269 std::shared_ptr<TransientMultiApp> trans_multi_app =
6270 std::dynamic_pointer_cast<TransientMultiApp>(multi_app);
6271 if (trans_multi_app)
6287std::shared_ptr<MultiApp>
6291 mooseAssert(
getMooseApp().actionWarehouse().isTaskComplete(
"add_multi_app"),
6292 "A MultiApp getter was called before MultiApps have been constructed. "
6293 "If you are attempting to access this object in the constructor of another object "
6294 "then make sure that the MultiApp is constructed before the object using it.");
6302 const MultiAppName & source_app)
6305 bool is_executing_a_transfer =
false;
6310 std::string string_direction;
6311 std::string additional_source_info =
"";
6313 string_direction =
" To ";
6314 else if (from_multiapp)
6315 string_direction =
" From ";
6317 string_direction =
" Between ";
6318 if (!source_app.empty())
6319 additional_source_info =
" from app '" + source_app +
"'";
6322 auto executeThisTransfer = [
this, &direction, &source_app, &
type](
auto & transfer)
6324 mooseAssert(transfer->getExecuteOnEnum().contains(
type),
"Should execute on this schedule");
6330 if (transfer->getFromName() == source_app && transfer->executeAfterSiblingSourceApp())
6332 libmesh_ignore(
this);
6333 mooseAssert(this->
getMultiApp(transfer->getFromName())->getExecuteOnEnum().contains(
type),
6334 "from_multiapp should also execute on this schedule");
6340 if ((source_app.empty() && (!transfer->executeAfterSiblingSourceApp() ||
6341 !transfer->getFromMultiApp()->getExecuteOnEnum().contains(
type))) ||
6342 (transfer->getFromName() == source_app && transfer->executeAfterSiblingSourceApp()))
6353 TIME_SECTION(
"execMultiAppTransfers", 1,
"Executing Transfers");
6360 {
"Name",
"Type",
"From",
"To"});
6363 for (
const auto & transfer : transfers)
6368 if (!executeThisTransfer(multiapp_transfer))
6371 is_executing_a_transfer =
true;
6372 table.addRow(multiapp_transfer->name(),
6373 multiapp_transfer->type(),
6374 multiapp_transfer->getFromName(),
6375 multiapp_transfer->getToName());
6379 if (is_executing_a_transfer)
6382 <<
"MultiApps" << additional_source_info << COLOR_DEFAULT <<
":" << std::endl;
6388 for (
const auto & transfer : transfers)
6390 auto multiapp_transfer = libMesh::cast_ptr<MultiAppTransfer *>(transfer.get());
6391 if (!executeThisTransfer(multiapp_transfer))
6394 transfer->setCurrentDirection(direction);
6395 transfer->execute();
6402 << COLOR_DEFAULT << std::endl;
6408 << COLOR_DEFAULT << std::endl;
6411std::vector<std::shared_ptr<Transfer>>
6422std::vector<std::shared_ptr<Transfer>>
6452 std::map<unsigned int, std::vector<std::shared_ptr<MultiApp>>> groups;
6454 if (multi_app->usingPositions())
6455 groups[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(multi_app);
6463 std::map<unsigned int, std::vector<std::shared_ptr<MultiApp>>> check_groups;
6465 check_groups[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(multi_app);
6466 for (
const auto & [group_id, group] : check_groups)
6467 for (
const auto & multi_app : group)
6468 if (group.size() > 1 && !multi_app->usingPositions())
6469 multi_app->paramError(
6470 "execution_order_group",
6471 "This MultiApp must be placed in its own execution order group as concurrent execution "
6472 "has not been implemented for this type of app at this time");
6477 for (
const auto & [group_id, group] : groups)
6480 if (group.size() < 2)
6487 std::vector<processor_id_type>
count(group.size());
6488 std::vector<processor_id_type> caps(group.size());
6489 std::vector<processor_id_type> mins(group.size());
6490 std::vector<processor_id_type> maxs(group.size());
6491 processor_id_type min_total = 0;
6492 for (
const auto m : index_range(group))
6495 mins[m] = group[m]->getParam<processor_id_type>(
"min_procs_per_app");
6496 maxs[m] = group[m]->getParam<processor_id_type>(
"max_procs_per_app");
6497 const auto n_apps_m = cast_int<processor_id_type>(group[m]->numGlobalApps());
6498 caps[m] = (maxs[m] >= n_procs) ? n_procs : std::min(n_procs, n_apps_m * maxs[m]);
6500 min_total += mins[m];
6503 if (min_total > n_procs)
6504 mooseError(
"Not enough MPI ranks to run the ",
6506 " multiapps of 'execution_order_group' ",
6508 " concurrently: they need at least ",
6510 " ranks (from 'min_procs_per_app') but only ",
6512 " are available. Reduce the number of concurrent multiapps, lower "
6513 "'min_procs_per_app', or run with more processors.");
6516 processor_id_type remaining = n_procs - min_total;
6517 bool progress =
true;
6518 while (remaining > 0 && progress)
6521 for (
const auto m : index_range(group))
6522 if (remaining > 0 &&
count[m] < caps[m])
6533 processor_id_type offset = 0;
6534 for (
const auto m : index_range(group))
6537 if (my_rank >= offset && my_rank < offset +
count[m])
6539 my_rank - offset,
count[m], group[m]->numGlobalApps(), mins[m], maxs[m],
false);
6540 group[m]->init(group[m]->numGlobalApps(), cfg);
6550 const std::vector<MooseSharedPointer<MultiApp>> & multi_apps =
6554 for (
const auto & multi_app : multi_apps)
6555 multi_app->preTransfer(
_dt,
_time);
6568 std::map<unsigned int, std::vector<MooseSharedPointer<MultiApp>>> ordered_multi_apps;
6570 for (
const auto & multi_app : multi_apps)
6571 ordered_multi_apps[multi_app->getParam<
unsigned int>(
"execution_order_group")].push_back(
6577 bool has_concurrent_apps =
false;
6578 for (
const auto & [group, multi_app_group] : ordered_multi_apps)
6579 if (multi_app_group.size() > 1)
6580 has_concurrent_apps =
true;
6581 if (!has_concurrent_apps)
6583 "num_concurrent_multiapps",
6584 "Due to the specified multiapp execution groups, or differences in execution schedules, "
6585 "concurrent multiapps are not actually used on " +
6590 if (multi_apps.size())
6592 TIME_SECTION(
"execMultiApps", 1,
"Executing MultiApps",
false);
6596 << COLOR_DEFAULT << std::endl;
6598 bool success =
true;
6600 for (
const auto & [group_id, multi_app_group] : ordered_multi_apps)
6602 bool group_success =
true;
6605 << COLOR_DEFAULT << std::endl;
6610 _console << COLOR_CYAN <<
"\nConcurrent MultiApps: " << std::endl;
6611 for (
const auto & multi_app : multi_app_group)
6612 _console << multi_app->name() <<
" ";
6613 _console << COLOR_DEFAULT << std::endl;
6622 for (
const auto & multi_app : multi_app_group)
6623 if (!multi_app->solveStep(
_dt,
_time, auto_advance))
6624 group_success =
false;
6638 for (
const auto & multi_app : multi_app_group)
6651 << COLOR_DEFAULT << std::endl;
6666 for (
const auto & multi_app : multi_apps)
6667 multi_app->finalize();
6675 for (
const auto & multi_app : multi_apps)
6676 multi_app->postExecute();
6684 if (multi_apps.size())
6685 for (
const auto & multi_app : multi_apps)
6686 multi_app->incrementTStep(
_time);
6694 if (multi_apps.size())
6697 _console << COLOR_CYAN <<
"\nAdvancing MultiApps on " <<
type.name() << COLOR_DEFAULT
6700 for (
const auto & multi_app : multi_apps)
6701 multi_app->finishStep(recurse_through_multiapp_levels);
6706 _console << COLOR_CYAN <<
"Finished Advancing MultiApps on " <<
type.name() <<
"\n"
6707 << COLOR_DEFAULT << std::endl;
6716 if (multi_apps.size())
6718 TIME_SECTION(
"backupMultiApps", 5,
"Backing Up MultiApp");
6721 _console << COLOR_CYAN <<
"\nBacking Up MultiApps on " <<
type.name() << COLOR_DEFAULT
6724 for (
const auto & multi_app : multi_apps)
6725 multi_app->backup();
6730 _console << COLOR_CYAN <<
"Finished Backing Up MultiApps on " <<
type.name() <<
"\n"
6731 << COLOR_DEFAULT << std::endl;
6740 if (multi_apps.size())
6745 _console << COLOR_CYAN <<
"\nRestoring Multiapps on " <<
type.name()
6746 <<
" because of solve failure!" << COLOR_DEFAULT << std::endl;
6748 _console << COLOR_CYAN <<
"\nRestoring MultiApps on " <<
type.name() << COLOR_DEFAULT
6752 for (
const auto & multi_app : multi_apps)
6753 multi_app->restore(force);
6758 _console << COLOR_CYAN <<
"Finished Restoring MultiApps on " <<
type.name() <<
"\n"
6759 << COLOR_DEFAULT << std::endl;
6768 Real smallest_dt = std::numeric_limits<Real>::max();
6770 for (
const auto & multi_app : multi_apps)
6771 smallest_dt = std::min(smallest_dt, multi_app->computeDT());
6778 const std::string & name,
6781 parallel_object_only();
6812 std::shared_ptr<MultiApp> multiapp;
6825 exec_enum = multiapp->getParam<
ExecFlagEnum>(
"execute_on");
6833 std::shared_ptr<MultiAppTransfer> multi_app_transfer =
6834 std::dynamic_pointer_cast<MultiAppTransfer>(transfer);
6835 if (multi_app_transfer)
6852 if (sys->hasVariable(var_name))
6854 if (
_aux->hasVariable(var_name))
6864 if (sys->hasVariable(var_name))
6872 const std::string & var_name,
6884 if (sys->hasVariable(var_name))
6885 return sys->getFieldVariable<Real>(tid, var_name);
6886 if (
_aux->hasVariable(var_name))
6887 return _aux->getFieldVariable<Real>(tid, var_name);
6896 if (sys->hasVariable(var_name))
6897 return sys->getActualFieldVariable<Real>(tid, var_name);
6898 if (
_aux->hasVariable(var_name))
6899 return _aux->getActualFieldVariable<Real>(tid, var_name);
6908 if (sys->hasVariable(var_name))
6909 return sys->getFieldVariable<RealVectorValue>(tid, var_name);
6910 if (
_aux->hasVariable(var_name))
6911 return _aux->getFieldVariable<RealVectorValue>(tid, var_name);
6920 if (sys->hasVariable(var_name))
6921 return sys->getFieldVariable<RealEigenVector>(tid, var_name);
6922 if (
_aux->hasVariable(var_name))
6923 return _aux->getFieldVariable<RealEigenVector>(tid, var_name);
6932 if (sys->hasScalarVariable(var_name))
6934 if (
_aux->hasScalarVariable(var_name))
6944 if (sys->hasScalarVariable(var_name))
6945 return sys->getScalarVariable(tid, var_name);
6946 if (
_aux->hasScalarVariable(var_name))
6947 return _aux->getScalarVariable(tid, var_name);
6958 else if (
_aux->hasVariable(var_name) ||
_aux->hasScalarVariable(var_name))
6959 return _aux->system();
6961 mooseError(
"Unable to find a system containing the variable " + var_name);
7069 mat->setActiveProperties(mat_prop_ids);
7071 mat->setActiveProperties(mat_prop_ids);
7073 mat->setActiveProperties(mat_prop_ids);
7093#ifdef LIBMESH_ENABLE_AMR
7103 const std::string & redistributer_name,
7104 const bool use_displaced_mesh)
7108 redistribute_params.
set<std::string>(
"for_whom") = this->
name();
7112 redistribute_params.
set<
bool>(
"use_displaced_mesh") = use_displaced_mesh;
7115 std::shared_ptr<RedistributeProperties> redistributer =
7117 "RedistributeProperties", redistributer_name, redistribute_params);
7128 mesh.
getMesh().add_ghosting_functor(redistributer);
7131 add_redistributer(
_mesh,
"mesh_property_redistributer",
false);
7133 add_redistributer(
_displaced_problem->mesh(),
"displaced_mesh_property_redistributer",
true);
7155 mooseError(
"Max quadrature points per element assumptions made in some code (e.g. Coupleable ",
7156 "and MaterialPropertyInterface classes) have been violated.\n",
7157 "Complain to Moose developers to have constMaxQpsPerElem increased from ",
7161 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7165 _zero[tid].resize(max_qpts, 0);
7167 _grad_zero[tid].resize(max_qpts, RealGradient(0.));
7179 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7180 for (
const auto i : index_range(
_nl))
7192 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7193 for (
const auto i : index_range(
_nl))
7208 const bool allow_negative_qweights)
7210 if (order == INVALID_ORDER)
7214 for (
const auto i : make_range(std::size_t(1),
_solver_systems.size()))
7217 if (order < _aux->getMinQuadratureOrder())
7218 order =
_aux->getMinQuadratureOrder();
7221 if (volume_order == INVALID_ORDER)
7222 volume_order = order;
7224 if (face_order == INVALID_ORDER)
7227 for (
unsigned int tid = 0; tid <
numThreads(); ++tid)
7230 type, order, volume_order, face_order, block, allow_negative_qweights);
7234 type, order, volume_order, face_order, block, allow_negative_qweights);
7245 mooseError(
"Someone told us (the FEProblemBase) to trust the user coupling matrix, but we "
7246 "haven't been provided a coupling matrix!");
7267 _cm[i] = std::move(cm);
7274 mooseError(
"Someone told us (the FEProblemBase) to trust the user coupling matrix, but we "
7275 "haven't been provided a coupling matrix!");
7283 TIME_SECTION(
"setNonlocalCouplingMatrix", 5,
"Setting Nonlocal Coupling Matrix");
7286 mooseError(
"Nonlocal kernels are weirdly stored on the FEProblem so we don't currently support "
7287 "multiple nonlinear systems with nonlocal kernels.");
7289 for (
const auto nl_sys_num : index_range(
_nl))
7291 auto & nl =
_nl[nl_sys_num];
7293 unsigned int n_vars = nl->nVariables();
7294 nonlocal_cm.resize(
n_vars);
7295 const auto &
vars = nl->getVariables(0);
7298 for (
const auto & ivar :
vars)
7300 for (
const auto & kernel : nonlocal_kernel)
7302 for (
unsigned int i = ivar->number(); i < ivar->number() + ivar->count(); ++i)
7303 if (i == kernel->variable().number())
7304 for (
const auto & jvar :
vars)
7309 unsigned int j = jvar->number();
7310 nonlocal_cm(i, j) = 1;
7314 for (
const auto & integrated_bc : nonlocal_integrated_bc)
7316 for (
unsigned int i = ivar->number(); i < ivar->number() + ivar->count(); ++i)
7317 if (i == integrated_bc->variable().number())
7318 for (
const auto & jvar :
vars)
7323 unsigned int j = jvar->number();
7324 nonlocal_cm(i, j) = 1;
7334 const unsigned int jvar,
7335 const unsigned int nl_sys)
const
7337 return (*
_cm[nl_sys])(ivar, jvar);
7340std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
7343 return _assembly[tid][nl_sys]->couplingEntries();
7346std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
7349 return _assembly[tid][nl_sys]->nonlocalCouplingEntries();
7352const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
7355 return _assembly[tid][nl_sys]->fieldScalarCouplingEntries();
7364 TIME_SECTION(
"init", 2,
"Initializing");
7375 for (
const auto i : index_range(
_nl))
7380 unsigned int n_vars = nl->nVariables();
7382 TIME_SECTION(
"fillCouplingMatrix", 3,
"Filling Coupling Matrix");
7387 cm = std::make_unique<CouplingMatrix>(
n_vars);
7388 for (
unsigned int i = 0; i <
n_vars; i++)
7394 cm = std::make_unique<CouplingMatrix>(
n_vars);
7395 for (
unsigned int i = 0; i <
n_vars; i++)
7396 for (
unsigned int j = 0; j <
n_vars; j++)
7406 nl->dofMap()._dof_coupling = cm.get();
7412 nl->dofMap()._dof_coupling =
nullptr;
7414 nl->dofMap().attach_extra_sparsity_function(&
extraSparsity, nl.get());
7415 nl->dofMap().attach_extra_send_list_function(&
extraSendList, nl.get());
7419 mooseError(
"No variables specified in nonlinear system '", nl->name(),
"'.");
7422 for (
const auto param :
7423 {
"constant_null_space_variables",
"constant_transpose_null_space_variables"})
7424 for (
const auto & var : getParam<std::vector<VariableName>>(param))
7425 if (std::none_of(
_nl.begin(),
7427 [&var](
const auto & nl)
7428 {
return nl->hasVariable(var) || nl->hasScalarVariable(var); }))
7429 paramError(param,
"Variable '", var,
"' is not in any nonlinear system.");
7450 for (
auto & nl :
_nl)
7452 nl->turnOffJacobian();
7470 TIME_SECTION(
"EquationSystems::Init", 2,
"Initializing Equation Systems");
7488 for (
const auto i : index_range(
_nl))
7492 "Coupling matrix not set for system "
7494 <<
". This should only happen if a preconditioner was not setup for this system");
7501#ifdef MOOSE_KOKKOS_ENABLED
7512 std::istringstream ss(nl_sys_name);
7513 unsigned int nl_sys_num;
7514 if (!(ss >> nl_sys_num) || !ss.eof())
7523 std::istringstream ss(linear_sys_name);
7524 unsigned int linear_sys_num;
7525 if (!(ss >> linear_sys_num) || !ss.eof())
7528 return linear_sys_num;
7534 std::istringstream ss(solver_sys_name);
7535 unsigned int solver_sys_num;
7536 if (!(ss >> solver_sys_num) || !ss.eof())
7540 mooseError(
"The solver system number was requested for system '" + solver_sys_name,
7541 "' but this system does not exist in the Problem. Systems can be added to the "
7542 "problem using the 'nl_sys_names'/'linear_sys_names' parameter.\nSystems in the "
7545 solver_sys_num = search->second;
7548 return solver_sys_num;
7555 if (solver_sys->hasVariable(variable_name))
7556 return solver_sys->number();
7557 mooseAssert(
_aux,
"Should have an auxiliary system");
7558 if (
_aux->hasVariable(variable_name))
7559 return _aux->number();
7563 "' was not found in any solver (nonlinear/linear) or auxiliary system");
7569 TIME_SECTION(
"solve", 1,
"Solving",
false);
7583#if PETSC_RELEASE_LESS_THAN(3, 12, 0)
7622#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
7624 LibmeshPetscCall(PetscOptionsPop());
7641 TIME_SECTION(
"checkExceptionAndStopSolve", 5);
7661 <<
"To recover, the solution will fail and then be re-attempted with a reduced time "
7676 _aux->solution().close();
7690 mooseError(
"The following parallel-communicated exception was detected during " +
7693 "\nBecause this did not occur during residual evaluation, there"
7694 " is no way to handle this, so the solution is aborting.\n");
7702 ADReal::do_derivatives =
true;
7727 TIME_SECTION(
"solve", 1,
"Solving",
false);
7737#if PETSC_RELEASE_LESS_THAN(3, 12, 0)
7739 options, solver_params));
7757#if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
7759 LibmeshPetscCall(PetscOptionsPop());
7775 return _nl[nl_sys_num]->nNonlinearIterations();
7781 return _nl[nl_sys_num]->nLinearIterations();
7787 return _nl[nl_sys_num]->finalNonlinearResidual();
7793 return _nl[nl_sys_num]->computingPreSMOResidual();
7799 TIME_SECTION(
"copySolutionsBackwards", 3,
"Copying Solutions Backward");
7802 sys->copyStateHistoryBackwards();
7803 _aux->copyStateHistoryBackwards();
7810 sys->skipNextSolutionToOldCopy();
7811 _aux->skipNextSolutionToOldCopy();
7817 TIME_SECTION(
"advanceState", 5,
"Advancing State");
7843#ifdef MOOSE_KOKKOS_ENABLED
7878 TIME_SECTION(
"restoreSolutions", 5,
"Restoring Solutions");
7882 "There is currently no way to restore not-zeroed vectors.");
7887 _console <<
"Restoring solutions on system " << sys->
name() <<
"..." << std::endl;
7888 sys->restoreStateHistory();
7892 _console <<
"Restoring solutions on Auxiliary system..." << std::endl;
7893 _aux->restoreStateHistory();
7896 _console <<
"Restoring postprocessor, vector-postprocessor, and reporter data..." << std::endl;
7906 TIME_SECTION(
"saveOldSolutions", 5,
"Saving Old Solutions");
7909 sys->saveOldSolutions();
7910 _aux->saveOldSolutions();
7916 TIME_SECTION(
"restoreOldSolutions", 5,
"Restoring Old Solutions");
7919 sys->restoreOldSolutions();
7920 _aux->restoreOldSolutions();
7926 TIME_SECTION(
"outputStep", 1,
"Outputting");
7963 TIME_SECTION(
"onTimestepBegin", 2);
7965 for (
auto & nl :
_nl)
7966 nl->onTimestepBegin();
7982 switch (state.
state)
7994 mooseError(
"Unhandled state ", state.
state,
" in FEProblemBase::getTimeFromStateArg");
8000 const std::string & name,
8003 parallel_object_only();
8015 _aux->addDotVectors();
8016 for (
auto & nl :
_nl)
8018 nl->addDotVectors();
8020 auto tag_udot = nl->getTimeIntegrators()[0]->uDotFactorTag();
8021 if (!nl->hasVector(tag_udot))
8022 nl->associateVectorToTag(*nl->solutionUDot(), tag_udot);
8023 auto tag_udotdot = nl->getTimeIntegrators()[0]->uDotDotFactorTag();
8025 nl->associateVectorToTag(*nl->solutionUDotDot(), tag_udotdot);
8035 const std::string & name,
8038 parallel_object_only();
8041 mooseError(
"Vector bounds cannot be used with LinearSystems!");
8047 for (
auto & nl :
_nl)
8048 nl->setPredictor(predictor);
8072 residual->scale(-1.0);
8074 return residual->l2_norm();
8080 TIME_SECTION(
"computeResidualL2Norm", 2,
"Computing L2 Norm of Residual");
8084 for (
auto sys :
_nl)
8087 l2_norm += norm * norm;
8093 l2_norm += norm * norm;
8096 return std::sqrt(l2_norm);
8101 const NumericVector<Number> & soln,
8102 NumericVector<Number> & residual)
8104 parallel_object_only();
8106 TIME_SECTION(
"computeResidualSys", 5);
8115 const NumericVector<Number> & soln,
8116 NumericVector<Number> & residual)
8125 NumericVector<Number> & residual,
8126 const unsigned int nl_sys_num)
8135 mooseAssert(
_fe_vector_tags.empty(),
"This should be empty indicating a clean starting state");
8146 NumericVector<Number> & residual,
8147 SparseMatrix<Number> & jacobian)
8158 "This should be empty indicating a clean starting state");
8170 for (
auto & tag : tags)
8188 for (
auto index : make_range(matrix.row_start(), matrix.row_stop()))
8189 matrix.add(index, index, 0);
8192 _aux->zeroVariablesForResidual();
8214 for (
unsigned int tid = 0; tid < n_threads; tid++)
8217 _aux->residualSetup();
8227 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8233#ifdef MOOSE_KOKKOS_ENABLED
8278 NumericVector<Number> & residual,
8300 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8301 "contact the MOOSE team for assistance.");
8307 NumericVector<Number> & residual,
8308 const std::set<TagID> & tags)
8310 parallel_object_only();
8312 TIME_SECTION(
"computeResidualInternal", 1);
8333 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8334 "contact the MOOSE team for assistance.");
8340 NumericVector<Number> & residual,
8343 TIME_SECTION(
"computeResidualType", 5);
8364 mooseError(
"An unhandled MooseException was raised during residual computation. Please "
8365 "contact the MOOSE team for assistance.");
8372 auto create_exception_message =
8373 [&calling_method](
const std::string & exception_type,
const auto & exception)
8375 return std::string(
"A " + exception_type +
" was raised during FEProblemBase::" +
8376 calling_method +
"\n" + std::string(exception.what()));
8390 setException(create_exception_message(
"MooseException", e));
8392 catch (
const MetaPhysicL::LogicError & e)
8408 mooseError(create_exception_message(
"libMesh::PetscSolverException", e));
8410 catch (
const std::exception & e)
8413 if (strstr(e.
what(),
"Jacobian") || strstr(e.
what(),
"singular") ||
8414 strstr(e.
what(),
"det != 0"))
8415 setException(create_exception_message(
"libMesh DegenerateMap", e));
8418 const auto message = create_exception_message(
"std::exception", e);
8450 parallel_object_only();
8456 TIME_SECTION(
"computeResidualTags", 5,
"Computing Residual");
8458 ADReal::do_derivatives =
false;
8462 _aux->zeroVariablesForResidual();
8482 for (
unsigned int tid = 0; tid < n_threads; tid++)
8485 _aux->residualSetup();
8495 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8501#ifdef MOOSE_KOKKOS_ENABLED
8539 const NumericVector<Number> & soln,
8540 SparseMatrix<Number> & jacobian)
8549 SparseMatrix<Number> & jacobian,
8563 SparseMatrix<Number> & jacobian,
8564 const unsigned int nl_sys_num)
8571 for (
auto & tag : tags)
8579 SparseMatrix<Number> & jacobian,
8580 const std::set<TagID> & tags)
8582 TIME_SECTION(
"computeJacobianInternal", 1);
8602 TIME_SECTION(
"computeJacobianTags", 5,
"Computing Jacobian");
8604 for (
auto tag : tags)
8616 for (
auto index : make_range(matrix.row_start(), matrix.row_stop()))
8617 matrix.add(index, index, 0);
8620 _aux->zeroVariablesForJacobian();
8635 for (
unsigned int tid = 0; tid < n_threads; tid++)
8638 _aux->jacobianSetup();
8653 for (
unsigned int tid = 0; tid < n_threads; tid++)
8659#ifdef MOOSE_KOKKOS_ENABLED
8706 const unsigned int nl_sys_num)
8708 TIME_SECTION(
"computeTransientImplicitJacobian", 2);
8730 JacobianBlock jac_block(precond_system, jacobian, ivar, jvar);
8731 std::vector<JacobianBlock *>
blocks = {&jac_block};
8738 NumericVector<Number> & lower,
8739 NumericVector<Number> & upper)
8746 "I expect these system numbers to be the same");
8751 TIME_SECTION(
"computeBounds", 1,
"Computing Bounds");
8760 _aux->residualSetup();
8782 SparseMatrix<Number> & system_matrix,
8783 NumericVector<Number> & rhs,
8784 const bool compute_gradients)
8786 TIME_SECTION(
"computeLinearSystemSys", 5);
8819 const std::set<TagID> & vector_tags,
8820 const std::set<TagID> & matrix_tags,
8821 const bool compute_gradients)
8823 TIME_SECTION(
"computeLinearSystemTags", 5,
"Computing Linear System");
8827 for (
auto tag : matrix_tags)
8845 _aux->jacobianSetup();
8847 for (
THREAD_ID tid = 0; tid < n_threads; tid++)
8852#ifdef MOOSE_KOKKOS_ENABLED
8862 _console <<
"\nA MooseException was raised during Auxiliary variable computation.\n"
8863 <<
"The next solve will fail, the timestep will be reduced, and we will try again.\n"
8890 std::vector<NumericVector<Number> *> & sp)
8893 "I expect these system numbers to be the same");
8896 for (
unsigned int i = 0; i <
subspaceDim(
"NearNullSpace"); ++i)
8898 std::stringstream postfix;
8899 postfix <<
"_" << i;
8900 std::string modename =
"NearNullSpace" + postfix.str();
8907 std::vector<NumericVector<Number> *> & sp)
8910 "I expect these system numbers to be the same");
8912 for (
unsigned int i = 0; i <
subspaceDim(
"NullSpace"); ++i)
8914 std::stringstream postfix;
8915 postfix <<
"_" << i;
8923 std::vector<NumericVector<Number> *> & sp)
8926 "I expect these system numbers to be the same");
8928 for (
unsigned int i = 0; i <
subspaceDim(
"TransposeNullSpace"); ++i)
8930 std::stringstream postfix;
8931 postfix <<
"_" << i;
8939 const std::string & prefix,
8940 std::vector<NumericVector<Number> *> & sp)
8943 std::vector<dof_id_type> dofs;
8944 for (
const auto & var :
vars)
8955 for (
const auto dof : dofs)
8958 sp.push_back(&mode);
8964 const NumericVector<Number> & old_soln,
8965 NumericVector<Number> & search_direction,
8966 NumericVector<Number> & new_soln,
8967 bool & changed_search_direction,
8968 bool & changed_new_soln)
8971 "I expect these system numbers to be the same");
8982 TIME_SECTION(
"computePostCheck", 2,
"Computing Post Check");
8997 std::unique_ptr<NumericVector<Number>> ghosted_solution =
8998 sys.current_local_solution->zero_clone(),
8999 ghosted_search_direction =
9000 sys.current_local_solution->zero_clone();
9003 *ghosted_solution = new_soln;
9004 *ghosted_search_direction = search_direction;
9009 Real damping =
computeDamping(*ghosted_solution, *ghosted_search_direction);
9015 new_soln = old_soln;
9016 new_soln.add(-damping, search_direction);
9017 changed_new_soln =
true;
9024 if (changed_new_soln)
9025 *ghosted_solution = new_soln;
9027 bool updated_solution =
updateSolution(new_soln, *ghosted_solution);
9028 if (updated_solution)
9029 changed_new_soln =
true;
9036 _aux->copyCurrentIntoPreviousNL();
9040 changed_search_direction =
false;
9047 const NumericVector<Number> & update)
9054 TIME_SECTION(
"computeDamping", 1,
"Computing Damping");
9082 NumericVector<Number> & )
9095 parallel_object_only();
9104 TIME_SECTION(
"updateGeometricSearch", 3,
"Updating Geometric Search");
9115 TIME_SECTION(
"updateMortarMesh", 5,
"Updating Mortar Mesh");
9133 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
9134 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
9138 const bool correct_edge_dropping,
9139 const Real minimum_projection_angle,
9140 const Mortar3DSubpatchPlane mortar_3d_subpatch_plane,
9142 const bool triangulate_triangles,
9143 const Mortar3DQuadraturePointMapping mortar_3d_qp_mapping)
9148 return _mortar_data->createMortarInterface(primary_secondary_boundary_pair,
9149 primary_secondary_subdomain_pair,
9154 correct_edge_dropping,
9155 minimum_projection_angle,
9156 mortar_3d_subpatch_plane,
9158 triangulate_triangles,
9159 mortar_3d_qp_mapping);
9161 return _mortar_data->createMortarInterface(primary_secondary_boundary_pair,
9162 primary_secondary_subdomain_pair,
9167 correct_edge_dropping,
9168 minimum_projection_angle,
9169 mortar_3d_subpatch_plane,
9171 triangulate_triangles,
9172 mortar_3d_qp_mapping);
9177 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
9178 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
9179 bool on_displaced)
const
9182 primary_secondary_boundary_pair, primary_secondary_subdomain_pair, on_displaced);
9187 const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
9188 const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
9192 primary_secondary_boundary_pair, primary_secondary_subdomain_pair, on_displaced);
9200 TIME_SECTION(
"possiblyRebuildGeomSearchPatches", 5,
"Rebuilding Geometric Search Patches");
9234 libmesh_fallthrough();
9240 _console <<
"\n\nUpdating geometric search patches\n" << std::endl;
9256#ifdef LIBMESH_ENABLE_AMR
9265 mooseError(
"HFEM does not support mesh adaptivity currently.");
9267 TIME_SECTION(
"initialAdaptMesh", 2,
"Performing Initial Adaptivity");
9269 for (
unsigned int i = 0; i < n; i++)
9286 _console <<
"Mesh unchanged, skipping remaining steps..." << std::endl;
9302 TIME_SECTION(
"adaptMesh", 3,
"Adapting Mesh");
9306 bool mesh_changed =
false;
9308 for (
unsigned int i = 0; i < cycles_per_step; ++i)
9311 mooseError(
"HFEM does not support mesh adaptivity currently.");
9317 bool mesh_changed_this_step;
9320 if (mesh_changed_this_step)
9322 mesh_changed =
true;
9335 _console <<
"Mesh unchanged, skipping remaining steps..." << std::endl;
9351 return mesh_changed;
9365 std::vector<MaterialData *> data(
numThreads());
9366 for (
const auto tid : make_range(
numThreads()))
9367 data[tid] = &storage.getMaterialData(tid);
9374 for (
unsigned int i = 0; i < n_threads; ++i)
9375 for (
const auto nl_sys_num : index_range(
_nl))
9386 TIME_SECTION(
"updateMeshXFEM", 5,
"Updating XFEM");
9388 bool updated =
false;
9391 if (
_xfem->updateHeal())
9396 false,
true,
false);
9402 false,
true,
false);
9405 _console <<
"\nXFEM update complete: Mesh modified" << std::endl;
9408 _console <<
"\nXFEM update complete: Mesh not modified" << std::endl;
9415 const bool contract_mesh,
9416 const bool clean_refinement_flags)
9418 TIME_SECTION(
"meshChanged", 3,
"Handling Mesh Changes");
9440 if (intermediate_change)
9445 if (should_contract)
9448 if (clean_refinement_flags)
9456 if (!intermediate_change)
9492 mooseError(
"Disabling mesh contraction is not implemented when a displaced problem is used. "
9494 "developer of this application to discuss the combination of these features.");
9512 for (
auto & nl_sys :
_nl)
9513 nl_sys->reinitMortarFunctors();
9538 for (
const auto & elem : range)
9555 for (
const auto & elem : range)
9558 for (
auto && child : coarsened_children)
9594 mdi->meshDisplaced();
9605 cmt(elem_range,
true);
9607#ifdef MOOSE_KOKKOS_ENABLED
9616 TIME_SECTION(
"checkProblemIntegrity", 5);
9619 const auto & subdomain_names = getParam<std::vector<SubdomainName>>(
"block");
9621 std::set<SubdomainID> mesh_subdomains(mesh_subdomains_vec.begin(), mesh_subdomains_vec.end());
9627 std::set<SubdomainID>
blocks;
9630 blocks = mesh_subdomains;
9633 blocks = mesh_subdomains;
9641 "\" not found in mesh.");
9653 "\" not found in mesh.");
9657 for (
auto & nl :
_nl)
9658 nl->checkKernelCoverage(
blocks);
9663#ifdef LIBMESH_ENABLE_AMR
9668 _console <<
"Using EXPERIMENTAL Stateful Material Property projection with Adaptivity!\n"
9673 std::set<SubdomainID> local_mesh_subs(mesh_subdomains);
9682 bool check_material_coverage =
false;
9684 for (
const auto &
id : ids)
9686 local_mesh_subs.erase(
id);
9687 check_material_coverage =
true;
9698 "Subdomain \"" + subdomain_name +
"\" not found in mesh.");
9699 local_mesh_subs.erase(
id);
9704 std::set<SubdomainID>
blocks(local_mesh_subs);
9710 "Subdomain \"" + subdomain_name +
"\" not found in mesh.");
9713 for (
const auto id :
blocks)
9714 local_mesh_subs.erase(
id);
9718 auto && mortar_subdomain_ids =
_mortar_data->getMortarSubdomainIDs();
9719 for (
auto subdomain_id : mortar_subdomain_ids)
9720 local_mesh_subs.erase(subdomain_id);
9723 if (check_material_coverage && !local_mesh_subs.empty())
9725 std::stringstream extra_subdomain_ids;
9727 std::copy(local_mesh_subs.begin(),
9728 local_mesh_subs.end(),
9729 std::ostream_iterator<unsigned int>(extra_subdomain_ids,
" "));
9731 std::vector<SubdomainID> local_mesh_subs_vec(local_mesh_subs.begin(),
9732 local_mesh_subs.end());
9734 mooseError(
"The following blocks from your input mesh do not contain an active material: " +
9735 extra_subdomain_ids.str() +
9737 ")\nWhen ANY mesh block contains a Material object, "
9738 "all blocks must contain a Material object.\n");
9748 for (
const auto & material : materials)
9749 material->checkStatefulSanity();
9771 mooseError(
"Coordinate transformation parameters, listed below, are only to be used in the "
9772 "context of application to application field transfers at this time. The mesh is "
9773 "not modified by these parameters within an application.\n"
9774 "You should likely use a 'TransformGenerator' in the [Mesh] block to achieve the "
9775 "desired mesh modification.\n\n",
9798 const bool lagrange = var.feType().family == LAGRANGE;
9799 const auto sys_num = var.sys().number();
9800 const auto & dof_map_var = var.sys().dofMap().variable(var.number());
9801 bool has_nodes_without_dofs =
false;
9802 bool has_first_order_prism21 =
false;
9803 for (
const auto & elem :
9806 if (!dof_map_var.active_on_subdomain(elem->subdomain_id()))
9810 if (lagrange && var.order() < SECOND && elem->type() == PRISM21)
9811 has_first_order_prism21 =
true;
9813 for (
const auto & node : elem->node_ref_range())
9814 if (!node.n_dofs(sys_num, var.number()))
9815 has_nodes_without_dofs =
true;
9816 if (has_nodes_without_dofs || has_first_order_prism21)
9823 if (has_nodes_without_dofs)
9826 "' has no degrees of freedom on some mesh nodes, so the displaced mesh cannot be "
9827 "updated at those nodes. Use a LAGRANGE displacement variable.");
9828 if (has_first_order_prism21)
9831 "' must be at least SECOND order on PRISM21 elements.");
9840 std::set<SubdomainID> user_objects_blocks;
9844 std::set<std::string> names;
9846 std::vector<UserObjectBase *> objects;
9849 for (
const auto & obj : objects)
9850 names.insert(obj->name());
9853 std::set<SubdomainID> difference;
9854 std::set_difference(user_objects_blocks.begin(),
9855 user_objects_blocks.end(),
9856 mesh_subdomains.begin(),
9857 mesh_subdomains.end(),
9858 std::inserter(difference, difference.end()));
9860 if (!difference.empty())
9862 std::ostringstream oss;
9863 oss <<
"One or more UserObjects is referencing a nonexistent block:\n";
9864 for (
const auto &
id : difference)
9873 std::vector<FVGradientMethod *> methods;
9875 for (
auto * method : methods)
9876 method->resolveGradientMethodDependencies(*
this);
9881 const std::map<
SubdomainID, std::vector<std::shared_ptr<MaterialBase>>> & materials_map)
9883 for (
const auto & it : materials_map)
9886 std::set<std::string> block_depend_props, block_supplied_props;
9888 for (
const auto & mat1 : it.second)
9890 auto & alldeps = mat1->getMatPropDependencies();
9891 for (
auto & dep : alldeps)
9895 for (
const auto & mat2 : it.second)
9897 const std::set<std::string> & supplied_props = mat2->MaterialBase::getSuppliedItems();
9898 block_supplied_props.insert(supplied_props.begin(), supplied_props.end());
9907 std::set<std::string> difference;
9908 std::set_difference(block_depend_props.begin(),
9909 block_depend_props.end(),
9910 block_supplied_props.begin(),
9911 block_supplied_props.end(),
9912 std::inserter(difference, difference.end()));
9914 if (!difference.empty())
9916 std::ostringstream oss;
9917 oss <<
"One or more Material Properties were not supplied on block ";
9919 if (subdomain_name.length() > 0)
9920 oss << subdomain_name <<
" (" << it.first <<
")";
9924 for (
const auto &
name : difference)
9925 oss <<
name <<
"\n";
9931 for (
const auto & it : materials_map)
9933 const auto & materials = it.second;
9934 std::set<std::string> inner_supplied, outer_supplied;
9936 for (
const auto & outer_mat : materials)
9939 outer_supplied = outer_mat->getSuppliedItems();
9940 inner_supplied.clear();
9943 std::map<std::string, std::set<std::string>> prop_to_mat;
9944 for (
const auto &
name : outer_supplied)
9945 prop_to_mat[
name].insert(outer_mat->name());
9947 for (
const auto & inner_mat : materials)
9949 if (outer_mat == inner_mat)
9953 auto outer_mat_type = outer_mat->type();
9954 auto inner_mat_type = inner_mat->type();
9959 if (outer_mat_type == inner_mat_type && outer_mat_type != outer_mat->type() &&
9960 inner_mat_type != inner_mat->type())
9963 inner_supplied.insert(inner_mat->getSuppliedItems().begin(),
9964 inner_mat->getSuppliedItems().end());
9966 for (
const auto & inner_supplied_name : inner_supplied)
9967 prop_to_mat[inner_supplied_name].insert(inner_mat->name());
9971 std::set<std::string> intersection;
9972 std::set_intersection(outer_supplied.begin(),
9973 outer_supplied.end(),
9974 inner_supplied.begin(),
9975 inner_supplied.end(),
9976 std::inserter(intersection, intersection.end()));
9978 if (!intersection.empty())
9980 std::ostringstream oss;
9981 oss <<
"The following material properties are declared on block " << it.first
9982 <<
" by multiple materials:\n";
9984 <<
"Material Objects\n";
9985 for (
const auto & outer_name : intersection)
9988 for (
const auto & inner_name : prop_to_mat[outer_name])
9989 oss << inner_name <<
" ";
10011 mooseInfo(
"Restart file ", file_name,
" is NOT being used since we are performing recovery.");
10017 mooseInfo(
"Using ", file_name,
" for restart.");
10021std::vector<VariableName>
10024 std::vector<VariableName> names;
10028 const std::vector<VariableName> & var_names = sys->getVariableNames();
10029 names.insert(names.end(), var_names.begin(), var_names.end());
10032 const std::vector<VariableName> & aux_var_names =
_aux->getVariableNames();
10033 names.insert(names.end(), aux_var_names.begin(), aux_var_names.end());
10042 "Solver system number '" << solver_sys_num <<
"' is out of bounds. We have '"
10059 auto random_data_ptr = insert_pair.first->second.get();
10069 bnd_mat_side_cache =
false;
10072 if (
_aux->needMaterialOnSide(bnd_id))
10074 bnd_mat_side_cache =
true;
10077 for (
auto & nl :
_nl)
10078 if (nl->needBoundaryMaterialOnSide(bnd_id, tid))
10080 bnd_mat_side_cache =
true;
10094 bnd_mat_side_cache =
true;
10108 interface_mat_side_cache =
false;
10111 for (
auto & nl :
_nl)
10112 if (nl->needInterfaceMaterialOnSide(bnd_id, tid))
10114 interface_mat_side_cache =
true;
10127 interface_mat_side_cache =
true;
10132 interface_mat_side_cache =
true;
10146 for (
auto & nl :
_nl)
10147 if (nl->needInternalNeighborSideMaterial(subdomain_id, tid))
10180 mooseError(
"Previous nonlinear solution is required but not added through "
10181 "Problem/previous_nl_solution_required=true");
10186 const unsigned int solver_sys_num)
10193 const unsigned int solver_sys_num)
const
10212 bool needed,
const unsigned int solver_sys_num)
10219 const unsigned int solver_sys_num)
const
10250 const std::string & object_name,
10253 parallel_object_only();
10260 mooseError(
"The name '", object_name,
"' is a reserved name for output objects");
10264 if (output_warehouse.
hasOutput(object_name))
10265 mooseError(
"An output object named '", object_name,
"' already exists");
10271 if (object_type ==
"Console" &&
_app.
getParam<
bool>(
"show_input") &&
10289 if (object_type ==
"XDR")
10291 else if (object_type ==
"XDA")
10295 if (object_name ==
"auto_recovery_checkpoint")
10327 else if (sys_name ==
"aux0")
10330 mooseError(
"System '" + sys_name +
"' was requested from problem but does not exist.");
10345 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
10346 return *
_nl[sys_num];
10352 mooseAssert(sys_num <
_nl.size(),
"System number greater than the number of nonlinear systems");
10353 return *
_nl[sys_num];
10360 "System number greater than the number of linear systems");
10368 "System number greater than the number of linear systems");
10376 "System number greater than the number of solver systems");
10384 "System number greater than the number of solver systems");
10403 parallel_object_only();
10431 false,
true,
true);
10447 const std::vector<Point> *
const pts,
10448 const std::vector<Real> *
const weights,
10460 unsigned int neighbor_side,
10462 const std::vector<Point> *
const pts,
10463 const std::vector<Real> *
const weights,
10475 const std::vector<Point> & pts,
10488 std::vector<std::shared_ptr<MaterialBase>> & face_materials,
10489 std::vector<std::shared_ptr<MaterialBase>> & neighbor_materials,
10490 std::set<MooseVariableFieldBase *> & variables,
10495 auto & this_face_mats =
10497 for (std::shared_ptr<MaterialBase> face_mat : this_face_mats)
10498 if (face_mat->ghostable())
10500 face_materials.push_back(face_mat);
10501 auto & var_deps = face_mat->getMooseVariableDependencies();
10502 for (
auto * var : var_deps)
10506 "Ghostable materials should only have finite volume variables coupled into them.");
10507 else if (face_mat->hasStatefulProperties())
10508 mooseError(
"Finite volume materials do not currently support stateful properties.");
10509 variables.insert(var);
10516 auto & this_neighbor_mats =
10518 for (std::shared_ptr<MaterialBase> neighbor_mat : this_neighbor_mats)
10519 if (neighbor_mat->ghostable())
10521 neighbor_materials.push_back(neighbor_mat);
10523 auto & var_deps = neighbor_mat->getMooseVariableDependencies();
10524 for (
auto * var : var_deps)
10528 "Ghostable materials should only have finite volume variables coupled into them.");
10529 else if (neighbor_mat->hasStatefulProperties())
10530 mooseError(
"Finite volume materials do not currently support stateful properties.");
10531 auto pr = variables.insert(var);
10532 mooseAssert(!pr.second,
10533 "We should not have inserted any new variables dependencies from our "
10534 "neighbor materials that didn't exist for our face materials");
10543 const unsigned int nqp,
10554 "There must be one convergence object per nonlinear system");
10559 _nl[i]->setConvergenceName(convergence_names[i]);
10574const std::vector<ConvergenceName> &
10579 mooseError(
"The nonlinear system convergence name(s) have not been set.");
10594 paramError(
"linear_convergence",
"There must be one convergence object per linear system");
10598const std::vector<ConvergenceName> &
10603 mooseError(
"The linear convergence name(s) have not been set.");
10606const ConvergenceName &
10612 mooseError(
"The fixed point convergence name has not been set.");
10615const ConvergenceName &
10621 mooseError(
"The steady convergence name has not been set.");
10666 return current_nl_sys_num;
10677 return current_linear_sys_num;
10694std::vector<MortarUserObject *>
10697 const bool displaced,
10698 const std::vector<MortarUserObject *> & mortar_uo_superset)
10700 std::vector<MortarUserObject *> mortar_uos;
10701 auto *
const subproblem =
10702 displaced ? cast_ptr<SubProblem *>(
_displaced_problem.get()) : cast_ptr<SubProblem *>(
this);
10703 for (
auto *
const obj : mortar_uo_superset)
10704 if (obj->onInterface(primary_boundary_id, secondary_boundary_id) &&
10705 (&obj->getSubProblem() == subproblem))
10706 mortar_uos.push_back(obj);
10711std::vector<MortarUserObject *>
10714 const bool displaced)
10716 std::vector<MortarUserObject *> mortar_uos;
10720 .queryInto(mortar_uos);
10721 return getMortarUserObjects(primary_boundary_id, secondary_boundary_id, displaced, mortar_uos);
10727 const bool displaced)
10729 const auto mortar_uos =
10731 for (
auto *
const mortar_uo : mortar_uos)
10733 mortar_uo->setNormals();
10734 mortar_uo->reinit();
10766 mooseAssert(nl_sys_num <
_nl.size(),
10767 "System number greater than the number of nonlinear systems");
10776 "System number greater than the number of linear systems");
10794const ConstElemRange &
10802const ConstNodeRange &
10871 return solver_params;
10889 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
void appendConstantModes(const std::vector< VariableName > &vars, const std::string &prefix, std::vector< NumericVector< libMesh::Number > * > &sp)
Append one mode per variable of vars in the current nonlinear system to sp.
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)
virtual void reinitNeighborSurfaceElemRef(const Elem *neighbor_elem, const std::vector< Point > &pts, const THREAD_ID tid=0) override
reinitialize FE objects on a given neighbor element that is itself the face, i.e.
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...
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...
void checkDisplacementNodes()
Verify that the displaced mesh update can move every node of the elements the displacement variables ...
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 std::vector< VariableName > _constant_null_space_vars
Variables whose constant fields span part of the Jacobian nullspace.
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.
const std::vector< VariableName > _constant_transpose_null_space_vars
Variables whose constant fields span part of the Jacobian transpose nullspace.
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)
virtual void reinitNeighborSurfaceElemRef(const Elem *neighbor_elem, const std::vector< Point > &pts, const THREAD_ID tid=0)
reinitialize FE objects on a given neighbor element that is itself the face, i.e.
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()
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
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
void local_variable_indices(T &idx, const MeshBase &mesh, unsigned int var_num) 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
bool has_variable(std::string_view var) 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
RealTensorValue RealTensor
RealVectorValue RealGradient
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error
Holds app partitioning information relevant to the a particular rank for a multiapp scenario.
State argument for evaluating functors.
SolutionIterationType iteration_type
The solution iteration type, e.g. time or nonlinear.
unsigned int state
The state.
Per-mortar-interface configuration.