radia 1.3.14__tar.gz → 1.3.16__tar.gz

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.
Files changed (238) hide show
  1. {radia-1.3.14/src/radia.egg-info → radia-1.3.16}/PKG-INFO +3 -1
  2. radia-1.3.16/docs/API_REFERENCE.md +686 -0
  3. radia-1.3.16/docs/README.md +20 -0
  4. {radia-1.3.14 → radia-1.3.16}/examples/README.md +9 -5
  5. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/README.md +2 -2
  6. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/permeability_comparison.py +2 -3
  7. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/sphere_nastran_analysis.py +2 -2
  8. {radia-1.3.14 → radia-1.3.16}/examples/cube_uniform_field/README.md +12 -11
  9. radia-1.3.16/examples/cube_uniform_field/linear/README.md +214 -0
  10. radia-1.3.16/examples/cube_uniform_field/linear/benchmark_conditions.py +129 -0
  11. radia-1.3.16/examples/cube_uniform_field/linear/benchmark_hexa_unified.py +206 -0
  12. {radia-1.3.14/examples/cube_uniform_field/nonlinear → radia-1.3.16/examples/cube_uniform_field/linear}/benchmark_tetra_unified.py +253 -204
  13. radia-1.3.16/examples/cube_uniform_field/linear/compare_radia_elf.py +157 -0
  14. radia-1.3.16/examples/cube_uniform_field/linear/verify_radia_vs_elf.py +287 -0
  15. radia-1.3.16/examples/cube_uniform_field/nonlinear/README.md +229 -0
  16. {radia-1.3.14 → radia-1.3.16}/examples/cube_uniform_field/nonlinear/benchmark_conditions.py +7 -4
  17. radia-1.3.16/examples/cube_uniform_field/nonlinear/benchmark_hexahedron_hacapk.py +332 -0
  18. radia-1.3.16/examples/cube_uniform_field/nonlinear/benchmark_hexahedron_msc.py +440 -0
  19. radia-1.3.16/examples/cube_uniform_field/nonlinear/benchmark_tetra_all_solvers.py +327 -0
  20. radia-1.3.16/examples/cube_uniform_field/nonlinear/benchmark_tetrahedron_msc_netgen.py +352 -0
  21. {radia-1.3.14 → radia-1.3.16}/examples/magpylib_integration/cylinder_magnet_examples.py +1 -1
  22. {radia-1.3.14 → radia-1.3.16}/examples/magpylib_integration/demo_magpylib_integration.py +2 -2
  23. {radia-1.3.14 → radia-1.3.16}/examples/magpylib_integration/sphere_in_halbach_cylinder.py +1 -1
  24. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/README.md +22 -1
  25. radia-1.3.16/examples/ngsolve_integration/RadiaField_HACApK/verify_batch_evaluation.py +260 -0
  26. radia-1.3.16/examples/ngsolve_integration/mesh_magnetization_import/README.md +202 -0
  27. radia-1.3.16/examples/ngsolve_integration/mesh_magnetization_import/sphere_analytical_to_radia.py +282 -0
  28. radia-1.3.16/examples/ngsolve_integration/mesh_magnetization_import/verified_ngsolve_to_radia.py +534 -0
  29. radia-1.3.16/examples/ngsolve_integration/verify_curl_A_equals_B/verify_curl_A_equals_B.py +297 -0
  30. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/CONVERSION_NOTES.md +0 -1
  31. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/README.md +3 -5
  32. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_linear_material.py +2 -2
  33. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_lu_vs_hmatrix.py +2 -2
  34. radia-1.3.16/examples/tetra_field_accuracy_evaluation/README.md +151 -0
  35. radia-1.3.16/examples/tetra_field_accuracy_evaluation/analytical_reference.py +320 -0
  36. radia-1.3.16/examples/tetra_field_accuracy_evaluation/compare_all.py +290 -0
  37. radia-1.3.16/examples/tetra_field_accuracy_evaluation/evaluate_radia_solvers.py +419 -0
  38. radia-1.3.16/examples/tetra_field_accuracy_evaluation/evaluate_tetra_field.py +416 -0
  39. radia-1.3.16/examples/tetra_field_accuracy_evaluation/ngsolve_reference.py +302 -0
  40. {radia-1.3.14 → radia-1.3.16}/pyproject.toml +7 -1
  41. {radia-1.3.14 → radia-1.3.16}/src/radia/__init__.py +1 -1
  42. {radia-1.3.14 → radia-1.3.16}/src/radia/netgen_mesh_import.py +22 -0
  43. radia-1.3.16/src/radia/radia.pyd +0 -0
  44. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_ngsolve.pyd +0 -0
  45. {radia-1.3.14 → radia-1.3.16/src/radia.egg-info}/PKG-INFO +3 -1
  46. {radia-1.3.14 → radia-1.3.16}/src/radia.egg-info/SOURCES.txt +18 -48
  47. {radia-1.3.14 → radia-1.3.16}/src/radia.egg-info/requires.txt +3 -0
  48. {radia-1.3.14 → radia-1.3.16}/tests/test_mesh_import.py +62 -188
  49. radia-1.3.14/docs/API_EXTENSIONS.md +0 -765
  50. radia-1.3.14/docs/API_REFERENCE.md +0 -1035
  51. radia-1.3.14/docs/CF_BACKGROUND_FIELD_IMPLEMENTATION.md +0 -485
  52. radia-1.3.14/docs/HMATRIX_SERIALIZATION.md +0 -371
  53. radia-1.3.14/docs/HMATRIX_USER_GUIDE.md +0 -656
  54. radia-1.3.14/docs/HYBRID_DOF_SOLVER_DESIGN.md +0 -370
  55. radia-1.3.14/docs/MATERIAL_API_IMPLEMENTATION.md +0 -303
  56. radia-1.3.14/docs/MESH_MSC_API_DESIGN.md +0 -663
  57. radia-1.3.14/docs/ML_PARAMETER_TUNING.md +0 -339
  58. radia-1.3.14/docs/MMM_MSC_IMPLEMENTATION.md +0 -175
  59. radia-1.3.14/docs/NGSOLVE_CF_BACKGROUND_FIELD_DESIGN.md +0 -665
  60. radia-1.3.14/docs/NGSOLVE_INTEGRATION.md +0 -365
  61. radia-1.3.14/docs/NGSOLVE_USAGE_GUIDE.md +0 -299
  62. radia-1.3.14/docs/README.md +0 -110
  63. radia-1.3.14/docs/SOLVER_METHODS.md +0 -207
  64. radia-1.3.14/docs/SUPPORTED_ELEMENTS.md +0 -199
  65. radia-1.3.14/examples/cube_uniform_field/linear/README.md +0 -334
  66. radia-1.3.14/examples/cube_uniform_field/linear/README_CUBE_BENCHMARK.md +0 -331
  67. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_bicgstab_dense.py +0 -195
  68. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_external_field.py +0 -379
  69. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_high_mu.py +0 -318
  70. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_mesh_convergence.py +0 -410
  71. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_solver_methods.py +0 -53
  72. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_tetra_vs_hex.py +0 -275
  73. radia-1.3.14/examples/cube_uniform_field/linear/benchmark_tetra_vs_ngsolve.py +0 -349
  74. radia-1.3.14/examples/cube_uniform_field/linear/compare_external_field.py +0 -406
  75. radia-1.3.14/examples/cube_uniform_field/linear/cube_benchmark_external_field.py +0 -326
  76. radia-1.3.14/examples/cube_uniform_field/linear/cube_benchmark_radia.vtk +0 -225
  77. radia-1.3.14/examples/cube_uniform_field/linear/evaluate_perturbation_field.py +0 -370
  78. radia-1.3.14/examples/cube_uniform_field/linear/precision_evaluation.py +0 -504
  79. radia-1.3.14/examples/cube_uniform_field/linear/test_method9_fine_mesh.py +0 -132
  80. radia-1.3.14/examples/cube_uniform_field/linear/test_method9_high_mu.py +0 -138
  81. radia-1.3.14/examples/cube_uniform_field/nonlinear/README.md +0 -135
  82. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_bicgstab_hex.py +0 -198
  83. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_element_types.py +0 -394
  84. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_hexa_unified.py +0 -198
  85. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_hexahedron_msc.py +0 -289
  86. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_nonlinear_tetra_vs_hex.py +0 -230
  87. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_solver_methods.py +0 -252
  88. radia-1.3.14/examples/cube_uniform_field/nonlinear/benchmark_tetra_netgen.py +0 -228
  89. radia-1.3.14/examples/cube_uniform_field/nonlinear/compare_radia_elfmagic_field.py +0 -195
  90. radia-1.3.14/examples/cube_uniform_field/nonlinear/compare_tetra_methods.py +0 -227
  91. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/RADIA_TETRA_ROOT_CAUSE.md +0 -62
  92. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/README.md +0 -274
  93. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/compare_radia_ngsolve_cube.py +0 -191
  94. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/cube_hex.vtk +0 -601
  95. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/demo_tetrahedral_methods_comparison.py +0 -91
  96. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/ngsolve_cube_graded_mesh.vtk +0 -130354
  97. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/ngsolve_tet_mesh.vtk +0 -130354
  98. radia-1.3.14/examples/ngsolve_integration/mesh_magnetization_import/sphere_domain_graded_mesh.vtk +0 -6817
  99. radia-1.3.14/examples/ngsolve_integration/test_batch_evaluation.py +0 -143
  100. radia-1.3.14/examples/ngsolve_integration/test_unit_conversion.py +0 -173
  101. radia-1.3.14/examples/ngsolve_integration/verify_curl_A_equals_B.py +0 -352
  102. radia-1.3.14/src/radia/radia.pyd +0 -0
  103. {radia-1.3.14 → radia-1.3.16}/COPYRIGHT.txt +0 -0
  104. {radia-1.3.14 → radia-1.3.16}/LICENSE +0 -0
  105. {radia-1.3.14 → radia-1.3.16}/MANIFEST.in +0 -0
  106. {radia-1.3.14 → radia-1.3.16}/README.md +0 -0
  107. {radia-1.3.14 → radia-1.3.16}/docs/HMATRIX_EVALUATION.md +0 -0
  108. {radia-1.3.14 → radia-1.3.16}/docs/scripts/README.md +0 -0
  109. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/cubit_to_nastran.py +0 -0
  110. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/quadrupole_analytical.py +0 -0
  111. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/quadrupole_analytical.vtk.vtk +0 -0
  112. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/sphere_in_quadrupole.py +0 -0
  113. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/sphere_nastran_field_mu.pvsm +0 -0
  114. {radia-1.3.14 → radia-1.3.16}/examples/background_fields/sphere_nastran_geometry.vtk +0 -0
  115. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/README.md +0 -0
  116. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/coil_geometry.vtk +0 -0
  117. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/coil_model.py +0 -0
  118. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/complex_coil.pvsm +0 -0
  119. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/field_map.py +0 -0
  120. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/field_map.vtk +0 -0
  121. {radia-1.3.14 → radia-1.3.16}/examples/complex_coil_geometry/visualize_coils.py +0 -0
  122. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/README.md +0 -0
  123. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/Radia_model.vtk +0 -0
  124. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/York.vtk +0 -0
  125. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/field_distribution.vtk +0 -0
  126. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/main_simulation_workflow.py +0 -0
  127. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/visualize_paraview.py +0 -0
  128. {radia-1.3.14 → radia-1.3.16}/examples/electromagnet/york_cubit_mesh.py +0 -0
  129. {radia-1.3.14 → radia-1.3.16}/examples/magpylib_integration/README.md +0 -0
  130. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/benchmark_gridfunction_set.py +0 -0
  131. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/demo_basic_field.py +0 -0
  132. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/demo_batch_evaluation.py +0 -0
  133. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/demo_coordinate_transform.py +0 -0
  134. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/demo_field_types.py +0 -0
  135. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/demo_hdiv_projection.py +0 -0
  136. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/mesh_magnetization_import/ngsolve_cube_uniform_field.py +0 -0
  137. {radia-1.3.14 → radia-1.3.16}/examples/ngsolve_integration/visualize_field.py +0 -0
  138. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/arc_current_dual_magnets.py +0 -0
  139. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/arc_current_with_magnet.py +0 -0
  140. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/chamfered_pole_piece.py +0 -0
  141. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/compare_magpylib.py +0 -0
  142. {radia-1.3.14 → radia-1.3.16}/examples/simple_problems/cubic_polyhedron_magnet.py +0 -0
  143. {radia-1.3.14 → radia-1.3.16}/examples/smco_magnet_array/README.md +0 -0
  144. {radia-1.3.14 → radia-1.3.16}/examples/smco_magnet_array/smbo.pvsm +0 -0
  145. {radia-1.3.14 → radia-1.3.16}/examples/smco_magnet_array/smco_array.py +0 -0
  146. {radia-1.3.14 → radia-1.3.16}/examples/smco_magnet_array/smco_array.vtk +0 -0
  147. {radia-1.3.14 → radia-1.3.16}/examples/smco_magnet_array/smco_field_distribution.vtk +0 -0
  148. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/BENCHMARK_RESULTS.md +0 -0
  149. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/README.md +0 -0
  150. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_field_evaluation.py +0 -0
  151. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_large_scale_comparison.py +0 -0
  152. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_matrix_construction.py +0 -0
  153. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_parallel_construction.py +0 -0
  154. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_solver.py +0 -0
  155. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_solver_comparison.py +0 -0
  156. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_solver_methods.py +0 -0
  157. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_solver_scaling.py +0 -0
  158. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/benchmark_solver_scaling_extended.py +0 -0
  159. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/plot_benchmark_results.py +0 -0
  160. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/run_all_benchmarks.py +0 -0
  161. {radia-1.3.14 → radia-1.3.16}/examples/solver_benchmarks/verify_field_accuracy.py +0 -0
  162. {radia-1.3.14 → radia-1.3.16}/setup.cfg +0 -0
  163. {radia-1.3.14 → radia-1.3.16}/setup.py +0 -0
  164. {radia-1.3.14 → radia-1.3.16}/src/radia/libopenblas.dll +0 -0
  165. {radia-1.3.14 → radia-1.3.16}/src/radia/nastran_mesh_import.py +0 -0
  166. {radia-1.3.14 → radia-1.3.16}/src/radia/rad_ngsolve_fast.py +0 -0
  167. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_coil_builder.py +0 -0
  168. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_field_cached.py +0 -0
  169. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_ngsolve_field.py +0 -0
  170. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_ngsolve_utils.py +0 -0
  171. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_pyvista_viewer.py +0 -0
  172. {radia-1.3.14 → radia-1.3.16}/src/radia/radia_vtk_export.py +0 -0
  173. {radia-1.3.14 → radia-1.3.16}/src/radia.egg-info/dependency_links.txt +0 -0
  174. {radia-1.3.14 → radia-1.3.16}/src/radia.egg-info/not-zip-safe +0 -0
  175. {radia-1.3.14 → radia-1.3.16}/src/radia.egg-info/top_level.txt +0 -0
  176. {radia-1.3.14 → radia-1.3.16}/tests/README.md +0 -0
  177. {radia-1.3.14 → radia-1.3.16}/tests/__init__.py +0 -0
  178. {radia-1.3.14 → radia-1.3.16}/tests/benchmarks/benchmark_correct.py +0 -0
  179. {radia-1.3.14 → radia-1.3.16}/tests/benchmarks/benchmark_heavy.py +0 -0
  180. {radia-1.3.14 → radia-1.3.16}/tests/benchmarks/benchmark_openmp.py +0 -0
  181. {radia-1.3.14 → radia-1.3.16}/tests/benchmarks/benchmark_threads.py +0 -0
  182. {radia-1.3.14 → radia-1.3.16}/tests/conftest.py +0 -0
  183. {radia-1.3.14 → radia-1.3.16}/tests/profile_batch_performance.py +0 -0
  184. {radia-1.3.14 → radia-1.3.16}/tests/test_advanced.py +0 -0
  185. {radia-1.3.14 → radia-1.3.16}/tests/test_all_spaces.py +0 -0
  186. {radia-1.3.14 → radia-1.3.16}/tests/test_background_field_debug.py +0 -0
  187. {radia-1.3.14 → radia-1.3.16}/tests/test_batch_evaluation.py +0 -0
  188. {radia-1.3.14 → radia-1.3.16}/tests/test_cf_direct.py +0 -0
  189. {radia-1.3.14 → radia-1.3.16}/tests/test_convergence_hdiv.py +0 -0
  190. {radia-1.3.14 → radia-1.3.16}/tests/test_curlA_equals_B.py +0 -0
  191. {radia-1.3.14 → radia-1.3.16}/tests/test_curl_A_detailed.py +0 -0
  192. {radia-1.3.14 → radia-1.3.16}/tests/test_far_field_accuracy.py +0 -0
  193. {radia-1.3.14 → radia-1.3.16}/tests/test_fast_preparecache.py +0 -0
  194. {radia-1.3.14 → radia-1.3.16}/tests/test_fast_simple.py +0 -0
  195. {radia-1.3.14 → radia-1.3.16}/tests/test_group_operations.py +0 -0
  196. {radia-1.3.14 → radia-1.3.16}/tests/test_hcurl_vs_hdiv.py +0 -0
  197. {radia-1.3.14 → radia-1.3.16}/tests/test_l2_norm_debug.py +0 -0
  198. {radia-1.3.14 → radia-1.3.16}/tests/test_magpylib_comparison.py +0 -0
  199. {radia-1.3.14 → radia-1.3.16}/tests/test_materials.py +0 -0
  200. {radia-1.3.14 → radia-1.3.16}/tests/test_memory_allocation_tracking.py +0 -0
  201. {radia-1.3.14 → radia-1.3.16}/tests/test_minimal_cached.py +0 -0
  202. {radia-1.3.14 → radia-1.3.16}/tests/test_moving_magnet_memory.py +0 -0
  203. {radia-1.3.14 → radia-1.3.16}/tests/test_moving_magnet_memory_diagnosis.py +0 -0
  204. {radia-1.3.14 → radia-1.3.16}/tests/test_new_material_api.py +0 -0
  205. {radia-1.3.14 → radia-1.3.16}/tests/test_ngsolve_integration.py +0 -0
  206. {radia-1.3.14 → radia-1.3.16}/tests/test_objbckg_simple.py +0 -0
  207. {radia-1.3.14 → radia-1.3.16}/tests/test_objbckgcf_alone.py +0 -0
  208. {radia-1.3.14 → radia-1.3.16}/tests/test_order1.py +0 -0
  209. {radia-1.3.14 → radia-1.3.16}/tests/test_parallel_performance.py +0 -0
  210. {radia-1.3.14 → radia-1.3.16}/tests/test_preparecache_performance.py +0 -0
  211. {radia-1.3.14 → radia-1.3.16}/tests/test_process_memory.py +0 -0
  212. {radia-1.3.14 → radia-1.3.16}/tests/test_python_cached_field.py +0 -0
  213. {radia-1.3.14 → radia-1.3.16}/tests/test_python_cached_simple.py +0 -0
  214. {radia-1.3.14 → radia-1.3.16}/tests/test_rad_ngsolve.py +0 -0
  215. {radia-1.3.14 → radia-1.3.16}/tests/test_rad_ngsolve_diagnostic.py +0 -0
  216. {radia-1.3.14 → radia-1.3.16}/tests/test_rad_ngsolve_function.py +0 -0
  217. {radia-1.3.14 → radia-1.3.16}/tests/test_radhmat.py +0 -0
  218. {radia-1.3.14 → radia-1.3.16}/tests/test_radia.py +0 -0
  219. {radia-1.3.14 → radia-1.3.16}/tests/test_radia_core_memory.py +0 -0
  220. {radia-1.3.14 → radia-1.3.16}/tests/test_radia_field_computation_memory.py +0 -0
  221. {radia-1.3.14 → radia-1.3.16}/tests/test_radia_ngsolve_longrun.py +0 -0
  222. {radia-1.3.14 → radia-1.3.16}/tests/test_radia_ngsolve_memory_leak.py +0 -0
  223. {radia-1.3.14 → radia-1.3.16}/tests/test_radia_ngsolve_with_cache.py +0 -0
  224. {radia-1.3.14 → radia-1.3.16}/tests/test_radia_only_memory.py +0 -0
  225. {radia-1.3.14 → radia-1.3.16}/tests/test_serialization.py +0 -0
  226. {radia-1.3.14 → radia-1.3.16}/tests/test_set_vs_interpolate.py +0 -0
  227. {radia-1.3.14 → radia-1.3.16}/tests/test_simple.py +0 -0
  228. {radia-1.3.14 → radia-1.3.16}/tests/test_simple_fld_leak.py +0 -0
  229. {radia-1.3.14 → radia-1.3.16}/tests/test_square_coil_analytical.py +0 -0
  230. {radia-1.3.14 → radia-1.3.16}/tests/test_tetrahedral_solver.py +0 -0
  231. {radia-1.3.14 → radia-1.3.16}/tests/test_transformations.py +0 -0
  232. {radia-1.3.14 → radia-1.3.16}/tests/test_type_cast.py +0 -0
  233. {radia-1.3.14 → radia-1.3.16}/tests/test_unit_conversion_verify.py +0 -0
  234. {radia-1.3.14 → radia-1.3.16}/tests/test_utils.py +0 -0
  235. {radia-1.3.14 → radia-1.3.16}/tests/test_vector_potential.py +0 -0
  236. {radia-1.3.14 → radia-1.3.16}/tests/test_without_B_projection.py +0 -0
  237. {radia-1.3.14 → radia-1.3.16}/tests/test_without_gridfunction.py +0 -0
  238. {radia-1.3.14 → radia-1.3.16}/tests/verify_curl_A_equals_B.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radia
3
- Version: 1.3.14
3
+ Version: 1.3.16
4
4
  Summary: Radia 3D Magnetostatics with NGSolve Integration and OpenMP Parallelization
5
5
  Home-page: https://github.com/ksugahar/Radia_NGSolve
6
6
  Author: Pascal Elleaume
@@ -28,6 +28,8 @@ Requires-Dist: numpy>=1.20
28
28
  Provides-Extra: viz
29
29
  Requires-Dist: pyvista>=0.40; extra == "viz"
30
30
  Requires-Dist: matplotlib>=3.5; extra == "viz"
31
+ Provides-Extra: ngsolve
32
+ Requires-Dist: ngsolve==6.2.2405; extra == "ngsolve"
31
33
  Provides-Extra: test
32
34
  Requires-Dist: pytest>=7.0; extra == "test"
33
35
  Requires-Dist: pytest-cov>=4.0; extra == "test"
@@ -0,0 +1,686 @@
1
+ # Radia Python API Reference
2
+
3
+ Complete reference for Radia Python API.
4
+
5
+ **Version**: 1.3.14
6
+ **Date**: 2025-12-15
7
+ **Original ESRF Documentation**: https://www.esrf.fr/home/Accelerators/instrumentation--equipment/Software/Radia/Documentation/ReferenceGuide.html
8
+
9
+ ---
10
+
11
+ ## Table of Contents
12
+
13
+ - [Quick Start](#quick-start)
14
+ - [Supported Elements](#supported-elements)
15
+ - [Geometry Objects](#geometry-objects)
16
+ - [Materials](#materials)
17
+ - [Solver](#solver)
18
+ - [Field Computation](#field-computation)
19
+ - [Mesh Import](#mesh-import)
20
+ - [NGSolve Integration](#ngsolve-integration)
21
+ - [Utilities](#utilities)
22
+
23
+ ---
24
+
25
+ ## Quick Start
26
+
27
+ ### MSC Hexahedral Example (ObjThckPgn)
28
+
29
+ ```python
30
+ import radia as rad
31
+ import numpy as np
32
+
33
+ rad.FldUnits('m')
34
+ rad.UtiDelAll()
35
+
36
+ MU_0 = 4 * np.pi * 1e-7
37
+ n_div = 5
38
+ cube_size = 1.0
39
+ elem_size = cube_size / n_div
40
+
41
+ # Create 5x5x5 hexahedral mesh using ObjThckPgn
42
+ elements = []
43
+ for ix in range(n_div):
44
+ for iy in range(n_div):
45
+ for iz in range(n_div):
46
+ cx = (ix + 0.5) * elem_size - cube_size / 2
47
+ cy = (iy + 0.5) * elem_size - cube_size / 2
48
+ cz = (iz + 0.5) * elem_size - cube_size / 2
49
+ half = elem_size / 2
50
+
51
+ polygon = [[cx-half, cy-half], [cx+half, cy-half],
52
+ [cx+half, cy+half], [cx-half, cy+half]]
53
+ obj = rad.ObjThckPgn(cz - half, elem_size, polygon, 'z', [0, 0, 0])
54
+ elements.append(obj)
55
+
56
+ container = rad.ObjCnt(elements)
57
+ mat = rad.MatLin(1000) # mu_r = 1000
58
+ rad.MatApl(container, mat)
59
+
60
+ ext = rad.ObjBckg([0, 0, MU_0 * 50000])
61
+ grp = rad.ObjCnt([container, ext])
62
+ rad.Solve(grp, 0.001, 1000, 1)
63
+ ```
64
+
65
+ ### Tetrahedral Mesh Example (Netgen)
66
+
67
+ ```python
68
+ import radia as rad
69
+ rad.FldUnits('m')
70
+
71
+ # Import NGSolve BEFORE radia modules
72
+ from netgen.occ import Box, Pnt, OCCGeometry
73
+ from ngsolve import Mesh
74
+ from netgen_mesh_import import netgen_mesh_to_radia
75
+
76
+ # Create tetrahedral mesh
77
+ cube = Box(Pnt(-0.5, -0.5, -0.5), Pnt(0.5, 0.5, 0.5))
78
+ cube.mat('magnetic')
79
+ mesh = Mesh(OCCGeometry(cube).GenerateMesh(maxh=0.3))
80
+
81
+ # Import to Radia
82
+ mag_obj = netgen_mesh_to_radia(mesh,
83
+ material={'magnetization': [0, 0, 0]},
84
+ units='m',
85
+ material_filter='magnetic')
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Supported Elements
91
+
92
+ | Element Type | API | Faces | DOF | Use Case |
93
+ |--------------|-----|-------|-----|----------|
94
+ | **Extruded Polygon** | `ObjThckPgn()` | N-gon extruded | 3 | General prism shapes |
95
+ | **Hexahedron (MSC)** | `ObjRecMag()` or `ObjPolyhdr()` | 6 quad | 6 | Permanent magnets, soft iron |
96
+ | **Tetrahedron** | `ObjPolyhdr()` + `TETRA_FACES` | 4 tri | 3 | Complex curved geometry |
97
+ | **Wedge/Prism** | `ObjPolyhdr()` + `WEDGE_FACES` | 5 | 3 | Hybrid meshes |
98
+ | **Pyramid** | `ObjPolyhdr()` + `PYRAMID_FACES` | 5 | 3 | Mesh transitions |
99
+
100
+ **DOF (Degrees of Freedom)**:
101
+ - **Hexahedra (6 faces)**: 6 DOF - Surface charge density (sigma) per face (MSC method)
102
+ - **Other elements (4-5 faces)**: 3 DOF - Magnetization vector (Mx, My, Mz)
103
+ - `ObjRecMag()` automatically uses 6 DOF MSC hexahedron
104
+
105
+ ### Face Topology Constants
106
+
107
+ ```python
108
+ from netgen_mesh_import import TETRA_FACES, HEX_FACES, WEDGE_FACES, PYRAMID_FACES
109
+
110
+ # TETRA_FACES (1-indexed)
111
+ [[1, 3, 2], [1, 2, 4], [2, 3, 4], [3, 1, 4]]
112
+
113
+ # HEX_FACES (1-indexed)
114
+ [[1, 4, 3, 2], [5, 6, 7, 8], [1, 2, 6, 5], [3, 4, 8, 7], [1, 5, 8, 4], [2, 3, 7, 6]]
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Geometry Objects
120
+
121
+ ### ObjThckPgn - Thick Polygon (Extruded 2D)
122
+
123
+ ```python
124
+ obj = rad.ObjThckPgn(z_base, thickness, vertices_2d, axis, magnetization)
125
+ ```
126
+
127
+ | Parameter | Type | Description |
128
+ |-----------|------|-------------|
129
+ | `z_base` | float | Base position along extrusion axis |
130
+ | `thickness` | float | Extrusion length |
131
+ | `vertices_2d` | [[x,y], ...] | 2D polygon vertices (CCW) |
132
+ | `axis` | str | Extrusion axis: `'x'`, `'y'`, or `'z'` |
133
+ | `magnetization` | [Mx, My, Mz] | Initial magnetization |
134
+
135
+ ```python
136
+ polygon = [[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]]
137
+ hex_elem = rad.ObjThckPgn(-0.5, 1.0, polygon, 'z', [0, 0, 0])
138
+ ```
139
+
140
+ ### ObjPolyhdr - General Polyhedron
141
+
142
+ ```python
143
+ obj = rad.ObjPolyhdr(vertices, faces, magnetization)
144
+ ```
145
+
146
+ | Parameter | Type | Description |
147
+ |-----------|------|-------------|
148
+ | `vertices` | [[x,y,z], ...] | 3D vertex coordinates |
149
+ | `faces` | [[v1,v2,...], ...] | Face vertex indices (**1-indexed!**) |
150
+ | `magnetization` | [Mx, My, Mz] | Initial magnetization |
151
+
152
+ ```python
153
+ from netgen_mesh_import import TETRA_FACES
154
+ vertices = [[0,0,0], [1,0,0], [0.5,1,0], [0.5,0.5,1]]
155
+ tet = rad.ObjPolyhdr(vertices, TETRA_FACES, [0, 0, 1e6])
156
+ ```
157
+
158
+ ### ObjBckg - Uniform Background Field
159
+
160
+ ```python
161
+ field_src = rad.ObjBckg([Bx, By, Bz])
162
+ ```
163
+
164
+ ```python
165
+ MU_0 = 4 * np.pi * 1e-7
166
+ ext = rad.ObjBckg([0, 0, MU_0 * 50000]) # 50,000 A/m in z
167
+ ```
168
+
169
+ ### ObjCnt - Container
170
+
171
+ ```python
172
+ group = rad.ObjCnt([obj1, obj2, ...])
173
+ ```
174
+
175
+ ### ObjRaceTrk - Racetrack Coil
176
+
177
+ ```python
178
+ coil = rad.ObjRaceTrk(center, radii, heights, current, n_segments)
179
+ ```
180
+
181
+ ### ObjFlmCur - Filament Conductor
182
+
183
+ ```python
184
+ filament = rad.ObjFlmCur([[x1,y1,z1], [x2,y2,z2], ...], current)
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Materials
190
+
191
+ ### MatLin - Linear Isotropic
192
+
193
+ ```python
194
+ mat = rad.MatLin(mu_r) # relative permeability
195
+ rad.MatApl(obj, mat)
196
+ ```
197
+
198
+ ```python
199
+ # Soft iron (mu_r = 1000)
200
+ mat = rad.MatLin(1000)
201
+ rad.MatApl(cube, mat)
202
+ ```
203
+
204
+ ### MatLin - Linear Anisotropic
205
+
206
+ ```python
207
+ mat = rad.MatLin([mu_r_par, mu_r_perp], [ex, ey, ez])
208
+ ```
209
+
210
+ ```python
211
+ # Easy axis in z-direction
212
+ mat = rad.MatLin([5001, 101], [0, 0, 1])
213
+ ```
214
+
215
+ ### MatSatIsoTab - Nonlinear (B-H Table)
216
+
217
+ ```python
218
+ mat = rad.MatSatIsoTab(BH_data) # [[H, B], ...] in A/m and Tesla
219
+ ```
220
+
221
+ **Input Format**: Industry-standard B-H curve (H in A/m, B in Tesla).
222
+ Radia internally converts to M-H using: M = B/mu_0 - H
223
+
224
+ ```python
225
+ # B-H curve: [H (A/m), B (T)]
226
+ BH_DATA = [
227
+ [0.0, 0.0],
228
+ [100.0, 0.1],
229
+ [200.0, 0.3],
230
+ [500.0, 0.8],
231
+ [1000.0, 1.2],
232
+ [2000.0, 1.5],
233
+ [5000.0, 1.7],
234
+ [10000.0, 1.8],
235
+ [50000.0, 2.0],
236
+ [100000.0, 2.1],
237
+ ]
238
+
239
+ mat = rad.MatSatIsoTab(BH_DATA)
240
+ ```
241
+
242
+ ### MatSatIsoFrm - Nonlinear (Formula)
243
+
244
+ ```python
245
+ mat = rad.MatSatIsoFrm([ksi1, ms1], [ksi2, ms2], [ksi3, ms3])
246
+ ```
247
+
248
+ Formula: `M = ms1*tanh(ksi1*H/ms1) + ms2*tanh(ksi2*H/ms2) + ms3*tanh(ksi3*H/ms3)`
249
+
250
+ ```python
251
+ # Steel37 (C<0.13%)
252
+ mat = rad.MatSatIsoFrm([1596.3, 1.1488], [133.11, 0.4268], [18.713, 0.4759])
253
+ ```
254
+
255
+ ### MatApl - Apply Material
256
+
257
+ ```python
258
+ rad.MatApl(obj, material)
259
+ ```
260
+
261
+ ---
262
+
263
+ ## Solver
264
+
265
+ ### Solve - High-Level API (Recommended)
266
+
267
+ ```python
268
+ result = rad.Solve(obj, tolerance, max_iter, method=1)
269
+ ```
270
+
271
+ | Parameter | Type | Description |
272
+ |-----------|------|-------------|
273
+ | `obj` | int | Object or container |
274
+ | `tolerance` | float | Convergence threshold (0.001 = 0.1%) |
275
+ | `max_iter` | int | Maximum iterations |
276
+ | `method` | int | `0` = LU, `1` = BiCGSTAB (default) |
277
+
278
+ | Returns | Description |
279
+ |---------|-------------|
280
+ | `result[0]` | Final residual |
281
+ | `result[3]` | Number of iterations |
282
+
283
+ ### Solver Selection
284
+
285
+ | Problem Size | Elements | Method | Code |
286
+ |--------------|----------|--------|------|
287
+ | Small | < 1,000 | LU | `rad.Solve(grp, 0.001, 100, 0)` |
288
+ | Medium | 1,000-10,000 | BiCGSTAB | `rad.Solve(grp, 0.001, 1000, 1)` |
289
+ | Large | > 10,000 | BiCGSTAB | `rad.Solve(grp, 0.001, 1000, 1)` |
290
+
291
+ **Iteration counts**:
292
+ - Linear materials: 1-2 iterations
293
+ - Nonlinear materials: 3-6 iterations (with B-field convergence)
294
+
295
+ ### Nonlinear Convergence (v1.3.15+)
296
+
297
+ Radia uses **B-field based convergence** (mucal2) for nonlinear materials:
298
+
299
+ ```
300
+ rel_change = |B_new - B_old| / B_sat
301
+ ```
302
+
303
+ | Parameter | Description |
304
+ |-----------|-------------|
305
+ | `B_sat` | Saturation magnetization from BH curve |
306
+ | `tolerance` | Default 0.0001 (0.01% relative change) |
307
+
308
+ This method provides fast Newton-Raphson convergence and matches industry-standard solvers.
309
+
310
+ ### Solver Tolerance Parameters
311
+
312
+ Radia provides three tolerance parameters for controlling solver behavior:
313
+
314
+ ```python
315
+ # 1. Nonlinear iteration tolerance (outer loop)
316
+ # Set via Solve() - controls when Newton-Raphson iterations stop
317
+ rad.Solve(obj, nonl_tol, max_iter, method) # nonl_tol = 0.001 recommended
318
+
319
+ # 2. BiCGSTAB inner loop tolerance
320
+ # Set via SetBiCGSTABTol() BEFORE Solve() - controls linear system accuracy
321
+ rad.SetBiCGSTABTol(bicg_tol) # Default: 1e-4
322
+
323
+ # 3. H-matrix ACA tolerance (Method 2 only)
324
+ # Set via SetHACApKParams() BEFORE Solve() - controls low-rank approximation
325
+ rad.SetHACApKParams(hmat_eps, leaf_size, eta) # Default: 1e-4, 10, 2.0
326
+ ```
327
+
328
+ | Parameter | API | Default | Description |
329
+ |-----------|-----|---------|-------------|
330
+ | `nonl_tol` | `rad.Solve(obj, nonl_tol, ...)` | 0.001 | Nonlinear convergence threshold |
331
+ | `bicg_tol` | `rad.SetBiCGSTABTol(tol)` | 1e-4 | BiCGSTAB relative residual tolerance |
332
+ | `hmat_eps` | `rad.SetHACApKParams(eps, ...)` | 1e-4 | H-matrix ACA compression tolerance |
333
+
334
+ **Example - Full solver configuration:**
335
+
336
+ ```python
337
+ import radia as rad
338
+
339
+ # Configure tolerances BEFORE Solve()
340
+ rad.SetBiCGSTABTol(1e-4) # BiCGSTAB tolerance
341
+ rad.SetHACApKParams(1e-4, 10, 2.0) # H-matrix: eps=1e-4, leaf=10, eta=2.0
342
+
343
+ # Solve with nonlinear tolerance
344
+ rad.Solve(grp, 0.001, 100, 2) # nonl_tol=0.001, max_iter=100, method=2 (HACApK)
345
+ ```
346
+
347
+ ### SetBiCGSTABTol - BiCGSTAB Inner Loop Tolerance
348
+
349
+ ```python
350
+ rad.SetBiCGSTABTol(tol)
351
+ ```
352
+
353
+ | Parameter | Type | Default | Description |
354
+ |-----------|------|---------|-------------|
355
+ | `tol` | float | 1e-4 | Relative residual tolerance for BiCGSTAB |
356
+
357
+ **Notes:**
358
+ - Affects Method 1 (BiCGSTAB) and Method 2 (HACApK)
359
+ - Lower values = higher accuracy but more iterations
360
+ - Call BEFORE `rad.Solve()`
361
+
362
+ ### SetHACApKParams - H-Matrix Parameters (Method 2)
363
+
364
+ ```python
365
+ rad.SetHACApKParams(eps, leaf_size, eta)
366
+ ```
367
+
368
+ | Parameter | Type | Default | Description |
369
+ |-----------|------|---------|-------------|
370
+ | `eps` | float | 1e-4 | ACA+ compression tolerance |
371
+ | `leaf_size` | int | 10 | Minimum cluster size in elements |
372
+ | `eta` | float | 2.0 | Admissibility parameter |
373
+
374
+ **Notes:**
375
+ - Only affects Method 2 (HACApK H-matrix solver)
376
+ - Lower `eps` = higher accuracy, larger ranks, more memory
377
+ - Call BEFORE `rad.Solve()`
378
+
379
+ **Parameter Rationale:**
380
+
381
+ | Parameter | Default | Rationale |
382
+ |-----------|---------|-----------|
383
+ | `eps` | 1e-4 | Balance between accuracy and compression. Lower values (1e-6, 1e-8) for higher accuracy, higher values (1e-3) for faster computation. |
384
+ | `leaf_size` | 10 | Minimum cluster size. Smaller values allow deeper tree but increase H-matrix overhead. 10 provides good balance for typical element counts. ELF-compatible default. |
385
+ | `eta` | 2.0 | Standard admissibility criterion: clusters are "well-separated" when `dist(c1,c2) >= eta * max(diam(c1), diam(c2))`. eta=2.0 is conservative, ensuring accurate low-rank approximations. Lower values (1.0) allow more aggressive compression but may reduce accuracy. |
386
+
387
+ ### SetRelaxParam - Under-Relaxation Coefficient
388
+
389
+ ```python
390
+ rad.SetRelaxParam(relax)
391
+ ```
392
+
393
+ | Parameter | Type | Default | Description |
394
+ |-----------|------|---------|-------------|
395
+ | `relax` | float | 0.0 | Under-relaxation coefficient (0.0-1.0) |
396
+
397
+ **Notes:**
398
+ - Affects all solver methods (0=LU, 1=BiCGSTAB, 2=HACApK)
399
+ - `relax=0.0`: Full Newton step (default, fastest convergence when stable)
400
+ - `relax>0.0`: Damped update: `chi_new = chi_new*(1-relax) + chi_old*relax`
401
+ - Use under-relaxation (e.g., 0.2-0.5) when:
402
+ - Convergence is slow or oscillating
403
+ - Material has steep B-H curve
404
+ - Problem is highly nonlinear
405
+ - Call BEFORE `rad.Solve()`
406
+
407
+ **Example:**
408
+ ```python
409
+ # For difficult nonlinear problems, use under-relaxation
410
+ rad.SetRelaxParam(0.3) # 30% damping
411
+ rad.Solve(container, 0.001, 100, 1)
412
+
413
+ # Reset to full step for normal cases
414
+ rad.SetRelaxParam(0.0)
415
+ ```
416
+
417
+ ### BiCGSTAB Performance
418
+
419
+ Typical solve times (nonlinear BH curve material):
420
+
421
+ | Elements | Time | Iterations |
422
+ |----------|------|------------|
423
+ | 1,000 | 0.55s | 5-6 |
424
+ | 3,375 | 7.30s | 5-6 |
425
+ | 8,000 | 51.81s | 5-6 |
426
+
427
+ ---
428
+
429
+ ## Field Computation
430
+
431
+ ### Fld - Field at Point(s)
432
+
433
+ ```python
434
+ field = rad.Fld(obj, component, point)
435
+ ```
436
+
437
+ | Component | Description |
438
+ |-----------|-------------|
439
+ | `'bx'`, `'by'`, `'bz'`, `'b'` | Magnetic flux density B (T) |
440
+ | `'hx'`, `'hy'`, `'hz'`, `'h'` | Magnetic field H (A/m) |
441
+ | `'ax'`, `'ay'`, `'az'`, `'a'` | Vector potential A (T*m) |
442
+ | `'mx'`, `'my'`, `'mz'`, `'m'` | Magnetization M |
443
+
444
+ ```python
445
+ B = rad.Fld(magnet, 'b', [0, 0, 0.1]) # B vector at point
446
+ Bz = rad.Fld(magnet, 'bz', [0, 0, 0.1]) # Bz component
447
+ ```
448
+
449
+ ### FldLst - Field Along Line
450
+
451
+ ```python
452
+ field_list = rad.FldLst(obj, component, p1, p2, n_points, 'arg')
453
+ ```
454
+
455
+ ### ObjM - Get Magnetization
456
+
457
+ ```python
458
+ all_M = rad.ObjM(obj) # Returns [[center, [Mx, My, Mz]], ...]
459
+ ```
460
+
461
+ ```python
462
+ all_M = rad.ObjM(container)
463
+ M_list = [m[1] for m in all_M]
464
+ M_avg_z = np.mean([m[2] for m in M_list])
465
+ ```
466
+
467
+ ---
468
+
469
+ ## Mesh Import
470
+
471
+ ### NGSolve Mesh Access Policy (MANDATORY)
472
+
473
+ **CRITICAL**: All NGSolve mesh access MUST use functions from `netgen_mesh_import.py`.
474
+
475
+ | Rule | Description |
476
+ |------|-------------|
477
+ | **ALWAYS** | Use `netgen_mesh_to_radia()` or `extract_elements()` |
478
+ | **NEVER** | Directly access `mesh.ngmesh.Points()`, `mesh.vertices[]`, or `el.vertices[].nr` |
479
+ | **NO EXCEPTIONS** | Applies to all scripts including examples, tests, and debugging code |
480
+
481
+ **Why?** NGSolve has TWO different indexing schemes:
482
+
483
+ | Access Method | Indexing | Valid Range |
484
+ |--------------|----------|-------------|
485
+ | `mesh.ngmesh.Points()[i]` | **1-indexed** | 1 to nv |
486
+ | `mesh.vertices[i]` | **0-indexed** | 0 to nv-1 |
487
+ | `el.vertices[i].nr` | Returns **0-indexed** | Use with `mesh.vertices[]` only |
488
+
489
+ Mixing these causes off-by-one errors that are difficult to debug.
490
+
491
+ ### netgen_mesh_to_radia - Netgen Tetrahedral
492
+
493
+ ```python
494
+ from netgen_mesh_import import netgen_mesh_to_radia
495
+
496
+ mag_obj = netgen_mesh_to_radia(mesh,
497
+ material={'magnetization': [0, 0, 0]},
498
+ units='m',
499
+ material_filter='magnetic')
500
+ ```
501
+
502
+ ### extract_elements - Custom Processing
503
+
504
+ ```python
505
+ from netgen_mesh_import import extract_elements, compute_element_centroid
506
+
507
+ elements, _ = extract_elements(mesh, material_filter='magnetic')
508
+ for el in elements:
509
+ vertices = el['vertices'] # Correctly extracted coordinates
510
+ centroid = compute_element_centroid(vertices)
511
+ ```
512
+
513
+ ### Available Functions in netgen_mesh_import.py
514
+
515
+ | Function | Description |
516
+ |----------|-------------|
517
+ | `netgen_mesh_to_radia()` | Convert entire mesh to Radia geometry (recommended) |
518
+ | `extract_elements()` | Extract element data for custom processing |
519
+ | `compute_element_centroid()` | Compute centroid from vertex list |
520
+ | `create_radia_tetrahedron()` | Create single Radia tetrahedron |
521
+ | `create_radia_hexahedron()` | Create single Radia hexahedron |
522
+
523
+ ### create_radia_from_nastran - Nastran Import
524
+
525
+ ```python
526
+ from nastran_mesh_import import create_radia_from_nastran
527
+
528
+ mag_obj = create_radia_from_nastran('model.bdf',
529
+ material={'magnetization': [0, 0, 1e6]},
530
+ units='m')
531
+ ```
532
+
533
+ **Supported Nastran elements**: CTETRA, CHEXA, CPENTA, CPYRAM, CTRIA3
534
+
535
+ ---
536
+
537
+ ## NGSolve Integration
538
+
539
+ ### Import Order (CRITICAL)
540
+
541
+ ```python
542
+ # 1. Import radia first
543
+ import radia as rad
544
+ rad.FldUnits('m') # REQUIRED: NGSolve uses meters
545
+
546
+ # 2. Import ngsolve BEFORE radia_ngsolve
547
+ import ngsolve
548
+ from ngsolve import *
549
+
550
+ # 3. NOW import radia_ngsolve
551
+ from radia import radia_ngsolve
552
+ ```
553
+
554
+ Wrong order causes `ImportError: DLL load failed`.
555
+
556
+ ### NGSolve Version Requirement
557
+
558
+ **Use NGSolve 6.2.2405 only** (6.2.2406+ has Periodic BC bug).
559
+
560
+ ```bash
561
+ pip install ngsolve==6.2.2405
562
+ ```
563
+
564
+ ### RadiaField - CoefficientFunction
565
+
566
+ ```python
567
+ cf = radia_ngsolve.RadiaField(radia_obj, field_type='b')
568
+ ```
569
+
570
+ | Parameter | Type | Description |
571
+ |-----------|------|-------------|
572
+ | `radia_obj` | int | Radia object ID |
573
+ | `field_type` | str | `'b'`, `'h'`, `'a'`, or `'m'` |
574
+
575
+ ```python
576
+ # Create CoefficientFunction for B field
577
+ B_cf = radia_ngsolve.RadiaField(magnet, 'b')
578
+
579
+ # Use in NGSolve
580
+ fes = HDiv(mesh, order=2)
581
+ gf = GridFunction(fes)
582
+ gf.Set(B_cf)
583
+ ```
584
+
585
+ ---
586
+
587
+ ## Utilities
588
+
589
+ ### FldUnits - Unit System
590
+
591
+ ```python
592
+ rad.FldUnits('m') # Use meters (required for NGSolve)
593
+ rad.FldUnits('mm') # Use millimeters (default)
594
+ rad.FldUnits() # Get current units
595
+ ```
596
+
597
+ ### UtiDelAll - Clear Memory
598
+
599
+ ```python
600
+ rad.UtiDelAll()
601
+ ```
602
+
603
+ ### UtiVer - Version
604
+
605
+ ```python
606
+ version = rad.UtiVer()
607
+ ```
608
+
609
+ ---
610
+
611
+ ## Transformations
612
+
613
+ ### TrfTrsl - Translation
614
+
615
+ ```python
616
+ rad.TrfTrsl(obj, [dx, dy, dz])
617
+ ```
618
+
619
+ ### TrfRot - Rotation
620
+
621
+ ```python
622
+ rad.TrfRot(obj, [x, y, z], [nx, ny, nz], angle)
623
+ ```
624
+
625
+ ### TrfMlt - Multiple Copies
626
+
627
+ ```python
628
+ array = rad.TrfMlt(obj, transformation, n_copies)
629
+ ```
630
+
631
+ ---
632
+
633
+ ## Common Issues
634
+
635
+ ### 1. Coordinates Off by 1000x
636
+
637
+ **Cause**: Unit mismatch (NGSolve uses meters, Radia defaults to mm)
638
+
639
+ **Solution**:
640
+ ```python
641
+ rad.FldUnits('m') # Set at start of script
642
+ ```
643
+
644
+ ### 2. DLL Load Failed
645
+
646
+ **Cause**: Wrong import order
647
+
648
+ **Solution**: Import ngsolve BEFORE radia_ngsolve
649
+
650
+ ### 3. ObjPolyhdr Face Error
651
+
652
+ **Cause**: 0-indexed faces
653
+
654
+ **Solution**: Use **1-indexed** faces (Radia convention)
655
+
656
+ ### 4. Solver Not Converging
657
+
658
+ **Solutions**:
659
+ 1. Use BiCGSTAB (Method 1)
660
+ 2. Increase max iterations
661
+ 3. Check B-H data is monotonic
662
+ 4. Verify H-M conversion: `M = B/mu_0 - H`
663
+
664
+ ---
665
+
666
+ ## Units
667
+
668
+ | Quantity | Unit |
669
+ |----------|------|
670
+ | Length | mm (default) or m with `FldUnits('m')` |
671
+ | B (flux density) | Tesla (T) |
672
+ | H (field) | A/m |
673
+ | M (magnetization) | A/m |
674
+ | Current | Ampere (A) |
675
+
676
+ ---
677
+
678
+ ## References
679
+
680
+ 1. [ESRF Radia Reference Guide](https://www.esrf.fr/home/Accelerators/instrumentation--equipment/Software/Radia/Documentation/ReferenceGuide.html)
681
+ 2. [examples/cube_uniform_field/](../examples/cube_uniform_field/) - Benchmark examples
682
+
683
+ ---
684
+
685
+ **Last Updated**: 2025-12-15
686
+ **License**: LGPL-2.1 (modifications), BSD-style (original RADIA from ESRF)
@@ -0,0 +1,20 @@
1
+ # Radia Documentation
2
+
3
+ **Version:** 1.3.14
4
+
5
+ ## Documentation
6
+
7
+ | Document | Description |
8
+ |----------|-------------|
9
+ | [API_REFERENCE.md](API_REFERENCE.md) | **Main documentation** - Quick start, API, elements, solvers, NGSolve |
10
+ | [HMATRIX_EVALUATION.md](HMATRIX_EVALUATION.md) | H-matrix research (advanced, not for typical use) |
11
+
12
+ ## Quick Links
13
+
14
+ - [Main README](../README.md) - Project overview and installation
15
+ - [CHANGELOG](../CHANGELOG.md) - Version history
16
+ - [Examples](../examples/) - Working code examples
17
+
18
+ ---
19
+
20
+ **Last Updated:** 2025-12-15