-
Notifications
You must be signed in to change notification settings - Fork 258
Adding tidal potential to gravity model #6614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 11 commits
f6a4b3d
1ecc8f3
c8e0290
8ba55ba
98784e4
d814c23
8a8e39f
66a6297
545332f
58b8278
19db0c7
4478a28
2a0042b
a6daae7
59b5abb
ed5d7b5
a268a78
bf76c59
053571d
dc77c71
4986161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Added: ASPECT now has a new gravity model plugin called 'Radial linear with tidal potnetial' for tidal forces. | ||
| This plugin is useful for modeling long-term interior and surface evolution in moons orbiting a large planet. | ||
| <br> | ||
| (Hyunseong Kim, Antoniette Greta Grima, Wolfgang Bangerth 2025/07/16) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,8 @@ namespace aspect | |
| * Magnitude of the gravity vector. | ||
| */ | ||
| double magnitude; | ||
|
|
||
| template <int dim2> friend class RadialWithTidalPotential; | ||
|
||
| }; | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||
| /* | ||||||
| Copyright (C) 2014 - 2019 by the authors of the ASPECT code. | ||||||
| This file is part of ASPECT. | ||||||
| ASPECT is free software; you can redistribute it and/or modify | ||||||
| it under the terms of the GNU General Public License as published by | ||||||
| the Free Software Foundation; either version 2, or (at your option) | ||||||
| any later version. | ||||||
| ASPECT is distributed in the hope that it will be useful, | ||||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||
| GNU General Public License for more details. | ||||||
| You should have received a copy of the GNU General Public License | ||||||
| along with ASPECT; see the file LICENSE. If not see | ||||||
| <http://www.gnu.org/licenses/>. | ||||||
| */ | ||||||
|
|
||||||
|
|
||||||
| #ifndef _aspect_gravity_model_radial_with_tidal_potential_h | ||||||
| #define _aspect_gravity_model_radial_with_tidal_potential_h | ||||||
|
|
||||||
| #include <aspect/simulator_access.h> | ||||||
| #include <aspect/gravity_model/interface.h> | ||||||
| #include <aspect/gravity_model/radial.h> | ||||||
|
|
||||||
| namespace aspect | ||||||
| { | ||||||
| namespace GravityModel | ||||||
| { | ||||||
| /** | ||||||
| * A class that describes gravity as a radial vector of linearly | ||||||
| * changing magnitude by tidal potential from flattening and non-synchronnous rotation with respect to position and time. | ||||||
|
||||||
| * changing magnitude by tidal potential from flattening and non-synchronnous rotation with respect to position and time. | |
| * changing magnitude, which is modified by a tidal potential from flattening and non-synchronous rotation. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Tidal potential is positive because it is from geodesy research, where potential is taken as positive. | |
| * Tidal potential is positive because the formula follows conventions from geodesy research, where potential is taken as positive. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semimajor axis of the orbit or of the shape of the modeled body? Please add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this parameter explanation seems quite tricky. For me, I make model of Europa, so I use semimajor axis of Europa's orbit (modeled body). However, for Earth, if moon is the perturbing body, semimajor axis of moon should be used. If sun is the perturbing body, semimajor of Earth should be used.
My idea is to leave as 'Semimajor axis of the orbit' on header file and to make more explanation on declare_entry on plugin file. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about: Semimajor axis of the orbit that causes the tidal perturbation? More explanation in the parameter description is of course also welcome.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still up to date? If it is an angular rate, why does it have the unit of m/year? Shouldnt it be 1/s?
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,11 @@ | |
|
|
||
| #include <deal.II/base/tensor.h> | ||
|
|
||
| #include <aspect/geometry_model/spherical_shell.h> | ||
| #include <aspect/geometry_model/sphere.h> | ||
| #include <aspect/geometry_model/chunk.h> | ||
| #include <aspect/geometry_model/ellipsoidal_chunk.h> | ||
|
|
||
|
||
| namespace aspect | ||
| { | ||
| namespace GravityModel | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,199 @@ | ||||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||||
| Copyright (C) 2011 - 2020 by the authors of the ASPECT code. | ||||||||||||||||||||||||||||||||||||||||||
| This file is part of ASPECT. | ||||||||||||||||||||||||||||||||||||||||||
| ASPECT is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||
| the Free Software Foundation; either version 2, or (at your option) | ||||||||||||||||||||||||||||||||||||||||||
| any later version. | ||||||||||||||||||||||||||||||||||||||||||
| ASPECT is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||
| GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||
| You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||
| along with ASPECT; see the file LICENSE. If not see | ||||||||||||||||||||||||||||||||||||||||||
| <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/gravity_model/radial_with_tidal_potential.h> | ||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/geometry_model/interface.h> | ||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/utilities.h> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| #include <deal.II/base/tensor.h> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/gravity_model/radial.h> | ||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/geometry_model/spherical_shell.h> | ||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/geometry_model/sphere.h> | ||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/geometry_model/chunk.h> | ||||||||||||||||||||||||||||||||||||||||||
| #include <aspect/geometry_model/ellipsoidal_chunk.h> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| namespace aspect | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| namespace GravityModel | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| template <int dim> | ||||||||||||||||||||||||||||||||||||||||||
| Tensor<1,dim> | ||||||||||||||||||||||||||||||||||||||||||
| RadialWithTidalPotential<dim>::gravity_vector (const Point<dim> &p) const | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
34
to
37
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you want this to only work in 3D models, but ASPECT is compiled for 2D and 3D models, you will (or maybe already have) run into trouble with using types like
Suggested change
This construct is called a template specialization (more information here: https://www.learncpp.com/cpp-tutorial/function-template-specialization/), and it provides different functions for your class for dim==2 (which will crash) and dim==3 (which will work as you expect it to).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! but I had to change a bit to make this code work. I hope the code below is the correct modification.
I will use this later for Tensor<1,2> when Antoniette and I decide how to implement 2D case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @gassmoeller , I have a bit of trouble for upper part of suggestion, which is template
While in make, I see the warning that warning:
Because tests considers warnings as errors, I fail tests. Is there a simple but reasonable way I can use Point 'p'? or the way to avoid this warning?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, our usual way to avoid this warning is to comment the name (but not the type) of the parameter argument. This tells the compiler that this parameter exists (for some reasons or other), but that we are intentionally not using it in the function: |
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * Notation of this potential equation is converted from spherical coordinates to cartesian coordinates. | ||||||||||||||||||||||||||||||||||||||||||
| * Therefore, gradient of potential is (3 G M_p) / (2 a_s^3) * ( 1 / 6 * ( x^2 + y^2 - 2 * z^2) + 1 / 2 * (C1*(x^2 + y^2) - 2 * C2 * x * y))) | ||||||||||||||||||||||||||||||||||||||||||
| * where C1 = cos(2*b*t) and C2 = sin(2*b*t) | ||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||
| const Tensor<1,dim> e_x = Point<dim>::unit_vector(0); | ||||||||||||||||||||||||||||||||||||||||||
| const Tensor<1,dim> e_y = Point<dim>::unit_vector(1); | ||||||||||||||||||||||||||||||||||||||||||
| const Tensor<1,dim> e_z = Point<dim>::unit_vector(2); | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const double t = (this->simulator_is_past_initialization()) ? this->get_time() : 0.0; | ||||||||||||||||||||||||||||||||||||||||||
| const double x = p[0]; | ||||||||||||||||||||||||||||||||||||||||||
| const double y = p[1]; | ||||||||||||||||||||||||||||||||||||||||||
| const double z = p[2]; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const double C1 = std::cos( 2. * b_NSR * t); | ||||||||||||||||||||||||||||||||||||||||||
| const double C2 = std::sin( 2. * b_NSR * t); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const double dTstar_over_dx = 1. / 6. * ( 2. * x ); | ||||||||||||||||||||||||||||||||||||||||||
| const double dT0_over_dx = 1. / 2. * ( 2. * C1 * x - 2. * C2 * y ); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const double dTstar_over_dy = 1. / 6. * ( 2. * y ); | ||||||||||||||||||||||||||||||||||||||||||
| const double dT0_over_dy = 1. / 2. * ( -2. * C1 * y - 2. * C2 * x ); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const double dTstar_over_dz = 1. / 6. * ( -4. * z ); | ||||||||||||||||||||||||||||||||||||||||||
| const double dT0_over_dz = 0; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const double G = aspect::constants::big_g; | ||||||||||||||||||||||||||||||||||||||||||
| const double T_factor = 3. * G * M_p / 2. / a_s / a_s / a_s; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
| const double T_factor = 3. * G * M_p / 2. / a_s / a_s / a_s; | |
| const double T_factor = 3. * G * M_p / (2. * a_s * a_s * a_s); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you simplify above as I suggest, this simply becomes:
| const Tensor<1,dim> tidal_gravity = T_factor * | |
| ( (dTstar_over_dx + dT0_over_dx) * e_x | |
| + (dTstar_over_dy + dT0_over_dy) * e_y | |
| + (dTstar_over_dz + dT0_over_dz) * e_z); | |
| const Tensor<1,dim> tidal_gravity = T_factor * | |
| (dTstar_gradient + dT0_gradient); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, here is where you access the private member variable magnitude of the object radialconstant which is of the class type RadialConstant<dim>. The way to work around that is to call the public member function gravity_vector like so:
return radialconstant.gravity_vector(p) + tidal_gravity;
Then you do no longer access the private member variable magnitude, and instead call the public member function gravity_vector.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| prm.declare_entry ("Mass of perterbing body", "1.898e27", | |
| prm.declare_entry ("Mass of perturbing body", "1.898e27", |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Default value is for modeling Europa, therefore, mass of Jupiter. " | |
| "The default value is chosen for modeling Europa, therefore, it is the mass of Jupiter. " |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Length of semimajor axis of orbit between modeled body and perturbing body. " | |
| "The length of the semimajor axis of the orbit between the modeled body and the perturbing body. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence needs some explanation. Why is this relevant? And what is this? I.e. does this whole plugin only work for cases like Europa with a swimming ice shell, but e.g. not Io with a rocky shell? Then this should be documented in the plugin documentation at the very end of the file, not in this parameter.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comment here: #6614 (comment)
We want this input parameter to be given in 'degrees/year' if the input parameter 'Use years instead of seconds' is set to 'true', and 'degrees/s' if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before you end this function add the following:
RadialLinear<dim>::declare_parameters(prm);
This will let the RadialLinear class also declare its parameters. Technically, this is not necessary, because of course that other class is used as its own plugin, so ASPECT will call its declare_parameters function anyway. But calling this function multiple times is not wrong, and adding this line will make sure these parameters will always be declared, even if we decide in the future to remove that other class as its own plugin (and for example move it into the current class).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so you only allow this for 3D models. Please add this to the documentation at the bottom of this file. I will leave a comment above for how to handle this in the gravity_vector function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so you do the conversion already. Then disregard my earlier comment, and just fix the documentation of this parameter to say that it is given in degrees/year or degrees/second depending on the input parameter 'Use years instead of seconds'.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but according to your formulas, shouldnt this parameter now be b and not b_NSR?
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Assert (false, ExcMessage ("This initial condition can only be used if the geometry " | |
| Assert (false, ExcMessage ("This gravity model can only be used if the geometry " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document at the end of this text that this plugin only works in 3D (I had commented on that here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.