PALEOtoolkit / PALEOboxes.jl

Model coupler for the PALEO model framework
https://PALEOtoolkit.github.io/PALEOboxes.jl
MIT License
2 stars 1 forks source link

Add a remake! function #93

Open sjdaines opened 1 year ago

sjdaines commented 1 year ago

There should be a convenience function remake! that allows parameters and variable attribute (eg initial_value) to be modified and the model/modeldata instances to be reused without needing to recreate from the .yaml file.

"""
    remake!(model, modeldata)

Reinitialize after updating Parameters or Variable attributes
""""
function remake!(model, modeldata)
    # Reinitialise Reactions and non-state Variables
    PB.dispatch_setup(model, :setup, modeldata)

    # Reinitialise constant, state variables etc     
    dispatch_setup(model, :initial_value, modeldata)

    return nothing
end