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

New API #82

Open
JordiBolibar opened this issue Nov 25, 2022 · 0 comments
Open

New API #82

JordiBolibar opened this issue Nov 25, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@JordiBolibar
Copy link
Member

JordiBolibar commented Nov 25, 2022

We should improve the interface of how we launch simulations. In order to have everything in a more tidy way. We should create data structures that gather multiple parameters driving simulations.

Here's a draft of the prototype I have in mind:

Model parameters

  • PhysicalParameters struct to hold all parameters related to model physics.

  • Hyperparameters struct holding all the hyperparameters from the neural network.

  • SolverParameters struct holding all parameters to configure the solver.

  • UDEparameters struct holding all parameters for the training of the UDE. It's a child of SolverParameters, since it also includes a solver.

  • OGGMparameters struct wrapping OGGM's parameters

  • SimulationParameters struct holding the parameters defining a simulation

  • Parameters: struct holding all the parameter types.

Models

  • Machine struct holding an ML model (e.g. a neural network) + a Hyperparameters struct. Inspired by MLJ.jl. When initialized inside a Model, it automatically fetches the Hyperparameters to generate the NN.

  • MBmodel struct defining a mass balance model. It can have children like TImodel.

  • IceflowModel struct defining an ice flow model. It can have children, like SIAmodel

  • Model struct, contains all information about the PhysicalParameters, SolverParameters, UDEparameters, OGGMparameters, Machine, MBmodel, IceflowModel

Glaciers, intial conditions and climate data

  • Climate struct containing climate data series for a Glacier.

  • Glaciers struct containing OGGM's gdirs and additional information on the Julia side, for example its Climate.

Simulations

  • Simulation (inmutable?) struct holding all the data necessary for a simulation: Model, Glaciers, its type (functional inversion, inversion or forward).

To be run such as:

# Produce everything needed for a simulation
# First we create the model parameters
parameters = Parameters(; physics = PhysicsParameters(),
                                      hyper = Hyperparameters(),
                                      solver = SolverParameters(),
                                      UDE = UDEparameters(),
                                      OGGM = OGGMparameters(workspace_path),
                                      simulation = SimulationParameters())

# Then we generate the models to be run
model = Model(IceflowModel(), MBmodel(), Machine(), params)
glaciers = Glaciers(rgi_ids)
add_climate!(Glaciers, time_period)

# We create a simulation based on everything we generated before
simulation = Simulation(model, glaciers, parameters)

# We finally run the simulation
run!(simulation)

Beyond this, we should also accommodate an API similar to OGGM's, where everything is based on entity_tasks around glacier directories. Since Julia is not OO, entity tasks would just be functions with a common interface, run on Glaciers. Something like:

entity_tasks = [ODINN.tasks.DoSomethingToGlaciers(), ODINN.tasks.DoSomethingElseToGlaciers()]
apply_entity_tasks!(glaciers, entity_tasks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant