Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
aelligp committed Apr 4, 2024
1 parent b784850 commit 8ac066e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 101 deletions.
6 changes: 3 additions & 3 deletions Sill_2D_OM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)


# while it < 30e3
while it < 50e3
while it < 100e3
# Update buoyancy and viscosity -
args = (; T = thermal.Tc, P = stokes.P, dt=dt, ϕ= ϕ)
@parallel (@idx ni) compute_viscosity!(
Expand Down Expand Up @@ -321,7 +321,7 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)
t += dt

# Data I/O and plotting ---------------------
if it == 1 || rem(it, 75) == 0
if it == 1 || rem(it, 100) == 0
checkpointing(figdir, stokes, thermal.T, η, t)

if do_save_vtk
Expand Down Expand Up @@ -469,7 +469,7 @@ end


# (Path)/folder where output data and figures are stored
figdir = "240322_OM_Geometry_bas1e5_rhy1e3"
figdir = "240325_OM_Geometry_bas1e5_rhy1e3"
# figdir = "test_JP"
do_save_vtk = true # set to true to generate VTK files for ParaView
ar = 2 # aspect ratio
Expand Down
34 changes: 7 additions & 27 deletions Sill_2D_OM_small_sill.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,6 @@ end
return GeoParams.compute_meltfraction_ratio(phase_ratios, rheology, args)
end


# function foo!(ϕ, phase_ratios, rheology, args)
# for i in 1:size(ϕ, 1), j in 1:size(ϕ, 2)
# args_ijk = ntuple_idx(args, i, j)
# ϕ[i, j] = compute_melt_frac(rheology, args_ijk, phase_ratios[i, j])
# end
# # args_ijk = ntuple_idx(args, I...)
# # ϕ[I...] = compute_melt_frac(rheology, args_ijk, phase_ratios[I...])
# return nothing
# end

# @code_warntype foo!(ϕ, phase_ratios.center, rheology, (T=thermal.Tc, P=stokes.P))

# @device_code_warntype interactive=true @parallel (@idx ni) compute_melt_fraction!(
# ϕ, phase_ratios.center, rheology, (T=thermal.Tc, P=stokes.P)
# )


## END OF HELPER FUNCTION ------------------------------------------------------------

## BEGIN OF MAIN SCRIPT --------------------------------------------------------------
Expand All @@ -117,9 +99,9 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)
# ----------------------------------------------------

# Physical properties using GeoParams ----------------
rheology = init_rheologies(; is_plastic = false)
rheology = init_rheologies()
κ = (4 / (compute_heatcapacity(rheology[1].HeatCapacity[1].Cp) * rheology[1].Density[1].ρ))
@show κ
# @show κ
# κ = (4 / (rheology[1].HeatCapacity[1].Cp * rheology[1].Density[1].ρ))
dt = dt_diff = 0.5 * min(di...)^2 / κ / 2.01 # diffusive CFL timestep limiter
# dt = dt_diff = 0.5 * min(di...)^2 / κ / 2.01 / 100 # diffusive CFL timestep limiter
Expand Down Expand Up @@ -158,7 +140,6 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)
thermal = ThermalArrays(ni)
thermal_bc = TemperatureBoundaryConditions(;
no_flux = (left = true, right = true, top = false, bot = false),
periodicity = (left = false, right = false, top = false, bot = false),
)
# initialize thermal profile - Half space cooling
@parallel (@idx ni .+ 1) init_T!(thermal.T, xvi[2], xvi[1])
Expand Down Expand Up @@ -189,13 +170,12 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)

# PT coefficients for thermal diffusion
pt_thermal = PTThermalCoeffs(
rheology, phase_ratios, args, dt, ni, di, li; ϵ=1e-5, CFL= 5e-2 / 2.1
rheology, phase_ratios, args, dt, ni, di, li; ϵ=1e-6, CFL= 5e-2 / 2.1
)

# Boundary conditions
flow_bcs = FlowBoundaryConditions(;
free_slip = (left = true, right=true, top=true, bot=true),
periodicity = (left = false, right = false, top = false, bot = false),
)
flow_bcs!(stokes, flow_bcs) # apply boundary conditions
update_halo!(stokes.V.Vx, stokes.V.Vy)
Expand Down Expand Up @@ -242,7 +222,7 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)
t, it = 0.0, 0


while it < 30e3
while it < 100e3
# Update buoyancy and viscosity -
args = (; T = thermal.Tc, P = stokes.P, dt=dt, ϕ= ϕ)
@parallel (@idx ni) compute_viscosity!(
Expand Down Expand Up @@ -341,7 +321,7 @@ function main2D(igg; ar=8, ny=16, nx=ny*8, figdir="figs2D", do_save_vtk =false)
t += dt

# Data I/O and plotting ---------------------
if it == 1 || rem(it, 25) == 0
if it == 1 || rem(it, 100) == 0
checkpointing(figdir, stokes, thermal.T, η, t)

if do_save_vtk
Expand Down Expand Up @@ -507,11 +487,11 @@ end


# (Path)/folder where output data and figures are stored
figdir = "240322_eta_1e5_bas_1e3_rhy"
figdir = "240404_COSTA_256ny_eta_1e5_bas_1e5_rhy"
# figdir = "test_JP"
do_save_vtk = true # set to true to generate VTK files for ParaView
ar = 1 # aspect ratio
n = 512
n = 256
nx = n * 2
ny = n
igg = if !(JustRelax.MPI.Initialized()) # initialize (or not) MPI grid
Expand Down
4 changes: 1 addition & 3 deletions Sill_rheology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ function init_phases!(phases, particles)

x = JustRelax.@cell px[ip, i, j]
depth = -(JustRelax.@cell py[ip, i, j])
if 0e0 < depth 0.250e3
@cell phases[ip, i, j] = 1.0
end
@cell phases[ip, i, j] = 1.0

if 0.1e3 < depth 0.2e3
@cell phases[ip, i, j] = 2.0
Expand Down
75 changes: 7 additions & 68 deletions Sill_rheology_small_sill.jl
Original file line number Diff line number Diff line change
@@ -1,89 +1,28 @@
# from "Fingerprinting secondary mantle plumes", Cloetingh et al. 2022

function init_rheologies(; is_plastic = true)
# Dislocation and Diffusion creep
# disl_upper_crust = DislocationCreep(A=5.07e-18, n=2.3, E=154e3, V=6e-6, r=0.0, R=8.3145)
linear_viscosity_rhy = LinearMeltViscosity(A = -8.1590, B = 2.4050e+04K, T0 = -430.9606K,η0=1e3Pa*s)
# linear_viscosity_rhy = LinearViscous(; η=1e13Pa*s)
linear_viscosity_bas = LinearMeltViscosity(A = -9.6012, B = 1.3374e+04K, T0 = 307.8043K, η0=1e5Pa*s)
# linear_viscosity_bas = LinearViscous(; η=1e9Pa*s)
el_rhy = SetConstantElasticity(; G=25e9, ν=0.5)
el_bas = SetConstantElasticity(; G=25e9, ν=0.5)
β_rhy = inv(get_Kb(el_rhy))
β_bas = inv(get_Kb(el_bas))

# Physical properties using GeoParams ----------------
η_reg = 1e2
cohesion = 3e6
friction = 30.0
pl_crust = if is_plastic
DruckerPrager_regularised(; C = cohesion, ϕ=friction, η_vp=η_reg, Ψ=0.0) # non-regularized plasticity
else
DruckerPrager_regularised(; C = Inf, ϕ=friction, η_vp=η_reg, Ψ=0.0) # non-regularized plasticity
end
friction = asind(0.3)
pl = if is_plastic
DruckerPrager_regularised(; C = cohesion, ϕ=friction, η_vp=η_reg, Ψ=0.0) # non-regularized plasticity
else
DruckerPrager_regularised(; C = Inf, ϕ=friction, η_vp=η_reg, Ψ=0.0) # non-regularized plasticity
end
pl_wz = if is_plastic
DruckerPrager_regularised(; C = 2e6, ϕ=2.0, η_vp=η_reg, Ψ=0.0) # non-regularized plasticity
else
DruckerPrager_regularised(; C = Inf, ϕ=friction, η_vp=η_reg, Ψ=0.0) # non-regularized plasticity
end

# crust
#K_crust = TP_Conductivity(;
# a = 0.64,
# b = 807e0,
# c = 0.77,
# d = 0.00004*1e-6,
#)
K_crust = ConstantConductivity()
K_mantle = ConstantConductivity()
#K_mantle = TP_Conductivity(;
# a = 0.73,
# b = 1293e0,
# c = 0.77,
# d = 0.00004*1e-6,
#)
#

function init_rheologies()
linear_viscosity_rhy = ViscosityPartialMelt_Costa_etal_2009(LinearMeltViscosity(A = -8.1590, B = 2.4050e+04K, T0 = -430.9606K,η0=1e3Pa*s))
linear_viscosity_bas = ViscosityPartialMelt_Costa_etal_2009(LinearMeltViscosity(A = -9.6012, B = 1.3374e+04K, T0 = 307.8043K, η0=1e5Pa*s))
# Define rheolgy struct
rheology = (
# Name = "Rhyolite",
SetMaterialParams(;
Phase = 1,
Density = MeltDependent_Density(ρmelt=T_Density(ρ0=2300kg / m^3),ρsolid=ConstantDensity=2700kg / m^3)),
# Density = PT_Density(; ρ0=2300, β=β_rhy, T0=273.15, α = 3.5e-5),
# HeatCapacity = ConstantHeatCapacity(Cp=1050J/kg/K),
Density = MeltDependent_Density(ρsolid=ConstantDensity=2700kg / m^3),ρmelt=T_Density(ρ0=2300kg / m^3)),
HeatCapacity = Latent_HeatCapacity(Cp=ConstantHeatCapacity(), Q_L=400e3J/kg),
Conductivity = K_crust,
#CompositeRheology = CompositeRheology((linear_viscosity_rhy, el_rhy)),
Conductivity = ConstantConductivity(),
CompositeRheology = CompositeRheology((linear_viscosity_rhy,)),

#Elasticity = el_rhy,
# Melting = MeltingParam_Caricchi(),
Melting = MeltingParam_Smooth3rdOrder(a=3043.0,b=-10552.0,c=12204.9,d=-4709.0),
Gravity = ConstantGravity(; g=9.81),
),
# Name = "Basaltic_Sill",
SetMaterialParams(;
Phase = 2,
Density = MeltDependent_Density(ρmelt=T_Density(ρ0=2800kg / m^3)),
# Density = PT_Density(; ρ0=2800, β=β_bas, T0=273.15, α = 3.5e-5),
# HeatCapacity = ConstantHeatCapacity(Cp=1050J/kg/K),
Density = MeltDependent_Density(ρsolid=ConstantDensity=2900kg/m^3),ρmelt=T_Density(ρ0=2800kg / m^3)),
HeatCapacity = Latent_HeatCapacity(Cp=ConstantHeatCapacity(), Q_L=400e3J/kg),
Conductivity = K_crust,
Conductivity = ConstantConductivity(),
CompositeRheology = CompositeRheology((linear_viscosity_bas,)),
# Melting = MeltingParam_Caricchi(),
Melting = MeltingParam_Smooth3rdOrder(),

#CompositeRheology = CompositeRheology((linear_viscosity_bas, el_bas)),
#Elasticity = el_bas,
),

)
end

Expand Down

0 comments on commit 8ac066e

Please sign in to comment.