Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NEAMS
saline
Commits
c3a43d6b
Commit
c3a43d6b
authored
Oct 10, 2022
by
Henderson, Shane
Browse files
Merge branch 'gui_dev' into 'master'
Gui dev See merge request neams/saline!15
parents
428e677a
1fb13a81
Changes
9
Hide whitespace changes
Inline
Side-by-side
include/data_store.hh
View file @
c3a43d6b
...
...
@@ -74,6 +74,7 @@ class Data_Store
double
cp_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_cp
()
const
;
double
cp_unc
()
const
;
std
::
pair
<
double
,
double
>
cp_rng
()
const
;
std
::
string
cp_ref
()
const
;
// viscosity
...
...
@@ -81,6 +82,7 @@ class Data_Store
double
mu_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_mu
()
const
;
double
mu_unc
()
const
;
std
::
pair
<
double
,
double
>
mu_rng
()
const
;
std
::
string
mu_ref
()
const
;
// conductivity
...
...
@@ -88,6 +90,7 @@ class Data_Store
double
k_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_k
()
const
;
double
k_unc
()
const
;
std
::
pair
<
double
,
double
>
k_rng
()
const
;
std
::
string
k_ref
()
const
;
// density
...
...
@@ -95,6 +98,7 @@ class Data_Store
double
rho_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_rho
()
const
;
double
rho_unc
()
const
;
std
::
pair
<
double
,
double
>
rho_rng
()
const
;
std
::
string
rho_ref
()
const
;
// enthalpy given temperature
...
...
@@ -130,11 +134,16 @@ class Data_Store
// the constituents names in a given compound
virtual
Vec_Name
names
(
Id
)
const
=
0
;
// The list accessible salt names
virtual
Vec_Name
getSaltKeys
()
const
=
0
;
virtual
std
::
vector
<
std
::
vector
<
double
>>
getSaltComps
(
Vec_Name
names
)
const
=
0
;
// specific heat
virtual
double
cp
(
Id
id
,
Id
data_id
,
double
temperature
,
double
pressure
=
101.325
)
const
=
0
;
virtual
double
cp_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
=
0
;
virtual
bool
valid_cp
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
double
cp_unc
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
pair
<
double
,
double
>
cp_rng
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
string
cp_ref
(
Id
id
,
Id
data_id
)
const
=
0
;
// viscosity
...
...
@@ -142,6 +151,7 @@ class Data_Store
virtual
double
mu_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
=
0
;
virtual
bool
valid_mu
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
double
mu_unc
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
pair
<
double
,
double
>
mu_rng
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
string
mu_ref
(
Id
id
,
Id
data_id
)
const
=
0
;
// conductivity
...
...
@@ -149,6 +159,7 @@ class Data_Store
virtual
double
k_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
=
0
;
virtual
bool
valid_k
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
double
k_unc
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
pair
<
double
,
double
>
k_rng
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
string
k_ref
(
Id
id
,
Id
data_id
)
const
=
0
;
// density
...
...
@@ -156,6 +167,7 @@ class Data_Store
virtual
double
rho_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
=
0
;
virtual
bool
valid_rho
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
double
rho_unc
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
pair
<
double
,
double
>
rho_rng
(
Id
id
,
Id
data_id
)
const
=
0
;
virtual
std
::
string
rho_ref
(
Id
id
,
Id
data_id
)
const
=
0
;
// enthalpy
...
...
include/default_data_store.hh
View file @
c3a43d6b
...
...
@@ -82,6 +82,7 @@ class Default_Data_Store : public Data_Store
double
cp_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_cp
(
Id
id
,
Id
data_id
)
const
;
double
cp_unc
(
Id
id
,
Id
data_id
)
const
;
std
::
pair
<
double
,
double
>
cp_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
cp_ref
(
Id
id
,
Id
data_id
)
const
;
// viscosity
...
...
@@ -89,6 +90,7 @@ class Default_Data_Store : public Data_Store
double
mu_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_mu
(
Id
id
,
Id
data_id
)
const
;
double
mu_unc
(
Id
id
,
Id
data_id
)
const
;
std
::
pair
<
double
,
double
>
mu_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
mu_ref
(
Id
id
,
Id
data_id
)
const
;
// conductivity
...
...
@@ -96,6 +98,7 @@ class Default_Data_Store : public Data_Store
double
k_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_k
(
Id
id
,
Id
data_id
)
const
;
double
k_unc
(
Id
id
,
Id
data_id
)
const
;
std
::
pair
<
double
,
double
>
k_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
k_ref
(
Id
id
,
Id
data_id
)
const
;
// density
...
...
@@ -103,6 +106,7 @@ class Default_Data_Store : public Data_Store
double
rho_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_rho
(
Id
id
,
Id
data_id
)
const
;
double
rho_unc
(
Id
id
,
Id
data_id
)
const
;
std
::
pair
<
double
,
double
>
rho_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
rho_ref
(
Id
id
,
Id
data_id
)
const
;
// enthalpy
...
...
@@ -148,8 +152,11 @@ class Default_Data_Store : public Data_Store
//Obtain the nearest neighboring composition
Id
nearest
(
Id
id
,
const
Vec_Mole
&
mole_percent
)
const
;
private:
// The list accessible salt names
Vec_Name
getSaltKeys
()
const
;
std
::
vector
<
std
::
vector
<
double
>>
getSaltComps
(
Vec_Name
names
)
const
;
private:
class
Data
{
...
...
include/r_kister_data_store.hh
View file @
c3a43d6b
...
...
@@ -52,6 +52,7 @@ class R_Kister_Data_Store : public Data_Store
double
cp
(
Id
id
,
Id
data_id
,
double
temperature
,
double
pressure
=
101.325
)
const
;
double
cp_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
cp_unc
(
Id
id
,
Id
data_id
)
const
{
return
.2
;}
std
::
pair
<
double
,
double
>
cp_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
cp_ref
(
Id
id
,
Id
data_id
)
const
{
return
"----"
;}
bool
valid_cp
(
Id
id
,
Id
data_id
)
const
;
...
...
@@ -60,12 +61,14 @@ class R_Kister_Data_Store : public Data_Store
double
mu_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_mu
(
Id
id
,
Id
data_id
)
const
;
double
mu_unc
(
Id
id
,
Id
data_id
)
const
{
return
.2
;}
std
::
pair
<
double
,
double
>
mu_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
mu_ref
(
Id
id
,
Id
data_id
)
const
{
return
"----"
;}
// conductivity
double
k
(
Id
id
,
Id
data_id
,
double
temperature
,
double
pressure
=
101.325
)
const
;
double
k_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_k
(
Id
id
,
Id
data_id
)
const
;
std
::
pair
<
double
,
double
>
k_rng
(
Id
id
,
Id
data_id
)
const
;
double
k_unc
(
Id
id
,
Id
data_id
)
const
{
return
.2
;}
std
::
string
k_ref
(
Id
id
,
Id
data_id
)
const
{
return
"----"
;}
...
...
@@ -74,6 +77,7 @@ class R_Kister_Data_Store : public Data_Store
double
rho_h
(
Id
id
,
Id
data_id
,
double
enthalpy
,
double
pressure
=
101.325
)
const
;
bool
valid_rho
(
Id
id
,
Id
data_id
)
const
;
double
rho_unc
(
Id
id
,
Id
data_id
)
const
{
return
.2
;}
std
::
pair
<
double
,
double
>
rho_rng
(
Id
id
,
Id
data_id
)
const
;
std
::
string
rho_ref
(
Id
id
,
Id
data_id
)
const
{
return
"----"
;}
// enthalpy
...
...
@@ -111,6 +115,10 @@ class R_Kister_Data_Store : public Data_Store
bool
valid
(
Vec_Name
&
names
)
const
;
bool
valid
(
Name
&
name
)
const
;
// The list accessible salt names
Vec_Name
getSaltKeys
()
const
;
std
::
vector
<
std
::
vector
<
double
>>
getSaltComps
(
Vec_Name
names
)
const
;
private:
// Data_Store providing the base information
Default_Data_Store
d
;
...
...
include/thermophysical_properties.hh
View file @
c3a43d6b
...
...
@@ -56,16 +56,22 @@ class Thermophysical_Properties
double
cp_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
cp_kg
(
double
temperature
,
double
pressure
=
101.325
)
const
;
double
cp_h_kg
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
cp_unc
()
const
{
return
m_impl
.
cp_unc
();}
std
::
pair
<
double
,
double
>
cp_rng
()
const
{
return
m_impl
.
cp_rng
();}
bool
valid_cp
()
const
;
// viscosity
double
mu
(
double
temperature
,
double
pressure
=
101.325
)
const
;
double
mu_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
mu_unc
()
const
{
return
m_impl
.
mu_unc
();}
std
::
pair
<
double
,
double
>
mu_rng
()
const
{
return
m_impl
.
mu_rng
();}
bool
valid_mu
()
const
;
// conductivity
double
k
(
double
temperature
,
double
pressure
=
101.325
)
const
;
double
k_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
k_unc
()
const
{
return
m_impl
.
k_unc
();}
std
::
pair
<
double
,
double
>
k_rng
()
const
{
return
m_impl
.
k_rng
();}
bool
valid_k
()
const
;
// density
...
...
@@ -73,6 +79,8 @@ class Thermophysical_Properties
double
rho_h
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
rho_kgm3
(
double
temperature
,
double
pressure
=
101.325
)
const
;
double
rho_h_kgm3
(
double
enthalpy
,
double
pressure
=
101.325
)
const
;
double
rho_unc
()
const
{
return
m_impl
.
rho_unc
();}
std
::
pair
<
double
,
double
>
rho_rng
()
const
{
return
m_impl
.
rho_rng
();}
bool
valid_rho
()
const
;
// enthalpy
...
...
@@ -86,6 +94,10 @@ class Thermophysical_Properties
double
t_melt
()
const
;
double
t_boil
()
const
;
// The list accessible salt names
Vec_Name
getSaltKeys
()
const
;
std
::
vector
<
std
::
vector
<
double
>>
getSaltComps
(
std
::
string
names
)
const
;
// list of species for which properties are being tracked
const
Vec_Name
&
species
()
const
{
return
m_comp_names
;}
...
...
@@ -105,7 +117,7 @@ class Thermophysical_Properties
int
mole_percent_count
);
// interface for checking if salt is valid
bool
isSaltValid
(
const
Vec_Name
&
names
);
bool
isSaltValid
(
const
Vec_Name
&
names
)
const
;
bool
isSaltValid
(
const
std
::
string
&
names
,
int
name_count
);
// initialize the properties data
...
...
@@ -114,7 +126,7 @@ class Thermophysical_Properties
private:
// the most recent species used by the client (names in order of request)
std
::
vector
<
std
::
string
>
m_comp_names
;
Vec_Name
m_comp_names
;
// the data store backing this instance of material properties
Data_Store
*
m_data
;
...
...
src/cpp/data_store.cc
View file @
c3a43d6b
...
...
@@ -89,6 +89,14 @@ double Data_Store::View::cp_unc() const
return
d
->
cp_unc
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the density experimental range for the view object
*/
std
::
pair
<
double
,
double
>
Data_Store
::
View
::
cp_rng
()
const
{
return
d
->
cp_rng
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the heat capacity reference for the view object
*/
...
...
@@ -125,6 +133,14 @@ bool Data_Store::View::valid_mu() const
return
d
->
valid_mu
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the density experimental range for the view object
*/
std
::
pair
<
double
,
double
>
Data_Store
::
View
::
mu_rng
()
const
{
return
d
->
mu_rng
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the viscosity uncertainty for the view object
*/
...
...
@@ -177,6 +193,14 @@ double Data_Store::View::k_unc() const
return
d
->
k_unc
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the density experimental range for the view object
*/
std
::
pair
<
double
,
double
>
Data_Store
::
View
::
k_rng
()
const
{
return
d
->
k_rng
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the thermal conductivity reference for the view object
*/
...
...
@@ -213,6 +237,14 @@ bool Data_Store::View::valid_rho() const
return
d
->
valid_rho
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the density experimental range for the view object
*/
std
::
pair
<
double
,
double
>
Data_Store
::
View
::
rho_rng
()
const
{
return
d
->
rho_rng
(
id
,
rec_id
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieves the density uncertainty for the view object
*/
...
...
src/cpp/default_data_store.cc
View file @
c3a43d6b
...
...
@@ -7,9 +7,19 @@
#include
<algorithm>
#include
<fstream>
#include
<sstream>
#include
<iomanip>
namespace
saline
{
//@{
//! Types
using
Id
=
std
::
size_t
;
using
Name
=
std
::
string
;
using
Vec_Id
=
std
::
vector
<
Id
>
;
using
Vec_Name
=
std
::
vector
<
Name
>
;
using
Vec_Mole
=
std
::
vector
<
double
>
;
//@}
//---------------------------------------------------------------------------//
/*!
* \brief constructs the default data store
...
...
@@ -120,7 +130,7 @@ void Default_Data_Store::load(std::istream& inFile)
parse_data_token
(
tokens
[
19
],
d
.
m_mu_c
);
}
//Applicability range
parse_range_token
(
tokens
[
20
],
d
.
m_
rho
_rng
);
parse_range_token
(
tokens
[
20
],
d
.
m_
mu
_rng
);
//uncertainty
parse_data_qualifier
(
tokens
[
21
],
d
.
m_mu_unc_qualifier
);
parse_data_token
(
tokens
[
21
],
d
.
m_mu_unc
);
...
...
@@ -132,7 +142,7 @@ void Default_Data_Store::load(std::istream& inFile)
parse_data_token
(
tokens
[
23
],
d
.
m_k_a
);
parse_data_token
(
tokens
[
24
],
d
.
m_k_b
);
//Applicability range
parse_range_token
(
tokens
[
25
],
d
.
m_
rho
_rng
);
parse_range_token
(
tokens
[
25
],
d
.
m_
k
_rng
);
//uncertainty
parse_data_qualifier
(
tokens
[
26
],
d
.
m_k_unc_qualifier
);
parse_data_token
(
tokens
[
26
],
d
.
m_k_unc
);
...
...
@@ -332,6 +342,16 @@ double Default_Data_Store::cp_h(Id id, Id data_id, double enthalpy, double p) co
return
d
.
cp_h
(
enthalpy
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the heat capacity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
Default_Data_Store
::
cp_rng
(
Id
id
,
Id
data_id
)
const
{
const
auto
&
d
=
compounds
[
id
].
data
[
data_id
];
// k(t) = a + b * t
return
d
.
m_cp_rng
;
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the heat capacity uncertainty for the selected compound
...
...
@@ -367,6 +387,16 @@ double Default_Data_Store::mu_h(Id id, Id data_id, double enthalpy, double p) co
return
d
.
mu_h
(
enthalpy
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the viscosity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
Default_Data_Store
::
mu_rng
(
Id
id
,
Id
data_id
)
const
{
const
auto
&
d
=
compounds
[
id
].
data
[
data_id
];
// k(t) = a + b * t
return
d
.
m_mu_rng
;
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the viscosity uncertainty for the selected compound
...
...
@@ -403,6 +433,16 @@ double Default_Data_Store::k_h(Id id, Id data_id, double enthalpy, double p) con
return
d
.
k_h
(
enthalpy
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the conductivity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
Default_Data_Store
::
k_rng
(
Id
id
,
Id
data_id
)
const
{
const
auto
&
d
=
compounds
[
id
].
data
[
data_id
];
// k(t) = a + b * t
return
d
.
m_k_rng
;
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the conductivity uncertainty for the selected compound
...
...
@@ -440,6 +480,16 @@ double Default_Data_Store::rho_h(Id id, Id data_id, double enthalpy, double p) c
return
d
.
rho_h
(
enthalpy
);
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the conductivity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
Default_Data_Store
::
rho_rng
(
Id
id
,
Id
data_id
)
const
{
const
auto
&
d
=
compounds
[
id
].
data
[
data_id
];
// k(t) = a + b * t
return
d
.
m_rho_rng
;
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the density uncertainty for the selected compound
...
...
@@ -607,7 +657,7 @@ Default_Data_Store::Data& Default_Data_Store::getDataReference(std::string names
auto
symbols
=
utils
::
split
(
"-"
,
names
);
//mole fraction of each salt
std
::
vector
<
doub
le
>
molfrac
;
Vec_Mo
le
molfrac
;
if
(
symbols
.
size
()
==
1
)
{
//This is for pure salt and might benefit from some error checking
...
...
@@ -666,7 +716,7 @@ void Default_Data_Store::parse_range_token(std::string &token,std::pair<double,d
double
stp
=
0.0
;
if
(
!
all_of
(
token
.
begin
(),
token
.
end
(),[]
(
char
c
){
return
c
==
'-'
;}))
{
std
::
vector
<
std
::
string
>
rng_str
=
utils
::
split
(
"-"
,
token
);
Vec_Name
rng_str
=
utils
::
split
(
"-"
,
token
);
stt
=
std
::
stod
(
rng_str
[
0
]);
if
(
rng_str
.
size
()
==
2
)
{
...
...
@@ -705,4 +755,36 @@ void Default_Data_Store::parse_data_qualifier(std::string &token,DataQualifier &
break
;
}
}
Vec_Name
Default_Data_Store
::
getSaltKeys
()
const
{
Vec_Name
keys
;
for
(
auto
comp
:
compounds
)
{
std
::
string
key
=
comp
.
names
[
0
];
for
(
int
i
=
1
;
i
<
comp
.
names
.
size
();
++
i
)
{
key
.
append
(
"-"
);
key
.
append
(
comp
.
names
[
i
]);
}
keys
.
push_back
(
key
);
}
return
keys
;
}
std
::
vector
<
std
::
vector
<
double
>>
Default_Data_Store
::
getSaltComps
(
Vec_Name
names
)
const
{
size_t
id
=
names_to_id
(
names
);
std
::
vector
<
std
::
vector
<
double
>>
comps
;
if
(
valid
(
id
))
{
const
auto
&
d
=
compounds
[
id
];
for
(
int
i
=
0
;
i
<
d
.
data
.
size
();
++
i
)
{
Vec_Mole
mp
=
d
.
data
[
i
].
mole_percents
();
comps
.
push_back
(
mp
);
}
}
return
comps
;
}
}
// namespace saline
src/cpp/r_kister_data_store.cc
View file @
c3a43d6b
...
...
@@ -18,6 +18,15 @@
namespace
saline
{
//@{
//! Types
using
Id
=
std
::
size_t
;
using
Name
=
std
::
string
;
using
Vec_Id
=
std
::
vector
<
Id
>
;
using
Vec_Name
=
std
::
vector
<
Name
>
;
using
Vec_Mole
=
std
::
vector
<
double
>
;
//@}
//----------------------------------------------------------------------------//
/*!
* \brief constructs the Redlich-Kister data store extension
...
...
@@ -142,9 +151,9 @@ Data_Store::View R_Kister_Data_Store::setView( const Vec_Name& names, const Vec_
/*!
* \brief returns the names of the compound currently being investigated
*/
std
::
vector
<
std
::
string
>
R_Kister_Data_Store
::
names
(
Id
id
)
const
Vec_Name
R_Kister_Data_Store
::
names
(
Id
id
)
const
{
std
::
vector
<
std
::
string
>
comp_names
;
Vec_Name
comp_names
;
return
comp_names
;
}
...
...
@@ -469,6 +478,38 @@ bool R_Kister_Data_Store::valid_cp(Id id, Id data_id) const
(
Data_Store
::
View
v
){
return
v
.
valid_cp
();}));
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the conductivity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
R_Kister_Data_Store
::
rho_rng
(
Id
id
,
Id
data_id
)
const
{
return
{
0.0
,
0.0
};
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the conductivity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
R_Kister_Data_Store
::
k_rng
(
Id
id
,
Id
data_id
)
const
{
return
{
0.0
,
0.0
};
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the viscosity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
R_Kister_Data_Store
::
mu_rng
(
Id
id
,
Id
data_id
)
const
{
return
{
0.0
,
0.0
};
}
//----------------------------------------------------------------------------//
/*!
* \brief retrieve the heat capacity experimental range for the selected compound
*/
std
::
pair
<
double
,
double
>
R_Kister_Data_Store
::
cp_rng
(
Id
id
,
Id
data_id
)
const
{
return
{
0.0
,
0.0
};
}
//----------------------------------------------------------------------------//
/*!
* \brief Test if a salt is valid
*/
...
...
@@ -493,4 +534,18 @@ bool R_Kister_Data_Store::valid(Name& name) const
return
d
.
valid
(
d
.
name_to_id
(
name
));
}
///TODO
Vec_Name
R_Kister_Data_Store
::
getSaltKeys
()
const
{
//TODO
Vec_Name
keys
;
return
keys
;
}
std
::
vector
<
std
::
vector
<
double
>>
R_Kister_Data_Store
::
getSaltComps
(
Vec_Name
names
)
const
{
//TODO
std
::
vector
<
std
::
vector
<
double
>>
keys
;
return
keys
;
}
}
// namespace saline
src/cpp/thermophysical_properties.cc
View file @
c3a43d6b
...
...
@@ -12,6 +12,15 @@
namespace
saline
{
//@{
//! Types
using
Id
=
std
::
size_t
;
using
Name
=
std
::
string
;
using
Vec_Id
=
std
::
vector
<
Id
>
;
using
Vec_Name
=
std
::
vector
<
Name
>
;
using
Vec_Mole
=
std
::
vector
<
double
>
;
//@}
//---------------------------------------------------------------------------//
// CONSTRUCTORS
//---------------------------------------------------------------------------//
...
...
@@ -259,7 +268,7 @@ bool Thermophysical_Properties::setComposition(const std::string& names,
auto
comps
=
utils
::
split
(
"-"
,
names
);
if
(
comps
.
size
()
!=
mole_percent_count
)
return
false
;
std
::
vector
<
doub
le
>
mp
(
mole_percents
,
mole_percents
+
mole_percent_count
);
Vec_Mo
le
mp
(
mole_percents
,
mole_percents
+
mole_percent_count
);
return
setComposition
(
comps
,
mp
);
}
...
...
@@ -283,7 +292,7 @@ bool Thermophysical_Properties::initialize(Data_Store* d)
* \brief checks that the requested salt is valid
* \returns true, iff the salt named is included in the loaded data_store
*/
bool
Thermophysical_Properties
::
isSaltValid
(
const
Vec_Name
&
names
)
bool
Thermophysical_Properties
::
isSaltValid
(
const
Vec_Name
&
names
)
const
{
auto
sp
=
utils
::
getSortPermutation
(
names
);
auto
sort_names
=
utils
::
applySortPermuation
(
names
,
sp
);
...
...
@@ -299,4 +308,35 @@ bool Thermophysical_Properties::isSaltValid(const std::string& names, int name_c
return
isSaltValid
(
comps
);
}
//---------------------------------------------------------------------------//
/*!
*/
Vec_Name
Thermophysical_Properties
::
getSaltKeys
()
const
{
Vec_Name
keys
;
if
(
m_data
!=
nullptr
&&
m_data
->
size
()
>
0
)
{
keys
=
m_data
->
getSaltKeys
();
}
return
keys
;
}
//---------------------------------------------------------------------------//
/*!
*/
std
::
vector
<
std
::
vector
<
double
>>
Thermophysical_Properties
::
getSaltComps
(
std
::
string
names
)
const
{
std
::
vector
<
std
::
vector
<
double
>>
mp
;
auto
comps
=
utils
::
split
(
"-"
,
names
);
if
(
m_data
!=
nullptr
&&
m_data
->
size
()
>
0
)
{
if
(
isSaltValid
(
comps
))
{
//This doesn't really have any meaning for synthetic data
mp
=
m_data
->
getSaltComps
(
comps
);
}
}
return
mp
;
}
}
// namespace saline
src/python/SalinePy.i
View file @
c3a43d6b
%
module
SalinePy
%
include
std_string
.
i
%
include
std_vector
.
i
%
include
std_pair
.
i
%
{
#
define
SWIG_FILE_INIT
...
...
@@ -15,7 +16,10 @@ namespace std
{
%
template
(
IntVector
)
vector
<
int
>
;
%
template
(
DoubleVector
)
vector
<
double
>
;
%
template
(
DoublePair
)
pair
<
double
,
double
>
;
%
template
(
StringVector
)
vector
<
string
>
;
%
template
(
StringVectorVector
)
vector
<
vector
<
string
>
>
;
%
template
(
DoubleVectorVector
)
vector
<
vector
<
double
>
>
;
}
%
include
data_store
.
hh
%
include
default_data_store
.
hh
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment