drbx 2.0.0.dev0__tar.gz → 2.2.0__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.
- drbx-2.2.0/PKG-INFO +469 -0
- drbx-2.2.0/README.md +435 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/pyproject.toml +5 -3
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/__init__.py +10 -1
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/cli.py +59 -2
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/data/atomic_rates/iz_AMJUEL_H.x_2.1.5.json +1 -1
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/data/atomic_rates/rec_AMJUEL_H.x_2.1.8.json +1 -1
- drbx-2.2.0/src/drbx/data/essos/ESSOS_biot_savart_LandremanPaulQA.json +1 -0
- drbx-2.2.0/src/drbx/data/essos/__init__.py +1 -0
- drbx-2.2.0/src/drbx/deck.py +614 -0
- drbx-2.2.0/src/drbx/fci/__init__.py +1 -0
- drbx-2.2.0/src/drbx/fci/_shared.py +221 -0
- drbx-2.2.0/src/drbx/fci_braginskii/__init__.py +1 -0
- drbx-2.2.0/src/drbx/fci_braginskii/_host_guards.py +43 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry/__init__.py +1 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry/fci_control_volumes.py +194 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry/fci_geometry.py +4018 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry/fci_simulation_geometry.py +146 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/Bfield_evaluator.py +584 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/MetricEvaluator.py +3463 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/ScalarPotential_evaluator.py +899 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/WallEvaluator.py +360 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/__init__.py +1 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_boundaries.py +4132 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_control_volumes.py +1324 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_geometry.py +4855 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_helpers.py +56 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_model.py +40 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_owner_boundary_overlap.py +621 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_rlp_overlap.py +2585 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_simulation_geometry.py +990 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_trace_executor.py +535 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/fci_trace_jax.py +409 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/hsx_fci_builder.py +2507 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/hsx_jax_field.py +72 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/hsx_simulation_geometry.py +1043 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/jax_bfield_evaluator.py +276 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/jax_metric_evaluator.py +585 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/provider_bfield.py +245 -0
- drbx-2.2.0/src/drbx/fci_braginskii/geometry_build/solve_MMPDE.py +818 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/__init__.py +1 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/characteristic_wall_residual.py +180 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_angular_agglomeration.py +659 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_boundaries.py +4068 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_control_volume_operators.py +268 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_curvature_production_flux.py +357 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_drb_EB_rhs.py +3441 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_electromagnetic.py +46 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_gmres.py +702 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_halo.py +2556 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_helpers.py +109 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_model.py +28 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_neutral_fluid.py +344 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_neutrals.py +516 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_operators.py +5626 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_parallel_conduction.py +100 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_sharding.py +871 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_support_pair.py +284 -0
- drbx-2.2.0/src/drbx/fci_braginskii/native/fci_wall_closure.py +353 -0
- drbx-2.2.0/src/drbx/fci_braginskii/run.py +4313 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/__init__.py +29 -21
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/essos_import.py +321 -166
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/fci_geometry.py +20 -240
- drbx-2.2.0/src/drbx/geometry/field_provider.py +233 -0
- drbx-2.0.0.dev0/src/drbx/geometry/vmec_jax_import.py → drbx-2.2.0/src/drbx/geometry/vmex_import.py +48 -36
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/electromagnetic.py +82 -34
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_2_field_rhs.py +3 -20
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_4_field_rhs.py +35 -164
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_boundaries.py +20 -248
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_drb_EB_rhs.py +4 -122
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_drb_rhs.py +2 -22
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_halo.py +4 -50
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_helpers.py +2 -67
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_neutral.py +16 -7
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_operators.py +31 -188
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_sharding.py +4 -26
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/neutrals/__init__.py +4 -2
- drbx-2.2.0/src/drbx/native/neutrals/atomic_rates.py +217 -0
- drbx-2.2.0/src/drbx/native/neutrals/detachment_sol_model.py +818 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/neutrals/reactions.py +9 -1
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/neutrals/recycling_sol_model.py +2 -2
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/stellarator_turbulence.py +26 -5
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/transport.py +0 -37
- drbx-2.2.0/src/drbx/validation/__init__.py +219 -0
- drbx-2.2.0/src/drbx/validation/electromagnetic_waves.py +129 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/publication_plotting.py +0 -16
- drbx-2.2.0/src/drbx/viz.py +55 -0
- drbx-2.2.0/src/drbx.egg-info/PKG-INFO +469 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx.egg-info/SOURCES.txt +67 -20
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx.egg-info/requires.txt +9 -2
- drbx-2.2.0/tests/test_coil_filament_field.py +234 -0
- drbx-2.2.0/tests/test_decks.py +131 -0
- drbx-2.2.0/tests/test_detachment_control.py +37 -0
- drbx-2.2.0/tests/test_electromagnetic_fci.py +224 -0
- drbx-2.2.0/tests/test_essos_coil_field.py +155 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_operators_domain_decomp.py +12 -5
- drbx-2.2.0/tests/test_fci_small_eig.py +85 -0
- drbx-2.2.0/tests/test_hygiene.py +37 -0
- drbx-2.2.0/tests/test_landreman_paul_turbulence.py +139 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_mms_shifted_torus_4_field.py +9 -12
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_atomic_rates.py +49 -0
- drbx-2.2.0/tests/test_native_detachment_sol.py +219 -0
- drbx-2.2.0/tests/test_neutral_energy_conservation.py +135 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_packaging_metadata.py +10 -7
- drbx-2.2.0/tests/test_sheath_heat_transmission.py +37 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_validation_diverted_tokamak_movie.py +7 -0
- drbx-2.2.0/tests/test_validation_stellarator_fci_campaigns.py +178 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_validation_vmec_extender_edge_field_campaign.py +8 -1
- drbx-2.0.0.dev0/tests/test_vmec_jax_import.py → drbx-2.2.0/tests/test_vmex_import.py +20 -20
- drbx-2.0.0.dev0/PKG-INFO +0 -380
- drbx-2.0.0.dev0/README.md +0 -351
- drbx-2.0.0.dev0/src/drbx/native/array_backend.py +0 -64
- drbx-2.0.0.dev0/src/drbx/native/neutrals/atomic_rates.py +0 -134
- drbx-2.0.0.dev0/src/drbx/native/neutrals/detachment_sol_model.py +0 -221
- drbx-2.0.0.dev0/src/drbx/validation/__init__.py +0 -424
- drbx-2.0.0.dev0/src/drbx/validation/essos_fieldline_import_campaign.py +0 -181
- drbx-2.0.0.dev0/src/drbx/validation/essos_imported_artifact_audit.py +0 -535
- drbx-2.0.0.dev0/src/drbx/validation/essos_imported_drb_movie_campaign.py +0 -2826
- drbx-2.0.0.dev0/src/drbx/validation/essos_imported_fci_campaign.py +0 -5241
- drbx-2.0.0.dev0/src/drbx/validation/essos_imported_pytree_campaign.py +0 -406
- drbx-2.0.0.dev0/src/drbx/validation/essos_vmec_closed_field_campaign.py +0 -314
- drbx-2.0.0.dev0/src/drbx/validation/essos_vmec_closed_field_transient_campaign.py +0 -629
- drbx-2.0.0.dev0/src/drbx/validation/essos_vmec_fieldline_surface_campaign.py +0 -620
- drbx-2.0.0.dev0/src/drbx/validation/geometry_lineouts.py +0 -136
- drbx-2.0.0.dev0/src/drbx/validation/geometry_slices.py +0 -178
- drbx-2.0.0.dev0/src/drbx/validation/stellarator_fci_suite_campaign.py +0 -264
- drbx-2.0.0.dev0/src/drbx/validation/stellarator_metric_mms_campaign.py +0 -289
- drbx-2.0.0.dev0/src/drbx/validation/stellarator_neutral_physics_campaign.py +0 -255
- drbx-2.0.0.dev0/src/drbx/validation/stellarator_sheath_recycling_campaign.py +0 -331
- drbx-2.0.0.dev0/src/drbx/validation/stellarator_vorticity_campaign.py +0 -304
- drbx-2.0.0.dev0/src/drbx.egg-info/PKG-INFO +0 -380
- drbx-2.0.0.dev0/tests/test_detachment_control.py +0 -58
- drbx-2.0.0.dev0/tests/test_essos_fieldline_import.py +0 -2360
- drbx-2.0.0.dev0/tests/test_native_array_backend.py +0 -26
- drbx-2.0.0.dev0/tests/test_native_detachment_sol.py +0 -83
- drbx-2.0.0.dev0/tests/test_validation_stellarator_fci_campaigns.py +0 -1170
- {drbx-2.0.0.dev0 → drbx-2.2.0}/LICENSE +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/setup.cfg +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/__main__.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/config/__init__.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/config/boutinp.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/config/model.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/config/normalization.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/data/atomic_rates/__init__.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/data/atomic_rates/iz_AMJUEL_H.x_2.3.9a.json +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/data/atomic_rates/rec_AMJUEL_H.x_2.3.13a.json +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/embedding.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/fci_maps.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/island_divertor.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/metric_tensor.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/open_slab.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/rotating_ellipse.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/shifted_torus.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/stellarator.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/geometry/vmec_extender_import.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/linear/__init__.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/linear/dispersion.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/linear/eigen.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/__init__.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/deck_runner.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/expression.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_differentiable_case.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_model.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_sheath_recycling.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_time_integrator.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fci_vorticity.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/fluid_1d.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/hasegawa_wakatani.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/limiters.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/mesh.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/metrics.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/sol_flux_tube.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/units.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/native/vorticity.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/__init__.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/artifacts.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/memory.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/output.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/paths.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/performance.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/run_config.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/scheduler.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/runtime/state.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/autodiff_diffusion.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/autodiff_diffusion_uncertainty.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/diverted_tokamak_movie.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/fluid_1d_mms_convergence.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/stellarator_drb_pytree_campaign.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/stellarator_fci_geometry_campaign.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/stellarator_fci_operator_campaign.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/stellarator_sol_showcase.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/vmec_extender_edge_field_campaign.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx/validation/vmec_extender_sol_smoke_campaign.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx.egg-info/dependency_links.txt +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx.egg-info/entry_points.txt +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/src/drbx.egg-info/top_level.txt +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_autodiff_methods.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_boutinp.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_cli_command_surface.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_cli_run.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_diffusion_precision_benchmark.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fast_research_checks.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_differentiable.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_halo.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_model_state.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_neutrals_3d.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_operators.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_fci_sharded_2field.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_geometry_fci_maps.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_hasegawa_wakatani.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_island_divertor.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_linear_dispersion.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_mms_convergence.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_mms_shifted_torus_2_field.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_mms_shifted_torus_EB.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_mms_slab_2_field.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_multigrid_preconditioner.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_electromagnetic.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_expression.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_fluid_1d.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_limiters.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_mesh.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_metrics.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_reactions.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_recycling_sol.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_transport.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_native_vorticity.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_normalization.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_open_field_line_sol.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_restartable_diffusion_tutorial.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_rotating_ellipse_fci.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_rotating_ellipse_filament.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_run_config.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_runtime_artifacts.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_runtime_memory.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_runtime_performance.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_runtime_precision.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_scheduler.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_shifted_torus_4_field_blob.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_shifted_torus_4_field_free_decay.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_shifted_torus_EB_blob.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_state.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_stellarator_turbulence.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_validation_autodiff_diffusion.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_validation_autodiff_diffusion_uncertainty.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_validation_fluid_1d_mms_convergence.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_validation_vmec_extender_sol_smoke_campaign.py +0 -0
- {drbx-2.0.0.dev0 → drbx-2.2.0}/tests/test_vmec_extender_import.py +0 -0
drbx-2.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drbx
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: JAX-first edge and scrape-off-layer plasma code with differentiable, hardware-agnostic solver infrastructure.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: jax
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: netCDF4
|
|
17
|
+
Requires-Dist: rich
|
|
18
|
+
Requires-Dist: solvax>=0.36.1
|
|
19
|
+
Requires-Dist: tomli; python_version < "3.11"
|
|
20
|
+
Provides-Extra: essos
|
|
21
|
+
Requires-Dist: essos>=0.19.4; extra == "essos"
|
|
22
|
+
Provides-Extra: viz
|
|
23
|
+
Requires-Dist: pyvista; extra == "viz"
|
|
24
|
+
Requires-Dist: imageio; extra == "viz"
|
|
25
|
+
Requires-Dist: pillow; extra == "viz"
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
30
|
+
Provides-Extra: docs
|
|
31
|
+
Requires-Dist: mkdocs; extra == "docs"
|
|
32
|
+
Requires-Dist: pymdown-extensions; extra == "docs"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# DRBX
|
|
36
|
+
|
|
37
|
+
[](https://github.com/uwplasma/drbx/actions/workflows/test.yml)
|
|
38
|
+
[](https://github.com/uwplasma/drbx/actions/workflows/docs.yml)
|
|
39
|
+
[](https://pypi.org/project/drbx/)
|
|
40
|
+
[](LICENSE)
|
|
41
|
+
|
|
42
|
+
DRBX is a JAX code for drift-reduced Braginskii fluid simulations of edge and
|
|
43
|
+
scrape-off-layer (SOL) plasma turbulence. Parallel operators use the
|
|
44
|
+
flux-coordinate-independent (FCI) approach, so the same models run on closed
|
|
45
|
+
and open field lines in tokamak and non-axisymmetric stellarator geometry.
|
|
46
|
+
Every solver is written in JAX: steps are `jit`-compiled, and outputs can be
|
|
47
|
+
differentiated with respect to physical and geometric inputs.
|
|
48
|
+
|
|
49
|
+
- **Models:** Hasegawa-Wakatani, two- and four-field drift-reduced turbulence, optional electromagnetic terms (A_par, flutter, electron inertia), fluid neutrals with AMJUEL rates, a 1D divertor-leg model.
|
|
50
|
+
- **Geometry:** rotating-ellipse and shifted-torus stellarators, island divertors, and imported ESSOS coil fields and VMEC (VMEX) equilibria.
|
|
51
|
+
- **Gradients:** forward, reverse and checkpointed reverse mode, used for sensitivity, inverse design and control.
|
|
52
|
+
- **Runtime:** TOML-deck CLI, small Python API, restartable runs, multi-device `shard_map` stepping.
|
|
53
|
+
|
|
54
|
+
Documentation: [drbx.readthedocs.io](https://drbx.readthedocs.io/en/latest/).
|
|
55
|
+
Every section below names the script that produces its figure; run it from the
|
|
56
|
+
repository root.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install drbx
|
|
62
|
+
# or, from source:
|
|
63
|
+
git clone https://github.com/uwplasma/drbx && cd drbx && pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Python 3.10 or newer. CPU JAX is installed by default; for a GPU, install the
|
|
67
|
+
matching JAX wheel following the
|
|
68
|
+
[JAX guide](https://docs.jax.dev/en/latest/installation.html). ESSOS coil
|
|
69
|
+
imports need `pip install "drbx[essos]"`; the 3D (PyVista, offscreen) renders in
|
|
70
|
+
the field-line and HSX examples need `pip install "drbx[viz]"`.
|
|
71
|
+
|
|
72
|
+
## Quick start
|
|
73
|
+
|
|
74
|
+
New to DRBX? **Tutorial: start here** -- [one page](docs/tutorial.md)
|
|
75
|
+
from a first run to a stellarator simulation and a gradient.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
drbx inspect examples/inputs/restartable_diffusion.toml # print the resolved plan
|
|
79
|
+
drbx run examples/inputs/restartable_diffusion.toml # run and write artifacts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
From Python, a Hasegawa-Wakatani run is one function call, and its gradient
|
|
83
|
+
with respect to a physical parameter is one more:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import jax, jax.numpy as jnp, numpy as np
|
|
87
|
+
from drbx.native.hasegawa_wakatani import HasegawaWakataniParameters, hw_grid, hw_run
|
|
88
|
+
|
|
89
|
+
grid = hw_grid(64, 2 * jnp.pi * 8)
|
|
90
|
+
rng = np.random.default_rng(0)
|
|
91
|
+
zeta0 = jnp.fft.fft2(jnp.asarray(1e-2 * rng.standard_normal((64, 64))))
|
|
92
|
+
n0 = jnp.fft.fft2(jnp.asarray(1e-2 * rng.standard_normal((64, 64))))
|
|
93
|
+
|
|
94
|
+
def density_energy(alpha):
|
|
95
|
+
params = HasegawaWakataniParameters(adiabaticity=alpha, gradient=1.0)
|
|
96
|
+
_, n = hw_run(zeta0, n0, grid, params, dt=5e-3, steps=200)
|
|
97
|
+
return jnp.sum(jnp.abs(n) ** 2).real
|
|
98
|
+
|
|
99
|
+
print(jax.grad(density_energy)(1.0)) # d(energy)/d(adiabaticity) through 200 steps
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Running from a TOML deck
|
|
103
|
+
|
|
104
|
+
Every model also runs from a TOML deck, with no Python needed:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
drbx inspect examples/inputs/hasegawa_wakatani.toml # resolved plan, nothing runs
|
|
108
|
+
drbx run examples/inputs/hasegawa_wakatani.toml # run and write artifacts
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The decks in [`examples/inputs/`](examples/inputs) cover Hasegawa-Wakatani, the
|
|
112
|
+
sheath SOL with recycling, the SD1D detachment leg, stellarator turbulence,
|
|
113
|
+
the differentiable FCI operators, restartable diffusion and the HSX filament.
|
|
114
|
+
Keys, defaults and outputs are listed in [docs/decks.md](docs/decks.md).
|
|
115
|
+
|
|
116
|
+
Examples are flat scripts: parameters at the top, then run and plot, writing
|
|
117
|
+
to `output/`. [`examples/model_selection_guide.py`](examples/model_selection_guide.py)
|
|
118
|
+
helps choose a model family, dimension and boundary conditions.
|
|
119
|
+
|
|
120
|
+
## Validation
|
|
121
|
+
|
|
122
|
+
<img src="docs/media/validation_overview.png" width="800" alt="Validation overview">
|
|
123
|
+
|
|
124
|
+
Each panel compares a component with an analytic or published reference.
|
|
125
|
+
|
|
126
|
+
| Component | Check | Reference | Result |
|
|
127
|
+
|---|---|---|---|
|
|
128
|
+
| FCI parallel gradient, parallel and perpendicular Laplacian | manufactured solution, 16^3 to 64^3 | exact derivatives | order 1.98, 1.98, 1.90 |
|
|
129
|
+
| Parallel-operator pair `(G, D)` | exact adjoint on a sheared FCI map | `D = -M^-1 G^T M` | residual 1e-16 |
|
|
130
|
+
| Shear-Alfven wave, electron inertia | frequency of the evolved RHS | `omega = k_par v_A / sqrt(1 + k_perp^2 d_e^2)` | within 2.5% |
|
|
131
|
+
| Drift-Alfven wave | frequency of the evolved RHS | eigenvalue of the linear system | within 0.5% |
|
|
132
|
+
| 1D plasma-neutral leg (AMJUEL) | target temperature, six densities | SD1D 13.6 eV scan (Dudson et al. 2019) | within 0.4% |
|
|
133
|
+
| HSX 16^3 with sheath and neutrals | wall-face ledger at t = 0.6 | integrated wall fluxes | particles 9e-5, energy 8e-4 of the wall loss |
|
|
134
|
+
| Reverse-mode gradient | 8 directional derivatives through an FGMRES solve | central differences | 2e-10 relative |
|
|
135
|
+
|
|
136
|
+
The gradient through three steps of the HSX 16^3 driver agrees with central differences to 2e-7 (`slow` test, not part of the figure). `PYTHONPATH=src:. python examples/validation_overview.py` regenerates the figure; the first run builds the HSX geometry (about 8 min) and the script takes about 6 min after that.
|
|
137
|
+
|
|
138
|
+
## Drift-wave turbulence
|
|
139
|
+
|
|
140
|
+
The Hasegawa-Wakatani model on a doubly periodic plane: density-gradient-driven
|
|
141
|
+
drift waves saturate into turbulence with zonal flows. The adiabaticity
|
|
142
|
+
`alpha` sets the regime, from streamer-like transport at small `alpha` to
|
|
143
|
+
wave-like transport at large `alpha`. The movie is the default run (96x96 modes, t = 400, about 2 min on a laptop CPU), shown from t = 124, after the energy (right) saturates.
|
|
144
|
+
|
|
145
|
+
<img src="docs/media/drift_wave_turbulence.gif" width="700" alt="Drift-wave turbulence">
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
python examples/tokamak/drift_wave_turbulence.py
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Stellarator turbulence on FCI geometry
|
|
152
|
+
|
|
153
|
+
Four-field interchange turbulence (density, vorticity, and ion and electron
|
|
154
|
+
parallel velocity) on a rotating-ellipse stellarator, a torus whose
|
|
155
|
+
elliptical cross-section rotates with the toroidal angle. The movie is a
|
|
156
|
+
cutaway of density fluctuations on a flux surface and through the interior,
|
|
157
|
+
from a 500-step run (t = 1.0, 16x32x16 cells). The fluctuation (about 3% rms)
|
|
158
|
+
settles within t = 0.1 and the state stays quasi-steady; at this resolution it
|
|
159
|
+
shows low-order band structures rather than fine-scale turbulence. The script
|
|
160
|
+
also writes the closed and limiter-terminated open field lines of the same
|
|
161
|
+
geometry. About 7 min on a laptop CPU.
|
|
162
|
+
|
|
163
|
+
<img src="docs/media/stellarator_3d_turbulence.gif" width="700" alt="Stellarator turbulence in 3D">
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
python examples/stellarator/stellarator_3d_render.py
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Electromagnetic four-field model
|
|
170
|
+
|
|
171
|
+
`[physics] electromagnetic = true` adds the parallel vector potential A_par to the
|
|
172
|
+
four-field model: Ampere's law is solved every right-hand-side evaluation, every
|
|
173
|
+
parallel gradient carries the magnetic flutter term `{A_par, f}/(rho_star B)`, and
|
|
174
|
+
the evolved electron velocity is the canonical momentum, which brings in electron
|
|
175
|
+
inertia. The default (`false`) is the electrostatic model, unchanged bit for bit.
|
|
176
|
+
The shear-Alfven wave follows `omega = k_par v_A / sqrt(1 + k_perp^2 d_e^2)` to
|
|
177
|
+
2.5% on a 12x3x16 slab, and the drift-Alfven wave in a density gradient to 0.24%
|
|
178
|
+
(left: measured against theory). The step costs about 2.5 times the electrostatic one (laptop CPU and RTX A4000). Also verified: the beta -> 0 limit (RHS difference 8.5e-9 at beta 1e-8, linear in beta), energy conservation over a wave period (0.55%) and a manufactured solution (order 2.1); the citations, numbers and figures are on the page [Electromagnetic model](docs/electromagnetic.md).
|
|
179
|
+
|
|
180
|
+
<img src="docs/media/electromagnetic_verification.png" width="700" alt="Electromagnetic verification">
|
|
181
|
+
|
|
182
|
+
<img src="docs/media/alfven_dispersion.png" width="700" alt="Alfven wave dispersion">
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
drbx run examples/inputs/electromagnetic_turbulence.toml
|
|
186
|
+
python examples/electromagnetic/alfven_dispersion.py
|
|
187
|
+
python examples/electromagnetic/electromagnetic_verification.py
|
|
188
|
+
python examples/electromagnetic/electromagnetic_turbulence.py
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## FCI parallel gradient on the rotating ellipse
|
|
192
|
+
|
|
193
|
+
Parallel derivatives come from field-line tracing and interpolation on a grid
|
|
194
|
+
that is not field aligned. On the rotating-ellipse geometry (nested flux
|
|
195
|
+
surfaces, no wall), the parallel gradient b·∇f converges at second order
|
|
196
|
+
(measured orders 2.02 direct and 1.99 traced between 16^3 and 48^3). This
|
|
197
|
+
tests the bulk only; the wall, where FCI is harder, is not included. The
|
|
198
|
+
operator is differentiable with respect to the shape. About 40 s.
|
|
199
|
+
|
|
200
|
+
<img src="docs/media/rotating_ellipse_fci.png" width="700" alt="Rotating-ellipse FCI convergence">
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python examples/stellarator/rotating_ellipse_fci.py
|
|
204
|
+
python examples/stellarator/fci_differentiable.py # shape derivative of the operator
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Tilted planes: the FCI approach of the HSX backend
|
|
208
|
+
|
|
209
|
+
Classic FCI codes put the poloidal planes at fixed toroidal angles and trace
|
|
210
|
+
field lines from plane to plane. The HSX backend (`drbx.fci_braginskii`) keeps
|
|
211
|
+
the plane-to-plane field-line maps, but its logical planes (the `eta` index of
|
|
212
|
+
the geometry bundle) are wall-fitted surfaces: the boundary of every plane is
|
|
213
|
+
a vessel contour, and the planes are tilted and curved to follow the twisting
|
|
214
|
+
HSX cross-section. In the 32^3 bundle the toroidal angle of the cell centres
|
|
215
|
+
varies by about 9 degrees across one plane, almost the 11.25 degrees between
|
|
216
|
+
planes. The figure shows three consecutive planes (coloured), the
|
|
217
|
+
constant-angle planes of a classic grid at the same positions (black outlines)
|
|
218
|
+
and field lines traced through the coil field. Parallel
|
|
219
|
+
operators use field lines traced from each cell to the neighbouring plane
|
|
220
|
+
(mean traced length 0.27 m; about 3% of the forward maps end on the wall).
|
|
221
|
+
|
|
222
|
+
<img src="docs/media/hsx_fci_planes.png" width="800" alt="Tilted FCI planes of the HSX geometry">
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
PYTHONPATH=src python examples/stellarator/hsx_fci_planes.py # needs the 32^3 bundle and drbx[viz]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Island divertor
|
|
229
|
+
|
|
230
|
+
A sheared rotational transform with resonant perturbations forms island chains
|
|
231
|
+
and a stochastic edge. The open SOL is not imposed: multi-transit field-line
|
|
232
|
+
tracing marks the region of finite connection length, and the turbulence drains
|
|
233
|
+
through it. The Poincare section uses 120 field lines and 600 transits each.
|
|
234
|
+
|
|
235
|
+
<img src="docs/media/island_divertor.png" width="800" alt="Island divertor">
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
python examples/stellarator/island_divertor.py
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Imported stellarator fields
|
|
242
|
+
|
|
243
|
+
Field lines run on imported geometry. ESSOS coils give a Biot-Savart field;
|
|
244
|
+
traced lines are classified by Poincare crossings as closed (stay on a flux
|
|
245
|
+
surface) or open (leave the confined region). The same tracing is available for
|
|
246
|
+
VMEC `wout` files through VMEX. The figure shows the traced lines in 3D
|
|
247
|
+
and the Poincare section at phi = 0 (30 closed and 30 open lines, 16000 samples each). The 3D view is a PyVista render. Needs `drbx[essos,viz]`; about 3 min.
|
|
248
|
+
|
|
249
|
+
<img src="docs/media/closed_open_vacuum_poincare.png" width="700" alt="Closed and open field lines from ESSOS coils">
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
python examples/geometry-3D/essos-field-lines/closed_open_vacuum_poincare.py
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Four-field turbulence on the Landreman-Paul precise-QA field
|
|
256
|
+
([`landreman_paul_turbulence.py`](examples/stellarator/landreman_paul_turbulence.py))
|
|
257
|
+
additionally needs the QA `wout` from an ESSOS checkout:
|
|
258
|
+
`DRBX_ESSOS_ROOT=/path/to/ESSOS python examples/stellarator/landreman_paul_turbulence.py`.
|
|
259
|
+
|
|
260
|
+
## Sheath-bounded SOL, neutrals and detachment
|
|
261
|
+
|
|
262
|
+
On open field lines, parallel transport to Bohm-sheath targets relaxes to the
|
|
263
|
+
two-point steady state (`examples/sol/open_sol_flux_tube.py`: target-to-upstream
|
|
264
|
+
density ratio 0.49; two-point theory gives 0.5). The Bohm condition is imposed on
|
|
265
|
+
the target face, where the flux uses |v| = max(|v_cell|, c_s), so the flow at the
|
|
266
|
+
sheath entrance is at least c_s by construction. The Mach number printed and
|
|
267
|
+
plotted is that of the last cell centre (0.94 here), half a cell upstream of the
|
|
268
|
+
face; it can be below 1. With the diffusive neutral of the 1D SOL model (AMJUEL ionization, recombination
|
|
269
|
+
and charge exchange) and recycling, raising the upstream density chokes the flow
|
|
270
|
+
into the sheath: the Mach number of the last cell falls through 1 between
|
|
271
|
+
upstream densities of 4 and 8 in normalized units, while the face keeps the
|
|
272
|
+
c_s floor and the target flux stays n c_s.
|
|
273
|
+
|
|
274
|
+
<img src="docs/media/recycling_sol.png" width="700" alt="Recycling SOL profiles and last-cell Mach number">
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
python examples/sol/recycling_sol.py # under 10 s
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
The 1D divertor-leg model implements the SD1D equations (Dudson et al.,
|
|
281
|
+
*Plasma Phys. Control. Fusion* 61, 065008, 2019) and finds the steady state
|
|
282
|
+
with a Newton method. The movie steps through an upstream-density scan; the leg
|
|
283
|
+
is drawn with half-width proportional to the square root of the flux-tube area,
|
|
284
|
+
on a logarithmic distance-to-target axis, next to the target temperature and
|
|
285
|
+
flux against the published SD1D hydrogen-only 13.6 eV scan (800 cells).
|
|
286
|
+
|
|
287
|
+
<img src="docs/media/b6_detachment.gif" width="800" alt="Detachment scan against SD1D">
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
python examples/benchmarks/b6_detachment_sd1d.py # about 1 min
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Analysis: as the upstream density rises from 1.7 to 7.5e19 m^-3 the target
|
|
294
|
+
cools from 29 to 3 eV and the neutral density builds up in the last 0.1 m of
|
|
295
|
+
the leg, while the target particle flux keeps rising (hydrogen only: no flux
|
|
296
|
+
rollover without impurity radiation and excitation, which this model does not
|
|
297
|
+
include). Seven of the eight SD1D densities agree to within 0.35% in target
|
|
298
|
+
temperature and 0.15% in flux, with particle and power ledgers closed to 1e-9
|
|
299
|
+
or better. The eighth SD1D point is not a steady state in its restart data and
|
|
300
|
+
differs by about 10%.
|
|
301
|
+
|
|
302
|
+
## Fluid neutrals in 3D
|
|
303
|
+
|
|
304
|
+
The FCI backend evolves neutral density, parallel velocity and temperature
|
|
305
|
+
(`n_n`, `u_n`, `T_n`) with `neutrals = true`, coupled to the plasma through
|
|
306
|
+
ionisation, recombination and charge exchange from one AMJUEL 2020 rates module
|
|
307
|
+
shared with the 1D models, and returns the ion wall flux as neutrals with
|
|
308
|
+
`recycling = true`. The closure is valid for Knudsen number Kn <~ 0.3. Each
|
|
309
|
+
figure below has its generator in [`examples/neutrals/`](examples/neutrals);
|
|
310
|
+
the HSX and ledger figures read run output that the script directory does not
|
|
311
|
+
contain (the docstrings list the decks).
|
|
312
|
+
|
|
313
|
+
<img src="docs/media/fig4_rates.png" width="800" alt="AMJUEL rate coefficients against SD1D fits">
|
|
314
|
+
|
|
315
|
+
Ionisation, charge-exchange and recombination rate coefficients versus T_e from the single shared AMJUEL 2020 rates module (n_e = 1e19 m^-3, CX at T_eff = T_e), with the SD1D fits dashed. At 10 eV the SD1D fits are 0.59x the AMJUEL ionisation rate, 1.18x charge exchange and 1.02x recombination.
|
|
316
|
+
|
|
317
|
+
<img src="docs/media/fig2_slab.png" width="800" alt="Neutral penetration in a plasma slab">
|
|
318
|
+
|
|
319
|
+
Steady neutral profile entering a uniform plasma slab matches the analytic exp(-x/lambda), lambda = lambda_mfp / sqrt(nu_iz/nu), with a fitted/analytic length ratio of 1.002 at Kn = lambda_mfp/lambda = 0.09. A sweep over plasma temperature keeps the ratio within 0.7% for 0.003 <= Kn <= 0.24 and drops to 0.98 at Kn = 0.42 and 0.87 at Kn = 0.65, above the Kn ~ 0.3 closure limit.
|
|
320
|
+
|
|
321
|
+
<img src="docs/media/fig1_hsx_neutrals.png" width="800" alt="Fluid neutrals on the HSX poloidal section">
|
|
322
|
+
|
|
323
|
+
Neutral density, neutral temperature and Knudsen number on the phi = 0 (bean) poloidal section of the 32^3 HSX artifact at t = 0.18 L_ref/c_s0 (240 steps of the default fluid-neutral run with recycling, n0 = 1e19 m^-3), when the neutral inventory is growing by 3.2% over the last tenth of the run (down from 8% earlier). Neutrals reach a peak of 15.4e17 m^-3 with T_n of 4.9-14 eV, but Kn > 1 in 98% of neutral-bearing cells (median 2.7, Kn < 0.3 in 0.2%), so the fluid closure is outside its validity range at HSX edge parameters (cells with n_n < 1e15 m^-3 are masked).
|
|
324
|
+
|
|
325
|
+
<img src="docs/media/fig3_conservation.png" width="800" alt="Wall-face conservation ledger">
|
|
326
|
+
|
|
327
|
+
The independent wall-face ledger on the 16^3 HSX run (800 steps, t = 0.6) shows applied and wall-face rates agreeing per step to 1.3e-4 or better for particles, 5.7e-4 for electron energy and 1.9e-4 for ion energy (relative to the larger of the two), and particles closed to 9.5e-5 of the wall loss. Flux-form perpendicular diffusion reduces the final energy residual from 2.85e-3 to 0.76e-3 (W_e), 1.74e-3 to 0.33e-3 (W_i) and 3.98e-3 to 0.49e-3 in total (8.2x), in the run's normalised energy units.
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
python examples/neutrals/fig4_rates.py # a few seconds
|
|
331
|
+
PYTHONPATH=src:. python examples/neutrals/fig2_slab.py # about 1 min
|
|
332
|
+
python examples/neutrals/fig1_hsx_neutrals.py # needs the 32^3 HSX run history
|
|
333
|
+
python examples/neutrals/fig3_conservation.py # needs the 16^3 ledger logs
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Differentiable design and control
|
|
337
|
+
|
|
338
|
+
The steady-state solve is differentiated with the implicit-function theorem, so
|
|
339
|
+
a controller can use exact sensitivities. Newton steps on `dT_target/dn_upstream`
|
|
340
|
+
find the upstream density that gives a 10 eV target temperature in three
|
|
341
|
+
updates (200-cell grid, 2.706e19 m^-3, 10.0002 eV; about 2 min):
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
python examples/autodiff/detachment_control.py
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Gradients also pass through nonlinear turbulence. Starting from saturated
|
|
348
|
+
Hasegawa-Wakatani turbulence at `alpha = 0.3`, a damped Newton iteration on
|
|
349
|
+
`ln(alpha)` (bottom right: the windowed flux objective and `alpha` over the
|
|
350
|
+
iterations) finds `alpha = 0.73`, which cuts the windowed flux by 4x. The
|
|
351
|
+
figure compares the two long independent runs to t = 250 (top: density at the
|
|
352
|
+
end; bottom left: flux traces and their means over the grey window). The
|
|
353
|
+
saturated fluxes are 1.00 and 0.31, a 3.2x reduction: the flux fluctuates by
|
|
354
|
+
about 25%, so the 4x target is met within the scatter of the short-window
|
|
355
|
+
objective. About 3 min.
|
|
356
|
+
|
|
357
|
+
<img src="docs/media/hasegawa_wakatani_optimization.png" width="650" alt="Hasegawa-Wakatani inverse design">
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
python examples/tokamak/hasegawa_wakatani_optimization.py
|
|
361
|
+
python examples/autodiff/differentiation_methods.py # forward vs reverse vs checkpointed cost
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Verification
|
|
365
|
+
|
|
366
|
+
`drbx.linear` linearizes a model about an equilibrium. The shear-Alfven
|
|
367
|
+
operator reproduces the analytic dispersion relation to 4e-16 (relative), and
|
|
368
|
+
the drift-wave operator is scanned in adiabaticity against the analytic
|
|
369
|
+
frequency and growth rate. Method-of-manufactured-solutions tests check
|
|
370
|
+
second-order convergence of the 1D fluid model and the FCI operators.
|
|
371
|
+
|
|
372
|
+
<img src="docs/media/linear_dispersion.png" width="700" alt="Linear dispersion">
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
python examples/benchmarks/linear_dispersion.py
|
|
376
|
+
pytest -n 2 -q tests/test_validation_fluid_1d_mms_convergence.py tests/test_mms_convergence.py
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
## Parallel performance
|
|
381
|
+
|
|
382
|
+
The two-field drift-reduced step runs across devices with `shard_map`, and every
|
|
383
|
+
device count gives the same result (checksums agree to 1e-10;
|
|
384
|
+
[`tests/test_fci_sharded_2field.py`](tests/test_fci_sharded_2field.py)). The
|
|
385
|
+
figure uses 512x256x32 cells (4.2 M) and 10 timed RK4 steps per device count,
|
|
386
|
+
with CPU devices pinned one core each on a 36-core Linux host that was shared
|
|
387
|
+
and heavily loaded (load average about 25): 8.0 s per step on one device and
|
|
388
|
+
2.0 s on 16 (4.0x, throughput 0.5 to 2.1 Mcell/s). An earlier run of the same script on a
|
|
389
|
+
256x128x32 grid (1.05 M cells) gave 6.2x at 16 shards. On a laptop one XLA device already
|
|
390
|
+
threads across all cores, so sharding gains little there. One NVIDIA A4000 ran
|
|
391
|
+
a 1.05M-cell step about 21x faster than a single CPU shard (measured by hand,
|
|
392
|
+
not reproduced by the script). The FCI operator and domain-decomposition stack
|
|
393
|
+
was contributed by Aiken Xie in [PR #3](https://github.com/uwplasma/drbx/pull/3).
|
|
394
|
+
|
|
395
|
+
<img src="docs/media/sharded_fci_step.png" width="800" alt="Sharded FCI step: time per step and throughput">
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
python examples/benchmarks/fci_sharded_strong_scaling.py
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## HSX geometry and scrape-off-layer filament
|
|
402
|
+
|
|
403
|
+
*Scope:* experimental. The Bohm sheath wall closure is the default; fluid
|
|
404
|
+
neutrals (`n_n`, `u_n`, `T_n`) with wall recycling are optional
|
|
405
|
+
(`examples/inputs/hsx_fci_neutrals.toml`). The fluid closure needs
|
|
406
|
+
`Kn <~ 0.3`, and HSX edge cells are mostly `Kn >= 1`, so the neutral fields are
|
|
407
|
+
not a quantitative prediction there. Each step with the sheath on prints an
|
|
408
|
+
independent wall-flux conservation check (`[wall-step]`, `[wall-run]`).
|
|
409
|
+
|
|
410
|
+
The HSX geometry is built from the coils in
|
|
411
|
+
[`examples/inputs/hsx/coils.hsx`](examples/inputs/hsx/coils.hsx) (QHS currents)
|
|
412
|
+
and the vessel outline [`vessel_hsx_flare.txt`](examples/inputs/hsx/vessel_hsx_flare.txt).
|
|
413
|
+
The figure shows the coils (PyVista render), the boundary of the simulated
|
|
414
|
+
domain colored by |B| and the vessel; a Poincare section at phi = 0 traced
|
|
415
|
+
through the coil field (90 lines, about 320 toroidal turns each; blue points
|
|
416
|
+
stay inside the vessel, red diamonds mark lines that reach the wall); and the
|
|
417
|
+
connection length to the wall on the same plane.
|
|
418
|
+
|
|
419
|
+
<img src="docs/media/hsx_geometry.png" width="800" alt="HSX coils, Poincare section and connection length">
|
|
420
|
+
|
|
421
|
+
The `drbx.fci_braginskii` backend evolves a density filament in the
|
|
422
|
+
scrape-off layer up to the vessel wall. It uses a Bohm sheath wall closure by
|
|
423
|
+
default, with implicit Spitzer-Harm parallel conduction
|
|
424
|
+
(`parallel_conduction = "auto"`, on with the Bohm wall). Fluid neutrals (`n_n`,
|
|
425
|
+
`u_n`, `T_n`) with wall recycling are the neutral model when `neutrals = true`
|
|
426
|
+
and `recycling = true`; the deck keys are in [docs/decks.md](docs/decks.md) and
|
|
427
|
+
the geometry bundle is described in
|
|
428
|
+
[docs/fci_braginskii_hsx_backend.md](docs/fci_braginskii_hsx_backend.md). The
|
|
429
|
+
first run is `drbx run examples/inputs/hsx_fci_blob.toml`, which builds a 16^3
|
|
430
|
+
geometry from the shipped coils and vessel (about 4 min on a laptop). The default
|
|
431
|
+
HSX deck is verified to t = 0.6 at 16^3, and at 32^3 with
|
|
432
|
+
`sheath_potential = "current"` ([docs/plan.md](docs/plan.md), C3a).
|
|
433
|
+
|
|
434
|
+
The movie is the default 32^3 HSX deck with `sheath_potential = "current"` (800
|
|
435
|
+
steps, t = 0 to 0.6 in L_ref/c_s, about 40 min on a laptop CPU). It shows
|
|
436
|
+
n - 1, phi and the parallel flows Vi and Ve on four toroidal planes (rows from
|
|
437
|
+
top to bottom), each row on its own fixed colour scale (99.5th percentile of
|
|
438
|
+
|field| over the active cells). The seeded filament is a few percent of the
|
|
439
|
+
scale at t = 0; by t = 0.3 n - 1 is depleted in the wall layer, and Vi and Ve
|
|
440
|
+
carry alternating-sign structures confined to that layer.
|
|
441
|
+
|
|
442
|
+
<img src="docs/media/hsx_fci_blob.gif" width="700" alt="HSX filament: n - 1, phi, Vi and Ve on four toroidal planes">
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
python examples/stellarator/hsx_fci_blob_render.py # runs the backend, then renders the geometry figure and the movie (drbx[viz])
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## Tests
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
pip install -e ".[dev]" # or: pip install pytest pytest-xdist
|
|
452
|
+
pytest -n 2 -q -m "not slow"
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
CI runs the fast suite on Python 3.10-3.12 (CPU). Policy:
|
|
456
|
+
[docs/testing_strategy.md](docs/testing_strategy.md).
|
|
457
|
+
|
|
458
|
+
## More
|
|
459
|
+
|
|
460
|
+
[Equation-to-code map](docs/equation_to_code_map.md),
|
|
461
|
+
[physics models](docs/physics_models.md),
|
|
462
|
+
[validation gallery](docs/validation_gallery.md) (with the comparison against
|
|
463
|
+
other edge codes), [island-tokamak write-up](docs/island_tokamak.md) and
|
|
464
|
+
[release notes](docs/release_notes.md).
|
|
465
|
+
|
|
466
|
+
## Citing and license
|
|
467
|
+
|
|
468
|
+
If you use DRBX in published work, please cite https://github.com/uwplasma/DRBX.
|
|
469
|
+
MIT license, see [LICENSE](LICENSE).
|