pyvale 2025.7.1__cp311-cp311-win32.whl → 2025.8.1__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 (186) hide show
  1. pyvale/__init__.py +12 -92
  2. pyvale/blender/__init__.py +23 -0
  3. pyvale/{pyvaleexceptions.py → blender/blenderexceptions.py} +0 -3
  4. pyvale/{blenderlightdata.py → blender/blenderlightdata.py} +3 -3
  5. pyvale/{blendermaterialdata.py → blender/blendermaterialdata.py} +1 -1
  6. pyvale/{blenderrenderdata.py → blender/blenderrenderdata.py} +5 -3
  7. pyvale/{blenderscene.py → blender/blenderscene.py} +33 -30
  8. pyvale/{blendertools.py → blender/blendertools.py} +14 -10
  9. pyvale/dataset/__init__.py +7 -0
  10. pyvale/dataset/dataset.py +443 -0
  11. pyvale/dic/__init__.py +20 -0
  12. pyvale/dic/cpp/dicfourier.cpp +36 -4
  13. pyvale/dic/cpp/dicinterpolator.cpp +56 -1
  14. pyvale/dic/cpp/dicmain.cpp +24 -19
  15. pyvale/dic/cpp/dicoptimizer.cpp +6 -1
  16. pyvale/dic/cpp/dicscanmethod.cpp +32 -32
  17. pyvale/dic/cpp/dicsignalhandler.cpp +16 -0
  18. pyvale/dic/cpp/dicstrain.cpp +7 -3
  19. pyvale/dic/cpp/dicutil.cpp +79 -23
  20. pyvale/{dic2d.py → dic/dic2d.py} +51 -29
  21. pyvale/dic/dic2dconv.py +6 -0
  22. pyvale/dic/dic2dcpp.cp311-win32.pyd +0 -0
  23. pyvale/{dicchecks.py → dic/dicchecks.py} +28 -16
  24. pyvale/dic/dicdataimport.py +370 -0
  25. pyvale/{dicregionofinterest.py → dic/dicregionofinterest.py} +169 -12
  26. pyvale/{dicresults.py → dic/dicresults.py} +4 -1
  27. pyvale/{dicstrain.py → dic/dicstrain.py} +9 -9
  28. pyvale/examples/basics/{ex1_1_basicscalars_therm2d.py → ex1a_basicscalars_therm2d.py} +12 -9
  29. pyvale/examples/basics/{ex1_2_sensormodel_therm2d.py → ex1b_sensormodel_therm2d.py} +17 -14
  30. pyvale/examples/basics/{ex1_3_customsens_therm3d.py → ex1c_customsens_therm3d.py} +27 -24
  31. pyvale/examples/basics/{ex1_4_basicerrors_therm3d.py → ex1d_basicerrors_therm3d.py} +32 -29
  32. pyvale/examples/basics/{ex1_5_fielderrs_therm3d.py → ex1e_fielderrs_therm3d.py} +19 -15
  33. pyvale/examples/basics/{ex1_6_caliberrs_therm2d.py → ex1f_caliberrs_therm2d.py} +20 -16
  34. pyvale/examples/basics/{ex1_7_spatavg_therm2d.py → ex1g_spatavg_therm2d.py} +19 -16
  35. pyvale/examples/basics/{ex2_1_basicvectors_disp2d.py → ex2a_basicvectors_disp2d.py} +13 -10
  36. pyvale/examples/basics/{ex2_2_vectorsens_disp2d.py → ex2b_vectorsens_disp2d.py} +19 -15
  37. pyvale/examples/basics/{ex2_3_sensangle_disp2d.py → ex2c_sensangle_disp2d.py} +21 -18
  38. pyvale/examples/basics/{ex2_4_chainfielderrs_disp2d.py → ex2d_chainfielderrs_disp2d.py} +31 -29
  39. pyvale/examples/basics/{ex2_5_vectorfields3d_disp3d.py → ex2e_vectorfields3d_disp3d.py} +21 -18
  40. pyvale/examples/basics/{ex3_1_basictensors_strain2d.py → ex3a_basictensors_strain2d.py} +16 -14
  41. pyvale/examples/basics/{ex3_2_tensorsens2d_strain2d.py → ex3b_tensorsens2d_strain2d.py} +17 -14
  42. pyvale/examples/basics/{ex3_3_tensorsens3d_strain3d.py → ex3c_tensorsens3d_strain3d.py} +25 -22
  43. pyvale/examples/basics/{ex4_1_expsim2d_thermmech2d.py → ex4a_expsim2d_thermmech2d.py} +17 -14
  44. pyvale/examples/basics/{ex4_2_expsim3d_thermmech3d.py → ex4b_expsim3d_thermmech3d.py} +37 -34
  45. pyvale/examples/basics/ex5_nomesh.py +24 -0
  46. pyvale/examples/dic/ex1_2_blenderdeformed.py +174 -0
  47. pyvale/examples/dic/ex1_region_of_interest.py +6 -3
  48. pyvale/examples/dic/ex2_plate_with_hole.py +21 -18
  49. pyvale/examples/dic/ex3_plate_with_hole_strain.py +8 -6
  50. pyvale/examples/dic/ex4_dic_blender.py +17 -15
  51. pyvale/examples/dic/ex5_dic_challenge.py +19 -14
  52. pyvale/examples/genanalyticdata/ex1_1_scalarvisualisation.py +16 -10
  53. pyvale/examples/genanalyticdata/ex1_2_scalarcasebuild.py +3 -3
  54. pyvale/examples/genanalyticdata/ex2_1_analyticsensors.py +29 -23
  55. pyvale/examples/genanalyticdata/ex2_2_analyticsensors_nomesh.py +67 -0
  56. pyvale/examples/imagedef2d/ex_imagedef2d_todisk.py +12 -9
  57. pyvale/examples/mooseherder/ex0_create_moose_config.py +65 -0
  58. pyvale/examples/mooseherder/ex1a_modify_moose_input.py +71 -0
  59. pyvale/examples/mooseherder/ex1b_modify_gmsh_input.py +69 -0
  60. pyvale/examples/mooseherder/ex2a_run_moose_once.py +80 -0
  61. pyvale/examples/mooseherder/ex2b_run_gmsh_once.py +64 -0
  62. pyvale/examples/mooseherder/ex2c_run_both_once.py +114 -0
  63. pyvale/examples/mooseherder/ex3_run_moose_seq_para.py +157 -0
  64. pyvale/examples/mooseherder/ex4_run_gmsh-moose_seq_para.py +176 -0
  65. pyvale/examples/mooseherder/ex5_run_moose_paramulti.py +136 -0
  66. pyvale/examples/mooseherder/ex6_read_moose_exodus.py +163 -0
  67. pyvale/examples/mooseherder/ex7a_read_moose_herd_results.py +153 -0
  68. pyvale/examples/mooseherder/ex7b_read_multi_herd_results.py +116 -0
  69. pyvale/examples/mooseherder/ex7c_read_multi_gmshmoose_results.py +127 -0
  70. pyvale/examples/mooseherder/ex7d_readconfig_multi_gmshmoose_results.py +143 -0
  71. pyvale/examples/mooseherder/ex8_read_existing_sweep_output.py +72 -0
  72. pyvale/examples/renderblender/ex1_1_blenderscene.py +24 -20
  73. pyvale/examples/renderblender/ex1_2_blenderdeformed.py +22 -18
  74. pyvale/examples/renderblender/ex2_1_stereoscene.py +36 -29
  75. pyvale/examples/renderblender/ex2_2_stereodeformed.py +26 -20
  76. pyvale/examples/renderblender/ex3_1_blendercalibration.py +24 -17
  77. pyvale/examples/renderrasterisation/ex_rastenp.py +14 -12
  78. pyvale/examples/renderrasterisation/ex_rastercyth_oneframe.py +14 -15
  79. pyvale/examples/renderrasterisation/ex_rastercyth_static_cypara.py +13 -11
  80. pyvale/examples/renderrasterisation/ex_rastercyth_static_pypara.py +13 -11
  81. pyvale/mooseherder/__init__.py +32 -0
  82. pyvale/mooseherder/directorymanager.py +416 -0
  83. pyvale/mooseherder/exodusreader.py +763 -0
  84. pyvale/mooseherder/gmshrunner.py +163 -0
  85. pyvale/mooseherder/inputmodifier.py +236 -0
  86. pyvale/mooseherder/mooseconfig.py +226 -0
  87. pyvale/mooseherder/mooseherd.py +527 -0
  88. pyvale/mooseherder/mooserunner.py +303 -0
  89. pyvale/mooseherder/outputreader.py +22 -0
  90. pyvale/mooseherder/simdata.py +92 -0
  91. pyvale/mooseherder/simrunner.py +31 -0
  92. pyvale/mooseherder/sweepreader.py +356 -0
  93. pyvale/mooseherder/sweeptools.py +76 -0
  94. pyvale/sensorsim/__init__.py +82 -0
  95. pyvale/{camera.py → sensorsim/camera.py} +7 -7
  96. pyvale/{camerasensor.py → sensorsim/camerasensor.py} +7 -7
  97. pyvale/{camerastereo.py → sensorsim/camerastereo.py} +2 -2
  98. pyvale/{cameratools.py → sensorsim/cameratools.py} +4 -4
  99. pyvale/{cython → sensorsim/cython}/rastercyth.c +596 -596
  100. pyvale/{cython → sensorsim/cython}/rastercyth.cp311-win32.pyd +0 -0
  101. pyvale/{cython → sensorsim/cython}/rastercyth.py +16 -17
  102. pyvale/{errorcalculator.py → sensorsim/errorcalculator.py} +1 -1
  103. pyvale/{errorintegrator.py → sensorsim/errorintegrator.py} +2 -2
  104. pyvale/{errorrand.py → sensorsim/errorrand.py} +4 -4
  105. pyvale/{errorsyscalib.py → sensorsim/errorsyscalib.py} +2 -2
  106. pyvale/{errorsysdep.py → sensorsim/errorsysdep.py} +2 -2
  107. pyvale/{errorsysfield.py → sensorsim/errorsysfield.py} +8 -8
  108. pyvale/{errorsysindep.py → sensorsim/errorsysindep.py} +3 -3
  109. pyvale/sensorsim/exceptions.py +8 -0
  110. pyvale/{experimentsimulator.py → sensorsim/experimentsimulator.py} +23 -3
  111. pyvale/{field.py → sensorsim/field.py} +1 -1
  112. pyvale/{fieldconverter.py → sensorsim/fieldconverter.py} +72 -19
  113. pyvale/sensorsim/fieldinterp.py +37 -0
  114. pyvale/sensorsim/fieldinterpmesh.py +124 -0
  115. pyvale/sensorsim/fieldinterppoints.py +55 -0
  116. pyvale/{fieldsampler.py → sensorsim/fieldsampler.py} +4 -4
  117. pyvale/{fieldscalar.py → sensorsim/fieldscalar.py} +28 -24
  118. pyvale/{fieldtensor.py → sensorsim/fieldtensor.py} +33 -31
  119. pyvale/{fieldvector.py → sensorsim/fieldvector.py} +33 -31
  120. pyvale/{imagedef2d.py → sensorsim/imagedef2d.py} +9 -5
  121. pyvale/{integratorfactory.py → sensorsim/integratorfactory.py} +6 -6
  122. pyvale/{integratorquadrature.py → sensorsim/integratorquadrature.py} +3 -3
  123. pyvale/{integratorrectangle.py → sensorsim/integratorrectangle.py} +3 -3
  124. pyvale/{integratorspatial.py → sensorsim/integratorspatial.py} +1 -1
  125. pyvale/{rastercy.py → sensorsim/rastercy.py} +5 -5
  126. pyvale/{rasternp.py → sensorsim/rasternp.py} +9 -9
  127. pyvale/{rasteropts.py → sensorsim/rasteropts.py} +1 -1
  128. pyvale/{renderer.py → sensorsim/renderer.py} +1 -1
  129. pyvale/{rendermesh.py → sensorsim/rendermesh.py} +5 -5
  130. pyvale/{renderscene.py → sensorsim/renderscene.py} +2 -2
  131. pyvale/{sensorarray.py → sensorsim/sensorarray.py} +1 -1
  132. pyvale/{sensorarrayfactory.py → sensorsim/sensorarrayfactory.py} +12 -12
  133. pyvale/{sensorarraypoint.py → sensorsim/sensorarraypoint.py} +10 -8
  134. pyvale/{sensordata.py → sensorsim/sensordata.py} +1 -1
  135. pyvale/{sensortools.py → sensorsim/sensortools.py} +2 -20
  136. pyvale/sensorsim/simtools.py +174 -0
  137. pyvale/{visualexpplotter.py → sensorsim/visualexpplotter.py} +3 -3
  138. pyvale/{visualimages.py → sensorsim/visualimages.py} +2 -2
  139. pyvale/{visualsimanimator.py → sensorsim/visualsimanimator.py} +4 -4
  140. pyvale/{visualsimplotter.py → sensorsim/visualsimplotter.py} +5 -5
  141. pyvale/{visualsimsensors.py → sensorsim/visualsimsensors.py} +12 -12
  142. pyvale/{visualtools.py → sensorsim/visualtools.py} +1 -1
  143. pyvale/{visualtraceplotter.py → sensorsim/visualtraceplotter.py} +2 -2
  144. pyvale/simcases/case17.geo +3 -0
  145. pyvale/simcases/case17.i +4 -4
  146. pyvale/simcases/run_1case.py +1 -9
  147. pyvale/simcases/run_all_cases.py +1 -1
  148. pyvale/simcases/run_build_case.py +1 -1
  149. pyvale/simcases/run_example_cases.py +1 -1
  150. pyvale/verif/__init__.py +12 -0
  151. pyvale/{analyticsimdatafactory.py → verif/analyticsimdatafactory.py} +2 -2
  152. pyvale/{analyticsimdatagenerator.py → verif/analyticsimdatagenerator.py} +2 -2
  153. pyvale/verif/psens.py +125 -0
  154. pyvale/verif/psensconst.py +18 -0
  155. pyvale/verif/psensmech.py +227 -0
  156. pyvale/verif/psensmultiphys.py +187 -0
  157. pyvale/verif/psensscalar.py +347 -0
  158. pyvale/verif/psenstensor.py +123 -0
  159. pyvale/verif/psensvector.py +116 -0
  160. {pyvale-2025.7.1.dist-info → pyvale-2025.8.1.dist-info}/METADATA +6 -7
  161. pyvale-2025.8.1.dist-info/RECORD +260 -0
  162. pyvale/dataset.py +0 -415
  163. pyvale/dic2dcpp.cp311-win32.pyd +0 -0
  164. pyvale/dicdataimport.py +0 -247
  165. pyvale/simtools.py +0 -67
  166. pyvale-2025.7.1.dist-info/RECORD +0 -211
  167. /pyvale/{blendercalibrationdata.py → blender/blendercalibrationdata.py} +0 -0
  168. /pyvale/{dicspecklegenerator.py → dic/dicspecklegenerator.py} +0 -0
  169. /pyvale/{dicspecklequality.py → dic/dicspecklequality.py} +0 -0
  170. /pyvale/{dicstrainresults.py → dic/dicstrainresults.py} +0 -0
  171. /pyvale/{cameradata.py → sensorsim/cameradata.py} +0 -0
  172. /pyvale/{cameradata2d.py → sensorsim/cameradata2d.py} +0 -0
  173. /pyvale/{errordriftcalc.py → sensorsim/errordriftcalc.py} +0 -0
  174. /pyvale/{fieldtransform.py → sensorsim/fieldtransform.py} +0 -0
  175. /pyvale/{generatorsrandom.py → sensorsim/generatorsrandom.py} +0 -0
  176. /pyvale/{imagetools.py → sensorsim/imagetools.py} +0 -0
  177. /pyvale/{integratortype.py → sensorsim/integratortype.py} +0 -0
  178. /pyvale/{output.py → sensorsim/output.py} +0 -0
  179. /pyvale/{raster.py → sensorsim/raster.py} +0 -0
  180. /pyvale/{sensordescriptor.py → sensorsim/sensordescriptor.py} +0 -0
  181. /pyvale/{visualimagedef.py → sensorsim/visualimagedef.py} +0 -0
  182. /pyvale/{visualopts.py → sensorsim/visualopts.py} +0 -0
  183. /pyvale/{analyticmeshgen.py → verif/analyticmeshgen.py} +0 -0
  184. {pyvale-2025.7.1.dist-info → pyvale-2025.8.1.dist-info}/WHEEL +0 -0
  185. {pyvale-2025.7.1.dist-info → pyvale-2025.8.1.dist-info}/licenses/LICENSE +0 -0
  186. {pyvale-2025.7.1.dist-info → pyvale-2025.8.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,443 @@
1
+ #===============================================================================
2
+ # pyvale: the python validation engine
3
+ # License: MIT
4
+ # Copyright (C) 2025 The Computer Aided Validation Team
5
+ #===============================================================================
6
+
7
+ """
8
+ Accesors for data that comes pre-packaged with pyvale for demonstrating its
9
+ functionality. This includes moose simulation outputs as exodus files, input
10
+ files for moose and gmsh for additional simulation cases, and images required
11
+ for testing the image deformation and digital image correlation modules.
12
+ """
13
+
14
+ from enum import Enum
15
+ from pathlib import Path
16
+ from importlib.resources import files
17
+
18
+ SIM_CASE_COUNT = 26
19
+ """Constant describing the number of simulation test case input files for moose
20
+ and gmsh that come packaged with pyvale.
21
+ """
22
+
23
+ class EElemTest(Enum):
24
+ """Enumeration used to specify different 3D element types for extracting
25
+ specific test simulation datasets.
26
+ """
27
+
28
+ TET4 = "TET4"
29
+ """Tetrahedral element, linear with 4 nodes.
30
+ """
31
+
32
+ TET10 = "TET10"
33
+ """Tetrahedral element, quadratic with 10 nodes.
34
+ """
35
+
36
+ TET14 = "TET14"
37
+ """Tetrahedral element, quadratic with 14 nodes.
38
+ """
39
+
40
+ HEX8 = "HEX8"
41
+ """Hexahedral element, linear with 8 nodes.
42
+ """
43
+
44
+ HEX20 = "HEX20"
45
+ """Hexahedral element, quadratic with 20 nodes.
46
+ """
47
+
48
+ HEX27 = "HEX27"
49
+ """Hexahedral element, quadratic with 27 nodes.
50
+ """
51
+
52
+ def __str__(self):
53
+ return self.value
54
+
55
+
56
+ class DataSetError(Exception):
57
+ """Custom error class for file io errors associated with retrieving datasets
58
+ and files packaged with pyvale.
59
+ """
60
+
61
+
62
+ def sim_case_input_file_path(case_num: int) -> Path:
63
+ """Gets the path to MOOSE input file (*.i) for a particular simulation
64
+ case.
65
+
66
+ Parameters
67
+ ----------
68
+ case_num : int
69
+ Integer defining the case number to be retrieved. Must be greater
70
+ than 0 and less than the number of simulation cases.
71
+
72
+ Returns
73
+ -------
74
+ Path
75
+ Path object to the MOOSE *.i file for the selected simulation case.
76
+
77
+ Raises
78
+ ------
79
+ DataSetError
80
+ Raised if an invalid simulation case number is specified.
81
+ """
82
+ if case_num <= 0:
83
+ raise DataSetError("Simulation case number must be greater than 0")
84
+ elif case_num > SIM_CASE_COUNT:
85
+ raise DataSetError("Simulation case number must be less than " \
86
+ + f"{SIM_CASE_COUNT}")
87
+
88
+ case_num_str = str(case_num).zfill(2)
89
+ case_file = f"case{case_num_str}.i"
90
+ return Path(files("pyvale.simcases").joinpath(case_file))
91
+
92
+
93
+ def sim_case_gmsh_file_path(case_num: int) -> Path | None:
94
+ """Gets the path to Gmsh input file (*.geo) for a particular simulation
95
+ case. Note that not all simulation cases use Gmsh for geometry and mesh
96
+ generation. If the specified simulation case does not have an associated
97
+ Gmsh *.geo file. In this case 'None' is returned
98
+
99
+ Parameters
100
+ ----------
101
+ case_num : int
102
+ Integer defining the case number to be retrieved. Must be greater
103
+ than 0 and less than the number of simulation cases.
104
+
105
+ Returns
106
+ -------
107
+ Path | None
108
+ Path object to the Gmsh *.geo file for the selected simulation case.
109
+ Returns None if there is no *.geo for this simulation case.
110
+
111
+ Raises
112
+ ------
113
+ DataSetError
114
+ Raised if an invalid simulation case number is specified.
115
+ """
116
+ if case_num <= 0:
117
+ raise DataSetError("Simulation case number must be greater than 0")
118
+ elif case_num > SIM_CASE_COUNT:
119
+ raise DataSetError("Simulation case number must be less than " \
120
+ + f"{SIM_CASE_COUNT}")
121
+
122
+ case_num_str = str(case_num).zfill(2)
123
+ case_file = f"case{case_num_str}.geo"
124
+ case_path = Path(files("pyvale.simcases").joinpath(case_file))
125
+
126
+ if case_path.is_file():
127
+ return case_path
128
+
129
+ return None
130
+
131
+
132
+ def dic_pattern_5mpx_path() -> Path:
133
+ """Path to a 5 mega-pixel speckle pattern image (2464 x 2056 pixels)
134
+ with 8 bit resolution stored as a *.tiff. Speckles are sampled by
135
+ 5 pixels. A gaussian blur has been applied to the image to remove sharp
136
+ transitions from black to white.
137
+
138
+ Path
139
+ Path to the *.tiff file containing the speckle pattern.
140
+ """
141
+ return Path(files("pyvale.data")
142
+ .joinpath("optspeckle_2464x2056px_spec5px_8bit_gblur1px.tiff"))
143
+
144
+
145
+ def thermal_2d_path() -> Path:
146
+ """Path to a MOOSE simulation output in exodus format. This case is a
147
+ thermal problem solving for a scalar temperature field. The geometry is
148
+ a 2D plate (in x,y) with a heat flux applied on one edge and a heat
149
+ transfer coefficient applied on the opposite edge inducing a temperature
150
+ gradient along the x axis of the plate.
151
+
152
+ The simulation parameters can be found in the corresponding MOOSE input
153
+ file: case13.i which can be retrieved using `sim_case_input_file_path`
154
+ in this class.
155
+
156
+
157
+ Returns
158
+ -------
159
+ Path
160
+ Path to the exodus (*.e) output file for this simulation case.
161
+ """
162
+ return Path(files("pyvale.data").joinpath("case13_out.e"))
163
+
164
+
165
+ def thermal_3d_path() -> Path:
166
+ """Path to a MOOSE simulation output in exodus format. This case is a 3D
167
+ thermal problem solving for a scalar temperature field. The model is a
168
+ divertor armour monoblock composed of a tungsten block bonded to a
169
+ copper-chromium-zirconium pipe with a pure copper interlayer. A heat
170
+ flux is applied to the top surface of the block and a heat transfer
171
+ coefficient for cooling water is applied to the inner surface of the
172
+ pipe inducing a temperature gradient from the top of the block to the
173
+ pipe.
174
+
175
+ The simulation parameters can be found in the corresponding MOOSE input
176
+ file: case16.i which can be retrieved using `sim_case_input_file_path`
177
+ in this class. Note that this case uses a Gmsh *.geo file for geometry
178
+ and mesh creation.
179
+
180
+ Returns
181
+ -------
182
+ Path
183
+ Path to the exodus (*.e) output file for this simulation case.
184
+ """
185
+ return Path(files("pyvale.data").joinpath("case16_out.e"))
186
+
187
+
188
+ def mechanical_2d_path() -> Path:
189
+ """Path to a MOOSE simulation output in exodus format. This case is a 2D
190
+ plate with a hole in the center with the bottom edge fixed and a
191
+ displacement applied to the top edge. This is a mechanical problem and
192
+ solves for the displacement vector field and the tensorial strain field.
193
+
194
+ The simulation parameters can be found in the corresponding MOOSE input
195
+ file: case17.i which can be retrieved using `sim_case_input_file_path`
196
+ in this class. Note that this case uses a Gmsh *.geo file for geometry
197
+ and mesh creation.
198
+
199
+ Returns
200
+ -------
201
+ Path
202
+ Path to the exodus (*.e) output file for this simulation case.
203
+ """
204
+ return Path(files("pyvale.data").joinpath("case17_out.e"))
205
+
206
+
207
+ def thermomechanical_2d_path() -> Path:
208
+ """Path to a MOOSE simulation output in exodus format. This case is a
209
+ thermo-mechanical analysis of a 2D plate with a heat flux applied on one
210
+ edge and a heat transfer coefficient applied on the opposing edge. The
211
+ mechanical deformation results from thermal expansion due to the imposed
212
+ temperature gradient. This model is solved for the scalar temperature
213
+ field, vector displacement and tensor strain field.
214
+
215
+ Returns
216
+ -------
217
+ Path
218
+ Path to the exodus (*.e) output file for this simulation case.
219
+ """
220
+ return Path(files("pyvale.data").joinpath("case18_1_out.e"))
221
+
222
+
223
+ def thermomechanical_3d_path() -> Path:
224
+ """Path to a MOOSE simulation output in exodus format. This case is a
225
+ thermo-mechanical analysis of a 3D monoblock divertor armour with a heat
226
+ flux applied on the top surface and a heat transfer coefficient applied
227
+ on the inner surface of the pipe. The mechanical deformation results
228
+ from thermal expansion due to the imposed temperature gradient.
229
+ This model is solved for the scalar temperature field, vector
230
+ displacement and tensor strain field.
231
+
232
+ Returns
233
+ -------
234
+ Path
235
+ Path to the exodus (*.e) output file for this simulation case.
236
+ """
237
+ return Path(files("pyvale.data").joinpath("case16_out.e"))
238
+
239
+
240
+ def thermomechanical_2d_experiment_paths() -> list[Path]:
241
+ """Path to a MOOSE simulation output in exodus format. This case is a
242
+ thermo-mechanical analysis of a 2D plate with a heat flux applied on one
243
+ edge and a heat transfer coefficient applied on the opposing edge. The
244
+ mechanical deformation results from thermal expansion due to the imposed
245
+ temperature gradient. This model is solved for the scalar temperature
246
+ field, vector temperature and tensor strain field.
247
+
248
+ Here we analyse 3 separate experiments where the thermal conductivity of
249
+ the material is perturbed from the nominal case by +/-10%.
250
+
251
+ The simulation parameters can be found in the corresponding MOOSE input
252
+ file: case18.i which can be retrieved using `sim_case_input_file_path`
253
+ in this class.
254
+
255
+ Returns
256
+ -------
257
+ Path
258
+ Path to the exodus (*.e) output file for this simulation case.
259
+ """
260
+ return [Path(files("pyvale.data").joinpath("case18_1_out.e")),
261
+ Path(files("pyvale.data").joinpath("case18_2_out.e")),
262
+ Path(files("pyvale.data").joinpath("case18_3_out.e"))]
263
+
264
+
265
+ def render_mechanical_3d_path() -> Path:
266
+ """Path to a MOOSE simulation output in exodus format. This case is a
267
+ purely mechanical test case in 3D meant for testing image rendering
268
+ algorithms for digital image correlation simulation. The simulation
269
+ consists of a linear elastic thin plate with a hole loaded in tension.
270
+ The simulation uses linear tetrahedral elements for rendering tests.
271
+
272
+ Returns
273
+ -------
274
+ Path
275
+ Path to the exodus (*.e) output file for this simulation case.
276
+ """
277
+ return Path(files("pyvale.data").joinpath("case26_out.e"))
278
+
279
+
280
+ def render_simple_block_path() -> Path:
281
+ """Path to a MOOSE simulation output in exodus format. This case is a
282
+ a simple rectangular block in 3D loaded in tension. It uses a minimum
283
+ number of elements and is intended purely for testing image rendering
284
+ algorithms. This simulation uses linear tetrahedral elements.
285
+
286
+ Returns
287
+ -------
288
+ Path
289
+ Path to the exodus (*.e) output file for this simulation case.
290
+ """
291
+ return Path(files("pyvale.data").joinpath("case25_out.e"))
292
+
293
+
294
+ def element_case_input_path(elem_type: EElemTest) -> Path:
295
+ """Path to a MOOSE simulation input file (.i) for a simple test
296
+ case. This case is a 10mm cube undergoing thermo-mechanical loading
297
+ solved for the temperature, displacement and strain fields. This case is
298
+ solved using a variety of tetrahedral and hexahedral elements with
299
+ linear or quadratic shapes functions. These simulation cases are
300
+ intended for testing purposes and contain a minimal number of elements.
301
+
302
+ Parameters
303
+ ----------
304
+ elem_type : EElemTest
305
+ Enumeration specifying the element type for this test case.
306
+
307
+ Returns
308
+ -------
309
+ Path
310
+ Path to the moose input file (.i) for this simulation case.
311
+ """
312
+ return Path(files("pyvale.simcases")
313
+ .joinpath(f"case00_{elem_type.value}.i"))
314
+
315
+
316
+
317
+ def element_case_output_path(elem_type: EElemTest) -> Path:
318
+ """Path to a MOOSE simulation output in exodus format. This case is a
319
+ 10mm cube undergoing thermo-mechanical loading solved for the
320
+ temperature, displacement and strain fields. This case is solved using a
321
+ variety of tetrahedral and hexahedral elements with linear or quadratic
322
+ shapes functions. These simulation cases are intended for testing
323
+ purposes and contain a minimal number of elements.
324
+
325
+ Parameters
326
+ ----------
327
+ elem_type : EElemTest
328
+ Enumeration specifying the element type for this test case.
329
+
330
+ Returns
331
+ -------
332
+ Path
333
+ Path to the exodus (*.e) output file for this simulation case.
334
+ """
335
+ return Path(files("pyvale.data")
336
+ .joinpath(f"case00_{elem_type.value}_out.e"))
337
+
338
+
339
+ def dic_plate_with_hole_ref() -> Path:
340
+ """Path to the reference image for the plate with hole example.
341
+ 1040x1540 image in .tiff format.
342
+
343
+ Parameters
344
+ ----------
345
+ elem_type : EElemTest
346
+ Enumeration specifying the element type for this test case.
347
+
348
+ Returns
349
+ -------
350
+ Path
351
+ Path to the reference image (*.tiff).
352
+ """
353
+ return Path(files("pyvale.data")
354
+ .joinpath("plate_hole_ref0000.tiff"))
355
+
356
+
357
+ def dic_plate_with_hole_def() -> Path:
358
+ """Path to the deformed images for the plate with hole example.
359
+ 1040x1540 image in .tiff format.
360
+
361
+ Parameters
362
+ ----------
363
+ elem_type : EElemTest
364
+ Enumeration specifying the element type for this test case.
365
+
366
+ Returns
367
+ -------
368
+ Path
369
+ Path to the reference image (*.tiff).
370
+ """
371
+ return Path(files("pyvale.data")
372
+ .joinpath("plate_hole_def*.tiff"))
373
+
374
+
375
+ def dic_plate_rigid_ref() -> Path:
376
+ """Path to the reference image for the plate with hole example.
377
+ 1040x1540 image in .tiff format.
378
+
379
+ Parameters
380
+ ----------
381
+ elem_type : EElemTest
382
+ Enumeration specifying the element type for this test case.
383
+
384
+ Returns
385
+ -------
386
+ Path
387
+ Path to the reference image (*.tiff).
388
+ """
389
+ return Path(files("pyvale.data")
390
+ .joinpath("plate_rigid_ref0000.tiff"))
391
+
392
+
393
+ def dic_plate_rigid_def() -> Path:
394
+ """Path to the deformed images for the plate with hole example.
395
+ 1040x1540 image in .tiff format.
396
+
397
+ Returns
398
+ -------
399
+ Path
400
+ Path to the reference image (*.tiff).
401
+ """
402
+ return Path(files("pyvale.data")
403
+ .joinpath("plate_rigid_def*.tiff"))
404
+
405
+
406
+
407
+
408
+ def dic_challenge_ref() -> Path:
409
+ """Path to the reference images for the 2D dic challenge.
410
+
411
+ Returns
412
+ -------
413
+ Path
414
+ Path to the reference image (*.tiff).
415
+ """
416
+ return Path(files("pyvale.data")
417
+ .joinpath("DIC_Challenge_Star_Noise_Ref.tiff"))
418
+
419
+
420
+ def dic_challenge_def() -> Path:
421
+ """Path to the reference images for the 2D dic challenge.
422
+
423
+ Returns
424
+ -------
425
+ Path
426
+ Path to the reference image (*.tiff).
427
+ """
428
+ return Path(files("pyvale.data")
429
+ .joinpath("DIC_Challenge_Star_Noise_Def.tiff"))
430
+
431
+ def cal_target() -> Path:
432
+ """Path to example calibration target.
433
+
434
+ Returns
435
+ -------
436
+ Path
437
+ Path to the image (*.tiff).
438
+ """
439
+ return Path(files("pyvale.data")
440
+ .joinpath("cal_target.tiff"))
441
+
442
+
443
+
pyvale/dic/__init__.py ADDED
@@ -0,0 +1,20 @@
1
+ #===============================================================================
2
+ # pyvale: the python validation engine
3
+ # License: MIT
4
+ # Copyright (C) 2025 The Computer Aided Validation Team
5
+ #===============================================================================
6
+
7
+ from .dic2d import two_dimensional
8
+ from .dicdataimport import data_import
9
+ from .dicregionofinterest import RegionOfInterest
10
+ from .dicresults import Results
11
+ from .dicstrain import strain_two_dimensional, strain_data_import
12
+ from .dicstrainresults import StrainResults
13
+
14
+ __all__ = ["two_dimensional",
15
+ "RegionOfInterest",
16
+ "data_import",
17
+ "Results",
18
+ "strain_two_dimensional",
19
+ "strain_data_import",
20
+ "StrainResults"]
@@ -12,11 +12,13 @@
12
12
  #include <cmath>
13
13
  #include <algorithm>
14
14
  #include <omp.h>
15
+ #include <csignal>
15
16
 
16
17
  // Program Header files
17
18
  #include "./defines.hpp"
18
19
  #include "./dicutil.hpp"
19
20
  #include "./dicfourier.hpp"
21
+ #include "./dicsignalhandler.hpp"
20
22
 
21
23
  namespace fourier {
22
24
 
@@ -134,8 +136,10 @@ namespace fourier {
134
136
  }
135
137
 
136
138
  void mgwd(const std::vector<util::SubsetData> &ssdata,
137
- const double *img_ref, const double *img_def,
138
- const Interpolator &interp_def, const bool fft_mad,
139
+ const double *img_ref,
140
+ const double *img_def,
141
+ const Interpolator &interp_def,
142
+ const bool fft_mad,
139
143
  const double fft_mad_scale){
140
144
 
141
145
  const int px_hori = interp_def.px_hori;
@@ -150,11 +154,21 @@ namespace fourier {
150
154
  //util::Timer timer("FFT windowing for subset size: " + std::to_string(ssdata[i].size));
151
155
 
152
156
  const int ss_size = ssdata[i].size;
157
+ const int num_ss = ssdata[i].num;
153
158
 
154
159
  std::fill(shifts[i].x.begin(), shifts[i].x.end(), 0.0);
155
160
  std::fill(shifts[i].y.begin(), shifts[i].y.end(), 0.0);
156
161
 
157
- #pragma omp parallel
162
+ indicators::ProgressBar bar;
163
+ std::atomic<int> current_progress = 0;
164
+ int prev_pct = 0;
165
+
166
+ if (g_debug_level == 1){
167
+ std::string bar_title = "FFT windowing for size: " + std::to_string(ss_size);
168
+ util::create_progress_bar(bar, bar_title, ssdata[i].num);
169
+ }
170
+
171
+ #pragma omp parallel shared(stop_request)
158
172
  {
159
173
 
160
174
 
@@ -165,6 +179,11 @@ namespace fourier {
165
179
  #pragma omp for
166
180
  for (int ss = 0; ss < ssdata[i].num; ss++){
167
181
 
182
+ // exit when ctrl+C
183
+ if (stop_request){
184
+ continue;
185
+ }
186
+
168
187
  int ss_x = ssdata[i].coords[2*ss];
169
188
  int ss_y = ssdata[i].coords[2*ss+1];
170
189
 
@@ -213,6 +232,12 @@ namespace fourier {
213
232
  //util::extract_ss_subpx(fft.ss_def, ss_x+shifts[i].x[ss], ss_y+shifts[i].y[ss], interp_def);
214
233
  //shifts[i].cost[ss] = debugcost(fft.ss_ref,fft.ss_def);
215
234
  shifts[i].max_val[ss] = max_val;
235
+
236
+
237
+ if (g_debug_level == 1){
238
+ int progress = current_progress.fetch_add(1);
239
+ if (omp_get_thread_num()==0) util::update_progress_bar(bar, progress, num_ss, prev_pct);
240
+ }
216
241
  }
217
242
  }
218
243
 
@@ -222,7 +247,6 @@ namespace fourier {
222
247
  remove_outliers(shifts[i].y, ssdata[i], fft_mad);
223
248
  }
224
249
 
225
-
226
250
  //smooth_field(shifts[i].x, ssdata[i], 7.0, 5);
227
251
  //smooth_field(shifts[i].y, ssdata[i], 7.0, 5);
228
252
 
@@ -233,9 +257,17 @@ namespace fourier {
233
257
  // std::cout << shifts[i].cost[ss] << std::endl;
234
258
  //}
235
259
  //std::cout << std::endl;
260
+
261
+ if (g_debug_level == 1){
262
+ int progress = current_progress;
263
+ util::update_progress_bar(bar, progress-1, num_ss, prev_pct);
264
+ bar.mark_as_completed();
265
+ indicators::show_console_cursor(true);
266
+ }
236
267
  }
237
268
 
238
269
 
270
+
239
271
  }
240
272
 
241
273
 
@@ -11,7 +11,9 @@
11
11
 
12
12
  // Program Header files
13
13
  #include "./dicinterpolator.hpp"
14
-
14
+ #include "./dicutil.hpp"
15
+ #include "defines.hpp"
16
+ #include "./dicsignalhandler.hpp"
15
17
 
16
18
 
17
19
  inline int idx_from_2d(const int x, const int y, const int length){
@@ -49,10 +51,27 @@ Interpolator::Interpolator(double*img, int px_hori, int px_vert){
49
51
 
50
52
  //interpolator data
51
53
  std::vector<double> data(px_hori,0);
54
+
55
+
56
+ indicators::ProgressBar bar;
57
+ std::atomic<int> current_progress = 0;
58
+ int prev_pct = 0;
59
+ int niters = px_vert+px_hori+px_hori;
60
+
61
+ if (g_debug_level == 1){
62
+ std::string bar_title = "Creating Interpolator: ";
63
+ util::create_progress_bar(bar, bar_title, niters);
64
+ }
65
+
52
66
 
53
67
  //#pragma omp parallel for
54
68
  for (int j = 0; j < px_vert; j++){
55
69
 
70
+ // exit if ctrl+C
71
+ if (stop_request){
72
+ continue;
73
+ }
74
+
56
75
  // get 1D data
57
76
  for (int i = 0; i < px_hori; i++) {
58
77
  data[i] = image[j*px_hori + i];
@@ -62,6 +81,12 @@ Interpolator::Interpolator(double*img, int px_hori, int px_vert){
62
81
  for (int i = 0; i < px_hori; i++){
63
82
  dx[j*px_hori + i] = cspline_eval_deriv(px_x, data, px_x[i], px_hori);
64
83
  }
84
+
85
+ // update progress bar if enabled
86
+ if (g_debug_level == 1){
87
+ int progress = current_progress.fetch_add(1);
88
+ util::update_progress_bar(bar, progress, niters, prev_pct);
89
+ }
65
90
  }
66
91
 
67
92
  data.resize(px_vert,0);
@@ -69,6 +94,11 @@ Interpolator::Interpolator(double*img, int px_hori, int px_vert){
69
94
  //#pragma omp parallel for
70
95
  for (int i = 0; i < px_hori; ++i) {
71
96
 
97
+ // exit if ctrl+C
98
+ if (stop_request){
99
+ continue;
100
+ }
101
+
72
102
  // get 1D data
73
103
  for (int j = 0; j < px_vert; j++){
74
104
  data[j] = image[j*px_hori + i];
@@ -78,6 +108,12 @@ Interpolator::Interpolator(double*img, int px_hori, int px_vert){
78
108
  for (int j = 0; j < px_vert; j++){
79
109
  dy[j*px_hori + i] = cspline_eval_deriv(px_y, data, px_y[j], px_vert);
80
110
  }
111
+
112
+ // update progress bar if enabled
113
+ if (g_debug_level == 1){
114
+ int progress = current_progress.fetch_add(1);
115
+ util::update_progress_bar(bar, progress, niters, prev_pct);
116
+ }
81
117
  }
82
118
 
83
119
 
@@ -86,6 +122,11 @@ Interpolator::Interpolator(double*img, int px_hori, int px_vert){
86
122
  //#pragma omp parallel for
87
123
  for (int j = 0; j < px_vert; j++){
88
124
 
125
+ // exit if ctrl+C
126
+ if (stop_request){
127
+ continue;
128
+ }
129
+
89
130
  // get 1D data
90
131
  for (int i = 0; i < px_hori; i++) {
91
132
  data[i] = dy[j*px_hori + i];
@@ -95,6 +136,20 @@ Interpolator::Interpolator(double*img, int px_hori, int px_vert){
95
136
  for (int i = 0; i < px_hori; i++){
96
137
  dxy[j*px_hori + i] = cspline_eval_deriv(px_x, data, px_x[i], px_hori);
97
138
  }
139
+
140
+ // update progress bar if enabled
141
+ if (g_debug_level == 1){
142
+ int progress = current_progress.fetch_add(1);
143
+ util::update_progress_bar(bar, progress, niters, prev_pct);
144
+ }
145
+ }
146
+
147
+
148
+ if (g_debug_level == 1){
149
+ int progress = current_progress;
150
+ util::update_progress_bar(bar, progress-1, niters, prev_pct);
151
+ bar.mark_as_completed();
152
+ indicators::show_console_cursor(true);
98
153
  }
99
154
  }
100
155