Combining ODE and SDE

Hi everyone,

I’m working on a problem where I have a large set of differential equations. Noise is added to the system in two ways, by sampling the initial condition for many simulations and by explicitly adding noise in only one of the differential equations. It’s the second part that has me wondering if my implementation is correct.
The deterministic part is

param=[0.0, Jm, Uv, γv, zeros(Float64,M), dWv]
function du_det!(du,u,p,t)
        @inbounds @. du = im*D - (im*Uv*abs2(u)+γv)*u

Where Jm, γv and Uv are predefined arrays and M the size of the array u. For the stochastic part I take

function du_stoch!(du,u,p,t)

I want only the equation for u[N] to be stochastic so I usually have dWv = zeros(Float64,M); dWv[N] = 1.0. However when running this and pulling the noise

prob=SDEProblem(du_det!, du_stoch!, ψ0[1], (0.0,1.0), param)

I find that sol.W is nonzero for the other equations. Does anyone know how I can correctly implement my problem?
Thanks in advance and apologies if the answer is trivial, my experience with Julia is limited.

Just make du in the du_stoch! be zero for the equations where you don’t want the Wiener process.

This is what I already do by taking dWv = zeros(Float64,M); dWv[N]=1.0. I went to check the noise thinking I would get zero for the equations where I put du equal to zero in du_stoch, but that isn’t the case.

Am I correct to assume that sol.W just gives the Wiener process for each equation, but that it does not necessarily mean that this noise also effects the corresponding equation (depending on whether I chose du zero or not)?

The noise is du .* sol.W. The W is just a Brownian process.

Ok, that clears some things up. Thanks for your response!