pyvale 2025.5.3__cp311-cp311-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyvale might be problematic. Click here for more details.

Files changed (174) hide show
  1. pyvale/__init__.py +89 -0
  2. pyvale/analyticmeshgen.py +102 -0
  3. pyvale/analyticsimdatafactory.py +91 -0
  4. pyvale/analyticsimdatagenerator.py +323 -0
  5. pyvale/blendercalibrationdata.py +15 -0
  6. pyvale/blenderlightdata.py +26 -0
  7. pyvale/blendermaterialdata.py +15 -0
  8. pyvale/blenderrenderdata.py +30 -0
  9. pyvale/blenderscene.py +488 -0
  10. pyvale/blendertools.py +420 -0
  11. pyvale/camera.py +146 -0
  12. pyvale/cameradata.py +69 -0
  13. pyvale/cameradata2d.py +84 -0
  14. pyvale/camerastereo.py +217 -0
  15. pyvale/cameratools.py +522 -0
  16. pyvale/cython/rastercyth.c +32211 -0
  17. pyvale/cython/rastercyth.cp311-win32.pyd +0 -0
  18. pyvale/cython/rastercyth.py +640 -0
  19. pyvale/data/__init__.py +5 -0
  20. pyvale/data/cal_target.tiff +0 -0
  21. pyvale/data/case00_HEX20_out.e +0 -0
  22. pyvale/data/case00_HEX27_out.e +0 -0
  23. pyvale/data/case00_HEX8_out.e +0 -0
  24. pyvale/data/case00_TET10_out.e +0 -0
  25. pyvale/data/case00_TET14_out.e +0 -0
  26. pyvale/data/case00_TET4_out.e +0 -0
  27. pyvale/data/case13_out.e +0 -0
  28. pyvale/data/case16_out.e +0 -0
  29. pyvale/data/case17_out.e +0 -0
  30. pyvale/data/case18_1_out.e +0 -0
  31. pyvale/data/case18_2_out.e +0 -0
  32. pyvale/data/case18_3_out.e +0 -0
  33. pyvale/data/case25_out.e +0 -0
  34. pyvale/data/case26_out.e +0 -0
  35. pyvale/data/optspeckle_2464x2056px_spec5px_8bit_gblur1px.tiff +0 -0
  36. pyvale/dataset.py +325 -0
  37. pyvale/errorcalculator.py +109 -0
  38. pyvale/errordriftcalc.py +146 -0
  39. pyvale/errorintegrator.py +336 -0
  40. pyvale/errorrand.py +607 -0
  41. pyvale/errorsyscalib.py +134 -0
  42. pyvale/errorsysdep.py +327 -0
  43. pyvale/errorsysfield.py +414 -0
  44. pyvale/errorsysindep.py +808 -0
  45. pyvale/examples/__init__.py +5 -0
  46. pyvale/examples/basics/ex1_1_basicscalars_therm2d.py +131 -0
  47. pyvale/examples/basics/ex1_2_sensormodel_therm2d.py +158 -0
  48. pyvale/examples/basics/ex1_3_customsens_therm3d.py +216 -0
  49. pyvale/examples/basics/ex1_4_basicerrors_therm3d.py +153 -0
  50. pyvale/examples/basics/ex1_5_fielderrs_therm3d.py +168 -0
  51. pyvale/examples/basics/ex1_6_caliberrs_therm2d.py +133 -0
  52. pyvale/examples/basics/ex1_7_spatavg_therm2d.py +123 -0
  53. pyvale/examples/basics/ex2_1_basicvectors_disp2d.py +112 -0
  54. pyvale/examples/basics/ex2_2_vectorsens_disp2d.py +111 -0
  55. pyvale/examples/basics/ex2_3_sensangle_disp2d.py +139 -0
  56. pyvale/examples/basics/ex2_4_chainfielderrs_disp2d.py +196 -0
  57. pyvale/examples/basics/ex2_5_vectorfields3d_disp3d.py +109 -0
  58. pyvale/examples/basics/ex3_1_basictensors_strain2d.py +114 -0
  59. pyvale/examples/basics/ex3_2_tensorsens2d_strain2d.py +111 -0
  60. pyvale/examples/basics/ex3_3_tensorsens3d_strain3d.py +182 -0
  61. pyvale/examples/basics/ex4_1_expsim2d_thermmech2d.py +171 -0
  62. pyvale/examples/basics/ex4_2_expsim3d_thermmech3d.py +252 -0
  63. pyvale/examples/genanalyticdata/ex1_1_scalarvisualisation.py +35 -0
  64. pyvale/examples/genanalyticdata/ex1_2_scalarcasebuild.py +43 -0
  65. pyvale/examples/genanalyticdata/ex2_1_analyticsensors.py +80 -0
  66. pyvale/examples/imagedef2d/ex_imagedef2d_todisk.py +79 -0
  67. pyvale/examples/renderblender/ex1_1_blenderscene.py +121 -0
  68. pyvale/examples/renderblender/ex1_2_blenderdeformed.py +119 -0
  69. pyvale/examples/renderblender/ex2_1_stereoscene.py +128 -0
  70. pyvale/examples/renderblender/ex2_2_stereodeformed.py +131 -0
  71. pyvale/examples/renderblender/ex3_1_blendercalibration.py +120 -0
  72. pyvale/examples/renderrasterisation/ex_rastenp.py +153 -0
  73. pyvale/examples/renderrasterisation/ex_rastercyth_oneframe.py +218 -0
  74. pyvale/examples/renderrasterisation/ex_rastercyth_static_cypara.py +187 -0
  75. pyvale/examples/renderrasterisation/ex_rastercyth_static_pypara.py +190 -0
  76. pyvale/examples/visualisation/ex1_1_plot_traces.py +102 -0
  77. pyvale/examples/visualisation/ex2_1_animate_sim.py +89 -0
  78. pyvale/experimentsimulator.py +175 -0
  79. pyvale/field.py +128 -0
  80. pyvale/fieldconverter.py +351 -0
  81. pyvale/fieldsampler.py +111 -0
  82. pyvale/fieldscalar.py +166 -0
  83. pyvale/fieldtensor.py +218 -0
  84. pyvale/fieldtransform.py +388 -0
  85. pyvale/fieldvector.py +213 -0
  86. pyvale/generatorsrandom.py +505 -0
  87. pyvale/imagedef2d.py +569 -0
  88. pyvale/integratorfactory.py +240 -0
  89. pyvale/integratorquadrature.py +217 -0
  90. pyvale/integratorrectangle.py +165 -0
  91. pyvale/integratorspatial.py +89 -0
  92. pyvale/integratortype.py +43 -0
  93. pyvale/output.py +17 -0
  94. pyvale/pyvaleexceptions.py +11 -0
  95. pyvale/raster.py +31 -0
  96. pyvale/rastercy.py +77 -0
  97. pyvale/rasternp.py +603 -0
  98. pyvale/rendermesh.py +147 -0
  99. pyvale/sensorarray.py +178 -0
  100. pyvale/sensorarrayfactory.py +196 -0
  101. pyvale/sensorarraypoint.py +278 -0
  102. pyvale/sensordata.py +71 -0
  103. pyvale/sensordescriptor.py +213 -0
  104. pyvale/sensortools.py +142 -0
  105. pyvale/simcases/case00_HEX20.i +242 -0
  106. pyvale/simcases/case00_HEX27.i +242 -0
  107. pyvale/simcases/case00_HEX8.i +242 -0
  108. pyvale/simcases/case00_TET10.i +242 -0
  109. pyvale/simcases/case00_TET14.i +242 -0
  110. pyvale/simcases/case00_TET4.i +242 -0
  111. pyvale/simcases/case01.i +101 -0
  112. pyvale/simcases/case02.i +156 -0
  113. pyvale/simcases/case03.i +136 -0
  114. pyvale/simcases/case04.i +181 -0
  115. pyvale/simcases/case05.i +234 -0
  116. pyvale/simcases/case06.i +305 -0
  117. pyvale/simcases/case07.geo +135 -0
  118. pyvale/simcases/case07.i +87 -0
  119. pyvale/simcases/case08.geo +144 -0
  120. pyvale/simcases/case08.i +153 -0
  121. pyvale/simcases/case09.geo +204 -0
  122. pyvale/simcases/case09.i +87 -0
  123. pyvale/simcases/case10.geo +204 -0
  124. pyvale/simcases/case10.i +257 -0
  125. pyvale/simcases/case11.geo +337 -0
  126. pyvale/simcases/case11.i +147 -0
  127. pyvale/simcases/case12.geo +388 -0
  128. pyvale/simcases/case12.i +329 -0
  129. pyvale/simcases/case13.i +140 -0
  130. pyvale/simcases/case14.i +159 -0
  131. pyvale/simcases/case15.geo +337 -0
  132. pyvale/simcases/case15.i +150 -0
  133. pyvale/simcases/case16.geo +391 -0
  134. pyvale/simcases/case16.i +357 -0
  135. pyvale/simcases/case17.geo +135 -0
  136. pyvale/simcases/case17.i +144 -0
  137. pyvale/simcases/case18.i +254 -0
  138. pyvale/simcases/case18_1.i +254 -0
  139. pyvale/simcases/case18_2.i +254 -0
  140. pyvale/simcases/case18_3.i +254 -0
  141. pyvale/simcases/case19.geo +252 -0
  142. pyvale/simcases/case19.i +99 -0
  143. pyvale/simcases/case20.geo +252 -0
  144. pyvale/simcases/case20.i +250 -0
  145. pyvale/simcases/case21.geo +74 -0
  146. pyvale/simcases/case21.i +155 -0
  147. pyvale/simcases/case22.geo +82 -0
  148. pyvale/simcases/case22.i +140 -0
  149. pyvale/simcases/case23.geo +164 -0
  150. pyvale/simcases/case23.i +140 -0
  151. pyvale/simcases/case24.geo +79 -0
  152. pyvale/simcases/case24.i +123 -0
  153. pyvale/simcases/case25.geo +82 -0
  154. pyvale/simcases/case25.i +140 -0
  155. pyvale/simcases/case26.geo +166 -0
  156. pyvale/simcases/case26.i +140 -0
  157. pyvale/simcases/run_1case.py +61 -0
  158. pyvale/simcases/run_all_cases.py +69 -0
  159. pyvale/simcases/run_build_case.py +64 -0
  160. pyvale/simcases/run_example_cases.py +69 -0
  161. pyvale/simtools.py +67 -0
  162. pyvale/visualexpplotter.py +191 -0
  163. pyvale/visualimagedef.py +74 -0
  164. pyvale/visualimages.py +76 -0
  165. pyvale/visualopts.py +493 -0
  166. pyvale/visualsimanimator.py +111 -0
  167. pyvale/visualsimsensors.py +318 -0
  168. pyvale/visualtools.py +136 -0
  169. pyvale/visualtraceplotter.py +142 -0
  170. pyvale-2025.5.3.dist-info/METADATA +144 -0
  171. pyvale-2025.5.3.dist-info/RECORD +174 -0
  172. pyvale-2025.5.3.dist-info/WHEEL +5 -0
  173. pyvale-2025.5.3.dist-info/licenses/LICENSE +21 -0
  174. pyvale-2025.5.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,204 @@
1
+ //==============================================================================
2
+ // Gmsh 3D simple test case divertor armour mock-up
3
+ // author: Lloyd Fletcher (scepticalrabbit)
4
+ //==============================================================================
5
+ // Always set to OpenCASCADE - circles and boolean opts are much easier!
6
+ SetFactory("OpenCASCADE");
7
+
8
+ // Allows gmsh to print to terminal in vscode - easier debugging
9
+ General.Terminal = 1;
10
+
11
+ // View options - not required when
12
+ Geometry.PointLabels = 1;
13
+ Geometry.CurveLabels = 1;
14
+ Geometry.SurfaceLabels = 0;
15
+ Geometry.VolumeLabels = 0;
16
+
17
+ //------------------------------------------------------------------------------
18
+ // Variables
19
+ file_name = "case09.msh";
20
+
21
+ // Geometric variables
22
+ block_width = 25e-3;
23
+ block_height = block_width+8e-3; // Must be greater than plate width
24
+ block_depth= 50e-3;
25
+ block_diff = block_height-block_width;
26
+
27
+ hole_rad = 6e-3;
28
+ hole_loc_x = 0.0;
29
+ hole_loc_y = block_width/2;
30
+ hole_circ = 2*Pi*hole_rad;
31
+
32
+ // Mesh variables
33
+ mesh_ref = 1;
34
+ hole_sect_nodes = 5*mesh_ref; // Must be odd
35
+ block_rad_nodes = 5*mesh_ref;
36
+ block_diff_nodes = 5*mesh_ref; // numbers of nodes along the rectangular extension
37
+ block_halfdepth_divs = 2*mesh_ref;
38
+
39
+ block_edge_nodes = Floor((hole_sect_nodes-1)/2)+1;
40
+ elem_size = hole_circ/(4*(hole_sect_nodes-1));
41
+ tol = elem_size/4; // Used for bounding box selection tolerance
42
+
43
+ //------------------------------------------------------------------------------
44
+ // Geometry Definition
45
+ // Split block into six pieces with a square around the hole to allow spider
46
+ // web meshing around the hole
47
+
48
+ // 4 squares around the hole center
49
+ s1 = news;
50
+ Rectangle(s1) = {-block_width/2,0.0,0.0,
51
+ block_width/2,block_width/2};
52
+ s2 = news;
53
+ Rectangle(s2) = {0.0,0.0,0.0,
54
+ block_width/2,block_width/2};
55
+
56
+ s3 = news;
57
+ Rectangle(s3) = {-block_width/2,block_width/2,0.0,
58
+ block_width/2,block_width/2};
59
+ s4 = news;
60
+ Rectangle(s4) = {0.0,block_width/2,0.0,
61
+ block_width/2,block_width/2};
62
+
63
+ // Two rectangles above the hole (armour)
64
+ s5 = news;
65
+ Rectangle(s5) = {-block_width/2,block_width,0.0,
66
+ block_width/2,block_diff};
67
+ s6 = news;
68
+ Rectangle(s6) = {0.0,block_width,0.0,
69
+ block_width/2,block_diff};
70
+
71
+ // Merge coincicent edges of the four overlapping squares
72
+ BooleanFragments{ Surface{s1}; Delete; }
73
+ { Surface{s2,s3,s4,s5,s6}; Delete; }
74
+
75
+
76
+ // Create the hole surface
77
+ c2 = newc; Circle(c2) = {hole_loc_x,hole_loc_y,0.0,hole_rad};
78
+ cl2 = newcl; Curve Loop(cl2) = {c2};
79
+ s9 = news; Plane Surface(s9) = {cl2};
80
+ // Bore out the hole from the quarters of the plate
81
+ BooleanDifference{ Surface{s1,s2,s3,s4}; Delete; }{ Surface{s9}; Delete; }
82
+
83
+ //------------------------------------------------------------------------------
84
+ // Transfinite meshing (line element sizes and mapped meshing)
85
+ // Line sizing
86
+ Transfinite Curve{21,24,28,19} = block_rad_nodes;
87
+ Transfinite Curve{22,26,25,31,12,9,27,18,14,17} = block_edge_nodes;
88
+ Transfinite Curve{20,23,30,29} = hole_sect_nodes;
89
+ Transfinite Curve{15,13,16} = block_diff_nodes;
90
+
91
+ // Spider web mesh around the 4 quadrants of the hole
92
+ Transfinite Surface{s1} = {17,16,15,13};
93
+ Recombine Surface{s1};
94
+ Transfinite Surface{s2} = {17,16,18,19};
95
+ Recombine Surface{s2};
96
+ Transfinite Surface{s3} = {13,15,21,7};
97
+ Recombine Surface{s3};
98
+ Transfinite Surface{s4} = {21,18,19,7};
99
+ Recombine Surface{s4};
100
+
101
+ // Mesh the armour
102
+ Transfinite Surface{s5} = {8,7,10,11};
103
+ Recombine Surface{s5};
104
+ Transfinite Surface{s6} = {7,9,10,12};
105
+ Recombine Surface{s6};
106
+
107
+ //------------------------------------------------------------------------------
108
+ // Extrude the surface mesh to 3D
109
+ // Extrude only hlafway and then extrude again to allow BCs on the centre line
110
+ Extrude{0.0,0.0,block_depth/2}{
111
+ Surface{:}; Layers{block_halfdepth_divs}; Recombine;
112
+ }
113
+
114
+ es1() = Surface In BoundingBox{
115
+ -block_width/2-tol,0.0-tol,block_depth/2-tol,
116
+ block_width/2+tol,block_height+tol,block_depth/2+tol};
117
+
118
+ Extrude{0.0,0.0,block_depth/2}{
119
+ Surface{es1(0),es1(1),es1(2),es1(3),es1(4),es1(5)};
120
+ Layers{block_halfdepth_divs}; Recombine;
121
+ }
122
+
123
+ //------------------------------------------------------------------------------
124
+ // Physical surfaces and volumes for export/BCs
125
+ Physical Volume("stc-vol") = {Volume{:}};
126
+
127
+ // Physical surface for mechanical BC for dispy - like sitting on a flat surface
128
+ ps1() = Surface In BoundingBox{
129
+ -block_width/2-tol,0.0-tol,0.0-tol,
130
+ block_width/2+tol,0.0+tol,block_depth+tol};
131
+ Physical Surface("bc-base-disp") = {ps1(0),ps1(1),ps1(2),ps1(3)};
132
+
133
+ // thermal BCs for top surface heat flux and pipe htc
134
+ ps2() = Surface In BoundingBox{
135
+ -block_width/2-tol,block_height-tol,0.0-tol,
136
+ block_width/2+tol,block_height+tol,block_depth+tol};
137
+ Physical Surface("bc-top-heatflux") = {ps2(0),ps2(1),ps2(2),ps2(3)};
138
+
139
+ ps3() = Surface In BoundingBox{
140
+ -hole_rad-tol,block_width/2-hole_rad-tol,0.0-tol,
141
+ hole_rad+tol,block_width/2+hole_rad+tol,block_depth+tol};
142
+ Physical Surface("bc-pipe-htc") = {ps3(0),ps3(1),ps3(2),ps3(3),ps3(4),ps3(5),ps3(6),ps3(7)};
143
+
144
+ // These don't work in MOOSE because of how it handles 3D meshes from Gmsh
145
+ // See: https://github.com/idaholab/moose/discussions/27607
146
+ /*
147
+ pc1() = Curve In BoundingBox{
148
+ -tol,-tol,-tol,
149
+ +tol,+tol,block_depth+tol};
150
+ Physical Curve("bc-curve-xy-mech") = {pc1(0)};
151
+
152
+ pc2() = Curve In BoundingBox{
153
+ -block_width/2-tol,-tol,-tol,
154
+ block_width/2+tol,+tol,+tol};
155
+ Physical Curve("bc-curve-yz-mech") = {pc2(0),pc2(1)};
156
+ */
157
+
158
+ // Physical points for applying mechanical BCs
159
+ // Center of the base of the block - lock all DOFs
160
+ pp0() = Point In BoundingBox{
161
+ -tol,-tol,block_depth/2-tol,
162
+ +tol,+tol,block_depth/2+tol};
163
+ Physical Point("bc-c-point-xyz-mech") = {pp0(0)};
164
+
165
+ // Left and right on the base center line
166
+ pp1() = Point In BoundingBox{
167
+ -block_width/2-tol,-tol,block_depth/2-tol,
168
+ -block_width/2+tol,+tol,block_depth/2+tol};
169
+ Physical Point("bc-l-point-yz-mech") = {pp1(0)};
170
+
171
+ pp2() = Point In BoundingBox{
172
+ block_width/2-tol,-tol,block_depth/2-tol,
173
+ block_width/2+tol,+tol,block_depth/2+tol};
174
+ Physical Point("bc-r-point-yz-mech") = {pp2(0)};
175
+
176
+ // Front and back on the base center line
177
+ pp3() = Point In BoundingBox{
178
+ -tol,-tol,block_depth-tol,
179
+ +tol,+tol,block_depth+tol};
180
+ Physical Point("bc-f-point-xy-mech") = {pp3(0)};
181
+
182
+ pp4() = Point In BoundingBox{
183
+ -tol,-tol,0.0-tol,
184
+ +tol,+tol,0.0+tol};
185
+ Physical Point("bc-b-point-xy-mech") = {pp4(0)};
186
+
187
+ //------------------------------------------------------------------------------
188
+ // Global meshing
189
+ Mesh.Algorithm = 6;
190
+ Mesh.Algorithm3D = 10;
191
+
192
+ num_threads = 4;
193
+ General.NumThreads = num_threads;
194
+ Mesh.MaxNumThreads1D = num_threads;
195
+ Mesh.MaxNumThreads2D = num_threads;
196
+ Mesh.MaxNumThreads3D = num_threads;
197
+
198
+ Mesh.ElementOrder = 2;
199
+ Mesh 3;
200
+
201
+ //------------------------------------------------------------------------------
202
+ // Save and exit
203
+ Save Str(file_name);
204
+ Exit;
@@ -0,0 +1,87 @@
1
+ #-------------------------------------------------------------------------
2
+ # pyvale: gmsh,3Dstc,1mat,thermal,steady,
3
+ #-------------------------------------------------------------------------
4
+
5
+ #-------------------------------------------------------------------------
6
+ #_* MOOSEHERDER VARIABLES - START
7
+
8
+ # Thermal Loads/BCs
9
+ coolantTemp = 100.0 # degC
10
+ heatTransCoeff = 125.0e3 # W.m^-2.K^-1
11
+ surfHeatFlux = 5.0e6 # W.m^-2
12
+
13
+ # Material Properties: Pure (OFHC) Copper at 250degC
14
+ cuDensity = 8829.0 # kg.m^-3
15
+ cuThermCond = 384.0 # W.m^-1.K^-1
16
+ cuSpecHeat = 406.0 # J.kg^-1.K^-1
17
+
18
+ #** MOOSEHERDER VARIABLES - END
19
+ #-------------------------------------------------------------------------
20
+
21
+ [Mesh]
22
+ type = FileMesh
23
+ file = 'case09.msh'
24
+ []
25
+
26
+ [Variables]
27
+ [temperature]
28
+ initial_condition = ${coolantTemp}
29
+ []
30
+ []
31
+
32
+ [Kernels]
33
+ [heat_conduction]
34
+ type = HeatConduction
35
+ variable = temperature
36
+ []
37
+ []
38
+
39
+ [Materials]
40
+ [copper_thermal]
41
+ type = HeatConductionMaterial
42
+ thermal_conductivity = ${cuThermCond}
43
+ specific_heat = ${cuSpecHeat}
44
+ []
45
+ [copper_density]
46
+ type = GenericConstantMaterial
47
+ prop_names = 'density'
48
+ prop_values = ${cuDensity}
49
+ []
50
+ []
51
+
52
+ [BCs]
53
+ [heat_flux_out]
54
+ type = ConvectiveHeatFluxBC
55
+ variable = temperature
56
+ boundary = 'bc-pipe-htc'
57
+ T_infinity = ${coolantTemp}
58
+ heat_transfer_coefficient = ${heatTransCoeff}
59
+ []
60
+ [heat_flux_in]
61
+ type = NeumannBC
62
+ variable = temperature
63
+ boundary = 'bc-top-heatflux'
64
+ value = ${surfHeatFlux}
65
+ []
66
+ []
67
+
68
+ [Executioner]
69
+ type = Steady
70
+ #end_time= ${endTime}
71
+ #dt = ${timeStep}
72
+ []
73
+
74
+ [Postprocessors]
75
+ [max_temp]
76
+ type = NodalExtremeValue
77
+ variable = temperature
78
+ []
79
+ [avg_temp]
80
+ type = AverageNodalVariableValue
81
+ variable = temperature
82
+ []
83
+ []
84
+
85
+ [Outputs]
86
+ exodus = true
87
+ []
@@ -0,0 +1,204 @@
1
+ //==============================================================================
2
+ // Gmsh 3D simple test case divertor armour mock-up
3
+ // author: Lloyd Fletcher (scepticalrabbit)
4
+ //==============================================================================
5
+ // Always set to OpenCASCADE - circles and boolean opts are much easier!
6
+ SetFactory("OpenCASCADE");
7
+
8
+ // Allows gmsh to print to terminal in vscode - easier debugging
9
+ General.Terminal = 1;
10
+
11
+ // View options - not required when
12
+ Geometry.PointLabels = 1;
13
+ Geometry.CurveLabels = 1;
14
+ Geometry.SurfaceLabels = 0;
15
+ Geometry.VolumeLabels = 0;
16
+
17
+ //------------------------------------------------------------------------------
18
+ // Variables
19
+ file_name = "case10.msh";
20
+
21
+ // Geometric variables
22
+ block_width = 37e-3;
23
+ block_height = 35e-3; // Must be greater than plate width
24
+ block_depth= 49.5e-3;
25
+ block_armour = 8e-3;
26
+
27
+ hole_rad = 6e-3;
28
+ hole_loc_x = 0.0;
29
+ hole_loc_y = block_width/2;
30
+ hole_circ = 2*Pi*hole_rad;
31
+
32
+ // Mesh variables
33
+ mesh_ref = 1;
34
+ hole_sect_nodes = 5*mesh_ref; // Must be odd
35
+ block_rad_nodes = 5*mesh_ref;
36
+ block_armour_nodes = 5*mesh_ref; // numbers of nodes along the rectangular extension
37
+ block_halfdepth_divs = 2*mesh_ref;
38
+
39
+ block_edge_nodes = Floor((hole_sect_nodes-1)/2)+1;
40
+ elem_size = hole_circ/(4*(hole_sect_nodes-1));
41
+ tol = elem_size/4; // Used for bounding box selection tolerance
42
+
43
+ //------------------------------------------------------------------------------
44
+ // Geometry Definition
45
+ // Split block into six pieces with a square around the hole to allow spider
46
+ // web meshing around the hole
47
+
48
+ // 4 squares around the hole center
49
+ s1 = news;
50
+ Rectangle(s1) = {-block_width/2,0.0,0.0,
51
+ block_width/2,block_width/2};
52
+ s2 = news;
53
+ Rectangle(s2) = {0.0,0.0,0.0,
54
+ block_width/2,block_width/2};
55
+
56
+ s3 = news;
57
+ Rectangle(s3) = {-block_width/2,block_width/2,0.0,
58
+ block_width/2,block_width/2};
59
+ s4 = news;
60
+ Rectangle(s4) = {0.0,block_width/2,0.0,
61
+ block_width/2,block_width/2};
62
+
63
+ // Two rectangles above the hole (armour)
64
+ s5 = news;
65
+ Rectangle(s5) = {-block_width/2,block_width,0.0,
66
+ block_width/2,block_armour};
67
+ s6 = news;
68
+ Rectangle(s6) = {0.0,block_width,0.0,
69
+ block_width/2,block_armour};
70
+
71
+ // Merge coincicent edges of the four overlapping squares
72
+ BooleanFragments{ Surface{s1}; Delete; }
73
+ { Surface{s2,s3,s4,s5,s6}; Delete; }
74
+
75
+
76
+ // Create the hole surface
77
+ c2 = newc; Circle(c2) = {hole_loc_x,hole_loc_y,0.0,hole_rad};
78
+ cl2 = newcl; Curve Loop(cl2) = {c2};
79
+ s9 = news; Plane Surface(s9) = {cl2};
80
+ // Bore out the hole from the quarters of the plate
81
+ BooleanDifference{ Surface{s1,s2,s3,s4}; Delete; }{ Surface{s9}; Delete; }
82
+
83
+ //------------------------------------------------------------------------------
84
+ // Transfinite meshing (line element sizes and mapped meshing)
85
+ // Line sizing
86
+ Transfinite Curve{21,24,28,19} = block_rad_nodes;
87
+ Transfinite Curve{22,26,25,31,12,9,27,18,14,17} = block_edge_nodes;
88
+ Transfinite Curve{20,23,30,29} = hole_sect_nodes;
89
+ Transfinite Curve{15,13,16} = block_armour_nodes;
90
+
91
+ // Spider web mesh around the 4 quadrants of the hole
92
+ Transfinite Surface{s1} = {17,16,15,13};
93
+ Recombine Surface{s1};
94
+ Transfinite Surface{s2} = {17,16,18,19};
95
+ Recombine Surface{s2};
96
+ Transfinite Surface{s3} = {13,15,21,7};
97
+ Recombine Surface{s3};
98
+ Transfinite Surface{s4} = {21,18,19,7};
99
+ Recombine Surface{s4};
100
+
101
+ // Mesh the armour
102
+ Transfinite Surface{s5} = {8,7,10,11};
103
+ Recombine Surface{s5};
104
+ Transfinite Surface{s6} = {7,9,10,12};
105
+ Recombine Surface{s6};
106
+
107
+ //------------------------------------------------------------------------------
108
+ // Extrude the surface mesh to 3D
109
+ // Extrude only hlafway and then extrude again to allow BCs on the centre line
110
+ Extrude{0.0,0.0,block_depth/2}{
111
+ Surface{:}; Layers{block_halfdepth_divs}; Recombine;
112
+ }
113
+
114
+ es1() = Surface In BoundingBox{
115
+ -block_width/2-tol,0.0-tol,block_depth/2-tol,
116
+ block_width/2+tol,block_height+tol,block_depth/2+tol};
117
+
118
+ Extrude{0.0,0.0,block_depth/2}{
119
+ Surface{es1(0),es1(1),es1(2),es1(3),es1(4),es1(5)};
120
+ Layers{block_halfdepth_divs}; Recombine;
121
+ }
122
+
123
+ //------------------------------------------------------------------------------
124
+ // Physical surfaces and volumes for export/BCs
125
+ Physical Volume("stc-vol") = {Volume{:}};
126
+
127
+ // Physical surface for mechanical BC for dispy - like sitting on a flat surface
128
+ ps1() = Surface In BoundingBox{
129
+ -block_width/2-tol,0.0-tol,0.0-tol,
130
+ block_width/2+tol,0.0+tol,block_depth+tol};
131
+ Physical Surface("bc-base-disp") = {ps1(0),ps1(1),ps1(2),ps1(3)};
132
+
133
+ // thermal BCs for top surface heat flux and pipe htc
134
+ ps2() = Surface In BoundingBox{
135
+ -block_width/2-tol,block_height-tol,0.0-tol,
136
+ block_width/2+tol,block_height+tol,block_depth+tol};
137
+ Physical Surface("bc-top-heatflux") = {ps2(0),ps2(1),ps2(2),ps2(3)};
138
+
139
+ ps3() = Surface In BoundingBox{
140
+ -hole_rad-tol,block_width/2-hole_rad-tol,0.0-tol,
141
+ hole_rad+tol,block_width/2+hole_rad+tol,block_depth+tol};
142
+ Physical Surface("bc-pipe-htc") = {ps3(0),ps3(1),ps3(2),ps3(3),ps3(4),ps3(5),ps3(6),ps3(7)};
143
+
144
+ // These don't work in MOOSE because of how it handles 3D meshes from Gmsh
145
+ // See: https://github.com/idaholab/moose/discussions/27607
146
+ /*
147
+ pc1() = Curve In BoundingBox{
148
+ -tol,-tol,-tol,
149
+ +tol,+tol,block_depth+tol};
150
+ Physical Curve("bc-curve-xy-mech") = {pc1(0)};
151
+
152
+ pc2() = Curve In BoundingBox{
153
+ -block_width/2-tol,-tol,-tol,
154
+ block_width/2+tol,+tol,+tol};
155
+ Physical Curve("bc-curve-yz-mech") = {pc2(0),pc2(1)};
156
+ */
157
+
158
+ // Physical points for applying mechanical BCs
159
+ // Center of the base of the block - lock all DOFs
160
+ pp0() = Point In BoundingBox{
161
+ -tol,-tol,block_depth/2-tol,
162
+ +tol,+tol,block_depth/2+tol};
163
+ Physical Point("bc-c-point-xyz-mech") = {pp0(0)};
164
+
165
+ // Left and right on the base center line
166
+ pp1() = Point In BoundingBox{
167
+ -block_width/2-tol,-tol,block_depth/2-tol,
168
+ -block_width/2+tol,+tol,block_depth/2+tol};
169
+ Physical Point("bc-l-point-yz-mech") = {pp1(0)};
170
+
171
+ pp2() = Point In BoundingBox{
172
+ block_width/2-tol,-tol,block_depth/2-tol,
173
+ block_width/2+tol,+tol,block_depth/2+tol};
174
+ Physical Point("bc-r-point-yz-mech") = {pp2(0)};
175
+
176
+ // Front and back on the base center line
177
+ pp3() = Point In BoundingBox{
178
+ -tol,-tol,block_depth-tol,
179
+ +tol,+tol,block_depth+tol};
180
+ Physical Point("bc-f-point-xy-mech") = {pp3(0)};
181
+
182
+ pp4() = Point In BoundingBox{
183
+ -tol,-tol,0.0-tol,
184
+ +tol,+tol,0.0+tol};
185
+ Physical Point("bc-b-point-xy-mech") = {pp4(0)};
186
+
187
+ //------------------------------------------------------------------------------
188
+ // Global meshing
189
+ Mesh.Algorithm = 6;
190
+ Mesh.Algorithm3D = 10;
191
+
192
+ num_threads = 4;
193
+ General.NumThreads = num_threads;
194
+ Mesh.MaxNumThreads1D = num_threads;
195
+ Mesh.MaxNumThreads2D = num_threads;
196
+ Mesh.MaxNumThreads3D = num_threads;
197
+
198
+ Mesh.ElementOrder = 2;
199
+ Mesh 3;
200
+
201
+ //------------------------------------------------------------------------------
202
+ // Save and exit
203
+ Save Str(file_name);
204
+ Exit;