Skip to content

Commit 4658b51

Browse files
committed
remove Y_init
1 parent 2f7d5f5 commit 4658b51

File tree

9 files changed

+27
-37
lines changed

9 files changed

+27
-37
lines changed

experiments/ClimaEarth/components/atmosphere/climaatmos.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ include("climaatmos_extra_diags.jl")
1616
###
1717
### Functions required by ClimaCoupler.jl for an AtmosModelSimulation
1818
###
19-
struct ClimaAtmosSimulation{P, Y, D, I} <: Interfacer.AtmosModelSimulation
19+
struct ClimaAtmosSimulation{P, D, I} <: Interfacer.AtmosModelSimulation
2020
params::P
21-
Y_init::Y
2221
domain::D
2322
integrator::I
2423
end
@@ -69,7 +68,7 @@ function ClimaAtmosSimulation(atmos_config)
6968
@. ᶠradiation_flux = CC.Geometry.WVector(FT(0))
7069
end
7170

72-
sim = ClimaAtmosSimulation(integrator.p.params, Y, spaces, integrator)
71+
sim = ClimaAtmosSimulation(integrator.p.params, spaces, integrator)
7372

7473
# DSS state to ensure we have continuous fields
7574
dss_state!(sim)

experiments/ClimaEarth/components/land/climaland_bucket.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ using NCDatasets
1515
### Functions required by ClimaCoupler.jl for a SurfaceModelSimulation
1616
###
1717
"""
18-
BucketSimulation{M, Y, D, I}
18+
BucketSimulation{M, D, I}
1919
2020
The bucket model simulation object.
2121
"""
22-
struct BucketSimulation{M, Y, D, I, A} <: Interfacer.LandModelSimulation
22+
struct BucketSimulation{M, D, I, A} <: Interfacer.LandModelSimulation
2323
model::M
24-
Y_init::Y
2524
domain::D
2625
integrator::I
2726
area_fraction::A
@@ -222,7 +221,7 @@ function BucketSimulation(
222221
callback = SciMLBase.CallbackSet(diag_cb),
223222
)
224223

225-
sim = BucketSimulation(model, Y, (; domain = domain, soil_depth = d_soil), integrator, area_fraction)
224+
sim = BucketSimulation(model, (; domain = domain, soil_depth = d_soil), integrator, area_fraction)
226225

227226
# DSS state to ensure we have continuous fields
228227
dss_state!(sim)

experiments/ClimaEarth/components/ocean/eisenman_seaice.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ import ClimaCoupler: Checkpointer, FluxCalculator, Interfacer, Utilities
77
### Functions required by ClimaCoupler.jl for a SurfaceModelSimulation
88
###
99
"""
10-
EisenmanIceSimulation{P, Y, D, I}
10+
EisenmanIceSimulation{P, D, I}
1111
1212
Thermodynamic 0-layer, based on the Semtner 1976 model and later refined by
1313
Eisenmen 2009 and Zhang et al 2021.
1414
1515
Note that Eisenman sea ice assumes gray radiation, no snow coverage, and
1616
PartitionedStateFluxes for the surface flux calculation.
1717
"""
18-
struct EisenmanIceSimulation{P, Y, D, I} <: Interfacer.SeaIceModelSimulation
18+
struct EisenmanIceSimulation{P, D, I} <: Interfacer.SeaIceModelSimulation
1919
params_ice::P
20-
Y_init::Y
2120
domain::D
2221
integrator::I
2322
end
@@ -83,7 +82,7 @@ function EisenmanIceSimulation(
8382
problem = SciMLBase.ODEProblem(ode_function, Y, Float64.(tspan), cache)
8483
integrator = SciMLBase.init(problem, ode_algo, dt = Float64(dt), saveat = Float64.(saveat), adaptive = false)
8584

86-
sim = EisenmanIceSimulation(params, Y, space, integrator)
85+
sim = EisenmanIceSimulation(params, space, integrator)
8786
return sim
8887
end
8988

experiments/ClimaEarth/components/ocean/prescr_seaice.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ClimaCoupler: Checkpointer, FluxCalculator, Interfacer, Utilities
1111
### Functions required by ClimaCoupler.jl for a SurfaceModelSimulation
1212
###
1313
"""
14-
PrescribedIceSimulation{P, Y, D, I}
14+
PrescribedIceSimulation{P, D, I}
1515
1616
Ice concentration is prescribed, and we solve the following energy equation:
1717
@@ -27,9 +27,8 @@ Ice concentration is prescribed, and we solve the following energy equation:
2727
2828
In the current version, the sea ice has a prescribed thickness.
2929
"""
30-
struct PrescribedIceSimulation{P, Y, D, I} <: Interfacer.SeaIceModelSimulation
30+
struct PrescribedIceSimulation{P, D, I} <: Interfacer.SeaIceModelSimulation
3131
params::P
32-
Y_init::Y
3332
domain::D
3433
integrator::I
3534
end
@@ -143,7 +142,7 @@ function PrescribedIceSimulation(
143142
problem = SciMLBase.ODEProblem(ode_function, Y, Float64.(tspan), (; cache..., params = params))
144143
integrator = SciMLBase.init(problem, ode_algo, dt = Float64(dt), saveat = Float64.(saveat), adaptive = false)
145144

146-
sim = PrescribedIceSimulation(params, Y, space, integrator)
145+
sim = PrescribedIceSimulation(params, space, integrator)
147146

148147
# DSS state to ensure we have continuous fields
149148
dss_state!(sim)

experiments/ClimaEarth/components/ocean/slab_ocean.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ import ClimaCoupler: Checkpointer, FluxCalculator, Interfacer, Utilities
77
### Functions required by ClimaCoupler.jl for a SurfaceModelSimulation
88
###
99
"""
10-
SlabOceanSimulation{P, Y, D, I}
10+
SlabOceanSimulation{P, D, I}
1111
1212
Equation:
1313
1414
(h * ρ * c) dTdt = -(F_turb_energy + F_radiative)
1515
1616
"""
17-
struct SlabOceanSimulation{P, Y, D, I} <: Interfacer.OceanModelSimulation
17+
struct SlabOceanSimulation{P, D, I} <: Interfacer.OceanModelSimulation
1818
params::P
19-
Y_init::Y
2019
domain::D
2120
integrator::I
2221
end
@@ -96,7 +95,7 @@ function SlabOceanSimulation(
9695
problem = SciMLBase.ODEProblem(ode_function, Y, Float64.(tspan), cache)
9796
integrator = SciMLBase.init(problem, ode_algo, dt = Float64(dt), saveat = Float64.(saveat), adaptive = false)
9897

99-
sim = SlabOceanSimulation(params, Y, space, integrator)
98+
sim = SlabOceanSimulation(params, space, integrator)
10099

101100
# DSS state to ensure we have continuous fields
102101
dss_state!(sim)

experiments/ClimaEarth/test/component_model_tests/climaatmos_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for FT in (Float32, Float64)
1616
u = (; state_field1 = CC.Fields.ones(boundary_space), state_field2 = CC.Fields.zeros(boundary_space)),
1717
p = (; cache_field = CC.Fields.zeros(boundary_space)),
1818
)
19-
sim = ClimaAtmosSimulation(nothing, nothing, nothing, integrator)
19+
sim = ClimaAtmosSimulation(nothing, nothing, integrator)
2020

2121
# make field non-constant to check the impact of the dss step
2222
coords_lat = CC.Fields.coordinate_field(sim.integrator.u.state_field2).lat

experiments/ClimaEarth/test/component_model_tests/prescr_seaice_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ for FT in (Float32, Float64)
100100
)
101101
p = (; cache_field = CC.Fields.zeros(boundary_space), dss_buffer = CC.Spaces.create_dss_buffer(u))
102102
integrator = (; u, p)
103-
sim = PrescribedIceSimulation(nothing, nothing, nothing, integrator)
103+
sim = PrescribedIceSimulation(nothing, nothing, integrator)
104104

105105
# make field non-constant to check the impact of the dss step
106106
coords_lat = CC.Fields.coordinate_field(sim.integrator.u.state_field2).lat

experiments/ClimaEarth/test/component_model_tests/slab_ocean_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ for FT in (Float32, Float64)
2121
)
2222
p = (; cache_field = CC.Fields.zeros(boundary_space), dss_buffer = CC.Spaces.create_dss_buffer(u))
2323
integrator = (; u, p)
24-
sim = SlabOceanSimulation(nothing, nothing, nothing, integrator)
24+
sim = SlabOceanSimulation(nothing, nothing, integrator)
2525

2626
# make field non-constant to check the impact of the dss step
2727
coords_lat = CC.Fields.coordinate_field(sim.integrator.u.state_field2).lat

test/flux_calculator_tests.jl

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ function FluxCalculator.atmos_turbulent_fluxes_most!(sim::DummySimulation, csf)
2626
end
2727

2828
# atmos sim object and extensions
29-
struct TestAtmos{P, Y, D, I} <: Interfacer.AtmosModelSimulation
29+
struct TestAtmos{P, D, I} <: Interfacer.AtmosModelSimulation
3030
params::P
31-
Y_init::Y
3231
domain::D
3332
integrator::I
3433
end
@@ -66,9 +65,8 @@ end
6665

6766

6867
# ocean sim object and extensions
69-
struct TestOcean{M, Y, D, I} <: Interfacer.SurfaceModelSimulation
68+
struct TestOcean{M, D, I} <: Interfacer.SurfaceModelSimulation
7069
model::M
71-
Y_init::Y
7270
domain::D
7371
integrator::I
7472
end
@@ -98,9 +96,8 @@ function FluxCalculator.update_turbulent_fluxes!(sim::TestOcean, fields::NamedTu
9896
end
9997

10098
# simple surface sim object and extensions
101-
struct DummySurfaceSimulation3{M, Y, D, I} <: Interfacer.SurfaceModelSimulation
99+
struct DummySurfaceSimulation3{M, D, I} <: Interfacer.SurfaceModelSimulation
102100
model::M
103-
Y_init::Y
104101
domain::D
105102
integrator::I
106103
end
@@ -181,7 +178,7 @@ for FT in (Float32, Float64)
181178
Y_init =
182179
(; ρ = ones(boundary_space) .* FT(1.2), T = ones(boundary_space) .* FT(310), q = zeros(boundary_space))
183180
integrator = (; Y_init..., p = p)
184-
atmos_sim = TestAtmos(params, Y_init, nothing, integrator)
181+
atmos_sim = TestAtmos(params, nothing, integrator)
185182

186183
# ocean
187184
p = (;
@@ -197,10 +194,10 @@ for FT in (Float32, Float64)
197194
)
198195
Y_init = (; T = ones(boundary_space) .* FT(300))
199196
integrator = (; Y_init..., p = p)
200-
ocean_sim = TestOcean(nothing, Y_init, nothing, integrator)
197+
ocean_sim = TestOcean(nothing, nothing, integrator)
201198

202199
# ocean
203-
ocean_sim2 = TestOcean(nothing, Y_init, nothing, integrator)
200+
ocean_sim2 = TestOcean(nothing, nothing, integrator)
204201

205202
model_sims = (; atmos_sim, ocean_sim, ocean_sim2)
206203

@@ -270,15 +267,15 @@ for FT in (Float32, Float64)
270267
@testset "get_surface_params for FT=$FT" begin
271268
sf_params = SurfaceFluxesParameters(FT, UF.BusingerParams)
272269

273-
@test FluxCalculator.get_surface_params(TestAtmos((; FT = FT), [], [], [])) == sf_params
270+
@test FluxCalculator.get_surface_params(TestAtmos((; FT = FT), [], [])) == sf_params
274271
sim = DummySimulation([], [])
275272
@test_throws ErrorException(
276273
"get_surface_params is required to be dispatched on" * Interfacer.name(sim) * ", but no method defined",
277274
) FluxCalculator.get_surface_params(DummySimulation([], []))
278275
end
279276

280277
@testset "update_turbulent_fluxes! for FT=$FT" begin
281-
sim = DummySurfaceSimulation3([], [], [], [])
278+
sim = DummySurfaceSimulation3([], [], [])
282279
@test_throws ErrorException(
283280
"update_turbulent_fluxes! is required to be dispatched on" *
284281
Interfacer.name(sim) *
@@ -290,13 +287,11 @@ for FT in (Float32, Float64)
290287
boundary_space = TestHelper.create_space(FT)
291288
_ones = CC.Fields.ones(boundary_space)
292289
surface_sim = DummySurfaceSimulation3(
293-
[],
294290
[],
295291
[],
296292
(; T = _ones .* FT(300), ρ = _ones .* FT(1.2), p = (; q = _ones .* FT(0.01))),
297293
)
298-
atmos_sim =
299-
TestAtmos((; FT = FT), [], [], (; T = _ones .* FT(300), ρ = _ones .* FT(1.2), q = _ones .* FT(0.01)))
294+
atmos_sim = TestAtmos((; FT = FT), [], (; T = _ones .* FT(300), ρ = _ones .* FT(1.2), q = _ones .* FT(0.01)))
300295
thermo_params = get_thermo_params(atmos_sim)
301296
thermo_state_int = Interfacer.get_field(atmos_sim, Val(:thermo_state_int))
302297
@test FluxCalculator.surface_thermo_state(surface_sim, thermo_params, thermo_state_int).ρ == thermo_state_int.ρ
@@ -305,7 +300,7 @@ for FT in (Float32, Float64)
305300
@testset "water_albedo_from_atmosphere!" begin
306301
boundary_space = TestHelper.create_space(FT)
307302
ocean_sim = Interfacer.SurfaceStub((; α_direct = zeros(boundary_space), α_diffuse = zeros(boundary_space)))
308-
atmos_sim = TestAtmos(1, 2, 3, 4)
303+
atmos_sim = TestAtmos(1, 2, 3)
309304
coupler_fields = (; temp1 = ones(boundary_space), temp2 = ones(boundary_space))
310305
model_sims = (; atmos_sim, ocean_sim)
311306
cs = Interfacer.CoupledSimulation{FT}(

0 commit comments

Comments
 (0)