From 4704f4500a07c8b3fcb8c05800d0169caa4504c7 Mon Sep 17 00:00:00 2001 From: Haoyuan Li Date: Sat, 2 Nov 2024 00:18:25 -0700 Subject: [PATCH] follow --- ...aterial_table_temperature_pressure_small.txt | 10 +++++----- source/material_model/utilities.cc | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/data/material-model/entropy-table/pyrtable/material_table_temperature_pressure_small.txt b/data/material-model/entropy-table/pyrtable/material_table_temperature_pressure_small.txt index 80644a34816..6c440a8238f 100644 --- a/data/material-model/entropy-table/pyrtable/material_table_temperature_pressure_small.txt +++ b/data/material-model/entropy-table/pyrtable/material_table_temperature_pressure_small.txt @@ -1,8 +1,8 @@ # This is a data output from HeFESTo # Independent variables are T(K) and P(bar) # POINTS: 2 2 -T(K) P(bar) s,J/K/kg rho,kg/m3 alpha,1/K cp,J/K/kg vp,km/s vs,km/s h,J/kg -250.0 0.0 509.74740059944844 3332.8967443100287 1.9781287327429287e-05 748.5636509347647 8.116376883289359 4.7495273882440685 -13445454.390915 -4000.0 0.0 3804.799798825367 2879.31713365359 0.00012376961201237974 1865.6003296108431 5.89690417370827 3.068046128481904 -8401781.805825338 -250.0 1500000.0 198.7646619931198 5836.877132241759 3.4121952803538903e-06 376.4469624433934 14.555814776451808 7.855984247196738 16942560.667925145 -4000.0 1500000.0 3001.438264292299 5612.196624661615 1.174389488674247e-05 1244.420157015243 14.133650137979814 7.318949741082264 21273542.53213353 +T(K) P(bar) s,J/K/kg rho,kg/m3 alpha,1/K cp,J/K/kg vp,km/s vs,km/s h,J/kg maph,1 +250.0 0.0 509.74740059944844 3332.8967443100287 1.9781287327429287e-05 748.5636509347647 8.116376883289359 4.7495273882440685 -13445454.390915 0.0 +4000.0 0.0 3804.799798825367 2879.31713365359 0.00012376961201237974 1865.6003296108431 5.89690417370827 3.068046128481904 -8401781.805825338 0.0 +250.0 1500000.0 198.7646619931198 5836.877132241759 3.4121952803538903e-06 376.4469624433934 14.555814776451808 7.855984247196738 16942560.667925145 1.0 +4000.0 1500000.0 3001.438264292299 5612.196624661615 1.174389488674247e-05 1244.420157015243 14.133650137979814 7.318949741082264 21273542.53213353 1.0 diff --git a/source/material_model/utilities.cc b/source/material_model/utilities.cc index e3296d9c96b..551c8a6f057 100644 --- a/source/material_model/utilities.cc +++ b/source/material_model/utilities.cc @@ -1170,7 +1170,7 @@ namespace aspect for (unsigned i = 0; i < material_file_names.size(); ++i) { material_lookup - .push_back(std::make_unique>(7,1.0)); + .push_back(std::make_unique>(8,1.0)); material_lookup[i]->load_file(data_directory+material_file_names[i], this->get_mpi_communicator()); @@ -1187,7 +1187,20 @@ namespace aspect // the percentage of material that has undergone the transition double function_value; - function_value = 0.0; + // lookup the most abundant phase + + // Convert pressure from Pa to bar, bar is used in the table. + Point<2> temperature_pressure(in.temperature, in.pressure / 1.e5); + + const unsigned maph = unsigned(material_lookup[0]->get_data(temperature_pressure, 7)); + + // Convert pressure from Pa to bar, bar is used in the table. + + // determine the value + if (in.phase_index < maph) + function_value = 1.0; + else + function_value = 0.0; return function_value; }