Skip to content

Commit 25755ff

Browse files
authored
Merge pull request #6374 from alarshi/modify_depths_chunk
Modify depths in presence of topography in chunk.
2 parents 0eaaebf + 7cf725d commit 25755ff

File tree

11 files changed

+73
-37
lines changed

11 files changed

+73
-37
lines changed

include/aspect/geometry_model/chunk.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ namespace aspect
119119
std::unique_ptr<Manifold<dim,dim>>
120120
clone() const override;
121121

122+
/**
123+
* Return the topography at a given point
124+
*/
125+
double topography_for_point(const Point<dim> &x_y_z) const;
126+
122127
private:
123128
/**
124129
* A pointer to the topography model.

source/geometry_model/chunk.cc

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,34 @@ namespace aspect
433433

434434
return r_phi_theta;
435435
}
436+
437+
438+
439+
template <int dim>
440+
double
441+
ChunkGeometry<dim>::
442+
topography_for_point(const Point<dim> &x_y_z) const
443+
{
444+
if (dynamic_cast<const InitialTopographyModel::ZeroTopography<dim>*>(topo) != nullptr)
445+
return 0;
446+
else
447+
{
448+
// The natural coordinate system in chunk geometry is r/lon/lat.
449+
// So, after converting the point into the spherical system we need to
450+
// change the theta (co-latitudes) into latitudes.
451+
const std::array<double, dim> r_phi_theta = Utilities::Coordinates::cartesian_to_spherical_coordinates(x_y_z);
452+
453+
// Grab lon,lat coordinates
454+
Point<dim-1> surface_point;
455+
// Convert latitude to colatitude
456+
if (dim == 3)
457+
surface_point[1] = 0.5*numbers::PI - surface_point[1];
458+
459+
for (unsigned int d=0; d<dim-1; ++d)
460+
surface_point[d] = r_phi_theta[d+1];
461+
return topo->value(surface_point);
462+
}
463+
}
436464
}
437465

438466

@@ -555,8 +583,12 @@ namespace aspect
555583
Chunk<dim>::depth(const Point<dim> &position) const
556584
{
557585
// depth is defined wrt the reference surface point2[0]
558-
// negative depth is not allowed
559-
return std::max (0., std::min (point2[0]-position.norm(), maximal_depth()));
586+
// plus initial topography. Negative depth is not allowed.
587+
if (this->simulator_is_past_initialization() &&
588+
!Plugins::plugin_type_matches<const InitialTopographyModel::ZeroTopography<dim>>(this->get_initial_topography_model()))
589+
return std::min(std::max(point2[0]+ manifold->topography_for_point(position) - position.norm(), 0.), maximal_depth());
590+
else
591+
return std::min(std::max(point2[0]-position.norm(), 0.), maximal_depth());
560592
}
561593

562594

@@ -582,10 +614,9 @@ namespace aspect
582614
// Choose a point at the mean longitude (and latitude)
583615
Point<dim> p = 0.5*(point2+point1);
584616
// at a depth beneath the top surface
585-
p[0] = point2[0]-depth;
617+
p[0] = point2[0]+manifold->topography_for_point(p) - depth;
586618

587-
// Now convert to Cartesian coordinates. This ignores the surface topography,
588-
// but that is as documented.
619+
// Now convert to Cartesian coordinates.
589620
return manifold->push_forward_sphere(p);
590621
}
591622

@@ -658,12 +689,12 @@ namespace aspect
658689
double
659690
Chunk<dim>::maximal_depth() const
660691
{
661-
// The depth is defined as relative to a reference surface (without
692+
// The depth is defined as relative to a reference surface (with
662693
// topography) and since we don't apply topography on the CMB,
663694
// the maximal depth really is the formula below, unless one applies a
664695
// topography that is always strictly below zero (i.e., where the
665696
// actual surface lies strictly below the reference surface).
666-
return point2[0]-point1[0];
697+
return point2[0] + this->get_initial_topography_model().max_topography() - point1[0];
667698
}
668699

669700

tests/chunk_initial_topography_ascii_data/screen-output

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Number of degrees of freedom: 3,556 (2,178+289+1,089)
77

88
*** Timestep 0: t=0 years, dt=0 years
99
Solving temperature system... 0 iterations.
10-
Solving Stokes system (GMG)... 29+0 iterations.
10+
Solving Stokes system (GMG)... 28+0 iterations.
1111

1212
Postprocessing:
1313

14-
Model domain depth (m): 3e+06
14+
Model domain depth (m): 3.09e+06
1515
Temperature contrast across model domain (K): 3500
1616
Reference depth (m): 0
1717
Reference temperature (K): 1613
@@ -23,7 +23,7 @@ Number of degrees of freedom: 3,556 (2,178+289+1,089)
2323
Reference thermal conductivity (W/(m*K)): 4.7
2424
Reference viscosity (Pa*s): 1e+21
2525
Reference thermal diffusivity (m^2/s): 1.22101e-06
26-
Rayleigh number: 7.4479e+07
26+
Rayleigh number: 8.13852e+07
2727

2828
RMS, max velocity: 0.0119 m/year, 0.0933 m/year
2929
Temperature min/avg/max: 1613 K, 1613 K, 1613 K

tests/chunk_initial_topography_ascii_data/statistics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# 16: Average nondimensional temperature (K)
1717
# 17: Minimum topography (m)
1818
# 18: Maximum topography (m)
19-
0 0.000000000000e+00 0.000000000000e+00 256 2467 1089 0 29 30 30 1.18604659e-02 9.33132004e-02 1.61300000e+03 1.61300000e+03 1.61300000e+03 4.40406633e-10 -4.75663606e+04 9.00000000e+04
19+
0 0.000000000000e+00 0.000000000000e+00 256 2467 1089 0 28 29 29 1.18604723e-02 9.33132938e-02 1.61300000e+03 1.61300000e+03 1.61300000e+03 4.40406633e-10 -4.75663606e+04 9.00000000e+04

tests/chunk_initial_topography_ascii_data_3d/screen-output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Number of degrees of freedom: 3,041 (2,187+125+729)
1111

1212
Postprocessing:
1313

14-
Model domain depth (m): 3e+06
14+
Model domain depth (m): 3.009e+06
1515
Temperature contrast across model domain (K): 3500
1616
Reference depth (m): 0
1717
Reference temperature (K): 1613
@@ -23,7 +23,7 @@ Number of degrees of freedom: 3,041 (2,187+125+729)
2323
Reference thermal conductivity (W/(m*K)): 4.7
2424
Reference viscosity (Pa*s): 1e+21
2525
Reference thermal diffusivity (m^2/s): 1.22101e-06
26-
Rayleigh number: 7.4479e+07
26+
Rayleigh number: 7.51513e+07
2727

2828
RMS, max velocity: 0.0442 m/year, 0.113 m/year
2929
Temperature min/avg/max: 1613 K, 1613 K, 1613 K

tests/chunk_initial_topography_ascii_data_3d/statistics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# 16: Average nondimensional temperature (K)
1717
# 17: Minimum topography (m)
1818
# 18: Maximum topography (m)
19-
0 0.000000000000e+00 0.000000000000e+00 64 2312 729 0 23 24 24 4.42347040e-02 1.13166975e-01 1.61300000e+03 1.61300006e+03 1.61300000e+03 1.71059328e-08 -1.98131486e+03 8.99532925e+03
19+
0 0.000000000000e+00 0.000000000000e+00 64 2312 729 0 23 24 24 4.42347089e-02 1.13166977e-01 1.61300000e+03 1.61300006e+03 1.61300000e+03 1.71059328e-08 -1.98131486e+03 8.99532925e+03

tests/chunk_initial_topography_ascii_data_3d_colatitude/screen-output

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Number of degrees of freedom: 3,041 (2,187+125+729)
77

88
*** Timestep 0: t=0 years, dt=0 years
99
Solving temperature system... 0 iterations.
10-
Solving Stokes system (GMG)... 21+0 iterations.
10+
Solving Stokes system (GMG)... 20+0 iterations.
1111

1212
Postprocessing:
1313

14-
Model domain depth (m): 3e+06
14+
Model domain depth (m): 3.009e+06
1515
Temperature contrast across model domain (K): 3500
1616
Reference depth (m): 0
1717
Reference temperature (K): 1613
@@ -23,7 +23,7 @@ Number of degrees of freedom: 3,041 (2,187+125+729)
2323
Reference thermal conductivity (W/(m*K)): 4.7
2424
Reference viscosity (Pa*s): 1e+21
2525
Reference thermal diffusivity (m^2/s): 1.22101e-06
26-
Rayleigh number: 7.4479e+07
26+
Rayleigh number: 7.51513e+07
2727

2828
RMS, max velocity: 0.0124 m/year, 0.0606 m/year
2929
Temperature min/avg/max: 1613 K, 1613 K, 1613 K

tests/chunk_initial_topography_ascii_data_3d_colatitude/statistics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# 16: Average nondimensional temperature (K)
1717
# 17: Minimum topography (m)
1818
# 18: Maximum topography (m)
19-
0 0.000000000000e+00 0.000000000000e+00 64 2312 729 0 21 22 22 1.24375134e-02 6.06479500e-02 1.61300000e+03 1.61300000e+03 1.61300000e+03 -1.75439514e-10 -1.95928291e+03 8.99918928e+03
19+
0 0.000000000000e+00 0.000000000000e+00 64 2312 729 0 20 21 21 1.24375096e-02 6.06479458e-02 1.61300000e+03 1.61300000e+03 1.61300000e+03 -1.75439514e-10 -1.95928291e+03 8.99918928e+03

tests/chunk_lithostatic_pressure_2d_initial_topography/screen-output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Number of degrees of freedom: 109 (50+9+25+25)
1111
Solving Stokes system (GMG)... 13+0 iterations.
1212

1313
Postprocessing:
14-
RMS, max velocity: 0.261 m/year, 0.401 m/year
15-
Pressure min/avg/max: -2.139e+09 Pa, 3.927e+10 Pa, 9.249e+10 Pa
14+
RMS, max velocity: 0.27 m/year, 0.427 m/year
15+
Pressure min/avg/max: -2.152e+09 Pa, 3.928e+10 Pa, 9.249e+10 Pa
1616
Writing graphical output: output-chunk_lithostatic_pressure_2d_initial_topography/solution/solution-00000
1717

1818
Termination requested by criterion: end time

tests/chunk_lithostatic_pressure_2d_initial_topography/solution/solution-00000.0000.gnuplot

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)