boriskaus / MagmaThermoKinematics.jl

Package to simulate the thermal evolution of magmatic systems
MIT License
15 stars 3 forks source link

Internal set up of ParallelStencil #2

Closed albert-de-montserrat closed 2 years ago

albert-de-montserrat commented 2 years ago

This PR introduces environment!(:gpu, Float64, 2) to dynamically set up ParallelStencil inside the Diffusion modules and replaces @init_parallel_stencil. The first argument should be :gpu or :cpu. There is no longer the need to load GeoParams and/or ParallelStencil after loading MTK.jl. E.g. in Example2D_paper:

using MagmaThermoKinematics
environment!(:gpu, Float64, 2)   # initialize parallel stencil in 2D
using MagmaThermoKinematics.Diffusion2D # to load AFTER calling environment!()

using CairoMakie    # plotting
using Printf        # print    
using MAT, JLD2     # saves files in matlab format & JLD2 (hdf5) format
using Parameters
using Statistics
using LinearAlgebra: norm
boriskaus commented 2 years ago

thanks a lot - this is great!