Julia¶
Pure Julia package using ccall into the native library. Distributed
via a private registry.
API coverage¶
Note: Julia uses free functions dispatched on MultipleDefectModel rather
than methods. The naming convention differs from C++/Python:
getTimeDerivative → trapped_rates, getMobileTimeDerivative →
mobile_rates, both together → rates.
C API ( |
Julia wrapper |
|---|---|
Process configuration |
|
— |
|
Construction |
|
|
|
|
|
Model metadata (struct fields) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Diffusion |
|
|
|
|
|
|
|
|
|
|
|
|
— |
Time integration |
|
|
|
|
|
— |
|
|
|
|
|
|
|
Initialisation |
|
|
|
|
|
|
|
|
|
— |
|
Bounds / validation |
|
|
|
|
|
Surface |
|
|
|
|
|
Retention |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Diagnostics |
|
|
|
|
— |
|
— |
Usage¶
Install from the private registry:
using Pkg
Pkg.activate(temp=true)
Pkg.Registry.add("General")
Pkg.Registry.add(url="https://github.com/stephen-dixon/julia-registry.git")
Pkg.add("Palioxis")
Example:
using Palioxis
# Set the Palioxis data root once per process.
Palioxis.init("/path/to/palioxis")
# Construct a model — try_model returns nothing on failure rather than throwing.
m = Palioxis.try_model("input.xml")
# Cached metadata available as struct fields.
println(m.n_gas, " ", m.gas_names, " ", m.defect_names)
# State vectors — sizes follow the cached dimensions.
mobile = zeros(m.n_gas)
defects = zeros(m.n_traps)
trapped = zeros(m.n_ne_species)
T = 800.0 # Kelvin
# Effective diffusion coefficient prefactor (ShapedDoubleData with .shape and .data).
D_eff = effective_diffusion_prefactor(m, mobile, defects, T)
# Both mobile and trapped time derivatives in a single call.
dy = rates(m, mobile, defects, trapped, T)
# dy.mobile — mobile rates [n_gas]
# dy.trapped — trapped rates [n_ne_species]