Skip to content

Conversation

albert-de-montserrat
Copy link
Collaborator

No description provided.

Copy link
Contributor

github-actions bot commented Sep 26, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/miniapps/subduction/3D/Subduction3D.jl b/miniapps/subduction/3D/Subduction3D.jl
index be24c30..ede7203 100644
--- a/miniapps/subduction/3D/Subduction3D.jl
+++ b/miniapps/subduction/3D/Subduction3D.jl
@@ -54,29 +54,29 @@ end
 ## BEGIN OF MAIN SCRIPT --------------------------------------------------------------
 function main3D(li, origin, phases_GMG, igg; nx = 16, ny = 16, nz = 16, figdir = "figs3D", do_vtk = false)
 
-    thickness = 660e3 * m
-    η0        = 1.0e20 * Pa * s
-    CharDim   = GEO_units(;
+    thickness = 660.0e3 * m
+    η0 = 1.0e20 * Pa * s
+    CharDim = GEO_units(;
         length = thickness, viscosity = η0, temperature = 1000 * K
     )
-    li_nd     = nondimensionalize(li .* m, CharDim)
+    li_nd = nondimensionalize(li .* m, CharDim)
     origin_nd = nondimensionalize(origin .* m, CharDim)
-   
+
     # Physical domain ------------------------------------
-    ni           = nx, ny, nz        # number of cells
-    di           = @. li_nd / ni        # grid steps
-    grid         = Geometry(ni, li_nd; origin = origin_nd)
+    ni = nx, ny, nz        # number of cells
+    di = @. li_nd / ni        # grid steps
+    grid = Geometry(ni, li_nd; origin = origin_nd)
     (; xci, xvi) = grid              # nodes at the center and vertices of the cells
     # ----------------------------------------------------
 
     # Physical properties using GeoParams ----------------
-    rheology  = init_rheologies(CharDim)
-    dt        = nondimensionalize(10.0e3 * yr, CharDim) # diffusive CFL timestep limiter
+    rheology = init_rheologies(CharDim)
+    dt = nondimensionalize(10.0e3 * yr, CharDim) # diffusive CFL timestep limiter
     # ----------------------------------------------------
 
     # Initialize particles -------------------------------
     nxcell, max_xcell, min_xcell = 150, 175, 125
-    particles      = init_particles(backend_JP, nxcell, max_xcell, min_xcell, xvi, di, ni)
+    particles = init_particles(backend_JP, nxcell, max_xcell, min_xcell, xvi, di, ni)
     subgrid_arrays = SubgridDiffusionCellArrays(particles)
     # velocity grids
     grid_vx, grid_vy, grid_vz = velocity_grids(xci, xvi, di)
@@ -85,36 +85,36 @@ function main3D(li, origin, phases_GMG, igg; nx = 16, ny = 16, nz = 16, figdir =
 
     # Assign particles phases anomaly
     phases_device = PTArray(backend_JR)(phases_GMG)
-    phase_ratios  = PhaseRatios(backend_JP, length(rheology), ni)
+    phase_ratios = PhaseRatios(backend_JP, length(rheology), ni)
     init_phases!(pPhases, phases_device, particles, xvi)
     update_phase_ratios!(phase_ratios, particles, xci, xvi, pPhases)
     # ----------------------------------------------------
 
     # STOKES ---------------------------------------------
     # Allocate arrays needed for every Stokes problem
-    stokes     = StokesArrays(backend_JR, ni)
-    pt_stokes  = PTStokesCoeffs(li_nd, di; ϵ_abs = 5.0e-3, ϵ_rel = 5.0e-3, CFL = 0.99 / √3.1)
+    stokes = StokesArrays(backend_JR, ni)
+    pt_stokes = PTStokesCoeffs(li_nd, di; ϵ_abs = 5.0e-3, ϵ_rel = 5.0e-3, CFL = 0.99 / √3.1)
     # ----------------------------------------------------
 
     # TEMPERATURE PROFILE --------------------------------
-    thermal    = ThermalArrays(backend_JR, ni)
+    thermal = ThermalArrays(backend_JR, ni)
     temperature2center!(thermal)
     # ----------------------------------------------------
-    
+
     # Buoyancy forces
-    ρg         = ntuple(_ -> @zeros(ni...), Val(3))
+    ρg = ntuple(_ -> @zeros(ni...), Val(3))
     compute_ρg!(ρg[end], phase_ratios, rheology, (T = thermal.Tc, P = stokes.P))
     @parallel (@idx ni) init_P!(stokes.P, ρg[3], xci[3])
     # stokes.P        .= PTArray(backend_JR)(reverse(cumsum(reverse((ρg[end]).* di[end], dims=3), dims=3), dims=3))
     # Rheology
-    args              = (; T = thermal.Tc, P = stokes.P, dt = Inf)
-    viscosity_cutoff  = nondimensionalize((1.0e18, 1.0e24) .* (Pa * s), CharDim)
+    args = (; T = thermal.Tc, P = stokes.P, dt = Inf)
+    viscosity_cutoff = nondimensionalize((1.0e18, 1.0e24) .* (Pa * s), CharDim)
     compute_viscosity!(stokes, phase_ratios, args, rheology, viscosity_cutoff)
 
     # Boundary conditions
     flow_bcs = VelocityBoundaryConditions(;
         free_slip = (left = true, right = true, top = true, bot = false, front = true, back = true),
-        no_slip   = (left = false, right = false, top = false, bot = true, front = false, back = false),
+        no_slip = (left = false, right = false, top = false, bot = true, front = false, back = false),
     )
     flow_bcs!(stokes, flow_bcs) # apply boundary conditions
 
@@ -136,7 +136,7 @@ function main3D(li, origin, phases_GMG, igg; nx = 16, ny = 16, nz = 16, figdir =
 
     # Time loop
     t, it = 0.0, 0
-    t_max = nondimensionalize(10 * Myr, CharDim) 
+    t_max = nondimensionalize(10 * Myr, CharDim)
     while t < t_max
 
         # # interpolate fields from particle to grid vertices
@@ -145,7 +145,7 @@ function main3D(li, origin, phases_GMG, igg; nx = 16, ny = 16, nz = 16, figdir =
 
         # interpolate stress back to the grid
         stress2grid!(stokes, pτ, xvi, xci, particles)
-      
+
         # Stokes solver ----------------
         t_stokes = @elapsed begin
             out = solve!(
@@ -221,16 +221,16 @@ function main3D(li, origin, phases_GMG, igg; nx = 16, ny = 16, nz = 16, figdir =
                     phase_vertex = [argmax(p) for p in Array(phase_ratios.center)],
                 )
                 data_c = (;
-                    P   = dimensionalize_and_strip(Array(stokes.P), Pa, CharDim),
+                    P = dimensionalize_and_strip(Array(stokes.P), Pa, CharDim),
                     τII = dimensionalize_and_strip(Array(stokes.τ.II), Pa, CharDim),
                     εII = dimensionalize_and_strip(Array(stokes.ε.II), s^-1, CharDim),
-                    η   = dimensionalize_and_strip(Array(stokes.viscosity.η), Pa*s, CharDim),
+                    η = dimensionalize_and_strip(Array(stokes.viscosity.η), Pa * s, CharDim),
                     phase_center = [argmax(p) for p in Array(phase_ratios.center)],
                 )
                 velocity_v = (
-                    dimensionalize_and_strip(Array(Vx_v), cm/yr, CharDim),
-                    dimensionalize_and_strip(Array(Vy_v), cm/yr, CharDim),
-                    dimensionalize_and_strip(Array(Vz_v), cm/yr, CharDim),
+                    dimensionalize_and_strip(Array(Vx_v), cm / yr, CharDim),
+                    dimensionalize_and_strip(Array(Vy_v), cm / yr, CharDim),
+                    dimensionalize_and_strip(Array(Vz_v), cm / yr, CharDim),
                 )
                 save_vtk(
                     joinpath(vtk_dir, "vtk_" * lpad("$it", 6, "0")),
@@ -264,5 +264,5 @@ let
 
     # (Path)/folder where output data and figures are stored
     figdir = "Subduction3D"
-    main3D(li, origin, phases_GMG, igg; figdir = figdir, nx = nx, ny = ny, nz = nz, do_vtk = do_vtk);
-end
\ No newline at end of file
+    main3D(li, origin, phases_GMG, igg; figdir = figdir, nx = nx, ny = ny, nz = nz, do_vtk = do_vtk)
+end
diff --git a/miniapps/subduction/3D/Subduction3D_MPI.jl b/miniapps/subduction/3D/Subduction3D_MPI.jl
index 26a8d03..1f23d58 100644
--- a/miniapps/subduction/3D/Subduction3D_MPI.jl
+++ b/miniapps/subduction/3D/Subduction3D_MPI.jl
@@ -54,24 +54,24 @@ end
 
 ## BEGIN OF MAIN SCRIPT --------------------------------------------------------------
 function main3D(x_global, y_global, z_global, li, origin, phases_GMG, igg; nx = 16, ny = 16, nz = 16, figdir = "figs3D", do_vtk = false)
-    thickness = 660e3 * m
-    η0        = 1.0e20 * Pa * s
-    CharDim   = GEO_units(;
+    thickness = 660.0e3 * m
+    η0 = 1.0e20 * Pa * s
+    CharDim = GEO_units(;
         length = thickness, viscosity = η0, temperature = 1000 * K
     )
-    li_nd     = nondimensionalize(li .* m, CharDim)
+    li_nd = nondimensionalize(li .* m, CharDim)
     origin_nd = nondimensionalize(origin .* m, CharDim)
-   
+
     # LOCAL Physical domain ------------------------------------
     ni = nx, ny, nz           # number of cells
     di = @. li_nd / (nx_g(), ny_g(), nz_g())           # grid steps
-    grid         = Geometry(ni, li_nd; origin = origin_nd)
+    grid = Geometry(ni, li_nd; origin = origin_nd)
     (; xci, xvi) = grid              # nodes at the center and vertices of the cells
     # ----------------------------------------------------
 
     # Physical properties using GeoParams ----------------
-    rheology  = init_rheologies(CharDim)
-    dt        = nondimensionalize(10.0e3 * yr, CharDim) # diffusive CFL timestep limiter
+    rheology = init_rheologies(CharDim)
+    dt = nondimensionalize(10.0e3 * yr, CharDim) # diffusive CFL timestep limiter
     # ----------------------------------------------------
 
     # Initialize particles -------------------------------
@@ -95,15 +95,15 @@ function main3D(x_global, y_global, z_global, li, origin, phases_GMG, igg; nx =
 
     # STOKES ---------------------------------------------
     # Allocate arrays needed for every Stokes problem
-    stokes     = StokesArrays(backend_JR, ni)
-    pt_stokes  = PTStokesCoeffs(li_nd, di; ϵ_abs = 5.0e-3, ϵ_rel = 5.0e-3, CFL = 0.99 / √3.1)
+    stokes = StokesArrays(backend_JR, ni)
+    pt_stokes = PTStokesCoeffs(li_nd, di; ϵ_abs = 5.0e-3, ϵ_rel = 5.0e-3, CFL = 0.99 / √3.1)
     # ----------------------------------------------------
 
     # TEMPERATURE PROFILE --------------------------------
     thermal = ThermalArrays(backend_JR, ni)
     temperature2center!(thermal)
     # ----------------------------------------------------
-    
+
     # Buoyancy forces
     ρg = ntuple(_ -> @zeros(ni...), Val(3))
     compute_ρg!(ρg[end], phase_ratios, rheology, (T = thermal.Tc, P = stokes.P))
@@ -111,7 +111,7 @@ function main3D(x_global, y_global, z_global, li, origin, phases_GMG, igg; nx =
     # stokes.P        .= PTArray(backend_JR)(reverse(cumsum(reverse((ρg[end]).* di[end], dims=3), dims=3), dims=3))
     # Rheology
     args = (; T = thermal.Tc, P = stokes.P, dt = Inf)
-    viscosity_cutoff  = nondimensionalize((1.0e18, 1.0e24) .* (Pa * s), CharDim)
+    viscosity_cutoff = nondimensionalize((1.0e18, 1.0e24) .* (Pa * s), CharDim)
     compute_viscosity!(stokes, phase_ratios, args, rheology, viscosity_cutoff)
 
     # Boundary conditions
@@ -142,45 +142,48 @@ function main3D(x_global, y_global, z_global, li, origin, phases_GMG, igg; nx =
 
 
     # global array
-    nx_v           = (nx - 2) * igg.dims[1]
-    ny_v           = (ny - 2) * igg.dims[2]
-    nz_v           = (nz - 2) * igg.dims[3]
+    nx_v = (nx - 2) * igg.dims[1]
+    ny_v = (ny - 2) * igg.dims[2]
+    nz_v = (nz - 2) * igg.dims[3]
     # center
-    P_v            = zeros(nx_v, ny_v, nz_v)
-    τII_v          = zeros(nx_v, ny_v, nz_v)
-    η_vep_v        = zeros(nx_v, ny_v, nz_v)
-    εII_v          = zeros(nx_v, ny_v, nz_v)
-    phases_c_v     = zeros(nx_v, ny_v, nz_v)
+    P_v = zeros(nx_v, ny_v, nz_v)
+    τII_v = zeros(nx_v, ny_v, nz_v)
+    η_vep_v = zeros(nx_v, ny_v, nz_v)
+    εII_v = zeros(nx_v, ny_v, nz_v)
+    phases_c_v = zeros(nx_v, ny_v, nz_v)
     # center nohalo
-    P_nohalo       = zeros(nx - 2, ny - 2, nz - 2)
-    τII_nohalo     = zeros(nx - 2, ny - 2, nz - 2)
-    η_vep_nohalo   = zeros(nx - 2, ny - 2, nz - 2)
-    εII_nohalo     = zeros(nx - 2, ny - 2, nz - 2)
-    phases_c_nohalo= zeros(nx - 2, ny - 2, nz - 2)
+    P_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    τII_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    η_vep_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    εII_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    phases_c_nohalo = zeros(nx - 2, ny - 2, nz - 2)
     # vertex
-    Vxv_v          = zeros(nx_v, ny_v, nz_v)
-    Vyv_v          = zeros(nx_v, ny_v, nz_v)
-    Vzv_v          = zeros(nx_v, ny_v, nz_v)
-    T_v            = zeros(nx_v, ny_v, nz_v)
+    Vxv_v = zeros(nx_v, ny_v, nz_v)
+    Vyv_v = zeros(nx_v, ny_v, nz_v)
+    Vzv_v = zeros(nx_v, ny_v, nz_v)
+    T_v = zeros(nx_v, ny_v, nz_v)
     # vertex nohalo
-    Vxv_nohalo     = zeros(nx - 2, ny - 2, nz - 2)
-    Vyv_nohalo     = zeros(nx - 2, ny - 2, nz - 2)
-    Vzv_nohalo     = zeros(nx - 2, ny - 2, nz - 2)
-    T_nohalo       = zeros(nx - 2, ny - 2, nz - 2)
+    Vxv_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    Vyv_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    Vzv_nohalo = zeros(nx - 2, ny - 2, nz - 2)
+    T_nohalo = zeros(nx - 2, ny - 2, nz - 2)
 
     xci_v = (
         LinRange(
-            dimensionalize_and_strip(minimum(x_global), km, CharDim), dimensionalize_and_strip(maximum(x_global), km, CharDim), nx_v),
+            dimensionalize_and_strip(minimum(x_global), km, CharDim), dimensionalize_and_strip(maximum(x_global), km, CharDim), nx_v
+        ),
         LinRange(
-            dimensionalize_and_strip(minimum(y_global), km, CharDim), dimensionalize_and_strip(maximum(y_global), km, CharDim), ny_v),
+            dimensionalize_and_strip(minimum(y_global), km, CharDim), dimensionalize_and_strip(maximum(y_global), km, CharDim), ny_v
+        ),
         LinRange(
-            dimensionalize_and_strip(minimum(z_global), km, CharDim), dimensionalize_and_strip(maximum(z_global), km, CharDim), nz_v),
+            dimensionalize_and_strip(minimum(z_global), km, CharDim), dimensionalize_and_strip(maximum(z_global), km, CharDim), nz_v
+        ),
     )
 
     # Time loop
     t, it = 0.0, 0
 
-    t_max = nondimensionalize(10 * Myr, CharDim) 
+    t_max = nondimensionalize(10 * Myr, CharDim)
     while t < t_max
 
         # Stokes solver ----------------
@@ -233,12 +236,12 @@ function main3D(x_global, y_global, z_global, li, origin, phases_GMG, igg; nx =
         #MPI gathering
         phase_center = [argmax(p) for p in Array(phase_ratios.center)]
         #centers
-        @views P_nohalo         .= Array(stokes.P[2:(end - 1), 2:(end - 1), 2:(end - 1)])                   # Copy data to CPU removing the halo
-        @views τII_nohalo       .= Array(stokes.τ.II[2:(end - 1), 2:(end - 1), 2:(end - 1)])               # Copy data to CPU removing the halo
-        @views η_vep_nohalo     .= Array(stokes.viscosity.η_vep[2:(end - 1), 2:(end - 1), 2:(end - 1)])   # Copy data to CPU removing the halo
-        @views εII_nohalo       .= Array(stokes.ε.II[2:(end - 1), 2:(end - 1), 2:(end - 1)])              # Copy data to CPU removing the halo
-        @views phases_c_nohalo  .= Array(phase_center[2:(end - 1), 2:(end - 1), 2:(end - 1)])
-        gather!(P_nohalo,         P_v)
+        @views P_nohalo .= Array(stokes.P[2:(end - 1), 2:(end - 1), 2:(end - 1)])                   # Copy data to CPU removing the halo
+        @views τII_nohalo .= Array(stokes.τ.II[2:(end - 1), 2:(end - 1), 2:(end - 1)])               # Copy data to CPU removing the halo
+        @views η_vep_nohalo .= Array(stokes.viscosity.η_vep[2:(end - 1), 2:(end - 1), 2:(end - 1)])   # Copy data to CPU removing the halo
+        @views εII_nohalo .= Array(stokes.ε.II[2:(end - 1), 2:(end - 1), 2:(end - 1)])              # Copy data to CPU removing the halo
+        @views phases_c_nohalo .= Array(phase_center[2:(end - 1), 2:(end - 1), 2:(end - 1)])
+        gather!(P_nohalo, P_v)
         gather!(τII_nohalo, τII_v)
         gather!(η_vep_nohalo, η_vep_v)
         gather!(εII_nohalo, εII_v)
@@ -265,17 +268,17 @@ function main3D(x_global, y_global, z_global, li, origin, phases_GMG, igg; nx =
             if do_vtk
 
                 data_c = (;
-                    T      = dimensionalize_and_strip(T_v, C,CharDim),
-                    P      = dimensionalize_and_strip(P_v, Pa, CharDim),
-                    τII    = dimensionalize_and_strip(τII_v, Pa, CharDim),
-                    εII    = dimensionalize_and_strip(εII_v, s^-1, CharDim),
-                    η      = dimensionalize_and_strip(η_vep_v, Pa*s, CharDim),
+                    T = dimensionalize_and_strip(T_v, C, CharDim),
+                    P = dimensionalize_and_strip(P_v, Pa, CharDim),
+                    τII = dimensionalize_and_strip(τII_v, Pa, CharDim),
+                    εII = dimensionalize_and_strip(εII_v, s^-1, CharDim),
+                    η = dimensionalize_and_strip(η_vep_v, Pa * s, CharDim),
                     phases = phases_c_v,
                 )
                 velocity_v = (
-                    dimensionalize_and_strip(Array(Vx_v), cm/yr, CharDim),
-                    dimensionalize_and_strip(Array(Vy_v), cm/yr, CharDim),
-                    dimensionalize_and_strip(Array(Vz_v), cm/yr, CharDim),
+                    dimensionalize_and_strip(Array(Vx_v), cm / yr, CharDim),
+                    dimensionalize_and_strip(Array(Vy_v), cm / yr, CharDim),
+                    dimensionalize_and_strip(Array(Vz_v), cm / yr, CharDim),
                 )
                 save_vtk(
                     joinpath(vtk_dir, "vtk_" * lpad("$(it)_$(igg.me)", 6, "0")),
@@ -304,10 +307,10 @@ let
     end
 
     # GLOBAL Physical domain ------------------------------------
-    x_global = range(-3960, 500, nx_g());
-    y_global = range(0, 2640, ny_g());
+    x_global = range(-3960, 500, nx_g())
+    y_global = range(0, 2640, ny_g())
     air_thickness = 0.0
-    z_global = range(-660, air_thickness, nz_g());
+    z_global = range(-660, air_thickness, nz_g())
     origin = (x_global[1], y_global[1], z_global[1])
     li = (abs(last(x_global) - first(x_global)), abs(last(y_global) - first(y_global)), abs(last(z_global) - first(z_global)))
 
@@ -319,5 +322,5 @@ let
     # (Path)/folder where output data and figures are stored
     figdir = "Subduction3D_$(nx_g())x$(ny_g())x$(nz_g())"
 
-    main3D(x_global, y_global, z_global, li_GMG, origin_GMG, phases_GMG, igg; figdir = figdir, nx = nx, ny = ny, nz = nz, do_vtk = do_vtk);
-end
\ No newline at end of file
+    main3D(x_global, y_global, z_global, li_GMG, origin_GMG, phases_GMG, igg; figdir = figdir, nx = nx, ny = ny, nz = nz, do_vtk = do_vtk)
+end
diff --git a/miniapps/subduction/3D/Subduction3D_rheology.jl b/miniapps/subduction/3D/Subduction3D_rheology.jl
index 15d5d36..cc81afe 100644
--- a/miniapps/subduction/3D/Subduction3D_rheology.jl
+++ b/miniapps/subduction/3D/Subduction3D_rheology.jl
@@ -3,39 +3,39 @@ function init_rheologies(CharDim)
     return rheology = (
         # Name              = "slab",
         SetMaterialParams(;
-            Phase            = 1,
-            Density          = ConstantDensity(; ρ = 3.28e3kg/m^3),
-            CompositeRheology= CompositeRheology((LinearViscous(η = 2.0e23*Pa*s),)),
+            Phase = 1,
+            Density = ConstantDensity(; ρ = 3.28e3kg / m^3),
+            CompositeRheology = CompositeRheology((LinearViscous(η = 2.0e23 * Pa * s),)),
             # Elasticity     = el_upper_crust,
-            Gravity          = ConstantGravity(; g = 9.81m/s^2),
-            CharDim          = CharDim,
+            Gravity = ConstantGravity(; g = 9.81m / s^2),
+            CharDim = CharDim,
         ),
         # Name              = "crust",
         SetMaterialParams(;
-            Phase            = 2,
-            Density          = ConstantDensity(; ρ = 3.28e3kg/m^3),
-            CompositeRheology= CompositeRheology((LinearViscous(η = 1.0e21*Pa*s),)),
+            Phase = 2,
+            Density = ConstantDensity(; ρ = 3.28e3kg / m^3),
+            CompositeRheology = CompositeRheology((LinearViscous(η = 1.0e21 * Pa * s),)),
             # Elasticity     = el_upper_crust,
-            Gravity          = ConstantGravity(; g = 9.81m/s^2),
-            CharDim          = CharDim,
+            Gravity = ConstantGravity(; g = 9.81m / s^2),
+            CharDim = CharDim,
         ),
         # Name              = "mantle",
         SetMaterialParams(;
-            Phase            = 3,
-            Density          = ConstantDensity(; ρ = 3.2e3kg/m^3),
-            CompositeRheology= CompositeRheology((LinearViscous(η = 1.0e21*Pa*s),)),
+            Phase = 3,
+            Density = ConstantDensity(; ρ = 3.2e3kg / m^3),
+            CompositeRheology = CompositeRheology((LinearViscous(η = 1.0e21 * Pa * s),)),
             # Elasticity     = el_upper_crust,
-            Gravity          = ConstantGravity(; g = 9.81m/s^2),
-            CharDim          = CharDim,
+            Gravity = ConstantGravity(; g = 9.81m / s^2),
+            CharDim = CharDim,
         ),
         # Name              = "StickyAir",
         SetMaterialParams(;
-            Phase            = 4,
-            Density          = ConstantDensity(; ρ = 100kg/m^3), # water density
-            HeatCapacity     = ConstantHeatCapacity(; Cp = 3.0e3J/kg/K),
-            Conductivity     = ConstantConductivity(; k = 1.0Watt/K/m),
-            CompositeRheology= CompositeRheology((LinearViscous(; η = 1.0e19*Pa*s),)),
-            CharDim          = CharDim,
+            Phase = 4,
+            Density = ConstantDensity(; ρ = 100kg / m^3), # water density
+            HeatCapacity = ConstantHeatCapacity(; Cp = 3.0e3J / kg / K),
+            Conductivity = ConstantConductivity(; k = 1.0Watt / K / m),
+            CompositeRheology = CompositeRheology((LinearViscous(; η = 1.0e19 * Pa * s),)),
+            CharDim = CharDim,
         ),
     )
 end
diff --git a/src/variational_stokes/Stokes2D.jl b/src/variational_stokes/Stokes2D.jl
index dc485bc..d4bc3ed 100644
--- a/src/variational_stokes/Stokes2D.jl
+++ b/src/variational_stokes/Stokes2D.jl
@@ -44,8 +44,8 @@ function _solve_VS!(
     (; η, η_vep) = stokes.viscosity
     ni = size(stokes.P)
 
-    nRx = length(@views stokes.R.Rx[ϕ.Vx[2:end-1,:] .> 0])
-    nRy = length(@views stokes.R.Ry[ϕ.Vy[:, 2:end-1] .> 0])
+    nRx = length(@views stokes.R.Rx[ϕ.Vx[2:(end - 1), :] .> 0])
+    nRy = length(@views stokes.R.Ry[ϕ.Vy[:, 2:(end - 1)] .> 0])
     nRP = length(@views stokes.R.RP[ϕ.center .> 0])
 
     # ~preconditioner
@@ -230,9 +230,9 @@ function _solve_VS!(
             #     norm_mpi(@views stokes.R.RP[ϕ.center .> 0]) /
             #         √length(@views stokes.R.RP[ϕ.center .> 0]),
             # )
-             errs = (
-                norm_mpi(@views stokes.R.Rx[ϕ.Vx[2:end-1,:] .> 0]) / nRx,
-                norm_mpi(@views stokes.R.Ry[ϕ.Vy[:,2:end-1] .> 0]) / nRy,
+            errs = (
+                norm_mpi(@views stokes.R.Rx[ϕ.Vx[2:(end - 1), :] .> 0]) / nRx,
+                norm_mpi(@views stokes.R.Ry[ϕ.Vy[:, 2:(end - 1)] .> 0]) / nRy,
                 norm_mpi(@views stokes.R.RP[ϕ.center .> 0]) / nRP,
             )
 

Copy link

codecov bot commented Sep 26, 2025

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/stress_rotation/stress_rotation_particles.jl 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant