IsotropicPlasticityStressUpdate::IsotropicPlasticityStressUpdate(const InputParameters & parameters) : RadialReturnStressUpdate(parameters), _plastic_prepend(getParam<std::string>("plastic_prepend")), _yield_stress_function( isParamValid("yield_stress_function") ? &getFunction("yield_stress_function") : NULL), _yield_stress(getParam<Real>("yield_stress")), _hardening_constant(getParam<Real>("hardening_constant")), _hardening_function(isParamValid("hardening_function") ? &getFunction("hardening_function") : NULL), _yield_condition(-1.0), // set to a non-physical value to catch uninitalized yield condition _hardening_slope(0.0), _plastic_strain( declareProperty<RankTwoTensor>(_base_name + _plastic_prepend + "plastic_strain")), _plastic_strain_old( getMaterialPropertyOld<RankTwoTensor>(_base_name + _plastic_prepend + "plastic_strain")), _hardening_variable(declareProperty<Real>(_base_name + "hardening_variable")), _hardening_variable_old(getMaterialPropertyOld<Real>(_base_name + "hardening_variable")), _temperature(coupledValue("temperature")) { if (parameters.isParamSetByUser("yield_stress") && _yield_stress <= 0.0) mooseError("Yield stress must be greater than zero"); if (_yield_stress_function == NULL && !parameters.isParamSetByUser("yield_stress")) mooseError("Either yield_stress or yield_stress_function must be given"); if (!parameters.isParamSetByUser("hardening_constant") && !isParamValid("hardening_function")) mooseError("Either hardening_constant or hardening_function must be defined"); if (parameters.isParamSetByUser("hardening_constant") && isParamValid("hardening_function")) mooseError( "Only the hardening_constant or only the hardening_function can be defined but not both"); }
Exodus::Exodus(const InputParameters & parameters) : OversampleOutput(parameters), _exodus_initialized(false), _exodus_num(declareRestartableData<unsigned int>("exodus_num", 0)), _recovering(_app.isRecovering()), _exodus_mesh_changed(declareRestartableData<bool>("exodus_mesh_changed", true)), _sequence(isParamValid("sequence") ? getParam<bool>("sequence") : _use_displaced ? true : false), _overwrite(getParam<bool>("overwrite")), _output_dimension(getParam<MooseEnum>("output_dimension")), _discontinuous(getParam<bool>("discontinuous")) { if (isParamValid("use_problem_dimension")) { auto use_problem_dimension = getParam<bool>("use_problem_dimension"); if (use_problem_dimension) _output_dimension = "problem_dimension"; else _output_dimension = "default"; } // If user sets 'discontinuous = true' and 'elemental_as_nodal = false', issue an error that these // are incompatible states if (_discontinuous && parameters.isParamSetByUser("elemental_as_nodal") && !getParam<bool>("elemental_as_nodal")) mooseError(name(), ": Invalid parameters. 'elemental_as_nodal' set to false while 'discontinuous' set " "to true."); // Discontinuous output implies that elemental values are output as nodal values if (_discontinuous) _elemental_as_nodal = true; }
PorousFlow2PhasePP::PorousFlow2PhasePP(const InputParameters & parameters) : PorousFlowVariableBase(parameters), _phase0_porepressure(_nodal_material ? coupledNodalValue("phase0_porepressure") : coupledValue("phase0_porepressure")), _phase0_gradp_qp(coupledGradient("phase0_porepressure")), _phase0_porepressure_varnum(coupled("phase0_porepressure")), _p0var(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum) ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum) : 0), _phase1_porepressure(_nodal_material ? coupledNodalValue("phase1_porepressure") : coupledValue("phase1_porepressure")), _phase1_gradp_qp(coupledGradient("phase1_porepressure")), _phase1_porepressure_varnum(coupled("phase1_porepressure")), _p1var(_dictator.isPorousFlowVariable(_phase1_porepressure_varnum) ? _dictator.porousFlowVariableNum(_phase1_porepressure_varnum) : 0), _pc_uo(parameters.isParamSetByUser("capillary_pressure") ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure") : nullptr) { if (_num_phases != 2) mooseError("The Dictator announces that the number of phases is ", _dictator.numPhases(), " whereas PorousFlow2PhasePP can only be used for 2-phase simulation. When you " "have an efficient government, you have a dictatorship."); }
PorousFlow2PhasePS::PorousFlow2PhasePS(const InputParameters & parameters) : PorousFlowVariableBase(parameters), _phase0_porepressure(_nodal_material ? coupledNodalValue("phase0_porepressure") : coupledValue("phase0_porepressure")), _phase0_gradp_qp(coupledGradient("phase0_porepressure")), _phase0_porepressure_varnum(coupled("phase0_porepressure")), _pvar(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum) ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum) : 0), _phase1_saturation(_nodal_material ? coupledNodalValue("phase1_saturation") : coupledValue("phase1_saturation")), _phase1_grads_qp(coupledGradient("phase1_saturation")), _phase1_saturation_varnum(coupled("phase1_saturation")), _svar(_dictator.isPorousFlowVariable(_phase1_saturation_varnum) ? _dictator.porousFlowVariableNum(_phase1_saturation_varnum) : 0), _sat_lr(getParam<Real>("sat_lr")), _dseff_ds(1.0 / (1.0 - _sat_lr)), _pc_uo(parameters.isParamSetByUser("capillary_pressure") ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure") : nullptr) { if (_dictator.numPhases() != 2) mooseError("The Dictator proclaims that the number of phases is ", _dictator.numPhases(), " whereas PorousFlow2PhasePS can only be used for 2-phase simulation. Be aware " "that the Dictator has noted your mistake."); }
Console::Console(const InputParameters & parameters) : TableOutput(parameters), _max_rows(getParam<unsigned int>("max_rows")), _fit_mode(getParam<MooseEnum>("fit_mode")), _scientific_time(getParam<bool>("scientific_time")), _write_file(getParam<bool>("output_file")), _write_screen(getParam<bool>("output_screen")), _verbose(getParam<bool>("verbose")), _perf_log(getParam<bool>("perf_log")), _perf_log_interval(getParam<unsigned int>("perf_log_interval")), _solve_log(isParamValid("solve_log") ? getParam<bool>("solve_log") : _perf_log), _libmesh_log(getParam<bool>("libmesh_log")), _perf_header(isParamValid("perf_header") ? getParam<bool>("perf_header") : _perf_log), _all_variable_norms(getParam<bool>("all_variable_norms")), _outlier_variable_norms(getParam<bool>("outlier_variable_norms")), _outlier_multiplier(getParam<std::vector<Real>>("outlier_multiplier")), _precision(isParamValid("time_precision") ? getParam<unsigned int>("time_precision") : 0), _console_buffer(_app.getOutputWarehouse().consoleBuffer()), _old_linear_norm(std::numeric_limits<Real>::max()), _old_nonlinear_norm(std::numeric_limits<Real>::max()), _print_mesh_changed_info(getParam<bool>("print_mesh_changed_info")), _system_info_flags(getParam<MultiMooseEnum>("system_info")), _allow_changing_sysinfo_flag(true) { // Apply the special common console flags (print_...) ActionWarehouse & awh = _app.actionWarehouse(); const auto & actions = awh.getActionListByName("common_output"); mooseAssert(actions.size() == 1, "Should be only one common_output Action"); Action * common_action = *actions.begin(); // Honor the 'print_linear_residuals' option, only if 'execute_on' has not been set by the user if (!parameters.isParamSetByUser("execute_on")) { if (common_action->getParam<bool>("print_linear_residuals")) _execute_on.push_back("linear"); else _execute_on.erase("linear"); } if (!_pars.isParamSetByUser("perf_log") && common_action->getParam<bool>("print_perf_log")) { _perf_log = true; _solve_log = true; } // Append the common 'execute_on' to the setting for this object // This is unique to the Console object, all other objects inherit from the common options const ExecFlagEnum & common_execute_on = common_action->getParam<ExecFlagEnum>("execute_on"); for (auto & mme : common_execute_on) _execute_on.push_back(mme); // If --show-outputs is used, enable it if (_app.getParam<bool>("show_outputs")) _system_info_flags.push_back("output"); }
ComputeStrainBase::ComputeStrainBase(const InputParameters & parameters) : DerivativeMaterialInterface<Material>(parameters), _ndisp(coupledComponents("displacements")), _disp(3), _grad_disp(3), _grad_disp_old(3), _T(coupledValue("temperature")), _T0(getParam<Real>("temperature_ref")), _thermal_expansion_coeff(getParam<Real>("thermal_expansion_coeff")), _no_thermal_eigenstrains(false), _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : "" ), _mechanical_strain(declareProperty<RankTwoTensor>(_base_name + "mechanical_strain")), _total_strain(declareProperty<RankTwoTensor>(_base_name + "total_strain")), _stateful_displacements(getParam<bool>("stateful_displacements") && _fe_problem.isTransient()), _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction")) { // Checking for consistency between mesh size and length of the provided displacements vector if (_ndisp != _mesh.dimension()) mooseError("The number of variables supplied in 'displacements' must match the mesh dimension."); if (parameters.isParamSetByUser("thermal_expansion_coeff")) _no_thermal_eigenstrains = true; if (_no_thermal_eigenstrains) mooseDeprecated("The calculation of the thermal strains has been moved to the material ComputeThermalExpansionEigenStrains"); // fetch coupled variables and gradients (as stateful properties if necessary) for (unsigned int i = 0; i < _ndisp; ++i) { _disp[i] = &coupledValue("displacements", i); _grad_disp[i] = &coupledGradient("displacements", i); if (_stateful_displacements) _grad_disp_old[i] = &coupledGradientOld("displacements" ,i); else _grad_disp_old[i] = &_grad_zero; } // set unused dimensions to zero for (unsigned i = _ndisp; i < 3; ++i) { _disp[i] = &_zero; _grad_disp[i] = &_grad_zero; _grad_disp_old[i] = &_grad_zero; } }
PorousFlow1PhaseP::PorousFlow1PhaseP(const InputParameters & parameters) : PorousFlowVariableBase(parameters), _porepressure_var(_nodal_material ? coupledNodalValue("porepressure") : coupledValue("porepressure")), _gradp_qp_var(coupledGradient("porepressure")), _porepressure_varnum(coupled("porepressure")), _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum) ? _dictator.porousFlowVariableNum(_porepressure_varnum) : 0), _pc_uo(parameters.isParamSetByUser("capillary_pressure") ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure") : nullptr) { if (_num_phases != 1) mooseError("The Dictator proclaims that the number of phases is ", _dictator.numPhases(), " whereas PorousFlow1PhaseP can only be used for 1-phase simulations. Be aware " "that the Dictator has noted your mistake."); }
ParsedGenerateSideset::ParsedGenerateSideset(const InputParameters & parameters) : SideSetsGeneratorBase(parameters), FunctionParserUtils(parameters), _input(getMesh("input")), _function(parameters.get<std::string>("combinatorial_geometry")), _sideset_name(getParam<BoundaryName>("new_sideset_name")), _check_subdomains(isParamValid("included_subdomain_ids")), _check_normal(parameters.isParamSetByUser("normal")), _included_ids(_check_subdomains ? parameters.get<std::vector<SubdomainID>>("included_subdomain_ids") : std::vector<SubdomainID>()), _normal(getParam<Point>("normal")) { if (typeid(_input).name() == typeid(std::unique_ptr<DistributedMesh>).name()) mooseError("GenerateAllSideSetsByNormals only works with ReplicatedMesh."); // base function object _func_F = ADFunctionPtr(new ADFunction()); // set FParser internal feature flags setParserFeatureFlags(_func_F); // add the constant expressions addFParserConstants(_func_F, getParam<std::vector<std::string>>("constant_names"), getParam<std::vector<std::string>>("constant_expressions")); // parse function if (_func_F->Parse(_function, "x,y,z") >= 0) mooseError("Invalid function\n", _function, "\nin ParsedAddSideset ", name(), ".\n", _func_F->ErrorMsg()); _func_params.resize(3); }
void GapConductance::setGapGeometryParameters(const InputParameters & params, const Moose::CoordinateSystemType coord_sys, GAP_GEOMETRY & gap_geometry_type, Point & p1, Point & p2) { if (params.isParamSetByUser("gap_geometry_type")) { gap_geometry_type = GapConductance::GAP_GEOMETRY(int(params.get<MooseEnum>("gap_geometry_type"))); if (params.isParamSetByUser("coord_type")) mooseError("Deprecated parameter 'coord_type' cannot be used together with 'gap_geometry_type' in GapConductance"); } else if (params.isParamSetByUser("coord_type")) { if (params.get<MooseEnum>("coord_type") == "XYZ") gap_geometry_type = GapConductance::PLATE; else { if (coord_sys == Moose::COORD_XYZ) gap_geometry_type = GapConductance::PLATE; else if (coord_sys == Moose::COORD_RZ) gap_geometry_type = GapConductance::CYLINDER; else if (coord_sys == Moose::COORD_RSPHERICAL) gap_geometry_type = GapConductance::SPHERE; } } else { if (coord_sys == Moose::COORD_XYZ) gap_geometry_type = GapConductance::PLATE; else if (coord_sys == Moose::COORD_RZ) gap_geometry_type = GapConductance::CYLINDER; else if (coord_sys == Moose::COORD_RSPHERICAL) gap_geometry_type = GapConductance::SPHERE; } if (gap_geometry_type == GapConductance::PLATE) { if (coord_sys == Moose::COORD_RSPHERICAL) mooseError("'gap_geometry_type = PLATE' cannot be used with models having a spherical coordinate system."); } else if (gap_geometry_type == GapConductance::CYLINDER) { if (coord_sys == Moose::COORD_XYZ) { if (!params.isParamValid("cylinder_axis_point_1") || !params.isParamValid("cylinder_axis_point_2")) mooseError("For 'gap_geometry_type = CYLINDER' to be used with a Cartesian model, 'cylinder_axis_point_1' and 'cylinder_axis_point_2' must be specified."); p1 = params.get<RealVectorValue>("cylinder_axis_point_1"); p2 = params.get<RealVectorValue>("cylinder_axis_point_2"); } else if (coord_sys == Moose::COORD_RZ) { if (params.isParamValid("cylinder_axis_point_1") || params.isParamValid("cylinder_axis_point_2")) mooseError("The 'cylinder_axis_point_1' and 'cylinder_axis_point_2' cannot be specified with axisymmetric models. The y-axis is used as the cylindrical axis of symmetry."); p1 = Point(0,0,0); p2 = Point(0,1,0); } else if (coord_sys == Moose::COORD_RSPHERICAL) mooseError("'gap_geometry_type = CYLINDER' cannot be used with models having a spherical coordinate system."); } else if (gap_geometry_type == GapConductance::SPHERE) { if (coord_sys == Moose::COORD_XYZ || coord_sys == Moose::COORD_RZ) { if (!params.isParamValid("sphere_origin")) mooseError("For 'gap_geometry_type = SPHERE' to be used with a Cartesian or axisymmetric model, 'sphere_origin' must be specified."); p1 = params.get<RealVectorValue>("sphere_origin"); } else if (coord_sys == Moose::COORD_RSPHERICAL) { if (params.isParamValid("sphere_origin")) mooseError("The 'sphere_origin' cannot be specified with spherical models. x=0 is used as the spherical origin."); p1 = Point(0,0,0); } } }
Console::Console(const InputParameters & parameters) : TableOutput(parameters), _max_rows(getParam<unsigned int>("max_rows")), _fit_mode(getParam<MooseEnum>("fit_mode")), _scientific_time(getParam<bool>("scientific_time")), _write_file(getParam<bool>("output_file")), _write_screen(getParam<bool>("output_screen")), _verbose(getParam<bool>("verbose")), _perf_log(getParam<bool>("perf_log")), _perf_log_interval(getParam<unsigned int>("perf_log_interval")), _solve_log(isParamValid("solve_log") ? getParam<bool>("solve_log") : _perf_log), _setup_log(isParamValid("setup_log") ? getParam<bool>("setup_log") : _perf_log), _libmesh_log(getParam<bool>("libmesh_log")), _setup_log_early(getParam<bool>("setup_log_early")), _perf_header(isParamValid("perf_header") ? getParam<bool>("perf_header") : _perf_log), _all_variable_norms(getParam<bool>("all_variable_norms")), _outlier_variable_norms(getParam<bool>("outlier_variable_norms")), _outlier_multiplier(getParam<std::vector<Real>>("outlier_multiplier")), _precision(isParamValid("time_precision") ? getParam<unsigned int>("time_precision") : 0), _timing(_app.getParam<bool>("timing")), _console_buffer(_app.getOutputWarehouse().consoleBuffer()), _old_linear_norm(std::numeric_limits<Real>::max()), _old_nonlinear_norm(std::numeric_limits<Real>::max()), _print_mesh_changed_info(getParam<bool>("print_mesh_changed_info")), _system_info_flags(getParam<MultiMooseEnum>("system_info")), _allow_changing_sysinfo_flag(true) { // Apply the special common console flags (print_...) ActionWarehouse & awh = _app.actionWarehouse(); const auto & actions = awh.getActionListByName("common_output"); mooseAssert(actions.size() == 1, "Should be only one common_output Action"); Action * common_action = *actions.begin(); // Honor the 'print_linear_residuals' option, only if 'execute_on' has not been set by the user if (!parameters.isParamSetByUser("execute_on")) { if (common_action->getParam<bool>("print_linear_residuals")) _execute_on.push_back("linear"); else _execute_on.erase("linear"); } if (!_pars.isParamSetByUser("perf_log") && common_action->getParam<bool>("print_perf_log")) { _perf_log = true; _solve_log = true; _setup_log = true; } if (_app.name() != "main" && (_pars.isParamSetByUser("perf_log") || _pars.isParamSetByUser("perf_log_interval") || _pars.isParamSetByUser("setup_log") || _pars.isParamSetByUser("solve_log") || _pars.isParamSetByUser("perf_header") || _pars.isParamSetByUser("libmesh_log") || common_action->parameters().isParamSetByUser("print_perf_log"))) mooseWarning("Performance logging cannot currently be controlled from a Multiapp, please set " "all performance options in the main input file"); // Deprecate the setup perf log Moose::setup_perf_log.disable_logging(); // Append the common 'execute_on' to the setting for this object // This is unique to the Console object, all other objects inherit from the common options const MultiMooseEnum & common_execute_on = common_action->getParam<MultiMooseEnum>("execute_on"); for (auto & mme : common_execute_on) _execute_on.push_back(mme); // If --show-outputs is used, enable it if (_app.getParam<bool>("show_outputs")) _system_info_flags.push_back("output"); // Set output coloring if (Moose::colorConsole()) { char * term_env = getenv("TERM"); if (term_env) { std::string term(term_env); if (term != "xterm-256color" && term != "xterm") Moose::setColorConsole(false); } } }
Transient::Transient(const InputParameters & parameters) : Executioner(parameters), _problem(_fe_problem), _time_scheme(getParam<MooseEnum>("scheme")), _t_step(_problem.timeStep()), _time(_problem.time()), _time_old(_problem.timeOld()), _dt(_problem.dt()), _dt_old(_problem.dtOld()), _unconstrained_dt(declareRecoverableData<Real>("unconstrained_dt", -1)), _at_sync_point(declareRecoverableData<bool>("at_sync_point", false)), _first(declareRecoverableData<bool>("first", true)), _multiapps_converged(declareRecoverableData<bool>("multiapps_converged", true)), _last_solve_converged(declareRecoverableData<bool>("last_solve_converged", true)), _xfem_repeat_step(false), _xfem_update_count(0), _max_xfem_update(getParam<unsigned int>("max_xfem_update")), _end_time(getParam<Real>("end_time")), _dtmin(getParam<Real>("dtmin")), _dtmax(getParam<Real>("dtmax")), _num_steps(getParam<unsigned int>("num_steps")), _n_startup_steps(getParam<int>("n_startup_steps")), _steps_taken(0), _trans_ss_check(getParam<bool>("trans_ss_check")), _ss_check_tol(getParam<Real>("ss_check_tol")), _ss_tmin(getParam<Real>("ss_tmin")), _old_time_solution_norm(declareRecoverableData<Real>("old_time_solution_norm", 0.0)), _sync_times(_app.getOutputWarehouse().getSyncTimes()), _abort(getParam<bool>("abort_on_solve_fail")), _time_interval(declareRecoverableData<bool>("time_interval", false)), _start_time(getParam<Real>("start_time")), _timestep_tolerance(getParam<Real>("timestep_tolerance")), _target_time(declareRecoverableData<Real>("target_time", -1)), _use_multiapp_dt(getParam<bool>("use_multiapp_dt")), _picard_it(declareRecoverableData<int>("picard_it", 0)), _picard_max_its(getParam<unsigned int>("picard_max_its")), _picard_converged(declareRecoverableData<bool>("picard_converged", false)), _picard_initial_norm(declareRecoverableData<Real>("picard_initial_norm", 0.0)), _picard_timestep_begin_norm(declareRecoverableData<Real>("picard_timestep_begin_norm", 0.0)), _picard_timestep_end_norm(declareRecoverableData<Real>("picard_timestep_end_norm", 0.0)), _picard_rel_tol(getParam<Real>("picard_rel_tol")), _picard_abs_tol(getParam<Real>("picard_abs_tol")), _verbose(getParam<bool>("verbose")) { _problem.getNonlinearSystem().setDecomposition(_splitting); _t_step = 0; _dt = 0; _next_interval_output_time = 0.0; // Either a start_time has been forced on us, or we want to tell the App about what our start time is (in case anyone else is interested. if (_app.hasStartTime()) _start_time = _app.getStartTime(); else if (parameters.isParamSetByUser("start_time")) _app.setStartTime(_start_time); _time = _time_old = _start_time; _problem.transient(true); if (!_restart_file_base.empty()) _problem.setRestartFile(_restart_file_base); setupTimeIntegrator(); if (_app.halfTransient()) // Cut timesteps and end_time in half... { _end_time /= 2.0; _num_steps /= 2.0; if (_num_steps == 0) // Always do one step in the first half _num_steps = 1; } }
Transient::Transient(const InputParameters & parameters) : Executioner(parameters), _problem(_fe_problem), _nl(_fe_problem.getNonlinearSystemBase()), _time_scheme(getParam<MooseEnum>("scheme").getEnum<Moose::TimeIntegratorType>()), _t_step(_problem.timeStep()), _time(_problem.time()), _time_old(_problem.timeOld()), _dt(_problem.dt()), _dt_old(_problem.dtOld()), _unconstrained_dt(declareRecoverableData<Real>("unconstrained_dt", -1)), _at_sync_point(declareRecoverableData<bool>("at_sync_point", false)), _first(declareRecoverableData<bool>("first", true)), _multiapps_converged(declareRecoverableData<bool>("multiapps_converged", true)), _last_solve_converged(declareRecoverableData<bool>("last_solve_converged", true)), _xfem_repeat_step(false), _xfem_update_count(0), _max_xfem_update(getParam<unsigned int>("max_xfem_update")), _update_xfem_at_timestep_begin(getParam<bool>("update_xfem_at_timestep_begin")), _end_time(getParam<Real>("end_time")), _dtmin(getParam<Real>("dtmin")), _dtmax(getParam<Real>("dtmax")), _num_steps(getParam<unsigned int>("num_steps")), _n_startup_steps(getParam<int>("n_startup_steps")), _steps_taken(0), _steady_state_detection(getParam<bool>("steady_state_detection")), _steady_state_tolerance(getParam<Real>("steady_state_tolerance")), _steady_state_start_time(getParam<Real>("steady_state_start_time")), _sln_diff_norm(declareRecoverableData<Real>("sln_diff_norm", 0.0)), _old_time_solution_norm(declareRecoverableData<Real>("old_time_solution_norm", 0.0)), _sync_times(_app.getOutputWarehouse().getSyncTimes()), _abort(getParam<bool>("abort_on_solve_fail")), _time_interval(declareRecoverableData<bool>("time_interval", false)), _start_time(getParam<Real>("start_time")), _timestep_tolerance(getParam<Real>("timestep_tolerance")), _target_time(declareRecoverableData<Real>("target_time", -1)), _use_multiapp_dt(getParam<bool>("use_multiapp_dt")), _picard_it(declareRecoverableData<int>("picard_it", 0)), _picard_max_its(getParam<unsigned int>("picard_max_its")), _picard_converged(declareRecoverableData<bool>("picard_converged", false)), _picard_initial_norm(declareRecoverableData<Real>("picard_initial_norm", 0.0)), _picard_timestep_begin_norm(declareRecoverableData<Real>("picard_timestep_begin_norm", 0.0)), _picard_timestep_end_norm(declareRecoverableData<Real>("picard_timestep_end_norm", 0.0)), _picard_rel_tol(getParam<Real>("picard_rel_tol")), _picard_abs_tol(getParam<Real>("picard_abs_tol")), _verbose(getParam<bool>("verbose")), _sln_diff(_nl.addVector("sln_diff", false, PARALLEL)), _relax_factor(getParam<Real>("relaxation_factor")), _relaxed_vars(getParam<std::vector<std::string>>("relaxed_variables")) { // Handl deprecated parameters if (!parameters.isParamSetByAddParam("trans_ss_check")) _steady_state_detection = getParam<bool>("trans_ss_check"); if (!parameters.isParamSetByAddParam("ss_check_tol")) _steady_state_tolerance = getParam<Real>("ss_check_tol"); if (!parameters.isParamSetByAddParam("ss_tmin")) _steady_state_start_time = getParam<Real>("ss_tmin"); _nl.setDecomposition(_splitting); _t_step = 0; _dt = 0; _next_interval_output_time = 0.0; // Either a start_time has been forced on us, or we want to tell the App about what our start time // is (in case anyone else is interested. if (_app.hasStartTime()) _start_time = _app.getStartTime(); else if (parameters.isParamSetByUser("start_time")) _app.setStartTime(_start_time); _time = _time_old = _start_time; _problem.transient(true); if (!_restart_file_base.empty()) _problem.setRestartFile(_restart_file_base); setupTimeIntegrator(); if (_app.halfTransient()) // Cut timesteps and end_time in half... { _end_time /= 2.0; _num_steps /= 2.0; if (_num_steps == 0) // Always do one step in the first half _num_steps = 1; } // Set up relaxation if (_relax_factor != 1.0) { if (_relax_factor >= 2.0 || _relax_factor <= 0.0) mooseError("The Picard iteration relaxation factor should be between 0.0 and 2.0"); // Store a copy of the previous solution here _nl.addVector("relax_previous", false, PARALLEL); } // This lets us know if we are at Picard iteration > 0, works for both master- AND sub-app. // Initialize such that _prev_time != _time for the first Picard iteration _prev_time = _time - 1.0; }
ComputeSmearedCrackingStress::ComputeSmearedCrackingStress(const InputParameters & parameters) : ComputeMultipleInelasticStress(parameters), _cracking_release(getParam<MooseEnum>("cracking_release").getEnum<CrackingRelease>()), _cracking_residual_stress(getParam<Real>("cracking_residual_stress")), _cracking_stress(coupledValue("cracking_stress")), _max_cracks(getParam<unsigned int>("max_cracks")), _cracking_neg_fraction(getParam<Real>("cracking_neg_fraction")), _cracking_beta(getParam<Real>("cracking_beta")), _shear_retention_factor(getParam<Real>("shear_retention_factor")), _max_stress_correction(getParam<Real>("max_stress_correction")), _crack_damage(declareProperty<RealVectorValue>(_base_name + "crack_damage")), _crack_damage_old(getMaterialPropertyOld<RealVectorValue>(_base_name + "crack_damage")), _crack_flags(declareProperty<RealVectorValue>(_base_name + "crack_flags")), _crack_rotation(declareProperty<RankTwoTensor>(_base_name + "crack_rotation")), _crack_rotation_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "crack_rotation")), _crack_initiation_strain( declareProperty<RealVectorValue>(_base_name + "crack_initiation_strain")), _crack_initiation_strain_old( getMaterialPropertyOld<RealVectorValue>(_base_name + "crack_initiation_strain")), _crack_max_strain(declareProperty<RealVectorValue>(_base_name + "crack_max_strain")), _crack_max_strain_old(getMaterialPropertyOld<RealVectorValue>(_base_name + "crack_max_strain")) { MultiMooseEnum prescribed_crack_directions = getParam<MultiMooseEnum>("prescribed_crack_directions"); if (prescribed_crack_directions.size() > 0) { if (prescribed_crack_directions.size() > 3) mooseError("A maximum of three crack directions may be specified"); for (unsigned int i = 0; i < prescribed_crack_directions.size(); ++i) { for (unsigned int j = 0; j < i; ++j) if (prescribed_crack_directions[i] == prescribed_crack_directions[j]) mooseError("Entries in 'prescribed_crack_directions' cannot be repeated"); _prescribed_crack_directions.push_back( static_cast<unsigned int>(prescribed_crack_directions.get(i))); } // Fill in the last remaining direction if 2 are specified if (_prescribed_crack_directions.size() == 2) { std::set<unsigned int> available_dirs = {0, 1, 2}; for (auto dir : _prescribed_crack_directions) if (available_dirs.erase(dir) != 1) mooseError("Invalid prescribed crack direction:" + Moose::stringify(dir)); if (available_dirs.size() != 1) mooseError("Error in finding remaining available crack direction"); _prescribed_crack_directions.push_back(*available_dirs.begin()); } } if (parameters.isParamSetByUser("softening_models")) { if (parameters.isParamSetByUser("cracking_release")) mooseError("In ComputeSmearedCrackingStress cannot specify both 'cracking_release' and " "'softening_models'"); if (parameters.isParamSetByUser("cracking_residual_stress")) mooseError("In ComputeSmearedCrackingStress cannot specify both 'cracking_residual_stress' " "and 'softening_models'"); if (parameters.isParamSetByUser("cracking_beta")) mooseError("In ComputeSmearedCrackingStress cannot specify both 'cracking_beta' and " "'softening_models'"); } }