Skip to content

Commit fb51b06

Browse files
committed
Refactor and regold ICs tests Refs idaholab#32847
1 parent 54e18e2 commit fb51b06

37 files changed

Lines changed: 374 additions & 155 deletions

File tree

modules/combined/test/tests/subchannel_thm_coupling/3D.i

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,14 @@ heated_length = 1.0
1010
###################################################
1111
[TriSubChannelMesh]
1212
[subchannel]
13-
type = SCMDetailedTriSubChannelMeshGenerator
13+
type = SCMDetailedTriAssemblyMeshGenerator
1414
nrings = ${n_rings}
1515
n_cells = ${n_cells}
1616
flat_to_flat = ${inner_duct_in}
1717
heated_length = ${heated_length}
1818
pin_diameter = ${fuel_pin_diameter}
1919
pitch = ${fuel_pin_pitch}
2020
[]
21-
22-
[fuel_pins]
23-
type = SCMDetailedTriPinMeshGenerator
24-
input = subchannel
25-
nrings = ${n_rings}
26-
n_cells = ${n_cells}
27-
pin_diameter = ${fuel_pin_diameter}
28-
heated_length = ${heated_length}
29-
pitch = ${fuel_pin_pitch}
30-
[]
3121
[]
3222

3323
[AuxVariables]

modules/combined/test/tests/subchannel_thm_coupling/subchannel.i

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ heated_length = 1.0
1717
###################################################
1818
[TriSubChannelMesh]
1919
[subchannel]
20-
type = SCMTriSubChannelMeshGenerator
20+
type = SCMTriAssemblyMeshGenerator
2121
nrings = ${n_rings}
2222
n_cells = ${n_cells}
2323
flat_to_flat = ${inner_duct_in}
@@ -29,15 +29,6 @@ heated_length = 1.0
2929
spacer_z = '0.0'
3030
spacer_k = '0.0'
3131
[]
32-
33-
[fuel_pins]
34-
type = SCMTriPinMeshGenerator
35-
input = subchannel
36-
nrings = ${n_rings}
37-
n_cells = ${n_cells}
38-
heated_length = ${heated_length}
39-
pitch = ${fuel_pin_pitch}
40-
[]
4132
[]
4233

4334
[AuxVariables]
@@ -273,12 +264,14 @@ heated_length = 1.0
273264
[Transfers]
274265
[subchannel_transfer]
275266
type = SCMSolutionTransfer
267+
transfer_type = subchannel
276268
to_multi_app = viz
277269
variable = 'mdot SumWij P DP h T rho mu S'
278270
[]
279271
[pin_transfer]
280-
type = SCMPinSolutionTransfer
272+
type = SCMSolutionTransfer
273+
transfer_type = pin
281274
to_multi_app = viz
282-
variable = 'Dpin Tpin q_prime'
275+
variable = 'Tpin q_prime Dpin'
283276
[]
284277
[]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SCMQuadAssemblyMeshGenerator
2+
3+
!syntax description /Mesh/SCMQuadAssemblyMeshGenerator
4+
5+
## Overview
6+
7+
!! Intentional comment to provide extra spacing
8+
9+
This mesh generator creates the 1D subchannel and pin meshes for a square lattice arrangement.
10+
The generated subdomains are named `subchannel` and `fuel_pins`.
11+
The center of the mesh is the origin.
12+
13+
## Example Input File Syntax
14+
15+
!listing /test/tests/problems/psbt/psbt_explicit.i block=QuadSubChannelMesh language=moose
16+
17+
!syntax parameters /Mesh/SCMQuadAssemblyMeshGenerator
18+
19+
!syntax inputs /Mesh/SCMQuadAssemblyMeshGenerator
20+
21+
!syntax children /Mesh/SCMQuadAssemblyMeshGenerator

modules/subchannel/doc/content/source/postprocessors/SCMPinPowerPostprocessor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ The user needs to specify a subchannel problem. Either a [QuadSubChannel1PhasePr
1010

1111
## Example Input File Syntax
1212

13-
!listing /test/tests/SCMQuadPower/test.i block=Postprocessors language=moose
14-
!listing /test/tests/SCMTriPower/test.i block=Postprocessors language=moose
13+
!listing /test/tests/SCMQuadPower/test_with_pins.i block=Postprocessors language=moose
14+
!listing /test/tests/SCMTriPower/test_with_pins.i block=Postprocessors language=moose
1515

1616
!syntax parameters /Postprocessors/SCMPinPowerPostprocessor
1717

modules/subchannel/include/mesh/TriSubChannelMesh.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TriSubChannelMesh : public SubChannelMesh
4141
const Real & getDuctToPinGap() const { return _duct_to_pin_gap; }
4242

4343
/**
44-
* Return the number of rings
44+
* Return the number of fuel-pin rings, counting the center pin as the first ring
4545
*/
4646
const unsigned int & getNumOfRings() const { return _n_rings; }
4747

@@ -131,7 +131,7 @@ class TriSubChannelMesh : public SubChannelMesh
131131
unsigned int pinIndex(const Point & p) const override;
132132

133133
protected:
134-
/// number of rings of fuel pins
134+
/// number of fuel-pin rings, counting the center pin as the first ring
135135
unsigned int _n_rings;
136136
/// number of subchannels
137137
unsigned int _n_channels;

modules/subchannel/src/mesh/TriSubChannelMesh.C

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,15 @@ TriSubChannelMesh::channelIndex(const Point & p) const
8282
// subchannel
8383
Real distance_outer_ring = _flat_to_flat / 2 - _duct_to_pin_gap - _pin_diameter / 2;
8484
Real channel_distance = std::sqrt(std::pow(p(0), 2) + std::pow(p(1), 2));
85-
Real angle = std::abs(std::atan(p(1) / p(0)));
85+
Real angle = std::abs(std::atan2(p(1), p(0)));
8686
Real projection_angle =
8787
angle - libMesh::pi / 6 - std::trunc(angle / (libMesh::pi / 3)) * (libMesh::pi / 3);
8888
channel_distance = channel_distance * std::cos(projection_angle);
8989

9090
// Projecting point on top edge to determine if the point is a corner or edge subchannel by x
9191
// coordinate
92-
Real loc_angle = std::atan(p(1) / p(0));
93-
if (p(0) <= 0)
94-
loc_angle += libMesh::pi;
95-
else if (p(0) >= 0 && p(1) <= 0)
92+
Real loc_angle = std::atan2(p(1), p(0));
93+
if (loc_angle < 0.0)
9694
loc_angle += 2 * libMesh::pi;
9795
Real rem_ang = std::trunc(loc_angle / (libMesh::pi / 3)) * (libMesh::pi / 3) - libMesh::pi / 3;
9896
Real x_coord_new = (std::cos(-rem_ang) * p(0) - std::sin(-rem_ang) * p(1));
@@ -101,46 +99,36 @@ TriSubChannelMesh::channelIndex(const Point & p) const
10199
// looping over all channels
102100
for (unsigned int i = 0; i < _n_channels; i++)
103101
{
102+
// Distance from the point to subchannel
103+
distance1 = std::sqrt(std::pow((p(0) - _subchannel_position[i][0]), 2.0) +
104+
std::pow((p(1) - _subchannel_position[i][1]), 2.0));
104105

105-
if (_n_rings == 1)
106+
// If subchannel belongs to center ring
107+
if (channel_distance < distance_outer_ring)
106108
{
107-
Real angle = std::atan(p(1) / p(0));
108-
if ((i * libMesh::pi / 6.0 < angle) && (angle <= (i + 1) * libMesh::pi / 6.0))
109-
return i;
110-
}
109+
if ((distance1 < distance0) && (_subch_type[i] == EChannelType::CENTER))
110+
{
111+
j = i;
112+
distance0 = distance1;
113+
} // if
114+
} // if
115+
// If subchannel belongs to outer ring
111116
else
112117
{
113-
// Distance from the point to subchannel
114-
distance1 = std::sqrt(std::pow((p(0) - _subchannel_position[i][0]), 2.0) +
115-
std::pow((p(1) - _subchannel_position[i][1]), 2.0));
116-
117-
// If subchannel belongs to center ring
118-
if (channel_distance < distance_outer_ring)
118+
if ((distance1 < distance0) &&
119+
(_subch_type[i] == EChannelType::EDGE || _subch_type[i] == EChannelType::CORNER))
119120
{
120-
if ((distance1 < distance0) && (_subch_type[i] == EChannelType::CENTER))
121+
if (((x_coord_new > x_lim) || (x_coord_new < -x_lim)) &&
122+
_subch_type[i] == EChannelType::CORNER)
121123
{
122124
j = i;
123125
distance0 = distance1;
124126
} // if
125-
} // if
126-
// If subchannel belongs to outer ring
127-
else
128-
{
129-
if ((distance1 < distance0) &&
130-
(_subch_type[i] == EChannelType::EDGE || _subch_type[i] == EChannelType::CORNER))
127+
else if ((x_coord_new <= x_lim && x_coord_new >= -x_lim) &&
128+
_subch_type[i] == EChannelType::EDGE)
131129
{
132-
if (((x_coord_new > x_lim) || (x_coord_new < -x_lim)) &&
133-
_subch_type[i] == EChannelType::CORNER)
134-
{
135-
j = i;
136-
distance0 = distance1;
137-
} // if
138-
else if (((x_coord_new > x_lim) || (x_coord_new > -x_lim)) &&
139-
_subch_type[i] == EChannelType::EDGE)
140-
{
141-
j = i;
142-
distance0 = distance1;
143-
}
130+
j = i;
131+
distance0 = distance1;
144132
}
145133
}
146134
}
@@ -205,7 +193,7 @@ TriSubChannelMesh::pinPositions(std::vector<Point> & positions,
205193
Real theta_corrected = 0.0;
206194
Real pi = libMesh::pi;
207195
unsigned int k = 0;
208-
positions.emplace_back(0.0, 0.0);
196+
positions.emplace_back(center(0), center(1));
209197
for (unsigned int i = 1; i < nrings; i++)
210198
{
211199
dtheta = 2.0 * pi / (i * 6);

modules/subchannel/src/meshgenerators/SCMDetailedTriAssemblyMeshGenerator.C

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ SCMDetailedTriAssemblyMeshGenerator::validParams()
2727
params.addParam<Real>("unheated_length_entry", 0.0, "Unheated length at entry [m]");
2828
params.addRequiredParam<Real>("heated_length", "Heated length [m]");
2929
params.addParam<Real>("unheated_length_exit", 0.0, "Unheated length at exit [m]");
30-
params.addRequiredParam<unsigned int>("nrings", "Number of fuel Pin rings per assembly [-]");
30+
params.addRequiredParam<unsigned int>(
31+
"nrings",
32+
"Number of fuel-pin rings per assembly, counting the center pin as the first ring [-]");
3133
params.addRequiredParam<Real>("flat_to_flat",
3234
"Flat to flat distance for the hexagonal assembly [m]");
3335
params.addRequiredParam<unsigned int>("n_cells", "The number of cells in the axial direction");
@@ -63,6 +65,11 @@ SCMDetailedTriAssemblyMeshGenerator::SCMDetailedTriAssemblyMeshGenerator(
6365
_verbose(getParam<bool>("verbose_flag")),
6466
_elem_id(0)
6567
{
68+
if (_n_rings < 2)
69+
mooseError(name(),
70+
": 'nrings' must be at least 2. In this mesh generator, the center pin counts as "
71+
"the first ring, so a 7-pin bundle uses nrings = 2.");
72+
6673
Real L = _unheated_length_entry + _heated_length + _unheated_length_exit;
6774
Real dz = L / _n_cells;
6875
for (unsigned int i = 0; i < _n_cells + 1; i++)
@@ -293,18 +300,6 @@ SCMDetailedTriAssemblyMeshGenerator::SCMDetailedTriAssemblyMeshGenerator(
293300
_subchannel_position[i][0] = (a2 * x1 - a1 * x0) / (a2 - a1);
294301
_subchannel_position[i][1] = (a2 * y1 - a1 * y0) / (a2 - a1);
295302
}
296-
297-
/// Special case _n_rings == 1
298-
if (_n_rings == 1)
299-
{
300-
for (unsigned int i = 0; i < _n_channels; i++)
301-
{
302-
Real angle = (2 * i + 1) * libMesh::pi / 6.0;
303-
_subch_type[i] = EChannelType::CORNER;
304-
_subchannel_position[i][0] = std::cos(angle) * _flat_to_flat / 2.0;
305-
_subchannel_position[i][1] = std::sin(angle) * _flat_to_flat / 2.0;
306-
}
307-
}
308303
}
309304
}
310305

@@ -399,19 +394,9 @@ SCMDetailedTriAssemblyMeshGenerator::generate()
399394
}
400395

401396
// specify number and type of sub-channel
402-
unsigned int n_center, n_side, n_corner;
403-
if (_n_rings == 1)
404-
{
405-
n_corner = 6;
406-
n_side = 0;
407-
n_center = _n_channels - n_side - n_corner;
408-
}
409-
else
410-
{
411-
n_corner = 6;
412-
n_side = (_n_rings - 1) * 6;
413-
n_center = _n_channels - n_side - n_corner;
414-
}
397+
unsigned int n_corner = 6;
398+
unsigned int n_side = (_n_rings - 1) * 6;
399+
unsigned int n_center = _n_channels - n_side - n_corner;
415400
if (_verbose)
416401
{
417402
_console << "Centers: " << n_center << std::endl;

modules/subchannel/src/meshgenerators/SCMTriAssemblyMeshGenerator.C

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ SCMTriAssemblyMeshGenerator::validParams()
2727
params.addParam<Real>("unheated_length_entry", 0.0, "Unheated length at entry [m]");
2828
params.addRequiredParam<Real>("heated_length", "Heated length [m]");
2929
params.addParam<Real>("unheated_length_exit", 0.0, "Unheated length at exit [m]");
30-
params.addRequiredParam<unsigned int>("nrings", "Number of fuel Pin rings per assembly [-]");
30+
params.addRequiredParam<unsigned int>(
31+
"nrings",
32+
"Number of fuel-pin rings per assembly, counting the center pin as the first ring [-]");
3133
params.addRequiredParam<Real>("flat_to_flat",
3234
"Flat to flat distance for the hexagonal assembly [m]");
3335
params.addRequiredParam<Real>("dwire", "Wire diameter [m]");
@@ -86,6 +88,11 @@ SCMTriAssemblyMeshGenerator::SCMTriAssemblyMeshGenerator(const InputParameters &
8688
_n_gaps(0),
8789
_elem_id(0)
8890
{
91+
if (_n_rings < 2)
92+
mooseError(name(),
93+
": 'nrings' must be at least 2. In this mesh generator, the center pin counts as "
94+
"the first ring, so a 7-pin bundle uses nrings = 2.");
95+
8996
if (_spacer_z.size() != _spacer_k.size())
9097
mooseError(name(), ": Size of vector spacer_z should be equal to size of vector spacer_k");
9198

@@ -739,18 +746,6 @@ SCMTriAssemblyMeshGenerator::SCMTriAssemblyMeshGenerator(const InputParameters &
739746
}
740747
}
741748

742-
/// Special case _n_rings == 1
743-
if (_n_rings == 1)
744-
{
745-
for (unsigned int i = 0; i < _n_channels; i++)
746-
{
747-
Real angle = (2 * i + 1) * libMesh::pi / 6.0;
748-
_subch_type[i] = EChannelType::CORNER;
749-
_subchannel_position[i][0] = std::cos(angle) * _flat_to_flat / 2.0;
750-
_subchannel_position[i][1] = std::sin(angle) * _flat_to_flat / 2.0;
751-
}
752-
}
753-
754749
// Reduce reserved memory in the channel-to-gap map.
755750
for (auto & gap : _chan_to_gap_map)
756751
{
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
time,center_S,center_w_perim,corner_S,corner_w_perim,edge_S,edge_w_perim
2+
0,0,0,0,0,0,0
3+
1,1.78771169811e-05,0.017645070068785,1.6955350355555e-05,0.014091834788374,4.3125203206028e-05,0.028871590068785
Binary file not shown.

0 commit comments

Comments
 (0)