From fb43f8f8cd1e53eccdd180b7077ca717dbd0f95d Mon Sep 17 00:00:00 2001 From: Milan Date: Wed, 4 Oct 2023 11:05:47 -0700 Subject: [PATCH] PrognosticVariables generator function --- src/dynamics/models.jl | 10 +++++----- src/dynamics/prognostic_variables.jl | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/dynamics/models.jl b/src/dynamics/models.jl index 656a956c7..d92f6c3c3 100644 --- a/src/dynamics/models.jl +++ b/src/dynamics/models.jl @@ -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 @@ -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) @@ -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) @@ -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) diff --git a/src/dynamics/prognostic_variables.jl b/src/dynamics/prognostic_variables.jl index f57c4f176..b8fae08bf 100644 --- a/src/dynamics/prognostic_variables.jl +++ b/src/dynamics/prognostic_variables.jl @@ -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 @@ -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