Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor (from scratch) ClimaLandSimulations #795

Open
AlexisRenchon opened this issue Sep 25, 2024 · 1 comment
Open

Refactor (from scratch) ClimaLandSimulations #795

AlexisRenchon opened this issue Sep 25, 2024 · 1 comment

Comments

@AlexisRenchon
Copy link
Member

AlexisRenchon commented Sep 25, 2024

ClimaLandSimulations is a high level API to run ClimaLand simulations.
For example, running a a one column (fluxnet site) simulation via ClimaLandSimulations is as simple as

run_fluxnet("US-MOz")

using default for model config etc, which can be changed via option kwarg.
We expect ClimaLandSimulations to be the main package used by most users (i.e., research scientists), and also for the calibration framework.

To discuss/address

  • Too many dependencies
  • lib or ext?
  • (improve speed! 1 column is slow... implicit solver will improve it?)
  • Add PFTs params (that can be adjusted)
  • Use gap-filled data (our current met data gapfilling is bad, slow and annoying)
  • Add global run in ClimaLandSimulations
  • Use diagnostics for outputs
  • Something else to read inputs, etc.
@AlexisRenchon
Copy link
Member Author

AlexisRenchon commented Sep 26, 2024

Deps:

  • ClimaComms
  • ClimaLand
  • ClimaUtilities
  • ClimaParams
  • ClimaTimeSteppers
  • SciMLBase
  • Julia
abstract type LandSimulation end

struct SingleColumnSimulation <: LandSimulation
    floating_point_type  # Redundant
    context # Redundant
    computational_domain
    land_model
    output_dir
    params
    timestepper
    drivers
    mutable callbacks
    mutable hooks?
    mutable diagnostics
    mutable output_writers
    mutable time_info
    mutable verbose
    config_id
    job_id
    gap_fill_data
    initalized
    private _integrator
end

function FluxnetSimulation(site_id = "US-MOz";
                           time_info = (; t_init = FT(0), t_end = FT(30 * 86400), dt = FT(3600) )
                           job_id = site_id,
                           FT = Float64,
                           output_dir = OutputPathGenerator.generate_output_path(joinpath("output", job_id)),
                           context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
                           computational_domain = ClimaLand.Domain.Column(; context),
                           params = ClimaParams(),
                           timestepper = (),
                           drivers = Drivers(site_id),
                           model = ClimaLand.LandModel(....)
                           callbacks = (),
                           hooks = (),
                           output_writers = DictWriter()
                           diagnostics = ClimaLand.default_diangostics(model; dict_writer),
                           verbose = false
                           config_id = FluxnetSimulation()
                           )
    return SingleColumnSimulation
end

SingleColumnSimulation( ...., params = ClimaParams() )

struct MultiColumnSimulation <: LandSimulation end

struct RegionalSimulation <: LandSimulation end

struct GlobalSimulation <: LandSimulation
    ...
    drivers -> (AtmosDriver -> ERA5Driver(), LAI)
    ...
    params -> ClimaParams() + maps -> CLMMaps()
end

function run!(simulation::LandSimulation)
    if more_init?
        do_more_init()
        # download data
        # preprocess data
        # prepreare output dir
    end

    _integrator
    solve
end

# As extension
function plot(simulation) end

function plot(simulation.config_id, simulation.ouput_dir) end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants