fullwave25 1.0.7__py3-none-any.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 fullwave25 might be problematic. Click here for more details.

Files changed (225) hide show
  1. fullwave/__init__.py +28 -0
  2. fullwave/constants/__init__.py +5 -0
  3. fullwave/constants/material_properties.py +112 -0
  4. fullwave/grid.py +222 -0
  5. fullwave/medium.py +1042 -0
  6. fullwave/medium_builder/__init__.py +12 -0
  7. fullwave/medium_builder/domain.py +151 -0
  8. fullwave/medium_builder/medium_builder.py +198 -0
  9. fullwave/medium_builder/presets/__init__.py +8 -0
  10. fullwave/medium_builder/presets/data/.keep +0 -0
  11. fullwave/medium_builder/presets/data/abdominal_wall/i2365f_etfw1.mat +0 -0
  12. fullwave/medium_builder/presets/domain_abdominal_wall.py +293 -0
  13. fullwave/medium_builder/presets/domain_background.py +140 -0
  14. fullwave/medium_builder/presets/domain_scatterer.py +179 -0
  15. fullwave/medium_builder/presets/domain_simple.py +92 -0
  16. fullwave/medium_builder/presets/domain_water_gel.py +1 -0
  17. fullwave/sensor.py +161 -0
  18. fullwave/solver/__init__.py +1 -0
  19. fullwave/solver/bins/database/relaxation_params_database_num_relax=2_20251027_1437.mat +0 -0
  20. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenu +0 -0
  21. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_100_cuda129 +0 -0
  22. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_101_cuda129 +0 -0
  23. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_120_cuda129 +0 -0
  24. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda118 +0 -0
  25. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda124 +0 -0
  26. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda126 +0 -0
  27. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_61_cuda129 +0 -0
  28. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda118 +0 -0
  29. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda124 +0 -0
  30. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda126 +0 -0
  31. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_70_cuda129 +0 -0
  32. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda118 +0 -0
  33. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda124 +0 -0
  34. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda126 +0 -0
  35. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_75_cuda129 +0 -0
  36. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda118 +0 -0
  37. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda124 +0 -0
  38. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda126 +0 -0
  39. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_80_cuda129 +0 -0
  40. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda118 +0 -0
  41. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda124 +0 -0
  42. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda126 +0 -0
  43. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_86_cuda129 +0 -0
  44. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_89_cuda118 +0 -0
  45. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_89_cuda126 +0 -0
  46. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_89_cuda129 +0 -0
  47. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda118 +0 -0
  48. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda124 +0 -0
  49. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda126 +0 -0
  50. fullwave/solver/bins/exponential_attenuation/gpu/2d/fullwave2_2d_exponential_attenuation_gpu_sm_90_cuda129 +0 -0
  51. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_100_cuda129 +0 -0
  52. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_101_cuda129 +0 -0
  53. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_120_cuda129 +0 -0
  54. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda118 +0 -0
  55. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda124 +0 -0
  56. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda126 +0 -0
  57. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_61_cuda129 +0 -0
  58. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda118 +0 -0
  59. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda124 +0 -0
  60. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda126 +0 -0
  61. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_70_cuda129 +0 -0
  62. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda118 +0 -0
  63. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda124 +0 -0
  64. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda126 +0 -0
  65. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_75_cuda129 +0 -0
  66. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda118 +0 -0
  67. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda124 +0 -0
  68. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda126 +0 -0
  69. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_80_cuda129 +0 -0
  70. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda118 +0 -0
  71. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda124 +0 -0
  72. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda126 +0 -0
  73. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_86_cuda129 +0 -0
  74. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda118 +0 -0
  75. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda124 +0 -0
  76. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda126 +0 -0
  77. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_89_cuda129 +0 -0
  78. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda118 +0 -0
  79. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda124 +0 -0
  80. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda126 +0 -0
  81. fullwave/solver/bins/exponential_attenuation/gpu/3d/fullwave2_3d_exponential_attenuation_gpu_sm_90_cuda129 +0 -0
  82. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_100_cuda129 +0 -0
  83. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_101_cuda129 +0 -0
  84. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_120_cuda129 +0 -0
  85. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda118 +0 -0
  86. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda124 +0 -0
  87. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda126 +0 -0
  88. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_61_cuda129 +0 -0
  89. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda118 +0 -0
  90. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda124 +0 -0
  91. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda126 +0 -0
  92. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_70_cuda129 +0 -0
  93. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda118 +0 -0
  94. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda124 +0 -0
  95. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda126 +0 -0
  96. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_75_cuda129 +0 -0
  97. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda118 +0 -0
  98. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda124 +0 -0
  99. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda126 +0 -0
  100. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_80_cuda129 +0 -0
  101. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda118 +0 -0
  102. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda124 +0 -0
  103. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda126 +0 -0
  104. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_86_cuda129 +0 -0
  105. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda118 +0 -0
  106. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda124 +0 -0
  107. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda126 +0 -0
  108. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_89_cuda129 +0 -0
  109. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda118 +0 -0
  110. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda124 +0 -0
  111. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda126 +0 -0
  112. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_isotropic_multi_gpu_sm_90_cuda129 +0 -0
  113. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_100_cuda129 +0 -0
  114. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_101_cuda129 +0 -0
  115. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_120_cuda129 +0 -0
  116. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda118 +0 -0
  117. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda124 +0 -0
  118. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda126 +0 -0
  119. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_61_cuda129 +0 -0
  120. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda118 +0 -0
  121. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda124 +0 -0
  122. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda126 +0 -0
  123. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_70_cuda129 +0 -0
  124. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda118 +0 -0
  125. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda124 +0 -0
  126. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda126 +0 -0
  127. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_75_cuda129 +0 -0
  128. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda118 +0 -0
  129. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda124 +0 -0
  130. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda126 +0 -0
  131. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_80_cuda129 +0 -0
  132. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda118 +0 -0
  133. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda124 +0 -0
  134. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda126 +0 -0
  135. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_86_cuda129 +0 -0
  136. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda118 +0 -0
  137. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda124 +0 -0
  138. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda126 +0 -0
  139. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_89_cuda129 +0 -0
  140. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda118 +0 -0
  141. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda124 +0 -0
  142. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda126 +0 -0
  143. fullwave/solver/bins/gpu/2d/num_relax=2/fullwave2_2d_2_relax_multi_gpu_sm_90_cuda129 +0 -0
  144. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_100_cuda129 +0 -0
  145. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_101_cuda129 +0 -0
  146. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_120_cuda129 +0 -0
  147. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda118 +0 -0
  148. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda124 +0 -0
  149. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda126 +0 -0
  150. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_61_cuda129 +0 -0
  151. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda118 +0 -0
  152. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda124 +0 -0
  153. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda126 +0 -0
  154. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_70_cuda129 +0 -0
  155. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda118 +0 -0
  156. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda124 +0 -0
  157. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda126 +0 -0
  158. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_75_cuda129 +0 -0
  159. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda118 +0 -0
  160. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda124 +0 -0
  161. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda126 +0 -0
  162. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_80_cuda129 +0 -0
  163. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda118 +0 -0
  164. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda124 +0 -0
  165. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda126 +0 -0
  166. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_86_cuda129 +0 -0
  167. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda118 +0 -0
  168. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda124 +0 -0
  169. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda126 +0 -0
  170. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_89_cuda129 +0 -0
  171. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda118 +0 -0
  172. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda124 +0 -0
  173. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda126 +0 -0
  174. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_isotropic_multi_gpu_sm_90_cuda129 +0 -0
  175. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_100_cuda129 +0 -0
  176. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_101_cuda129 +0 -0
  177. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_120_cuda129 +0 -0
  178. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda118 +0 -0
  179. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda124 +0 -0
  180. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda126 +0 -0
  181. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_61_cuda129 +0 -0
  182. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda118 +0 -0
  183. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda124 +0 -0
  184. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda126 +0 -0
  185. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_70_cuda129 +0 -0
  186. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda118 +0 -0
  187. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda124 +0 -0
  188. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda126 +0 -0
  189. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_75_cuda129 +0 -0
  190. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda118 +0 -0
  191. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda124 +0 -0
  192. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda126 +0 -0
  193. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_80_cuda129 +0 -0
  194. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda118 +0 -0
  195. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda124 +0 -0
  196. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda126 +0 -0
  197. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_86_cuda129 +0 -0
  198. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda118 +0 -0
  199. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda124 +0 -0
  200. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda126 +0 -0
  201. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_89_cuda129 +0 -0
  202. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda118 +0 -0
  203. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda124 +0 -0
  204. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda126 +0 -0
  205. fullwave/solver/bins/gpu/3d/num_relax=2/fullwave2_3d_2_relax_multi_gpu_sm_90_cuda129 +0 -0
  206. fullwave/solver/cuda_utils.py +392 -0
  207. fullwave/solver/input_file_writer.py +853 -0
  208. fullwave/solver/launcher.py +134 -0
  209. fullwave/solver/pml_builder.py +1923 -0
  210. fullwave/solver/solver.py +750 -0
  211. fullwave/solver/utils.py +83 -0
  212. fullwave/source.py +173 -0
  213. fullwave/transducer.py +1003 -0
  214. fullwave/utils/__init__.py +12 -0
  215. fullwave/utils/check_functions.py +48 -0
  216. fullwave/utils/coordinates.py +155 -0
  217. fullwave/utils/memory_tempfile.py +439 -0
  218. fullwave/utils/numerical.py +111 -0
  219. fullwave/utils/plot_utils.py +1122 -0
  220. fullwave/utils/pulse.py +72 -0
  221. fullwave/utils/relaxation_parameters.py +212 -0
  222. fullwave/utils/signal_process.py +197 -0
  223. fullwave25-1.0.7.dist-info/METADATA +292 -0
  224. fullwave25-1.0.7.dist-info/RECORD +225 -0
  225. fullwave25-1.0.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,853 @@
1
+ """input generator modules."""
2
+
3
+ import logging
4
+ import os
5
+ import shutil
6
+ from pathlib import Path
7
+
8
+ import numpy as np
9
+ from numpy.typing import DTypeLike, NDArray
10
+
11
+ import fullwave
12
+ from fullwave.utils import check_functions
13
+ from fullwave.utils.coordinates import map_to_coords
14
+ from fullwave.utils.numerical import matlab_round
15
+
16
+ logger = logging.getLogger("__main__." + __name__)
17
+
18
+
19
+ class InputFileWriter:
20
+ """Base class for Fullwave input data generation.
21
+
22
+ if you want to make your own InputGenerator,
23
+ you can inherit this class and override the methods such as "__init__", "run".
24
+ """
25
+
26
+ def __init__(
27
+ self,
28
+ work_dir: Path,
29
+ grid: fullwave.Grid,
30
+ medium: fullwave.MediumRelaxationMaps | fullwave.MediumExponentialAttenuation,
31
+ source: fullwave.Source,
32
+ sensor: fullwave.Sensor,
33
+ *,
34
+ path_fullwave_simulation_bin: Path = Path(__file__).parent / "bins" / "fullwave_solver_gpu",
35
+ validate_input: bool = True,
36
+ use_exponential_attenuation: bool = False,
37
+ use_isotropic_relaxation: bool = False,
38
+ ) -> None:
39
+ """Initialize the InputGeneratorBase instance.
40
+
41
+ Parameters
42
+ ----------
43
+ work_dir : Path
44
+ The working directory of the whole simulation.
45
+ the simulation directory will be generated under work_dir.
46
+ grid : fullwave.Grid
47
+ The computational grid.
48
+ medium : fullwave.MediumRelaxationMaps
49
+ The MediumRelaxationMaps properties.
50
+ source : fullwave.Source
51
+ The source configuration.
52
+ sensor : fullwave.Sensor
53
+ The sensor configuration.
54
+ path_fullwave_simulation_bin : Path, optional
55
+ The path to the fullwave simulation binary.
56
+ validate_input: bool, optional
57
+ Flag indicating whether to validate the input data.
58
+ default is True.
59
+ use_exponential_attenuation: bool, optional
60
+ Flag indicating whether to use exponential attenuation.
61
+ default is False.
62
+ If True, the medium should be an instance of MediumExponentialAttenuation.
63
+ If False, the medium should be an instance of MediumRelaxationMaps.
64
+ use_isotropic_relaxation : bool, optional
65
+ Whether to use isotropic relaxation mechanisms for attenuation modeling
66
+ to reduce memory usage while retaining accuracy.
67
+ For 2D it will reduce the memory usage by approximately 15%.
68
+ For 3D it will reduce the memory usage by approximately 25%.
69
+ This option omits the anisotropic relaxation mechanisms to model the attenuation.
70
+ We usually recommend using isotropic relaxation mechanisms
71
+ unless the anisotropic attenuation is required for the simulation.
72
+
73
+ """
74
+ self._work_dir = Path(work_dir)
75
+ self.path_fullwave_simulation_bin = path_fullwave_simulation_bin
76
+ self.use_isotropic_relaxation = use_isotropic_relaxation
77
+
78
+ if validate_input:
79
+ check_functions.check_path_exists(self.path_fullwave_simulation_bin)
80
+ check_functions.check_instance(grid, fullwave.Grid)
81
+ if use_exponential_attenuation:
82
+ check_functions.check_instance(medium, fullwave.MediumExponentialAttenuation)
83
+ else:
84
+ check_functions.check_instance(medium, fullwave.MediumRelaxationMaps)
85
+ check_functions.check_instance(source, fullwave.Source)
86
+ check_functions.check_instance(sensor, fullwave.Sensor)
87
+
88
+ self.grid = grid
89
+ self.medium: fullwave.MediumRelaxationMaps | fullwave.MediumExponentialAttenuation = medium
90
+ self.source = source
91
+ self.sensor = sensor
92
+ self.is_3d = self.grid.is_3d
93
+ self.use_exponential_attenuation = use_exponential_attenuation
94
+
95
+ self._dim = int(
96
+ matlab_round(self.medium.sound_speed.max())
97
+ - matlab_round(self.medium.sound_speed.min()),
98
+ )
99
+
100
+ self._set_d_mat()
101
+ self._set_d_map(self._dim, self.medium.sound_speed)
102
+ self._set_dc_map(self.medium.sound_speed)
103
+
104
+ def run(
105
+ self,
106
+ simulation_dir_name: Path | str,
107
+ *,
108
+ is_static_map: bool = False,
109
+ recalculate_pml: bool = True,
110
+ ) -> Path:
111
+ r"""Run the input data generation and return the simulation directory path.
112
+
113
+ Parameters
114
+ ----------
115
+ simulation_dir_name : Path
116
+ The directory name where simulation files will be stored.
117
+ The directory will be created under the work directory.
118
+ This is the directory, where Fullwave2 will be executed
119
+ is_static_map : bool
120
+ Flag indicating if a static map is used.\n
121
+ static map is a map that does not change
122
+ during the transmission events such as plane wave and synthetic aperture sequence.\n
123
+ non-static map is a map that changes
124
+ during the transmission events such as walking aperture implementation
125
+ for focused transmit implementation.\n
126
+ if it is a static map, the input files are stored inside the work directory and
127
+ symbolic links are created in the simulation directory.\n
128
+ recalculate_pml : bool
129
+ Flag indicating whether to re-calculate PML parameters.
130
+ default is True.
131
+ you can store the value false
132
+ if you are using the same PML parameters in case of static map simulation.
133
+ set True if you are using different PML parameters for each transmit event
134
+ such as walking aperture.
135
+ set False if you are using the same PML parameters for each transmit event
136
+ such as plane wave
137
+ AND this is the second or later transmit event.
138
+
139
+ Returns
140
+ -------
141
+ Path: The simulation directory.
142
+
143
+ """
144
+ simulation_dir = self._work_dir / simulation_dir_name
145
+ simulation_dir.mkdir(parents=True, exist_ok=True)
146
+ self._write_ic(
147
+ simulation_dir / "icmat.dat",
148
+ np.transpose(self.source.icmat),
149
+ )
150
+ self._copy_simulation_bin_file(simulation_dir)
151
+
152
+ if not self.use_exponential_attenuation:
153
+ if recalculate_pml:
154
+ dat_output_dir = self._work_dir if is_static_map else simulation_dir
155
+
156
+ self._save_variables_into_dat_file(
157
+ simulation_dir=dat_output_dir,
158
+ relaxation_param_map_dict_for_fw2=self.medium.relaxation_param_dict_for_fw2,
159
+ dim=self._dim,
160
+ )
161
+ if is_static_map:
162
+ self._build_symbolic_links_for_dat_files(
163
+ src_dir=self._work_dir,
164
+ dst_dir=simulation_dir,
165
+ )
166
+ else:
167
+ dat_output_dir = self._work_dir if is_static_map else simulation_dir
168
+ self._save_variables_into_dat_file_exponential_attenuation(
169
+ simulation_dir=dat_output_dir,
170
+ dim=self._dim,
171
+ )
172
+ return simulation_dir
173
+
174
+ # --- constructor utils ---
175
+
176
+ def _set_d_mat(self) -> None:
177
+ # For 2D modeling:
178
+ self._d = np.zeros((9, 2))
179
+ if self.is_3d:
180
+ self._d[1, 0] = (
181
+ 3.26627215252963e-3 * self.grid.cfl**7
182
+ - 7.91679373564790e-4 * self.grid.cfl**6
183
+ + 1.08663532410570e-3 * self.grid.cfl**5
184
+ + 2.54974226454794e-2 * self.grid.cfl**4
185
+ + 3.23083288193913e-5 * self.grid.cfl**3
186
+ - 3.97704676886853e-1 * self.grid.cfl**2
187
+ + 7.95584310128586e-8 * self.grid.cfl
188
+ + 1.25425295688331
189
+ )
190
+ self._d[2, 0] = (
191
+ -2.83291379048757e-3 * self.grid.cfl**7
192
+ + 8.52796449228369e-4 * self.grid.cfl**6
193
+ - 9.45353822586534e-4 * self.grid.cfl**5
194
+ - 8.82015372858580e-3 * self.grid.cfl**4
195
+ - 2.81364895458027e-5 * self.grid.cfl**3
196
+ + 6.73021045987599e-2 * self.grid.cfl**2
197
+ - 6.93180036837075e-8 * self.grid.cfl
198
+ - 1.23448809066664e-1
199
+ )
200
+ self._d[3, 0] = (
201
+ 2.32775473203342e-3 * self.grid.cfl**7
202
+ - 5.56793042789852e-4 * self.grid.cfl**6
203
+ + 7.77649035879584e-4 * self.grid.cfl**5
204
+ + 2.45547234243566e-3 * self.grid.cfl**4
205
+ + 2.31537892801923e-5 * self.grid.cfl**3
206
+ + 1.61900960524164e-2 * self.grid.cfl**2
207
+ + 5.70523152308121e-8 * self.grid.cfl
208
+ + 3.46683979649506e-2
209
+ )
210
+ self._d[4, 0] = (
211
+ -1.68883462553539e-3 * self.grid.cfl**7
212
+ + 3.03535823592644e-4 * self.grid.cfl**6
213
+ - 5.64777117315819e-4 * self.grid.cfl**5
214
+ + 2.44582905523866e-4 * self.grid.cfl**4
215
+ - 1.68215579314751e-5 * self.grid.cfl**3
216
+ - 2.62344345204941e-2 * self.grid.cfl**2
217
+ - 4.14559953526389e-8 * self.grid.cfl
218
+ - 1.19918511290930e-2
219
+ )
220
+ self._d[5, 0] = (
221
+ 1.08994931098070e-3 * self.grid.cfl**7
222
+ - 1.41445142143525e-4 * self.grid.cfl**6
223
+ + 3.64794490139160e-4 * self.grid.cfl**5
224
+ - 8.86057426195227e-4 * self.grid.cfl**4
225
+ + 1.08681882832738e-5 * self.grid.cfl**3
226
+ + 2.07238558666603e-2 * self.grid.cfl**2
227
+ + 2.67876079477806e-8 * self.grid.cfl
228
+ + 4.17058420250698e-3
229
+ )
230
+ self._d[6, 0] = (
231
+ -6.39950124405340e-4 * self.grid.cfl**7
232
+ + 6.06079815415080e-5 * self.grid.cfl**6
233
+ - 2.14633466007892e-4 * self.grid.cfl**5
234
+ + 6.84580412267934e-4 * self.grid.cfl**4
235
+ - 6.39907927898092e-6 * self.grid.cfl**3
236
+ - 1.29825288653404e-2 * self.grid.cfl**2
237
+ - 1.57775422151124e-8 * self.grid.cfl
238
+ - 1.29998325971518e-3
239
+ )
240
+ self._d[7, 0] = (
241
+ 2.92716539609611e-4 * self.grid.cfl**7
242
+ - 1.87446062803024e-5 * self.grid.cfl**6
243
+ + 9.85389372183761e-5 * self.grid.cfl**5
244
+ - 2.40360290348543e-4 * self.grid.cfl**4
245
+ + 2.94166215515130e-6 * self.grid.cfl**3
246
+ + 5.57066438452790e-3 * self.grid.cfl**2
247
+ + 7.25741366376659e-9 * self.grid.cfl
248
+ + 3.18698432679400e-4
249
+ )
250
+ self._d[8, 0] = (
251
+ -6.42183857909518e-5 * self.grid.cfl**7
252
+ + 3.38552867751042e-6 * self.grid.cfl**6
253
+ - 2.17377151411164e-5 * self.grid.cfl**5
254
+ + 4.98269067389945e-5 * self.grid.cfl**4
255
+ - 6.50197868987757e-7 * self.grid.cfl**3
256
+ - 1.19096089679178e-3 * self.grid.cfl**2
257
+ - 1.60559948991172e-9 * self.grid.cfl
258
+ - 4.57795411807702e-5
259
+ )
260
+ self._d[1, 1] = (
261
+ -4.47723278782936e-5 * self.grid.cfl**7
262
+ - 7.69502473399932e-5 * self.grid.cfl**6
263
+ - 1.41765498250133e-5 * self.grid.cfl**5
264
+ - 2.54672045901272e-3 * self.grid.cfl**4
265
+ - 4.14343385915353e-7 * self.grid.cfl**3
266
+ + 5.00210047924752e-2 * self.grid.cfl**2
267
+ - 1.01220354410507e-9 * self.grid.cfl
268
+ - 8.07139347787336e-8
269
+ )
270
+ else:
271
+ self._d[1, 0] = (
272
+ -0.000874634088067635 * self.grid.cfl**7
273
+ - 0.00180530560296097 * self.grid.cfl**6
274
+ - 0.000440512972481673 * self.grid.cfl**5
275
+ + 0.00474018847663366 * self.grid.cfl**4
276
+ - 1.93097802254349e-05 * self.grid.cfl**3
277
+ - 0.292328221171893 * self.grid.cfl**2
278
+ - 6.58101498708345e-08 * self.grid.cfl
279
+ + 1.25420636437969
280
+ )
281
+ self._d[2, 0] = (
282
+ 0.000793317828964018 * self.grid.cfl**7
283
+ + 0.00161433256585486 * self.grid.cfl**6
284
+ + 0.000397244786277123 * self.grid.cfl**5
285
+ + 0.00546057645976549 * self.grid.cfl**4
286
+ + 1.73781972873916e-05 * self.grid.cfl**3
287
+ + 0.0588754971188371 * self.grid.cfl**2
288
+ + 5.91706982879834e-08 * self.grid.cfl
289
+ - 0.123406473759703
290
+ )
291
+ self._d[3, 0] = (
292
+ -0.000650217700538851 * self.grid.cfl**7
293
+ - 0.00116449260340413 * self.grid.cfl**6
294
+ - 0.000324403734066325 * self.grid.cfl**5
295
+ - 0.00911483710059994 * self.grid.cfl**4
296
+ - 1.417399823126e-05 * self.grid.cfl**3
297
+ + 0.0233184077551615 * self.grid.cfl**2
298
+ - 4.82326094707544e-08 * self.grid.cfl
299
+ + 0.0346342451534453
300
+ )
301
+ self._d[4, 0] = (
302
+ 0.000467529510541428 * self.grid.cfl**7
303
+ + 0.000732736676632388 * self.grid.cfl**6
304
+ + 0.000232444388955328 * self.grid.cfl**5
305
+ + 0.00846419766685254 * self.grid.cfl**4
306
+ + 1.01438593426278e-05 * self.grid.cfl**3
307
+ - 0.0317586249260511 * self.grid.cfl**2
308
+ + 3.44988852042879e-08 * self.grid.cfl
309
+ - 0.0119674942518101
310
+ )
311
+ self._d[5, 0] = (
312
+ -0.000298416281187033 * self.grid.cfl**7
313
+ - 0.000399380750669364 * self.grid.cfl**6
314
+ - 0.000148203388388213 * self.grid.cfl**5
315
+ - 0.00601788793192501 * self.grid.cfl**4
316
+ - 6.46543538517443e-06 * self.grid.cfl**3
317
+ + 0.0241912754935119 * self.grid.cfl**2
318
+ - 2.19855171569984e-08 * self.grid.cfl
319
+ + 0.00415554391204146
320
+ )
321
+ self._d[6, 0] = (
322
+ 0.000167882669698981 * self.grid.cfl**7
323
+ + 0.000188195874702691 * self.grid.cfl**6
324
+ + 8.3057921860396e-05 * self.grid.cfl**5
325
+ + 0.00348461963201376 * self.grid.cfl**4
326
+ + 3.61873162287129e-06 * self.grid.cfl**3
327
+ - 0.0149875789940005 * self.grid.cfl**2
328
+ + 1.22979142197165e-08 * self.grid.cfl
329
+ - 0.00129213888778954
330
+ )
331
+ self._d[7, 0] = (
332
+ -6.22209937489143e-05 * self.grid.cfl**7
333
+ - 6.44890425871692e-05 * self.grid.cfl**6
334
+ - 3.02936928954918e-05 * self.grid.cfl**5
335
+ - 0.00133386143898282 * self.grid.cfl**4
336
+ - 1.31215186728213e-06 * self.grid.cfl**3
337
+ + 0.00670228205200379 * self.grid.cfl**2
338
+ - 4.44653967516776e-09 * self.grid.cfl
339
+ + 0.000315659916047599
340
+ )
341
+ self._d[8, 0] = (
342
+ 6.8474088109024e-06 * self.grid.cfl**7
343
+ + 1.14082245705934e-05 * self.grid.cfl**6
344
+ + 3.0372759370575e-06 * self.grid.cfl**5
345
+ + 0.000236122782444105 * self.grid.cfl**4
346
+ + 1.26768491232397e-07 * self.grid.cfl**3
347
+ - 0.00153347270556276 * self.grid.cfl**2
348
+ + 4.21617557752767e-10 * self.grid.cfl
349
+ - 4.51948990428065e-05
350
+ )
351
+ self._d[1, 1] = (
352
+ 2.13188763071246e-06 * self.grid.cfl**7
353
+ - 7.41025068776257e-05 * self.grid.cfl**6
354
+ + 2.31652037371554e-06 * self.grid.cfl**5
355
+ - 0.00259495924602038 * self.grid.cfl**4
356
+ + 1.20637183170338e-07 * self.grid.cfl**3
357
+ + 0.0521123771632193 * self.grid.cfl**2
358
+ + 4.42258843694177e-10 * self.grid.cfl
359
+ - 4.20967682664542e-07
360
+ )
361
+
362
+ def _set_d_map(self, dim: int, c_map: NDArray[np.float64]) -> None:
363
+ self._d_map = np.zeros((9, 2, dim + 1))
364
+ if self.is_3d:
365
+ for i in range(dim + 1):
366
+ r_d_map = (i + c_map.min()) * self.grid.dt / self.grid.dx
367
+ self._d_map[1, 0, i] = (
368
+ 3.26627215252963e-3 * r_d_map**7
369
+ - 7.91679373564790e-4 * r_d_map**6
370
+ + 1.08663532410570e-3 * r_d_map**5
371
+ + 2.54974226454794e-2 * r_d_map**4
372
+ + 3.23083288193913e-5 * r_d_map**3
373
+ - 3.97704676886853e-1 * r_d_map**2
374
+ + 7.95584310128586e-8 * r_d_map
375
+ + 1.25425295688331
376
+ )
377
+ self._d_map[2, 0, i] = (
378
+ -2.83291379048757e-3 * r_d_map**7
379
+ + 8.52796449228369e-4 * r_d_map**6
380
+ - 9.45353822586534e-4 * r_d_map**5
381
+ - 8.82015372858580e-3 * r_d_map**4
382
+ - 2.81364895458027e-5 * r_d_map**3
383
+ + 6.73021045987599e-2 * r_d_map**2
384
+ - 6.93180036837075e-8 * r_d_map
385
+ - 1.23448809066664e-1
386
+ )
387
+ self._d_map[3, 0, i] = (
388
+ 2.32775473203342e-3 * r_d_map**7
389
+ - 5.56793042789852e-4 * r_d_map**6
390
+ + 7.77649035879584e-4 * r_d_map**5
391
+ + 2.45547234243566e-3 * r_d_map**4
392
+ + 2.31537892801923e-5 * r_d_map**3
393
+ + 1.61900960524164e-2 * r_d_map**2
394
+ + 5.70523152308121e-8 * r_d_map
395
+ + 3.46683979649506e-2
396
+ )
397
+ self._d_map[4, 0, i] = (
398
+ -1.68883462553539e-3 * r_d_map**7
399
+ + 3.03535823592644e-4 * r_d_map**6
400
+ - 5.64777117315819e-4 * r_d_map**5
401
+ + 2.44582905523866e-4 * r_d_map**4
402
+ - 1.68215579314751e-5 * r_d_map**3
403
+ - 2.62344345204941e-2 * r_d_map**2
404
+ - 4.14559953526389e-8 * r_d_map
405
+ - 1.19918511290930e-2
406
+ )
407
+ self._d_map[5, 0, i] = (
408
+ 1.08994931098070e-3 * r_d_map**7
409
+ - 1.41445142143525e-4 * r_d_map**6
410
+ + 3.64794490139160e-4 * r_d_map**5
411
+ - 8.86057426195227e-4 * r_d_map**4
412
+ + 1.08681882832738e-5 * r_d_map**3
413
+ + 2.07238558666603e-2 * r_d_map**2
414
+ + 2.67876079477806e-8 * r_d_map
415
+ + 4.17058420250698e-3
416
+ )
417
+ self._d_map[6, 0, i] = (
418
+ -6.39950124405340e-4 * r_d_map**7
419
+ + 6.06079815415080e-5 * r_d_map**6
420
+ - 2.14633466007892e-4 * r_d_map**5
421
+ + 6.84580412267934e-4 * r_d_map**4
422
+ - 6.39907927898092e-6 * r_d_map**3
423
+ - 1.29825288653404e-2 * r_d_map**2
424
+ - 1.57775422151124e-8 * r_d_map
425
+ - 1.29998325971518e-3
426
+ )
427
+ self._d_map[7, 0, i] = (
428
+ 2.92716539609611e-4 * r_d_map**7
429
+ - 1.87446062803024e-5 * r_d_map**6
430
+ + 9.85389372183761e-5 * r_d_map**5
431
+ - 2.40360290348543e-4 * r_d_map**4
432
+ + 2.94166215515130e-6 * r_d_map**3
433
+ + 5.57066438452790e-3 * r_d_map**2
434
+ + 7.25741366376659e-9 * r_d_map
435
+ + 3.18698432679400e-4
436
+ )
437
+ self._d_map[8, 0, i] = (
438
+ -6.42183857909518e-5 * r_d_map**7
439
+ + 3.38552867751042e-6 * r_d_map**6
440
+ - 2.17377151411164e-5 * r_d_map**5
441
+ + 4.98269067389945e-5 * r_d_map**4
442
+ - 6.50197868987757e-7 * r_d_map**3
443
+ - 1.19096089679178e-3 * r_d_map**2
444
+ - 1.60559948991172e-9 * r_d_map
445
+ - 4.57795411807702e-5
446
+ )
447
+ self._d_map[1, 1, i] = (
448
+ -4.47723278782936e-5 * r_d_map**7
449
+ - 7.69502473399932e-5 * r_d_map**6
450
+ - 1.41765498250133e-5 * r_d_map**5
451
+ - 2.54672045901272e-3 * r_d_map**4
452
+ - 4.14343385915353e-7 * r_d_map**3
453
+ + 5.00210047924752e-2 * r_d_map**2
454
+ - 1.01220354410507e-9 * r_d_map
455
+ - 8.07139347787336e-8
456
+ )
457
+ else:
458
+ for i in range(dim + 1):
459
+ r_d_map = (i + c_map.min()) * self.grid.dt / self.grid.dx
460
+ self._d_map[1, 0, i] = (
461
+ -0.000874634088067635 * r_d_map**7
462
+ - 0.00180530560296097 * r_d_map**6
463
+ - 0.000440512972481673 * r_d_map**5
464
+ + 0.00474018847663366 * r_d_map**4
465
+ - 1.93097802254349e-05 * r_d_map**3
466
+ - 0.292328221171893 * r_d_map**2
467
+ - 6.58101498708345e-08 * r_d_map
468
+ + 1.25420636437969
469
+ )
470
+ self._d_map[2, 0, i] = (
471
+ 0.000793317828964018 * r_d_map**7
472
+ + 0.00161433256585486 * r_d_map**6
473
+ + 0.000397244786277123 * r_d_map**5
474
+ + 0.00546057645976549 * r_d_map**4
475
+ + 1.73781972873916e-05 * r_d_map**3
476
+ + 0.0588754971188371 * r_d_map**2
477
+ + 5.91706982879834e-08 * r_d_map
478
+ - 0.123406473759703
479
+ )
480
+ self._d_map[3, 0, i] = (
481
+ -0.000650217700538851 * r_d_map**7
482
+ - 0.00116449260340413 * r_d_map**6
483
+ - 0.000324403734066325 * r_d_map**5
484
+ - 0.00911483710059994 * r_d_map**4
485
+ - 1.417399823126e-05 * r_d_map**3
486
+ + 0.0233184077551615 * r_d_map**2
487
+ - 4.82326094707544e-08 * r_d_map
488
+ + 0.0346342451534453
489
+ )
490
+ self._d_map[4, 0, i] = (
491
+ 0.000467529510541428 * r_d_map**7
492
+ + 0.000732736676632388 * r_d_map**6
493
+ + 0.000232444388955328 * r_d_map**5
494
+ + 0.00846419766685254 * r_d_map**4
495
+ + 1.01438593426278e-05 * r_d_map**3
496
+ - 0.0317586249260511 * r_d_map**2
497
+ + 3.44988852042879e-08 * r_d_map
498
+ - 0.0119674942518101
499
+ )
500
+ self._d_map[5, 0, i] = (
501
+ -0.000298416281187033 * r_d_map**7
502
+ - 0.000399380750669364 * r_d_map**6
503
+ - 0.000148203388388213 * r_d_map**5
504
+ - 0.00601788793192501 * r_d_map**4
505
+ - 6.46543538517443e-06 * r_d_map**3
506
+ + 0.0241912754935119 * r_d_map**2
507
+ - 2.19855171569984e-08 * r_d_map
508
+ + 0.00415554391204146
509
+ )
510
+ self._d_map[6, 0, i] = (
511
+ 0.000167882669698981 * r_d_map**7
512
+ + 0.000188195874702691 * r_d_map**6
513
+ + 8.3057921860396e-05 * r_d_map**5
514
+ + 0.00348461963201376 * r_d_map**4
515
+ + 3.61873162287129e-06 * r_d_map**3
516
+ - 0.0149875789940005 * r_d_map**2
517
+ + 1.22979142197165e-08 * r_d_map
518
+ - 0.00129213888778954
519
+ )
520
+ self._d_map[7, 0, i] = (
521
+ -6.22209937489143e-05 * r_d_map**7
522
+ - 6.44890425871692e-05 * r_d_map**6
523
+ - 3.02936928954918e-05 * r_d_map**5
524
+ - 0.00133386143898282 * r_d_map**4
525
+ - 1.31215186728213e-06 * r_d_map**3
526
+ + 0.00670228205200379 * r_d_map**2
527
+ - 4.44653967516776e-09 * r_d_map
528
+ + 0.000315659916047599
529
+ )
530
+ self._d_map[8, 0, i] = (
531
+ 6.8474088109024e-06 * r_d_map**7
532
+ + 1.14082245705934e-05 * r_d_map**6
533
+ + 3.0372759370575e-06 * r_d_map**5
534
+ + 0.000236122782444105 * r_d_map**4
535
+ + 1.26768491232397e-07 * r_d_map**3
536
+ - 0.00153347270556276 * r_d_map**2
537
+ + 4.21617557752767e-10 * r_d_map
538
+ - 4.51948990428065e-05
539
+ )
540
+ self._d_map[1, 1, i] = (
541
+ 2.13188763071246e-06 * r_d_map**7
542
+ - 7.41025068776257e-05 * r_d_map**6
543
+ + 2.31652037371554e-06 * r_d_map**5
544
+ - 0.00259495924602038 * r_d_map**4
545
+ + 1.20637183170338e-07 * r_d_map**3
546
+ + 0.0521123771632193 * r_d_map**2
547
+ + 4.42258843694177e-10 * r_d_map
548
+ - 4.20967682664542e-07
549
+ )
550
+
551
+ def _set_dc_map(self, c_map: NDArray[np.float64]) -> None:
552
+ self._dc_map = matlab_round(c_map) - matlab_round(c_map.min()) + 1
553
+
554
+ # --- saving utils ---
555
+
556
+ def _save_variables_into_dat_file(
557
+ self,
558
+ simulation_dir: Path,
559
+ relaxation_param_map_dict_for_fw2: dict[str, NDArray[np.float64]],
560
+ dim: int,
561
+ ) -> None:
562
+ self._save_maps(
563
+ simulation_dir,
564
+ c_map=self.medium.sound_speed,
565
+ k_map=self.medium.bulk_modulus,
566
+ rho_map=self.medium.density,
567
+ beta_map=self.medium.beta,
568
+ )
569
+ self._save_coords(simulation_dir=simulation_dir)
570
+ self._save_step_params(simulation_dir)
571
+ self._save_coords_params(simulation_dir)
572
+ self._save_d_params(simulation_dir, dim)
573
+
574
+ if self.use_isotropic_relaxation:
575
+ rename_dict = {
576
+ "kappa_x": "kappax",
577
+ "kappa_u": "kappau",
578
+ }
579
+
580
+ for nu in range(1, self.medium.n_relaxation_mechanisms + 1):
581
+ rename_dict[f"a_pml_u{nu}"] = f"apmlu{nu}"
582
+ rename_dict[f"b_pml_u{nu}"] = f"bpmlu{nu}"
583
+ rename_dict[f"a_pml_x{nu}"] = f"apmlx{nu}"
584
+ rename_dict[f"b_pml_x{nu}"] = f"bpmlx{nu}"
585
+ else:
586
+ rename_dict = {
587
+ "kappa_x": "kappax",
588
+ "kappa_y": "kappay",
589
+ "kappa_u": "kappau",
590
+ "kappa_w": "kappaw",
591
+ }
592
+ if self.is_3d:
593
+ rename_dict.update(
594
+ {
595
+ "kappa_z": "kappaz",
596
+ "kappa_v": "kappav",
597
+ },
598
+ )
599
+
600
+ for nu in range(1, self.medium.n_relaxation_mechanisms + 1):
601
+ rename_dict[f"a_pml_u{nu}"] = f"apmlu{nu}"
602
+ rename_dict[f"b_pml_u{nu}"] = f"bpmlu{nu}"
603
+ rename_dict[f"a_pml_w{nu}"] = f"apmlw{nu}"
604
+ rename_dict[f"b_pml_w{nu}"] = f"bpmlw{nu}"
605
+ rename_dict[f"a_pml_x{nu}"] = f"apmlx{nu}"
606
+ rename_dict[f"b_pml_x{nu}"] = f"bpmlx{nu}"
607
+ rename_dict[f"a_pml_y{nu}"] = f"apmly{nu}"
608
+ rename_dict[f"b_pml_y{nu}"] = f"bpmly{nu}"
609
+ if self.is_3d:
610
+ rename_dict[f"a_pml_z{nu}"] = f"apmlz{nu}"
611
+ rename_dict[f"b_pml_z{nu}"] = f"bpmlz{nu}"
612
+ rename_dict[f"a_pml_v{nu}"] = f"apmlv{nu}"
613
+ rename_dict[f"b_pml_v{nu}"] = f"bpmlv{nu}"
614
+
615
+ # save relaxation params
616
+ for var_name, var in relaxation_param_map_dict_for_fw2.items():
617
+ if var_name in rename_dict:
618
+ var_name_fw2 = rename_dict[var_name]
619
+ save_path = simulation_dir / f"{var_name_fw2}.dat"
620
+ self._write_matrix(var_type=np.float32, save_path=save_path, variable_mat=var)
621
+
622
+ def _save_variables_into_dat_file_exponential_attenuation(
623
+ self,
624
+ simulation_dir: Path,
625
+ dim: int,
626
+ ) -> None:
627
+ self._save_maps(
628
+ simulation_dir,
629
+ c_map=self.medium.sound_speed,
630
+ k_map=self.medium.bulk_modulus,
631
+ rho_map=self.medium.density,
632
+ beta_map=self.medium.beta,
633
+ alpha_exp_map=self.medium.alpha_exp,
634
+ )
635
+ self._save_coords(simulation_dir=simulation_dir)
636
+ self._save_step_params(simulation_dir)
637
+ self._save_coords_params(simulation_dir)
638
+ self._save_d_params(simulation_dir, dim)
639
+
640
+ def _build_symbolic_links_for_dat_files(self, src_dir: Path, dst_dir: Path) -> None:
641
+ var_name_list = [
642
+ "c",
643
+ "K",
644
+ "rho",
645
+ "beta",
646
+ "dX",
647
+ "dY",
648
+ "dT",
649
+ "c0",
650
+ "icc",
651
+ "outc",
652
+ "nY",
653
+ "nX",
654
+ "nT",
655
+ "ncoords",
656
+ "ncoordsout",
657
+ "nTic",
658
+ "modT",
659
+ "d",
660
+ "dmap",
661
+ "ndmap",
662
+ "dcmap",
663
+ "kappax",
664
+ "kappay",
665
+ "kappau",
666
+ "kappaw",
667
+ "apmlu1",
668
+ "bpmlu1",
669
+ "apmlw1",
670
+ "bpmlw1",
671
+ "apmlx1",
672
+ "bpmlx1",
673
+ "apmly1",
674
+ "bpmly1",
675
+ "apmlu2",
676
+ "bpmlu2",
677
+ "apmlw2",
678
+ "bpmlw2",
679
+ "apmlx2",
680
+ "bpmlx2",
681
+ "apmly2",
682
+ "bpmly2",
683
+ ]
684
+ if self.is_3d:
685
+ var_name_list.extend(
686
+ [
687
+ "nZ",
688
+ "dZ",
689
+ "kappaz",
690
+ "kappav",
691
+ "apmlz1",
692
+ "bpmlz1",
693
+ "apmlv1",
694
+ "bpmlv1",
695
+ "apmlz2",
696
+ "bpmlz2",
697
+ "apmlv2",
698
+ "bpmlv2",
699
+ ],
700
+ )
701
+ for var_name in var_name_list:
702
+ src_data = src_dir / f"{var_name}.dat"
703
+ dst_data = dst_dir / f"{var_name}.dat"
704
+ # generate the symlink even if the file already exists
705
+ if dst_data.exists():
706
+ dst_data.unlink()
707
+ os.symlink(src_data, dst_data)
708
+
709
+ def _save_maps(
710
+ self,
711
+ simulation_dir: Path,
712
+ c_map: NDArray[np.float64],
713
+ k_map: NDArray[np.float64],
714
+ rho_map: NDArray[np.float64],
715
+ beta_map: NDArray[np.float64],
716
+ *,
717
+ alpha_exp_map: NDArray[np.float64] | None = None,
718
+ ) -> None:
719
+ self._write_matrix(
720
+ var_type=np.float32,
721
+ save_path=simulation_dir / "c.dat",
722
+ variable_mat=c_map,
723
+ )
724
+ self._write_matrix(
725
+ var_type=np.float32,
726
+ save_path=simulation_dir / "K.dat",
727
+ variable_mat=k_map,
728
+ )
729
+ self._write_matrix(
730
+ var_type=np.float32,
731
+ save_path=simulation_dir / "rho.dat",
732
+ variable_mat=rho_map,
733
+ )
734
+ self._write_matrix(
735
+ var_type=np.float32,
736
+ save_path=simulation_dir / "beta.dat",
737
+ variable_mat=beta_map,
738
+ )
739
+ if alpha_exp_map is not None:
740
+ self._write_matrix(
741
+ var_type=np.float32,
742
+ save_path=simulation_dir / "a_exp.dat",
743
+ variable_mat=alpha_exp_map,
744
+ )
745
+
746
+ def _save_coords(self, simulation_dir: Path) -> None:
747
+ self._write_coords(simulation_dir / "icc.dat", self.source.incoords)
748
+ self._write_coords(
749
+ simulation_dir / "outc.dat",
750
+ self.sensor.outcoords,
751
+ )
752
+ self._write_coords(
753
+ simulation_dir / "icczero.dat",
754
+ map_to_coords(self.medium.air_map),
755
+ )
756
+
757
+ # self._write_ic(simulation_dir / "icmat.dat", np.transpose(initial_condition_mat))
758
+
759
+ def _save_step_params(self, simulation_dir: Path) -> None:
760
+ var_list = [
761
+ ("dX", self.grid.dx),
762
+ ("dY", self.grid.dy),
763
+ ("dT", self.grid.dt),
764
+ ("c0", self.grid.c0),
765
+ ]
766
+ if self.is_3d:
767
+ var_list.extend(
768
+ [
769
+ ("dZ", self.grid.dz),
770
+ ],
771
+ )
772
+ for var_name, var in var_list:
773
+ save_path = simulation_dir / f"{var_name}.dat"
774
+ self._write_v_abs(np.float32, save_path, var)
775
+
776
+ def _save_coords_params(self, simulation_dir: Path) -> None:
777
+ nt_ic = self.source.icmat.shape[1]
778
+ var_list = [
779
+ ("nX", self.grid.nx),
780
+ ("nY", self.grid.ny),
781
+ ("nT", self.grid.nt),
782
+ ("ncoords", self.source.n_sources),
783
+ ("ncoordsout", self.sensor.n_sensors),
784
+ ("ncoordszero", self.medium.n_air),
785
+ ("nTic", nt_ic),
786
+ ("modT", self.sensor.sampling_modulus_time),
787
+ ]
788
+ if self.is_3d:
789
+ var_list.extend(
790
+ [
791
+ ("nZ", self.grid.nz),
792
+ ],
793
+ )
794
+ for var_name, var in var_list:
795
+ save_path = simulation_dir / f"{var_name}.dat"
796
+ self._write_v_abs(np.int32, save_path, var)
797
+
798
+ def _save_d_params(self, simulation_dir: Path, dim: int) -> None:
799
+ # save d and dmap
800
+ self._write_matrix(np.float32, simulation_dir / "d.dat", self._d)
801
+ self._write_matrix(np.float32, simulation_dir / "dmap.dat", self._d_map)
802
+
803
+ # save ndmap
804
+ ndmap = 1 if dim == 0 else self._d_map.shape[2]
805
+
806
+ self._write_v_abs(np.int32, simulation_dir / "ndmap.dat", ndmap)
807
+
808
+ # save dcmap
809
+ self._write_matrix(
810
+ var_type=np.int32,
811
+ save_path=simulation_dir / "dcmap.dat",
812
+ variable_mat=(self._dc_map - 1),
813
+ # variable_mat=(self._dc_map),
814
+ )
815
+
816
+ def _copy_simulation_bin_file(self, simulation_dir: Path) -> None:
817
+ shutil.copy(
818
+ src=self.path_fullwave_simulation_bin,
819
+ dst=simulation_dir / self.path_fullwave_simulation_bin.name,
820
+ )
821
+
822
+ @staticmethod
823
+ def _write_ic(fname: str | Path, icmat: NDArray[np.float64]) -> None:
824
+ icmat.T.flatten().astype(np.float32).tofile(fname)
825
+
826
+ @staticmethod
827
+ def _write_coords(
828
+ fname: str | Path,
829
+ coords: NDArray[np.float64 | np.int64],
830
+ # *,
831
+ # swap_ij: bool = False,
832
+ ) -> None:
833
+ # if swap_ij:
834
+ # np.array([coords[:, 1], coords[:, 0]]).T.flatten().astype(np.int32).tofile(fname)
835
+ # else:
836
+ # coords.T.flatten().astype(np.int32).tofile(fname)
837
+ coords.flatten().astype(np.int32).tofile(fname)
838
+
839
+ @staticmethod
840
+ def _write_v_abs(
841
+ var_type: DTypeLike,
842
+ save_path: str | Path,
843
+ variable: NDArray[np.float64 | np.int32] | float,
844
+ ) -> None:
845
+ np.array(variable).astype(var_type).tofile(save_path)
846
+
847
+ @staticmethod
848
+ def _write_matrix(
849
+ var_type: DTypeLike,
850
+ save_path: str | Path,
851
+ variable_mat: NDArray[np.float64],
852
+ ) -> None:
853
+ variable_mat.astype(var_type).tofile(save_path)