Example #1
0
    def set_state(self, pressure, temperature):
        """ Update the material to the given pressure [Pa] and temperature.
        
        This updates the other properties of this class (v_s, v_p, ...).
        """
        #in an effort to avoid additional work, don't do all the calculations if nothing has changed
        try:
            if self.pressure == pressure and self.temperature == temperature and self.old_params == self.params:
                return
        except AttributeError:
            pass  #do nothing

        self.pressure = pressure
        self.temperature = temperature
        self.old_params = self.params
                
        if (self.method == bm):
            self.V = self.method.volume(self.pressure, self.params)
            self.K_T = self.method.bulk_modulus(self.V, self.params)
            self.K_S = self.K_T  # since you are ignoring temperature in this method
            if (self.params.has_key('ref_mu') and self.params.has_key('mu_prime')):
                self.mu = self.method.shear_modulus(self.V, self.params)
            else:
                self.mu = -1
                warnings.warn(('Warning: mu and or mu_prime are undefined for ' + self.to_string()))
        else:
            self.V = self.method.volume(self.pressure, self.temperature, self.params)
            self.K_T = self.method.bulk_modulus(self.temperature, self.V, self.params)
            self.K_S = self.method.bulk_modulus_adiabatic(self.temperature, self.V, self.params)
            self.C_v = self.method.heat_capacity_v(self.temperature,self.V, self.params)
            self.C_p = self.method.heat_capacity_p(self.temperature,self.V, self.params)
            self.alpha = self.method.thermal_expansivity(self.temperature, self.V, self.params)
            self.gr = mgd.grueneisen_parameter(self.params['ref_V']/self.V, self.params)
            if (self.params.has_key('ref_mu') and self.params.has_key('mu_prime')):
                self.mu = self.method.shear_modulus(self.temperature, self.V, self.params)
            else:    
                self.mu = -1
                warnings.warn(('Warning: mu and or mu_prime are undefined for ' + self.to_string()))
Example #2
0
def thermal_expansivity(T,V,params):
    C_v = heat_capacity_v(T,V,params)
    gr = mgd.grueneisen_parameter(params['ref_V']/V, params)
    K = bulk_modulus(T,V,params)
    alpha = gr * C_v / K / V
    return alpha
Example #3
0
def bulk_modulus_adiabatic(T,V,params):
    K_T=bulk_modulus(T,V,params)
    alpha = thermal_expansivity(T,V,params)
    gr = mgd.grueneisen_parameter(params['ref_V']/V, params)
    K_S = K_T*(1. + gr * alpha * T)
    return K_S
Example #4
0
def heat_capacity_p(T,V,params):
    alpha = thermal_expansivity(T,V,params)
    gr = mgd.grueneisen_parameter(params['ref_V']/V, params)
    C_v = heat_capacity_v(T,V,params)
    C_p = C_v*(1. + gr * alpha * T)
    return C_p