35 using namespace Utilities;
39 namespace OceanicPlateModels
45 min_depth(NaN::
DSNAN),
46 max_depth(NaN::
DSNAN),
47 top_temperature(NaN::
DSNAN),
48 bottom_temperature(NaN::
DSNAN),
52 this->
name =
"plate model";
68 "The depth in meters from which the temperature of this feature is present.");
71 "The depth in meters to which the temperature of this feature is present.");
74 "The temperature in degree Kelvin which this feature should have");
77 "The temperature in degree Kelvin which this feature should have");
80 "The spreading velocity of the plate in meter per year. " 81 "This is the velocity with which one side moves away from the ridge.");
84 "An list of ridges. Each ridge is a lists of at least 2 2d points which " 85 "define the location of the ridge. You need to define at least one ridge." 86 "So the an example with two ridges is " 87 "[[[10,20],[20,30],[10,40]],[[50,10],[60,10]]].");
107 for (
auto &ridge_coordinate : ridge_coordinates)
109 ridge_coordinate *= dtr;
112 unsigned int ridge_point_index = 0;
113 for (
const auto &mid_oceanic_ridge : mid_oceanic_ridges)
115 std::vector<double> spreading_rates_for_ridge;
116 for (
unsigned int index_y = 0; index_y < mid_oceanic_ridge.size(); index_y++)
118 if (spreading_velocities.second.size() <= 1)
120 spreading_rates_for_ridge.push_back(spreading_velocities.second[0]);
124 spreading_rates_for_ridge.push_back(spreading_velocities.second[ridge_point_index]);
126 ridge_point_index += 1;
137 const double gravity_norm,
142 if (depth <= max_depth && depth >=
min_depth)
146 if (depth <= max_depth_local && depth >= min_depth_local)
151 std::vector<std::vector<double>> subducting_plate_velocities = {{0}};
152 std::vector<double> ridge_migration_times = {0.0};
155 if (bottom_temperature_local < 0)
159 this->world->specific_heat) * depth);
162 const int summation_number = 100;
167 position_in_natural_coordinates_at_min_depth,
168 subducting_plate_velocities,
169 ridge_migration_times);
172 const double age = ridge_parameters[1] / ridge_parameters[0];
177 for (
int i = 1; i<summation_number+1; ++i)
179 temperature = temperature + (bottom_temperature_local -
top_temperature) *
181 std::exp((((ridge_parameters[0] *
max_depth)/(2 * thermal_diffusivity)) -
182 std::sqrt(((ridge_parameters[0]*ridge_parameters[0]*max_depth*max_depth) /
183 (4*thermal_diffusivity*thermal_diffusivity)) +
double(i) *
double(i) * Consts::PI * Consts::PI)) *
184 ((ridge_parameters[0] * age) / max_depth)));
188 WBAssert(!std::isnan(temperature),
"Temperature inside plate model is not a number: " << temperature
189 <<
". Relevant variables: bottom_temperature_local = " << bottom_temperature_local
192 <<
", spreading_velocity = " << ridge_parameters[0]
193 <<
", thermal_diffusivity = " << thermal_diffusivity
194 <<
", age = " << age <<
'.');
195 WBAssert(std::isfinite(temperature),
"Temperature inside plate model is not a finite: " << temperature <<
". Relevant variables: bottom_temperature_local = " << bottom_temperature_local
197 <<
", spreading_velocity = " << ridge_parameters[0]
198 <<
", thermal_diffusivity = " << thermal_diffusivity
199 <<
", age = " << age <<
'.');
double bottom_temperature
~PlateModel() override final
double potential_mantle_temperature
std::pair< std::vector< double >, std::vector< double > > spreading_velocities
Operations string_operations_to_enum(const std::string &operation)
static void declare_entries(Parameters &prm, const std::string &parent_name="")
std::vector< double > calculate_ridge_distance_and_spreading(std::vector< std::vector< Point< 2 >>> mid_oceanic_ridges, std::vector< std::vector< double >> mid_oceanic_spreading_velocities, const std::unique_ptr< WorldBuilder::CoordinateSystems::Interface > &coordinate_system, const Objects::NaturalCoordinate &position_in_natural_coordinates_at_min_depth, const std::vector< std::vector< double >> &subducting_plate_velocities, const std::vector< double > &ridge_migration_times)
#define WBAssert(condition, message)
#define WB_REGISTER_FEATURE_OCEANIC_PLATE_TEMPERATURE_MODEL(classname, name)
Objects::Surface min_depth_surface
double thermal_diffusivity
void parse_entries(Parameters &prm, const std::vector< Point< 2 >> &coordinates) override final
WorldBuilder::World * world
double get_temperature(const Point< 3 > &position, const Objects::NaturalCoordinate &position_in_natural_coordinates, const double depth, const double gravity, double temperature, const double feature_min_depth, const double feature_max_depth) const override final
Point< 2 > get_surface_point() const
std::vector< std::vector< Point< 2 > > > mid_oceanic_ridges
Objects::Surface max_depth_surface
SurfaceValueInfo local_value(const Point< 2 > &check_point) const
std::unique_ptr< WorldBuilder::CoordinateSystems::Interface > coordinate_system
double thermal_expansion_coefficient
std::pair< std::vector< double >, std::vector< double > > get_value_at_array(const std::string &name)
double apply_operation(const Operations operation, const double old_value, const double new_value)
double sin(const double raw_angle)
void declare_entry(const std::string &name, const Types::Interface &type, const std::string &documentation)
std::vector< T > get_vector(const std::string &name)
T get(const std::string &name)
std::vector< std::vector< double > > spreading_velocities_at_each_ridge_point
double & get_ref_depth_coordinate()