Closed boriskaus closed 7 months ago
The current way to perform a simulation is a bit complicated, and not easily customisable.
With this PR, we simplify that. The basic idea is that we have a single 2D code, MTK_GeoParams_2D that runs the main simulation:
MTK_GeoParams_2D
Grid, Arrays, Tracers, Dikes, time_props = MTK_GeoParams_2D(MatParam::Tuple, Num::NumParam, Dike_params::DikeParam);
The input are the material parameters (from GeoParams) and two structures in which we specify the numerical parameters and the dike parameters.
GeoParams
Within MTK_GeoParams_2D we have a number of callback functions:
# Add new dike every X years ----------------- Tracers = MTK_inject_dikes(Grid, Num, Arrays, Mat_tup, Dikes, Tracers, dike, Tnew_cpu) # -------------------------------------------- # Update time-dependent properties ----------- MTK_update_TimeDepProps!(time_props, Grid, Num, Arrays, Mat_tup, Dikes) # -------------------------------------------- # Visualize results -------------------------- MTK_visualize_output(Grid, Num, Arrays, Mat_tup, Dikes) # -------------------------------------------- # Save output to disk once in a while -------- MTK_save_output(Grid, Arrays, Tracers, Dikes, time_props) # -------------------------------------------- # Optionally Update arrays (such as T) ------- MTK_update_Arrays!(Arrays, Grid, Num) # -------------------------------------------- # Display output ----------------------------- MTK_print_output(Grid, Num, Arrays, Mat_tup, Dikes) # --------------------------------------------
They are now set to default parameters (many are empty), but can be overwritten in a user-code as:
import MagmaThermoKinematics.MTK_GMG_2D.MTK_print_output function MTK_print_output(Grid::GridData, Num::NumericalParameters, Arrays::NamedTuple, Mat_tup::Tuple, Dikes::DikeParameters) println("$(Num.it), max. temperature = $(maximum(Arrays.Tnew))") return nothing end
An example of how this works is given in examples/MTK_GMG_2D_example2.jl and models a case underneath Unzen:
examples/MTK_GMG_2D_example2.jl
For the longterm support it might be good to update the deps to the newest release of Makie.jl (v.0.20.x)
deps
Makie.jl
The current way to perform a simulation is a bit complicated, and not easily customisable.
With this PR, we simplify that. The basic idea is that we have a single 2D code,
MTK_GeoParams_2D
that runs the main simulation:The input are the material parameters (from
GeoParams
) and two structures in which we specify the numerical parameters and the dike parameters.Within
MTK_GeoParams_2D
we have a number of callback functions:They are now set to default parameters (many are empty), but can be overwritten in a user-code as:
An example of how this works is given in
examples/MTK_GMG_2D_example2.jl
and models a case underneath Unzen: