materials.variation_with_state module¶
Classes for represernting the variaton of material properties with state.
-
class
materials.variation_with_state.
VariationWithState
(representation, state_vars, state_vars_units, value_type, reference)[source]¶ Bases:
object
A model of a material property’s variation with state.
Parameters: - representation (string) – Description of how the data is represented, e.g. “table”.
- state_vars (list of string) – Names of the state variables.
- state_vars_units (dict of string) – Units of measure for each state variable.
- value_type (string) – Is the stored value a multiplier on the default value, or does it override the default value?
- reference (string) – Bibtex tag for the source of the data.
-
class
materials.variation_with_state.
VariationWithStateEquation
(state_vars, state_vars_units, value_type, reference, expression, state_domain)[source]¶ Bases:
materials.variation_with_state.VariationWithState
A material property’s variation with state, represented as an equation.
Parameters: - state_vars (list of string) – Names of the state variables.
- state_vars_units (dict of string) – Units of measure for each state variable.
- value_type (string) – Is the stored value a multiplier on the default value, or does it override the default?
- reference (string) – Bibtex tag for the source of the data.
- expression (string) –
A mathematical expression for the value of the property as a function of the state variables. This should be a string containing python math operators, the state variable names, and ‘math’ functions, e.g.
’value = 1.23 * temperature + 4.5 * temperature**2’ or’value = 5.6 * exp(7.8 / temperature)’
When evaluated, this expression gives the value of the property.
- state_domain (dict) – each key is the name of a state variable. Values are tuples ‘(smin, smax)’ where ‘smin’ is the minimum bound of the valid domain in that state variable and ‘smax’ is the maximum bound.
-
get_state_domain
()[source]¶ Get the domain over which the property’s variation with state model is valid.
Returns: each key is the name of a state variable. Values are tuples (smin, smax) where smin is the minimum bound of the valid domain in that state variable and smax is the maximum bound. The units of smin and smax are given by state_vars_units[key]. Return type: dict
-
query_value
(state)[source]¶ Query the value of the property at a particular state.
Parameters: state (dict) – The state at which to query the values. It must have a key for each variable name in self.state_vars. state[s1] specifies the query point for state variable s1. The query point for each state may be an array or a scalar. e.g.
state={‘s1’: 0, ‘s2’: 1}state={‘s1’: 0, ‘s2’: np.array([1, 2, 3])}
and
state={‘s1’: np.array([5, 6, 7]), ‘s2’: np.array([1, 2, 3])}
are all valid.
Returns: value(s) of the property at the provided state(s). Return type: scalar or array
-
class
materials.variation_with_state.
VariationWithStateTable
(state_vars, state_vars_units, value_type, reference, interp_points, interp_values, state_vars_interp_scales)[source]¶ Bases:
materials.variation_with_state.VariationWithState
A material property’s variation with state, represented as a table.
-
get_state_domain
()[source]¶ Get the domain over which the property’s variation with state model is valid.
Returns: each key is the name of a state variable. Values are tuples (smin, smax) where smin is the minimum bound of the valid domain in that state variable and smax is the maximum bound. The units of smin and smax are given by state_vars_units[key]. Return type: dict
-
query_value
(state, method='linear', fill_value=nan, rescale=True)[source]¶ Query the value of the property at a particular state.
Parameters: - state (dict) –
The state at which to query the values. It must have a key for each variable name in self.state_vars. state[s1] specifies the query point for state variable s1. The query point for each state may be an array or a scalar. e.g.
state={‘s1’: 0, ‘s2’: 1}state={‘s1’: 0, ‘s2’: [1, 2, 3]}
and
state={‘s1’: [5, 6, 7], ‘s2’: [1, 2, 3]}
are all valid.
- fill_value, and rescale (method,) – are passed through to scipy.interpolate.griddata.
Returns: value(s) of the property at the provided state(s).
Return type: scalar or array
- state (dict) –
-