You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For GPU performance, avoiding branch divergence is important. For the `ρe` formulation, use the fixed-iteration path by passing `forced_fixed_iters=true` as the last positional argument.
194
191
195
192
```julia
196
-
# GPU-optimized broadcasting
193
+
# GPU-optimized broadcasting using the convenience method
194
+
# This automatically uses the fast, branch-free fixed-iteration solver
197
195
sol = TD.saturation_adjustment.(
198
-
RS.NewtonsMethod,
199
196
Ref(params_f32),
200
197
Ref(TD.ρe()),
201
-
ρ_gpu, e_int_gpu, q_tot_gpu,
202
-
Ref(3), # maxiter (3 iterations → ~0.1 K accuracy)
203
-
Ref(1e-4), # tol (ignored when forced_fixed_iters=true)
204
-
nothing, # T_guess (ignored when forced_fixed_iters=true)
205
-
true, # forced_fixed_iters
198
+
ρ_gpu, e_int_gpu, q_tot_gpu
206
199
)
207
200
```
208
201
209
202
For CPU single calls, you can omit the last two arguments to use the standard solver:
210
203
211
204
```julia
212
-
# CPU single-call (standard solver)
205
+
# CPU single-call (uses defaults)
213
206
sol = TD.saturation_adjustment(
214
-
RS.NewtonsMethod,
215
207
params_f32,
216
208
TD.ρe(),
217
-
ρ_val, e_int_val, q_tot_val,
218
-
10, # maxiter
219
-
1e-4, # tolerance
209
+
ρ_val, e_int_val, q_tot_val
220
210
)
221
211
```
222
212
@@ -257,7 +247,7 @@ If your model handles phase changes (microphysics), you might step `q_liq` and `
257
247
ρ = 1.0
258
248
e_int = -7.0e4
259
249
q_tot = 0.01
260
-
sol = TD.saturation_adjustment(RS.NewtonsMethod, params, TD.ρe(), ρ, e_int, q_tot, 15, 1e-4)
250
+
sol = TD.saturation_adjustment(params, TD.ρe(), ρ, e_int, q_tot)
0 commit comments