Skip to content

Commit

Permalink
PrognosticVariables generator function
Browse files Browse the repository at this point in the history
  • Loading branch information
milankl committed Oct 4, 2023
1 parent 9789053 commit fb43f8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/dynamics/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ function initialize!(model::Barotropic)
initialize!(horizontal_diffusion,model)

# initial conditions
prognostic_variables = initial_conditions(model)
prognostic_variables = PrognosticVariables(spectral_grid,model)
initialize!(prognostic_variables,model.initial_conditions,model)

diagnostic_variables = DiagnosticVariables(spectral_grid,Barotropic)
return Simulation(prognostic_variables,diagnostic_variables,model)
end
Expand Down Expand Up @@ -128,7 +128,7 @@ function initialize!(model::ShallowWater)
initialize!(orography,planet,spectral_transform,geometry)

# initial conditions
prognostic_variables = initial_conditions(model)
prognostic_variables = PrognosticVariables(spectral_grid,model)
initialize!(prognostic_variables,model.initial_conditions,model)

diagnostic_variables = DiagnosticVariables(spectral_grid,ShallowWater)
Expand Down Expand Up @@ -200,7 +200,7 @@ function initialize!(model::PrimitiveDry)
# initialize!(model.vertical_diffusion,model)

# initial conditions
prognostic_variables = initial_conditions(model)
prognostic_variables = PrognosticVariables(spectral_grid,model)
initialize!(prognostic_variables,model.initial_conditions,model)

diagnostic_variables = DiagnosticVariables(spectral_grid,PrimitiveDry)
Expand Down Expand Up @@ -276,7 +276,7 @@ function initialize!(model::PrimitiveWet)
# initialize!(model.vertical_diffusion,model)

# initial conditions
prognostic_variables = initial_conditions(model)
prognostic_variables = PrognosticVariables(spectral_grid,model)
initialize!(prognostic_variables,model.initial_conditions,model)

diagnostic_variables = DiagnosticVariables(spectral_grid,PrimitiveWet)
Expand Down
7 changes: 2 additions & 5 deletions src/dynamics/prognostic_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,8 @@ Base.@kwdef struct PrognosticVariablesSurface{NF<:AbstractFloat} <: AbstractVari
"Spectral resolution as max degree of spherical harmonics"
trunc::Int

"log of surface pressure [log(Pa)]"
"log of surface pressure [log(Pa)] for PrimitiveEquation, interface displacement [m] for ShallowWaterModel"
pres::LTM{Complex{NF}} = zeros(LTM{Complex{NF}},trunc+2,trunc+1)

"Interface displacement in the ShallowWaterModel [m]"
eta::LTM{Complex{NF}} = zeros(LTM{Complex{NF}},trunc+2,trunc+1)
end

# generator function based on a SpectralGrid
Expand Down Expand Up @@ -183,7 +180,7 @@ struct PrognosticVariables{NF<:AbstractFloat,Grid<:AbstractGrid{NF},M<:ModelSetu
clock::Clock
end

function Base.zeros(::Type{PrognosticVariables},SG::SpectralGrid,Model::Type{<:ModelSetup})
function PrognosticVariables(SG::SpectralGrid,::Model) where Model<:ModelSetup

(;trunc,nlat_half,nlev,Grid,NF) = SG

Expand Down

0 comments on commit fb43f8f

Please sign in to comment.