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 6289 : CardinalProblem::validParams() 24 : { 25 6289 : InputParameters params = ExternalProblem::validParams(); 26 : 27 : // these parameters don't do anything for ExternalProblem, and instead just 28 : // clutter the MooseDocs 29 6289 : params.suppressParameter<bool>("allow_invalid_solution"); 30 6289 : params.suppressParameter<bool>("boundary_restricted_elem_integrity_check"); 31 6289 : params.suppressParameter<bool>("boundary_restricted_node_integrity_check"); 32 6289 : params.suppressParameter<bool>("check_uo_aux_state"); 33 6289 : params.suppressParameter<bool>("error_on_jacobian_nonzero_reallocation"); 34 6289 : params.suppressParameter<std::vector<std::vector<TagName>>>("extra_tag_matrices"); 35 6289 : params.suppressParameter<std::vector<TagName>>("extra_tag_solutions"); 36 6289 : params.suppressParameter<std::vector<std::vector<TagName>>>("extra_tag_vectors"); 37 6289 : params.suppressParameter<bool>("force_restart"); 38 6289 : params.suppressParameter<bool>("fv_bcs_integrity_check"); 39 6289 : params.suppressParameter<bool>("material_dependency_check"); 40 6289 : params.suppressParameter<unsigned int>("near_null_space_dimension"); 41 6289 : params.suppressParameter<unsigned int>("null_space_dimension"); 42 6289 : params.suppressParameter<unsigned int>("transpose_null_space_dimension"); 43 6289 : params.suppressParameter<bool>("immediately_print_invalid_solution"); 44 6289 : params.suppressParameter<bool>("identify_variable_groups_in_nl"); 45 6289 : params.suppressParameter<std::vector<LinearSystemName>>("linear_sys_names"); 46 : 47 6289 : return params; 48 0 : } 49 : 50 2750 : CardinalProblem::CardinalProblem(const InputParameters & params) 51 2750 : : ExternalProblem(params) 52 : { 53 2750 : } 54 : 55 : void 56 10775 : CardinalProblem::checkDuplicateVariableName(const std::string & name) const 57 : { 58 : // TODO: eventually remove this 59 : std::string extra; 60 20000 : if (name == "cell_id" || name == "cell_instance") 61 : extra = "\n\nCardinal recently added the CellIDAux (cell_id) and CellInstanceAux " 62 : "(cell_instance) as automatic outputs when using OpenMC, so you no longer need to " 63 : "include these auxkernels manually."; 64 : 65 10775 : if (_aux.get()->hasVariable(name)) 66 4 : mooseError("Cardinal is trying to add an auxiliary variable named '", 67 : name, 68 : "', but you already have a variable by this name. Please choose a different name " 69 4 : "for the auxiliary variable you are adding." + 70 : extra); 71 : 72 10771 : if (_nl[0].get()->hasVariable(name)) 73 1 : mooseError("Cardinal is trying to add a nonlinear variable named '", name, 74 : "', but you already have a variable by this name. Please choose a different name " 75 : "for the nonlinear variable you are adding."); 76 10770 : } 77 : 78 : bool 79 56 : CardinalProblem::stringHasEnding(std::string const & full, std::string const & ending) const 80 : { 81 56 : if (full.length() >= ending.length()) 82 56 : return 0 == full.compare(full.length() - ending.length(), ending.length(), ending); 83 : 84 : return false; 85 : }