Skip to content

Commit

Permalink
Do not give cryptic error in FEProblemBase::addTransfer
Browse files Browse the repository at this point in the history
Also fix typos: 'directions' to 'direction' towards bottom of
`MultiAppTransfer` constructor

Refs idaholab#19676
  • Loading branch information
lindsayad committed Apr 15, 2022
1 parent 49bd072 commit 1ecd394
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions framework/src/problems/FEProblemBase.C
Expand Up @@ -4504,13 +4504,15 @@ FEProblemBase::addTransfer(const std::string & transfer_name,
std::shared_ptr<MultiApp> multiapp;
if (parameters.isParamValid("multi_app"))
multiapp = getMultiApp(parameters.get<MultiAppName>("multi_app"));
else if (parameters.isParamValid("from_multi_app"))
multiapp = getMultiApp(parameters.get<MultiAppName>("from_multi_app"));
else if (parameters.isParamValid("to_multi_app"))
multiapp = getMultiApp(parameters.get<MultiAppName>("to_multi_app"));
else
mooseError("Should not reach here");
exec_enum = multiapp->getParam<ExecFlagEnum>("execute_on");
else if (parameters.isParamValid("from_multiapp"))
multiapp = getMultiApp(parameters.get<MultiAppName>("from_multiapp"));
else if (parameters.isParamValid("to_multiapp"))
multiapp = getMultiApp(parameters.get<MultiAppName>("to_multiapp"));
// else do nothing because the user has provided invalid input. They should get a nice error
// about this during transfer construction. This necessitates checking for null in this next
// line, however
if (multiapp)
exec_enum = multiapp->getParam<ExecFlagEnum>("execute_on");
}

// Create the Transfer objects
Expand Down
14 changes: 7 additions & 7 deletions framework/src/transfers/MultiAppTransfer.C
Expand Up @@ -114,16 +114,16 @@ MultiAppTransfer::MultiAppTransfer(const InputParameters & parameters)
"Between multiapp transfer is only supported with the same number of subapps per MultiApp");

// Handle deprecated parameters
if (parameters.isParamSetByUser("directions"))
if (parameters.isParamSetByUser("direction"))
{
if (!isParamValid("multi_app"))
paramError("directions",
"The deprecated directions parameter is meant to be used in conjunction with the "
"multi_app parameter");
paramError("direction",
"The deprecated 'direction' parameter is meant to be used in conjunction with the "
"'multi_app' parameter");
if (isParamValid("to_multi_app") || isParamValid("from_multi_app"))
paramError("directions",
"The deprecated directions parameter is not meant to be used in conjunction with "
"the from_multi_app or to_multi_app parameters");
paramError("direction",
"The deprecated 'direction' parameter is not meant to be used in conjunction with "
"the 'from_multi_app' or 'to_multi_app' parameters");
}
}

Expand Down

0 comments on commit 1ecd394

Please sign in to comment.