Skip to content

Commit

Permalink
Merge pull request #29668 from GiudGiud/PR_component_mesh
Browse files Browse the repository at this point in the history
Add a clean error on adding components with a regular / mesh generated mesh
  • Loading branch information
GiudGiud authored Jan 14, 2025
2 parents ce892b6 + 25e7f55 commit 2df0918
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/thermal_hydraulics/src/actions/AddComponentAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "AddComponentAction.h"
#include "THMProblem.h"
#include "THMMesh.h"

registerMooseAction("ThermalHydraulicsApp", AddComponentAction, "THM:add_component");

Expand All @@ -29,6 +30,12 @@ AddComponentAction::AddComponentAction(const InputParameters & params)
void
AddComponentAction::act()
{
// Error if using an unsupported mesh type, as most components cannot handle working with a
// regular MooseMesh instead of a THM mesh
if (!dynamic_cast<THMMesh *>(_mesh.get()))
mooseError("The Components block cannot be used to add a Component in conjunction with the "
"Mesh block at this time");

if (!_group)
{
THMProblem * thm_problem = dynamic_cast<THMProblem *>(_problem.get());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]

[Variables]
[u]
[]
[]

[Kernels]
[diff]
type = CoefDiffusion
variable = u
coef = 0.1
[]
[time]
type = TimeDerivative
variable = u
[]
[]

[Components]
[inlet]
type = InletMassFlowRateTemperature1Phase
input = 'iwst_pipe_1:in'
m_dot = 1
T = 100
[]

[iwst_pipe_1]
type = FlowChannel1Phase
position = '0 0 0'
orientation = '0 1 0'
length = 10
n_elems = 15
A = 1
D_h = 1
[]

[outlet]
type = Outlet1Phase
input = 'iwst_pipe_1:out'
p = 1e5
[]
[]

[Executioner]
type = Transient
dt = 0.1
num_steps = 10
abort_on_solve_fail = true
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Tests]
issues = '#29667'
design = 'THMMesh.md'
[no_components_and_mesh]
type = 'RunException'
input = 'test.i'
requirement = 'The system shall error if using both a regular mesh, usually created in the Mesh syntax, and components, usually created in the Components syntax.'
expect_err = "The Components block cannot be used to add a Component in conjunction with the Mesh block at this time"
[]
[]

0 comments on commit 2df0918

Please sign in to comment.