Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions KIM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ include_directories("${CMAKE_Fortran_MODULE_DIRECTORY}")

enable_testing()

include(FetchZeal)

add_subdirectory(src)
# slatec is provided by the top-level cmake/Dependencies.cmake; do not add its subdir here
add_subdirectory(src/math/libcerf-main)
Expand Down
21 changes: 3 additions & 18 deletions KIM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ This is the integral plasma response model based on the code and model Kinetic L

### Auto-fetched Dependencies
The following are automatically downloaded during build:
- **ZEAL** - Complex root finder ([Kravanja et al., 2000](#references))
- **QUADPACK** - Adaptive quadrature (from Netlib)
- **libcerf** - Complex error function
- **SLATEC** - Mathematical library
Expand All @@ -30,8 +29,6 @@ To compile the code:
make
```

The build process downloads the ZEAL package (complex root finder) which requires a working LAPACK installation.

## WKB Dispersion Solver

Solves the kinetic dispersion relation D(k_r) = 0 for complex radial wavenumber k_r at each radial grid point.
Expand All @@ -40,33 +37,21 @@ Solves the kinetic dispersion relation D(k_r) = 0 for complex radial wavenumber

```fortran
&WKB_dispersion
WKB_dispersion_solver = 'Muller' ! 'Muller' or 'ZEAL'
WKB_dispersion_solver = 'Muller' ! 'Muller'
WKB_dispersion_mode = 'KIM' ! 'KIM' (full Bessel) or 'FLRE' (finite Larmor radius expansion)
/
```

### Solvers

**Muller** (recommended): Iterative root finder using previous root as initial guess. Reliable branch tracking.

**ZEAL**: Contour integration + Newton refinement. Per-branch tracking with configurable parameters in `zeal_input.f90`:
- `MAX_TRACKED_BRANCHES = 4` - Maximum simultaneous branches
- `BRANCH_SEARCH_HALFWIDTH = 1.5` - Search window per branch
- `BROAD_SEARCH_HALFWIDTH = 5.0` - Initial discovery window
**Muller**: Iterative root finder using previous root as initial guess. Reliable branch tracking.

### Output

Results written to `out/m*_n*/dispersion/` directory:
- `muller_branches_*.dat` or `zeal_branches_*.dat` - Branch-tracked roots
- `muller_branches_*.dat` - Branch-tracked roots
- HDF5 files with same data for post-processing

### Python Alternative

Python implementation using cxroots: `python/KIMpy/WKB-dispersion/wkb.py`

## References

P. Kravanja, M. Van Barel, O. Ragos, M.N. Vrahatis, F.A. Zafiropoulos,
*ZEAL: A mathematical software package for computing zeros of analytic functions*,
Computer Physics Communications **124** (2000) 212-232.
[doi:10.1016/S0010-4655(99)00429-4](https://doi.org/10.1016/S0010-4655(99)00429-4)
6 changes: 3 additions & 3 deletions KIM/nmls/KIM_config.nml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

&wkb_dispersion
WKB_dispersion_mode = 'KIM' ! 'KIM' (full Bessel) or 'FLRE' (finite Larmor radius)
WKB_dispersion_solver = 'ZEAL' ! 'Muller' or 'ZEAL'
WKB_dispersion_solver = 'Muller' ! 'Muller'
WKB_solve_for_kr_squared = .false. ! If true, solve D(kr^2)=0; if false, solve D(kr)=0
WKB_max_tracked_branches = 4 ! Max branches for ZEAL tracking
WKB_max_tracked_branches = 4 ! Max branches for per-branch tracking
WKB_branch_search_halfwidth = 1.5 ! Search half-width per branch
WKB_broad_search_halfwidth = 5.0 ! Initial broad search half-width
WKB_broad_search_interval = 0 ! Broad search every N points (0=only at start)
WKB_root_tolerance = 1.0d-6 ! |f(z)| tolerance for valid roots
WKB_verbose = .false. ! ZEAL verbose output
WKB_verbose = .false. ! Verbose dispersion solver output
/

&kim_io
Expand Down
2 changes: 1 addition & 1 deletion KIM/nmls/KIM_config_electromagnetic.nml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

&wkb_dispersion
WKB_dispersion_mode = 'KIM'
WKB_dispersion_solver = 'ZEAL'
WKB_dispersion_solver = 'Muller'
WKB_solve_for_kr_squared = .false.
WKB_max_tracked_branches = 4
WKB_branch_search_halfwidth = 1.5
Expand Down
3 changes: 0 additions & 3 deletions KIM/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ add_library(KIM_lib STATIC "${KIM_setup}"
"${KIM_WKB_dispersion}"
"${KIM_asymptotics}"
"${KIM_electromagnetic}"
"${external_zeal}"
)

set_target_properties(KIM_lib PROPERTIES
Expand Down Expand Up @@ -67,8 +66,6 @@ add_library(quadpack_netlib STATIC
${QUADPACK_DIR}/dqk15i.f
)
set_target_properties(quadpack_netlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
# Add dqagx from zeal (not available on netlib, required by zeros.f90)
target_sources(quadpack_netlib PRIVATE ${CMAKE_BINARY_DIR}/_deps/zeal-src/dqagx.f)
target_link_libraries(KIM_lib PUBLIC quadpack_netlib)

# Optionally provide minimal XERROR compatibility if SLATEC doesn't provide it
Expand Down
15 changes: 0 additions & 15 deletions KIM/src/CMakeSources.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,3 @@ set(KIM_electromagnetic electromagnetic/electromagnetic_kernel.f90
electromagnetic/ampere_matrices.f90
electromagnetic/electromagnetic_solver.f90
)

# Keep Zeal sources for root finding, but do not use its QUADPACK copies
# Use local modified copy of zeal_input.f90 instead of original form Zeal
set(external_dir ${CMAKE_BINARY_DIR}/_deps/zeal-src/)
set(external_zeal
${external_dir}/prec.f90
dispersion/zeal_input.f90
${external_dir}/integr_input.f90
${external_dir}/error.f90
${external_dir}/quad.f90
${external_dir}/split.f90
${external_dir}/refine.f90
${external_dir}/zeal.f90
${external_dir}/zeros.f90
)
2 changes: 1 addition & 1 deletion KIM/src/dispersion/fun_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MODULE Function_Input_Module
! Module for dispersion function input.
! Keep this name, since ZEAL uses it.

USE Precision_Module, only: DP
USE KIM_kinds_m, only: DP

IMPLICIT NONE

Expand Down
Loading
Loading