Skip to content

Commit

Permalink
Merge pull request #89 from jbisits/jib-tracernoisefield
Browse files Browse the repository at this point in the history
Fix `TracerNoise` setting on `GPU`
  • Loading branch information
jbisits authored Nov 26, 2024
2 parents e89bc57 + c503f35 commit 2a63042
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/set_initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,23 @@ function set_noise!(model, noise::VelocityNoise)
end
"""
function set_noise!(model, noise::TracerNoise)
Add initial noise the `tracer` fields.
Add initial noise the `tracer` fields. The tracer noise is added to the values already in
the tracer `Field`s so if nothing else is set it will just be noise.
"""
function set_noise!(model, noise::TracerNoise)

S, T = model.tracers

S_noise = noise.S_magnitude * randn(size(S))
S_noise_field = similar(S)
set!(S_noise_field, S_noise)

T_noise = noise.T_magnitude * randn(size(T))
S₀ = S + S_noise
T₀ = T + T_noise
T_noise_field = similar(T)
set!(T_noise_field, T_noise)

S₀ = S + S_noise_field
T₀ = T + T_noise_field

set!(model, S = S₀, T = T₀)

Expand Down

0 comments on commit 2a63042

Please sign in to comment.