diff --git a/CMakeLists.txt b/CMakeLists.txt index f2a57a2..06f245d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.16...4.2) # Set the name of the project -project(xGEMS VERSION 2.0.2 LANGUAGES CXX) +project(xGEMS VERSION 2.1.0 LANGUAGES CXX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_MACOSX_RPATH ON) @@ -23,8 +23,8 @@ include(CondaAware) # Set the version of the project set(XGEMS_VERSION_MAJOR "2") -set(XGEMS_VERSION_MINOR "0") -set(XGEMS_VERSION_MICRO "2") +set(XGEMS_VERSION_MINOR "1") +set(XGEMS_VERSION_MICRO "0") set(XGEMS_VERSION "${XGEMS_VERSION_MAJOR}.${XGEMS_VERSION_MINOR}.${XGEMS_VERSION_MICRO}") # Set the output directories of the built libraries and binaries diff --git a/demos/demo.pro b/demos/demo.pro index 268b816..bba43f2 100644 --- a/demos/demo.pro +++ b/demos/demo.pro @@ -19,7 +19,7 @@ DEFINES += USE_THERMOFUN DEFINES += USE_THERMO_LOG #DEFINES += OVERFLOW_EXCEPT #compile with nan inf exceptions -#GEMS3K_CPP = ../../standalone/GEMS3K +#GEMS3K_CPP = ../../GEMS3K/GEMS3K #GEMS3K_H = $$GEMS3K_CPP #DEPENDPATH += $$GEMS3K_H #INCLUDEPATH += $$GEMS3K_H diff --git a/demos/demo1-dict.cpp b/demos/demo1-dict.cpp index c169cd9..2db4bad 100644 --- a/demos/demo1-dict.cpp +++ b/demos/demo1-dict.cpp @@ -19,20 +19,92 @@ #include #include #include -using namespace std; // xGEMS includes #include "xGEMS/ChemicalEngineMaps.hpp" +#include -void print_map(const std::string title, const xGEMS::ValuesMap& data) +template +void print_map(const std::string title, const std::map& data) { std::cout << "\n" << title << std::endl; for(const auto& sp: data) { std::cout<< sp.first << ":" << sp.second << std::endl; } } +static void demo_dict(); +static void demo_warnings_map(); +static void demo_warnings(); + int main(int argc, char **argv) +{ + //demo_dict(); + //demo_warnings_map(); + demo_warnings(); + return 0; +} + +void demo_warnings_map() +{ + + auto engine = xGEMS::ChemicalEngineMaps("resources/solvus2/series1-dat.lst"); + std::cout << engine.equilibrate() << std::endl; + + print_map("engine.species_molar_mass()", engine.species_molar_mass()); + + print_map("engine.element_molar_masses()", engine.element_molar_masses()); + + print_map("engine.phases_moles()", engine.phases_moles()); + +} + +void demo_warnings() +{ + + xGEMS::ChemicalEngine engine("resources/solvus2/series1-dat.lst"); + + auto T = engine.temperature(); + auto P = engine.pressure(); + auto b = engine.elementAmounts(); + engine.equilibrate(T, P, b); + + // Test setPT + bool no_error = engine.setPT(101325, 298.15); + std::cout << (no_error ? "PT set correctly" : "PT error") << std::endl; + no_error = engine.setPT(50000000, 673.15); + std::cout << (no_error ? "PT set correctly" : "PT error") << std::endl; + + //Test long names + auto ispecies1 = engine.indexSpecies("Anorthite_long_substance_name"); + auto ispecies2 = engine.indexSpecies("Anorthite_long_substance_name", "Plagioclase"); + auto ispecies3 = engine.indexSpecies("Anorthite"); + std::cout << ispecies1 << " " << ispecies2 << " " <. + +from xgems import * +from numpy import * + +#connect all loggers +update_loggers(True, "test_demo1.log", 3) + +engine = ChemicalEngine("resources/solvus2/series1-dat.lst") + +T = engine.temperature() +P = engine.pressure() +b = engine.elementAmounts() + +engine.equilibrate(T, P, b) + +# SetPT test +print("setPT(101325, 298.15)", engine.setPT(101325, 298.15) ) +print("setPT(50000000, 673.15)", engine.setPT(50000000, 673.15) ) + +# long names +ispecies1 = engine.indexSpecies("Anorthite_long_substance_name") +ispecies2 = engine.indexSpecies("Anorthite_long_substance_name", "Plagioclase") +ispecies3 = engine.indexSpecies("Anorthite") +print(ispecies1, " ",ispecies2, " ",ispecies3, " ") + +print(engine.speciesName(ispecies1), " ", engine.speciesName(ispecies2), " ",engine.speciesName(ispecies3)) + +iphase1= engine.indexPhase("Kaolinite_long_phase_name"); +print(iphase1, " ", engine.phaseName(iphase1)) +iphase2= engine.indexPhase("Kaolinite"); +print(iphase2, " ", engine.phaseName(iphase2)) + +#indexSpecies dependen on phase optional +print(engine.speciesAmount(ispecies1), " ", engine.speciesAmount(ispecies2)) +engine.setSpeciesAmount("Anorthite_long_substance_name", 10) +engine.setSpeciesAmount("Anorthite_long_substance_name", 20, "Plagioclase") +print(engine.speciesAmount(ispecies1), " ", engine.speciesAmount(ispecies2)) + +print("Albite indexes\n", engine.indexSpeciesMap("Albite")) +print("Quartz indexes\n", engine.indexSpeciesMap("Quartz")) + +# warning messages required +print(engine.phaseSpecificVolume(2)) +print(engine.phaseSpecificVolume(30)) +print(engine.phaseSpecificVolume(-1)) diff --git a/demos/resources/solvus2/series1-dat.lst b/demos/resources/solvus2/series1-dat.lst new file mode 100644 index 0000000..d91c507 --- /dev/null +++ b/demos/resources/solvus2/series1-dat.lst @@ -0,0 +1 @@ +-j "series1-dch.json" "series1-ipm.json" "series1-dbr-0-0000.json" \ No newline at end of file diff --git a/demos/resources/solvus2/series1-dat.lst.txt b/demos/resources/solvus2/series1-dat.lst.txt new file mode 100644 index 0000000..3c301ff --- /dev/null +++ b/demos/resources/solvus2/series1-dat.lst.txt @@ -0,0 +1,367 @@ + +Node:0:time:0:dt:0 + + +2 2 -5 1 130 1 0 13000 1 7000 + +1000 1e-13 1e-20 4e-05 0.01 0.01 1e-05 1e-05 1e-05 1e-05 1e-05 1e-05 1e-06 1e-17 1 0 1 1000 0.001 12.05 1e-13 1e-13 1e-33 1e-20 1e-05 1e-10 0.001 1e-10 + +9 9 60 42 35 0 0 0 21 3 0 5 3 0 81 1 2 1 1 0 1 0 0 0 0 0 0 2 0 2 81 0 0 0 0 0 0 0 0 + +400 400 673.15 673.15 500 500 0 49.3869647066202 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 5.84399917022432 1000 0.095789528986145 -247.894235284192 0.14460194555862 5.14732918802631 -2.8794431718465 -0.383826099593121 1e-13 1e-20 55.50837344 0 3.999996e-05 4e-05 6.21460809842219 5596.9124065 +17.2390243034617 0.555080801143299 4.01653388216503 0.0206245407531976 1.66e-24 4.55369833889275 3.32464529023611 27.7891398150404 85.1800863163369 0 0 1 1 + +1e-13 1e-13 1e-33 1e-20 1e-05 1e-05 1e-05 1e-05 1e-05 1e-05 1e-06 1 + +12.2630928233121 -0.109834958358815 -0.000165819390393567 0.0129109578062983 0 + +12.2630928333529 -0.109834958217768 -0.000165819387514881 0.0129109577680876 0 + +0.577991203938277 -0.00282639549712378 -2.66530537457313e-05 0.000411925579847386 0 + +0.577991204258629 -0.00282639549109626 -2.66530535870405e-05 0.000411925578483688 0 +Error Code +Error Message + +36 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + +0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 + +0 1 2 3 4 5 6 7 8 + +0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 +40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 + +1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 +1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +-285.766012206448 29.7748067950671 -386.35645617081 -1672.01981593256 -940.621522503403 -705.736025403141 -255.966239312319 48.9953699214242 -327.78644810367 -233.944169472753 -85.8839498987396 51.7446856524092 54.6948198329714 28.2764486776203 -170.307983086851 56.5314700313038 40.2950583072279 28.9363020766455 16.792988120537 -702.90556521368 -35.068983424635 -663.350412985774 93.0237009571521 -523.474116753637 168.694330139116 -396.842820571131 -352.004164446705 -635.263428297151 47.1343353823106 102.49971070309 173.81678787308 100.12729722517 -701.521861134173 -817.627093756841 0 31.1688147293263 101.32187482655 101.311541033942 109.634493307496 101.32187482655 +101.311541033942 109.634493307496 98.2511231864014 51.9360060661386 20.7038768194301 26.1195517606584 28.4215908233738 60.941844123644 61.0460657392688 100.278285099932 44.4844001885621 90.525606705678 55.5145565219996 23.1623790411208 50.1424316067025 14.0781940532671 39.2650122657552 53.8028309830979 27.0081361566848 40.2731851592315 + +500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 +500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 + +60.996200799942 78.0035508871079 95.0109009742737 26.9815006256104 43.9888507127762 40.0779991149902 75.5309982299805 110.983997344971 117.169650197029 57.0853492021561 39.0983009338379 98.0786018371582 74.5513000488281 56.1056510210037 22.9897994995117 118.000700473785 58.442798614502 100.081450581551 39.9971495866775 77.0916510820389 60.084300994873 51.4523992538452 52.4603492021561 67.4517993927002 68.4597493410111 83.4511995315552 99.4505996704102 35.4529991149902 36.4609490633011 2.0158998966217 31.99880027771 34.0147001743317 33.0067502260208 17.0073500871658 1.00794994831085 18.0153000354767 262.223003387451 278.207202911377 278.331504821777 262.223003387451 +278.207202911377 278.331504821777 220.154002428055 162.045502662659 60.084300994873 60.084300994873 58.442798614502 202.138702392578 158.162902832031 258.160403728485 162.045502662659 218.247203826904 142.054401397705 60.084300994873 162.045502662659 60.084300994873 74.5513000488281 180.060802698135 60.084300994873 116.161700248718 + +26.9815006256104 40.0779991149902 35.4529991149902 1.00794994831085 39.0983009338379 22.9897994995117 15.999400138855 28.0855007171631 0 + +1 0 0 2 0 0 2 0 1 1 0 0 3 0 0 3 0 0 1 0 0 4 0 0 4 0 -1 1 0 0 0 0 0 0 0 3 1 0 0 1 +0 0 1 0 2 0 1 0 0 0 0 0 0 2 0 1 1 0 0 0 0 0 1 0 1 2 0 0 0 0 0 0 0 1 0 1 0 0 3 1 +1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 2 0 0 0 0 1 0 1 0 0 0 0 0 0 0 +1 1 0 1 0 0 0 0 0 0 0 1 0 0 1 1 0 0 4 0 1 4 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 3 +1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 3 1 -1 0 0 0 0 0 0 2 1 0 0 0 1 0 0 0 1 0 -1 0 0 +1 1 0 0 1 0 0 0 0 1 0 0 0 2 0 -1 0 0 1 1 0 0 2 0 0 0 0 1 0 0 0 3 0 -1 0 0 1 0 0 0 +4 0 -1 0 0 1 0 0 0 0 0 -1 0 0 1 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 +0 0 2 0 0 2 0 0 0 0 0 1 0 0 2 0 -1 0 0 0 1 0 0 1 0 -1 0 0 0 1 0 0 0 0 1 0 0 0 2 0 +0 1 0 0 1 0 0 0 0 1 8 3 0 2 1 0 0 0 0 8 2 0 1 0 0 0 1 0 8 3 0 1 0 0 0 0 1 8 3 0 +2 1 0 0 0 0 8 2 0 1 0 0 0 1 0 8 3 0 1 0 0 2 0 1 7 2 0 2 0 0 0 0 0 5 1 0 0 0 0 0 +0 0 2 1 0 0 0 0 0 0 0 2 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 6 2 0 1 0 0 0 1 0 4 1 +0 2 0 0 4 0 0 9 2 0 2 0 0 0 0 0 5 1 0 1 0 0 0 1 0 6 2 0 1 0 0 0 0 1 4 1 0 0 0 0 +0 0 0 2 1 0 2 0 0 0 0 0 5 1 0 0 0 0 0 0 0 2 1 0 0 0 1 0 1 0 0 0 0 2 0 0 2 0 0 6 +1 0 0 0 0 0 0 0 2 1 0 0 1 0 0 0 0 3 1 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +-155.013191186437 -199.264566963682 -238.460203496966 -52.2861802881108 -104.469204574019 -87.7247154878058 -120.131051961839 -145.850744136812 -278.984751556283 -125.495629809958 -53.2596246078204 -203.77031282744 -78.6924982139691 -79.9770278096138 -47.6268032129195 -295.991014840672 -74.4797460717546 -231.718018663775 -73.9612937452897 -173.859402268656 -149.294744212428 0.0746828392903924 -21.2882060236086 4.66672530908408 -11.0016459499788 -4.92921474481342 -7.44326409101556 -16.9285691040988 -24.0475554230211 -1.13100972481049 -6.62739239776165 -31.1527816869369 -3.11713717701559 -17.0459015911871 4.01653388216503 -49.2440841737175 -683.926693202287 -736.249360469905 -690.789108118911 -683.926693202287 +-736.249360469905 -690.789108118911 -574.308665571895 -446.454522303287 -156.213966081767 -156.950104841692 -74.8542625918671 -523.241516019767 -371.110630952591 -700.02044541111 -446.176132311568 -530.531033618223 -365.953917742361 -157.247293183519 -446.252736270172 -148.979466005084 -79.8405915515162 -492.769703522517 -157.019191045857 -284.960995328881 + +-155.013191186437 -199.264566963682 -238.460203496966 -52.2861802881108 -104.469204574019 -87.7247154878058 -120.131051961839 -145.850744136812 -278.984751556283 -125.495629809958 -53.2596246078204 -203.77031282744 -78.6924982139691 -79.9770278096138 -47.6268032129195 -295.991014840672 -74.4797460717546 -231.718018663775 -73.9612937452897 -173.859402268656 -149.294744212428 0.0746828392903924 -21.2882060236086 4.66672530908408 -11.0016459499788 -4.92921474481342 -7.44326409101556 -16.9285691040988 -24.0475554230211 -1.13100972481049 -6.62739239776165 -31.1527816869369 -3.11713717701559 -17.0459015911871 4.01653388216503 -49.2440841737175 -683.926693202287 -736.249360469905 -690.789108118911 -683.926693202287 +-736.249360469905 -690.789108118911 -574.308665571895 -446.454522303287 -156.213966081767 -156.950104841692 -74.8542625918671 -523.241516019767 -371.110630952591 -700.02044541111 -446.176132311568 -530.531033618223 -365.953917742361 -157.247293183519 -446.252736270172 -148.979466005084 -79.8405915515162 -492.769703522517 -157.019191045857 -284.960995328881 + +-1.02611258153635 -0.0108514486476181 -1.02611258153635 -9.14820164464621 -4.07189598020255 -4.07189598020255 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -1.02611258153635 -1.02611258153635 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -1.02611258153635 -1.02611258153635 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -1.02611258153635 -1.02611258153635 -1.02611258153635 0.00126824538911275 2.14550620875745 6.37185145012339 0.0231086251328513 0.00340661922802799 +0.773599670288198 3.63243523325193 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +-1.04673712228802 -0.0314759893992879 -1.04673712228802 -9.16882618539788 -4.09252052095422 -4.09252052095422 -1.04673712228802 -0.0314759893992879 -1.04673712228802 -1.04673712228802 -1.04673712228802 -0.0314759893992879 -0.0314759893992879 -0.0314759893992879 -1.04673712228802 -0.0314759893992879 -0.0314759893992879 -0.0314759893992879 -0.0314759893992879 -1.04673712228802 -0.0314759893992879 -1.04673712228802 -0.0314759893992879 -1.04673712228802 -0.0314759893992879 -1.04673712228802 -1.04673712228802 -1.04673712228802 -0.0314759893992879 -0.0314759893992879 -0.0314759893992879 -0.0314759893992879 -1.04673712228802 -1.04673712228802 -1.04673712228802 0.00170257491738546 2.14550620875745 6.37185145012339 0.0231086251328513 0.00340661922802799 +0.773599670288198 3.63243523325193 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0.29442571790996 1.78324960377229e-08 0.01 1.11026667785195 0.0872223855045395 0.178347345796736 3.15066041476453 1.01307661056411 0 + +-86.373480502319 -108.981958645742 -30.5145543047713 -5.22200054232318 -55.1321688541345 -48.1920082486158 -38.8200893701638 -79.6071144429484 -6.63016293740676 + +-86.373480502319 -86.3734805525829 -108.981958645742 -108.98195637927 -30.5145543047713 -30.5145569155526 -5.22200054232318 -5.2220005589866 -55.1321688541345 -55.1321755943379 -48.1920082486158 -48.192004836916 -38.8200893701638 -38.8200893352187 -79.6071144429484 -79.6071145127222 -6.63016293740676 -6.63016486768891 + +-3.08097976288637e-06 -2.18322516968387e-06 1.03171837918489e-06 -1.02815695626862e-06 -1.03171838054661e-06 -1.03171836850443e-06 2.05631392937389e-06 -4.11260443398388e-06 1.03171859249918e-06 + +-483424.804616015 -609962.476429021 -170787.287567193 -29227.0796220783 -308569.919856958 -269726.448860828 -217272.639817308 -445554.046471403 -37108.4412014883 + +6.22861673728642e-17 0 -3.7889738046237e-19 -1.66096446327638e-16 -6.48814243467335e-18 0 1.66096446327638e-16 0 -4.89857921856136e-20 + +0.566770175729462 0.0931744471929803 0.162399710020344 0 0.0194255837448217 0 0 0 0 0 0 0 0 0 0.226735202292314 0 0 0 0 0 0 + +0.56677017572944 0.0931744471929923 0.162399710020337 0 0.019425583292457 0 0 0 0 0 0 0 0 0 0.22673520208625 0 0 0 0 0 0 + +3.55350428238655e-10 3.08413635095867e-07 -1.76884897644245e-07 -0.719052139409618 2.12027373869277e-09 -0.448768257254383 -0.129067256567927 -1.67303261244899 -1.50211075429386 -2.29415639516028 -0.959595796187578 -0.120903234849457 -1.35038694036197 -1.51961503423066 1.05511311143631e-10 -0.087634558404711 -3.59067171335983 -2.52157091305552 -1.28069500386576 -0.099063499385681 -8.72425774391333 + +7.19391365234115e-12 2.4343210707881e-09 3.99903391227158e-08 1.84567548980301e-20 2.99606111324497e-16 3.25844585853158e-14 7.78534606393218e-12 1.76773377651494e-11 5.17603414490138e-17 2.21896396560158e-15 0.000307861647889097 1.15507644151822e-07 0.0005247238519488 2.52848680588758e-09 0.00113795546302765 2.17460495363025e-07 0.00802469845599351 1.06066173052874e-08 6.3728472331301e-09 1.40536032432992e-09 0.000193358682022468 8.24877911556822e-28 4.03574035361822e-24 0 0 0 0 0.00144596825286761 4.60939605005968e-06 4.96056377387062e-05 7.93689399079162e-32 1.0354276657432e-25 2.67698085397109e-32 2.16860962022365e-09 1.94691212633305e-07 0.555080801143299 0.0106771728566372 3.77647194981908e-11 0.0824972742985784 0.158507284581118 +1.77692337792127e-08 0.0038924076699923 0 0.0194255837448217 0 0 0 0 0 0 0 0 0 0.226735202292314 0 0 0 0 0 0 + +7.19391365234115e-12 2.4343210707881e-09 3.99903391227158e-08 1.84567548980301e-20 2.99606111324497e-16 3.25844585853158e-14 7.78534606393218e-12 1.76773377651494e-11 5.17603414490138e-17 2.21896396560158e-15 0.000307861647889097 1.15507644151822e-07 0.0005247238519488 2.52848680588758e-09 0.00113795546302765 2.17460495363025e-07 0.00802469845599351 1.06066173052874e-08 6.3728472331301e-09 1.40536032432992e-09 0.000193358682022468 8.24877911556822e-28 4.03574035361822e-24 0 0 0 0 0.00144596825286761 4.60939605005968e-06 4.96056377387062e-05 7.93689399079162e-32 1.0354276657432e-25 2.67698085397109e-32 2.16860962022365e-09 1.94691212633305e-07 0.555080801143299 0.0106771728566372 3.77647194981908e-11 0.0824972742985784 0.158507284581118 +1.77692337792127e-08 0.0038924076699923 0 0.0194255837448217 0 0 0 0 0 0 0 0 0 0.226735202292314 0 0 0 0 0 0 + +7.19391365234115e-12 2.4343210707881e-09 3.99903391227158e-08 1.84567548980301e-20 2.99606111324497e-16 3.25844585853158e-14 7.78534606393218e-12 1.76773377651494e-11 5.17603414490138e-17 2.21896396560158e-15 0.000307861647889094 1.15507644151822e-07 0.0005247238519488 2.52848680588759e-09 0.0011379554630276 2.17460495363025e-07 0.00802469845599339 1.06066173052874e-08 6.37284723313012e-09 1.40536032432992e-09 0.000193358682022319 8.24877911556822e-28 4.03574035361822e-24 0 0 0 0 0.00144596825286769 4.60939605004673e-06 4.96056386045536e-05 7.93689399079162e-32 1.0354276657432e-25 2.67698085397109e-32 2.16860962022365e-09 1.94691212633282e-07 0.555080801142411 0.0106771728566371 3.77647194981908e-11 0.0824972742985905 0.158507284581111 +1.77692337792192e-08 0.00389240766999232 0 0.019425583292457 0 1.6635215447886e-11 0 0 0 0 3.48409732481595e-11 0 0 0.22673520208625 4.17455624284701e-10 0 0 0 1.8998911175509e-10 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +1.06873548648648e-26 6.05765777084843e-22 -3.29952021546392e-21 1.41398418100303e-43 2.78982073988559e-35 -3.72403698714409e-30 -2.125933055092e-25 -1.09604461911388e-24 -9.67451608725398e-36 -1.77835298392084e-32 5.88206172351146e-16 -2.74575551958013e-20 -1.09781478916314e-17 -6.66688177991237e-22 8.49313627457216e-15 -9.72564890431601e-20 2.01385114368002e-14 -1.16543412832451e-20 -4.23513167837786e-21 -2.04614687575785e-22 2.56437943479211e-14 4.09683459116907e-56 9.82351888925203e-49 0 0 0 0 -1.30592181432885e-14 2.21559975435285e-15 -1.48160082978524e-10 7.58578066299028e-64 6.45518449540951e-52 4.30731653723232e-65 -4.90444621714938e-22 3.95295590259861e-18 1.51896430117333e-10 5.50336383703553e-15 -5.00618252985362e-24 -2.07119527591438e-12 1.21286965464877e-12 +-1.10833629665812e-18 -4.6108233805147e-15 0 7.74067052164112e-08 0 0 0 0 0 0 0 0 0 3.52608547529548e-08 0 0 0 0 0 0 + +1.26928276363719e-11 4.29507619805553e-09 7.05583582760042e-08 3.25649441013947e-20 5.28621095295552e-16 5.74916260545702e-14 1.37363449058557e-11 3.11896011637034e-11 9.13251868883086e-17 3.91510742831823e-15 0.000543185770911637 2.03799627930066e-07 0.000925813048740552 4.46121707420022e-09 0.00200779139581569 3.83683887121005e-07 0.0141586465590746 1.87141493751704e-08 1.12441518133218e-08 2.47959683272894e-09 0.00034115888228191 1.45540185790341e-27 7.12059183198736e-24 2.03860769133178e-46 3.35559283089132e-45 4.14425908683205e-59 7.07838350628361e-75 0.00255124383640369 8.13273970398992e-06 8.75233760949737e-05 1.40037265499553e-31 1.82689170460419e-25 4.72322556455406e-32 3.82626252388072e-09 3.43510094037837e-07 0.979375458579096 0.114594310555292 4.05318358676438e-10 0.88540639918828 0.976031479300265 +1.09416691502576e-07 0.0239680039905975 0.190962398408021 1.00000000488211 0.355821136708889 0.742904079912088 0.0212308502731988 0.0314694567394238 0.00507976480601025 0.109749917843989 0.757001543740752 0.0446285790788294 0.0302262984205056 1.00000000024295 0.817269782236609 0.000256642328317519 0.00300904780136934 0.052396827961505 0.796042950287905 1.88687120152586e-09 + +-25.0899840350387 -19.2657965405603 -16.466825692582 -44.8710505774021 -35.1762597646575 -30.4871370915466 -25.0109758830202 -24.1909363727037 -36.9321050548045 -33.1739336256609 -7.51805917699728 -15.4061285418215 -6.98483823490978 -19.2278442215492 -6.21071996909521 -14.773446834005 -4.25742977727107 -17.7939859481234 -18.3034176822749 -19.815169857433 -7.98316225874716 -61.7945154573506 -53.2990513874176 -105.206647207131 -102.405700729205 -134.430796462692 -170.736836411238 -5.97117425975546 -11.7196127042113 -9.34360464490922 -71.0433994994747 -56.9620113241961 -72.1302310272906 -19.3813773525268 -14.8840493398705 -0.0208401976354886 -2.16635712204828 -21.6263482868078 -0.12170853125564 -0.0242604397077542 +-16.0281023854469 -3.73103550515045 -1.65567873729006 4.88211070378072e-09 -1.03332709936286 -0.297188340966946 -3.85229995351793 -3.45873783086309 -5.28249031649301 -2.20955097560127 -0.278389986259117 -3.1093808386513 -3.49904292490916 2.42948772181581e-10 -0.201786027813804 -8.26782716101774 -5.80613159532903 -2.94890922457324 -0.228102136945294 -20.0883458285727 + +1.51534021958973e-18 1.73514361023433e-13 4.68263042765468e-11 9.97448309546558e-36 2.62833697330971e-27 3.10885686650564e-23 1.77474333080425e-18 9.1498385118409e-18 7.8446572665662e-29 1.44171762624853e-25 0.00277517828226526 3.90661992969003e-10 0.00806197265663943 1.87197951644405e-13 0.0379166743840333 1.38465141805995e-09 1.88554608962724 3.2940751873646e-12 1.18917761262232e-12 5.78302521403695e-14 0.00109473010954676 1.99231982900917e-50 4.76898705464401e-43 0 0 0 0 0.0612205496585558 6.22110826611594e-07 7.20512962905123e-05 1.84450938026277e-58 3.13920182630936e-46 2.09831284382983e-59 1.37702704155431e-13 1.1098707579068e-09 9021.77769900914 3.33804553176884 4.17592062743599e-17 199.277794625121 735.661724575201 +9.24521704062994e-12 0.443625342989096 0 11.0491239431236 0 0 0 0 0 0 0 0 0 1505.28111646411 0 0 0 0 0 0 + +-181.087823569324 -218.499750219951 -255.911678040329 -106.263973775638 -143.675898088065 -122.242286928396 -146.126676430241 -170.011067101712 -316.901505592659 -159.654212409503 -61.7623312883225 -219.145827269429 -85.646721959962 -99.1742579391415 -54.8221719025706 -310.733848790049 -78.7065625739514 -249.481391736246 -92.2340985530898 -194.659220986526 -157.247293166154 -62.7044811705667 -74.5566438035934 0 0 0 0 -23.884391824153 -35.7365544571734 -10.4440010899093 -77.6401786758313 -88.0841797827468 -76.2320171497868 -37.4119278033703 -11.8521637857037 -49.2640904540334 -683.947555346658 -751.503879208211 -690.887707373509 -683.947546691713 +-751.5038637581 -690.887704878922 0 -446.454522303287 0 -156.950104841692 0 0 0 0 -446.176132311568 0 0 -157.247293183519 -446.252736270172 0 0 0 -157.019191045857 0 + +-1.02611258153635 -0.0108514486476181 -1.02611258153635 -9.14820164464621 -4.07189598020255 -4.07189598020255 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -1.02611258153635 -1.02611258153635 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -0.0108514486476181 -1.02611258153635 -1.02611258153635 -1.02611258153635 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -0.0108514486476181 -1.02611258153635 -1.02611258153635 -1.02611258153635 0.00126824538911275 2.14550620875745 6.37185145012339 0.0231086251328513 0.00340661922802799 +0.773599670288198 3.63243523325193 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +16.5129735411707 10.1263780424818 16.4869991902986 0 1.00888723520935 0 0 0 0 0 0 0 0 0 5.25172669745979 0 0 0 0 0 0 + +10.6094426698081 25.761390843879 42.6476408493477 0 3.14782848244522 0 0 0 0 0 0 0 0 0 13.6232261406648 0 0 0 0 0 0 + +-9.57971030879131 -6.60937544092877 -5.83472022409407 -21.6978973738563 -15.2828913334498 -13.2464312315556 -9.54539750434442 -8.74833649262502 -14.7226781216928 -13.0905250079735 -1.94832030654509 -4.93314292710228 -1.27582301631462 -6.59289295820686 -1.38055010257892 -4.65837275259714 -0.0913245732689292 -5.97017622222829 -6.19141961327612 -7.28888761839808 -1.70938963101752 -25.5202857663047 -21.3898302220877 -44.3739350328426 -42.716577055929 -57.065821792817 -72.8333346021886 -1.27651672284934 -3.33210944138334 -2.30022225227347 -29.0961026921046 -22.9806335100592 -30.0090300048395 -7.10049392722677 -5.14732918802631 -0.00868861746385326 -0.00905670709984018 -6.62494647532001 -0.0428212307086267 -0.00905670709984018 +-6.62494647532001 -0.0428212307086267 -0.719052139407759 2.1202737394587e-09 -0.448768257253222 -0.129067256567593 -1.67303261244466 -1.50211075428998 -2.29415639515434 -0.959595796185096 -0.120903234849144 -1.35038694035847 -1.51961503422673 1.05511310937004e-10 -0.0876345584044844 -3.59067171335055 -2.521570913049 -1.28069500386245 -0.0990634993854248 -8.72425774389077 + +4.13595148522145e-05 0.01789780042463 0.358126083392533 4.69384640953008e-14 1.24222628029217e-09 1.23090339708518e-07 5.54256220685422e-05 0.000184920326981605 5.71636163218878e-10 1.19393955729494e-08 1134.5428529822 1.06780616027587 3687.17250725476 0.0133713337031405 2465.85694919006 2.41864644325162 44204.5685529133 0.100054798231521 0.0240253641976803 0.010211803875061 1095.04538666027 4.00039370228931e-21 1.99554637155955e-17 0 0 0 0 4831.91368148906 15.840884372944 9.42556580034949 2.39382117931075e-25 3.31966180492121e-19 8.32828275309039e-26 0.003476365739597 0.0184966358571093 942.551601224706 0 0 0 0 +0 0 0 3286.19267237499 0 0 0 0 0 0 0 0 0 14222.0410569461 0 0 0 0 0 0 + +-181.0878232647 -218.49975023978 -255.91167721486 -106.263969314539 -143.675896289619 -122.242284520555 -146.12667588792 -170.011067255284 -316.901504678911 -159.654211495635 -61.7623317915413 -219.145828096781 -85.6467231589059 -99.1742587666215 -54.8221711860226 -310.733848400883 -78.7065625533872 -249.481391344379 -92.2340981611028 -194.659220158356 -157.247293183276 -62.7044807375284 -74.5566442172583 -101.524570107692 -113.376733587422 -140.344659477856 -179.16474884802 -23.8843913673646 -35.7365548470945 -10.4440010846464 -77.6401787403276 -88.0841798249739 -76.232016345244 -37.4119269750802 -11.8521634797299 -49.2640904548101 -683.94754704109 -751.503863497587 -690.887707646609 -683.94754704109 +-751.503863497587 -690.887707646609 -575.964344312625 -446.454522298405 -157.247293183276 -157.247293183276 -78.7065625533872 -526.700253857814 -376.393121280057 -702.229996391301 -446.454522298405 -533.640414463333 -369.452960674538 -157.247293183276 -446.454522298405 -157.247293183276 -85.6467231589059 -495.718612753215 -157.247293183276 -305.049341199181 + +1.2692823229596e-11 4.29507616143528e-09 7.0558298293036e-08 3.25647955527571e-20 5.28620107681017e-16 5.74914841688308e-14 1.37363368739579e-11 3.11896047501049e-11 9.1325097306674e-17 3.91510361805058e-15 0.000543186040960719 2.03799792399375e-07 0.00092581415610561 4.46122063962397e-09 0.00200778995042046 3.836837305053e-07 0.0141586463078536 1.87141415682928e-08 1.12441471094133e-08 2.47959470083468e-09 0.00034115888644565 1.4554010547488e-27 7.12059407223399e-24 0 0 0 0 0.00255124266375975 8.13274277201893e-06 8.75233734288528e-05 1.40037255499135e-31 1.82689158689508e-25 4.72322110196727e-32 3.82625923714588e-09 3.43509981594793e-07 0.97937545924833 0.114593358783475 4.05311978078856e-10 0.885406640811213 0.976031820261634 +1.09416659530899e-07 0.0239680703217062 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 + +-25.089984382225 -19.2657965490864 -16.4668265427009 -44.8710551390244 -35.1762616329436 -30.4871395594871 -25.0109764677391 -24.1909362577166 -36.9321060357133 -33.1739345988832 -7.51805867983953 -15.4061277348071 -6.98483703881042 -19.2278434223453 -6.2107206889886 -14.7734472421945 -4.25742979501436 -17.7939863652879 -18.3034181006176 -19.815170717208 -7.98316224654246 -61.7945160091946 -53.2990510728024 -54.7552246294886 -54.7552246294886 -54.7552246294886 -54.7552246294886 -5.97117471939173 -11.7196123269671 -9.34360467537103 -71.0433995708873 -56.9620113886275 -72.1302319721087 -19.3813782115207 -14.8840496672061 -0.0208401969521606 -2.16636542765931 -21.6263640291192 -0.12170825836073 -0.0242600903734177 +-16.0281026776481 -3.73103273766856 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0.365866033679079 1.00982100472631 0.365866033679079 0.000108628461986511 0.0174002372212245 0.0174002372212245 0.365866033679079 1.00982100472631 0.365866033679079 0.365866033679079 0.365866033679079 1.00982100472631 1.00982100472631 1.00982100472631 0.365866033679079 1.00982100472631 1.00982100472631 1.00982100472631 1.00982100472631 0.365866033679079 1.00982100472631 0.365866033679079 1.00982100472631 0.365866033679079 1.00982100472631 0.365866033679079 0.365866033679079 0.365866033679079 1.00982100472631 1.00982100472631 1.00982100472631 1.00982100472631 0.365866033679079 0.365866033679079 0.365866033679079 1.00083426366534 8.54636638799716 585.140184485182 1.02337769804821 1.00341242834993 +2.16755470972485 37.8047680383689 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.90775527898214 6.90775527898214 0 0 +0 6.90775527898214 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +3.75399993921609e-07 2.54975390119739e-11 0.01 1.11026667785195 0.000832703535968855 0.00916288835898106 0.5554688337492 0.00019337069400015 -1.1321776868122e-19 0.093174447230745 3.77647194981908e-11 0 0 0.0824972742985784 0.0106771728566372 0.745395577543842 0.279523341541176 0 0.162399727789578 1.77692337792127e-08 0 0 0.0038924076699923 0.158507284581118 1.29919768016275 0.487199112291798 0 + +0.294425342509966 1.78069984987109e-08 0 0 0.0863896819685707 0.169184457437755 2.59519158101533 1.01288323987011 0 + +0.555080801143299 0 0 + +0.555080801142411 0 0 + +1000000 1000000 1000000 + +0 0 0 + +7.19395165329058e-10 2.4343339297848e-07 3.99905503666824e-06 1.84568523935303e-18 2.99607693956321e-14 3.25846307086443e-12 7.78538718904938e-10 1.7677431143476e-09 5.17606148665461e-15 2.2189756870013e-13 0.0307863274129761 1.15508254306511e-05 0.0524726623736943 2.52850016230301e-07 0.113796147413511 2.17461644070903e-05 0.80247408454598 1.06066733334172e-06 6.37288089689883e-07 1.40536774797012e-07 0.0193359703415531 8.24882268871258e-26 4.03576167191207e-22 0 0 0 0 0.144597589101412 0.000460942039861802 0.00496058997742856 7.9369359164418e-30 1.03543313526039e-23 2.67699499478776e-30 2.16862107563283e-07 1.94692241065294e-05 55.50837344 1.06772292574679 3.77649189855999e-09 8.24977100801154 15.8508121876031 +1.77693276429685e-06 0.389242823114916 0 1.94257079620823 0 0 0 0 0 0 0 0 0 22.6736652154829 0 0 0 0 0 0 + +3.7540197692516e-05 2.54976736995359e-09 1.00000528237497 0.0105076120401484 0.0832707934621174 0.916293676079321 0.0388034655635171 0.0193371715456664 1.01881122895747e-17 + +-4.42550343544218 -8.59349942308693 2.29410023819963e-06 -1.97849596640498 -1.07950729481651 -0.0379653106858667 -1.41112948260749 -1.71360704643789 -16.9919062417102 + +0.000954701909052662 9.63189469758271e-08 33.416457601379 0.0099827025756625 3.06870911613779 19.8552339425757 0.585166358116733 0.51189425628121 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +1 0 -1 3 2 2 1 0 1 1 1 0 0 0 1 0 0 0 0 -1 0 -1 0 -1 0 -1 -1 -1 0 0 0 0 -1 -1 1 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +'HNNSNNNN' 'VNNSNNNN' 'VNNSNNNN' + +2 0 4 3 2 3 3 2 3 + +0 1 0 2 1 2 0 1 0 2 1 2 + +0.0299999993294477 3.72000002861023 1 1 0 0 0 0 3100 0 0 25100 -10.8000001907349 0.342999994754791 40000 0 0 3100 0 0 25100 -10.8000001907349 0.342999994754791 40000 0 0 + +0 0 0 1 0 0 1 0 0 + +0.64300000667572 1 1 0.64300000667572 1 1 + + + + + +0 0 0 0 0 0 0 0 0 + + + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + + + + + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 + + + + + + + + + +0 0 0 0 0 0 0 0 0 0 0 0 + + + + + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' 'NNNNNN' + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 + + + + + + + + + + + + + +0 0 0 0 0 0 + + + +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0.0251614286274407 0 0 0 0 0.0284016401730412 0 0 0 0 0.00963920579443535 0 0 + +0 -686.161681570424 -21.7577526050125 0 0 0 -1992.58052031044 1490.58765834872 0 0 0 -633.043184723817 505.889689068244 0 0 + +0 0 121.037223302011 0 0 0 0 2092.5716201415 0 0 0 0 710.196456470288 0 0 + +0 1.01932954255429 0.212129504429955 0 0 0 2.96008396391658 0.894279078649298 0 0 0 0.940419200362204 0.303508530642567 0 0 + +0 0 2.88643848490556 0 0 0 0 0 0 0 0 0 0 0 0 + +0 -686.161681570424 -34.3384669187329 0 0 0 -1992.58052031044 1476.3868382622 0 0 0 -633.043184723817 501.070086171026 0 0 + +0 0 108.456508988291 0 0 0 0 2078.37080005498 0 0 0 0 705.37685357307 0 0 \ No newline at end of file diff --git a/demos/resources/solvus2/series1-dbr-0-0000.json b/demos/resources/solvus2/series1-dbr-0-0000.json new file mode 100644 index 0000000..d34a4bd --- /dev/null +++ b/demos/resources/solvus2/series1-dbr-0-0000.json @@ -0,0 +1,108 @@ +[ +{ + "_key" : "series1-dbr-0-0000", + "set" : "series1", + "dbr" : { + "NodeHandle": 0, + "NodeTypeHY": 0, + "NodeTypeMT": 0, + "NodeStatusFMT": -1, + "NodeStatusCH": 2, + "IterDone": 85, + "TK": 673.15, + "P": 50000000, + "Vs": 4.93869647066202e-05, + "Vi": 0, + "Ms": 0.095789528986145, + "Mi": 0, + "Hs": 0, + "Hi": 0, + "Gs": -247.894235284192, + "IS": 0.14460194555862, + "pH": 5.14732918802631, + "pe": -2.8794431718465, + "Eh": -0.383826099593121, + "Tm": 0, + "dt": 0, + "bIC": [ + 0.29442571790996, 1.78324960377229e-08, 0.01, 1.11026667785195, 0.0872223855045395, 0.178347345796736, 3.15066041476453, 1.01307661056411, 0 + ], + "rMB": [ + 6.22861673728642e-17, 0, -3.7889738046237e-19, -1.66096446327638e-16, -6.48814243467335e-18, 0, 1.66096446327638e-16, 0, -4.89857921856136e-20 + ], + "uIC": [ + -86.373480502319, -108.981958645742, -30.5145543047713, -5.22200054232318, -55.1321688541345, -48.1920082486158, -38.8200893701638, -79.6071144429484, -6.63016293740676 + ], + "bSP": [ + 0.294425342509966, 1.78069984987109e-08, 0, 0, 0.0863896819685707, 0.169184457437755, 2.59519158101533, 1.01288323987011, 0 + ], + "xDC": [ + 7.19391365234115e-12, 2.4343210707881e-09, 3.99903391227158e-08, 1.84567548980301e-20, 2.99606111324497e-16, 3.25844585853158e-14, 7.78534606393218e-12, 1.76773377651494e-11, 5.17603414490138e-17, 2.21896396560158e-15, + 0.000307861647889097, 1.15507644151822e-07, 0.0005247238519488, 2.52848680588758e-09, 0.00113795546302765, 2.17460495363025e-07, 0.00802469845599351, 1.06066173052874e-08, 6.3728472331301e-09, 1.40536032432992e-09, + 0.000193358682022468, 8.24877911556822e-28, 4.03574035361822e-24, 0, 0, 0, 0, 0.00144596825286761, 4.60939605005968e-06, 4.96056377387062e-05, + 7.93689399079162e-32, 1.0354276657432e-25, 2.67698085397109e-32, 2.16860962022365e-09, 1.94691212633305e-07, 0.555080801143299, 0.0106771728566372, 3.77647194981908e-11, 0.0824972742985784, 0.158507284581118, + 1.77692337792127e-08, 0.0038924076699923, 0, 0.0194255837448217, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0.226735202292314, 0, 0, 0, 0, 0, 0 + ], + "gam": [ + 0.365866033679079, 1.00982100472631, 0.365866033679079, 0.000108628461986511, 0.0174002372212245, 0.0174002372212245, 0.365866033679079, 1.00982100472631, 0.365866033679079, 0.365866033679079, + 0.365866033679079, 1.00982100472631, 1.00982100472631, 1.00982100472631, 0.365866033679079, 1.00982100472631, 1.00982100472631, 1.00982100472631, 1.00982100472631, 0.365866033679079, + 1.00982100472631, 0.365866033679079, 1.00982100472631, 0.365866033679079, 1.00982100472631, 0.365866033679079, 0.365866033679079, 0.365866033679079, 1.00982100472631, 1.00982100472631, + 1.00982100472631, 1.00982100472631, 0.365866033679079, 0.365866033679079, 0.365866033679079, 1.00083426366534, 8.54636638799716, 585.140184485182, 1.02337769804821, 1.00341242834993, + 2.16755470972485, 37.8047680383689, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + ], + "dll": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "dul": [ + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000 + ], + "aPH": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 + ], + "xPH": [ + 0.566770175729462, 0.0931744471929803, 0.162399710020344, 0, 0.0194255837448217, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0.226735202292314, 0, 0, 0, 0, 0, + 0 + ], + "vPS": [ + 1.65129735411707e-05, 1.01263780424818e-05, 1.64869991902986e-05 + ], + "mPS": [ + 0.0106094426698081, 0.025761390843879, 0.0426476408493477 + ], + "xPA": [ + 0.555080801143299, 0, 0 + ], + "amru": [ + 1000000, 1000000, 1000000 + ], + "amrl": [ + 0, 0, 0 + ], + "omPH": [ + 3.55350428238655e-10, 3.08413635095867e-07, -1.76884897644245e-07, -0.719052139409618, 2.12027373869277e-09, -0.448768257254383, -0.129067256567927, -1.67303261244899, -1.50211075429386, -2.29415639516028, + -0.959595796187578, -0.120903234849457, -1.35038694036197, -1.51961503423066, 1.05511311143631e-10, -0.087634558404711, -3.59067171335983, -2.52157091305552, -1.28069500386576, -0.099063499385681, + -8.72425774391333 + ], + "bPS": [ + 3.75399993921609e-07, 2.54975390119739e-11, 0.01, 1.11026667785195, 0.000832703535968855, 0.00916288835898106, 0.5554688337492, 0.00019337069400015, -1.1321776868122e-19, + 0.093174447230745, 3.77647194981908e-11, 0, 0, 0.0824972742985784, 0.0106771728566372, 0.745395577543842, 0.279523341541176, 0, + 0.162399727789578, 1.77692337792127e-08, 0, 0, 0.0038924076699923, 0.158507284581118, 1.29919768016275, 0.487199112291798, 0 + ] + } +} +] \ No newline at end of file diff --git a/demos/resources/solvus2/series1-dbr.lst b/demos/resources/solvus2/series1-dbr.lst new file mode 100644 index 0000000..5e60023 --- /dev/null +++ b/demos/resources/solvus2/series1-dbr.lst @@ -0,0 +1 @@ + "series1-dbr-0-0000.json" \ No newline at end of file diff --git a/demos/resources/solvus2/series1-dch.json b/demos/resources/solvus2/series1-dch.json new file mode 100644 index 0000000..2b1d79d --- /dev/null +++ b/demos/resources/solvus2/series1-dch.json @@ -0,0 +1,311 @@ +[ +{ + "_key" : "series1-dch", + "set" : "series1", + "dch" : { + "nIC": 9, + "nDC": 60, + "nPH": 21, + "nPS": 3, + "nDCs": 42, + "nICb": 9, + "nDCb": 60, + "nPHb": 21, + "nPSb": 3, + "nTp": 1, + "nPp": 1, + "iGrd": 0, + "fAalp": 1, + "mLook": 0, + "xic": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8 + ], + "xdc": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + ], + "xph": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20 + ], + "ICNL": [ + "Al", "Ca", "Cl", "H", "K", "Na", "O", "Si", "Zz" + ], + "ccIC": [ + "e", "e", "e", "h", "e", "e", "o", "e", "z" + ], + "ICmm": [ + 0.0269815006256104, 0.0400779991149902, 0.0354529991149902, 0.00100794994831085, 0.0390983009338379, 0.0229897994995117, 0.015999400138855, 0.0280855007171631, 0 + ], + "DCNL": [ + "Al(OH)2+", "Al(OH)3@", "Al(OH)4-", "Al+3", "AlOH+2", "Ca+2", "CaCl+", "CaCl2@", "CaHSiO3+", "CaOH+", + "K+", "KAlO2@", "KCl@", "KOH@", "Na+", "NaAl(OH)4@", "NaCl@", "NaHSiO3@", "NaOH@", "HSiO3-", + "SiO2@", "ClO-", "HClO@", "ClO2-", "HClO2@", "ClO3-", "ClO4-", "Cl-", "HCl@", "H2@", + "O2@", "H2O2@", "HO2-", "OH-", "H+", "H2O@", "Albite", "Anorthite_long_substance_name", "Sanidine", "Albite", + "Anorthite_long_substance_name", "Sanidine", "Analcite", "Andalusite", "Coesite", "Cristobalite", "Halite", "Jadeite", "Kalsilite", "Kaolinite", + "Kyanite", "Leucite", "Nepheline", "Quartz", "Sillimanite", "Stishovite", "Sylvite", "Topaz-OH", "Tridymite", "Wollastonite" + ], + "ccDC": [ + "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", + "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", + "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", + "S", "S", "S", "S", "T", "W", "J", "J", "M", "M", + "M", "J", "O", "O", "O", "O", "O", "O", "O", "O", + "O", "O", "O", "O", "O", "O", "O", "O", "O", "O" + ], + "DCmm": [ + 0.060996200799942, 0.0780035508871079, 0.0950109009742737, 0.0269815006256104, 0.0439888507127762, 0.0400779991149902, 0.0755309982299805, 0.110983997344971, 0.117169650197029, 0.0570853492021561, + 0.0390983009338379, 0.0980786018371582, 0.0745513000488281, 0.0561056510210037, 0.0229897994995117, 0.118000700473785, 0.058442798614502, 0.100081450581551, 0.0399971495866775, 0.0770916510820389, + 0.060084300994873, 0.0514523992538452, 0.0524603492021561, 0.0674517993927002, 0.0684597493410111, 0.0834511995315552, 0.0994505996704102, 0.0354529991149902, 0.0364609490633011, 0.0020158998966217, + 0.03199880027771, 0.0340147001743317, 0.0330067502260208, 0.0170073500871658, 0.00100794994831085, 0.0180153000354767, 0.262223003387451, 0.278207202911377, 0.278331504821777, 0.262223003387451, + 0.278207202911377, 0.278331504821777, 0.220154002428055, 0.162045502662659, 0.060084300994873, 0.060084300994873, 0.058442798614502, 0.202138702392578, 0.158162902832031, 0.258160403728485, + 0.162045502662659, 0.218247203826904, 0.142054401397705, 0.060084300994873, 0.162045502662659, 0.060084300994873, 0.0745513000488281, 0.180060802698135, 0.060084300994873, 0.116161700248718 + ], + "PHNL": [ + "aq_gen", "Alkali feldspar", "Plagioclase", "Analcite", "Andalusite", "Coesite", "Cristobalite", "Halite", "Jadeite", "Kalsilite", + "Kaolinite_long_phase_name", "Kyanite", "Leucite", "Nepheline", "Quartz", "Sillimanite", "Stishovite", "Sylvite", "Topaz-OH", "Tridymite", + "Wollastonite" + ], + "ccPH": [ + "a", "s", "s", "s", "s", "s", "s", "s", "s", "s", + "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", + "s" + ], + "nDCinPH": [ + 36, 3, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 + ], + "A": [ + 1, 0, 0, 2, 0, 0, 2, 0, 1, + 1, 0, 0, 3, 0, 0, 3, 0, 0, + 1, 0, 0, 4, 0, 0, 4, 0, -1, + 1, 0, 0, 0, 0, 0, 0, 0, 3, + 1, 0, 0, 1, 0, 0, 1, 0, 2, + 0, 1, 0, 0, 0, 0, 0, 0, 2, + 0, 1, 1, 0, 0, 0, 0, 0, 1, + 0, 1, 2, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, 0, 3, 1, 1, + 0, 1, 0, 1, 0, 0, 1, 0, 1, + 0, 0, 0, 0, 1, 0, 0, 0, 1, + 1, 0, 0, 0, 1, 0, 2, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 1, + 1, 0, 0, 4, 0, 1, 4, 0, 0, + 0, 0, 1, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 3, 1, 0, + 0, 0, 0, 1, 0, 1, 1, 0, 0, + 0, 0, 0, 1, 0, 0, 3, 1, -1, + 0, 0, 0, 0, 0, 0, 2, 1, 0, + 0, 0, 1, 0, 0, 0, 1, 0, -1, + 0, 0, 1, 1, 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, 0, 2, 0, -1, + 0, 0, 1, 1, 0, 0, 2, 0, 0, + 0, 0, 1, 0, 0, 0, 3, 0, -1, + 0, 0, 1, 0, 0, 0, 4, 0, -1, + 0, 0, 1, 0, 0, 0, 0, 0, -1, + 0, 0, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 1, 0, 0, 2, 0, -1, + 0, 0, 0, 1, 0, 0, 1, 0, -1, + 0, 0, 0, 1, 0, 0, 0, 0, 1, + 0, 0, 0, 2, 0, 0, 1, 0, 0, + 1, 0, 0, 0, 0, 1, 8, 3, 0, + 2, 1, 0, 0, 0, 0, 8, 2, 0, + 1, 0, 0, 0, 1, 0, 8, 3, 0, + 1, 0, 0, 0, 0, 1, 8, 3, 0, + 2, 1, 0, 0, 0, 0, 8, 2, 0, + 1, 0, 0, 0, 1, 0, 8, 3, 0, + 1, 0, 0, 2, 0, 1, 7, 2, 0, + 2, 0, 0, 0, 0, 0, 5, 1, 0, + 0, 0, 0, 0, 0, 0, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 2, 1, 0, + 0, 0, 1, 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 1, 6, 2, 0, + 1, 0, 0, 0, 1, 0, 4, 1, 0, + 2, 0, 0, 4, 0, 0, 9, 2, 0, + 2, 0, 0, 0, 0, 0, 5, 1, 0, + 1, 0, 0, 0, 1, 0, 6, 2, 0, + 1, 0, 0, 0, 0, 1, 4, 1, 0, + 0, 0, 0, 0, 0, 0, 2, 1, 0, + 2, 0, 0, 0, 0, 0, 5, 1, 0, + 0, 0, 0, 0, 0, 0, 2, 1, 0, + 0, 0, 1, 0, 1, 0, 0, 0, 0, + 2, 0, 0, 2, 0, 0, 6, 1, 0, + 0, 0, 0, 0, 0, 0, 2, 1, 0, + 0, 1, 0, 0, 0, 0, 3, 1, 0 + ], + "Ttol": 1, + "TKval": [ + 673.15 + ], + "Psat": [ + 1e-05 + ], + "Ptol": 50000, + "Pval": [ + 50000000 + ], + "denW": [ + 577.991203938277, + -2.82639549712378, + -0.0266530537457313, + 0.411925579847386, + 0 + ], + "denWg": [ + 577.991204258629, + -2.82639549109626, + -0.0266530535870405, + 0.411925578483688, + 0 + ], + "epsW": [ + 12.2630928233121, + -0.109834958358815, + -0.000165819390393567, + 0.0129109578062983, + 0 + ], + "epsWg": [ + 12.2630928333529, + -0.109834958217768, + -0.000165819387514881, + 0.0129109577680876, + 0 + ], + "V0": [ + -0.000285766012206448, + 2.97748067950671e-05, + -0.00038635645617081, + -0.00167201981593256, + -0.000940621522503403, + -0.000705736025403141, + -0.000255966239312319, + 4.89953699214242e-05, + -0.00032778644810367, + -0.000233944169472753, + -8.58839498987396e-05, + 5.17446856524092e-05, + 5.46948198329714e-05, + 2.82764486776203e-05, + -0.000170307983086851, + 5.65314700313038e-05, + 4.02950583072279e-05, + 2.89363020766455e-05, + 1.6792988120537e-05, + -0.00070290556521368, + -3.5068983424635e-05, + -0.000663350412985774, + 9.30237009571521e-05, + -0.000523474116753637, + 0.000168694330139116, + -0.000396842820571131, + -0.000352004164446705, + -0.000635263428297151, + 4.71343353823106e-05, + 0.00010249971070309, + 0.00017381678787308, + 0.00010012729722517, + -0.000701521861134173, + -0.000817627093756841, + 0, + 3.11688147293263e-05, + 0.00010132187482655, + 0.000101311541033942, + 0.000109634493307496, + 0.00010132187482655, + 0.000101311541033942, + 0.000109634493307496, + 9.82511231864014e-05, + 5.19360060661386e-05, + 2.07038768194301e-05, + 2.61195517606584e-05, + 2.84215908233738e-05, + 6.0941844123644e-05, + 6.10460657392688e-05, + 0.000100278285099932, + 4.44844001885621e-05, + 9.0525606705678e-05, + 5.55145565219996e-05, + 2.31623790411208e-05, + 5.01424316067025e-05, + 1.40781940532671e-05, + 3.92650122657552e-05, + 5.38028309830979e-05, + 2.70081361566848e-05, + 4.02731851592315e-05 + ], + "G0": [ + -890075.44123874, + -1137746.5153311, + -1357121.0597249, + -315121.35945924, + -607185.17549373, + -513467.7367866, + -694843.16344733, + -838794.0276728, + -1583933.4055259, + -724868.2357611, + -320569.64204926, + -1162964.7802565, + -462915.20786846, + -470104.60749884, + -289043.23410054, + -1679115.9714905, + -439336.80313819, + -1319385.6417851, + -436435.07088002, + -995556.03386033, + -858069.794424, + -22062.19500644, + -141628.41272188, + 3639.0644639232, + -84055.437025574, + -50068.571475766, + -64139.485452078, + -117227.90675924, + -157072.24960932, + -28810.350676881, + -59573.123049993, + -196839.57863682, + -39926.532055018, + -117884.60641191, + 0, + -275614.82565861, + -3827877.7943204, + -4120723.1798917, + -3866286.1295058, + -3827877.7943204, + -4120723.1798917, + -3866286.1295058, + -3214355.2954998, + -2498766.8548173, + -874315.88483161, + -878435.98898994, + -418952.75097983, + -2928536.9326069, + -2077073.6945626, + -3917953.1157251, + -2497208.7304188, + -2969335.7240911, + -2048212.0224195, + -880099.32610738, + -2497637.4760651, + -833825.0215976, + -446860.79739698, + -2757988.8671925, + -878822.65842315, + -1594901.7301248 + ] + } +} +] diff --git a/demos/resources/solvus2/series1-ipm.json b/demos/resources/solvus2/series1-ipm.json new file mode 100644 index 0000000..6546cc0 --- /dev/null +++ b/demos/resources/solvus2/series1-ipm.json @@ -0,0 +1,267 @@ +[ +{ + "_key" : "series1-ipm", + "set" : "series1", + "ipm" : { + "ID_key": "Node:0:time:0:dt:0", + "pa_PE": 1, + "PV": 1, + "PSOL": 0, + "PAalp": "+", + "PSigm": "+", + "Lads": 0, + "FIa": 0, + "FIat": 0, + "pa_DB": 1e-17, + "pa_DHB": 1e-13, + "pa_EPS": 1e-10, + "pa_DK": 4e-05, + "pa_DS": 1e-20, + "pa_DF": 0.01, + "pa_DFM": 0.01, + "pa_DP": 130, + "pa_IIM": 7000, + "pa_PD": 2, + "pa_PRD": -5, + "pa_AG": 1, + "pa_DGC": 0, + "pa_PSM": 1, + "pa_GAR": 1, + "pa_GAH": 1000, + "pa_XwMin": 1e-13, + "pa_ScMin": 1e-13, + "pa_DcMin": 1e-33, + "pa_PhMin": 1e-20, + "pa_ICmin": 1e-05, + "pa_PC": 2, + "pa_DFYw": 1e-05, + "pa_DFYaq": 1e-05, + "pa_DFYid": 1e-05, + "pa_DFYr": 1e-05, + "pa_DFYh": 1e-05, + "pa_DFYc": 1e-05, + "pa_DFYs": 1e-06, + "pa_DW": 1, + "pa_DT": 0, + "pa_GAS": 0.001, + "pa_DG": 1000, + "pa_DNS": 12.05, + "pa_IEPS": 0.001, + "pKin": 1, + "pa_DKIN": 1e-10, + "pa_PLLG": 13000, + "tMin": 0, + "sMod": [ + "HNNSNNNN", "VNNSNNNN", "VNNSNNNN" + ], + "LsMod": [ + 2, 0, 4, + 3, 2, 3, + 3, 2, 3 + ], + "IPxPH": [ + 0, 1, 0, 2, 1, 2, 0, 1, 0, 2, + 1, 2 + ], + "PMc": [ + 0.0299999993294477, 3.72000002861023, 1, 1, 0, 0, 0, 0, 3100, 0, + 0, 25100, -10.8000001907349, 0.342999994754791, 40000, 0, 0, 3100, 0, 0, + 25100, -10.8000001907349, 0.342999994754791, 40000, 0, 0 + ], + "LsMdc": [ + 0, 0, 0, + 1, 0, 0, + 1, 0, 0 + ], + "DMc": [ + 0.64300000667572, 1, 1, 0.64300000667572, 1, 1 + ], + "LsMdc2": [ + 0, 0, 0, + 0, 0, 0, + 0, 0, 0 + ], + "LsPhl": [ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0 + ], + "SorMc": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "LsISmo": [ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 + ], + "LsESmo": [ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 + ], + "kMod": [ + "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", + "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", + "NNNNNN" + ], + "LsKin": [ + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 + ], + "PfFact": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "LsUpt": [ + 0, 0, + 0, 0, + 0, 0 + ], + "B": [ + 0.29442571790996, 1.78324960377229e-08, 0.01, 1.11026667785195, 0.0872223855045395, 0.178347345796736, 3.15066041476453, 1.01307661056411, 0 + ], + "Pparc": [ + 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 500, 500, 500, 500, 500 + ], + "fDQF": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "lnGmf": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 6.90775527898214, 6.90775527898214, 0, 0, + 0, 6.90775527898214, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "RLC": [ + "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", + "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", + "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", + "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", + "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", + "B", "B", "B", "B", "B", "B", "B", "B", "B", "B" + ], + "RSC": [ + "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", + "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", + "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", + "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", + "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", + "M", "M", "M", "M", "M", "M", "M", "M", "M", "M" + ], + "DLL": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "DUL": [ + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, + 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000 + ], + "Aalp": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 + ], + "Sigw": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 + ], + "Sigg": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 + ], + "YOF": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 + ], + "dcMod": [ + "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", + "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", + "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", "HKF", + "HKF", "HKF", "HKF", "HKF", "HKF", "HWF", "CHE", "CHE", "CSE", "CHE", + "CHE", "CSE", "CSE", "CSE", "CSE", "CSE", "CSE", "CSE", "CSE", "CSE", + "CSE", "CHE", "CHE", "CHE", "CHE", "CSE", "CSE", "CSE", "CSE", "CSE" + ] + } +} +] \ No newline at end of file diff --git a/environment.devenv.yml b/environment.devenv.yml index 59978c1..5217e67 100644 --- a/environment.devenv.yml +++ b/environment.devenv.yml @@ -17,6 +17,6 @@ dependencies: - pybind11 - nlohmann_json - numpy - - eigen>=3.4.0 - - gems3k=>4.4.4 + - eigen=3.4.0 + - gems3k>=4.5.2 diff --git a/install-dependencies.sh b/install-dependencies.sh index 18d5226..dbd394c 100755 --- a/install-dependencies.sh +++ b/install-dependencies.sh @@ -57,7 +57,7 @@ if [ "$USING_THERMOFUN_MODE" == "NO_THERMOFUN" ]; # nlohmann/json test -f /usr/local/include/nlohmann/json.hpp || { - # Building yaml-cpp library + # Building json library mkdir -p ~/code && \ cd ~/code && \ git clone https://github.com/nlohmann/json.git && \ diff --git a/python/src/xgems/pyxGEMS.hpp b/python/src/xgems/pyxGEMS.hpp index b8f639b..d01b943 100644 --- a/python/src/xgems/pyxGEMS.hpp +++ b/python/src/xgems/pyxGEMS.hpp @@ -28,19 +28,7 @@ using namespace xGEMS; void exportChemicalEngine(py::module &m) { auto reequilibrate1 = static_cast(&ChemicalEngine::reequilibrate); - auto reequilibrate2 = static_cast(&ChemicalEngine::reequilibrate); - - auto speciesAmount1 = static_cast(&ChemicalEngine::speciesAmount); - auto speciesAmount2 = static_cast(&ChemicalEngine::speciesAmount); - - auto setSpeciesAmount1 = static_cast(&ChemicalEngine::setSpeciesAmount); - auto setSpeciesAmount2 = static_cast(&ChemicalEngine::setSpeciesAmount); - - auto setSpeciesUpperLimit1 = static_cast(&ChemicalEngine::setSpeciesUpperLimit); - auto setSpeciesUpperLimit2 = static_cast(&ChemicalEngine::setSpeciesUpperLimit); - - auto setSpeciesLowerLimit1 = static_cast(&ChemicalEngine::setSpeciesLowerLimit); - auto setSpeciesLowerLimit2 = static_cast(&ChemicalEngine::setSpeciesLowerLimit); + auto reequilibrate2 = static_cast(&ChemicalEngine::reequilibrate); // Bind ChemicalEngineOptions py::class_(m, "ChemicalEngineOptions", @@ -218,9 +206,11 @@ Whether to include zero-amount species/phases in the printed output. num_phases = engine.numPhases() print(num_phases) )doc") - .def("numSpeciesInPhase", &ChemicalEngine::numSpeciesInPhase, py::arg("iphase"), + .def("numSpeciesInPhase", static_cast(&ChemicalEngine::numSpeciesInPhase), + py::arg("iphase"), R"doc( Returns the number of species in a given phase. + Access specified element with bounds checking. :param int iphase: Index of the phase. @@ -230,23 +220,68 @@ Whether to include zero-amount species/phases in the printed output. num_species_in_phase = engine.numSpeciesInPhase(0) print(num_species_in_phase) + )doc") + .def("numSpeciesInPhase", static_cast(&ChemicalEngine::numSpeciesInPhase), + py::arg("phase"), + R"doc( + Returns the number of species in in a phase identified by name. + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + num_species_in_phase = engine.numSpeciesInPhase("aq_gen") + print(num_species_in_phase) + )doc") + .def("numSpeciesInPhase_i", &ChemicalEngine::numSpeciesInPhase_i, + py::arg("iphase"), + R"doc( + Returns the number of species in a given phase. + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + num_species_in_phase = engine.numSpeciesInPhase_i(0) + print(num_species_in_phase) )doc") .def("elementName", &ChemicalEngine::elementName, py::arg("index"), R"doc( Returns the name of an element by its index. - + Access specified element with bounds checking. + :param int index: Index of the element. - + **Example:** - + .. code-block:: python - + element_name = engine.elementName(0) print(element_name) + )doc") + .def("elementName_i", &ChemicalEngine::elementName_i, py::arg("index"), + R"doc( + Returns the name of an element by its index. + Access specified element without bounds checking. + + :param int index: Index of the element. + + **Example:** + + .. code-block:: python + + element_name = engine.elementName_i(0) + print(element_name) )doc") .def("speciesName", &ChemicalEngine::speciesName, py::arg("index"), R"doc( Returns the name of a species by its index. + Access specified element with bounds checking. :param int index: Index of the species. @@ -257,31 +292,90 @@ Whether to include zero-amount species/phases in the printed output. species_name = engine.speciesName(0) print(species_name) )doc") - .def("speciesCharge", &ChemicalEngine::speciesCharge, py::arg("index"), + .def("speciesName_i", &ChemicalEngine::speciesName_i, py::arg("index"), + R"doc( + Returns the name of a species by its index. + Access specified element without bounds checking. + + :param int index: Index of the species. + + **Example:** + + .. code-block:: python + + species_name = engine.speciesName_i(0) + print(species_name) + )doc") + .def("speciesCharge", static_cast(&ChemicalEngine::speciesCharge), py::arg("index"), R"doc( Returns the electrical charge of a species by its index. - + Access specified element with bounds checking. + :param int index: Index of the species. - + **Example:** - + .. code-block:: python - + charge = engine.speciesCharge(0) print(charge) + )doc") + .def("speciesCharge", static_cast) const>(&ChemicalEngine::speciesCharge), + py::arg("species"), py::arg("phase") = py::none(), + R"doc( + Returns the electrical charge of a species identified by name. + + :param str species: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. + + **Example:** + + .. code-block:: python + + charge = engine.speciesCharge("SiO2") + print(charge) + )doc") + .def("speciesCharge_i", &ChemicalEngine::speciesCharge_i, py::arg("index"), + R"doc( + Returns the electrical charge of a species by its index. + Access specified element without bounds checking. + + :param int index: Index of the species. + + **Example:** + + .. code-block:: python + + charge = engine.speciesCharge_i(0) + print(charge) )doc") .def("phaseName", &ChemicalEngine::phaseName, py::arg("index"), R"doc( Returns the name of a phase by its index. - + Access specified element with bounds checking. + :param int index: Index of the phase. - + **Example:** - + .. code-block:: python - + phase_name = engine.phaseName(0) print(phase_name) + )doc") + .def("phaseName_i", &ChemicalEngine::phaseName_i, py::arg("index"), + R"doc( + Returns the name of a phase by its index. + Access specified element without bounds checking. + + :param int index: Index of the phase. + + **Example:** + + .. code-block:: python + + phase_name = engine.phaseName_i(0) + print(phase_name) )doc") .def("indexElement", &ChemicalEngine::indexElement, py::arg("name"), R"doc( @@ -296,11 +390,12 @@ Whether to include zero-amount species/phases in the printed output. index = engine.indexElement("O") print(index) )doc") - .def("indexSpecies", &ChemicalEngine::indexSpecies, py::arg("name"), + .def("indexSpecies", &ChemicalEngine::indexSpecies, py::arg("name"), py::arg("phase") = py::none(), R"doc( Returns the index of a species by its name. :param str name: Name of the species. +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -323,7 +418,19 @@ Returns all indices of species matching the specified name. indices = engine.indexSpeciesAll("H2O@") print(indices) )doc") + .def("indexSpeciesMap", &ChemicalEngine::indexSpeciesMap, py::arg("name"), + R"doc( +Returns dictionary of all phase name and corresponding species index. + +:param str name: Name of the species. +**Example:** + +.. code-block:: python + + dict = engine.indexSpeciesMap("Anorthite") + print(dict) +)doc") .def("indexPhase", &ChemicalEngine::indexPhase, py::arg("name"), R"doc( Returns the index of a phase by its name. @@ -366,11 +473,13 @@ Returns the index of the phase containing a given species. print(phase_index) )doc") - .def("indexFirstSpeciesInPhase", &ChemicalEngine::indexFirstSpeciesInPhase, py::arg("phase_index"), + .def("indexFirstSpeciesInPhase", static_cast(&ChemicalEngine::indexFirstSpeciesInPhase), + py::arg("iphase"), R"doc( Returns the index of the first species in a specified phase. +Access specified element with bounds checking. -:param int phase_index: Index of the phase. +:param int iphase: Index of the phase. **Example:** @@ -379,6 +488,34 @@ Returns the index of the first species in a specified phase. species_index = engine.indexFirstSpeciesInPhase(0) print(species_index) )doc") + .def("indexFirstSpeciesInPhase", static_cast(&ChemicalEngine::indexFirstSpeciesInPhase), + py::arg("phase"), + R"doc( +Returns the index of the first species in a specified phase. + +:param str phase: Name of the phase. + +**Example:** + +.. code-block:: python + + species_index = engine.indexFirstSpeciesInPhase("aq_gen") + print(species_index) +)doc") + .def("indexFirstSpeciesInPhase_i", &ChemicalEngine::indexFirstSpeciesInPhase_i, py::arg("iphase"), + R"doc( +Returns the index of the first species in a specified phase. +Access specified element without bounds checking. + +:param int iphase: Index of the phase. + +**Example:** + +.. code-block:: python + + species_index = engine.indexFirstSpeciesInPhase_i(0) + print(species_index) +)doc") .def("elementMolarMasses", &ChemicalEngine::elementMolarMasses, R"doc( @@ -471,12 +608,14 @@ Cold start resets the initial guess to default values for robust convergence. engine.setColdStart() )doc") - .def("setSpeciesUpperLimit", setSpeciesUpperLimit1, py::arg("name"), py::arg("limit"), + .def("setSpeciesUpperLimit", static_cast)>(&ChemicalEngine::setSpeciesUpperLimit), + py::arg("name"), py::arg("limit"), py::arg("phase") = py::none(), R"doc( Sets the upper limit for a species by its name. :param str name: Name of the species. :param float limit: Upper limit for the species amount. +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -484,10 +623,11 @@ Sets the upper limit for a species by its name. engine.setSpeciesUpperLimit("H2O@", 10.0) )doc") - - .def("setSpeciesUpperLimit", setSpeciesUpperLimit2, py::arg("index"), py::arg("limit"), + .def("setSpeciesUpperLimit", static_cast(&ChemicalEngine::setSpeciesUpperLimit), + py::arg("index"), py::arg("limit"), R"doc( Sets the upper limit for a species by its index. +Access specified element with bounds checking. :param int index: Index of the species. :param float limit: Upper limit for the species amount. @@ -498,13 +638,29 @@ Sets the upper limit for a species by its index. engine.setSpeciesUpperLimit(0, 10.0) )doc") + .def("setSpeciesUpperLimit_i", &ChemicalEngine::setSpeciesUpperLimit_i, py::arg("index"), py::arg("limit"), + R"doc( +Sets the upper limit for a species by its index. +Access specified element without bounds checking. + + +:param int index: Index of the species. +:param float limit: Upper limit for the species amount. - .def("setSpeciesLowerLimit", setSpeciesLowerLimit1, py::arg("name"), py::arg("limit"), +**Example:** + +.. code-block:: python + + engine.setSpeciesUpperLimit_i(0, 10.0) +)doc") + .def("setSpeciesLowerLimit", static_cast)>(&ChemicalEngine::setSpeciesLowerLimit), + py::arg("name"), py::arg("limit"), py::arg("phase") = py::none(), R"doc( Sets the lower limit for a species by its name. :param str name: Name of the species. :param float limit: Lower limit for the species amount. +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -512,10 +668,11 @@ Sets the lower limit for a species by its name. engine.setSpeciesLowerLimit("SiO2", 0.1) )doc") - - .def("setSpeciesLowerLimit", setSpeciesLowerLimit2, py::arg("index"), py::arg("limit"), + .def("setSpeciesLowerLimit", static_cast(&ChemicalEngine::setSpeciesLowerLimit), + py::arg("index"), py::arg("limit"), R"doc( Sets the lower limit for a species by its index. +Access specified element with bounds checking. :param int index: Index of the species. :param float limit: Lower limit for the species amount. @@ -526,13 +683,29 @@ Sets the lower limit for a species by its index. engine.setSpeciesLowerLimit(0, 0.1) )doc") + .def("setSpeciesLowerLimit_i", &ChemicalEngine::setSpeciesLowerLimit_i, + py::arg("index"), py::arg("limit"), + R"doc( +Sets the lower limit for a species by its index. +Access specified element without bounds checking. - .def("setSpeciesAmount", setSpeciesAmount1, py::arg("name"), py::arg("amount"), +:param int index: Index of the species. +:param float limit: Lower limit for the species amount. + +**Example:** + +.. code-block:: python + + engine.setSpeciesLowerLimit_i(0, 0.1) +)doc") + .def("setSpeciesAmount", static_cast)>(&ChemicalEngine::setSpeciesAmount), + py::arg("name"), py::arg("amount"), py::arg("phase") = py::none(), R"doc( Sets the amount of a species by its name. :param str name: Name of the species. :param float amount: Amount of the species in moles. +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -540,12 +713,13 @@ Sets the amount of a species by its name. engine.setSpeciesAmount("SiO2", 1.0) )doc") - - .def("setSpeciesAmount", setSpeciesAmount2, py::arg("index"), py::arg("amount"), + .def("setSpeciesAmount", static_cast(&ChemicalEngine::setSpeciesAmount), + py::arg("ispecies"), py::arg("amount"), R"doc( Sets the amount of a species by its index. +Access specified element with bounds checking. -:param int index: Index of the species. +:param int ispecies: Index of the species. :param float amount: Amount of the species in moles. **Example:** @@ -554,12 +728,43 @@ Sets the amount of a species by its index. engine.setSpeciesAmount(0, 1.0) )doc") + .def("setSpeciesAmount_i", &ChemicalEngine::setSpeciesAmount_i, py::arg("ispecies"), py::arg("amount"), + R"doc( +Sets the amount of a species by its index. +Access specified element without bounds checking. + +:param int ispecies: Index of the species. +:param float amount: Amount of the species in moles. + +**Example:** + +.. code-block:: python + + engine.setSpeciesAmount_i(0, 1.0) +)doc") - .def("setStandardMolarGibbsEnergy", &ChemicalEngine::setStandardMolarGibbsEnergy, + .def("setStandardMolarGibbsEnergy", static_cast)>(&ChemicalEngine::setStandardMolarGibbsEnergy), +py::arg("name"), py::arg("value"), py::arg("phase") = py::none(), R"doc( Sets the standard molar Gibbs energy for a species (J/mol). -:param int index: Index of the species. +:param str name: Name of the species. +:param float value: Standard molar Gibbs energy value (J/mol). +:param str phase: Name of the phase the species was included in. If None get the first index. + +**Example:** + +.. code-block:: python + + engine.setStandardMolarGibbsEnergy("H2O", -237.13) +)doc") + .def("setStandardMolarGibbsEnergy", static_cast(&ChemicalEngine::setStandardMolarGibbsEnergy), + py::arg("ispecies"), py::arg("value"), + R"doc( +Sets the standard molar Gibbs energy for a species (J/mol). +Access specified element with bounds checking. + +:param int ispecies: Index of the species. :param float value: Standard molar Gibbs energy value (J/mol). **Example:** @@ -567,15 +772,30 @@ Sets the standard molar Gibbs energy for a species (J/mol). .. code-block:: python engine.setStandardMolarGibbsEnergy(0, -237.13) -)doc", - py::arg("index"), py::arg("value")) +)doc") + .def("setStandardMolarGibbsEnergy_i", &ChemicalEngine::setStandardMolarGibbsEnergy_i, + py::arg("ispecies"), py::arg("value"), + R"doc( +Sets the standard molar Gibbs energy for a species (J/mol). +Access specified element with bounds checking. + +:param int ispecies: Index of the species. +:param float value: Standard molar Gibbs energy value (J/mol). + +**Example:** +.. code-block:: python + + engine.setStandardMolarGibbsEnergy_i(0, -237.13) +)doc") .def("setPT", &ChemicalEngine::setPT, R"doc( Sets the temperature and pressure of the system. :param float temperature: Temperature in Kelvin (K). :param float pressure: Pressure in Pascals (Pa). + + :return bool: True if PT was set correctly, False if out of range. **Example:** @@ -790,9 +1010,11 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("elementAmountsInPhase", &ChemicalEngine::elementAmountsInPhase, + .def("elementAmountsInPhase", static_cast(&ChemicalEngine::elementAmountsInPhase), + py::arg("iphase"), R"doc( Returns the amounts of all elements in a specific phase (mol). + Access specified element with bounds checking. :param int phase_index: Index of the phase. @@ -802,8 +1024,36 @@ Sets the standard molar Gibbs energy for a species (J/mol). amounts = engine.elementAmountsInPhase(0) print(amounts) - )doc", - py::arg("phase_index")) + )doc") + .def("elementAmountsInPhase", static_cast(&ChemicalEngine::elementAmountsInPhase), + py::arg("phase"), + R"doc( + Returns the amounts of all elements in a specific phase (mol). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + amounts = engine.elementAmountsInPhase("aq_gen"") + print(amounts) + )doc") + .def("elementAmountsInPhase_i", &ChemicalEngine::elementAmountsInPhase_i, + py::arg("iphase"), + R"doc( + Returns the amounts of all elements in a specific phase (mol). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + amounts = engine.elementAmountsInPhase_i(0) + print(amounts) + )doc") .def("elementAmountsInSpecies", &ChemicalEngine::elementAmountsInSpecies, R"doc( @@ -820,11 +1070,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::arg("species_index")) - .def("speciesAmount", speciesAmount1, + .def("speciesAmount", static_cast(&ChemicalEngine::speciesAmount), + py::arg("ispecies"), R"doc( Returns the amount of a species by its index (mol). + Access specified element with bounds checking. - :param int index: Index of the species. + :param int ispecies: Index of the species. **Example:** @@ -833,12 +1085,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). amount = engine.speciesAmount(0) print(amount) )doc") - - .def("speciesAmount", speciesAmount2, + .def("speciesAmount", static_cast) const>(&ChemicalEngine::speciesAmount), + py::arg("name"), py::arg("phase") = py::none(), R"doc( Returns the amount of a species by its name (mol). :param str name: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -847,6 +1100,20 @@ Sets the standard molar Gibbs energy for a species (J/mol). amount = engine.speciesAmount("H2O@") print(amount) )doc") + .def("speciesAmount_i", &ChemicalEngine::speciesAmount_i, py::arg("ispecies"), + R"doc( + Returns the amount of a species by its index (mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + amount = engine.speciesAmount_i(0) + print(amount) + )doc") .def("setSpeciesAmounts", &ChemicalEngine::setSpeciesAmounts, R"doc( @@ -1007,11 +1274,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("standardMolarGibbsEnergy", &ChemicalEngine::standardMolarGibbsEnergy, + .def("standardMolarGibbsEnergy", static_cast(&ChemicalEngine::standardMolarGibbsEnergy), + py::arg("ispecies"), R"doc( Returns the standard molar Gibbs energy of a specific species by its index (J/mol). + Access specified element with bounds checking. - :param int index: Index of the species. + :param int ispecies: Index of the species. **Example:** @@ -1020,96 +1289,320 @@ Sets the standard molar Gibbs energy for a species (J/mol). gibbs_energy = engine.standardMolarGibbsEnergy(0) print(gibbs_energy) )doc") - - .def("standardMolarEnthalpy", &ChemicalEngine::standardMolarEnthalpy, + .def("standardMolarGibbsEnergy", static_cast) const>(&ChemicalEngine::standardMolarGibbsEnergy), + py::arg("species"), py::arg("phase") = py::none(), R"doc( - Returns the standard molar enthalpy of a specific species by its index (J/mol). - - :param int index: Index of the species. - + Returns the standard molar Gibbs energy of a specific species by its index (J/mol). + + :param str species: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. + **Example:** - + .. code-block:: python - - enthalpy = engine.standardMolarEnthalpy(0) - print(enthalpy) - )doc") - .def("standardMolarVolume", &ChemicalEngine::standardMolarVolume, + gibbs_energy = engine.standardMolarGibbsEnergy("SiO2") + print(gibbs_energy) + )doc") + .def("standardMolarGibbsEnergy_i", &ChemicalEngine::standardMolarGibbsEnergy_i, + py::arg("ispecies"), R"doc( - Returns the standard molar volume of a species by its index. (m³/mol). + Returns the standard molar Gibbs energy of a specific species by its index (J/mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. - :param int index: Index of the species. - **Example:** - + .. code-block:: python - - volume = engine.standardMolarVolume(0) - print(volume) + + gibbs_energy = engine.standardMolarGibbsEnergy_i(0) + print(gibbs_energy) )doc") - .def("standardMolarEntropy", &ChemicalEngine::standardMolarEntropy, + .def("standardMolarEnthalpy", static_cast(&ChemicalEngine::standardMolarEnthalpy), + py::arg("ispecies"), R"doc( - Returns the standard molar entropy of a specific species by its index (J/K/mol). + Returns the standard molar enthalpy of a specific species by its index (J/mol). + Access specified element with bounds checking. - :param int index: Index of the species. + :param int ispecies: Index of the species. **Example:** .. code-block:: python - entropy = engine.standardMolarEntropy(1) - print(entropy) + enthalpy = engine.standardMolarEnthalpy(0) + print(enthalpy) )doc") - - // .def("standardMolarInternalEnergy", &ChemicalEngine::standardMolarInternalEnergy) - // .def("standardMolarHelmholtzEnergy", &ChemicalEngine::standardMolarHelmholtzEnergy) - .def("standardMolarHeatCapacityConstP", &ChemicalEngine::standardMolarHeatCapacityConstP, + .def("standardMolarEnthalpy", static_cast) const>(&ChemicalEngine::standardMolarEnthalpy), + py::arg("species"), py::arg("phase") = py::none(), R"doc( - Returns the standard molar heat capacity at constant pressure for all species (J/K/mol). - + Returns the standard molar enthalpy of a specific species by its index (J/mol). + + :param str species: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. + + **Example:** + + .. code-block:: python + + enthalpy = engine.standardMolarEnthalpy("SiO2") + print(enthalpy) + )doc") + .def("standardMolarEnthalpy_i", &ChemicalEngine::standardMolarEnthalpy_i, + py::arg("ispecies"), + R"doc( + Returns the standard molar enthalpy of a specific species by its index (J/mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + enthalpy = engine.standardMolarEnthalpy_i(0) + print(enthalpy) + )doc") + + .def("standardMolarVolume", static_cast(&ChemicalEngine::standardMolarVolume), + py::arg("ispecies"), + R"doc( + Returns the standard molar volume of a species by its index. (m³/mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + volume = engine.standardMolarVolume(0) + print(volume) + )doc") + .def("standardMolarVolume", static_cast) const>(&ChemicalEngine::standardMolarVolume), + py::arg("species"), py::arg("phase") = py::none(), + R"doc( + Returns the standard molar volume of a species by its index. (m³/mol). + + :param str species: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. + + **Example:** + + .. code-block:: python + + volume = engine.standardMolarVolume("SiO2") + print(volume) + )doc") + .def("standardMolarVolume_i", &ChemicalEngine::standardMolarVolume_i, + py::arg("ispecies"), + R"doc( + Returns the standard molar volume of a species by its index. (m³/mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + volume = engine.standardMolarVolume_i(0) + print(volume) + )doc") + + .def("standardMolarEntropy", static_cast(&ChemicalEngine::standardMolarEntropy), + py::arg("ispecies"), + R"doc( + Returns the standard molar entropy of a specific species by its index (J/K/mol). + Access specified element with bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + entropy = engine.standardMolarEntropy(1) + print(entropy) + )doc") + .def("standardMolarEntropy", static_cast) const>(&ChemicalEngine::standardMolarEntropy), + py::arg("species"), py::arg("phase") = py::none(), + R"doc( + Returns the standard molar entropy of a specific species by its index (J/K/mol). + + :param str species: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. + + **Example:** + + .. code-block:: python + + entropy = engine.standardMolarEntropy("SiO2") + print(entropy) + )doc") + .def("standardMolarEntropy_i", &ChemicalEngine::standardMolarEntropy_i, + py::arg("ispecies"), + R"doc( + Returns the standard molar entropy of a specific species by its index (J/K/mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + entropy = engine.standardMolarEntropy_i(1) + print(entropy) + )doc") + + // .def("standardMolarInternalEnergy", &ChemicalEngine::standardMolarInternalEnergy) + // .def("standardMolarHelmholtzEnergy", &ChemicalEngine::standardMolarHelmholtzEnergy) + .def("standardMolarHeatCapacityConstP",static_cast(&ChemicalEngine::standardMolarHeatCapacityConstP), + py::arg("ispecies"), + R"doc( + Returns the standard molar heat capacity at constant pressure for species (J/K/mol). + Access specified element with bounds checking. + + :param int ispecies: Index of the species. + **Example:** .. code-block:: python - heat_capacity = engine.standardMolarHeatCapacityConstP() + heat_capacity = engine.standardMolarHeatCapacityConstP(0) + print(heat_capacity) + )doc") + .def("standardMolarHeatCapacityConstP", static_cast) const>(&ChemicalEngine::standardMolarHeatCapacityConstP), + py::arg("species"), py::arg("phase") = py::none(), + R"doc( + Returns the standard molar heat capacity at constant pressure for species (J/K/mol). + + :param str species: Name of the species. + :param str phase: Name of the phase the species was included in. If None get the first index. + + **Example:** + + .. code-block:: python + + heat_capacity = engine.standardMolarHeatCapacityConstP("SiO2") + print(heat_capacity) + )doc") + .def("standardMolarHeatCapacityConstP_i", &ChemicalEngine::standardMolarHeatCapacityConstP_i, + py::arg("ispecies"), + R"doc( + Returns the standard molar heat capacity at constant pressure for species (J/K/mol). + Access specified element without bounds checking. + + :param int ispecies: Index of the species. + + **Example:** + + .. code-block:: python + + heat_capacity = engine.standardMolarHeatCapacityConstP_i(0) print(heat_capacity) )doc") // .def("standardMolarHeatCapacityConstV", &ChemicalEngine::standardMolarHeatCapacityConstV) - .def("phaseMolarGibbsEnergy", &ChemicalEngine::phaseMolarGibbsEnergy, + .def("phaseMolarGibbsEnergy", static_cast(&ChemicalEngine::phaseMolarGibbsEnergy), + py::arg("iphase"), R"doc( Returns the molar Gibbs energy of a specific phase by its index (J/mol). - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + molar_gibbs_energy = engine.phaseMolarGibbsEnergy(0) print(molar_gibbs_energy) )doc") + .def("phaseMolarGibbsEnergy", static_cast(&ChemicalEngine::phaseMolarGibbsEnergy), + py::arg("phase"), + R"doc( + Returns the molar Gibbs energy of a specific phase by its index (J/mol). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + molar_gibbs_energy = engine.phaseMolarGibbsEnergy("aq_gen") + print(molar_gibbs_energy) + )doc") + .def("phaseMolarGibbsEnergy_i", &ChemicalEngine::phaseMolarGibbsEnergy_i, + py::arg("iphase"), + R"doc( + Returns the molar Gibbs energy of a specific phase by its index (J/mol). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python - .def("phaseMolarEnthalpy", &ChemicalEngine::phaseMolarEnthalpy, + molar_gibbs_energy = engine.phaseMolarGibbsEnergy_i(0) + print(molar_gibbs_energy) + )doc") + + .def("phaseMolarEnthalpy", static_cast(&ChemicalEngine::phaseMolarEnthalpy), + py::arg("iphase"), R"doc( Returns the molar enthalpy of a specific phase by its index (J/mol). - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + molar_enthalpy = engine.phaseMolarEnthalpy(0) print(molar_enthalpy) )doc") + .def("phaseMolarEnthalpy", static_cast(&ChemicalEngine::phaseMolarEnthalpy), + py::arg("phase"), + R"doc( + Returns the molar enthalpy of a specific phase (J/mol). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python - .def("phaseMolarVolume", &ChemicalEngine::phaseMolarVolume, + molar_enthalpy = engine.phaseMolarEnthalpy("aq_gen") + print(molar_enthalpy) + )doc") + .def("phaseMolarEnthalpy_i", &ChemicalEngine::phaseMolarEnthalpy_i, + py::arg("iphase"), + R"doc( + Returns the molar enthalpy of a specific phase by its index (J/mol). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + molar_enthalpy = engine.phaseMolarEnthalpy_i(0) + print(molar_enthalpy) + )doc") + + .def("phaseMolarVolume", static_cast(&ChemicalEngine::phaseMolarVolume), + py::arg("iphase"), R"doc( Returns the molar volume of a specific phase by its index (m³/mol). - - :param int index: Index of the phase. + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** @@ -1118,109 +1611,353 @@ Sets the standard molar Gibbs energy for a species (J/mol). molar_volume = engine.phaseMolarVolume(0) print(molar_volume) )doc") + .def("phaseMolarVolume", static_cast(&ChemicalEngine::phaseMolarVolume), + py::arg("phase"), + R"doc( + Returns the molar volume of a specific phase (m³/mol). + + :param str phase: Name of the phase. - .def("phaseMolarEntropy", &ChemicalEngine::phaseMolarEntropy, + **Example:** + + .. code-block:: python + + molar_volume = engine.phaseMolarVolume("aq_gen") + print(molar_volume) + )doc") + .def("phaseMolarVolume_i", &ChemicalEngine::phaseMolarVolume_i, + py::arg("iphase"), + R"doc( + Returns the molar volume of a specific phase by its index (m³/mol). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + molar_volume = engine.phaseMolarVolume_i(0) + print(molar_volume) + )doc") + + .def("phaseMolarEntropy", static_cast(&ChemicalEngine::phaseMolarEntropy), + py::arg("iphase"), R"doc( Returns the molar entropy of a specific phase by its index (J/K/mol). - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + molar_entropy = engine.phaseMolarEntropy(0) print(molar_entropy) )doc") + .def("phaseMolarEntropy", static_cast(&ChemicalEngine::phaseMolarEntropy), + py::arg("phase"), + R"doc( + Returns the molar entropy of a specific phase (J/K/mol). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + molar_entropy = engine.phaseMolarEntropy("aq_gen") + print(molar_entropy) + )doc") + .def("phaseMolarEntropy_i", &ChemicalEngine::phaseMolarEntropy_i, + py::arg("iphase"), + R"doc( + Returns the molar entropy of a specific phase by its index (J/K/mol). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + molar_entropy = engine.phaseMolarEntropy_i(0) + print(molar_entropy) + )doc") // .def("phaseMolarInternalEnergy", &ChemicalEngine::phaseMolarInternalEnergy) // .def("phaseMolarHelmholtzEnergy", &ChemicalEngine::phaseMolarHelmholtzEnergy) - .def("phaseMolarHeatCapacityConstP", &ChemicalEngine::phaseMolarHeatCapacityConstP, + .def("phaseMolarHeatCapacityConstP", static_cast(&ChemicalEngine::phaseMolarHeatCapacityConstP), + py::arg("iphase"), R"doc( Returns the molar heat capacity at constant pressure of a specific species by its index (J/K/mol). - - :param int index: Index of the species. - + Access specified element with bounds checking. + + :param int iphase: Index of the species. + **Example:** - + .. code-block:: python - + molar_heat_capacity = engine.phaseMolarHeatCapacityConstP(0) print(molar_heat_capacity) )doc") + .def("phaseMolarHeatCapacityConstP", static_cast(&ChemicalEngine::phaseMolarHeatCapacityConstP), + py::arg("phase"), + R"doc( + Returns the molar heat capacity at constant pressure of a specific species (J/K/mol). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + molar_heat_capacity = engine.phaseMolarHeatCapacityConstP("aq_gen") + print(molar_heat_capacity) + )doc") + .def("phaseMolarHeatCapacityConstP_i", &ChemicalEngine::phaseMolarHeatCapacityConstP_i, + py::arg("iphase"), + R"doc( + Returns the molar heat capacity at constant pressure of a specific species by its index (J/K/mol). + Access specified element without bounds checking. + + :param int iphase: Index of the species. + + **Example:** + + .. code-block:: python + + molar_heat_capacity = engine.phaseMolarHeatCapacityConstP_i(0) + print(molar_heat_capacity) + )doc") // .def("phaseMolarHeatCapacityConstV", &ChemicalEngine::phaseMolarHeatCapacitiesConstV) - .def("phaseSpecificGibbsEnergy", &ChemicalEngine::phaseSpecificGibbsEnergy, + .def("phaseSpecificGibbsEnergy", static_cast(&ChemicalEngine::phaseSpecificGibbsEnergy), + py::arg("iphase"), R"doc( Returns the specific Gibbs energy of a specific phase by its index (J/kg). - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + specific_gibbs_energy = engine.phaseSpecificGibbsEnergy(0) + print(specific_gibbs_energy) + )doc") + .def("phaseSpecificGibbsEnergy", static_cast(&ChemicalEngine::phaseSpecificGibbsEnergy), + py::arg("phase"), + R"doc( + Returns the specific Gibbs energy of a specific phase (J/kg). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + specific_gibbs_energy = engine.phaseSpecificGibbsEnergy("aq_gen") + print(specific_gibbs_energy) + )doc") + .def("phaseSpecificGibbsEnergy_i", &ChemicalEngine::phaseSpecificGibbsEnergy_i, + R"doc( + Returns the specific Gibbs energy of a specific phase by its index (J/kg). + Access specified element without bounds checking. + :param int index: Index of the phase. + + **Example:** + + .. code-block:: python + + specific_gibbs_energy = engine.phaseSpecificGibbsEnergy_i(0) + print(specific_gibbs_energy) + )doc") + + .def("phaseSpecificEnthalpy", static_cast(&ChemicalEngine::phaseSpecificEnthalpy), + py::arg("iphase"), + R"doc( + Returns the specific enthalpy of a specific phase by its index (J/kg). + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** .. code-block:: python - specific_gibbs_energy = engine.phaseSpecificGibbsEnergy(0) - print(specific_gibbs_energy) + specific_enthalpy = engine.phaseSpecificEnthalpy(0) + print(specific_enthalpy) + )doc") + .def("phaseSpecificEnthalpy", static_cast(&ChemicalEngine::phaseSpecificEnthalpy), + py::arg("phase"), + R"doc( + Returns the specific enthalpy of a specific phase (J/kg). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + specific_enthalpy = engine.phaseSpecificEnthalpy("aq_gen") + print(specific_enthalpy) + )doc") + .def("phaseSpecificEnthalpy_i", &ChemicalEngine::phaseSpecificEnthalpy_i, + py::arg("iphase"), + R"doc( + Returns the specific enthalpy of a specific phase by its index (J/kg). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + specific_enthalpy = engine.phaseSpecificEnthalpy_i(0) + print(specific_enthalpy) + )doc") + + .def("phaseSpecificVolume", static_cast(&ChemicalEngine::phaseSpecificVolume), + py::arg("iphase"), + R"doc( + Returns the specific volume of a specific phase by its index (m³/kg). + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + specific_volume = engine.phaseSpecificVolume(0) + print(specific_volume) + )doc") + .def("phaseSpecificVolume", static_cast(&ChemicalEngine::phaseSpecificVolume), + py::arg("phase"), + R"doc( + Returns the specific volume of a specific phase (m³/kg). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + specific_volume = engine.phaseSpecificVolume("aq_gen") + print(specific_volume) + )doc") + .def("phaseSpecificVolume_i", &ChemicalEngine::phaseSpecificVolume_i, + R"doc( + Returns the specific volume of a specific phase by its index (m³/kg). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + specific_volume = engine.phaseSpecificVolume_i(0) + print(specific_volume) )doc") - .def("phaseSpecificEnthalpy", &ChemicalEngine::phaseSpecificEnthalpy, + .def("phaseSpecificEntropy", static_cast(&ChemicalEngine::phaseSpecificEntropy), + py::arg("iphase"), R"doc( - Returns the specific enthalpy of a specific phase by its index (J/kg). - - :param int index: Index of the phase. + Returns the specific entropy of a specific phase by its index (J/K/kg). + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** .. code-block:: python - specific_enthalpy = engine.phaseSpecificEnthalpy(0) - print(specific_enthalpy) + specific_entropy = engine.phaseSpecificEntropy(0) + print(specific_entropy) )doc") - - .def("phaseSpecificVolume", &ChemicalEngine::phaseSpecificVolume, + .def("phaseSpecificEntropy", static_cast(&ChemicalEngine::phaseSpecificEntropy), + py::arg("phase"), R"doc( - Returns the specific volume of a specific phase by its index (m³/kg). - - :param int index: Index of the phase. - + Returns the specific entropy of a specific phase (J/K/kg). + + :param str phase: Name of the phase. + **Example:** - + .. code-block:: python - - specific_volume = engine.phaseSpecificVolume(0) - print(specific_volume) - )doc") - .def("phaseSpecificEntropy", &ChemicalEngine::phaseSpecificEntropy, + specific_entropy = engine.phaseSpecificEntropy("aq_gen") + print(specific_entropy) + )doc") + .def("phaseSpecificEntropy_i", &ChemicalEngine::phaseSpecificEntropy_i, + py::arg("iphase"), R"doc( Returns the specific entropy of a specific phase by its index (J/K/kg). - - :param int index: Index of the phase. - + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - - specific_entropy = engine.phaseSpecificEntropy(0) + + specific_entropy = engine.phaseSpecificEntropy_i(0) print(specific_entropy) )doc") // .def("phaseSpecificInternalEnergy", &ChemicalEngine::phaseSpecificInternalEnergy) // .def("phaseSpecificHelmholtzEnergy", &ChemicalEngine::phaseSpecificHelmholtzEnergy) - .def("phaseSpecificHeatCapacityConstP", &ChemicalEngine::phaseSpecificHeatCapacityConstP, + .def("phaseSpecificHeatCapacityConstP", static_cast(&ChemicalEngine::phaseSpecificHeatCapacityConstP), + py::arg("iphase"), R"doc( Returns the specific heat capacity at constant pressure of a specific phase by its index (J/K/kg). - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + specific_heat_capacity = engine.phaseSpecificHeatCapacityConstP(0) print(specific_heat_capacity) )doc") + .def("phaseSpecificHeatCapacityConstP", static_cast(&ChemicalEngine::phaseSpecificHeatCapacityConstP), + py::arg("phase"), + R"doc( + Returns the specific heat capacity at constant pressure of a specific phase (J/K/kg). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + specific_heat_capacity = engine.phaseSpecificHeatCapacityConstP("aq_gen") + print(specific_heat_capacity) + )doc") + .def("phaseSpecificHeatCapacityConstP_i", &ChemicalEngine::phaseSpecificHeatCapacityConstP_i, + py::arg("iphase"), + R"doc( + Returns the specific heat capacity at constant pressure of a specific phase by its index (J/K/kg). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + specific_heat_capacity = engine.phaseSpecificHeatCapacityConstP_i(0) + print(specific_heat_capacity) + )doc") // .def("phaseSpecificHeatCapacityConstV", &ChemicalEngine::phaseSpecificHeatCapacityConstVl) .def("phaseDensities", &ChemicalEngine::phaseDensities, @@ -1236,11 +1973,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseDensity", &ChemicalEngine::phaseDensity, py::arg("index"), + .def("phaseDensity", static_cast(&ChemicalEngine::phaseDensity), + py::arg("iphase"), R"doc( Returns the density of a specific phase by its index (kg/m³). - - :param int index: Index of the phase. + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** @@ -1249,6 +1988,34 @@ Sets the standard molar Gibbs energy for a species (J/mol). density = engine.phaseDensity(0) print(density) )doc") + .def("phaseDensity", static_cast(&ChemicalEngine::phaseDensity), + py::arg("phase"), + R"doc( + Returns the density of a specific phase (kg/m³). + + :param str phase: Name of the phase. + **Example:** + + .. code-block:: python + + density = engine.phaseDensity("aq_gen") + print(density) + )doc") + .def("phaseDensity_i", &ChemicalEngine::phaseDensity_i, + py::arg("iphase"), + R"doc( + Returns the density of a specific phase by its index (kg/m³). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + density = engine.phaseDensity_i(0) + print(density) + )doc") .def("phaseMasses", &ChemicalEngine::phaseMasses, R"doc( @@ -1263,19 +2030,50 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseMass", &ChemicalEngine::phaseMass, py::arg("index"), + .def("phaseMass", static_cast(&ChemicalEngine::phaseMass), + py::arg("iphase"), R"doc( Returns the mass of a specific phase by its index (kg). - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + mass = engine.phaseMass(0) print(mass) )doc") + .def("phaseMass", static_cast(&ChemicalEngine::phaseMass), + py::arg("phase"), + R"doc( + Returns the mass of a specific phase (kg). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + mass = engine.phaseMass("aq_gen") + print(mass) + )doc") + .def("phaseMass_i", &ChemicalEngine::phaseMass_i, + py::arg("iphase"), + R"doc( + Returns the mass of a specific phase by its index (kg). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + mass = engine.phaseMass_i(0) + print(mass) + )doc") .def("phaseAmounts", &ChemicalEngine::phaseAmounts, R"doc( @@ -1290,11 +2088,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseAmount", &ChemicalEngine::phaseAmount, py::arg("index"), + .def("phaseAmount", static_cast(&ChemicalEngine::phaseAmount), + py::arg("iphase"), R"doc( Returns the amount of a specific phase by its index (mol). - - :param int index: Index of the phase. + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** @@ -1303,6 +2103,35 @@ Sets the standard molar Gibbs energy for a species (J/mol). amount = engine.phaseAmount(0) print(amount) )doc") + .def("phaseAmount", static_cast(&ChemicalEngine::phaseAmount), + py::arg("phase"), + R"doc( + Returns the amount of a specific phase (mol). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + amount = engine.phaseAmount("aq_gen") + print(amount) + )doc") + .def("phaseAmount_i", &ChemicalEngine::phaseAmount_i, + py::arg("iphase"), + R"doc( + Returns the amount of a specific phase by its index (mol). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + amount = engine.phaseAmount_i(0) + print(amount) + )doc") .def("phaseVolumes", &ChemicalEngine::phaseVolumes, R"doc( @@ -1317,11 +2146,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseVolume", &ChemicalEngine::phaseVolume, py::arg("index"), + .def("phaseVolume", static_cast(&ChemicalEngine::phaseVolume), + py::arg("iphase"), R"doc( Returns the volume of a specific phase by its index (m³). - - :param int index: Index of the phase. + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** @@ -1330,6 +2161,35 @@ Sets the standard molar Gibbs energy for a species (J/mol). volume = engine.phaseVolume(0) print(volume) )doc") + .def("phaseVolume", static_cast(&ChemicalEngine::phaseVolume), + py::arg("phase"), + R"doc( + Returns the volume of a specific phase (m³). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + volume = engine.phaseVolume("aq_gen") + print(volume) + )doc") + .def("phaseVolume_i", &ChemicalEngine::phaseVolume_i, + py::arg("iphase"), + R"doc( + Returns the iphase of a specific phase by its index (m³). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + volume = engine.phaseVolume_i(0) + print(volume) + )doc") .def("phaseEnthalpies", &ChemicalEngine::phaseEnthalpies, R"doc( @@ -1344,11 +2204,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseEnthalpy", &ChemicalEngine::phaseEnthalpy, py::arg("index"), + .def("phaseEnthalpy", static_cast(&ChemicalEngine::phaseEnthalpy), + py::arg("iphase"), R"doc( Returns the enthalpy of a specific phase by its index (J). - - :param int index: Index of the phase. + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** @@ -1357,6 +2219,35 @@ Sets the standard molar Gibbs energy for a species (J/mol). enthalpy = engine.phaseEnthalpy(0) print(enthalpy) )doc") + .def("phaseEnthalpy", static_cast(&ChemicalEngine::phaseEnthalpy), + py::arg("phase"), + R"doc( + Returns the enthalpy of a specific phase (J). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + enthalpy = engine.phaseEnthalpy("aq_gen") + print(enthalpy) + )doc") + .def("phaseEnthalpy_i", &ChemicalEngine::phaseEnthalpy_i, + py::arg("iphase"), + R"doc( + Returns the enthalpy of a specific phase by its index (J). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + enthalpy = engine.phaseEnthalpy_i(0) + print(enthalpy) + )doc") .def("phaseEntropies", &ChemicalEngine::phaseEntropies, R"doc( @@ -1371,19 +2262,50 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseEntropy", &ChemicalEngine::phaseEntropy, py::arg("index"), + .def("phaseEntropy", static_cast(&ChemicalEngine::phaseEntropy), + py::arg("iphase"), R"doc( Returns the entropy of a specific phase by its index (J/K). - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + entropy = engine.phaseEntropy(0) print(entropy) )doc") + .def("phaseEntropy", static_cast(&ChemicalEngine::phaseEntropy), + py::arg("phase"), + R"doc( + Returns the entropy of a specific phase (J/K). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + entropy = engine.phaseEntropy("aq_gen") + print(entropy) + )doc") + .def("phaseEntropy_i", &ChemicalEngine::phaseEntropy_i, + py::arg("iphase"), + R"doc( + Returns the entropy of a specific phase by its index (J/K). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + entropy = engine.phaseEntropy_i(0) + print(entropy) + )doc") .def("phaseHeatCapacitiesConstP", &ChemicalEngine::phaseHeatCapacitiesConstP, R"doc( @@ -1398,11 +2320,13 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseHeatCapacityConstP", &ChemicalEngine::phaseHeatCapacityConstP, py::arg("index"), + .def("phaseHeatCapacityConstP", static_cast(&ChemicalEngine::phaseHeatCapacityConstP), + py::arg("iphase"), R"doc( Returns the isobaric heat capacity of a specific phase by its index (J/K). - - :param int index: Index of the phase. + Access specified element with bounds checking. + + :param int iphase: Index of the phase. **Example:** @@ -1411,6 +2335,35 @@ Sets the standard molar Gibbs energy for a species (J/mol). heat_capacity = engine.phaseHeatCapacityConstP(0) print(heat_capacity) )doc") + .def("phaseHeatCapacityConstP", static_cast(&ChemicalEngine::phaseHeatCapacityConstP), + py::arg("phase"), + R"doc( + Returns the isobaric heat capacity of a specific phase (J/K). + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + heat_capacity = engine.phaseHeatCapacityConstP("aq_gen") + print(heat_capacity) + )doc") + .def("phaseHeatCapacityConstP_i", &ChemicalEngine::phaseHeatCapacityConstP_i, + py::arg("iphase"), + R"doc( + Returns the isobaric heat capacity of a specific phase by its index (J/K). + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + heat_capacity = engine.phaseHeatCapacityConstP_i(0) + print(heat_capacity) + )doc") .def("phaseSatIndices", &ChemicalEngine::phaseSatIndices, R"doc( @@ -1425,19 +2378,50 @@ Sets the standard molar Gibbs energy for a species (J/mol). )doc", py::return_value_policy::reference_internal) - .def("phaseSatIndex", &ChemicalEngine::phaseSatIndex, py::arg("index"), + .def("phaseSatIndex", static_cast(&ChemicalEngine::phaseSatIndex), + py::arg("iphase"), R"doc( Returns the saturation index of a specific phase by its index. - - :param int index: Index of the phase. - + Access specified element with bounds checking. + + :param int iphase: Index of the phase. + **Example:** - + .. code-block:: python - + sat_index = engine.phaseSatIndex(0) print(sat_index) )doc") + .def("phaseSatIndex", static_cast(&ChemicalEngine::phaseSatIndex), + py::arg("phase"), + R"doc( + Returns the saturation index of a specific phase. + + :param str phase: Name of the phase. + + **Example:** + + .. code-block:: python + + sat_index = engine.phaseSatIndex("aq_gen") + print(sat_index) + )doc") + .def("phaseSatIndex_i", &ChemicalEngine::phaseSatIndex_i, + py::arg("iphase"), + R"doc( + Returns the saturation index of a specific phase by its index. + Access specified element without bounds checking. + + :param int iphase: Index of the phase. + + **Example:** + + .. code-block:: python + + sat_index = engine.phaseSatIndex_i(0) + print(sat_index) + )doc") .def("systemMass", &ChemicalEngine::systemMass, R"doc( diff --git a/python/src/xgems/pyxdGEMS.hpp b/python/src/xgems/pyxdGEMS.hpp index 5a7c085..0ffcbf9 100644 --- a/python/src/xgems/pyxdGEMS.hpp +++ b/python/src/xgems/pyxdGEMS.hpp @@ -1,7 +1,7 @@ // ChemicalFun is a C++ and Python library for of C++ and Python API // for Chemical Formula Parser and Reactions Generator. // -// Copyright (C) 2018-2022 G.D.Miron, D.Kulik, S.Dmytriieva +// Copyright (C) 2018-2026 G.D.Miron, D.Kulik, S.Dmytriieva // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -41,7 +41,8 @@ void exportChemicalEngineMaps(py::module& m) Class for equilibrium computations and thermodynamic analysis using dictionaries. Gems interface in calculator format for easy using dictionaries.)doc"); - gems.def(py::init(), py::arg("input_file"), py::arg("reset_calc")=false, py::arg("cold_start")=true, + gems.def(py::init(), + py::arg("input_file"), py::arg("reset_calc")=false, py::arg("cold_start")=true, R"doc( Constructs a ChemicalEngineDicts instance by loading a GEM-Selektor project file. @@ -312,11 +313,13 @@ Clear the amounts of elements (set the default amount for all components). )doc") .def("set_species_G0", &ChemicalEngineMaps::set_species_G0, + py::arg("name"), py::arg("value"), py::arg("phase") = py::none(), R"doc( Sets the standard molar Gibbs energy for a species (J/mol). :param str name: Species name. :param float value: Standard molar Gibbs energy value (J/mol). +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -481,7 +484,8 @@ Sets the standard molar Gibbs energy for a species (J/mol). print("aq_elements_moles", engine.aq_elements_moles) )doc") - .def("set_bulk_composition", &ChemicalEngineMaps::set_bulk_composition, py::arg("b_input"), py::arg("min_amount")=1e-15, + .def("set_bulk_composition", &ChemicalEngineMaps::set_bulk_composition, + py::arg("b_input"), py::arg("min_amount")=1e-15, R"doc( Sets the amounts of elements (vector b). @@ -509,7 +513,8 @@ Be careful as this will also remove water i.e H+ and OH-. engine.reset_aq_composition() )doc") - .def("solids_elements_moles", &ChemicalEngineMaps::solids_elements_moles, py::arg("min_amount_phase")=1e-12, py::arg("min_amount_element")=1e-14, + .def("solids_elements_moles", &ChemicalEngineMaps::solids_elements_moles, + py::arg("min_amount_phase")=1e-12, py::arg("min_amount_element")=1e-14, R"doc( Returns the dictionary of the mole amounts of elements in all solids together. @@ -767,7 +772,8 @@ Get the dictionary of phase species amounts in mol. print("phases_volume_frac", engine.phases_volume_frac) )doc") - .def("add_multiple_species_amt", &ChemicalEngineMaps::add_multiple_species_amt, py::arg("input_dict"), py::arg("units")="moles", + .def("add_multiple_species_amt", &ChemicalEngineMaps::add_multiple_species_amt, + py::arg("input_dict"), py::arg("units")="moles", R"doc( Add multiple species amounts in the system useful for adding aqueous solution composition. @@ -780,13 +786,15 @@ Add multiple species amounts in the system useful for adding aqueous solution co engine.add_multiple_species_amt( { 'HCl@':0.01, 'H2@':2 }, "moles") )doc") - .def("add_species_amt", &ChemicalEngineMaps::add_species_amt, py::arg("species"), py::arg("val"), py::arg("units")="moles", + .def("add_species_amt", &ChemicalEngineMaps::add_species_amt, + py::arg("species"), py::arg("val"), py::arg("units")="moles", py::arg("phase") = py::none(), R"doc( Add species amount in the system useful for adding aqueous solution composition. :param str species: Species symbol. :param float val: Species amount in units. :param str units: Units of amount ("moles", "kg", "m3"), default "moles". +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -794,7 +802,8 @@ Add species amount in the system useful for adding aqueous solution composition. engine.add_species_amt( 'H2O@', 0.01, "kg") )doc") - .def("add_element_amt", &ChemicalEngineMaps::add_element_amt, py::arg("element_name"), py::arg("val"), py::arg("units")="moles", + .def("add_element_amt", &ChemicalEngineMaps::add_element_amt, + py::arg("element_name"), py::arg("val"), py::arg("units")="moles", R"doc( Add element amount in the system. @@ -808,7 +817,8 @@ Add element amount in the system. engine.add_element_amt( 'Al', 0.3, "moles") )doc") - .def("add_multiple_elements_amt", &ChemicalEngineMaps::add_multiple_elements_amt, py::arg("input_dict"), py::arg("units")="moles", + .def("add_multiple_elements_amt", &ChemicalEngineMaps::add_multiple_elements_amt, + py::arg("input_dict"), py::arg("units")="moles", R"doc( Add multiple elements amount in the system useful for adding aqueous solution composition @@ -821,7 +831,8 @@ Add multiple elements amount in the system useful for adding aqueous solution co engine.add_multiple_elements_amt( { 'Na':1.013077, 'Si':1.013077 }, "moles") )doc") - .def("add_amt_from_formula", &ChemicalEngineMaps::add_amt_from_formula, py::arg("formula"), py::arg("val"), py::arg("units")="moles", + .def("add_amt_from_formula", &ChemicalEngineMaps::add_amt_from_formula, + py::arg("formula"), py::arg("val"), py::arg("units")="moles", R"doc( Add multiple elements using user defined formula. @@ -835,7 +846,8 @@ Add multiple elements using user defined formula. engine.add_amt_from_formula( { 'K':2, 'O':1 }, 4.108*1e-3, "kg") )doc") - .def("get_b_from_formula", &ChemicalEngineMaps::get_b_from_formula, py::arg("formula"), py::arg("val")=1, py::arg("units")="moles", py::arg("min_amount")=1e-15, + .def("get_b_from_formula", &ChemicalEngineMaps::get_b_from_formula, + py::arg("formula"), py::arg("val")=1, py::arg("units")="moles", py::arg("min_amount")=1e-15, R"doc( Returns a bulk vector b from user-defined formula (as dict. {"H":2,"O":1} ) and amount of the formula [object] in units of 'moles' or 'kg'. @@ -855,7 +867,8 @@ and amount of the formula [object] in units of 'moles' or 'kg'. print("b_from_formula", b_from_formula) )doc") - .def("set_multiple_species_lower_bound", &ChemicalEngineMaps::set_multiple_species_lower_bound, py::arg("input_dict"), py::arg("units")="moles", + .def("set_multiple_species_lower_bound", &ChemicalEngineMaps::set_multiple_species_lower_bound, + py::arg("input_dict"), py::arg("units")="moles", R"doc( Sets an lower bound for multiple species. @@ -868,7 +881,8 @@ Sets an lower bound for multiple species. engine.set_multiple_species_lower_bound( {'Mg(CO3)@':30, 'Mg(HCO3)+':40, 'Mg+2':50}) )doc") - .def("set_multiple_species_upper_bound", &ChemicalEngineMaps::set_multiple_species_upper_bound, py::arg("input_dict"), py::arg("units")="moles", + .def("set_multiple_species_upper_bound", &ChemicalEngineMaps::set_multiple_species_upper_bound, + py::arg("input_dict"), py::arg("units")="moles", R"doc( Sets an upper bounds for multiple species. @@ -881,14 +895,16 @@ Sets an upper bounds for multiple species. engine.set_multiple_species_upper_bound( {'Mg(CO3)@':300, 'Mg(HCO3)+':400, 'Mg+2':500}) )doc") - .def("set_species_lower_bound", py::overload_cast - (&ChemicalEngineMaps::set_species_lower_bound), py::arg("species"), py::arg("val"), py::arg("units")="moles", + .def("set_species_lower_bound", py::overload_cast > + (&ChemicalEngineMaps::set_species_lower_bound), + py::arg("species"), py::arg("val"), py::arg("units")="moles", py::arg("phase") = py::none(), R"doc( Sets a lower bound for a species identified by name. :param str species: Species name. :param float val: Lower limit in units. :param str units: Units of amount ("moles", "kg", "m3"), default "moles". +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -897,7 +913,8 @@ Sets a lower bound for a species identified by name. engine.set_species_lower_bound( 'Ca(HCO3)+', 200, "moles") )doc") .def("set_species_lower_bound", py::overload_cast - (&ChemicalEngineMaps::set_species_lower_bound), py::arg("ispecies"), py::arg("val"), py::arg("units")="moles", + (&ChemicalEngineMaps::set_species_lower_bound), + py::arg("ispecies"), py::arg("val"), py::arg("units")="moles", R"doc( Sets a lower bound (minimum amount allowed to form) for a species identified by its index (phase depended case). @@ -911,14 +928,16 @@ Sets a lower bound (minimum amount allowed to form) for a species identified by engine.set_species_lower_bound( 8, 400, "moles") )doc") - .def("set_species_upper_bound", py::overload_cast - (&ChemicalEngineMaps::set_species_upper_bound), py::arg("species"), py::arg("val"), py::arg("units")="moles", + .def("set_species_upper_bound", py::overload_cast> + (&ChemicalEngineMaps::set_species_upper_bound), + py::arg("species"), py::arg("val"), py::arg("units")="moles", py::arg("phase") = py::none(), R"doc( Sets an upper bound for a species identified by name. :param str species: Species name. :param float val: Upper limit in units. :param str units: Units of amount ("moles", "kg", "m3"), default "moles". +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -927,7 +946,8 @@ Sets an upper bound for a species identified by name. engine.set_species_upper_bound( 'CaOH+', 500, "kg") )doc") .def("set_species_upper_bound", py::overload_cast - (&ChemicalEngineMaps::set_species_upper_bound), py::arg("ispecies"), py::arg("val"), py::arg("units")="moles", + (&ChemicalEngineMaps::set_species_upper_bound), + py::arg("ispecies"), py::arg("val"), py::arg("units")="moles", R"doc( Sets an upper bound (maximum amount allowed to form) for a species identified by its index (phase depended case). @@ -942,7 +962,8 @@ Sets an upper bound (maximum amount allowed to form) for a species identified by engine.set_species_lower_bound( 8, 400, "moles") )doc") - .def("suppress_phase", &ChemicalEngineMaps::suppress_phase, py::arg("phase_name"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, + .def("suppress_phase", &ChemicalEngineMaps::suppress_phase, + py::arg("phase_name"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, R"doc( Suppresses a phase in GEM calculation. @@ -956,7 +977,8 @@ Suppresses a phase in GEM calculation. engine.suppress_phase('gas_gen') )doc") - .def("suppress_multiple_phases", &ChemicalEngineMaps::suppress_multiple_phases, py::arg("phase_name_list"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, + .def("suppress_multiple_phases", &ChemicalEngineMaps::suppress_multiple_phases, + py::arg("phase_name_list"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, R"doc( Suppresses multiple phases in calculation as given in phase names list. @@ -970,13 +992,15 @@ Suppresses multiple phases in calculation as given in phase names list. engine.suppress_multiple_phases(['Dolomite-dis', 'Tin']) )doc") - .def("suppress_species", &ChemicalEngineMaps::suppress_species, py::arg("species_name"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, + .def("suppress_species", &ChemicalEngineMaps::suppress_species, py::arg("species_name"), + py::arg("min_amount")=0, py::arg("max_amount")=1e-15, py::arg("phase") = py::none(), R"doc( Suppresses a specie in calculation. :param str species_name: Species name. :param float min_amount: Lower amount of specie in mol, default 0. :param float max_amount: Upper amount of specie in mol, default 1e-15. +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** @@ -984,7 +1008,8 @@ Suppresses a specie in calculation. engine.suppress_species('Ca(CO3)@') )doc") - .def("suppress_multiple_species", &ChemicalEngineMaps::suppress_multiple_species, py::arg("species_list"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, + .def("suppress_multiple_species", &ChemicalEngineMaps::suppress_multiple_species, + py::arg("species_list"), py::arg("min_amount")=0, py::arg("max_amount")=1e-15, R"doc( Suppresses multiple species in in GEM calculation as given in species name list. @@ -1023,10 +1048,12 @@ Activate multiple suppressed phases given in list. engine.activate_multiple_phases(['Dolomite-dis', 'Tin']) )doc") .def("activate_species", &ChemicalEngineMaps::activate_species, + py::arg("species_name"), py::arg("phase") = py::none(), R"doc( Activate a suppressed species in phase. :param str species_name: Species name. +:param str phase: Name of the phase the species was included in. If None get the first index. **Example:** diff --git a/xGEMS/ChemicalEngine.cpp b/xGEMS/ChemicalEngine.cpp index ed4a0e9..bef5c7c 100644 --- a/xGEMS/ChemicalEngine.cpp +++ b/xGEMS/ChemicalEngine.cpp @@ -306,77 +306,141 @@ namespace xGEMS return pimpl->node->pCSD()->nPH; } - auto ChemicalEngine::numSpeciesInPhase(Index iphase) const -> Index + auto ChemicalEngine::numSpeciesInPhase_i(Index iphase) const -> Index { return pimpl->node->pCSD()->nDCinPH[iphase]; } + auto ChemicalEngine::numSpeciesInPhase(Index iphase) const -> Index + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return pimpl->node->pCSD()->nDCinPH[iphase]; + } + return 0; + } + + auto ChemicalEngine::numSpeciesInPhase(std::string phase) const -> Index + { + auto iphase = indexPhase(phase); + if(iphasenode->pCSD()->nDCinPH[iphase]; + } + return 0; + } + + auto ChemicalEngine::elementName_i(Index ielement) const -> std::string + { + return pimpl->node->pCSD()->ICNL[ielement]; + } + auto ChemicalEngine::elementName(Index ielement) const -> std::string { - std::string name = pimpl->node->pCSD()->ICNL[ielement]; - if (name.length() > MaxICnameLength) - name.resize(MaxICnameLength); - return name; + if(pimpl->node->check_IC_xCH(ielement)) { + return pimpl->node->pCSD()->ICNL[ielement]; + } + return {}; + } + + auto ChemicalEngine::speciesName_i(Index ispecies) const -> std::string + { + return pimpl->node->pCSD()->DCNL[ispecies]; } auto ChemicalEngine::speciesName(Index ispecies) const -> std::string { - std::string name = pimpl->node->pCSD()->DCNL[ispecies]; - if (name.length() > MaxDCnameLength) - name.resize(MaxDCnameLength); - return name; + if(pimpl->node->check_DC_xCH(ispecies)) { + return pimpl->node->pCSD()->DCNL[ispecies]; + } + return {}; } - auto ChemicalEngine::speciesCharge(Index ispecies) const -> double + auto ChemicalEngine::speciesCharge_i(Index ispecies) const -> double { MatrixConstRef W = formulaMatrix(); auto chargeRow = numElements(); return W(chargeRow - 1, ispecies); } + auto ChemicalEngine::speciesCharge(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return speciesCharge_i(ispecies); + } + return 0; + } + + auto ChemicalEngine::speciesCharge(std::string species, std::optional phase) const -> double + { + auto ispecies = indexSpecies(species, phase); + if(ispecies std::string + { + return pimpl->node->pCSD()->PHNL[iphase]; + } + auto ChemicalEngine::phaseName(Index iphase) const -> std::string { - std::string name = pimpl->node->pCSD()->PHNL[iphase]; - if (name.length() > MaxPHnameLength) - name.resize(MaxPHnameLength); - return name; + if(pimpl->node->check_Phase_xCH(iphase)) { + return pimpl->node->pCSD()->PHNL[iphase]; + } + return {}; } - // These methods may be ambiguous, as in GEMS3K, species with the same name - // may occur in more than one condensed phase! - // An overload including phase name or index is needed! - // - auto ChemicalEngine::setSpeciesUpperLimit(std::string name, double amount) -> void + auto ChemicalEngine::setSpeciesUpperLimit_i(Index ispecies, double amount) -> void { - auto ispecies = indexSpecies(name); double bound = (amount < 0.0 ? 1e6 : amount); pimpl->node->pCNode()->dul[ispecies] = bound; } - auto ChemicalEngine::setSpeciesLowerLimit(std::string name, double amount) -> void + auto ChemicalEngine::setSpeciesLowerLimit_i(Index ispecies, double amount) -> void { - auto ispecies = indexSpecies(name); double bound = (amount < 0.0 ? 0.0 : amount); pimpl->node->pCNode()->dll[ispecies] = bound; } + // These methods may be ambiguous, as in GEMS3K, species with the same name + // may occur in more than one condensed phase! + // An overload including phase name or index is needed! + // + auto ChemicalEngine::setSpeciesUpperLimit(std::string name, double amount, std::optional phase) -> void + { + auto ispecies = indexSpecies(name, phase); + if(ispecies phase) -> void + { + auto ispecies = indexSpecies(name, phase); + if(ispecies void { - double bound = (amount < 0.0 ? 1e6 : amount); - pimpl->node->pCNode()->dul[ispecies] = bound; + if(pimpl->node->check_DC_xCH(ispecies)) { + setSpeciesUpperLimit_i(ispecies, amount); + } } // Overload! auto ChemicalEngine::setSpeciesLowerLimit(Index ispecies, double amount) -> void { - double bound = (amount < 0.0 ? 0.0 : amount); - pimpl->node->pCNode()->dll[ispecies] = bound; + if(pimpl->node->check_DC_xCH(ispecies)) { + setSpeciesLowerLimit_i(ispecies, amount); + } } auto ChemicalEngine::setSpeciesUpperLimits(VectorConstRef n) -> void { - // Updates all the specied upper limits for (Index jj = 0; jj < numSpecies(); jj++) pimpl->node->Set_dul(jj, n[jj]); @@ -388,31 +452,53 @@ namespace xGEMS pimpl->node->Set_dll(jj, n[jj]); } - auto ChemicalEngine::setStandardMolarGibbsEnergy(std::string name, double value) -> void + auto ChemicalEngine::setStandardMolarGibbsEnergy_i(Index ispecies, double value) -> void { - auto ispecies = indexSpecies(name); double TK = pimpl->node->cTK(); double P = pimpl->node->cP(); auto idc = pimpl->node->DC_xDB_to_xCH(ispecies); pimpl->node->Set_DC_G0(idc, P, TK, value); } + auto ChemicalEngine::setStandardMolarGibbsEnergy(Index ispecies, double value) -> void + { + if(pimpl->node->check_DC_xCH(ispecies)) { + setStandardMolarGibbsEnergy_i(ispecies, value); + } + } + + auto ChemicalEngine::setStandardMolarGibbsEnergy(std::string name, double value, std::optional phase) -> void + { + auto ispecies = indexSpecies(name, phase); + if(ispecies Index { - const Index size = numElements(); - for (Index i = 0; i < size; ++i) - if (elementName(i) == element) - return i; - return size; // in case that element name was not found + auto ielement = pimpl->node->IC_name_to_xCH(element); + return (ielement>=0 ? ielement : numElements()); // in case that element name was not found } - auto ChemicalEngine::indexSpecies(std::string species) const -> Index + auto ChemicalEngine::indexSpecies(std::string species, std::optional phase) const -> Index { - const Index size = numSpecies(); - for (Index i = 0; i < size; ++i) - if (speciesName(i) == species) - return i; - return size; // in case that species name was not found + int ispecies = -1; + if(phase.has_value()) { + auto species_map = pimpl->node->DC_name_to_xCH_map(species); + if(species_map.find(phase.value()) != species_map.end()) { + return species_map[phase.value()]; + } + } + else { + ispecies = pimpl->node->DC_name_to_xCH(species); + } + return (ispecies>=0 ? ispecies : numSpecies()); // in case that element name was not found + } + + std::map ChemicalEngine::indexSpeciesMap(std::string species) const + { + return pimpl->node->DC_name_to_xCH_map(species); } auto ChemicalEngine::indexSpeciesAll(std::string species) const -> VectorXi @@ -421,7 +507,7 @@ namespace xGEMS occur.resize(0); const Index size = numSpecies(); for (Index i = 0; i < size; ++i) - if (speciesName(i) == species) + if (speciesName_i(i) == species) occur.push_back(i); Index n_species_found = occur.size(); VectorXi result; @@ -438,11 +524,8 @@ namespace xGEMS // Index of phase searched by name auto ChemicalEngine::indexPhase(std::string phase) const -> Index { - const Index size = numPhases(); - for (Index i = 0; i < size; ++i) - if (phaseName(i) == phase) - return i; - return size; // in case that phase name was not found + auto iphase = pimpl->node->Ph_name_to_xCH(phase); + return (iphase>=0 ? iphase : numPhases()); // in case that element name was not found } auto ChemicalEngine::indexPhaseAll(std::string phase) const -> VectorXi @@ -451,7 +534,7 @@ namespace xGEMS occur.resize(0); const Index size = numPhases(); for (Index i = 0; i < size; ++i) - if (phaseName(i) == phase) + if (phaseName_i(i) == phase) occur.push_back(i); Index n_phases_found = occur.size(); VectorXi result; @@ -471,21 +554,38 @@ namespace xGEMS Index counter = 0; for (Index i = 0; i < size; ++i) { - counter += numSpeciesInPhase(i); + counter += numSpeciesInPhase_i(i); if (counter > ispecies) return i; } return size; // in case that species name was not found } - auto ChemicalEngine::indexFirstSpeciesInPhase(Index iphase) const -> Index + auto ChemicalEngine::indexFirstSpeciesInPhase_i(Index iphase) const -> Index { Index counter = 0; for (Index i = 0; i < iphase; ++i) - counter += numSpeciesInPhase(i); + counter += numSpeciesInPhase_i(i); return counter; } + auto ChemicalEngine::indexFirstSpeciesInPhase(Index iphase) const -> Index + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return indexFirstSpeciesInPhase_i(iphase); + } + return numSpecies(); + } + + auto ChemicalEngine::indexFirstSpeciesInPhase(std::string phase) const -> Index + { + auto iphase = indexPhase(phase); + if(iphase VectorConstRef { for (Index i = 0; i < numElements(); ++i) @@ -529,11 +629,11 @@ namespace xGEMS { // Check if P, T are feasible if (pimpl->node->check_TP(T, P) == false) - return true; + return false; // Set temperature and pressure pimpl->node->Set_TK(T); pimpl->node->Set_P(P); - return false; + return true; } auto ChemicalEngine::setB(VectorConstRef b) -> void @@ -612,26 +712,23 @@ namespace xGEMS // Caution: this may be ambiguous as in GEMS3K, species with the same name // may occur in more than one condensed phase! // An overload including phase name is needed! - auto ChemicalEngine::setSpeciesAmount(std::string name, double amount) -> void + auto ChemicalEngine::setSpeciesAmount(std::string name, double amount, std::optional phase) -> void { - - MatrixConstRef W = formulaMatrix(); - auto ispecies = indexSpecies(name); - // Updates the species amount - pimpl->node->pCNode()->xDC[ispecies] = amount; - // Correction of the bIC vector - long int ii; - long int jj; - for (ii = 0; ii < numElements(); ii++) - pimpl->node->pCNode()->bIC[ii] = 0.0; - for (jj = 0; jj < numSpecies(); jj++) - for (ii = 0; ii < numElements(); ii++) - pimpl->node->pCNode()->bIC[ii] += speciesAmounts()[jj] * W(ii, jj); + auto ispecies = indexSpecies(name, phase); + if(ispecies void { + if(pimpl->node->check_DC_xCH(ispecies)) { + setSpeciesAmount_i(ispecies, amount); + } + } + auto ChemicalEngine::setSpeciesAmount_i(Index ispecies, double amount) -> void + { MatrixConstRef W = formulaMatrix(); // Updates the species amount pimpl->node->pCNode()->xDC[ispecies] = amount; @@ -645,6 +742,7 @@ namespace xGEMS pimpl->node->pCNode()->bIC[ii] += speciesAmounts()[jj] * W(ii, jj); } + auto ChemicalEngine::converged() const -> bool { const auto status = pimpl->node->pCNode()->NodeStatusCH; @@ -676,18 +774,35 @@ namespace xGEMS return Vector::Map(pimpl->node->pCNode()->bIC, numElements()); } - auto ChemicalEngine::elementAmountsInPhase(Index iphase) const -> Vector + auto ChemicalEngine::elementAmountsInPhase_i(Index iphase) const -> Vector { MatrixConstRef W = formulaMatrix(); VectorConstRef n = speciesAmounts(); - const Index first = indexFirstSpeciesInPhase(iphase); - const Index size = numSpeciesInPhase(iphase); + const Index first = indexFirstSpeciesInPhase_i(iphase); + const Index size = numSpeciesInPhase_i(iphase); MatrixConstRef Wp = W.middleCols(first, size); VectorConstRef np = n.segment(first, size); Vector res = Wp * np; return res; } + auto ChemicalEngine::elementAmountsInPhase(Index iphase) const -> Vector + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return elementAmountsInPhase_i(iphase); + } + return {}; + } + + auto ChemicalEngine::elementAmountsInPhase(std::string phase) const -> Vector + { + auto iphase = indexPhase(phase); + if(iphase Vector { MatrixConstRef W = formulaMatrix(); @@ -698,14 +813,26 @@ namespace xGEMS return res; } - auto ChemicalEngine::speciesAmount(Index ispecies) const -> double + auto ChemicalEngine::speciesAmount_i(Index ispecies) const -> double { return pimpl->node->pCNode()->xDC[ispecies]; } - auto ChemicalEngine::speciesAmount(std::string name) const -> double + auto ChemicalEngine::speciesAmount(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return pimpl->node->pCNode()->xDC[ispecies]; + } + return 0.; + } + + auto ChemicalEngine::speciesAmount(std::string name, std::optional phase) const -> double { - return pimpl->node->pCNode()->xDC[indexSpecies(name)]; + auto ispecies = indexSpecies(name, phase); + if(ispeciesnode->pCNode()->xDC[ispecies]; + } + return 0.; } auto ChemicalEngine::speciesAmounts() const -> VectorConstRef @@ -728,10 +855,10 @@ namespace xGEMS { for (Index i = 0; i < numSpecies(); ++i) pimpl->molalities[i] = pimpl->node->Get_cDC(i); - if (numSpecies() > numSpeciesInPhase(0)) + if (numSpecies() > numSpeciesInPhase_i(0)) { Vector amountSp = Vector::Map(pimpl->node->pCNode()->xDC, numSpecies()); - Index H2Oindex = numSpeciesInPhase(0) - 1; + Index H2Oindex = numSpeciesInPhase_i(0) - 1; double H2Omass = pimpl->node->Get_nDC(H2Oindex) * pimpl->node->DCmm(H2Oindex); // in kg if (H2Omass != 0.0) for (Index i = H2Oindex + 1; i < numSpecies(); ++i) @@ -746,7 +873,7 @@ namespace xGEMS Index counter = 0; for (Index k = 0; k < numPhases(); ++k) { - Index numSpInPh = numSpeciesInPhase(k); + Index numSpInPh = numSpeciesInPhase_i(k); double amountPh = phaseAmounts()(k); if (numSpInPh == 1) { @@ -796,7 +923,7 @@ namespace xGEMS pimpl->chemPotentials[i] = pimpl->node->Get_muDC(i, false); return pimpl->chemPotentials; - return Vector{}; + //return Vector{}; } // Implemented on Oct 1, 2020 @@ -813,7 +940,7 @@ namespace xGEMS // } // Uses curent node TK and P - auto ChemicalEngine::standardMolarGibbsEnergy(Index ispecies) const -> double + auto ChemicalEngine::standardMolarGibbsEnergy_i(Index ispecies) const -> double { double TK = pimpl->node->cTK(); double P = pimpl->node->cP(); @@ -822,8 +949,25 @@ namespace xGEMS return stMolarG; } + auto ChemicalEngine::standardMolarGibbsEnergy(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return standardMolarGibbsEnergy_i(ispecies); + } + return 0.; + } + + auto ChemicalEngine::standardMolarGibbsEnergy(std::string species, std::optional phase) const -> double + { + auto ispecies = indexSpecies(species, phase); + if(ispecies double + auto ChemicalEngine::standardMolarEnthalpy_i(Index ispecies) const -> double { double TK = pimpl->node->cTK(); double P = pimpl->node->cP(); @@ -832,8 +976,25 @@ namespace xGEMS return stMolarH; } + auto ChemicalEngine::standardMolarEnthalpy(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return standardMolarEnthalpy_i(ispecies); + } + return 0.; + } + + auto ChemicalEngine::standardMolarEnthalpy(std::string species, std::optional phase) const -> double + { + auto ispecies = indexSpecies(species, phase); + if(ispecies double + auto ChemicalEngine::standardMolarVolume_i(Index ispecies) const -> double { double TK = pimpl->node->cTK(); double P = pimpl->node->cP(); @@ -842,8 +1003,25 @@ namespace xGEMS return stMolarV; } + auto ChemicalEngine::standardMolarVolume(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return standardMolarVolume_i(ispecies); + } + return 0.; + } + + auto ChemicalEngine::standardMolarVolume(std::string species, std::optional phase) const -> double + { + auto ispecies = indexSpecies(species, phase); + if(ispecies double + auto ChemicalEngine::standardMolarEntropy_i(Index ispecies) const -> double { double TK = pimpl->node->cTK(); double P = pimpl->node->cP(); @@ -852,6 +1030,23 @@ namespace xGEMS return stMolarS; } + auto ChemicalEngine::standardMolarEntropy(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return standardMolarEntropy_i(ispecies); + } + return 0.; + } + + auto ChemicalEngine::standardMolarEntropy(std::string species, std::optional phase) const -> double + { + auto ispecies = indexSpecies(species, phase); + if(ispecies double // { @@ -873,7 +1068,7 @@ namespace xGEMS // } // Implemented on Oct 1, 2020 - auto ChemicalEngine::standardMolarHeatCapacityConstP(Index ispecies) const -> double + auto ChemicalEngine::standardMolarHeatCapacityConstP_i(Index ispecies) const -> double { double TK = pimpl->node->cTK(); double P = pimpl->node->cP(); @@ -882,6 +1077,23 @@ namespace xGEMS return stMolarCp; } + auto ChemicalEngine::standardMolarHeatCapacityConstP(Index ispecies) const -> double + { + if(pimpl->node->check_DC_xCH(ispecies)) { + return standardMolarHeatCapacityConstP_i(ispecies); + } + return 0.; + } + + auto ChemicalEngine::standardMolarHeatCapacityConstP(std::string species, std::optional phase) const -> double + { + auto ispecies = indexSpecies(species, phase); + if(ispecies double // { @@ -892,38 +1104,110 @@ namespace xGEMS // return stMolarCv; // } - auto ChemicalEngine::phaseMolarGibbsEnergy(Index iphase) const -> double + auto ChemicalEngine::phaseMolarGibbsEnergy_i(Index iphase) const -> double { double phMolarGibbsEnergy = 0.0; - if (pimpl->node->Ph_Mole(iphase) > 1e-15) + if(pimpl->node->Ph_Mole(iphase) > 1e-15) { phMolarGibbsEnergy = pimpl->node->Ph_GibbsEnergy(iphase) / pimpl->node->Ph_Mole(iphase); + } return phMolarGibbsEnergy; } - auto ChemicalEngine::phaseMolarEnthalpy(Index iphase) const -> double + auto ChemicalEngine::phaseMolarGibbsEnergy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseMolarGibbsEnergy_i(iphase); + } + return 0; + } + + auto ChemicalEngine::phaseMolarGibbsEnergy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { double phMolarEnthalpy = 0.0; - if (pimpl->node->Ph_Mole(iphase) > 1e-15) + if(pimpl->node->Ph_Mole(iphase) > 1e-15) { phMolarEnthalpy = pimpl->node->Ph_Enthalpy(iphase) / pimpl->node->Ph_Mole(iphase); + } return phMolarEnthalpy; } - auto ChemicalEngine::phaseMolarVolume(Index iphase) const -> double + auto ChemicalEngine::phaseMolarEnthalpy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseMolarEnthalpy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseMolarEnthalpy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { double phMolarVolume = 0.0; - if (pimpl->node->Ph_Mole(iphase) > 1e-15) + if(pimpl->node->Ph_Mole(iphase) > 1e-15) { phMolarVolume = pimpl->node->Ph_Volume(iphase) / pimpl->node->Ph_Mole(iphase); + } return phMolarVolume; } - auto ChemicalEngine::phaseMolarEntropy(Index iphase) const -> double + auto ChemicalEngine::phaseMolarVolume(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseMolarVolume_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseMolarVolume(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { double phMolarEntropy = 0.0; - if (pimpl->node->Ph_Mole(iphase) > 1e-15) + if(pimpl->node->Ph_Mole(iphase) > 1e-15) { phMolarEntropy = pimpl->node->Ph_Entropy(iphase) / pimpl->node->Ph_Mole(iphase); + } return phMolarEntropy; } + auto ChemicalEngine::phaseMolarEntropy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseMolarEntropy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseMolarEntropy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double // { @@ -936,52 +1220,142 @@ namespace xGEMS // return 0.0; // } - auto ChemicalEngine::phaseMolarHeatCapacityConstP(Index iphase) const -> double + auto ChemicalEngine::phaseMolarHeatCapacityConstP_i(Index iphase) const -> double { double phMolarCp = 0.0; - if (pimpl->node->Ph_Mole(iphase) > 1e-15) + if(pimpl->node->Ph_Mole(iphase) > 1e-15) { phMolarCp = pimpl->node->Ph_HeatCapacityCp(iphase) / pimpl->node->Ph_Mole(iphase); + } return phMolarCp; } + auto ChemicalEngine::phaseMolarHeatCapacityConstP(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseMolarHeatCapacityConstP_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseMolarHeatCapacityConstP(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double // { // return 0.0; // } - auto ChemicalEngine::phaseSpecificGibbsEnergy(Index iphase) const -> double + auto ChemicalEngine::phaseSpecificGibbsEnergy_i(Index iphase) const -> double { double phSpecGibbsEnergy = 0.0; - if (pimpl->node->Ph_Mass(iphase) > 1e-15) + if(pimpl->node->Ph_Mass(iphase) > 1e-15) { phSpecGibbsEnergy = pimpl->node->Ph_GibbsEnergy(iphase) / pimpl->node->Ph_Mass(iphase); + } return phSpecGibbsEnergy; } - auto ChemicalEngine::phaseSpecificEnthalpy(Index iphase) const -> double + auto ChemicalEngine::phaseSpecificGibbsEnergy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseSpecificGibbsEnergy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseSpecificGibbsEnergy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { double phSpecEnthalpy = 0.0; - if (pimpl->node->Ph_Mass(iphase) > 1e-15) + if(pimpl->node->Ph_Mass(iphase) > 1e-15) { phSpecEnthalpy = pimpl->node->Ph_Enthalpy(iphase) / pimpl->node->Ph_Mass(iphase); + } return phSpecEnthalpy; } - auto ChemicalEngine::phaseSpecificVolume(Index iphase) const -> double + auto ChemicalEngine::phaseSpecificEnthalpy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseSpecificEnthalpy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseSpecificEnthalpy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { double phSpecVolume = 0.0; - if (pimpl->node->Ph_Mass(iphase) > 1e-15) + if(pimpl->node->Ph_Mass(iphase) > 1e-15) { phSpecVolume = pimpl->node->Ph_Volume(iphase) / pimpl->node->Ph_Mass(iphase); + } return phSpecVolume; } - auto ChemicalEngine::phaseSpecificEntropy(Index iphase) const -> double + auto ChemicalEngine::phaseSpecificVolume(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseSpecificVolume_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseSpecificVolume(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { double phSpecEntropy = 0.0; - if (pimpl->node->Ph_Mass(iphase) > 1e-15) + if(pimpl->node->Ph_Mass(iphase) > 1e-15) { phSpecEntropy = pimpl->node->Ph_Entropy(iphase) / pimpl->node->Ph_Mass(iphase); + } return phSpecEntropy; } + auto ChemicalEngine::phaseSpecificEntropy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseSpecificEntropy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseSpecificEntropy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double // { @@ -994,14 +1368,32 @@ namespace xGEMS // return 0.0; // } - auto ChemicalEngine::phaseSpecificHeatCapacityConstP(Index iphase) const -> double + auto ChemicalEngine::phaseSpecificHeatCapacityConstP_i(Index iphase) const -> double { double phSpecCp = 0.0; - if (pimpl->node->Ph_Mass(iphase) > 1e-15) + if(pimpl->node->Ph_Mass(iphase) > 1e-15) { phSpecCp = pimpl->node->Ph_HeatCapacityCp(iphase) / pimpl->node->Ph_Mass(iphase); + } return phSpecCp; } + auto ChemicalEngine::phaseSpecificHeatCapacityConstP(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseSpecificHeatCapacityConstP_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseSpecificHeatCapacityConstP(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double // { // return 0.0; @@ -1061,44 +1453,163 @@ namespace xGEMS return pimpl->phHeatCapacitiesConstP; } - auto ChemicalEngine::phaseDensity(Index iphase) const -> double + auto ChemicalEngine::phaseDensity_i(Index iphase) const -> double { - if (pimpl->node->Ph_Volume(iphase) > 1e-15) + if(pimpl->node->Ph_Volume(iphase) > 1e-15) { return pimpl->node->Ph_Mass(iphase) / pimpl->node->Ph_Volume(iphase); - else - return 0.0; + } + return 0.0; } - auto ChemicalEngine::phaseMass(Index iphase) const -> double + auto ChemicalEngine::phaseDensity(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseDensity_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseDensity(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->Ph_Mass(iphase); } - auto ChemicalEngine::phaseAmount(Index iphase) const -> double + auto ChemicalEngine::phaseMass(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseMass_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseMass(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->Ph_Moles(iphase); } - auto ChemicalEngine::phaseVolume(Index iphase) const -> double + auto ChemicalEngine::phaseAmount(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseAmount_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseAmount(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->Ph_Volume(iphase); } - auto ChemicalEngine::phaseEnthalpy(Index iphase) const -> double + auto ChemicalEngine::phaseVolume(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseVolume_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseVolume(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->Ph_Enthalpy(iphase); } - auto ChemicalEngine::phaseEntropy(Index iphase) const -> double + auto ChemicalEngine::phaseEnthalpy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseEnthalpy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseEnthalpy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->Ph_Entropy(iphase); } - auto ChemicalEngine::phaseHeatCapacityConstP(Index iphase) const -> double + auto ChemicalEngine::phaseEntropy(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseEntropy_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseEntropy(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->Ph_HeatCapacityCp(iphase); } + auto ChemicalEngine::phaseHeatCapacityConstP(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseHeatCapacityConstP_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseHeatCapacityConstP(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase VectorConstRef { for (Index i = 0; i < numPhases(); ++i) @@ -1106,11 +1617,29 @@ namespace xGEMS return pimpl->phSatIndices; } - auto ChemicalEngine::phaseSatIndex(Index iphase) const -> double + auto ChemicalEngine::phaseSatIndex_i(Index iphase) const -> double { return pimpl->node->Ph_SatInd(iphase); } + auto ChemicalEngine::phaseSatIndex(Index iphase) const -> double + { + if(pimpl->node->check_Phase_xCH(iphase)) { + return phaseSatIndex_i(iphase); + } + return 0.0; + } + + auto ChemicalEngine::phaseSatIndex(std::string phase) const -> double + { + auto iphase = indexPhase(phase); + if(iphase double { return pimpl->node->pCNode()->Vs; @@ -1241,11 +1770,11 @@ namespace xGEMS if (state.phaseAmounts()[i] != 0.0 && !options.print_zero_amounts) { valid_phase_indices.push_back(i); - phase_names.push_back(state.phaseName(i) + "[mol]"); + phase_names.push_back(state.phaseName_i(i) + "[mol]"); } else if (options.print_zero_amounts) { valid_phase_indices.push_back(i); - phase_names.push_back(state.phaseName(i) + "[mol]"); + phase_names.push_back(state.phaseName_i(i) + "[mol]"); } } @@ -1260,7 +1789,7 @@ namespace xGEMS Index phase_idx = valid_phase_indices[j]; row[j] = state.elementAmountsInPhase(phase_idx)[i]; } - element_names.push_back(state.elementName(i)); + element_names.push_back(state.elementName_i(i)); element_rows.push_back(row); } @@ -1275,12 +1804,12 @@ namespace xGEMS if (state.phaseAmounts()[i] != 0.0 && !options.print_zero_amounts) { valid_phase_indices.push_back(i); - phase_names.push_back(state.phaseName(i)); + phase_names.push_back(state.phaseName_i(i)); } else if (options.print_zero_amounts) // Include phases with zero amount if the option is set { valid_phase_indices.push_back(i); - phase_names.push_back(state.phaseName(i)); + phase_names.push_back(state.phaseName_i(i)); } } @@ -1335,7 +1864,7 @@ namespace xGEMS row[4] = chemical_potentials[i]; row[5] = activities[i]; - species_names.push_back(state.speciesName(i)); + species_names.push_back(state.speciesName_i(i)); species_rows.push_back(row); } @@ -1373,7 +1902,7 @@ namespace xGEMS { for(Index ii = 0; ii < pimpl->node->pCSD()->nPS; ++ii) { if( pimpl->node->pCSD()->ccPH[ii] == 'a' ) { - return phaseName(ii); + return phaseName_i(ii); } } return {}; @@ -1385,7 +1914,7 @@ namespace xGEMS if( pimpl->node->pCSD()->ccPH[ii] == 'g' || pimpl->node->pCSD()->ccPH[ii] == 'p' || pimpl->node->pCSD()->ccPH[ii] == 'f') { - return phaseName(ii); + return phaseName_i(ii); } } return {}; diff --git a/xGEMS/ChemicalEngine.hpp b/xGEMS/ChemicalEngine.hpp index 93b1595..c35a0f6 100644 --- a/xGEMS/ChemicalEngine.hpp +++ b/xGEMS/ChemicalEngine.hpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include // xGEMS includes (assumed to define Index and Eigen-based vector/matrix types) #include @@ -274,6 +276,7 @@ namespace xGEMS /** * @brief Returns the number of species in a given phase. + * Access specified element with bounds checking. * * @param iphase (Index) Index of the phase. * @return (Index) Number of species in that phase. @@ -286,8 +289,38 @@ namespace xGEMS */ auto numSpeciesInPhase(Index iphase) const -> Index; + /** + * @brief Returns the number of species in a phase identified by name. + * + * @param phase (std::string) Phases name. + * @return (Index) Number of species in that phase. + * + * @code + * // Example: For phase with index 0. + * Index sppInPhase = engine.numSpeciesInPhase("aq_gen"); + * std::cout << "Species in phase aq_gen: " << sppInPhase << std::endl; + * @endcode + */ + auto numSpeciesInPhase(std::string phase) const -> Index; + + /** + * @brief Returns the number of species in a given phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Index of the phase. + * @return (Index) Number of species in that phase. + * + * @code + * // Example: For phase with index 0. + * Index sppInPhase = engine.numSpeciesInPhase_i(0); + * std::cout << "Species in phase 0: " << sppInPhase << std::endl; + * @endcode + */ + auto numSpeciesInPhase_i(Index iphase) const -> Index; + /** * @brief Returns the name of an element. + * Access specified element with bounds checking. * * @param ielement (Index) Index of the element. * @return (std::string) Element name. @@ -300,8 +333,24 @@ namespace xGEMS */ auto elementName(Index ielement) const -> std::string; + /** + * @brief Returns the name of an element. + * Access specified element without bounds checking. + * + * @param ielement (Index) Index of the element. + * @return (std::string) Element name. + * + * @code + * // Example: Get the name of the first element. + * std::string element = engine.elementName_i(0); + * std::cout << "Element 0: " << element << std::endl; + * @endcode + */ + auto elementName_i(Index ielement) const -> std::string; + /** * @brief Returns the name of a species. + * Access specified element with bounds checking. * * @param ispecies (Index) Index of the species. * @return (std::string) Species name. @@ -314,8 +363,24 @@ namespace xGEMS */ auto speciesName(Index ispecies) const -> std::string; + /** + * @brief Returns the name of a species. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Index of the species. + * @return (std::string) Species name. + * + * @code + * // Example: Retrieve the name of species 0. + * std::string spName = engine.speciesName_i(0); + * std::cout << "Species 0: " << spName << std::endl; + * @endcode + */ + auto speciesName_i(Index ispecies) const -> std::string; + /** * @brief Returns the electrical charge of a species. + * Access specified element with bounds checking. * * @param ispecies (Index) Index of the species. * @return (double) Charge of the species. @@ -328,8 +393,39 @@ namespace xGEMS */ auto speciesCharge(Index ispecies) const -> double; + /** + * @brief Returns the electrical charge of a species identified by name. + * + * @param species (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. + * @return (double) Charge of the species. + * + * @code + * // Example: Get the charge of species with index 0. + * double charge = engine.speciesCharge("SiO2"); + * std::cout << "Charge: " << charge << std::endl; + * @endcode + */ + auto speciesCharge(std::string species, std::optional phase = std::nullopt) const -> double; + + /** + * @brief Returns the electrical charge of a species. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Index of the species. + * @return (double) Charge of the species. + * + * @code + * // Example: Get the charge of species with index 0. + * double charge = engine.speciesCharge_i(0); + * std::cout << "Charge: " << charge << std::endl; + * @endcode + */ + auto speciesCharge_i(Index ispecies) const -> double; + /** * @brief Returns the name of the phase. + * Access specified element with bounds checking. * * @param iphase (Index) Index of the phase. * @return (std::string) Phase name. @@ -342,6 +438,21 @@ namespace xGEMS */ auto phaseName(Index iphase) const -> std::string; + /** + * @brief Returns the name of the phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Index of the phase. + * @return (std::string) Phase name. + * + * @code + * // Example: Retrieve the name of phase 0. + * std::string phase = engine.phaseName_i(0); + * std::cout << "Phase 0: " << phase << std::endl; + * @endcode + */ + auto phaseName_i(Index iphase) const -> std::string; + /** * @brief Returns the index of an element by name. * @@ -360,6 +471,7 @@ namespace xGEMS * @brief Returns the index of a species by name. * * @param species (std::string) Name of the species. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * @return (Index) Index of the species (or total species if not found). * * @code @@ -368,7 +480,20 @@ namespace xGEMS * std::cout << "Index of H2O@: " << idx << std::endl; * @endcode */ - auto indexSpecies(std::string species) const -> Index; + auto indexSpecies(std::string species, std::optional phase = std::nullopt) const -> Index; + + /** + * @brief Returns all species indexes and the corresponding phase names matching the specified name. + * + * @param species (std::string) Name of the species. + * @return (Map) Dictionary of phases and corresponding species index. + * + * @code + * // Example: Retrieve all phase and indices where the species "Anorthite" appears. + * std::map allIndices = engine.indexSpeciesAll("Anorthite"); + * @endcode + */ + auto indexSpeciesMap(std::string species) const -> std::map; /** * @brief Returns all indices of species matching the specified name. @@ -424,9 +549,10 @@ namespace xGEMS /** * @brief Returns the index of the first species in a specified phase. + * Access specified element with bounds checking. * * @param iphase (Index) Index of the phase. - * @return (Index) Index of the first species in that phase. + * @return (Index) Index of the first species in that phase or numSpecies if illegal iphase. * * @code * // Example: Get the first species index in phase 0. @@ -435,6 +561,33 @@ namespace xGEMS */ auto indexFirstSpeciesInPhase(Index iphase) const -> Index; + /** + * @brief Returns the index of the first species in a specified by name phase. + * + * @param phase (std::string) Phase name. + * @return (Index) Index of the first species in that phase or numSpecies if illegal iphase. + * + * @code + * // Example: Get the first species index in phase aq_gen. + * Index firstSpec = engine.indexFirstSpeciesInPhase("aq_gen"); + * @endcode + */ + auto indexFirstSpeciesInPhase(std::string phase) const -> Index; + + /** + * @brief Returns the index of the first species in a specified phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Index of the phase. + * @return (Index) Index of the first species in that phase or numSpecies if illegal iphase. + * + * @code + * // Example: Get the first species index in phase 0. + * Index firstSpec = engine.indexFirstSpeciesInPhase_i(0); + * @endcode + */ + auto indexFirstSpeciesInPhase_i(Index iphase) const -> Index; + /** * @brief Returns molar masses of elements. * @@ -491,16 +644,18 @@ namespace xGEMS * * @param name (std::string) Species name. * @param amount (double) New amount in mol. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * // Example: Set the amount of "CaSO4@" to 0.01 mol. * engine.setSpeciesAmount("CaSO4@", 0.01); * @endcode */ - auto setSpeciesAmount(std::string name, double amount) -> void; + auto setSpeciesAmount(std::string name, double amount, std::optional phase = std::nullopt) -> void; /** * @brief Sets the amount for a species identified by its index. + * Access specified element with bounds checking. * * @param ispecies (Index) Index of the species. * @param amount (double) New amount in mol. @@ -512,6 +667,20 @@ namespace xGEMS */ auto setSpeciesAmount(Index ispecies, double amount) -> void; + /** + * @brief Sets the amount for a species identified by its index. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Index of the species. + * @param amount (double) New amount in mol. + * + * @code + * // Example: Set species at index 0 to 0.01 mol. + * engine.setSpeciesAmount_i(0, 0.01); + * @endcode + */ + auto setSpeciesAmount_i(Index ispecies, double amount) -> void; + /** * @brief Sets the options for the ChemicalEngine. * @@ -575,13 +744,14 @@ namespace xGEMS * * @param name (std::string) Species name. * @param amount (double) Upper limit in mol. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * // Example: Set the upper limit for "SiO2" to 0.1 mol. * engine.setSpeciesUpperLimit("SiO2", 0.1); * @endcode */ - auto setSpeciesUpperLimit(std::string name, double amount) -> void; + auto setSpeciesUpperLimit(std::string name, double amount, std::optional phase = std::nullopt) -> void; /** * @brief Sets a lower bound for a species identified by name. @@ -590,16 +760,18 @@ namespace xGEMS * * @param name (std::string) Species name. * @param amount (double) Lower limit in mol. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * // Example: Set the lower limit for "SiO2" to 0.05 mol. * engine.setSpeciesLowerLimit("SiO2", 0.05); * @endcode */ - auto setSpeciesLowerLimit(std::string name, double amount) -> void; + auto setSpeciesLowerLimit(std::string name, double amount, std::optional phase = std::nullopt) -> void; /** * @brief Sets an upper bound (maximum amount allowed to form) for a species identified by its index. + * Access specified element with bounds checking. * * If amount < 0, resets to default 1e6. * @@ -615,6 +787,7 @@ namespace xGEMS /** * @brief Sets a lower bound (minimum amount allowed to form) for a species identified by its index. + * Access specified element with bounds checking. * * If amount < 0, resets to default 0. * @@ -628,18 +801,79 @@ namespace xGEMS */ auto setSpeciesLowerLimit(Index ispecies, double amount) -> void; + /** + * @brief Sets an upper bound (maximum amount allowed to form) for a species identified by its index. + * Access specified element without bounds checking. + * + * If amount < 0, resets to default 1e6. + * + * @param ispecies (Index) Species index. + * @param amount (double) Upper limit in mol. + * + * @code + * // Example: Set upper limit for species index 0. + * engine.setSpeciesUpperLimit_i(0, 0.1); + * @endcode + */ + auto setSpeciesUpperLimit_i(Index ispecies, double amount) -> void; + + /** + * @brief Sets a lower bound (minimum amount allowed to form) for a species identified by its index. + * Access specified element without bounds checking. + * + * If amount < 0, resets to default 0. + * + * @param ispecies (Index) Species index. + * @param amount (double) Lower limit in mol. + * + * @code + * // Example: Set lower limit for species index 0. + * engine.setSpeciesLowerLimit_i(0, 0.05); + * @endcode + */ + auto setSpeciesLowerLimit_i(Index ispecies, double amount) -> void; + /** * @brief Sets the standard molar Gibbs energy for a species (@ T, P of the system). * * @param name (std::string) Species name. * @param value (double) Standard molar Gibbs energy in J/mol. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * // Example: Set the standard molar Gibbs energy of H2O. * engine.setStandardMolarGibbsEnergy("H2O", -237140); // Value in J/mol. * @endcode */ - auto setStandardMolarGibbsEnergy(std::string name, double value) -> void; + auto setStandardMolarGibbsEnergy(std::string name, double value, std::optional phase = std::nullopt) -> void; + + /** + * @brief Sets the standard molar Gibbs energy for a species (@ T, P of the system). + * Access specified element with bounds checking. + * + * @param ispecies (Index) Index of the species. + * @param value (double) Standard molar Gibbs energy in J/mol. + * + * @code + * // Example: Set the standard molar Gibbs energy of H2O. + * engine.setStandardMolarGibbsEnergy(0, -237.13); // Value in J/mol. + * @endcode + */ + auto setStandardMolarGibbsEnergy(Index ispecies, double value) -> void; + + /** + * @brief Sets the standard molar Gibbs energy for a species (@ T, P of the system). + * Access specified element without bounds checking. + * + * @param ispecies (Index) Index of the species. + * @param value (double) Standard molar Gibbs energy in J/mol. + * + * @code + * // Example: Set the standard molar Gibbs energy of H2O. + * engine.setStandardMolarGibbsEnergy_i(0, -237.13); // Value in J/mol. + * @endcode + */ + auto setStandardMolarGibbsEnergy_i(Index ispecies, double value) -> void; /** * @brief Sets upper limits for all species. @@ -670,12 +904,12 @@ namespace xGEMS * * @param P Pressure in Pascals (Pa). * @param T Temperature in Kelvin (K). - * @return (bool) False if PT was set correctly, true if out of range. + * @return (bool) true if PT was set correctly, false if out of range. * * @code * // Example: Set PT to 101325 Pa and 298.15 K. - * bool error = engine.setPT(101325, 298.15); - * std::cout << (error ? "PT error" : "PT set correctly") << std::endl; + * bool no_error = engine.setPT(101325, 298.15); + * std::cout << (no_error ? "PT set correctly" : "PT error") << std::endl; * @endcode */ auto setPT(double P, double T) const -> bool; @@ -855,6 +1089,7 @@ namespace xGEMS /** * @brief Returns the amounts of elements in a specified phase. + * Access specified element with bounds checking. * * The order of the elements in the vector is based on the index of elements in the chemical system. * @@ -870,6 +1105,41 @@ namespace xGEMS */ auto elementAmountsInPhase(Index iphase) const -> Vector; + /** + * @brief Returns the amounts of elements in a specified phase. + * + * The order of the elements in the vector is based on the index of elements in the chemical system. + * + * @param phase Name of the phase. + * @return A vector containing the amounts of each element in the phase (in mol). + * + * **Example usage:** + * @code + * // Retrieve the element amounts in phase aq_gen. + * Eigen::VectorXd elementAmounts = engine.elementAmountsInPhase("aq_gen"); + * std::cout << "Element amounts in phase aq_gen: " << elementAmounts.transpose() << std::endl; + * @endcode + */ + auto elementAmountsInPhase(std::string phase) const -> Vector; + + /** + * @brief Returns the amounts of elements in a specified phase. + * Access specified element without bounds checking. + * + * The order of the elements in the vector is based on the index of elements in the chemical system. + * + * @param iphase Index of the phase. + * @return A vector containing the amounts of each element in the phase (in mol). + * + * **Example usage:** + * @code + * // Retrieve the element amounts in phase index 0. + * Eigen::VectorXd elementAmounts = engine.elementAmountsInPhase_i(0); + * std::cout << "Element amounts in phase 0: " << elementAmounts.transpose() << std::endl; + * @endcode + */ + auto elementAmountsInPhase_i(Index iphase) const -> Vector; + /** * @brief Returns the amounts of elements in a specified group of species. * @@ -903,6 +1173,7 @@ namespace xGEMS /** * @brief Returns the amount of a species by index. + * Access specified element with bounds checking. * * @param ispecies (Index) Index of the species. * @return (double) Amount in mol. @@ -919,13 +1190,28 @@ namespace xGEMS * * @param name (std::string) Species name. * @return (double) Amount in mol. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * // Example: Get the amount of "OH-". * double waterAmt = engine.speciesAmount("OH-"); * @endcode */ - auto speciesAmount(std::string name) const -> double; + auto speciesAmount(std::string name, std::optional phase = std::nullopt) const -> double; + + /** + * @brief Returns the amount of a species by index. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Index of the species. + * @return (double) Amount in mol. + * + * @code + * // Example: Get the species amount at index 0. + * double amount = engine.speciesAmount_i(0); + * @endcode + */ + auto speciesAmount_i(Index ispecies) const -> double; /** * @brief Returns the upper limits for all species. @@ -1027,6 +1313,7 @@ namespace xGEMS /** * @brief Returns the standard molar Gibbs energy of a species. + * Access specified element with bounds checking. * * @param ispecies (Index) Species index. * @return (double) Standard molar Gibbs energy in J/mol. @@ -1039,91 +1326,306 @@ namespace xGEMS auto standardMolarGibbsEnergy(Index ispecies) const -> double; /** - * @brief Returns the standard molar enthalpy of a species. + * @brief Returns the standard molar Gibbs energy of a species. * - * @param ispecies (Index) Species index. - * @return (double) Standard molar enthalpy in J/mol. + * @param species (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. + * @return (double) Standard molar Gibbs energy in J/mol. * * @code - * double stdEnthalpy = engine.standardMolarEnthalpy(0); + * // Example: For species 0. + * double stdGibbs = engine.standardMolarGibbsEnergy("SiO2"); * @endcode */ - auto standardMolarEnthalpy(Index ispecies) const -> double; + auto standardMolarGibbsEnergy(std::string species, std::optional phase = std::nullopt) const -> double; /** - * @brief Returns the standard molar volume of a species. + * @brief Returns the standard molar Gibbs energy of a species. + * Access specified element without bounds checking. * * @param ispecies (Index) Species index. - * @return (double) Standard molar volume in m³/mol. + * @return (double) Standard molar Gibbs energy in J/mol. * * @code - * double stdVolume = engine.standardMolarVolume(0); + * // Example: For species 0. + * double stdGibbs = engine.standardMolarGibbsEnergy_i(0); * @endcode */ - auto standardMolarVolume(Index ispecies) const -> double; + auto standardMolarGibbsEnergy_i(Index ispecies) const -> double; /** - * @brief Returns the standard molar entropy of a species. + * @brief Returns the standard molar enthalpy of a species. + * Access specified element with bounds checking. * * @param ispecies (Index) Species index. - * @return (double) Standard molar entropy in J/(mol·K). + * @return (double) Standard molar enthalpy in J/mol. * * @code - * double stdEntropy = engine.standardMolarEntropy(0); + * double stdEnthalpy = engine.standardMolarEnthalpy(0); * @endcode */ - auto standardMolarEntropy(Index ispecies) const -> double; + auto standardMolarEnthalpy(Index ispecies) const -> double; /** - * @brief Returns the standard molar isobaric heat capacity of a species. + * @brief Returns the standard molar enthalpy of a species. * - * @param ispecies (Index) Species index. - * @return (double) Heat capacity in J/(mol·K). + * @param species (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. + * @return (double) Standard molar enthalpy in J/mol. * * @code - * double heatCap = engine.standardMolarHeatCapacityConstP(0); + * double stdEnthalpy = engine.standardMolarEnthalpy("SiO2"); * @endcode */ - auto standardMolarHeatCapacityConstP(Index ispecies) const -> double; + auto standardMolarEnthalpy(std::string species, std::optional phase = std::nullopt) const -> double; /** - * @brief Returns the molar Gibbs energy of a phase. + * @brief Returns the standard molar enthalpy of a species. + * Access specified element without bounds checking. * - * @param iphase (Index) Phase index. - * @return (double) Molar Gibbs energy in J/mol. + * @param ispecies (Index) Species index. + * @return (double) Standard molar enthalpy in J/mol. * * @code - * double phaseGibbs = engine.phaseMolarGibbsEnergy(0); + * double stdEnthalpy = engine.standardMolarEnthalpy_i(0); * @endcode */ - auto phaseMolarGibbsEnergy(Index iphase) const -> double; + auto standardMolarEnthalpy_i(Index ispecies) const -> double; /** - * @brief Returns the molar enthalpy of a phase. + * @brief Returns the standard molar volume of a species. + * Access specified element with bounds checking. * - * @param iphase (Index) Phase index. - * @return (double) Molar enthalpy in J/mol. + * @param ispecies (Index) Species index. + * @return (double) Standard molar volume in m³/mol. * * @code - * double phaseEnthalpy = engine.phaseMolarEnthalpy(0); + * double stdVolume = engine.standardMolarVolume(0); * @endcode */ - auto phaseMolarEnthalpy(Index iphase) const -> double; + auto standardMolarVolume(Index ispecies) const -> double; /** - * @brief Returns the molar volume of a phase. + * @brief Returns the standard molar volume of a species. * - * @param iphase (Index) Phase index. - * @return (double) Molar volume in m³/mol. + * @param species (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. + * @return (double) Standard molar volume in m³/mol. * * @code - * double phaseVol = engine.phaseMolarVolume(0); + * double stdVolume = engine.standardMolarVolume("SiO2"); * @endcode */ - auto phaseMolarVolume(Index iphase) const -> double; + auto standardMolarVolume(std::string species, std::optional phase = std::nullopt) const -> double; + + /** + * @brief Returns the standard molar volume of a species. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Species index. + * @return (double) Standard molar volume in m³/mol. + * + * @code + * double stdVolume = engine.standardMolarVolume_i(0); + * @endcode + */ + auto standardMolarVolume_i(Index ispecies) const -> double; + + /** + * @brief Returns the standard molar entropy of a species. + * Access specified element with bounds checking. + * + * @param ispecies (Index) Species index. + * @return (double) Standard molar entropy in J/(mol·K). + * + * @code + * double stdEntropy = engine.standardMolarEntropy(0); + * @endcode + */ + auto standardMolarEntropy(Index ispecies) const -> double; + + /** + * @brief Returns the standard molar entropy of a species. + * + * @param species (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. + * @return (double) Standard molar entropy in J/(mol·K). + * + * @code + * double stdEntropy = engine.standardMolarEntropy("SiO2"); + * @endcode + */ + auto standardMolarEntropy(std::string species, std::optional phase = std::nullopt) const -> double; + + /** + * @brief Returns the standard molar entropy of a species. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Species index. + * @return (double) Standard molar entropy in J/(mol·K). + * + * @code + * double stdEntropy = engine.standardMolarEntropy_i(0); + * @endcode + */ + auto standardMolarEntropy_i(Index ispecies) const -> double; + + /** + * @brief Returns the standard molar isobaric heat capacity of a species. + * Access specified element with bounds checking. + * + * @param ispecies (Index) Species index. + * @return (double) Heat capacity in J/(mol·K). + * + * @code + * double heatCap = engine.standardMolarHeatCapacityConstP(0); + * @endcode + */ + auto standardMolarHeatCapacityConstP(Index ispecies) const -> double; + + /** + * @brief Returns the standard molar isobaric heat capacity of a species. + * + * @param species (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. + * @return (double) Heat capacity in J/(mol·K). + * + * @code + * double heatCap = engine.standardMolarHeatCapacityConstP("SiO2"); + * @endcode + */ + auto standardMolarHeatCapacityConstP(std::string species, std::optional phase = std::nullopt) const -> double; + + /** + * @brief Returns the standard molar isobaric heat capacity of a species. + * Access specified element without bounds checking. + * + * @param ispecies (Index) Species index. + * @return (double) Heat capacity in J/(mol·K). + * + * @code + * double heatCap = engine.standardMolarHeatCapacityConstP_i(0); + * @endcode + */ + auto standardMolarHeatCapacityConstP_i(Index ispecies) const -> double; + + /** + * @brief Returns the molar Gibbs energy of a phase. + * Access specified element with bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar Gibbs energy in J/mol. + * + * @code + * double phaseGibbs = engine.phaseMolarGibbsEnergy(0); + * @endcode + */ + auto phaseMolarGibbsEnergy(Index iphase) const -> double; + + /** + * @brief Returns the molar Gibbs energy of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Molar Gibbs energy in J/mol. + * + * @code + * double phaseGibbs = engine.phaseMolarGibbsEnergy("aq_gen"); + * @endcode + */ + auto phaseMolarGibbsEnergy(std::string phase) const -> double; + + /** + * @brief Returns the molar Gibbs energy of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar Gibbs energy in J/mol. + * + * @code + * double phaseGibbs = engine.phaseMolarGibbsEnergy_i(0); + * @endcode + */ + auto phaseMolarGibbsEnergy_i(Index iphase) const -> double; + + /** + * @brief Returns the molar enthalpy of a phase. + * Access specified element with bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar enthalpy in J/mol. + * + * @code + * double phaseEnthalpy = engine.phaseMolarEnthalpy(0); + * @endcode + */ + auto phaseMolarEnthalpy(Index iphase) const -> double; + + /** + * @brief Returns the molar enthalpy of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Molar enthalpy in J/mol. + * + * @code + * double phaseEnthalpy = engine.phaseMolarEnthalpy("aq_gen"); + * @endcode + */ + auto phaseMolarEnthalpy(std::string phase) const -> double; + + /** + * @brief Returns the molar enthalpy of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar enthalpy in J/mol. + * + * @code + * double phaseEnthalpy = engine.phaseMolarEnthalpy_i(0); + * @endcode + */ + auto phaseMolarEnthalpy_i(Index iphase) const -> double; + + /** + * @brief Returns the molar volume of a phase. + * Access specified element with bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar volume in m³/mol. + * + * @code + * double phaseVol = engine.phaseMolarVolume(0); + * @endcode + */ + auto phaseMolarVolume(Index iphase) const -> double; + + /** + * @brief Returns the molar volume of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Molar volume in m³/mol. + * + * @code + * double phaseVol = engine.phaseMolarVolume("aq_gen"); + * @endcode + */ + auto phaseMolarVolume(std::string phase) const -> double; + + /** + * @brief Returns the molar volume of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar volume in m³/mol. + * + * @code + * double phaseVol = engine.phaseMolarVolume_i(0); + * @endcode + */ + auto phaseMolarVolume_i(Index iphase) const -> double; /** * @brief Returns the molar entropy of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Molar entropy in J/(mol·K). @@ -1134,8 +1636,34 @@ namespace xGEMS */ auto phaseMolarEntropy(Index iphase) const -> double; + /** + * @brief Returns the molar entropy of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Molar entropy in J/(mol·K). + * + * @code + * double phaseEnt = engine.phaseMolarEntropy("aq_gen"); + * @endcode + */ + auto phaseMolarEntropy(std::string phase) const -> double; + + /** + * @brief Returns the molar entropy of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Molar entropy in J/(mol·K). + * + * @code + * double phaseEnt = engine.phaseMolarEntropy_i(0); + * @endcode + */ + auto phaseMolarEntropy_i(Index iphase) const -> double; + /** * @brief Returns the molar isobaric heat capacity of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Heat capacity in J/(mol·K). @@ -1146,8 +1674,35 @@ namespace xGEMS */ auto phaseMolarHeatCapacityConstP(Index iphase) const -> double; + /** + * @brief Returns the molar isobaric heat capacity of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Heat capacity in J/(mol·K). + * + * @code + * double phaseCp = engine.phaseMolarHeatCapacityConstP("aq_gen"); + * @endcode + */ + auto phaseMolarHeatCapacityConstP(std::string phase) const -> double; + + + /** + * @brief Returns the molar isobaric heat capacity of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Heat capacity in J/(mol·K). + * + * @code + * double phaseCp = engine.phaseMolarHeatCapacityConstP_i(0); + * @endcode + */ + auto phaseMolarHeatCapacityConstP_i(Index iphase) const -> double; + /** * @brief Returns the specific Gibbs energy of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Specific Gibbs energy in J/kg. @@ -1158,8 +1713,34 @@ namespace xGEMS */ auto phaseSpecificGibbsEnergy(Index iphase) const -> double; + /** + * @brief Returns the specific Gibbs energy of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Specific Gibbs energy in J/kg. + * + * @code + * double specGibbs = engine.phaseSpecificGibbsEnergy("aq_gen"); + * @endcode + */ + auto phaseSpecificGibbsEnergy(std::string phase) const -> double; + + /** + * @brief Returns the specific Gibbs energy of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Specific Gibbs energy in J/kg. + * + * @code + * double specGibbs = engine.phaseSpecificGibbsEnergy_i(0); + * @endcode + */ + auto phaseSpecificGibbsEnergy_i(Index iphase) const -> double; + /** * @brief Returns the specific enthalpy of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Specific enthalpy in J/kg. @@ -1170,8 +1751,34 @@ namespace xGEMS */ auto phaseSpecificEnthalpy(Index iphase) const -> double; + /** + * @brief Returns the specific enthalpy of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Specific enthalpy in J/kg. + * + * @code + * double specEnthalpy = engine.phaseSpecificEnthalpy("aq_gen"); + * @endcode + */ + auto phaseSpecificEnthalpy(std::string phase) const -> double; + + /** + * @brief Returns the specific enthalpy of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Specific enthalpy in J/kg. + * + * @code + * double specEnthalpy = engine.phaseSpecificEnthalpy_i(0); + * @endcode + */ + auto phaseSpecificEnthalpy_i(Index iphase) const -> double; + /** * @brief Returns the specific volume of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Specific volume in m³/kg. @@ -1182,8 +1789,34 @@ namespace xGEMS */ auto phaseSpecificVolume(Index iphase) const -> double; + /** + * @brief Returns the specific volume of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Specific volume in m³/kg. + * + * @code + * double specVolume = engine.phaseSpecificVolume("aq_gen"); + * @endcode + */ + auto phaseSpecificVolume(std::string phase) const -> double; + + /** + * @brief Returns the specific volume of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Specific volume in m³/kg. + * + * @code + * double specVolume = engine.phaseSpecificVolume_i(0); + * @endcode + */ + auto phaseSpecificVolume_i(Index iphase) const -> double; + /** * @brief Returns the specific entropy of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Specific entropy in J/(kg·K). @@ -1194,8 +1827,34 @@ namespace xGEMS */ auto phaseSpecificEntropy(Index iphase) const -> double; + /** + * @brief Returns the specific entropy of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Specific entropy in J/(kg·K). + * + * @code + * double specEntropy = engine.phaseSpecificEntropy("aq_gen"); + * @endcode + */ + auto phaseSpecificEntropy(std::string phase) const -> double; + + /** + * @brief Returns the specific entropy of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Specific entropy in J/(kg·K). + * + * @code + * double specEntropy = engine.phaseSpecificEntropy_i(0); + * @endcode + */ + auto phaseSpecificEntropy_i(Index iphase) const -> double; + /** * @brief Returns the specific isobaric heat capacity of a phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Heat capacity in J/(kg·K). @@ -1206,6 +1865,31 @@ namespace xGEMS */ auto phaseSpecificHeatCapacityConstP(Index iphase) const -> double; + /** + * @brief Returns the specific isobaric heat capacity of a phase. + * + * @param phase (std::string) Phase name. + * @return (double) Heat capacity in J/(kg·K). + * + * @code + * double specCp = engine.phaseSpecificHeatCapacityConstP("aq_gen"); + * @endcode + */ + auto phaseSpecificHeatCapacityConstP(std::string phase) const -> double; + + /** + * @brief Returns the specific isobaric heat capacity of a phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Heat capacity in J/(kg·K). + * + * @code + * double specCp = engine.phaseSpecificHeatCapacityConstP_i(0); + * @endcode + */ + auto phaseSpecificHeatCapacityConstP_i(Index iphase) const -> double; + /** * @brief Returns the densities of all phases. * @@ -1219,6 +1903,7 @@ namespace xGEMS /** * @brief Returns the density of a specified phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Density in kg/m³. @@ -1229,6 +1914,31 @@ namespace xGEMS */ auto phaseDensity(Index iphase) const -> double; + /** + * @brief Returns the density of a specified phase. + * + * @param phase (std::string) Phase name. + * @return (double) Density in kg/m³. + * + * @code + * double density = engine.phaseDensity("aq_gen"); + * @endcode + */ + auto phaseDensity(std::string phase) const -> double; + + /** + * @brief Returns the density of a specified phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Density in kg/m³. + * + * @code + * double density = engine.phaseDensity_i(0); + * @endcode + */ + auto phaseDensity_i(Index iphase) const -> double; + /** * @brief Returns the masses of all phases. * @@ -1242,6 +1952,7 @@ namespace xGEMS /** * @brief Returns the mass of a specified phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Mass in kg. @@ -1252,6 +1963,31 @@ namespace xGEMS */ auto phaseMass(Index iphase) const -> double; + /** + * @brief Returns the mass of a specified phase. + * + * @param phase (std::string) Phase name. + * @return (double) Mass in kg. + * + * @code + * double mass = engine.phaseMass("aq_gen"); + * @endcode + */ + auto phaseMass(std::string phase) const -> double; + + /** + * @brief Returns the mass of a specified phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Mass in kg. + * + * @code + * double mass = engine.phaseMass_i(0); + * @endcode + */ + auto phaseMass_i(Index iphase) const -> double; + /** * @brief Returns the molar amounts of all phases. * @@ -1265,6 +2001,7 @@ namespace xGEMS /** * @brief Returns the molar amount of a specific phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Amount in mol. @@ -1275,6 +2012,31 @@ namespace xGEMS */ auto phaseAmount(Index iphase) const -> double; + /** + * @brief Returns the molar amount of a specific phase. + * + * @param phase (std::string) Phase name. + * @return (double) Amount in mol. + * + * @code + * double amt = engine.phaseAmount("aq_gen"); + * @endcode + */ + auto phaseAmount(std::string phase) const -> double; + + /** + * @brief Returns the molar amount of a specific phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Amount in mol. + * + * @code + * double amt = engine.phaseAmount_i(0); + * @endcode + */ + auto phaseAmount_i(Index iphase) const -> double; + /** * @brief Returns the volumes of all phases. * @@ -1288,6 +2050,7 @@ namespace xGEMS /** * @brief Returns the volume of a specific phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Volume in m³. @@ -1298,6 +2061,31 @@ namespace xGEMS */ auto phaseVolume(Index iphase) const -> double; + /** + * @brief Returns the volume of a specific phase. + * + * @param phase (std::string) Phase name. + * @return (double) Volume in m³. + * + * @code + * double vol = engine.phaseVolume("aq_gen"); + * @endcode + */ + auto phaseVolume(std::string phase) const -> double; + + /** + * @brief Returns the volume of a specific phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Volume in m³. + * + * @code + * double vol = engine.phaseVolume_i(0); + * @endcode + */ + auto phaseVolume_i(Index iphase) const -> double; + /** * @brief Returns the enthalpies of all phases. * @@ -1311,6 +2099,7 @@ namespace xGEMS /** * @brief Returns the enthalpy of a specific phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Enthalpy in J. @@ -1321,6 +2110,31 @@ namespace xGEMS */ auto phaseEnthalpy(Index iphase) const -> double; + /** + * @brief Returns the enthalpy of a specific phase. + * + * @param phase (std::string) Phase name. + * @return (double) Enthalpy in J. + * + * @code + * double enth0 = engine.phaseEnthalpy("aq_gen"); + * @endcode + */ + auto phaseEnthalpy(std::string phase) const -> double; + + /** + * @brief Returns the enthalpy of a specific phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Enthalpy in J. + * + * @code + * double enth0 = engine.phaseEnthalpy_i(0); + * @endcode + */ + auto phaseEnthalpy_i(Index iphase) const -> double; + /** * @brief Returns the entropies of all phases. * @@ -1334,6 +2148,7 @@ namespace xGEMS /** * @brief Returns the entropy of a specified phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Entropy in J/(K). @@ -1344,6 +2159,31 @@ namespace xGEMS */ auto phaseEntropy(Index iphase) const -> double; + /** + * @brief Returns the entropy of a specified phase. + * + * @param phase (std::string) Phase name. + * @return (double) Entropy in J/(K). + * + * @code + * double ent0 = engine.phaseEntropy("aq_gen"); + * @endcode + */ + auto phaseEntropy(std::string phase) const -> double; + + /** + * @brief Returns the entropy of a specified phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Entropy in J/(K). + * + * @code + * double ent0 = engine.phaseEntropy_i(0); + * @endcode + */ + auto phaseEntropy_i(Index iphase) const -> double; + /** * @brief Returns the heat capacities (Cp) of all phases. * @@ -1357,6 +2197,7 @@ namespace xGEMS /** * @brief Returns the heat capacity of a specified phase. + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Heat capacity in J/K. @@ -1367,6 +2208,31 @@ namespace xGEMS */ auto phaseHeatCapacityConstP(Index iphase) const -> double; + /** + * @brief Returns the heat capacity of a specified phase. + * + * @param phase (std::string) Phase name. + * @return (double) Heat capacity in J/K. + * + * @code + * double cp0 = engine.phaseHeatCapacityConstP("aq_gen"); + * @endcode + */ + auto phaseHeatCapacityConstP(std::string phase) const -> double; + + /** + * @brief Returns the heat capacity of a specified phase. + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Heat capacity in J/K. + * + * @code + * double cp0 = engine.phaseHeatCapacityConstP_i(0); + * @endcode + */ + auto phaseHeatCapacityConstP_i(Index iphase) const -> double; + /** * @brief Returns the saturation indices of all phases (log₁₀ units). * @@ -1380,6 +2246,7 @@ namespace xGEMS /** * @brief Returns the saturation index of a specific phase (log₁₀ units). + * Access specified element with bounds checking. * * @param iphase (Index) Phase index. * @return (double) Saturation index. @@ -1390,6 +2257,31 @@ namespace xGEMS */ auto phaseSatIndex(Index iphase) const -> double; + /** + * @brief Returns the saturation index of a specific phase (log₁₀ units). + * + * @param phase (std::string) Phase name. + * @return (double) Saturation index. + * + * @code + * double sat0 = engine.phaseSatIndex("aq_gen"); + * @endcode + */ + auto phaseSatIndex(std::string phase) const -> double; + + /** + * @brief Returns the saturation index of a specific phase (log₁₀ units). + * Access specified element without bounds checking. + * + * @param iphase (Index) Phase index. + * @return (double) Saturation index. + * + * @code + * double sat0 = engine.phaseSatIndex_i(0); + * @endcode + */ + auto phaseSatIndex_i(Index iphase) const -> double; + /** * @brief Returns the total mass of the system. * diff --git a/xGEMS/ChemicalEngineMaps.cpp b/xGEMS/ChemicalEngineMaps.cpp index ec03801..06d319d 100644 --- a/xGEMS/ChemicalEngineMaps.cpp +++ b/xGEMS/ChemicalEngineMaps.cpp @@ -56,26 +56,28 @@ ChemicalEngineMaps::ChemicalEngineMaps(const std::string &inputfile, bool reset_ auto elemolarmass = gem.elementMolarMasses(); for(Index i = 0; i < nelements(); ++i) { - m_element_names.push_back(gem.elementName(i)); - m_element_molar_masses[gem.elementName(i)] = elemolarmass[i]; + m_element_names.push_back(gem.elementName_i(i)); + m_element_molar_masses[gem.elementName_i(i)] = elemolarmass[i]; } auto molar_mass = gem.speciesMolarMasses(); for(Index i = 0; i < nspecies(); ++i) { - auto specname = gem.speciesName(i); + auto specname = gem.speciesName_i(i); m_species_names.push_back(specname); - m_species_charges[specname] = gem.speciesCharge(i); + m_species_charges[specname] = gem.speciesCharge_i(i); m_species_molar_mass[specname] = molar_mass[i]; - m_species_molar_volumes[specname] = gem.standardMolarVolume(i); + m_species_molar_volumes[specname] = gem.standardMolarVolume_i(i); } for(Index i = 0; i < nphases(); ++i) { - m_phase_names.push_back(gem.phaseName(i)); + m_phase_names.push_back(gem.phaseName_i(i)); } for(Index i = 0; i < nphases(); ++i) { - if( gem.numSpeciesInPhase(i) > 0) { - m_species_in_phase[m_phase_names[i]] = std::vector( m_species_names.begin()+gem.indexFirstSpeciesInPhase(i), - m_species_names.begin()+gem.indexFirstSpeciesInPhase(i)+gem.numSpeciesInPhase(i)); + auto number = gem.numSpeciesInPhase_i(i); + if( number > 0) { + auto first = gem.indexFirstSpeciesInPhase_i(i); + m_species_in_phase[m_phase_names[i]] = std::vector( m_species_names.begin()+first, + m_species_names.begin()+first+number); } } @@ -111,9 +113,9 @@ auto ChemicalEngineMaps::clear(double min_amount) -> void } -auto ChemicalEngineMaps::set_species_G0(std::string symbol, double value) -> void +auto ChemicalEngineMaps::set_species_G0(std::string symbol, double value, std::optional phase) -> void { - gem.setStandardMolarGibbsEnergy(symbol, value); + gem.setStandardMolarGibbsEnergy(symbol, value, phase); } // return input bulk elemental composition (vector b) in moles @@ -128,9 +130,9 @@ auto ChemicalEngineMaps::aq_elements_molarity() -> ValuesMap ValuesMap out; auto aq_index = gem.indexPhase(m_aq_phase_symbol); if(aq_index < nphases() ) { - auto moles_elements = gem.elementAmountsInPhase(aq_index); + auto moles_elements = gem.elementAmountsInPhase_i(aq_index); for(Index i = 0; i < nelements(); ++i) { - out[gem.elementName(i)] = moles_elements[i] / (gem.phaseVolume(aq_index)*1000);// volume from m3 to L + out[gem.elementName_i(i)] = moles_elements[i] / (gem.phaseVolume_i(aq_index)*1000);// volume from m3 to L } } return out; @@ -143,13 +145,14 @@ auto ChemicalEngineMaps::aq_elements_molality() -> ValuesMap ValuesMap out; auto aq_index = gem.indexPhase(m_aq_phase_symbol); if(aq_index < nphases() ) { - auto H2Oindex = gem.numSpeciesInPhase(aq_index)-1; - auto H2Oamount = gem.speciesAmounts()[H2Oindex]; + auto H2Oindex = gem.indexFirstSpeciesInPhase_i(aq_index) + + gem.numSpeciesInPhase_i(aq_index) - 1; + auto H2Oamount = gem.speciesAmount(H2Oindex); auto H2Ommass = gem.speciesMolarMasses()[H2Oindex]; - auto H2Omass = H2Oamount*H2Ommass/1000; // in kg - auto moles_elements = gem.elementAmountsInPhase(aq_index); + auto H2Omass = H2Oamount*H2Ommass; // in kg + auto moles_elements = gem.elementAmountsInPhase_i(aq_index); for(Index i = 0; i < nelements(); ++i) { - out[gem.elementName(i)] = moles_elements[i] / H2Omass; + out[gem.elementName_i(i)] = moles_elements[i] / H2Omass; } } return out; @@ -163,7 +166,7 @@ auto ChemicalEngineMaps::aq_species_molarity() -> ValuesMap if(aq_index < nphases() ) { auto moles_species = gem.speciesAmounts(); for(Index i = 0; i < nspecies(); ++i) { - out[gem.speciesName(i)] = moles_species[i] / (gem.phaseVolume(aq_index)*1000); // volume from m3 to L + out[gem.speciesName_i(i)] = moles_species[i] / (gem.phaseVolume_i(aq_index)*1000); // volume from m3 to L } } return out; @@ -176,9 +179,10 @@ auto ChemicalEngineMaps::aq_species_molality() -> ValuesMap auto aq_index = gem.indexPhase(m_aq_phase_symbol); if(aq_index < nphases() ) { auto molalities = gem.speciesMolalities(); - for(Index i = gem.indexFirstSpeciesInPhase(aq_index); - i < gem.indexFirstSpeciesInPhase(aq_index)+gem.numSpeciesInPhase(aq_index)-1; ++i) { - out[gem.speciesName(i)] = molalities[i]; + auto first = gem.indexFirstSpeciesInPhase_i(aq_index); + auto last = first+gem.numSpeciesInPhase_i(aq_index)-1; + for(Index i = first; i < last; ++i) { + out[gem.speciesName_i(i)] = molalities[i]; } } return out; @@ -190,7 +194,7 @@ auto ChemicalEngineMaps::aq_elements_moles() -> ValuesMap { auto aq_index = gem.indexPhase(m_aq_phase_symbol); if(aq_index < nphases() ) { - return to_map( m_element_names, gem.elementAmountsInPhase(aq_index) ); + return to_map( m_element_names, gem.elementAmountsInPhase_i(aq_index) ); } return {}; } @@ -221,7 +225,7 @@ auto ChemicalEngineMaps::reset_aq_composition(double min_amount) -> void auto aq_index = gem.indexPhase(m_aq_phase_symbol); if(aq_index < nphases() ) { if( peamt[aq_index] > min_amount ) { - auto b_aqup = gem.elementAmountsInPhase(aq_index); + auto b_aqup = gem.elementAmountsInPhase_i(aq_index); b_amounts -= b_aqup; } } @@ -242,14 +246,14 @@ auto ChemicalEngineMaps::solids_elements_moles(double min_amount_phase, double m if(aqupx < nphases() ) { if( peamt[aqupx] > min_amount_phase) { - auto b_aqup = gem.elementAmountsInPhase(aqupx); + auto b_aqup = gem.elementAmountsInPhase_i(aqupx); b_solid -= b_aqup; } } auto gaspx = gem.indexPhase(m_gas_phase_symbol); if( gaspx < nphases() ) { if(peamt[gaspx] > min_amount_phase) { - auto b_gasp = gem.elementAmountsInPhase(gaspx); + auto b_gasp = gem.elementAmountsInPhase_i(gaspx); b_solid -= b_gasp; } } @@ -266,7 +270,7 @@ auto ChemicalEngineMaps::phases_elements_moles() -> PhaseValuesMap { PhaseValuesMap out; for(Index k = 0; k < nphases(); ++k) { - auto peamt = gem.elementAmountsInPhase(k); + auto peamt = gem.elementAmountsInPhase_i(k); ValuesMap dictelems; for(Index i = 0; i < nelements(); ++i) { dictelems[m_element_names[i]] = peamt[i]; @@ -359,7 +363,7 @@ auto ChemicalEngineMaps::to_phase_species_map(Vector values) -> PhaseValuesMap Index jk = 0, j = 0; for(Index k = 0; k < nphases(); ++k) { ValuesMap out; - for( jk = 0; jk < gem.numSpeciesInPhase(k); ++j, ++jk) { + for( jk = 0; jk < gem.numSpeciesInPhase_i(k); ++j, ++jk) { out[m_species_names[j]]=values[j]; } phase_out[m_phase_names[k]] = out; @@ -374,9 +378,10 @@ auto ChemicalEngineMaps::phase_species_moles(std::string phase_symbol) -> Values auto index = gem.indexPhase(phase_symbol); if( index < nphases() ) { auto amounts = gem.speciesAmounts(); - for(Index i = gem.indexFirstSpeciesInPhase(index); - i < gem.indexFirstSpeciesInPhase(index)+gem.numSpeciesInPhase(index); ++i) { - out[m_species_names[i]] = amounts[i]; + auto first = gem.indexFirstSpeciesInPhase_i(index); + auto last = first+gem.numSpeciesInPhase_i(index); + for(Index i = first; i < last; ++i) { + out[m_species_names[i]] = amounts[i]; } } return out; @@ -439,28 +444,32 @@ auto ChemicalEngineMaps::add_multiple_species_amt(const ValuesMap& input_dict, c // add species amount in the system useful for adding aqueous solution composition // units= moles, kg, m3 -auto ChemicalEngineMaps::add_species_amt(const std::string& species, double val, const std::string& units) -> void +auto ChemicalEngineMaps::add_species_amt(const std::string& species, double val, const std::string& units, std::optional phase) -> void { - auto species_idx =gem.indexSpecies(species); - if( units == "kg") { - val/=m_species_molar_mass[species]; - } - if( units == "m3") { - val/=m_species_molar_volumes[species]; + auto species_idx =gem.indexSpecies(species, phase); + if(species_idx void { - if( units == "kg" ) { - val /= m_element_molar_masses[element_name]; - } auto el_index = gem.indexElement(element_name); - b_amounts[el_index] += val; + if(el_index void +auto ChemicalEngineMaps::set_species_lower_bound(const std::string& species, double val, const std::string& units, std::optional phase) -> void { - if( units == "kg") { - val/=m_species_molar_mass[species]; - } - if( units == "m3") { - val/=m_species_molar_volumes[species]; + auto species_idx =gem.indexSpecies(species, phase); + if(species_idx void +auto ChemicalEngineMaps::set_species_upper_bound(const std::string& species, double val, const std::string& units, std::optional phase) -> void { - if( units == "kg") { - val/=m_species_molar_mass[species]; - } - if( units == "m3") { - val/=m_species_molar_volumes[species]; + auto species_idx =gem.indexSpecies(species, phase); + if(species_idx void { - if( units == "kg") { - val/=m_species_molar_mass[m_species_names[ispecies]]; - } - if( units == "m3") { - val/=m_species_molar_volumes[m_species_names[ispecies]]; + if(ispecies=0) { + if( units == "kg") { + val/=m_species_molar_mass[m_species_names[ispecies]]; + } + if( units == "m3") { + val/=m_species_molar_volumes[m_species_names[ispecies]]; + } + gem.setSpeciesLowerLimit_i(ispecies,val); } - gem.setSpeciesLowerLimit(ispecies,val); } // constrain species amount to a specified upper bound, units= moles,kg,m3 auto ChemicalEngineMaps::set_species_upper_bound(Index ispecies, double val, const std::string& units) -> void { - if( units == "kg") { - val/=m_species_molar_mass[m_species_names[ispecies]]; - } - if( units == "m3") { - val/=m_species_molar_volumes[m_species_names[ispecies]]; + if(ispecies=0) { + if( units == "kg") { + val/=m_species_molar_mass[m_species_names[ispecies]]; + } + if( units == "m3") { + val/=m_species_molar_volumes[m_species_names[ispecies]]; + } + gem.setSpeciesUpperLimit_i(ispecies,val); } - gem.setSpeciesUpperLimit(ispecies,val); } @@ -589,10 +608,11 @@ auto ChemicalEngineMaps::suppress_multiple_phases(const std::vector } // suppresses species in calculation -auto ChemicalEngineMaps::suppress_species(const std::string& species_name, double min_amount, double max_amount) -> void +auto ChemicalEngineMaps::suppress_species(const std::string& species_name, double min_amount, double max_amount, std::optional phase) -> void { - set_species_lower_bound(species_name, min_amount); - set_species_upper_bound(species_name, max_amount); + auto species_idx =gem.indexSpecies(species_name, phase); + set_species_lower_bound(species_idx, min_amount); + set_species_upper_bound(species_idx, max_amount); } // suppresses multiple species in GEM calculation as given in species name list @@ -626,10 +646,11 @@ auto ChemicalEngineMaps::activate_multiple_species(const std::vector void +auto ChemicalEngineMaps::activate_species(const std::string& species_name, std::optional phase) -> void { - set_species_lower_bound(species_name, 0); - set_species_upper_bound(species_name, 1e6); + auto species_idx =gem.indexSpecies(species_name, phase); + set_species_lower_bound(species_idx, 0); + set_species_upper_bound(species_idx, 1e6); } @@ -668,7 +689,7 @@ auto ChemicalEngineMaps::phases_molar_volume() -> ValuesMap { ValuesMap phase_mvol; for(Index i = 0; i < nphases(); ++i) { - phase_mvol[m_phase_names[i]] = gem.phaseMolarVolume(i); + phase_mvol[m_phase_names[i]] = gem.phaseMolarVolume_i(i); } return phase_mvol; } diff --git a/xGEMS/ChemicalEngineMaps.hpp b/xGEMS/ChemicalEngineMaps.hpp index e231fd4..e6f305a 100644 --- a/xGEMS/ChemicalEngineMaps.hpp +++ b/xGEMS/ChemicalEngineMaps.hpp @@ -140,12 +140,13 @@ class ChemicalEngineMaps * * @param symbol (std::string) Species symbol. * @param value (double) Standard molar Gibbs energy in J/mol. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * engine.set_species_G0("H2O", -237140); // Value in J/mol. * @endcode */ - auto set_species_G0(std::string symbol, double value) -> void; + auto set_species_G0(std::string symbol, double value, std::optional phase= std::nullopt) -> void; /** * @brief Sets the amounts of elements (vector b). @@ -738,12 +739,13 @@ class ChemicalEngineMaps * @param species (std::string) Species symbol. * @param val (double) Species amount in units. * @param units (std::string) Units of amount ("moles", "kg", "m3"), default "moles". + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * engine.add_species_amt("H2O@", 0.01, "kg"); * @endcode */ - auto add_species_amt(const std::string &species, double val, const std::string &units = "moles") -> void; + auto add_species_amt(const std::string &species, double val, const std::string &units = "moles", std::optional phase= std::nullopt) -> void; /** * @brief Add element amount in the system. @@ -829,12 +831,14 @@ class ChemicalEngineMaps * @param name (std::string) Species name. * @param val (double) Lower limit in units. * @param units (std::string) Units of amount ("moles", "kg", "m3"), default "moles". + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * engine.set_species_lower_bound( "Ca(HCO3)+", 200, "moles"); * @endcode */ - auto set_species_lower_bound(const std::string& name, double val, const std::string& units= "moles") -> void; + auto set_species_lower_bound(const std::string& name, double val, const std::string& units= "moles", + std::optional phase= std::nullopt) -> void; /** * @brief Sets an upper bound for a species identified by name. @@ -842,12 +846,14 @@ class ChemicalEngineMaps * @param name (std::string) Species name. * @param val (double) Upper limit in units. * @param units (std::string) Units of amount ("moles", "kg", "m3"), default "moles". + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * engine.set_species_upper_bound("CaOH+", 500, "kg"); * @endcode */ - auto set_species_upper_bound(const std::string& name, double val, const std::string& units= "moles") -> void; + auto set_species_upper_bound(const std::string& name, double val, const std::string& units= "moles", + std::optional phase= std::nullopt) -> void; /** * @brief Sets a lower bound (minimum amount allowed to form) for a species identified by its index (phase depended case). @@ -909,12 +915,14 @@ class ChemicalEngineMaps * @param species_name (std::string) Species name. * @param min_amount (double) Lower amount of specie in mol, default 0. * @param max_amount (double) Upper amount of specie in mol, default 1e-15. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * engine.suppress_species("Ca(CO3)@"); * @endcode */ - auto suppress_species(const std::string &species_name, double min_amount=0, double max_amount=1e-15) -> void; + auto suppress_species(const std::string &species_name, double min_amount=0, double max_amount=1e-15, + std::optional phase= std::nullopt) -> void; /** * @brief Suppresses multiple species in in GEM calculation as given in species name list. @@ -966,12 +974,13 @@ class ChemicalEngineMaps * @brief Activate a suppressed species in phase. * * @param species_name (std::string) Species name. + * @param optional phase (std::string) Name of the phase the species was included in. If default get the first index. * * @code * engine.activate_species("Ca(CO3)@"); * @endcode */ - auto activate_species(const std::string &species_name) -> void; + auto activate_species(const std::string &species_name, std::optional phase= std::nullopt) -> void; /** * @brief Returns all species amounts in moles.