From da1b13320d8271aa5836821fd6167a5ff05e1a1a Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Thu, 14 Mar 2024 11:05:45 +0100 Subject: [PATCH 1/5] function name changes in GMG --- Project.toml | 4 +- README.md | 2 +- docs/src/juliasetup_LaPalma.md | 8 ++-- docs/src/juliasetup_TMSubduction.md | 12 ++--- docs/src/juliasetup_example_sphere.md | 2 +- docs/src/juliasetups.md | 2 +- notebooks/FallingSphere_1.jl | 2 +- notebooks/subduction_example.ipynb | 4 +- scripts/TM_Subduction_example.jl | 10 ++--- src/LaMEM.jl | 2 +- src/LaMEM_ModelGeneration/ErrorChecking.jl | 2 +- src/LaMEM_ModelGeneration/GMG_interface.jl | 44 +++++++++---------- src/LaMEM_ModelGeneration/LaMEM_Model.jl | 2 +- src/LaMEM_ModelGeneration/Utils.jl | 2 +- ...ers_Subduction_Linear_FreeSlip_parallel.jl | 4 +- test/mesh_refinement_test.jl | 2 +- test/test_compression.jl | 2 +- test/test_julia_setups.jl | 10 ++--- 18 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Project.toml b/Project.toml index fb474245..80c78921 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LaMEM" uuid = "2e889f3d-35ce-4a77-8ea2-858aecb630f7" authors = ["Boris Kaus "] -version = "0.2.13" +version = "0.2.14" [deps] DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" @@ -26,7 +26,7 @@ PlotsExt = "Plots" DelimitedFiles = "1" DocStringExtensions = "0.9" GeoParams = "0.4, 0.5" -GeophysicalModelGenerator = "0.6" +GeophysicalModelGenerator = "0.7" Glob = "1" LightXML = "0.9" MPICH_jll = "4.1 - 4.1.2" diff --git a/README.md b/README.md index 41eba094..63e48ec8 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ julia> add_phase!(model, sphere, matrix) Create an initial geometry using the [GeophysicalModelGenerator](https://github.com/JuliaGeodynamics/GeophysicalModelGenerator.jl/tree/main) interface: ```Julia -julia> addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) +julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) ``` and run the simulation with: ```julia diff --git a/docs/src/juliasetup_LaPalma.md b/docs/src/juliasetup_LaPalma.md index ab0cde93..c79f6be1 100644 --- a/docs/src/juliasetup_LaPalma.md +++ b/docs/src/juliasetup_LaPalma.md @@ -89,16 +89,16 @@ julia> model.Grid.Phases .= 2; Now set points above the topography to zero (will be air later), the ones above the topography but below zero to 'water` and below 40 km to mantle (if we had a Moho surface we could use that): ```julia - julia> aboveSurface!(model, Topo_LaMEM, phase=0, T=0) + julia> above_surface!(model, Topo_LaMEM, phase=0, T=0) julia> model.Grid.Phases[Z.<-0 .&& model.Grid.Phases .== 0] .= 1; julia> model.Grid.Phases[Z.<-40] .= 3; ``` Finally, we define some magma chambers: ```julia -julia> addSphere!(model, cen=(0,0,-35), radius=5, phase=ConstantPhase(5), T=ConstantTemp(1200)); -julia> addEllipsoid!(model, cen=(-1,0,-11), axes=(3,3,8), StrikeAngle=225, DipAngle=45, phase=ConstantPhase(5), T=ConstantTemp(1200)); -julia> addEllipsoid!(model, cen=(-0,0,-23), axes=(8,8,2), StrikeAngle=0, DipAngle=0, phase=ConstantPhase(5), T=ConstantTemp(1200)); +julia> add_sphere!(model, cen=(0,0,-35), radius=5, phase=ConstantPhase(5), T=ConstantTemp(1200)); +julia> add_ellipsoid!(model, cen=(-1,0,-11), axes=(3,3,8), StrikeAngle=225, DipAngle=45, phase=ConstantPhase(5), T=ConstantTemp(1200)); +julia> add_ellipsoid!(model, cen=(-0,0,-23), axes=(8,8,2), StrikeAngle=0, DipAngle=0, phase=ConstantPhase(5), T=ConstantTemp(1200)); ``` We can plot a cross-section through the model: diff --git a/docs/src/juliasetup_TMSubduction.md b/docs/src/juliasetup_TMSubduction.md index 6144f05c..3890f468 100644 --- a/docs/src/juliasetup_TMSubduction.md +++ b/docs/src/juliasetup_TMSubduction.md @@ -266,10 +266,10 @@ model.Grid.Phases[model.Grid.Grid.Z .> 0.0 ] .= 5; ``` ##### Add left oceanic plate -An oceanic plate can be added using the `addBox!()` function of the `GeophysicalModelGenerator` package (see `?GeophysicalModelGenerator.addBox!` for more information, or check out the online [help](https://juliageodynamics.github.io/GeophysicalModelGenerator.jl/dev/man/lamem/) of the package). The lithosphere to asthenosphere temperature is set to 1250°C. If temperature of the plate is > 1250°C then the material is turned to asthenosphere. The temperature profile of the plate is set using a half space cooling temperature and a spreading rate velocity of 0.5 cm/yr with the ridge prescribed to be at the "left" of the box. +An oceanic plate can be added using the `add_box!()` function of the `GeophysicalModelGenerator` package (see `?GeophysicalModelGenerator.add_box!` for more information, or check out the online [help](https://juliageodynamics.github.io/GeophysicalModelGenerator.jl/dev/man/lamem/) of the package). The lithosphere to asthenosphere temperature is set to 1250°C. If temperature of the plate is > 1250°C then the material is turned to asthenosphere. The temperature profile of the plate is set using a half space cooling temperature and a spreading rate velocity of 0.5 cm/yr with the ridge prescribed to be at the "left" of the box. ```julia -addBox!(model; xlim = (-2000.0, 0.0), +add_box!(model; xlim = (-2000.0, 0.0), ylim = (model.Grid.coord_y...,), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -286,7 +286,7 @@ addBox!(model; xlim = (-2000.0, 0.0), Same for the plate on the right: ```julia -addBox!(model; xlim = (1500, 2000), +add_box!(model; xlim = (1500, 2000), ylim = (model.Grid.coord_y..., ), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -303,7 +303,7 @@ addBox!(model; xlim = (1500, 2000), For the overriding plate margin the age is fixed to 90 Ma using `HalfspaceCoolingTemp()`. ```julia -addBox!(model; xlim = (0.0, 400.0), +add_box!(model; xlim = (0.0, 400.0), ylim = (model.Grid.coord_y[1], model.Grid.coord_y[2]), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -316,7 +316,7 @@ addBox!(model; xlim = (0.0, 400.0), ##### Add overriding plate craton ```julia -addBox!(model; xlim = (400.0, 1500.0), +add_box!(model; xlim = (400.0, 1500.0), ylim = (model.Grid.coord_y...,), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -330,7 +330,7 @@ addBox!(model; xlim = (400.0, 1500.0), Here we change the dip angle of the box to 30° to initiates subduction: ```julia -addBox!(model; xlim = (0.0, 300), +add_box!(model; xlim = (0.0, 300), ylim = (model.Grid.coord_y...,), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=30, diff --git a/docs/src/juliasetup_example_sphere.md b/docs/src/juliasetup_example_sphere.md index a463c8ac..af7ad2aa 100644 --- a/docs/src/juliasetup_example_sphere.md +++ b/docs/src/juliasetup_example_sphere.md @@ -69,7 +69,7 @@ julia> add_phase!(model, sphere, matrix) #### 1.3 Set initial model geometry We also need to specify an initial model geometry. The julia package `GeophysicalModelGenerator` has a number of functions for that, which can be used here. For the current setup, we just add a sphere: ```julia -julia> addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) +julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) ``` It is often useful to plot the initial model setup. You can do this with the `heatmap` function from the `Plots.jl` package, for which we provide a LaMEM plugin that allows you to specify a cross-section through a 3D LaMEM setup: diff --git a/docs/src/juliasetups.md b/docs/src/juliasetups.md index c0ca0bed..a38ea711 100644 --- a/docs/src/juliasetups.md +++ b/docs/src/juliasetups.md @@ -96,7 +96,7 @@ In order to run a simulation, we need to define at least 1 phase and heterogenei The easiest way to do that is to use routines from the `GeophyicalModelGenerator` package, for which we created simple interfaces to many of the relevant routines: ```julia julia> using GeophysicalModelGenerator -julia> addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) +julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) ``` For the sake of this example, lets add another phase: diff --git a/notebooks/FallingSphere_1.jl b/notebooks/FallingSphere_1.jl index ccb5e2e3..d006ace0 100644 --- a/notebooks/FallingSphere_1.jl +++ b/notebooks/FallingSphere_1.jl @@ -91,7 +91,7 @@ We also need to specify an initial model geometry. The julia package `Geophysica """ # ╔═╡ a3afc50b-2fcd-4067-895d-fde7fb7f8742 -addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) +add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) # ╔═╡ e0411cc1-60ae-43cf-9500-93a246e62e1b md""" diff --git a/notebooks/subduction_example.ipynb b/notebooks/subduction_example.ipynb index 77fe3d7a..3e84c68e 100644 --- a/notebooks/subduction_example.ipynb +++ b/notebooks/subduction_example.ipynb @@ -140,7 +140,7 @@ "metadata": {}, "outputs": [], "source": [ - "addBox!(model, xlim=(-700,100), zlim=(-60,0), phase=LithosphericPhases(Layers=[20 60], Phases=[1 2 0]), DipAngle=0, T=ConstantTemp(1000))" + "add_box!(model, xlim=(-700,100), zlim=(-60,0), phase=LithosphericPhases(Layers=[20 60], Phases=[1 2 0]), DipAngle=0, T=ConstantTemp(1000))" ] }, { @@ -150,7 +150,7 @@ "metadata": {}, "outputs": [], "source": [ - "addBox!(model, xlim=(100,300), zlim=(-60,0), phase=LithosphericPhases(Layers=[20 60], Phases=[1 2 0]), DipAngle=30, T=ConstantTemp(1000))" + "add_box!(model, xlim=(100,300), zlim=(-60,0), phase=LithosphericPhases(Layers=[20 60], Phases=[1 2 0]), DipAngle=30, T=ConstantTemp(1000))" ] }, { diff --git a/scripts/TM_Subduction_example.jl b/scripts/TM_Subduction_example.jl index 7592a1db..778239f9 100644 --- a/scripts/TM_Subduction_example.jl +++ b/scripts/TM_Subduction_example.jl @@ -62,7 +62,7 @@ model.Grid.Temp[model.Grid.Grid.Z .> 0] .= Tair; model.Grid.Phases[model.Grid.Grid.Z .> 0.0 ] .= 5; # Left ocanic plate: -addBox!(model; xlim = (-2000.0, 0.0), +add_box!(model; xlim = (-2000.0, 0.0), ylim = (model.Grid.coord_y...,), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -74,7 +74,7 @@ addBox!(model; xlim = (-2000.0, 0.0), AgeRidge = 0.01; maxAge = 80.0 ) ) # Add right oceanic plate: -addBox!(model; xlim = (1500, 2000), +add_box!(model; xlim = (1500, 2000), ylim = (model.Grid.coord_y..., ), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -87,7 +87,7 @@ addBox!(model; xlim = (1500, 2000), maxAge = 80.0 ) ) # Add overriding plate margin -addBox!(model; xlim = (0.0, 400.0), +add_box!(model; xlim = (0.0, 400.0), ylim = (model.Grid.coord_y[1], model.Grid.coord_y[2]), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -98,7 +98,7 @@ addBox!(model; xlim = (0.0, 400.0), # Overriding plate craton -addBox!(model; xlim = (400.0, 1500.0), +add_box!(model; xlim = (400.0, 1500.0), ylim = (model.Grid.coord_y...,), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=0, @@ -107,7 +107,7 @@ addBox!(model; xlim = (400.0, 1500.0), Tmantle = Tmantle, Age = 120 ) ) # Add pre-subducted slab -addBox!(model; xlim = (0.0, 300), +add_box!(model; xlim = (0.0, 300), ylim = (model.Grid.coord_y...,), zlim = (-660.0, 0.0), Origin = nothing, StrikeAngle=0, DipAngle=30, diff --git a/src/LaMEM.jl b/src/LaMEM.jl index 47a0ed10..3d7d51b7 100644 --- a/src/LaMEM.jl +++ b/src/LaMEM.jl @@ -35,7 +35,7 @@ export LaMEM_Model, Model, Write_LaMEM_InputFile, create_initialsetup, add_vbox!, rm_vbox!, rm_last_vbox!, add_phase!, rm_phase!, rm_last_phase!, replace_phase!, add_petsc!, add_softening!, add_phaseaggregate!, add_phasetransition!, add_dike!, add_geom!, rm_geom!, set_air, copy_phase, - add_topography!, aboveSurface!, belowSurface!, + add_topography!, above_surface!, below_surface!, prepare_lamem, isdefault, hasplasticity, add_geoparams_rheologies, stress_strainrate_0D diff --git a/src/LaMEM_ModelGeneration/ErrorChecking.jl b/src/LaMEM_ModelGeneration/ErrorChecking.jl index b95b0006..dacb4616 100644 --- a/src/LaMEM_ModelGeneration/ErrorChecking.jl +++ b/src/LaMEM_ModelGeneration/ErrorChecking.jl @@ -19,7 +19,7 @@ function Check_LaMEM_Model(m::Model) end if (m.ModelSetup.msetup=="files") && diff([extrema(m.Grid.Phases)...])[1]==0 && diff([extrema(m.Grid.Temp)...])[1]==0 - @warn "Your initial `Temp` grid is constant, as is your initial `Phases` grid. \n Is that intended? \n In most cases, you would want to set some variability in the initial conditions, \n for example with the `GeophysicalModelGenerator` function `addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.15, ))` " + @warn "Your initial `Temp` grid is constant, as is your initial `Phases` grid. \n Is that intended? \n In most cases, you would want to set some variability in the initial conditions, \n for example with the `GeophysicalModelGenerator` function `add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.15, ))` " end if (m.Solver.SolverType!="direct") && (m.Solver.SolverType!="multigrid") diff --git a/src/LaMEM_ModelGeneration/GMG_interface.jl b/src/LaMEM_ModelGeneration/GMG_interface.jl index d8ee1144..b9a57886 100644 --- a/src/LaMEM_ModelGeneration/GMG_interface.jl +++ b/src/LaMEM_ModelGeneration/GMG_interface.jl @@ -2,12 +2,12 @@ # # Some wrappers around GMG routines -import GeophysicalModelGenerator: addBox!, addLayer!, addSphere!, addEllipsoid!, addCylinder!, aboveSurface, belowSurface +import GeophysicalModelGenerator: add_box!, add_layer!, add_sphere!, add_ellipsoid!, add_cylinder!, above_surface, below_surface import GeophysicalModelGenerator: addPolygon!, addSlab!, addStripes! -export aboveSurface!, belowSurface! +export above_surface!, below_surface! """ - addBox!(model::Model; xlim=Tuple{2}, [ylim=Tuple{2}], zlim=Tuple{2}, + add_box!(model::Model; xlim=Tuple{2}, [ylim=Tuple{2}], zlim=Tuple{2}, Origin=nothing, StrikeAngle=0, DipAngle=0, phase = ConstantPhase(1), T=nothing ) @@ -16,10 +16,10 @@ Adds a box with phase & temperature structure to a 3D model setup. This simplifi See the documentation of the GMG routine for the full options. """ -addBox!(model::Model; kwargs...) = addBox!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_box!(model::Model; kwargs...) = add_box!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ - addLayer!(model::Model; xlim, ylim, zlim=Tuple{2}, + add_layer!(model::Model; xlim, ylim, zlim=Tuple{2}, phase = ConstantPhase(1), T=nothing ) @@ -27,19 +27,19 @@ Adds a layer with phase & temperature structure to a 3D model setup. This simpli See the documentation of the GMG routine for the full options. """ -addLayer!(model::Model; kwargs...) = addLayer!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_layer!(model::Model; kwargs...) = add_layer!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ - addSphere!(model::Model; cen=Tuple{3}, radius=Tuple{1}, phase = ConstantPhase(1), T=nothing) + add_sphere!(model::Model; cen=Tuple{3}, radius=Tuple{1}, phase = ConstantPhase(1), T=nothing) See the documentation of the GMG routine """ -addSphere!(model::Model; kwargs...) = addSphere!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_sphere!(model::Model; kwargs...) = add_sphere!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ - addCylinder!(model::Model; # required input + add_cylinder!(model::Model; # required input base=Tuple{3}, cap=Tuple{3}, radius=Tuple{1}, # center and radius of the sphere phase = ConstantPhase(1), # Sets the phase number(s) in the sphere T=nothing ) # Sets the thermal structure (various fucntions are available) @@ -48,11 +48,11 @@ addSphere!(model::Model; kwargs...) = addSphere!(model.Grid.Phases, model.Grid.T See the documentation of the GMG routine """ -addCylinder!(model::Model; kwargs...) = addCylinder!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_cylinder!(model::Model; kwargs...) = add_cylinder!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ - addEllipsoid!(model::Model; # required input + add_ellipsoid!(model::Model; # required input cen=Tuple{3}, axes=Tuple{3}, # center and semi-axes of the ellpsoid Origin=nothing, StrikeAngle=0, DipAngle=0, # origin & dip/strike phase = ConstantPhase(1), # Sets the phase number(s) in the box @@ -61,7 +61,7 @@ addCylinder!(model::Model; kwargs...) = addCylinder!(model.Grid.Phases, model.Gr See the documentation of the GMG routine """ -addEllipsoid!(model::Model; kwargs...) = addEllipsoid!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_ellipsoid!(model::Model; kwargs...) = add_ellipsoid!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ @@ -108,21 +108,21 @@ addStripes!(model::Model; kwargs...) = addStripes!(model.Grid.Phases, model.Grid """ - aboveSurface(model::Model, DataSurface_Cart::CartData) + above_surface(model::Model, DataSurface_Cart::CartData) Returns a boolean grid that is `true` if the `Phases/Temp` grid are above the surface """ -aboveSurface(model::Model, DataSurface_Cart::CartData) = aboveSurface(model.Grid.Grid, DataSurface_Cart) +above_surface(model::Model, DataSurface_Cart::CartData) = above_surface(model.Grid.Grid, DataSurface_Cart) """ - aboveSurface!(model::Model, DataSurface_Cart::CartData; phase::Int64=nothing, T::Number=nothing) + above_surface!(model::Model, DataSurface_Cart::CartData; phase::Int64=nothing, T::Number=nothing) Sets the `Temp` or `Phases` above the surface `DataSurface_Cart` to a constant value. """ -function aboveSurface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing) +function above_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing) - id = aboveSurface(model, DataSurface_Cart) + id = above_surface(model, DataSurface_Cart) if !isnothing(phase) model.Grid.Phases[id] .= phase end @@ -137,21 +137,21 @@ end """ - belowSurface(model::Model, DataSurface_Cart::CartData) + below_surface(model::Model, DataSurface_Cart::CartData) Returns a boolean grid that is `true` if the `Phases/Temp` grid are below the surface """ -belowSurface(model::Model, DataSurface_Cart::CartData) = belowSurface(model.Grid.Grid, DataSurface_Cart) +below_surface(model::Model, DataSurface_Cart::CartData) = below_surface(model.Grid.Grid, DataSurface_Cart) """ - belowSurface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing) + below_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing) Sets the `Temp` or `Phases` below the surface `DataSurface_Cart` to a constant value. """ -function belowSurface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing) +function below_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing) - id = belowSurface(model, DataSurface_Cart) + id = below_surface(model, DataSurface_Cart) if !isnothing(phase) model.Grid.Phases[id] .= phase end diff --git a/src/LaMEM_ModelGeneration/LaMEM_Model.jl b/src/LaMEM_ModelGeneration/LaMEM_Model.jl index a7f8ff92..77adba84 100644 --- a/src/LaMEM_ModelGeneration/LaMEM_Model.jl +++ b/src/LaMEM_ModelGeneration/LaMEM_Model.jl @@ -64,7 +64,7 @@ include("Model.jl") # main LaMEM_Model export Model include("GMG_interface.jl") -export aboveSurface!, belowSurface! +export above_surface!, below_surface! include("Utils.jl") export add_phase!, rm_phase!, rm_last_phase!, add_petsc!, add_softening!, add_phaseaggregate!, diff --git a/src/LaMEM_ModelGeneration/Utils.jl b/src/LaMEM_ModelGeneration/Utils.jl index ba1484f3..24d08f6a 100644 --- a/src/LaMEM_ModelGeneration/Utils.jl +++ b/src/LaMEM_ModelGeneration/Utils.jl @@ -247,7 +247,7 @@ function set_geom!(model::Model, d::geom_Sphere) end # call a GMG routine - addSphere!(model.Grid.Phases,model.Grid.Temp,model.Grid.Grid, cen=cen, radius=radius, phase=phase, T=T) + add_sphere!(model.Grid.Phases,model.Grid.Temp,model.Grid.Grid, cen=cen, radius=radius, phase=phase, T=T) return nothing end diff --git a/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl b/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl index bcb3cb84..81bcf090 100644 --- a/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl +++ b/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl @@ -28,13 +28,13 @@ Phases = zeros(Int64, size(Grid_LaMEM.X)); # Rock numbers Temp = ones(Float64,size(Grid_LaMEM.X))*T_mantle; # Temperature in C # Create horizontal part of slab with crust & mantle lithosphere -addBox!(Phases,Temp,Grid_LaMEM, +add_box!(Phases,Temp,Grid_LaMEM, xlim=(Trench_x_location, Trench_x_location+Length_Horiz_Slab), zlim=(-ThicknessSlab , 0.0), phase=LithosphericPhases(Layers=[ThicknessCrust ThicknessML], Phases=[1 2 0]) ); # Add inclined part of slab -addBox!(Phases,Temp,Grid_LaMEM, +add_box!(Phases,Temp,Grid_LaMEM, xlim=(Trench_x_location-Length_Subduct_Slab, Trench_x_location), zlim=(-ThicknessSlab , 0.0), DipAngle=-SubductionAngle, diff --git a/test/mesh_refinement_test.jl b/test/mesh_refinement_test.jl index 40780656..8358bb20 100644 --- a/test/mesh_refinement_test.jl +++ b/test/mesh_refinement_test.jl @@ -23,7 +23,7 @@ using GeophysicalModelGenerator add_phase!(model, sphere, matrix) # Add an initial geometry (using GeophysicalModelGenerator routines) - addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) + add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) # run the simulation on 1 core run_lamem(model, 1); diff --git a/test/test_compression.jl b/test/test_compression.jl index e8faf1d3..b81908bf 100644 --- a/test/test_compression.jl +++ b/test/test_compression.jl @@ -17,7 +17,7 @@ using GeophysicalModelGenerator add_phase!(model, sphere, matrix) # Add an initial geometry (using GeophysicalModelGenerator routines) - addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) + add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) # run the simulation on 4 core run_lamem(model, 4); diff --git a/test/test_julia_setups.jl b/test/test_julia_setups.jl index 5511d159..2a3b1afd 100644 --- a/test/test_julia_setups.jl +++ b/test/test_julia_setups.jl @@ -20,7 +20,7 @@ using GeophysicalModelGenerator add_phase!(model, sphere, matrix) # Add an initial geometry (using GeophysicalModelGenerator routines) - addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) + add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) # run the simulation on 1 core run_lamem(model, 1); @@ -63,7 +63,7 @@ using GeophysicalModelGenerator add_phase!(model, sphere, matrix) # Add an initial geometry (using GeophysicalModelGenerator routines) - addSphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) + add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, )) # Add a velocity box: vbox = VelocityBox(cenX=0, cenY=0, cenZ=0, @@ -137,12 +137,12 @@ using GeophysicalModelGenerator Z=model.Grid.Grid.Z; # Define mantle and lithosphere - addBox!(model, zlim=(-1000.0, 0.0), xlim=(model.Grid.coord_x...,), phase=ConstantPhase(3), T=HalfspaceCoolingTemp(Age=100)) + add_box!(model, zlim=(-1000.0, 0.0), xlim=(model.Grid.coord_x...,), phase=ConstantPhase(3), T=HalfspaceCoolingTemp(Age=100)) # Define oceanic crust (for Phase) - addBox!(model, zlim=(-10.0, 0.0), xlim=(model.Grid.coord_x...,), phase=ConstantPhase(1)) + add_box!(model, zlim=(-10.0, 0.0), xlim=(model.Grid.coord_x...,), phase=ConstantPhase(1)) - addSphere!(model, cen=(0.0,0.0,-550.0), radius=100.0, phase=ConstantPhase(4), T=ConstantTemp(1400)) + add_sphere!(model, cen=(0.0,0.0,-550.0), radius=100.0, phase=ConstantPhase(4), T=ConstantTemp(1400)) # ------------------------- # run the simulation on 1 core From ca99a8eba536e24bb0a1d5720d029a4e6d39393d Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Thu, 14 Mar 2024 11:15:46 +0100 Subject: [PATCH 2/5] more fixes --- docs/src/juliasetup_LaPalma.md | 2 +- scripts/Subduction3D.jl | 4 ++-- src/LaMEM_ModelGeneration/GMG_interface.jl | 14 +++++++------- src/LaMEM_ModelGeneration/Grid.jl | 4 ++-- src/LaMEM_ModelGeneration/Model.jl | 6 +++--- src/read_timestep.jl | 4 ++-- ...eMarkers_Subduction_Linear_FreeSlip_parallel.jl | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/src/juliasetup_LaPalma.md b/docs/src/juliasetup_LaPalma.md index c79f6be1..60e1fbe1 100644 --- a/docs/src/juliasetup_LaPalma.md +++ b/docs/src/juliasetup_LaPalma.md @@ -27,7 +27,7 @@ CartData This shows the dimensions of our domain in kilometers. The issue is that this projected topography is not an orthogonal grid, but (slightly) distorted. In any case, we see the approximate dimensions of the grid (in horizontal directions), so we can create an orthogonal grid on which to project this: ```julia -julia> Topo_LaMEM = CartData(xyzGrid(-70:.2:70,-60:.2:70,0)); +julia> Topo_LaMEM = CartData(xyz_grid(-70:.2:70,-60:.2:70,0)); julia> Topo_LaMEM = ProjectCartData(Topo_LaMEM, Topo, proj) ``` diff --git a/scripts/Subduction3D.jl b/scripts/Subduction3D.jl index 68a470e7..183fe4c8 100644 --- a/scripts/Subduction3D.jl +++ b/scripts/Subduction3D.jl @@ -40,10 +40,10 @@ model = Model( # Next, we specify the geometry of the model, using the `AddBox!` function from `GeophysicalModelGenerator`. # We start with the horizontal part of the slab. The function `AddBox!` allows you to specify a layered lithosphere; here we have a crust and mantle. It also allows specifying a thermal structure. # Since the current setup is only mechanical, we don't specify that here. -AddBox!(model, xlim=(-3000,-1000), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2])) +add_box!(model, xlim=(-3000,-1000), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2])) # The inclined part of the slab is generate by giving it a dip: -AddBox!(model, xlim=(-1000,-810), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2]), DipAngle=16) +add_box!(model, xlim=(-1000,-810), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2]), DipAngle=16) # There is a simple way to have a quick look at this setup by using the `Plots.jl` package: using Plots diff --git a/src/LaMEM_ModelGeneration/GMG_interface.jl b/src/LaMEM_ModelGeneration/GMG_interface.jl index b9a57886..11039718 100644 --- a/src/LaMEM_ModelGeneration/GMG_interface.jl +++ b/src/LaMEM_ModelGeneration/GMG_interface.jl @@ -3,7 +3,7 @@ # Some wrappers around GMG routines import GeophysicalModelGenerator: add_box!, add_layer!, add_sphere!, add_ellipsoid!, add_cylinder!, above_surface, below_surface -import GeophysicalModelGenerator: addPolygon!, addSlab!, addStripes! +import GeophysicalModelGenerator: add_polygon!, add_slab!, add_stripes! export above_surface!, below_surface! """ @@ -65,7 +65,7 @@ add_ellipsoid!(model::Model; kwargs...) = add_ellipsoid!(model.Grid.Phases, mode """ - addPolygon!(model::Model; # required input + add_polygon!(model::Model; # required input xlim::Vector, ylim=Vector, zlim=Vector(), @@ -75,11 +75,11 @@ add_ellipsoid!(model::Model; kwargs...) = add_ellipsoid!(model.Grid.Phases, mode See the documentation of the GMG routine """ -addPolygon!(model::Model; kwargs...) = addPolygon!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_polygon!(model::Model; kwargs...) = add_polygon!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ - addSlab!(model::Model; # required input + add_slab!(model::Model; # required input trench::Trench, phase = ConstantPhase(1), # Sets the phase number(s) in the box T=nothing) @@ -87,10 +87,10 @@ addPolygon!(model::Model; kwargs...) = addPolygon!(model.Grid.Phases, model.Grid See the documentation of the GMG routine """ -addSlab!(model::Model; kwargs...) = addSlab!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) +add_slab!(model::Model; kwargs...) = add_slab!(model.Grid.Phases, model.Grid.Temp, model.Grid.Grid; kwargs...) """ - addStripes!(Phase, Grid::AbstractGeneralGrid; + add_stripes!(Phase, Grid::AbstractGeneralGrid; stripAxes = (1,1,0), stripeWidth = 0.2, stripeSpacing = 1, @@ -103,7 +103,7 @@ addSlab!(model::Model; kwargs...) = addSlab!(model.Grid.Phases, model.Grid.Temp, See the documentation of the GMG routine """ -addStripes!(model::Model; kwargs...) = addStripes!(model.Grid.Phases, model.Grid.Grid; kwargs...) +add_stripes!(model::Model; kwargs...) = add_stripes!(model.Grid.Phases, model.Grid.Grid; kwargs...) diff --git a/src/LaMEM_ModelGeneration/Grid.jl b/src/LaMEM_ModelGeneration/Grid.jl index 5a67d22f..cc688323 100644 --- a/src/LaMEM_ModelGeneration/Grid.jl +++ b/src/LaMEM_ModelGeneration/Grid.jl @@ -174,10 +174,10 @@ function Create_Grid(nmark_x, nmark_y, nmark_z, nel_x, nel_y, nel_z, coord_x, c 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); + Xn,Yn,Zn = GeophysicalModelGenerator.xyz_grid(xn, yn, zn); # marker grid - X,Y,Z = GeophysicalModelGenerator.xyzGrid(x, y, z); + X,Y,Z = GeophysicalModelGenerator.xyz_grid(x, y, z); # finish Grid (using a routine of GeophysicalModelGenerator) Grid_LaMEM = LaMEM_grid( nmark_x, nmark_y, nmark_z, diff --git a/src/LaMEM_ModelGeneration/Model.jl b/src/LaMEM_ModelGeneration/Model.jl index 6ac9da39..d4f81064 100644 --- a/src/LaMEM_ModelGeneration/Model.jl +++ b/src/LaMEM_ModelGeneration/Model.jl @@ -158,7 +158,7 @@ function Write_LaMEM_InputFile(d::Model, fname::String="input.dat"; dir=pwd()) if d.Output.write_VTK_setup # If we want to write an input file - write_Paraview(CartData(d.Grid.Grid, (Phases=d.Grid.Phases,Temp=d.Grid.Temp)),"Model3D") + write_paraview(CartData(d.Grid.Grid, (Phases=d.Grid.Phases,Temp=d.Grid.Temp)),"Model3D") end if any(hasplasticity.(d.Materials.Phases)) @@ -293,9 +293,9 @@ function create_initialsetup(model::Model, cores::Int64=1, args::String=""; verb if cores>1 PartFile = run_lamem_save_grid(model.Output.param_file_name, cores) - save_LaMEMMarkersParallel(Model3D, PartitioningFile=PartFile, verbose=verbose) + save_LaMEM_markers_parallel(Model3D, PartitioningFile=PartFile, verbose=verbose) else - save_LaMEMMarkersParallel(Model3D, verbose=verbose) + save_LaMEM_markers_parallel(Model3D, verbose=verbose) end end diff --git a/src/read_timestep.jl b/src/read_timestep.jl index 51556f0c..8e52e1ed 100644 --- a/src/read_timestep.jl +++ b/src/read_timestep.jl @@ -3,7 +3,7 @@ # # Make these routines easily available outside the module: -using GeophysicalModelGenerator: CartData, xyzGrid +using GeophysicalModelGenerator: CartData, xyz_grid using Glob, ReadVTK, WriteVTK, LightXML export Read_LaMEM_PVTR_File, Read_LaMEM_PVTS_File, Read_LaMEM_PVTU_File @@ -240,7 +240,7 @@ function Read_LaMEM_PVTR_File(DirName_base::String, FileName::String; fields=not z = (z[1:end-1] + z[2:end])/2 end - X,Y,Z = xyzGrid(x,y,z) + X,Y,Z = xyz_grid(x,y,z) data_output = CartData(X,Y,Z, data_fields) return data_output end diff --git a/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl b/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl index 81bcf090..67ccc422 100644 --- a/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl +++ b/test/CreateMarkers_Subduction_Linear_FreeSlip_parallel.jl @@ -8,7 +8,7 @@ pkg_dir = pkgdir(LaMEM) # Load LaMEM particles grid ParamFile_2 = "input_files/Subduction2D_FreeSlip_Particles_Linear_DirectSolver.dat" ParamFile_2 = joinpath(pkg_dir,"test", ParamFile_2); -Grid_LaMEM = readLaMEM_InputFile(ParamFile_2) +Grid_LaMEM = read_LaMEM_inputfile(ParamFile_2) # Specify slab parameters Trench_x_location = -500; # trench location @@ -43,7 +43,7 @@ add_box!(Phases,Temp,Grid_LaMEM, # Save julia setup Model3D = CartData(Grid_LaMEM, (Phases=Phases,Temp=Temp)) # Create LaMEM model: -write_Paraview(Model3D,"LaMEM_ModelSetup") # Save model to paraview (load with opening LaMEM_ModelSetup.vts in paraview) +write_paraview(Model3D,"LaMEM_ModelSetup") # Save model to paraview (load with opening LaMEM_ModelSetup.vts in paraview) # Save LaMEM markers dir = joinpath(pkg_dir,"test","input_files"); @@ -56,5 +56,5 @@ cd(dir) @show pwd(), dir -save_LaMEMMarkersParallel(Model3D) # Create LaMEM marker input on 1 core +save_LaMEM_markers_parallel(Model3D) # Create LaMEM marker input on 1 core cd(cur_dir) \ No newline at end of file From b3c5f6bd035de0338a794dc65f85c56a7310cbfc Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Thu, 14 Mar 2024 11:23:02 +0100 Subject: [PATCH 3/5] change naming to by julia consistent --- README.md | 6 +- docs/src/juliasetup_TMSubduction.md | 2 +- docs/src/readtimesteps.md | 10 +-- ext/PlotsExt.jl | 6 +- notebooks/FallingSphere_1.jl | 4 +- notebooks/subduction_example.ipynb | 2 +- src/IO_functions.jl | 2 +- src/LaMEM.jl | 10 +-- .../BoundaryConditions.jl | 26 +++--- src/LaMEM_ModelGeneration/ErrorChecking.jl | 2 +- src/LaMEM_ModelGeneration/FreeSurface.jl | 6 +- src/LaMEM_ModelGeneration/Grid.jl | 8 +- src/LaMEM_ModelGeneration/LaMEM_Model.jl | 2 +- src/LaMEM_ModelGeneration/Materials.jl | 6 +- src/LaMEM_ModelGeneration/Model.jl | 42 +++++----- src/LaMEM_ModelGeneration/ModelSetup.jl | 82 +++++++++---------- src/LaMEM_ModelGeneration/Output.jl | 6 +- src/LaMEM_ModelGeneration/PassiveTracers.jl | 6 +- src/LaMEM_ModelGeneration/Scaling.jl | 4 +- src/LaMEM_ModelGeneration/SolutionParams.jl | 6 +- src/LaMEM_ModelGeneration/Solver.jl | 10 +-- src/LaMEM_ModelGeneration/Time.jl | 4 +- src/LaMEM_ModelGeneration/Utils.jl | 30 +++---- src/read_timestep.jl | 50 +++++------ test/mesh_refinement_test.jl | 2 +- test/read_timestep.jl | 16 ++-- test/test_julia_setup_phase_diagrams.jl | 2 +- test/test_julia_setups.jl | 20 ++--- 28 files changed, 186 insertions(+), 186 deletions(-) diff --git a/README.md b/README.md index 63e48ec8..8749cfbd 100644 --- a/README.md +++ b/README.md @@ -127,19 +127,19 @@ julia> using LaMEM ``` You can first read the `*.pvd` file in the directory to see which timesteps are available. If you used julia to run the simulation (as under 2 above ), this is done with: ```julia -julia> julia> Timestep, Filenames, t = Read_LaMEM_simulation(model) +julia> julia> Timestep, Filenames, t = read_LaMEM_simulation(model) ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], ["Timestep_00000000_0.00000000e+00/output.pvtr", "Timestep_00000001_4.40000000e-02/output.pvtr", "Timestep_00000002_9.24000000e-02/output.pvtr", "Timestep_00000003_1.45640000e-01/output.pvtr", "Timestep_00000004_2.04204000e-01/output.pvtr", "Timestep_00000005_2.68624400e-01/output.pvtr", "Timestep_00000006_3.39486840e-01/output.pvtr", "Timestep_00000007_4.17435524e-01/output.pvtr", "Timestep_00000008_5.03179076e-01/output.pvtr", "Timestep_00000009_5.97496984e-01/output.pvtr", "Timestep_00000010_7.01246682e-01/output.pvtr", "Timestep_00000011_8.15371351e-01/output.pvtr", "Timestep_00000012_9.40908486e-01/output.pvtr", "Timestep_00000013_1.07899933e+00/output.pvtr"], [0.0, 0.044, 0.0924, 0.14564, 0.204204, 0.2686244, 0.3394868, 0.4174355, 0.5031791, 0.597497, 0.7012467, 0.8153714, 0.9409085, 1.078999]) ``` If you instead have an existing LaMEM simulation, you can specify the `*.pvd` file: ```julia julia> pvdname="output.pvd" -julia> Timestep, Filenames, t = Read_LaMEM_simulation(pvdname) +julia> Timestep, Filenames, t = read_LaMEM_simulation(pvdname) ``` We can read a particular timestep (say 1) with: ```julia -julia> data, time = Read_LaMEM_timestep(model, 1) +julia> data, time = read_LaMEM_timestep(model, 1) (CartData size : (17, 17, 17) x ϵ [ -1.0 : 1.0] diff --git a/docs/src/juliasetup_TMSubduction.md b/docs/src/juliasetup_TMSubduction.md index 3890f468..dbabc23d 100644 --- a/docs/src/juliasetup_TMSubduction.md +++ b/docs/src/juliasetup_TMSubduction.md @@ -106,7 +106,7 @@ If you want to see what each of these parameters mean, you can get some basic he ```julia help?> Time -search: Time time Timer time_ns timedwait mtime ctime @time @timev @timed @time_imports @showtime optimize_ticks optimize_datetime_ticks Read_LaMEM_timestep +search: Time time Timer time_ns timedwait mtime ctime @time @timev @timed @time_imports @showtime optimize_ticks optimize_datetime_ticks read_LaMEM_timestep Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info` • time_end::Float64: simulation end time diff --git a/docs/src/readtimesteps.md b/docs/src/readtimesteps.md index e21e5332..e3d97916 100644 --- a/docs/src/readtimesteps.md +++ b/docs/src/readtimesteps.md @@ -8,12 +8,12 @@ You can first read the `*.pvd` file in the directory to see which timesteps are ```julia julia> FileName="FB_multigrid" julia> DirName ="test" -julia> Timestep, Filenames, Time = Read_LaMEM_simulation(FileName, DirName) +julia> Timestep, Filenames, Time = read_LaMEM_simulation(FileName, DirName) ([0, 1], ["Timestep_00000000_0.00000000e+00/FB_multigrid.pvtr", "Timestep_00000001_6.72970343e+00/FB_multigrid.pvtr"], [0.0, 6.729703]) ``` We can read a particular timestep (say 1) with: ```julia -julia> data, time = Read_LaMEM_timestep(FileName, 1, DirName) +julia> data, time = read_LaMEM_timestep(FileName, 1, DirName) (CartData size : (33, 33, 33) x ϵ [ 0.0 : 1.0] @@ -27,7 +27,7 @@ The output is in a `CartData` structure (as defined in GeophysicalModelGenerator If you do not indicate a directory name (`DirName`) it'll look in your current directory. The default above will load the main LaMEM simulation output. Alternatively, you can also load the `phase` information by specify the optional keyword `phase=true`: ```julia -julia> data, time = Read_LaMEM_timestep(FileName, 1, DirName, phase=true) +julia> data, time = read_LaMEM_timestep(FileName, 1, DirName, phase=true) (CartData size : (96, 96, 96) x ϵ [ 0.0052083334885537624 : 0.9947916269302368] @@ -41,12 +41,12 @@ In the same way, you can load the internal free surface with `surf=true` (if tha If you don't want to load all the fields in the file back to julia, you can check which fields are available: ```julia -julia> Read_LaMEM_fieldnames(FileName, DirName) +julia> read_LaMEM_fieldnames(FileName, DirName) ("phase [ ]", "visc_total [ ]", "visc_creep [ ]", "velocity [ ]", "pressure [ ]", "strain_rate [ ]", "j2_dev_stress [ ]", "j2_strain_rate [ ]") ``` and load only part of those: ```julia -julia> data, time = Read_LaMEM_timestep(FileName, 1, DirName, fields=("phase [ ]", "visc_total [ ]","velocity [ ]")) +julia> data, time = read_LaMEM_timestep(FileName, 1, DirName, fields=("phase [ ]", "visc_total [ ]","velocity [ ]")) (CartData size : (33, 33, 33) x ϵ [ 0.0 : 1.0] diff --git a/ext/PlotsExt.jl b/ext/PlotsExt.jl index 3ea3b393..d6008275 100644 --- a/ext/PlotsExt.jl +++ b/ext/PlotsExt.jl @@ -2,7 +2,7 @@ module PlotsExt using Plots using GeophysicalModelGenerator, Statistics, DelimitedFiles -import LaMEM: cross_section, Model, Read_LaMEM_timestep, Read_LaMEM_simulation, read_phase_diagram +import LaMEM: cross_section, Model, read_LaMEM_timestep, read_LaMEM_simulation, read_phase_diagram import LaMEM: plot_topo, plot_cross_section, plot_phasediagram, plot_cross_section_simulation export plot_topo, plot_cross_section, plot_phasediagram, plot_cross_section_simulation @@ -24,7 +24,7 @@ function plot_cross_section(model::Union{Model,CartData}, args...; field::Symbol if !isnothing(timestep) # load a particular timestep - data_cart, time = Read_LaMEM_timestep(model,timestep) + data_cart, time = read_LaMEM_timestep(model,timestep) model = data_cart end @@ -68,7 +68,7 @@ As `plot_cross_section`, but for the entire simulation instead of a single times function plot_cross_section_simulation(model::Union{Model,CartData}, args...; field::Symbol=:phase, dim=1, x=nothing, y=nothing, z=nothing, aspect_ratio::Union{Real, Symbol}=:equal) - Timesteps,_,_ = Read_LaMEM_simulation(model); + Timesteps,_,_ = read_LaMEM_simulation(model); for timestep_val in Timesteps plot_cross_section(model, args, field=field, timestep=timestep_val, dim=dim, x=x, y=y, z=z, aspect_ratio=aspect_ratio) end diff --git a/notebooks/FallingSphere_1.jl b/notebooks/FallingSphere_1.jl index d006ace0..40593581 100644 --- a/notebooks/FallingSphere_1.jl +++ b/notebooks/FallingSphere_1.jl @@ -129,7 +129,7 @@ We can read all timesteps of the simulation with: """ # ╔═╡ 3040c159-7281-4971-80ad-8104abb3a6d9 -timesteps,_,_ = Read_LaMEM_simulation(model) +timesteps,_,_ = read_LaMEM_simulation(model) # ╔═╡ b7ca7625-4910-4faf-919c-4b785438c574 md""" @@ -153,7 +153,7 @@ If you want to know which fields have been saved, you can read a timestep back i """ # ╔═╡ c72ffd0d-dbf7-4b88-af5e-de4f76d5ec33 -data_cart, time = Read_LaMEM_timestep(model,1) +data_cart, time = read_LaMEM_timestep(model,1) # ╔═╡ e73a3f02-c1f4-46d8-a0c2-c6f6058e1ca1 md""" diff --git a/notebooks/subduction_example.ipynb b/notebooks/subduction_example.ipynb index 3e84c68e..ad6f5f22 100644 --- a/notebooks/subduction_example.ipynb +++ b/notebooks/subduction_example.ipynb @@ -6397,7 +6397,7 @@ } ], "source": [ - "timesteps,_,_ = Read_LaMEM_simulation(model)" + "timesteps,_,_ = read_LaMEM_simulation(model)" ] }, { diff --git a/src/IO_functions.jl b/src/IO_functions.jl index 204aeb8d..dc177595 100644 --- a/src/IO_functions.jl +++ b/src/IO_functions.jl @@ -2,7 +2,7 @@ module IO_functions # this contains I/O routines of LaMEM, which don't require LaMEM_jll include("read_timestep.jl") -export Read_LaMEM_PVTR_File, Read_LaMEM_PVTS_File, field_names, readPVD, Read_LaMEM_PVTU_File +export read_LaMEM_PVTR_file, read_LaMEM_PVTS_file, field_names, readPVD, read_LaMEM_PVTU_file include("utils_IO.jl") diff --git a/src/LaMEM.jl b/src/LaMEM.jl index 3d7d51b7..1522cb22 100644 --- a/src/LaMEM.jl +++ b/src/LaMEM.jl @@ -8,9 +8,9 @@ export NO_units, GEO_units, SI_units, km, m, Pa, Pas, kg, cm, yr # Functions to read LaMEM output include("IO_functions.jl") using .IO_functions -export Read_LaMEM_PVTR_File, Read_LaMEM_PVTS_File, Read_LaMEM_PVTU_File -export Read_LaMEM_simulation, Read_LaMEM_timestep, Read_LaMEM_fieldnames -export PassiveTracer_Time +export read_LaMEM_PVTR_file, read_LaMEM_PVTS_file, read_LaMEM_PVTU_file +export read_LaMEM_simulation, read_LaMEM_timestep, read_LaMEM_fieldnames +export passivetracer_time export clean_directory, changefolder, read_phase_diagram, read_LaMEM_logfile export compress_vtr_file, compress_pvd @@ -25,10 +25,10 @@ include("DocUtils.jl") # Functions that help running LaMEM directly from julia include("LaMEM_ModelGeneration/LaMEM_Model.jl") using .LaMEM_Model -export LaMEM_Model, Model, Write_LaMEM_InputFile, create_initialsetup, +export LaMEM_Model, Model, write_LaMEM_inputFile, create_initialsetup, Scaling, Grid, Time, FreeSurface, BoundaryConditions, VelocityBox, BCBlock, VelCylinder, SolutionParams, Solver, ModelSetup, - geom_Sphere, geom_Ellipsoid, geom_Box, geom_RidgeSeg, geom_Hex, geom_Layer, geom_Cylinder, + GeomSphere, GeomEllipsoid, GeomBox, GeomRidgeSeg, GeomHex, GeomLayer, GeomCylinder , Output, Multigrid, print_short, Materials, Phase, Softening, PhaseTransition, PhaseAggregate, Dike, PassiveTracers, diff --git a/src/LaMEM_ModelGeneration/BoundaryConditions.jl b/src/LaMEM_ModelGeneration/BoundaryConditions.jl index 74339478..4a52addc 100644 --- a/src/LaMEM_ModelGeneration/BoundaryConditions.jl +++ b/src/LaMEM_ModelGeneration/BoundaryConditions.jl @@ -2,7 +2,7 @@ # # WARNING: incomplete, more parameters to be added -export BoundaryConditions, VelocityBox, BCBlock, VelCylinder, Write_LaMEM_InputFile +export BoundaryConditions, VelocityBox, BCBlock, VelCylinder, write_LaMEM_inputFile # ------- @@ -75,10 +75,10 @@ function show(d::VelocityBox) return str end """ - Write_LaMEM_InputFile(io, d::geom_Sphere) + write_LaMEM_inputFile(io, d::GeomSphere) """ -function Write_LaMEM_InputFile(io, d::VelocityBox) +function write_LaMEM_inputFile(io, d::VelocityBox) fields = fieldnames(typeof(d)) println(io, " ") for f in fields @@ -147,7 +147,7 @@ function show(io::IO, d::BCBlock) return nothing end -function Write_LaMEM_InputFile(io, d::BCBlock) +function write_LaMEM_inputFile(io, d::BCBlock) fields = fieldnames(typeof(d)) println(io, " ") for f in fields @@ -231,7 +231,7 @@ function show(io::IO, d::VelCylinder) return nothing end -function Write_LaMEM_InputFile(io, d::VelCylinder) +function write_LaMEM_inputFile(io, d::VelCylinder) fields = fieldnames(typeof(d)) println(io, " ") for f in fields @@ -485,10 +485,10 @@ function show_short(io::IO, d::BoundaryConditions) end """ - Write_LaMEM_InputFile(io, d::BoundaryConditions) + write_LaMEM_inputFile(io, d::BoundaryConditions) Writes the boundary conditions related parameters to file """ -function Write_LaMEM_InputFile(io, d::BoundaryConditions) +function write_LaMEM_inputFile(io, d::BoundaryConditions) Reference = BoundaryConditions(); # reference values fields = fieldnames(typeof(d)) @@ -511,7 +511,7 @@ function Write_LaMEM_InputFile(io, d::BoundaryConditions) end #end elseif f != :VelocityBoxes -# Write_LaMEM_InputFile(io, f) +# write_LaMEM_inputFile(io, f) #= @@ -539,9 +539,9 @@ function Write_LaMEM_InputFile(io, d::BoundaryConditions) end =# # elseif f != :VelCylinder - # Write_LaMEM_InputFile(io, f) + # write_LaMEM_inputFile(io, f) # elseif f != :BCBlock - # Write_LaMEM_InputFile(io, f) + # write_LaMEM_inputFile(io, f) # # # end @@ -553,21 +553,21 @@ function Write_LaMEM_InputFile(io, d::BoundaryConditions) println(io, "") println(io, "# Velocity boxes: \n") for object in d.VelocityBoxes - Write_LaMEM_InputFile(io, object) + write_LaMEM_inputFile(io, object) end end if length(d.VelCylinders)>0 println(io, "") for object in d.VelCylinders - Write_LaMEM_InputFile(io, object) + write_LaMEM_inputFile(io, object) end end if length(d.BCBlocks)>0 println(io, "") for object in d.BCBlocks - Write_LaMEM_InputFile(io, object) + write_LaMEM_inputFile(io, object) end end diff --git a/src/LaMEM_ModelGeneration/ErrorChecking.jl b/src/LaMEM_ModelGeneration/ErrorChecking.jl index dacb4616..5eae6049 100644 --- a/src/LaMEM_ModelGeneration/ErrorChecking.jl +++ b/src/LaMEM_ModelGeneration/ErrorChecking.jl @@ -15,7 +15,7 @@ function Check_LaMEM_Model(m::Model) if (m.ModelSetup.msetup=="geom") && length(m.ModelSetup.geom_primitives) == 0 error("If you use internal geometries to set phases, you need to at least specify one internal geometry object. - Example: add_geom!(model, geom_Sphere())") + Example: add_geom!(model, GeomSphere())") end if (m.ModelSetup.msetup=="files") && diff([extrema(m.Grid.Phases)...])[1]==0 && diff([extrema(m.Grid.Temp)...])[1]==0 diff --git a/src/LaMEM_ModelGeneration/FreeSurface.jl b/src/LaMEM_ModelGeneration/FreeSurface.jl index 4427f4ff..9d2bca21 100644 --- a/src/LaMEM_ModelGeneration/FreeSurface.jl +++ b/src/LaMEM_ModelGeneration/FreeSurface.jl @@ -2,7 +2,7 @@ # related to timestepping -export FreeSurface, Write_LaMEM_InputFile +export FreeSurface, write_LaMEM_inputFile """ Structure that contains the LaMEM free surface information. @@ -114,10 +114,10 @@ end """ - Write_LaMEM_InputFile(io, d::FreeSurface) + write_LaMEM_inputFile(io, d::FreeSurface) Writes the free surface related parameters to file """ -function Write_LaMEM_InputFile(io, d::FreeSurface) +function write_LaMEM_inputFile(io, d::FreeSurface) Reference = FreeSurface(); # reference values fields = fieldnames(typeof(d)) surf_use = d.surf_use diff --git a/src/LaMEM_ModelGeneration/Grid.jl b/src/LaMEM_ModelGeneration/Grid.jl index cc688323..23ca2f30 100644 --- a/src/LaMEM_ModelGeneration/Grid.jl +++ b/src/LaMEM_ModelGeneration/Grid.jl @@ -1,5 +1,5 @@ # This is the data that stores LaMEM grid-related info -export Grid, Write_LaMEM_InputFile, show_short +export Grid, write_LaMEM_inputFile, show_short """ Structure that contains the LaMEM grid information @@ -232,7 +232,7 @@ end """ - Write_LaMEM_InputFile(io, d::Grid) + write_LaMEM_inputFile(io, d::Grid) This writes grid info to a LaMEM input file @@ -241,12 +241,12 @@ Example ```julia julia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2]) julia> io = open("test.dat","w") -julia> LaMEM.Write_LaMEM_InputFile(io, d) +julia> LaMEM.write_LaMEM_inputFile(io, d) julia> close(io) ``` """ -function Write_LaMEM_InputFile(io, d::Grid) +function write_LaMEM_inputFile(io, d::Grid) println(io, "#===============================================================================") println(io, "# Grid & discretization parameters") diff --git a/src/LaMEM_ModelGeneration/LaMEM_Model.jl b/src/LaMEM_ModelGeneration/LaMEM_Model.jl index 77adba84..f3cf4daf 100644 --- a/src/LaMEM_ModelGeneration/LaMEM_Model.jl +++ b/src/LaMEM_ModelGeneration/LaMEM_Model.jl @@ -46,7 +46,7 @@ include("Solver.jl") # solver options export Solver include("ModelSetup.jl") # model setup options -export ModelSetup, geom_Sphere, set_geom! +export ModelSetup, GeomSphere, set_geom! include("Multigrid.jl") # Multigrid options export Multigrid diff --git a/src/LaMEM_ModelGeneration/Materials.jl b/src/LaMEM_ModelGeneration/Materials.jl index 7230b5bf..e11b49bd 100644 --- a/src/LaMEM_ModelGeneration/Materials.jl +++ b/src/LaMEM_ModelGeneration/Materials.jl @@ -1,6 +1,6 @@ # Specify Material properties using GeoParams -export Materials, Phase, Softening, PhaseAggregate, PhaseTransition, Dike, Write_LaMEM_InputFile +export Materials, Phase, Softening, PhaseAggregate, PhaseTransition, Dike, write_LaMEM_inputFile export add_geoparams_rheologies @@ -786,10 +786,10 @@ end """ - Write_LaMEM_InputFile(io, d::Output) + write_LaMEM_inputFile(io, d::Output) Writes the free surface related parameters to file """ -function Write_LaMEM_InputFile(io, d::Materials) +function write_LaMEM_inputFile(io, d::Materials) println(io, "#===============================================================================") println(io, "# Material phase parameters") diff --git a/src/LaMEM_ModelGeneration/Model.jl b/src/LaMEM_ModelGeneration/Model.jl index d4f81064..4c887ec1 100644 --- a/src/LaMEM_ModelGeneration/Model.jl +++ b/src/LaMEM_ModelGeneration/Model.jl @@ -1,10 +1,10 @@ # This is the main LaMEM Model struct using GeophysicalModelGenerator.GeoParams import LaMEM.Run: run_lamem, run_lamem_save_grid -import LaMEM: PassiveTracer_Time +import LaMEM: passivetracer_time using LaMEM.Run.LaMEM_jll -export Model, Write_LaMEM_InputFile, create_initialsetup, run_lamem, prepare_lamem +export Model, write_LaMEM_inputFile, create_initialsetup, run_lamem, prepare_lamem """ Model @@ -149,11 +149,11 @@ function show(io::IO, d::Model) end """ - Write_LaMEM_InputFile(d::Model,fname::String; dir=pwd()) + write_LaMEM_inputFile(d::Model,fname::String; dir=pwd()) Writes a LaMEM input file based on the data stored in Model """ -function Write_LaMEM_InputFile(d::Model, fname::String="input.dat"; dir=pwd()) +function write_LaMEM_inputFile(d::Model, fname::String="input.dat"; dir=pwd()) Check_LaMEM_Model(d) # check for mistakes in input if d.Output.write_VTK_setup @@ -169,19 +169,19 @@ function Write_LaMEM_InputFile(d::Model, fname::String="input.dat"; dir=pwd()) io = open(fname,"w") - Write_LaMEM_InputFile(io, d.Scaling) - Write_LaMEM_InputFile(io, d.Grid) - Write_LaMEM_InputFile(io, d.Time) - Write_LaMEM_InputFile(io, d.FreeSurface) - Write_LaMEM_InputFile(io, d.BoundaryConditions) - Write_LaMEM_InputFile(io, d.SolutionParams) - Write_LaMEM_InputFile(io, d.Solver) - Write_LaMEM_InputFile(io, d.ModelSetup) - Write_LaMEM_InputFile(io, d.Output) - Write_LaMEM_InputFile(io, d.PassiveTracers) - Write_LaMEM_InputFile(io, d.Materials) + write_LaMEM_inputFile(io, d.Scaling) + write_LaMEM_inputFile(io, d.Grid) + write_LaMEM_inputFile(io, d.Time) + write_LaMEM_inputFile(io, d.FreeSurface) + write_LaMEM_inputFile(io, d.BoundaryConditions) + write_LaMEM_inputFile(io, d.SolutionParams) + write_LaMEM_inputFile(io, d.Solver) + write_LaMEM_inputFile(io, d.ModelSetup) + write_LaMEM_inputFile(io, d.Output) + write_LaMEM_inputFile(io, d.PassiveTracers) + write_LaMEM_inputFile(io, d.Materials) - Write_LaMEM_InputFile_PETSc(io, d.Solver) # add PETSc options last + write_LaMEM_inputFile_PETSc(io, d.Solver) # add PETSc options last close(io) end @@ -243,19 +243,19 @@ end """ """ -function PassiveTracer_Time(model::Model, cores::Int64=1, args::String=""; wait=true) +function passivetracer_time(model::Model, cores::Int64=1, args::String=""; wait=true) end """ - PT = PassiveTracer_Time(ID::Union{Vector{Int64},Int64}, model::Model) + PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, model::Model) This reads passive tracers with `ID` from a LaMEM simulation specified by `model`, and returns a named tuple with the temporal evolution of these passive tracers. We return `x`,`y`,`z` coordinates and all fields specified in `FileName` for particles number `ID`. """ -function PassiveTracer_Time(ID::Union{Vector{Int64},Int64}, model::Model) - return PassiveTracer_Time(ID, model.Output.out_file_name, model.Output.out_dir) +function passivetracer_time(ID::Union{Vector{Int64},Int64}, model::Model) + return passivetracer_time(ID, model.Output.out_file_name, model.Output.out_dir) end """ @@ -279,7 +279,7 @@ function create_initialsetup(model::Model, cores::Int64=1, args::String=""; verb cd(model.Output.out_dir) end - Write_LaMEM_InputFile(model, model.Output.param_file_name) + write_LaMEM_inputFile(model, model.Output.param_file_name) if !isnothing(model.FreeSurface.Topography) diff --git a/src/LaMEM_ModelGeneration/ModelSetup.jl b/src/LaMEM_ModelGeneration/ModelSetup.jl index 3a05984f..0c8986ee 100644 --- a/src/LaMEM_ModelGeneration/ModelSetup.jl +++ b/src/LaMEM_ModelGeneration/ModelSetup.jl @@ -1,7 +1,7 @@ # Model Setup -export ModelSetup, Write_LaMEM_InputFile, - geom_Sphere, geom_Ellipsoid, geom_Box, geom_RidgeSeg, geom_Hex, geom_Layer, geom_Cylinder, +export ModelSetup, write_LaMEM_inputFile, + GeomSphere, GeomEllipsoid, GeomBox, GeomRidgeSeg, GeomHex, GeomLayer, GeomCylinder , set_geom! """ @@ -58,7 +58,7 @@ Base.@kwdef mutable struct ModelSetup "max number of same phase markers per subcell (subgrid marker control)" nmark_sub::Int64 = 3 - "Different geometric primitives that can be selected if we `msetup``=`geom`; see `geom_Sphere`" + "Different geometric primitives that can be selected if we `msetup``=`geom`; see `GeomSphere`" geom_primitives::Vector = [] end @@ -112,7 +112,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_Sphere +Base.@kwdef struct GeomSphere "phase" phase::Int64 = 1 @@ -130,22 +130,22 @@ Base.@kwdef struct geom_Sphere end -function show(io::IO, d::geom_Sphere) +function show(io::IO, d::GeomSphere) println(io, "Sphere(ph=$(d.phase), radius=$(d.radius), center=$(d.center), Temperature=$(d.Temperature), cstTemp = $(d.cstTemp))") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_Sphere) + write_LaMEM_inputFile(io, d::GeomSphere) """ -function Write_LaMEM_InputFile(io, d::geom_Sphere) +function write_LaMEM_inputFile(io, d::GeomSphere) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_Sphere, f) + comment = get_doc(GeomSphere, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -161,7 +161,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_Ellipsoid +Base.@kwdef struct GeomEllipsoid "phase" phase::Int64 = 1 @@ -179,21 +179,21 @@ Base.@kwdef struct geom_Ellipsoid end -function show(io::IO, d::geom_Ellipsoid) +function show(io::IO, d::GeomEllipsoid) println(io, "Ellipsoid(ph=$(d.phase), axes=$(d.axes), cen=$(d.center), T=$(d.Temperature)=$(d.cstTemp))") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_Ellipsoid) + write_LaMEM_inputFile(io, d::GeomEllipsoid) """ -function Write_LaMEM_InputFile(io, d::geom_Ellipsoid) +function write_LaMEM_inputFile(io, d::GeomEllipsoid) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_Ellipsoid, f) + comment = get_doc(GeomEllipsoid, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -209,7 +209,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_Box +Base.@kwdef struct GeomBox "phase" phase::Int64 = 1 @@ -232,21 +232,21 @@ Base.@kwdef struct geom_Box thermalAge::Union{Float64,Nothing} = nothing end -function show(io::IO, d::geom_Box) +function show(io::IO, d::GeomBox) println(io, "Box(ph=$(d.phase), bounds=$(d.bounds), T=$(d.Temperature)=$(d.cstTemp), [top,box]=[$(d.topTemp), $(d.botTemp)], thermalAge=$(d.thermalAge))") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_Box) + write_LaMEM_inputFile(io, d::GeomBox) """ -function Write_LaMEM_InputFile(io, d::geom_Box) +function write_LaMEM_inputFile(io, d::GeomBox) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_Box, f) + comment = get_doc(GeomBox, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -262,7 +262,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_RidgeSeg +Base.@kwdef struct GeomRidgeSeg "phase" phase::Int64 = 1 @@ -294,21 +294,21 @@ Base.@kwdef struct geom_RidgeSeg v_spread::Union{Float64,Nothing} = nothing end -function show(io::IO, d::geom_RidgeSeg) +function show(io::IO, d::GeomRidgeSeg) println(io, "RidgeSeg(ph=$(d.phase), bounds=$(d.bounds), ridgeseg_x=$(d.ridgeseg_x),ridgeseg_y=$(d.ridgeseg_y), T=$(d.Temperature) = [top,box]=[$(d.topTemp), $(d.botTemp)], age0=$(d.age0)), maxAge=$(d.maxAge), v_spread=$(d.v_spread))") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_RidgeSeg) + write_LaMEM_inputFile(io, d::GeomRidgeSeg) """ -function Write_LaMEM_InputFile(io, d::geom_RidgeSeg) +function write_LaMEM_inputFile(io, d::GeomRidgeSeg) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_RidgeSeg, f) + comment = get_doc(GeomRidgeSeg, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -324,7 +324,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_Hex +Base.@kwdef struct GeomHex "phase" phase::Int64 = 1 @@ -335,21 +335,21 @@ Base.@kwdef struct geom_Hex coord::Vector{Float64} = [0.25, 0.25, 0.25, 0.5, 0.2, 0.2, 0.6, 0.7, 0.25, 0.3, 0.5, 0.3, 0.2, 0.3, 0.75, 0.6, 0.15, 0.75, 0.5, 0.6, 0.80, 0.2, 0.4, 0.75] end -function show(io::IO, d::geom_Hex) +function show(io::IO, d::GeomHex) println(io, "Hex(ph=$(d.phase), coord=$(d.coord))") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_Hex) + write_LaMEM_inputFile(io, d::GeomHex) """ -function Write_LaMEM_InputFile(io, d::geom_Hex) +function write_LaMEM_inputFile(io, d::GeomHex) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_Hex, f) + comment = get_doc(GeomHex, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -365,7 +365,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_Layer +Base.@kwdef struct GeomLayer "phase" phase::Int64 = 1 @@ -400,21 +400,21 @@ Base.@kwdef struct geom_Layer thermalAge::Union{Float64,Nothing} = nothing end -function show(io::IO, d::geom_Layer) +function show(io::IO, d::GeomLayer) println(io, "Layer(ph=$(d.phase), bot/top=[$(d.bot),$(d.top)], T=$(d.Temperature)=$(d.cstTemp), [Ttop,Tbot]=[$(d.topTemp), $(d.botTemp)], thermalAge=$(d.thermalAge), cosine perturbation=$(d.cosine), wavelength=$(d.wavelength), amplitude=$(d.amplitude))") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_Layer) + write_LaMEM_inputFile(io, d::GeomLayer) """ -function Write_LaMEM_InputFile(io, d::geom_Layer) +function write_LaMEM_inputFile(io, d::GeomLayer) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_Layer, f) + comment = get_doc(GeomLayer, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -430,7 +430,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct geom_Cylinder +Base.@kwdef struct GeomCylinder "phase" phase::Int64 = 1 @@ -451,21 +451,21 @@ Base.@kwdef struct geom_Cylinder end -function show(io::IO, d::geom_Cylinder) +function show(io::IO, d::GeomCylinder ) println(io, "Cylinder(ph=$(d.phase), radius=$(d.radius) base=$(d.base), cap=$(d.cap), T=$(d.Temperature)=$(d.cstTemp) )") return nothing end """ - Write_LaMEM_InputFile(io, d::geom_Cylinder) + write_LaMEM_inputFile(io, d::GeomCylinder ) """ -function Write_LaMEM_InputFile(io, d::geom_Cylinder) +function write_LaMEM_inputFile(io, d::GeomCylinder ) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(geom_Cylinder, f) + comment = get_doc(GeomCylinder , f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end @@ -480,10 +480,10 @@ end """ - Write_LaMEM_InputFile(io, d::ModelSetup) + write_LaMEM_inputFile(io, d::ModelSetup) Writes options related to the Model Setup to disk """ -function Write_LaMEM_InputFile(io, d::ModelSetup) +function write_LaMEM_inputFile(io, d::ModelSetup) Reference = ModelSetup(); # reference values fields = fieldnames(typeof(d)) @@ -521,7 +521,7 @@ function Write_LaMEM_InputFile(io, d::ModelSetup) println(io, "") println(io, "# Geometric primitives: \n") for object in d.geom_primitives - Write_LaMEM_InputFile(io, object) + write_LaMEM_inputFile(io, object) end end diff --git a/src/LaMEM_ModelGeneration/Output.jl b/src/LaMEM_ModelGeneration/Output.jl index 621d06f9..23ec9c90 100644 --- a/src/LaMEM_ModelGeneration/Output.jl +++ b/src/LaMEM_ModelGeneration/Output.jl @@ -1,7 +1,7 @@ # Output options -export Output, Write_LaMEM_InputFile +export Output, write_LaMEM_inputFile """ Structure that contains the LaMEM output options @@ -201,10 +201,10 @@ function show_short(io::IO, d::Output) end """ - Write_LaMEM_InputFile(io, d::Output) + write_LaMEM_inputFile(io, d::Output) Writes the free surface related parameters to file """ -function Write_LaMEM_InputFile(io, d::Output) +function write_LaMEM_inputFile(io, d::Output) fields = fieldnames(typeof(d)) println(io, "#===============================================================================") diff --git a/src/LaMEM_ModelGeneration/PassiveTracers.jl b/src/LaMEM_ModelGeneration/PassiveTracers.jl index 067f8476..09cf2c17 100644 --- a/src/LaMEM_ModelGeneration/PassiveTracers.jl +++ b/src/LaMEM_ModelGeneration/PassiveTracers.jl @@ -3,7 +3,7 @@ # Capture meta-data with: # Docs.meta(LaMEM.LaMEM_Model)[Docs.@var(LaMEM.LaMEM_Model.PassiveTracers)].docs[Union{}].data -export PassiveTracers, Write_LaMEM_InputFile +export PassiveTracers, write_LaMEM_inputFile """ Structure that contains the LaMEM passive tracers parameters. @@ -76,10 +76,10 @@ end """ - Write_LaMEM_InputFile(io, d::PassiveTracers) + write_LaMEM_inputFile(io, d::PassiveTracers) Writes the boundary conditions related parameters to file """ -function Write_LaMEM_InputFile(io, d::PassiveTracers) +function write_LaMEM_inputFile(io, d::PassiveTracers) Reference = PassiveTracers(); # reference values fields = fieldnames(typeof(d)) diff --git a/src/LaMEM_ModelGeneration/Scaling.jl b/src/LaMEM_ModelGeneration/Scaling.jl index e0385d96..8ebe0409 100644 --- a/src/LaMEM_ModelGeneration/Scaling.jl +++ b/src/LaMEM_ModelGeneration/Scaling.jl @@ -1,4 +1,4 @@ -export Scaling, Write_LaMEM_InputFile +export Scaling, write_LaMEM_inputFile """ Scaling{T} is a structure that contains the scaling info, employed in the current simulation @@ -29,7 +29,7 @@ function show_short(io::IO, d::Scaling{T}) where T end -function Write_LaMEM_InputFile(io, d::Scaling) +function write_LaMEM_inputFile(io, d::Scaling) println(io, "#===============================================================================") println(io, "# Scaling") println(io, "#===============================================================================") diff --git a/src/LaMEM_ModelGeneration/SolutionParams.jl b/src/LaMEM_ModelGeneration/SolutionParams.jl index 9c8e76bd..1574f4a9 100644 --- a/src/LaMEM_ModelGeneration/SolutionParams.jl +++ b/src/LaMEM_ModelGeneration/SolutionParams.jl @@ -3,7 +3,7 @@ # Capture meta-data with: # Docs.meta(LaMEM.LaMEM_Model)[Docs.@var(LaMEM.LaMEM_Model.SolutionParams)].docs[Union{}].data -export SolutionParams, Write_LaMEM_InputFile +export SolutionParams, write_LaMEM_inputFile """ Structure that contains the LaMEM global solution parameters. @@ -167,10 +167,10 @@ end """ - Write_LaMEM_InputFile(io, d::SolutionParams) + write_LaMEM_inputFile(io, d::SolutionParams) Writes the boundary conditions related parameters to file """ -function Write_LaMEM_InputFile(io, d::SolutionParams) +function write_LaMEM_inputFile(io, d::SolutionParams) Reference = SolutionParams(); # reference values fields = fieldnames(typeof(d)) diff --git a/src/LaMEM_ModelGeneration/Solver.jl b/src/LaMEM_ModelGeneration/Solver.jl index 08a135aa..55aca4c8 100644 --- a/src/LaMEM_ModelGeneration/Solver.jl +++ b/src/LaMEM_ModelGeneration/Solver.jl @@ -1,6 +1,6 @@ # Solver options -export Solver, Write_LaMEM_InputFile +export Solver, write_LaMEM_inputFile """ Structure that contains the LaMEM solver options @@ -71,10 +71,10 @@ end """ - Write_LaMEM_InputFile(io, d::Solver) + write_LaMEM_inputFile(io, d::Solver) Writes the free surface related parameters to file """ -function Write_LaMEM_InputFile(io, d::Solver) +function write_LaMEM_inputFile(io, d::Solver) Reference = Solver(); # reference values fields = fieldnames(typeof(d)) @@ -107,10 +107,10 @@ end """ - Write_LaMEM_InputFile_PETSc(io, d::Solver) + write_LaMEM_inputFile_PETSc(io, d::Solver) Writes the (optional) PETSc options to file """ -function Write_LaMEM_InputFile_PETSc(io, d::Solver) +function write_LaMEM_inputFile_PETSc(io, d::Solver) PETSc_options = d.PETSc_options println(io, "#===============================================================================") diff --git a/src/LaMEM_ModelGeneration/Time.jl b/src/LaMEM_ModelGeneration/Time.jl index 71c36942..df9470d0 100644 --- a/src/LaMEM_ModelGeneration/Time.jl +++ b/src/LaMEM_ModelGeneration/Time.jl @@ -1,6 +1,6 @@ # related to timestepping -export Time, Write_LaMEM_InputFile +export Time, write_LaMEM_inputFile """ Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info` @@ -88,7 +88,7 @@ end """ Writes the Time related parameters to file """ -function Write_LaMEM_InputFile(io, d::Time) +function write_LaMEM_inputFile(io, d::Time) Reference = Time(); # reference values fields = fieldnames(typeof(d)) diff --git a/src/LaMEM_ModelGeneration/Utils.jl b/src/LaMEM_ModelGeneration/Utils.jl index 24d08f6a..2a0d6272 100644 --- a/src/LaMEM_ModelGeneration/Utils.jl +++ b/src/LaMEM_ModelGeneration/Utils.jl @@ -1,5 +1,5 @@ # Contains a number of useful functions -import LaMEM.IO_functions: Read_LaMEM_simulation, Read_LaMEM_timestep +import LaMEM.IO_functions: read_LaMEM_simulation, read_LaMEM_timestep export add_phase!, rm_phase!, rm_last_phase!, replace_phase!, add_vbox!, rm_last_vbox!, rm_vbox!, @@ -194,13 +194,13 @@ end This adds an internal geometric primitive object `geom_object` to the LaMEM Model Setup `model`. Currently available primitive geom objects are: -- `geom_Sphere` -- `geom_Ellipsoid` -- `geom_Box` -- `geom_Layer` -- `geom_Cylinder` -- `geom_RidgeSeg` -- `geom_Hex` +- `GeomSphere` +- `GeomEllipsoid` +- `GeomBox` +- `GeomLayer` +- `GeomCylinder ` +- `GeomRidgeSeg` +- `GeomHex` """ function add_geom!(model::Model, geom_object) @@ -236,7 +236,7 @@ end This sets the geometry """ -function set_geom!(model::Model, d::geom_Sphere) +function set_geom!(model::Model, d::GeomSphere) cen = (d.center...,) radius = d.radius @@ -254,18 +254,18 @@ end """ - Timestep, FileNames, Time = Read_LaMEM_simulation(model::Model; phase=false, surf=false, passive_tracers=false) + Timestep, FileNames, Time = read_LaMEM_simulation(model::Model; phase=false, surf=false, passive_tracers=false) Reads a LaMEM simulation as specified in `model` and returns the timesteps, times and filenames of that simulation once it is finished. """ -Read_LaMEM_simulation(model::Model; kwargs...) = Read_LaMEM_simulation(model.Output.out_file_name,model.Output.out_dir; kwargs...) +read_LaMEM_simulation(model::Model; kwargs...) = read_LaMEM_simulation(model.Output.out_file_name,model.Output.out_dir; kwargs...) """ - data, time = Read_LaMEM_timestep(model::Model, TimeStep::Int64=0; fields=nothing, phase=false, surf=false, last=true) + data, time = read_LaMEM_timestep(model::Model, TimeStep::Int64=0; fields=nothing, phase=false, surf=false, last=true) Reads a specific `Timestep` from a simulation specified in `model` """ -function Read_LaMEM_timestep(model::Model, TimeStep::Int64=0; kwargs...) +function read_LaMEM_timestep(model::Model, TimeStep::Int64=0; kwargs...) FileName = model.Output.out_file_name cur_dir = pwd(); @@ -273,7 +273,7 @@ function Read_LaMEM_timestep(model::Model, TimeStep::Int64=0; kwargs...) cd(model.Output.out_dir) end - data, time = Read_LaMEM_timestep(FileName,TimeStep; kwargs...) + data, time = read_LaMEM_timestep(FileName,TimeStep; kwargs...) cd(cur_dir) @@ -465,7 +465,7 @@ function stress_strainrate_0D(rheology, ε_vec::Vector; n=8, T=700, nstep_max=2, model.Output.out_dir="0D_$i" model.BoundaryConditions.exx_strain_rates = [ε] run_lamem(model, 1); #run - data,_ = Read_LaMEM_timestep(model, last=true) # read + data,_ = read_LaMEM_timestep(model, last=true) # read @show extrema(data.fields.j2_dev_stress) diff --git a/src/read_timestep.jl b/src/read_timestep.jl index 8e52e1ed..adaed32a 100644 --- a/src/read_timestep.jl +++ b/src/read_timestep.jl @@ -6,9 +6,9 @@ using GeophysicalModelGenerator: CartData, xyz_grid using Glob, ReadVTK, WriteVTK, LightXML -export Read_LaMEM_PVTR_File, Read_LaMEM_PVTS_File, Read_LaMEM_PVTU_File -export Read_LaMEM_simulation, Read_LaMEM_timestep, Read_LaMEM_fieldnames -export PassiveTracer_Time +export read_LaMEM_PVTR_file, read_LaMEM_PVTS_file, read_LaMEM_PVTU_file +export read_LaMEM_simulation, read_LaMEM_timestep, read_LaMEM_fieldnames +export passivetracer_time export compress_vtr_file, compress_pvd """ @@ -174,7 +174,7 @@ end """ - data_output = Read_LaMEM_PVTR_File(DirName, FileName; fields=nothing) + data_output = read_LaMEM_PVTR_file(DirName, FileName; fields=nothing) Reads a 3D LaMEM timestep from VTR file `FileName`, located in directory `DirName`. By default, it will read all fields. If you want you can only read a specific `field`. See the function `fieldnames` to get a list with all available fields in the file. @@ -182,7 +182,7 @@ By default, it will read all fields. If you want you can only read a specific `f It will return `data_output` which is a `CartData` output structure. """ -function Read_LaMEM_PVTR_File(DirName_base::String, FileName::String; fields=nothing) +function read_LaMEM_PVTR_file(DirName_base::String, FileName::String; fields=nothing) CurDir = pwd(); DirName, File = split_path_name(DirName_base, FileName) @@ -282,7 +282,7 @@ end """ - data_output = Read_LaMEM_PVTU_File(DirName, FileName; fields=nothing) + data_output = read_LaMEM_PVTU_file(DirName, FileName; fields=nothing) Reads a 3D LaMEM timestep from VTU file `FileName`, located in directory `DirName`. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific `field`. See the function `fieldnames` to get a list with all available fields in the file. @@ -290,7 +290,7 @@ By default, it will read all fields. If you want you can only read a specific `f It will return `data_output` which is a `CartData` output structure. """ -function Read_LaMEM_PVTU_File(DirName_base, FileName; fields=nothing) +function read_LaMEM_PVTU_file(DirName_base, FileName; fields=nothing) CurDir = pwd(); DirName, File = split_path_name(DirName_base, FileName) @@ -346,7 +346,7 @@ end """ - data_output = Read_LaMEM_PVTS_File(DirName, FileName; field=nothing) + data_output = read_LaMEM_PVTS_file(DirName, FileName; field=nothing) Reads a 3D LaMEM timestep from VTS file `FileName`, located in directory `DirName`. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific `field`. See the function `fieldnames` to get a list with all available fields in the file. @@ -354,7 +354,7 @@ By default, it will read all fields. If you want you can only read a specific `f It will return `data_output` which is a `CartData` output structure. """ -function Read_LaMEM_PVTS_File(DirName_base::String, FileName::String; fields=nothing) +function read_LaMEM_PVTS_file(DirName_base::String, FileName::String; fields=nothing) CurDir = pwd(); DirName, File = split_path_name(DirName_base, FileName) @@ -390,7 +390,7 @@ end """ - data, time = Read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=""; fields=nothing, phase=false, surf=false, last=false) + data, time = read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=""; fields=nothing, phase=false, surf=false, last=false) This reads a LaMEM timestep. @@ -409,9 +409,9 @@ Output: - `time`: The time of the timestep """ -function Read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=pwd(); fields=nothing, phase=false, surf=false, passive_tracers=false, last=false) +function read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=pwd(); fields=nothing, phase=false, surf=false, passive_tracers=false, last=false) - Timestep, FileNames, Time = Read_LaMEM_simulation(FileName, DirName; phase=phase, surf=surf, passive_tracers=passive_tracers); + Timestep, FileNames, Time = read_LaMEM_simulation(FileName, DirName; phase=phase, surf=surf, passive_tracers=passive_tracers); ind = findall(Timestep.==TimeStep) @@ -420,11 +420,11 @@ function Read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::Strin # Read file if surf==true - data = Read_LaMEM_PVTS_File(DirName, FileNames[ind[1]], fields=fields) + data = read_LaMEM_PVTS_file(DirName, FileNames[ind[1]], fields=fields) elseif passive_tracers==true - data = Read_LaMEM_PVTU_File(DirName, FileNames[ind[1]], fields=fields) + data = read_LaMEM_PVTU_file(DirName, FileNames[ind[1]], fields=fields) else - data = Read_LaMEM_PVTR_File(DirName, FileNames[ind[1]], fields=fields) + data = read_LaMEM_PVTR_file(DirName, FileNames[ind[1]], fields=fields) end return data, Time[ind] @@ -432,11 +432,11 @@ end """ - Timestep, FileNames, Time = Read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false, surf=false, passive_tracers=false) + Timestep, FileNames, Time = read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false, surf=false, passive_tracers=false) Reads a LaMEM simulation `FileName` in directory `DirName` and returns the timesteps, times and filenames of that simulation. """ -function Read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false, surf=false, passive_tracers=false) +function read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false, surf=false, passive_tracers=false) if phase==true pvd_file=FileName*"_phase.pvd" @@ -454,13 +454,13 @@ function Read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false end """ - Read_LaMEM_fieldnames(FileName::String, DirName_base::String=""; phase=false, surf=false, tracers=false) + read_LaMEM_fieldnames(FileName::String, DirName_base::String=""; phase=false, surf=false, tracers=false) Returns the names of the datasets stored in `FileName` """ -function Read_LaMEM_fieldnames(FileName::String, DirName_base::String=""; phase=false, surf=false, tracers=false) +function read_LaMEM_fieldnames(FileName::String, DirName_base::String=""; phase=false, surf=false, tracers=false) - _, FileNames, _ = Read_LaMEM_simulation(FileName, DirName_base; phase=phase, surf=surf); + _, FileNames, _ = read_LaMEM_simulation(FileName, DirName_base; phase=phase, surf=surf); # Read file DirName, File = split_path_name(DirName_base, FileNames[1]) @@ -489,21 +489,21 @@ end """ - PT = PassiveTracer_Time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String="") + PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String="") This reads passive tracers with `ID` from a LaMEM simulation, and returns a named tuple with the temporal evolution of these passive tracers. We return `x`,`y`,`z` coordinates and all fields specified in the `FileName` for particles number `ID`. """ -function PassiveTracer_Time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String="") - Timestep, _, Time_Myrs = Read_LaMEM_simulation(FileName, DirName,passive_tracers=true) +function passivetracer_time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String="") + Timestep, _, Time_Myrs = read_LaMEM_simulation(FileName, DirName,passive_tracers=true) # read first timestep - data0, _ = Read_LaMEM_timestep(FileName, Timestep[1], DirName, passive_tracers=true) + data0, _ = read_LaMEM_timestep(FileName, Timestep[1], DirName, passive_tracers=true) nt = extract_passive_tracers_CartData(data0, ID ); for timestep in Timestep - data, t = Read_LaMEM_timestep(FileName, timestep, DirName, passive_tracers=true); + data, t = read_LaMEM_timestep(FileName, timestep, DirName, passive_tracers=true); nt1 = extract_passive_tracers_CartData(data, ID ); if timestep>Timestep[1] diff --git a/test/mesh_refinement_test.jl b/test/mesh_refinement_test.jl index 8358bb20..3be0bec4 100644 --- a/test/mesh_refinement_test.jl +++ b/test/mesh_refinement_test.jl @@ -29,7 +29,7 @@ using GeophysicalModelGenerator run_lamem(model, 1); # read last timestep - data,time = Read_LaMEM_timestep(model,last=true); + data,time = read_LaMEM_timestep(model,last=true); @test sum(data.fields.velocity[3][:,:,:]) ≈ 0.3680135f0 # check Vz diff --git a/test/read_timestep.jl b/test/read_timestep.jl index 8218ef13..f9b5211d 100644 --- a/test/read_timestep.jl +++ b/test/read_timestep.jl @@ -7,39 +7,39 @@ pkg_dir = pkgdir(LaMEM) # Read a timestep FileName="FB_multigrid" Timestep = 1 - data, time = Read_LaMEM_timestep(FileName,Timestep) + data, time = read_LaMEM_timestep(FileName,Timestep) @test data.fields.phase[1000] ≈ 0.0f0 @test data.fields.strain_rate[1][1] ≈ -0.0010996389f0 rtol=1e-2 - fields = Read_LaMEM_fieldnames(FileName) + fields = read_LaMEM_fieldnames(FileName) # with cell-data FileName="FB_multigrid" DirName = "Timestep_00000001_6.72970343e+00" Timestep = 1 - data, time = Read_LaMEM_timestep(FileName,Timestep, phase=true) + data, time = read_LaMEM_timestep(FileName,Timestep, phase=true) @test data.fields.phase[1000] == 0 # read subduction setup - data, time = Read_LaMEM_timestep("Subduction2D_FreeSlip_direct",1) + data, time = read_LaMEM_timestep("Subduction2D_FreeSlip_direct",1) @test data.fields.density[10000] ≈ 3200.0f0 # single field - data, time = Read_LaMEM_timestep("Subduction2D_FreeSlip_direct",1, fields=("phase",)) + data, time = read_LaMEM_timestep("Subduction2D_FreeSlip_direct",1, fields=("phase",)) @test data.fields.phase[10000] ≈ 0.0f0 # Read PVD file - Timestep, FileNames, Time = Read_LaMEM_simulation("Subduction2D_FreeSlip_direct") + Timestep, FileNames, Time = read_LaMEM_simulation("Subduction2D_FreeSlip_direct") @test Time[2] ≈ 0.055 # Read passive tracers - data, time = Read_LaMEM_timestep("PlumeLithosphereInteraction",10, passive_tracers=true) + data, time = read_LaMEM_timestep("PlumeLithosphereInteraction",10, passive_tracers=true) @test data.z[100] ≈ -298.4531f0 @test data.fields.Temperature[100] ≈ 1350.0f0 # Read surface data - data, time = Read_LaMEM_timestep("Subduction2D_FreeSurface_direct",5, surf=true) + data, time = read_LaMEM_timestep("Subduction2D_FreeSurface_direct",5, surf=true) @test data.z[100] ≈ 0.68236357f0 @test sum(data.fields.topography[:,1,1]) ≈ 1.2645866f0 end diff --git a/test/test_julia_setup_phase_diagrams.jl b/test/test_julia_setup_phase_diagrams.jl index e4b25a9e..a605932d 100644 --- a/test/test_julia_setup_phase_diagrams.jl +++ b/test/test_julia_setup_phase_diagrams.jl @@ -37,7 +37,7 @@ run_lamem(model) # read back last timestep -data,time = Read_LaMEM_timestep(model,last=true); +data,time = read_LaMEM_timestep(model,last=true); ρ_num = data.fields.density[1,1,:]; ϕ_num = data.fields.melt_fraction[1,1,:]; diff --git a/test/test_julia_setups.jl b/test/test_julia_setups.jl index 2a3b1afd..68c19ce6 100644 --- a/test/test_julia_setups.jl +++ b/test/test_julia_setups.jl @@ -26,7 +26,7 @@ using GeophysicalModelGenerator run_lamem(model, 1); # read last timestep - data,time = Read_LaMEM_timestep(model,last=true); + data,time = read_LaMEM_timestep(model,last=true); @test sum(data.fields.velocity[3][:,:,:]) ≈ 0.10747005f0 rtol=1e-1 # check Vz # @test sum(data.fields.velocity[3][:,:,:]) ≈ 0.10866211f0 # check Vz @@ -77,7 +77,7 @@ using GeophysicalModelGenerator # # read last timestep # read last timestep - data,time = Read_LaMEM_timestep(model,last=true); + data,time = read_LaMEM_timestep(model,last=true); @test sum(data.fields.velocity[1][8, 8, 8]) ≈ 1 @@ -149,7 +149,7 @@ using GeophysicalModelGenerator run_lamem(model, 1); # read last timestep - data,time = Read_LaMEM_timestep(model,last=true); + data,time = read_LaMEM_timestep(model,last=true); @test sum(data.fields.phase) ≈ 29060.664f0 @@ -181,18 +181,18 @@ end sphere = Phase(ID=1,Name="sphere",eta=1e23,rho=3200) add_phase!(model, sphere, matrix) - geom_sphere = geom_Sphere(); + geom_sphere = GeomSphere(); rm_geom!(model) add_geom!(model, geom_sphere) out = run_lamem(model) @test isnothing(out) - geom_ellipsoid = geom_Ellipsoid(); - geom_box = geom_Box(); - geom_layer = geom_Layer(); - geom_cylinder = geom_Cylinder(); - geom_ridge = geom_RidgeSeg(); - geom_hex = geom_Hex(); + geom_ellipsoid = GeomEllipsoid(); + geom_box = GeomBox(); + geom_layer = GeomLayer(); + geom_cylinder = GeomCylinder (); + geom_ridge = GeomRidgeSeg(); + geom_hex = GeomHex(); add_geom!(model, geom_ellipsoid, geom_box, geom_layer, geom_cylinder, geom_ridge, geom_hex) out = run_lamem(model) From 0ceee2b8192b4df8ec4fd125ecf9c13a22b3016c Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Thu, 14 Mar 2024 11:25:53 +0100 Subject: [PATCH 4/5] typos --- src/LaMEM.jl | 2 +- src/LaMEM_ModelGeneration/ModelSetup.jl | 12 ++++++------ src/LaMEM_ModelGeneration/Utils.jl | 2 +- test/test_julia_setups.jl | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/LaMEM.jl b/src/LaMEM.jl index 1522cb22..b7d3a88b 100644 --- a/src/LaMEM.jl +++ b/src/LaMEM.jl @@ -28,7 +28,7 @@ using .LaMEM_Model export LaMEM_Model, Model, write_LaMEM_inputFile, create_initialsetup, Scaling, Grid, Time, FreeSurface, BoundaryConditions, VelocityBox, BCBlock, VelCylinder, SolutionParams, Solver, ModelSetup, - GeomSphere, GeomEllipsoid, GeomBox, GeomRidgeSeg, GeomHex, GeomLayer, GeomCylinder , + GeomSphere, GeomEllipsoid, GeomBox, GeomRidgeSeg, GeomHex, GeomLayer, GeomCylinder, Output, Multigrid, print_short, Materials, Phase, Softening, PhaseTransition, PhaseAggregate, Dike, PassiveTracers, diff --git a/src/LaMEM_ModelGeneration/ModelSetup.jl b/src/LaMEM_ModelGeneration/ModelSetup.jl index 0c8986ee..7ef4cb9f 100644 --- a/src/LaMEM_ModelGeneration/ModelSetup.jl +++ b/src/LaMEM_ModelGeneration/ModelSetup.jl @@ -1,7 +1,7 @@ # Model Setup export ModelSetup, write_LaMEM_inputFile, - GeomSphere, GeomEllipsoid, GeomBox, GeomRidgeSeg, GeomHex, GeomLayer, GeomCylinder , + GeomSphere, GeomEllipsoid, GeomBox, GeomRidgeSeg, GeomHex, GeomLayer, GeomCylinder, set_geom! """ @@ -430,7 +430,7 @@ end $(TYPEDFIELDS) """ -Base.@kwdef struct GeomCylinder +Base.@kwdef struct GeomCylinder "phase" phase::Int64 = 1 @@ -451,21 +451,21 @@ Base.@kwdef struct GeomCylinder end -function show(io::IO, d::GeomCylinder ) +function show(io::IO, d::GeomCylinder) println(io, "Cylinder(ph=$(d.phase), radius=$(d.radius) base=$(d.base), cap=$(d.cap), T=$(d.Temperature)=$(d.cstTemp) )") return nothing end """ - write_LaMEM_inputFile(io, d::GeomCylinder ) + write_LaMEM_inputFile(io, d::GeomCylinder) """ -function write_LaMEM_inputFile(io, d::GeomCylinder ) +function write_LaMEM_inputFile(io, d::GeomCylinder) fields = fieldnames(typeof(d)) println(io, " ") for f in fields if !isnothing(getfield(d,f)) name = rpad(String(f),15) - comment = get_doc(GeomCylinder , f) + comment = get_doc(GeomCylinder, f) data = getfield(d,f) println(io," $name = $(write_vec(data)) # $(comment)") end diff --git a/src/LaMEM_ModelGeneration/Utils.jl b/src/LaMEM_ModelGeneration/Utils.jl index 2a0d6272..c6a68bf6 100644 --- a/src/LaMEM_ModelGeneration/Utils.jl +++ b/src/LaMEM_ModelGeneration/Utils.jl @@ -198,7 +198,7 @@ Currently available primitive geom objects are: - `GeomEllipsoid` - `GeomBox` - `GeomLayer` -- `GeomCylinder ` +- `GeomCylinder` - `GeomRidgeSeg` - `GeomHex` diff --git a/test/test_julia_setups.jl b/test/test_julia_setups.jl index 68c19ce6..2f179226 100644 --- a/test/test_julia_setups.jl +++ b/test/test_julia_setups.jl @@ -190,7 +190,7 @@ end geom_ellipsoid = GeomEllipsoid(); geom_box = GeomBox(); geom_layer = GeomLayer(); - geom_cylinder = GeomCylinder (); + geom_cylinder = GeomCylinder(); geom_ridge = GeomRidgeSeg(); geom_hex = GeomHex(); From de5206f08d544722bb72dc0aeb0e0ad94fecac8a Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Thu, 14 Mar 2024 11:26:23 +0100 Subject: [PATCH 5/5] breaking change so new version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 80c78921..c87c2583 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LaMEM" uuid = "2e889f3d-35ce-4a77-8ea2-858aecb630f7" authors = ["Boris Kaus "] -version = "0.2.14" +version = "0.3.0" [deps] DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"