From e118bf7ccb5ab3228b20716a6b1cf70f27f66505 Mon Sep 17 00:00:00 2001 From: danieldouglas92 Date: Wed, 14 Aug 2024 16:08:15 -0600 Subject: [PATCH] Add cutoff pressures to Tian --- .../composition/water_content.h | 6 +++++- .../composition/water_content.h | 6 +++++- .../composition/water_content.cc | 18 ++++++++++------ .../composition/water_content.cc | 21 ++++++++++++------- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/include/world_builder/features/oceanic_plate_models/composition/water_content.h b/include/world_builder/features/oceanic_plate_models/composition/water_content.h index 3f666e991..4d0b82c1e 100644 --- a/include/world_builder/features/oceanic_plate_models/composition/water_content.h +++ b/include/world_builder/features/oceanic_plate_models/composition/water_content.h @@ -92,7 +92,7 @@ namespace WorldBuilder double min_depth; Objects::Surface min_depth_surface; double max_depth; - double density; + double density; // Density used to compute the lithostatic pressure Objects::Surface max_depth_surface; std::vector compositions; Operations operation; @@ -118,6 +118,10 @@ namespace WorldBuilder std::vector LR_poly_sediment = {-2.03283, 10.8186, -21.2119, 18.3351, -6.48711, 8.32459}; std::vector c_sat_poly_sediment = {-0.150662, 0.301807, 1.01867}; std::vector Td_poly_sediment = {2.83277, -24.7593, 85.9090, 524.898}; + + // Maximum pressure for the lithologies (Peridotite, Gabbro, MORB, Sediment). Above these + // pressures, the parameterized phase diagrams break down and the solubility goes to infinity. + std::vector pressure_cutoffs {10, 26, 16, 1.0}; }; } // namespace Composition } // namespace OceanicPlateModels diff --git a/include/world_builder/features/subducting_plate_models/composition/water_content.h b/include/world_builder/features/subducting_plate_models/composition/water_content.h index 6e98e09aa..4a1adb67e 100644 --- a/include/world_builder/features/subducting_plate_models/composition/water_content.h +++ b/include/world_builder/features/subducting_plate_models/composition/water_content.h @@ -90,7 +90,7 @@ namespace WorldBuilder // water_content composition submodule parameters double min_depth; double max_depth; - double density; + double density; // Density used to calculate the lithostatic pressure std::vector compositions; Operations operation; std::string lithology_str; @@ -115,6 +115,10 @@ namespace WorldBuilder std::vector LR_poly_sediment = {-2.03283, 10.8186, -21.2119, 18.3351, -6.48711, 8.32459}; std::vector c_sat_poly_sediment = {-0.150662, 0.301807, 1.01867}; std::vector Td_poly_sediment = {2.83277, -24.7593, 85.9090, 524.898}; + + // Maximum pressure for the lithologies (Peridotite, Gabbro, MORB, Sediment). Above these + // pressures, the parameterized phase diagrams break down and the solubility goes to infinity. + std::vector pressure_cutoffs {10, 26, 16, 1.0}; }; } // namespace Composition } // namespace SubductingPlateModels diff --git a/source/world_builder/features/oceanic_plate_models/composition/water_content.cc b/source/world_builder/features/oceanic_plate_models/composition/water_content.cc index f17fa79a5..9946ad90c 100644 --- a/source/world_builder/features/oceanic_plate_models/composition/water_content.cc +++ b/source/world_builder/features/oceanic_plate_models/composition/water_content.cc @@ -102,9 +102,9 @@ namespace WorldBuilder double WaterContent::calculate_water_content(double pressure, double temperature, - std::string lithology_str) const + std::string lithology_string) const { - double inv_pressure = 1/pressure; + pressure = pressure <= 0.5 ? 0.5 : pressure; double ln_LR_value = 0; double ln_c_sat_value = 0; double Td_value = 0; @@ -121,13 +121,13 @@ namespace WorldBuilder }; LithologyName lithology = peridotite; - if (lithology_str=="peridotite") + if (lithology_string=="peridotite") lithology = peridotite; - else if (lithology_str=="gabbro") + else if (lithology_string=="gabbro") lithology = gabbro; - else if (lithology_str=="MORB") + else if (lithology_string=="MORB") lithology = MORB; - else if (lithology_str=="sediment") + else if (lithology_string=="sediment") lithology = sediment; if (lithology == peridotite) @@ -135,6 +135,7 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_peridotite; c_sat_polynomial_coeffs = c_sat_poly_peridotite; Td_polynomial_coeffs = Td_poly_peridotite; + pressure = pressure > pressure_cutoffs[0] ? pressure_cutoffs[0] : pressure; } if (lithology == gabbro) @@ -142,6 +143,7 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_gabbro; c_sat_polynomial_coeffs = c_sat_poly_gabbro; Td_polynomial_coeffs = Td_poly_gabbro; + pressure = pressure > pressure_cutoffs[1] ? pressure_cutoffs[1] : pressure; } if (lithology == MORB) @@ -149,6 +151,7 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_MORB; c_sat_polynomial_coeffs = c_sat_poly_MORB; Td_polynomial_coeffs = Td_poly_MORB; + pressure = pressure > pressure_cutoffs[2] ? pressure_cutoffs[2] : pressure; } if (lithology == sediment) @@ -156,8 +159,11 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_sediment; c_sat_polynomial_coeffs = c_sat_poly_sediment; Td_polynomial_coeffs = Td_poly_sediment; + pressure = pressure > pressure_cutoffs[3] ? pressure_cutoffs[3] : pressure; } + double inv_pressure = 1/pressure; + // Calculate the c_sat value from Tian et al., 2019 if (lithology == sediment) { diff --git a/source/world_builder/features/subducting_plate_models/composition/water_content.cc b/source/world_builder/features/subducting_plate_models/composition/water_content.cc index 38269d375..b10b0a0b9 100644 --- a/source/world_builder/features/subducting_plate_models/composition/water_content.cc +++ b/source/world_builder/features/subducting_plate_models/composition/water_content.cc @@ -74,7 +74,7 @@ namespace WorldBuilder prm.declare_entry("initial water content", Types::Double(5), "The value of the initial water content (in wt%) for the lithology at the trench. This is essentially the " "max value applied to this lithology."); - prm.declare_entry("operation", Types::String("replace", std::vector {"replace", "replace defined only", "add", "subtract"}), + prm.declare_entry("operation", Types::String("add", std::vector {"replace", "replace defined only", "add", "subtract"}), "Whether the value should replace any value previously defined at this location (replace) or " "add the value to the previously define value. Replacing implies that all compositions not " "explicitly defined are set to zero. To only replace the defined compositions use the replace only defined option."); @@ -97,9 +97,9 @@ namespace WorldBuilder double WaterContent::calculate_water_content(double pressure, double temperature, - std::string lithology_str) const + std::string lithology_string) const { - double inv_pressure = 1/pressure; + pressure = pressure <= 0.5 ? 0.5 : pressure; double ln_LR_value = 0; double ln_c_sat_value = 0; double Td_value = 0; @@ -114,15 +114,16 @@ namespace WorldBuilder MORB, sediment }; + LithologyName lithology = peridotite; - if (lithology_str=="peridotite") + if (lithology_string=="peridotite") lithology = peridotite; - else if (lithology_str=="gabbro") + else if (lithology_string=="gabbro") lithology = gabbro; - else if (lithology_str=="MORB") + else if (lithology_string=="MORB") lithology = MORB; - else if (lithology_str=="sediment") + else if (lithology_string=="sediment") lithology = sediment; if (lithology == peridotite) @@ -130,6 +131,7 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_peridotite; c_sat_polynomial_coeffs = c_sat_poly_peridotite; Td_polynomial_coeffs = Td_poly_peridotite; + pressure = pressure > pressure_cutoffs[0] ? pressure_cutoffs[0] : pressure; } if (lithology == gabbro) @@ -137,6 +139,7 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_gabbro; c_sat_polynomial_coeffs = c_sat_poly_gabbro; Td_polynomial_coeffs = Td_poly_gabbro; + pressure = pressure > pressure_cutoffs[1] ? pressure_cutoffs[1] : pressure; } if (lithology == MORB) @@ -144,6 +147,7 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_MORB; c_sat_polynomial_coeffs = c_sat_poly_MORB; Td_polynomial_coeffs = Td_poly_MORB; + pressure = pressure > pressure_cutoffs[2] ? pressure_cutoffs[2] : pressure; } if (lithology == sediment) @@ -151,8 +155,11 @@ namespace WorldBuilder LR_polynomial_coeffs = LR_poly_sediment; c_sat_polynomial_coeffs = c_sat_poly_sediment; Td_polynomial_coeffs = Td_poly_sediment; + pressure = pressure > pressure_cutoffs[3] ? 1.0 : pressure; } + double inv_pressure = 1/pressure; + // Calculate the c_sat value from Tian et al., 2019 if (lithology == sediment) {