Skip to content

Commit

Permalink
Add cutoff pressures to Tian
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldouglas92 committed Aug 16, 2024
1 parent 199b8cd commit e118bf7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int> compositions;
Operations operation;
Expand All @@ -118,6 +118,10 @@ namespace WorldBuilder
std::vector<double> LR_poly_sediment = {-2.03283, 10.8186, -21.2119, 18.3351, -6.48711, 8.32459};
std::vector<double> c_sat_poly_sediment = {-0.150662, 0.301807, 1.01867};
std::vector<double> 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<double> pressure_cutoffs {10, 26, 16, 1.0};
};
} // namespace Composition
} // namespace OceanicPlateModels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int> compositions;
Operations operation;
std::string lithology_str;
Expand All @@ -115,6 +115,10 @@ namespace WorldBuilder
std::vector<double> LR_poly_sediment = {-2.03283, 10.8186, -21.2119, 18.3351, -6.48711, 8.32459};
std::vector<double> c_sat_poly_sediment = {-0.150662, 0.301807, 1.01867};
std::vector<double> 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<double> pressure_cutoffs {10, 26, 16, 1.0};
};
} // namespace Composition
} // namespace SubductingPlateModels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -121,43 +121,49 @@ 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)
{
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)
{
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)
{
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)
{
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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> {"replace", "replace defined only", "add", "subtract"}),
prm.declare_entry("operation", Types::String("add", std::vector<std::string> {"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.");
Expand All @@ -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;
Expand All @@ -114,45 +114,52 @@ 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)
{
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)
{
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)
{
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)
{
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)
{
Expand Down

0 comments on commit e118bf7

Please sign in to comment.