Skip to content

Commit

Permalink
Merge pull request #26314 from grmnptr/nsfvaction-fix-26313
Browse files Browse the repository at this point in the history
Add error message if user tries to define forbidden velocity variable names in NSFVAction.
  • Loading branch information
grmnptr authored Dec 13, 2023
2 parents 8fd34bc + 5ddb857 commit 23ce577
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/navier_stokes/include/base/NSFVBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -3208,6 +3208,17 @@ NSFVBase<BaseType>::checkGeneralControlErrors()
if (parameters().template get<MooseEnum>("porosity_interface_pressure_treatment") != "bernoulli")
checkDependentParameterError("porosity_interface_pressure_treatment",
{"pressure_allow_expansion_on_bernoulli_faces"});

if (!_create_velocity && _porous_medium_treatment)
for (const auto & name : NS::velocity_vector)
{
const auto & it = std::find(_velocity_name.begin(), _velocity_name.end(), name);
if (it != _velocity_name.end())
paramError("velocity_variable",
"For porous medium simulations, functor name " + *it +
" is already reserved for the automatically-computed interstitial velocity. "
"Please choose another name for your external velocity variable!");
}
}

template <class BaseType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@
expect_err = "The number of velocity variable names supplied to the NSFVAction is not 2 \(mesh "
"dimension\) or 3!"
[]
[velocity-name-error]
type = 'RunException'
input = 2d-rc-error-action-no-scalar.i
requirement = 'The system shall throw an error if the user supplies unallowed names for the external velocity components in a porous medium setting'
cli_args = "Modules/NavierStokesFV/velocity_variable='vel_x vel_y' "
"Modules/NavierStokesFV/porous_medium_treatment=true "
"Variables/vel_x/type=MooseVariableFVReal Variables/vel_y/type=MooseVariableFVReal"
expect_err = "For porous medium simulations, functor name vel\_x is already reserved for the automatically-computed interstitial velocity. Please choose another name for your external velocity variable!"
[]
[pressure-variable-error]
type = 'RunException'
input = 2d-rc-error-action.i
Expand Down

0 comments on commit 23ce577

Please sign in to comment.