Skip to content

calcN! optimization #2

@navidcy

Description

@navidcy

@glwagner any ideas to better optimize calcN!?

function calcN!(N, sol, t, clock, vars, params, grid)
@. vars.uh = sol[:, 1]
@. vars.vh = sol[:, 2]
ldiv!(vars.u, grid.rfftplan, vars.uh)
ldiv!(vars.v, grid.rfftplan, vars.vh)
@. vars.vu² = vars.v * vars.u^2
mul!(vars.vu²h, grid.rfftplan, vars.vu²)
@views @. N[:, 1] = + vars.vu²h - (params.B + 1) * sol[:, 1] # + v*u² - (B+1) u
N[1, 1] += params.E * grid.nx # note that fft(constant) = constant * nx
@views @. N[:, 2] = - vars.vu²h + params.B * sol[:, 1] # - v*u² + B*u
return nothing
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions