38 using namespace Utilities;
42 namespace OceanicPlateModels
48 min_depth(NaN::
DSNAN),
49 max_depth(NaN::
DSNAN),
50 top_temperature(NaN::
DSNAN),
51 bottom_temperature(NaN::
DSNAN),
55 this->
name =
"half space model";
67 "Half space cooling mode");
71 "The depth in meters from which the temperature of this feature is present.");
74 "The depth in meters to which the temperature of this feature is present." 75 "Because half-space reaches background temperature asymptotically, " 76 "this value should be ~2 times the nominal plate thickness of 100 km" );
79 "The actual surface temperature in degree Kelvin for this feature.");
82 "The mantle temperature for the half-space cooling model" 83 "in degree Kelvin for this feature. If the model has an adiabatic gradient" 84 "this should be the mantle potential temperature, and T = Tad + Thalf. ");
87 "The spreading velocity of the plate in meter per year. " 88 "This is the velocity with which one side moves away from the ridge.");
91 "An list of ridges. Each ridge is a lists of at least 2 2d points which " 92 "define the location of the ridge. You need to define at least one ridge." 93 "So the an example with two ridges is " 94 "[[[10,20],[20,30],[10,40]],[[50,10],[60,10]]].");
113 for (
auto &ridge_coordinate : ridge_coordinates)
115 ridge_coordinate *= dtr;
118 unsigned int ridge_point_index = 0;
119 for (
const auto &mid_oceanic_ridge : mid_oceanic_ridges)
121 std::vector<double> spreading_rates_for_ridge;
122 for (
unsigned int index_y = 0; index_y < mid_oceanic_ridge.size(); index_y++)
124 if (spreading_velocities.second.size() <= 1)
126 spreading_rates_for_ridge.push_back(spreading_velocities.second[0]);
130 spreading_rates_for_ridge.push_back(spreading_velocities.second[ridge_point_index]);
132 ridge_point_index += 1;
142 const double gravity_norm,
147 if (depth <= max_depth && depth >=
min_depth)
151 if (depth <= max_depth_local && depth >= min_depth_local)
156 std::vector<std::vector<double>> subducting_plate_velocities = {{0}};
157 std::vector<double> ridge_migration_times = {0.0};
161 if (bottom_temperature_local < 0)
165 this->world->specific_heat) * depth);
171 position_in_natural_coordinates_at_min_depth,
172 subducting_plate_velocities,
173 ridge_migration_times);
178 const double age = ridge_parameters[1] / ridge_parameters[0];
180 double temperature = bottom_temperature_local;
182 temperature = temperature + (age > 0 ? (
top_temperature - bottom_temperature_local)*std::erfc(depth/(2*std::sqrt(thermal_diffusivity*age))) : 0.);
184 WBAssert(!std::isnan(temperature),
"Temperature inside half-space cooling model is not a number: " << temperature
185 <<
". Relevant variables: bottom_temperature_local = " << bottom_temperature_local
188 <<
", spreading_velocity = " << ridge_parameters[0]
189 <<
", thermal_diffusivity = " << thermal_diffusivity
190 <<
", age = " << age <<
'.');
191 WBAssert(std::isfinite(temperature),
"Temperature inside half-space cooling model is not a finite: " << temperature <<
". Relevant variables: bottom_temperature_local = " << bottom_temperature_local
193 <<
", spreading_velocity = " << ridge_parameters[0]
194 <<
", thermal_diffusivity = " << thermal_diffusivity
195 <<
", age = " << age <<
'.');
Objects::Surface min_depth_surface
std::vector< std::vector< Point< 2 > > > mid_oceanic_ridges
double potential_mantle_temperature
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
double bottom_temperature
Operations string_operations_to_enum(const std::string &operation)
~HalfSpaceModel() override final
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)
void parse_entries(Parameters &prm, const std::vector< Point< 2 >> &coordinates) override final
std::vector< std::vector< double > > spreading_velocities_at_each_ridge_point
double thermal_diffusivity
WorldBuilder::World * world
Point< 2 > get_surface_point() const
static void declare_entries(Parameters &prm, const std::string &parent_name="")
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)
Objects::Surface max_depth_surface
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::pair< std::vector< double >, std::vector< double > > spreading_velocities
double & get_ref_depth_coordinate()