Skip to content

Commit 3dcd017

Browse files
committed
updates
1 parent ac11c36 commit 3dcd017

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2279
-474
lines changed

docs/Distributed_SHTnsKit_Guide.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ Vt = copy(fθφ);
106106
Vp = copy(fθφ);
107107

108108
# Analysis → Slm, Tlm (respects Robert form and PLM tables)
109-
Slm, Tlm = SHTnsKit.dist_spat_to_SHsphtor(cfg, Vt, Vp; use_rfft=true)
109+
Slm, Tlm = SHTnsKit.dist_analysis_sphtor(cfg, Vt, Vp; use_rfft=true)
110110

111111
# Synthesis back to grid
112-
Vt2, Vp2 = SHTnsKit.dist_SHsphtor_to_spat(cfg, Slm, Tlm; prototype_θφ=Vt, real_output=true, use_rfft=true)
112+
Vt2, Vp2 = SHTnsKit.dist_synthesis_sphtor(cfg, Slm, Tlm; prototype_θφ=Vt, real_output=true, use_rfft=true)
113113
```
114114

115115
QST transforms (distributed)
116116
```julia
117117
Vr = copy(fθφ)
118-
Q, S, T = SHTnsKit.dist_spat_to_SHqst(cfg, Vr, Vt, Vp)
119-
Vr2, Vt2, Vp2 = SHTnsKit.dist_SHqst_to_spat(cfg, Q, S, T; prototype_θφ=Vr, real_output=true, use_rfft=true)
118+
Q, S, T = SHTnsKit.dist_analysis_qst(cfg, Vr, Vt, Vp)
119+
Vr2, Vt2, Vp2 = SHTnsKit.dist_synthesis_qst(cfg, Q, S, T; prototype_θφ=Vr, real_output=true, use_rfft=true)
120120
```
121121

122122
Finalize MPI when done:
@@ -132,8 +132,8 @@ Using `use_rfft=true` halves azimuthal FFT work for real inputs/outputs.
132132

133133
Direct API
134134
- Scalar: `dist_analysis(...; use_rfft=true)`, `dist_synthesis(...; use_rfft=true)`
135-
- Vector: `dist_spat_to_SHsphtor(...; use_rfft=true)`, `dist_SHsphtor_to_spat(...; use_rfft=true)`
136-
- QST: `dist_SHqst_to_spat(...; use_rfft=true)`
135+
- Vector: `dist_analysis_sphtor(...; use_rfft=true)`, `dist_synthesis_sphtor(...; use_rfft=true)`
136+
- QST: `dist_synthesis_qst(...; use_rfft=true)`
137137

138138
Plan-based API (optional caching of FFT plans)
139139
```julia
@@ -210,11 +210,11 @@ Local/point (distributed reductions return the same result on all ranks)
210210

211211
Packed conversions (dense/LM ⇄ distributed)
212212
- Real (LM):
213-
- `dist_spat_to_SH_packed(cfg, fθφ::PencilArray) -> Qlm`
214-
- `dist_SH_packed_to_spat(cfg, Qlm; prototype_θφ, real_output=true) -> PencilArray`
213+
- `dist_analysis_packed(cfg, fθφ::PencilArray) -> Qlm`
214+
- `dist_synthesis_packed(cfg, Qlm; prototype_θφ, real_output=true) -> PencilArray`
215215
- Complex (LM_cplx):
216-
- `dist_spat_cplx_to_SH(cfg, z::PencilArray) -> alm_packed`
217-
- `dist_SH_to_spat_cplx(cfg, alm_packed; prototype_θφ) -> PencilArray`
216+
- `dist_analysis_packed_cplx(cfg, z::PencilArray) -> alm_packed`
217+
- `dist_synthesis_packed_cplx(cfg, alm_packed; prototype_θφ) -> PencilArray`
218218

219219
---
220220

docs/advanced_ad_summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ This document summarizes AD capabilities for SHTnsKit.jl, enabling applications
55
## AD Capabilities
66

77
### Supported Functions
8-
- **Basic transforms**: `synthesis`, `analysis`, `SH_to_spat_cplx`, `spat_cplx_to_SH`
9-
- **Vector transforms**: `SHsphtor_to_spat`, `spat_to_SHsphtor`
8+
- **Basic transforms**: `synthesis`, `analysis`, `synthesis_packed_cplx`, `analysis_packed_cplx`
9+
- **Vector transforms**: `synthesis_sphtor`, `analysis_sphtor`
1010
- **Diagnostics**: `energy_scalar_l_spectrum`, `energy_vector_l_spectrum`
1111

1212
### ForwardDiff Support

docs/advanced_optimizations_summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ for i in 1:cfg.nlat, j in 1:cfg.nlon
100100
end
101101

102102
# Decompose into spheroidal/toroidal components
103-
Slm, Tlm = spat_to_SHsphtor(cfg, Vθ, Vφ)
103+
Slm, Tlm = analysis_sphtor(cfg, Vθ, Vφ)
104104

105105
# Reconstruct velocity field
106-
Vθ_rec, Vφ_rec = SHsphtor_to_spat(cfg, Slm, Tlm)
106+
Vθ_rec, Vφ_rec = synthesis_sphtor(cfg, Slm, Tlm)
107107

108108
destroy_config(cfg)
109109
```

docs/src/advanced.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ end
203203
Alm = analysis(cfg, test_field)
204204

205205
# Compute gradient using spectral method (exact derivatives)
206-
# SH_to_grad_spat computes ∇f = (∂f/∂θ, (1/sinθ)∂f/∂φ)
207-
∂f_∂θ, ∂f_∂φ_over_sinθ = SH_to_grad_spat(cfg, Alm)
206+
# synthesis_grad computes ∇f = (∂f/∂θ, (1/sinθ)∂f/∂φ)
207+
∂f_∂θ, ∂f_∂φ_over_sinθ = synthesis_grad(cfg, Alm)
208208

209209
println("Gradient computed using spectral method:")
210210
println(" ∂f/∂θ range: ", extrema(∂f_∂θ))
@@ -250,7 +250,7 @@ Alm = SHTnsKit.dist_analysis(cfg, fθφ)
250250
# Compute gradient using distributed synthesis with spheroidal transform
251251
# Gradient = (∂f/∂θ, (1/sinθ)∂f/∂φ) via spheroidal synthesis
252252
Tlm = zeros(ComplexF64, cfg.lmax+1, cfg.mmax+1) # Zero toroidal component
253-
∂f_∂θ, ∂f_∂φ_over_sinθ = SHTnsKit.dist_SHsphtor_to_spat(cfg, Alm, Tlm; prototype_θφ=fθφ)
253+
∂f_∂θ, ∂f_∂φ_over_sinθ = SHTnsKit.dist_synthesis_sphtor(cfg, Alm, Tlm; prototype_θφ=fθφ)
254254

255255
if rank == 0
256256
println("Distributed gradient computed successfully")
@@ -360,7 +360,7 @@ for i in 1:cfg.nlat, j in 1:cfg.nlon
360360
end
361361

362362
# Decompose into spheroidal/toroidal
363-
Slm, Tlm = spat_to_SHsphtor(cfg, Vθ, Vφ)
363+
Slm, Tlm = analysis_sphtor(cfg, Vθ, Vφ)
364364

365365
# Compute divergence and vorticity
366366
div_field = divergence_from_spheroidal(cfg, Slm)

docs/src/api/index.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ analysis!
4646
## Complex Field Transforms
4747

4848
```@docs
49-
SH_to_spat_cplx
50-
spat_cplx_to_SH
49+
synthesis_packed_cplx
50+
analysis_packed_cplx
5151
```
5252

5353
## Vector Field Transforms
@@ -59,20 +59,20 @@ Vector fields on the sphere are decomposed into **spheroidal** and **toroidal**
5959
### Vector Synthesis
6060

6161
```@docs
62-
SHsphtor_to_spat
62+
synthesis_sphtor
6363
```
6464

6565
### Vector Analysis
6666

6767
```@docs
68-
spat_to_SHsphtor
68+
analysis_sphtor
6969
```
7070

7171
## QST Transforms (3D Vector Fields)
7272

7373
```@docs
74-
SHqst_to_spat
75-
spat_to_SHqst
74+
synthesis_qst
75+
analysis_qst
7676
```
7777

7878
## Rotations
@@ -113,15 +113,15 @@ When using MPI with PencilArrays, the following functions are available via the
113113

114114
- `dist_analysis(cfg, fθφ)` - Distributed spatial to spectral transform
115115
- `dist_synthesis(cfg, Alm; prototype_θφ, real_output)` - Distributed spectral to spatial transform
116-
- `dist_spat_to_SHsphtor(cfg, Vθ, Vφ)` - Distributed vector analysis
117-
- `dist_SHsphtor_to_spat(cfg, Slm, Tlm; prototype_θφ)` - Distributed vector synthesis
116+
- `dist_analysis_sphtor(cfg, Vθ, Vφ)` - Distributed vector analysis
117+
- `dist_synthesis_sphtor(cfg, Slm, Tlm; prototype_θφ)` - Distributed vector synthesis
118118

119119
See the [Distributed Guide](../distributed.md) for detailed usage.
120120

121121
## Gradient and Differential Operators
122122

123123
```@docs
124-
SH_to_grad_spat
124+
synthesis_grad
125125
divergence_from_spheroidal
126126
vorticity_from_toroidal
127127
```
@@ -173,10 +173,10 @@ for i in 1:cfg.nlat, j in 1:cfg.nlon
173173
end
174174

175175
# Decompose into spheroidal/toroidal
176-
Slm, Tlm = spat_to_SHsphtor(cfg, Vθ, Vφ)
176+
Slm, Tlm = analysis_sphtor(cfg, Vθ, Vφ)
177177

178178
# Reconstruct
179-
Vθ_rec, Vφ_rec = SHsphtor_to_spat(cfg, Slm, Tlm)
179+
Vθ_rec, Vφ_rec = synthesis_sphtor(cfg, Slm, Tlm)
180180

181181
destroy_config(cfg)
182182
```

docs/src/distributed.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ Pkg.add(["MPI", "PencilArrays", "PencilFFTs"])
9696
|----------|-------------|
9797
| `dist_analysis(cfg, fθφ)` | Distributed spatial → spectral transform |
9898
| `dist_synthesis(cfg, Alm; prototype_θφ)` | Distributed spectral → spatial transform |
99-
| `dist_spat_to_SHsphtor(cfg, Vθ, Vφ)` | Distributed vector field analysis |
100-
| `dist_SHsphtor_to_spat(cfg, Slm, Tlm; prototype_θφ)` | Distributed vector field synthesis |
99+
| `dist_analysis_sphtor(cfg, Vθ, Vφ)` | Distributed vector field analysis |
100+
| `dist_synthesis_sphtor(cfg, Slm, Tlm; prototype_θφ)` | Distributed vector field synthesis |
101101

102102
### Spectral Operators
103103

@@ -189,8 +189,8 @@ for (i_local, i_global) in enumerate(ranges[1])
189189
end
190190

191191
# Distributed vector transform
192-
Slm, Tlm = SHTnsKit.dist_spat_to_SHsphtor(cfg, Vθ, Vφ)
193-
Vθ_out, Vφ_out = SHTnsKit.dist_SHsphtor_to_spat(cfg, Slm, Tlm; prototype_θφ=Vθ)
192+
Slm, Tlm = SHTnsKit.dist_analysis_sphtor(cfg, Vθ, Vφ)
193+
Vθ_out, Vφ_out = SHTnsKit.dist_synthesis_sphtor(cfg, Slm, Tlm; prototype_θφ=Vθ)
194194

195195
destroy_config(cfg)
196196
MPI.Finalize()

docs/src/examples/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ for i in 1:cfg.nlat, j in 1:cfg.nlon
207207
end
208208

209209
# Decompose into spheroidal (divergent) and toroidal (rotational)
210-
Slm, Tlm = spat_to_SHsphtor(cfg, u, v)
210+
Slm, Tlm = analysis_sphtor(cfg, u, v)
211211

212212
# Analyze energy distribution
213213
spheroidal_energy = sum(abs2, Slm)
@@ -216,7 +216,7 @@ println("Spheroidal (divergent) energy: $spheroidal_energy")
216216
println("Toroidal (rotational) energy: $toroidal_energy")
217217

218218
# Reconstruct original velocity
219-
u_recon, v_recon = SHsphtor_to_spat(cfg, Slm, Tlm)
219+
u_recon, v_recon = synthesis_sphtor(cfg, Slm, Tlm)
220220
velocity_error = norm(u - u_recon) + norm(v - v_recon)
221221
println("Velocity reconstruction error: $velocity_error")
222222

@@ -258,7 +258,7 @@ end
258258

259259
# Get velocity from stream function (toroidal component only)
260260
Slm_zero = zeros(ComplexF64, cfg.lmax+1, cfg.mmax+1)
261-
u_stream, v_stream = SHsphtor_to_spat(cfg, Slm_zero, ψ_lm)
261+
u_stream, v_stream = synthesis_sphtor(cfg, Slm_zero, ψ_lm)
262262

263263
# Convert stream function to spatial domain
264264
stream_function = synthesis(cfg, ψ_lm)
@@ -472,8 +472,8 @@ start_time = MPI.Wtime()
472472

473473
n_iter = 20
474474
for i in 1:n_iter
475-
Slm, Tlm = SHTnsKit.dist_spat_to_SHsphtor(cfg, Vθ, Vφ)
476-
Vθ_out, Vφ_out = SHTnsKit.dist_SHsphtor_to_spat(cfg, Slm, Tlm; prototype_θφ=Vθ)
475+
Slm, Tlm = SHTnsKit.dist_analysis_sphtor(cfg, Vθ, Vφ)
476+
Vθ_out, Vφ_out = SHTnsKit.dist_synthesis_sphtor(cfg, Slm, Tlm; prototype_θφ=Vθ)
477477
end
478478

479479
MPI.Barrier(comm)
@@ -485,8 +485,8 @@ if rank == 0
485485
end
486486

487487
# Verify accuracy
488-
Slm, Tlm = SHTnsKit.dist_spat_to_SHsphtor(cfg, Vθ, Vφ)
489-
Vθ_rec, Vφ_rec = SHTnsKit.dist_SHsphtor_to_spat(cfg, Slm, Tlm; prototype_θφ=Vθ)
488+
Slm, Tlm = SHTnsKit.dist_analysis_sphtor(cfg, Vθ, Vφ)
489+
Vθ_rec, Vφ_rec = SHTnsKit.dist_synthesis_sphtor(cfg, Slm, Tlm; prototype_θφ=Vθ)
490490

491491
θ_err = maximum(abs.(parent(Vθ_rec) .- parent(Vθ)))
492492
φ_err = maximum(abs.(parent(Vφ_rec) .- parent(Vφ)))

docs/src/gpu.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ Alm = gpu_analysis_safe(cfg, large_spatial_data)
147147

148148
### Vector Field Transforms
149149

150-
#### `gpu_spat_to_SHsphtor`
150+
#### `gpu_analysis_sphtor`
151151

152152
```julia
153-
gpu_spat_to_SHsphtor(cfg::SHTConfig, vθ, vφ; device=get_device())
153+
gpu_analysis_sphtor(cfg::SHTConfig, vθ, vφ; device=get_device())
154154
```
155155

156156
GPU-accelerated spheroidal-toroidal decomposition.
@@ -164,21 +164,21 @@ vθ = rand(cfg.nlat, cfg.nlon)
164164
= rand(cfg.nlat, cfg.nlon)
165165

166166
# Decompose into spheroidal and toroidal
167-
Slm, Tlm = gpu_spat_to_SHsphtor(cfg, vθ, vφ)
167+
Slm, Tlm = gpu_analysis_sphtor(cfg, vθ, vφ)
168168
```
169169

170-
#### `gpu_SHsphtor_to_spat`
170+
#### `gpu_synthesis_sphtor`
171171

172172
```julia
173-
gpu_SHsphtor_to_spat(cfg::SHTConfig, Slm, Tlm; device=get_device(), real_output=true)
173+
gpu_synthesis_sphtor(cfg::SHTConfig, Slm, Tlm; device=get_device(), real_output=true)
174174
```
175175

176176
GPU-accelerated vector field synthesis.
177177

178178
**Example:**
179179
```julia
180180
# Reconstruct vector field from coefficients
181-
vθ_out, vφ_out = gpu_SHsphtor_to_spat(cfg, Slm, Tlm)
181+
vθ_out, vφ_out = gpu_synthesis_sphtor(cfg, Slm, Tlm)
182182
```
183183

184184
### Spectral Operators

docs/src/mpi_roundtrip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ end
3838
MPI.Finalize()
3939
```
4040

41-
For vector fields, use `dist_spat_to_SHsphtor` and `dist_SHsphtor_to_spat` with the
41+
For vector fields, use `dist_analysis_sphtor` and `dist_synthesis_sphtor` with the
4242
same `prototype_θφ`. Precomputing Legendre tables via `prepare_plm_tables!(cfg)` on
4343
regular grids typically improves performance.

docs/src/performance.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ function benchmark_vector_vs_scalar(cfg)
451451
Tlm[3,2] = 0.5
452452

453453
# Vector spatial fields
454-
Vθ, Vφ = SHsphtor_to_spat(cfg, Slm, Tlm)
454+
Vθ, Vφ = synthesis_sphtor(cfg, Slm, Tlm)
455455

456456
# Scalar benchmarks
457457
scalar_synth = @elapsed begin
@@ -469,13 +469,13 @@ function benchmark_vector_vs_scalar(cfg)
469469
# Vector benchmarks
470470
vector_synth = @elapsed begin
471471
for i in 1:20
472-
SHsphtor_to_spat(cfg, Slm, Tlm)
472+
synthesis_sphtor(cfg, Slm, Tlm)
473473
end
474474
end
475475

476476
vector_analysis = @elapsed begin
477477
for i in 1:20
478-
spat_to_SHsphtor(cfg, Vθ, Vφ)
478+
analysis_sphtor(cfg, Vθ, Vφ)
479479
end
480480
end
481481

0 commit comments

Comments
 (0)