Loading include/default_data.hh +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ namespace saline { static const char* tst_data_rk = R"ORNL_format( static const char* tst_data = R"ORNL_format( //Pure Salts //System , id , Mol Mass , Mol Frac , Melt(K) , Var(%) , Reference , Boil(K) , Var(%) , Reference , rho_a , rho_b , range(K) , Var(%) , Reference , mu1_a , mu2_b , mu2_a , mu2_b , mu2_c , range(K) , Var(%) , Reference , k_a , k_b , range(K) , Var(%) , Reference , cp_a , cp_b , cp_c , cp_d , Var(%) , Reference LiF , 1 , 25.9390 , 1.0 , 1121.20 , 1.00 , Douglas1954 , 1943.00 , 0.00 , Ruff1922 , 2.371E+00 , 5.000E-04 , 1123.6-1367.5 , 1.00 , Hill1967 , 1.149E-01 , 2.699E+04 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 1133-1772 , 1.00 , Abe1981 , 1.882E+00 , -3.990E-04 , 1118.5-1900 , 20.00 , Gheribi2014 , 6.489E+01 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 1.50 , Douglas1954 Loading @@ -18,7 +18,9 @@ LiF-BeF2-ThF4 , 9 , 47.9244 , 0.7011-0.2388-0.0601 , 828.30 , 0.00 , Cantor LiF-BeF2-ThF4 , 10 , 63.5179 , 0.7006-0.1796-0.1198 , 806.40 , 0.00 , Cantor1973 , 0.0 , 0.0 , ---- , 4.044E+00 , 8.064E-04 , 806.4-1014.4 , 1.00 , Cantor1973 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0 , ---- LiF-BeF2-ThF4 , 11 , 71.4958 , 0.6998-0.1499-0.1503 , 816.60 , 0.00 , Cantor1973 , 0.0 , 0.0 , ---- , 4.441E+00 , 9.526E-04 , 816.6-1022.7 , 1.00 , Cantor1973 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0 , ---- LiF-BeF2-ThF4 , 12 , 61.9697 , 0.727-0.157-0.116 , 826.20 , 0.00 , Cantor1973 , 0.0 , 0.0 , ---- , 0.0 , 0.0 , 0.0-0.0 , 0.0 , ---- , 1.094E-01 , 3.402E+04 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 826-946 , 15.00 , Cantor1973 , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0 , ---- )ORNL_format"; static const char* tst_data_rk = R"ORNL_format( //RK parameters //C 1 , C 2 , A1 , B1 , A2 , B2 , A3 , B3 , T min , T max , Reference KF , LiF , -5.383100E-03 , -4.142700E-05 , +0.000000E+00 , +0.000000E+00 , 0.000000E+00 , 0.000000E+00 , 1.006150E+03 , 1.314150E+03 , 'Taniuchi, K.; Kanai, T. Density of Binary Molten Salts of Lithium Fluoride-Potassium Fluoride and Lithium Fluoride-Calcium Fluoride Systems. Denki Kagaku oyobi Kogyo Butsuri Kagaku 1977, 45 (6), 401-404. https://doi.org/10.5796/kogyobutsurikagaku.45.401' Loading include/r_kister_data_store.hh +2 −2 Original line number Diff line number Diff line Loading @@ -38,8 +38,8 @@ class R_Kister_Data_Store : public Data_Store // >>> CONSTRUCTORS R_Kister_Data_Store(); void load(const std::string& fPath); void load(std::istream& inFile); void load(const std::string& rkfPath, const std::string& dfPath); void load(std::istream& rkinFile,std::istream& inFile); // >>> ACCESSORS // the number of entries in the data store Loading src/cpp/r_kister_data_store.cc +38 −14 Original line number Diff line number Diff line Loading @@ -38,23 +38,29 @@ R_Kister_Data_Store::R_Kister_Data_Store() /*! * \brief helper function to load data into data store */ void R_Kister_Data_Store::load(const std::string& fPath) void R_Kister_Data_Store::load(const std::string& rkfPath, const std::string& dfPath) { std::ifstream inFile(fPath.data()); load(inFile); //Set up a default data store d = Default_Data_Store(); std::ifstream inFile(dfPath.data()); std::ifstream rkinFile(rkfPath.data()); load(rkinFile,inFile); } //---------------------------------------------------------------------------// /*! * \brief helper function to load data Redlich-Kister parameters into data store */ void R_Kister_Data_Store::load(std::istream& inFile) void R_Kister_Data_Store::load(std::istream& rkinFile,std::istream& inFile) { //Set up a default data store TODO this may not always be desirable d = Default_Data_Store(); // set up default store d.load(inFile); // Set up space for the mixing models int num_binaries = d.size(); Vec_Name keys = d.getSaltKeys(); int num_binaries = std::count_if(keys.begin(),keys.end(),[](std::string str) { return str.find("-") == str.npos;}); m_rho.resize(num_binaries,std::vector<R_Kister_Data_Store::RK_Polynomial>(num_binaries)); ////TODO no input for these, implemented only for downstream process Loading @@ -64,17 +70,17 @@ void R_Kister_Data_Store::load(std::istream& inFile) // Jaunt through lines until we find the Redlich-Kister parameters std::string line; while( std::getline(inFile,line) ) while( std::getline(rkinFile,line) ) { if( line.find("RK parameters") != std::string::npos ) break; } // Its possible we could have a bum input. That should break here. // this is a comment line std::getline(inFile,line); std::getline(rkinFile,line); // Read the input data. TODO currently only uses density while( std::getline(inFile,line)) while( std::getline(rkinFile,line)) { auto tokens = utils::split(",",line); for(size_t i=0; i<tokens.size(); ++i) Loading Loading @@ -125,7 +131,28 @@ void R_Kister_Data_Store::load(std::istream& inFile) */ Data_Store::View R_Kister_Data_Store::setView( const Vec_Name& names, const Vec_Mole& mole_percents) { // Clear the old end members end_members.clear(); // Set up a view or returning useful data Data_Store::View v; // Look for the data in the default data first Vec_Name tempNames = names; if(d.valid(tempNames)) { // See if the data is close enough to what is requested std::vector<std::pair<double,size_t>> test = utils::nearest_neighbor( mole_percents,d.getSaltComps(names)); if(test[0].first < 0.01) { end_members.resize(1); endMem_moleFracs = {1.0}; } end_members[0] = d.setView(names,mole_percents); v = end_members[0]; } end_members.resize(names.size()); endMem_moleFracs = mole_percents; Loading @@ -136,9 +163,6 @@ Data_Store::View R_Kister_Data_Store::setView( const Vec_Name& names, const Vec_ if (valid(iname)) end_members[i] = (d.setView({names[i]},{1.0})); } // To adapt the interfaces a "minimal" view is returned to the client Data_Store::View v; if(std::all_of(end_members.begin(),end_members.end(),[] (Data_Store::View v){return !v.nullView();})) { Loading src/fortran/cix/r_kister_data_store.cpp2f.xml +2 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,8 @@ <include_relative name="r_kister_data_store.hh"/> <class name="R_Kister_Data_Store" parent="Data_Store"> <method name="load" return_type="void"> <param name="path" type="char*"/> <param name="rkpath" type="char*"/> <param name="dfpath" type="char*"/> </method> </class> Loading src/fortran/r_kister_data_storeInterface.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -2,16 +2,16 @@ * This file has been dynamically generated by Class Interface Xml (CIX) * DO NOT MODIFY THIS FILE -- CHANGES WILL BE OVERWRITTEN UPON REGENERATION * If changes need to occur, modify the appropriate CIX xml file * Date Generated: Tue Jun 14 14:36:27 EDT 2022 * Date Generated: Wed Mar 29 11:07:39 EDT 2023 * If any issues are experiences with this generated file that cannot be fixed * with adjustment of the CIX xml file, please contact Robert A. Lefebvre, raq@ornl.gov */ #include <string.h> #include "r_kister_data_storeInterface.h" using namespace saline; void R_Kister_Data_Store_load(void * R_Kister_Data_Store_ptr,char* path) void R_Kister_Data_Store_load(void * R_Kister_Data_Store_ptr,char* rkpath,char* dfpath) { ((R_Kister_Data_Store*)R_Kister_Data_Store_ptr)->load(path); ((R_Kister_Data_Store*)R_Kister_Data_Store_ptr)->load(rkpath,dfpath); } void* R_Kister_Data_Store_initialize() Loading Loading
include/default_data.hh +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ namespace saline { static const char* tst_data_rk = R"ORNL_format( static const char* tst_data = R"ORNL_format( //Pure Salts //System , id , Mol Mass , Mol Frac , Melt(K) , Var(%) , Reference , Boil(K) , Var(%) , Reference , rho_a , rho_b , range(K) , Var(%) , Reference , mu1_a , mu2_b , mu2_a , mu2_b , mu2_c , range(K) , Var(%) , Reference , k_a , k_b , range(K) , Var(%) , Reference , cp_a , cp_b , cp_c , cp_d , Var(%) , Reference LiF , 1 , 25.9390 , 1.0 , 1121.20 , 1.00 , Douglas1954 , 1943.00 , 0.00 , Ruff1922 , 2.371E+00 , 5.000E-04 , 1123.6-1367.5 , 1.00 , Hill1967 , 1.149E-01 , 2.699E+04 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 1133-1772 , 1.00 , Abe1981 , 1.882E+00 , -3.990E-04 , 1118.5-1900 , 20.00 , Gheribi2014 , 6.489E+01 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 1.50 , Douglas1954 Loading @@ -18,7 +18,9 @@ LiF-BeF2-ThF4 , 9 , 47.9244 , 0.7011-0.2388-0.0601 , 828.30 , 0.00 , Cantor LiF-BeF2-ThF4 , 10 , 63.5179 , 0.7006-0.1796-0.1198 , 806.40 , 0.00 , Cantor1973 , 0.0 , 0.0 , ---- , 4.044E+00 , 8.064E-04 , 806.4-1014.4 , 1.00 , Cantor1973 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0 , ---- LiF-BeF2-ThF4 , 11 , 71.4958 , 0.6998-0.1499-0.1503 , 816.60 , 0.00 , Cantor1973 , 0.0 , 0.0 , ---- , 4.441E+00 , 9.526E-04 , 816.6-1022.7 , 1.00 , Cantor1973 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0 , ---- LiF-BeF2-ThF4 , 12 , 61.9697 , 0.727-0.157-0.116 , 826.20 , 0.00 , Cantor1973 , 0.0 , 0.0 , ---- , 0.0 , 0.0 , 0.0-0.0 , 0.0 , ---- , 1.094E-01 , 3.402E+04 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 826-946 , 15.00 , Cantor1973 , 0.000E+00 , 0.000E+00 , 0.0-0.0 , 0.0 , ---- , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.000E+00 , 0.0 , ---- )ORNL_format"; static const char* tst_data_rk = R"ORNL_format( //RK parameters //C 1 , C 2 , A1 , B1 , A2 , B2 , A3 , B3 , T min , T max , Reference KF , LiF , -5.383100E-03 , -4.142700E-05 , +0.000000E+00 , +0.000000E+00 , 0.000000E+00 , 0.000000E+00 , 1.006150E+03 , 1.314150E+03 , 'Taniuchi, K.; Kanai, T. Density of Binary Molten Salts of Lithium Fluoride-Potassium Fluoride and Lithium Fluoride-Calcium Fluoride Systems. Denki Kagaku oyobi Kogyo Butsuri Kagaku 1977, 45 (6), 401-404. https://doi.org/10.5796/kogyobutsurikagaku.45.401' Loading
include/r_kister_data_store.hh +2 −2 Original line number Diff line number Diff line Loading @@ -38,8 +38,8 @@ class R_Kister_Data_Store : public Data_Store // >>> CONSTRUCTORS R_Kister_Data_Store(); void load(const std::string& fPath); void load(std::istream& inFile); void load(const std::string& rkfPath, const std::string& dfPath); void load(std::istream& rkinFile,std::istream& inFile); // >>> ACCESSORS // the number of entries in the data store Loading
src/cpp/r_kister_data_store.cc +38 −14 Original line number Diff line number Diff line Loading @@ -38,23 +38,29 @@ R_Kister_Data_Store::R_Kister_Data_Store() /*! * \brief helper function to load data into data store */ void R_Kister_Data_Store::load(const std::string& fPath) void R_Kister_Data_Store::load(const std::string& rkfPath, const std::string& dfPath) { std::ifstream inFile(fPath.data()); load(inFile); //Set up a default data store d = Default_Data_Store(); std::ifstream inFile(dfPath.data()); std::ifstream rkinFile(rkfPath.data()); load(rkinFile,inFile); } //---------------------------------------------------------------------------// /*! * \brief helper function to load data Redlich-Kister parameters into data store */ void R_Kister_Data_Store::load(std::istream& inFile) void R_Kister_Data_Store::load(std::istream& rkinFile,std::istream& inFile) { //Set up a default data store TODO this may not always be desirable d = Default_Data_Store(); // set up default store d.load(inFile); // Set up space for the mixing models int num_binaries = d.size(); Vec_Name keys = d.getSaltKeys(); int num_binaries = std::count_if(keys.begin(),keys.end(),[](std::string str) { return str.find("-") == str.npos;}); m_rho.resize(num_binaries,std::vector<R_Kister_Data_Store::RK_Polynomial>(num_binaries)); ////TODO no input for these, implemented only for downstream process Loading @@ -64,17 +70,17 @@ void R_Kister_Data_Store::load(std::istream& inFile) // Jaunt through lines until we find the Redlich-Kister parameters std::string line; while( std::getline(inFile,line) ) while( std::getline(rkinFile,line) ) { if( line.find("RK parameters") != std::string::npos ) break; } // Its possible we could have a bum input. That should break here. // this is a comment line std::getline(inFile,line); std::getline(rkinFile,line); // Read the input data. TODO currently only uses density while( std::getline(inFile,line)) while( std::getline(rkinFile,line)) { auto tokens = utils::split(",",line); for(size_t i=0; i<tokens.size(); ++i) Loading Loading @@ -125,7 +131,28 @@ void R_Kister_Data_Store::load(std::istream& inFile) */ Data_Store::View R_Kister_Data_Store::setView( const Vec_Name& names, const Vec_Mole& mole_percents) { // Clear the old end members end_members.clear(); // Set up a view or returning useful data Data_Store::View v; // Look for the data in the default data first Vec_Name tempNames = names; if(d.valid(tempNames)) { // See if the data is close enough to what is requested std::vector<std::pair<double,size_t>> test = utils::nearest_neighbor( mole_percents,d.getSaltComps(names)); if(test[0].first < 0.01) { end_members.resize(1); endMem_moleFracs = {1.0}; } end_members[0] = d.setView(names,mole_percents); v = end_members[0]; } end_members.resize(names.size()); endMem_moleFracs = mole_percents; Loading @@ -136,9 +163,6 @@ Data_Store::View R_Kister_Data_Store::setView( const Vec_Name& names, const Vec_ if (valid(iname)) end_members[i] = (d.setView({names[i]},{1.0})); } // To adapt the interfaces a "minimal" view is returned to the client Data_Store::View v; if(std::all_of(end_members.begin(),end_members.end(),[] (Data_Store::View v){return !v.nullView();})) { Loading
src/fortran/cix/r_kister_data_store.cpp2f.xml +2 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,8 @@ <include_relative name="r_kister_data_store.hh"/> <class name="R_Kister_Data_Store" parent="Data_Store"> <method name="load" return_type="void"> <param name="path" type="char*"/> <param name="rkpath" type="char*"/> <param name="dfpath" type="char*"/> </method> </class> Loading
src/fortran/r_kister_data_storeInterface.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -2,16 +2,16 @@ * This file has been dynamically generated by Class Interface Xml (CIX) * DO NOT MODIFY THIS FILE -- CHANGES WILL BE OVERWRITTEN UPON REGENERATION * If changes need to occur, modify the appropriate CIX xml file * Date Generated: Tue Jun 14 14:36:27 EDT 2022 * Date Generated: Wed Mar 29 11:07:39 EDT 2023 * If any issues are experiences with this generated file that cannot be fixed * with adjustment of the CIX xml file, please contact Robert A. Lefebvre, raq@ornl.gov */ #include <string.h> #include "r_kister_data_storeInterface.h" using namespace saline; void R_Kister_Data_Store_load(void * R_Kister_Data_Store_ptr,char* path) void R_Kister_Data_Store_load(void * R_Kister_Data_Store_ptr,char* rkpath,char* dfpath) { ((R_Kister_Data_Store*)R_Kister_Data_Store_ptr)->load(path); ((R_Kister_Data_Store*)R_Kister_Data_Store_ptr)->load(rkpath,dfpath); } void* R_Kister_Data_Store_initialize() Loading