Skip to content

Commit

Permalink
add jupyter notebook example; finetuning of various output writing
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus committed Jul 21, 2023
1 parent 74a7a15 commit dddb51a
Show file tree
Hide file tree
Showing 5 changed files with 6,924 additions and 4 deletions.
6,890 changes: 6,890 additions & 0 deletions notebooks/subduction_example.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/LaMEM_ModelGeneration/Grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ function Create_Grid(nmark_x, nmark_y, nmark_z, nel_x, nel_y, nel_z, coord_x, c
nump_z = nel_z_tot*nmark_z;

# Create 1D coordinate vectors (either regular or refined)

xn, x = GeophysicalModelGenerator.Create1D_grid_vector(coord_x, nel_x, nmark_x, nseg_x, bias_x)
yn, y = GeophysicalModelGenerator.Create1D_grid_vector(coord_y, nel_y, nmark_y, nseg_y, bias_y)
zn, z = GeophysicalModelGenerator.Create1D_grid_vector(coord_z, nel_z, nmark_z, nseg_z, bias_z)

# node grid
Xn,Yn,Zn = GeophysicalModelGenerator.XYZGrid(xn, yn, zn);

Expand Down
2 changes: 1 addition & 1 deletion src/LaMEM_ModelGeneration/LaMEM_Model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function write_vec(data)
if !isa(data,String)
str = ""; for d in data; str = str*" $d" end
else
str = data
str = " "*data
end

return str
Expand Down
8 changes: 7 additions & 1 deletion src/LaMEM_ModelGeneration/ModelSetup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ function Write_LaMEM_InputFile(io, d::ModelSetup)
for f in fields
if getfield(d,f) != getfield(Reference,f) ||
(f == :bg_phase) ||
(f == :msetup)
(f == :msetup) ||
(f == :rand_noise) ||
(f == :nmark_lim) ||
(f == :mark_ctrl)




if (f != :geom_primitives)
# only print if value differs from reference value
Expand Down
25 changes: 24 additions & 1 deletion src/LaMEM_ModelGeneration/Output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ Base.@kwdef mutable struct Output
"effective pressure"
out_eff_press = 0

"out_over_press"
out_over_press = 0

"lithospheric pressure"
out_litho_press = 0

"pore pressure"
out_pore_press = 0

"temperature"
Expand All @@ -69,10 +72,13 @@ Base.@kwdef mutable struct Output
"second invariant of strain rate tensor"
out_j2_strain_rate = 0

"sh max"
out_shmax = 0

"eh max"
out_ehmax = 0

"yield stress"
out_yield = 0

"relative proportion of diffusion creep strainrate"
Expand All @@ -93,20 +99,28 @@ Base.@kwdef mutable struct Output
"plastic dissipation"
out_plast_dissip = 0

"total displacement"
out_tot_displ = 0

"momentum residual"
out_moment_res = 0

"continuity residual"
out_cont_res = 0

"energy residual"
out_energ_res = 0

"Melt fraction"
out_melt_fraction = 0

"fluid density"
out_fluid_density = 0

"conductivity"
out_conductivity = 0

"velocity gradient tensor"
out_vel_gr_tensor = 0

"activate surface output"
Expand Down Expand Up @@ -200,7 +214,16 @@ function Write_LaMEM_InputFile(io, d::Output)

# Write all fields that are active
for f in fields
if getfield(d,f) == 1

# write "out_*" always
write_always = false
if length(String(f))>3
if String(f)[1:3]=="out"
write_always = true
end
end

if getfield(d,f) == 1 || write_always
# only print if value differs from reference value
name = rpad(String(f),15)
comment = get_doc(Output, f)
Expand Down

0 comments on commit dddb51a

Please sign in to comment.