Line data Source code
1 : /********************************************************************/ 2 : /* SOFTWARE COPYRIGHT NOTIFICATION */ 3 : /* Cardinal */ 4 : /* */ 5 : /* (c) 2021 UChicago Argonne, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /* */ 8 : /* Prepared by UChicago Argonne, LLC */ 9 : /* Under Contract No. DE-AC02-06CH11357 */ 10 : /* With the U. S. Department of Energy */ 11 : /* */ 12 : /* Prepared by Battelle Energy Alliance, LLC */ 13 : /* Under Contract No. DE-AC07-05ID14517 */ 14 : /* With the U. S. Department of Energy */ 15 : /* */ 16 : /* See LICENSE for full restrictions */ 17 : /********************************************************************/ 18 : 19 : #include "CardinalProblem.h" 20 : #include "NonlinearSystem.h" 21 : 22 : InputParameters 23 6673 : CardinalProblem::validParams() 24 : { 25 6673 : InputParameters params = ExternalProblem::validParams(); 26 : 27 : // these parameters don't do anything for ExternalProblem, and instead just 28 : // clutter the MooseDocs 29 6673 : params.suppressParameter<bool>("allow_invalid_solution"); 30 6673 : params.suppressParameter<bool>("boundary_restricted_elem_integrity_check"); 31 6673 : params.suppressParameter<bool>("boundary_restricted_node_integrity_check"); 32 6673 : params.suppressParameter<bool>("check_uo_aux_state"); 33 6673 : params.suppressParameter<bool>("error_on_jacobian_nonzero_reallocation"); 34 6673 : params.suppressParameter<std::vector<std::vector<TagName>>>("extra_tag_matrices"); 35 6673 : params.suppressParameter<std::vector<TagName>>("extra_tag_solutions"); 36 6673 : params.suppressParameter<std::vector<std::vector<TagName>>>("extra_tag_vectors"); 37 6673 : params.suppressParameter<bool>("force_restart"); 38 6673 : params.suppressParameter<bool>("fv_bcs_integrity_check"); 39 6673 : params.suppressParameter<bool>("material_dependency_check"); 40 6673 : params.suppressParameter<unsigned int>("near_null_space_dimension"); 41 6673 : params.suppressParameter<unsigned int>("null_space_dimension"); 42 6673 : params.suppressParameter<unsigned int>("transpose_null_space_dimension"); 43 6673 : params.suppressParameter<bool>("immediately_print_invalid_solution"); 44 6673 : params.suppressParameter<bool>("identify_variable_groups_in_nl"); 45 6673 : params.suppressParameter<std::vector<LinearSystemName>>("linear_sys_names"); 46 : 47 6673 : return params; 48 0 : } 49 : 50 2941 : CardinalProblem::CardinalProblem(const InputParameters & params) : ExternalProblem(params) {} 51 : 52 : void 53 10987 : CardinalProblem::checkDuplicateVariableName(const std::string & name, 54 : const std::string & system) const 55 : { 56 : // TODO: eventually remove this 57 : std::string extra; 58 10987 : if (name == "cell_id" || name == "cell_instance") 59 : extra = "\n\nCardinal recently added the CellIDAux (cell_id) and CellInstanceAux " 60 : "(cell_instance) as automatic outputs when using OpenMC, so you no longer need to " 61 : "include these auxkernels manually."; 62 : 63 10987 : if (_aux.get()->hasVariable(name)) 64 6 : mooseError( 65 : "Cardinal is trying to add an auxiliary variable named '", 66 : name, 67 : "' through the ", 68 : system, 69 : " system, but you already have a variable by this name. Please choose a different name " 70 6 : "for the auxiliary variable you are adding." + 71 : extra); 72 : 73 10981 : if (_nl[0].get()->hasVariable(name)) 74 1 : mooseError("Cardinal is trying to add a nonlinear variable named '", 75 : name, 76 : "', but you already have a variable by this name. Please choose a different name " 77 : "for the nonlinear variable you are adding."); 78 10980 : } 79 : 80 : bool 81 56 : CardinalProblem::stringHasEnding(std::string const & full, std::string const & ending) const 82 : { 83 56 : if (full.length() >= ending.length()) 84 56 : return 0 == full.compare(full.length() - ending.length(), ending.length(), ending); 85 : 86 : return false; 87 : }