Skip to content

Commit

Permalink
simplifies eta and params/vars style within Problem()
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy authored May 28, 2020
1 parent 7d6a4c8 commit 7dfb701
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/barotropicqgql.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ function Problem(dev::Device=CPU();
x, y = gridpoints(grid)

# topographic PV
if eta==nothing
eta = zeros(dev, T, (nx, ny))
end
eta === nothing && ( eta = zeros(dev, T, (nx, ny)) )

params = !(typeof(eta)<:ArrayType(dev)) ? Params(grid, β, eta, μ, ν, nν, calcF) : Params(β, eta, rfft(eta), μ, ν, nν, calcF)
params = !(typeof(eta)<:ArrayType(dev)) ?
Params(grid, β, eta, μ, ν, nν, calcF) :
Params(β, eta, rfft(eta), μ, ν, nν, calcF)

vars = calcF == nothingfunction ? Vars(dev, grid) : (stochastic ? StochasticForcedVars(dev, grid) : ForcedVars(dev, grid))
vars = calcF == nothingfunction ?
Vars(dev, grid) : stochastic ?
StochasticForcedVars(dev, grid) :
ForcedVars(dev, grid)

equation = BarotropicQGQL.Equation(params, grid)

FourierFlows.Problem(equation, stepper, dt, grid, vars, params, dev)
end

Expand Down

0 comments on commit 7dfb701

Please sign in to comment.