def __init__(self, # state instance var_dict, # Dictionary that will hold variable instances vis): # mayavi visualization instance import eos self.EOS = eos.ideal() # Methods for EOS constraints self.var_dict = var_dict self.vis = vis self.vis.curve = None self.curve_data = [] self.dispatch = { # Map GUI actions to methods #(Moved, constant): Method, ('v', 'P'): self.vP, ('E', 'P'): self.EP, ('P', 'v'): self.vP, ('E', 'v'): self.Ev, ('P', 'E'): self.EP, ('v', 'E'): self.Ev, ('P', 'S'): self.PS, ('v', 'S'): self.vS, ('E', 'S'): self.ES }
def __init__( self, var_dict, vis # state instance # Dictionary that will hold variable instances ): # mayavi visualization instance import eos self.EOS = eos.ideal() # Methods for EOS constraints self.var_dict = var_dict self.vis = vis self.vis.curve = None self.curve_data = [] self.dispatch = { # Map GUI actions to methods # (Moved, constant): Method, ("v", "P"): self.vP, ("E", "P"): self.EP, ("P", "v"): self.vP, ("E", "v"): self.Ev, ("P", "E"): self.EP, ("v", "E"): self.Ev, ("P", "S"): self.PS, ("v", "S"): self.vS, ("E", "S"): self.ES, }
def __init__(self # Visualization ): """ Calculate three 2-d arrays of values to describe EOS surface and put the surface into self.scene """ import numpy as np import eos EOS = eos.ideal() TA.HasTraits.__init__(self) P, v = np.mgrid[1e10:4e10:20j, 1e-6:4e-6:20j] P = P.T v = v.T E = np.empty(v.shape) n_i,n_j = v.shape for i in range(n_i): for j in range(n_j): E[i,j] = EOS.Pv2E(P[i,j],v[i,j]) self.ranges = [] for a in (P,v,E): self.ranges += [a.min(),a.max()] scale = lambda z: (z-z.min())/(z.max()-z.min()) ML.mesh(scale(P),scale(v),scale(E),figure=self.scene.mayavi_scene) self.flag = False
def __init__(self # Visualization ): """ Calculate three 2-d arrays of values to describe EOS surface and put the surface into self.scene """ import numpy as np import eos EOS = eos.ideal() TA.HasTraits.__init__(self) P, v = np.mgrid[1e10:4e10:20j, 1e-6:4e-6:20j] P = P.T v = v.T E = np.empty(v.shape) n_i, n_j = v.shape for i in range(n_i): for j in range(n_j): E[i, j] = EOS.Pv2E(P[i, j], v[i, j]) self.ranges = [] for a in (P, v, E): self.ranges += [a.min(), a.max()] scale = lambda z: (z - z.min()) / (z.max() - z.min()) ML.mesh(scale(P), scale(v), scale(E), figure=self.scene.mayavi_scene) self.flag = False
def ideal_eos(self,): # state instance import eos self.EOS = eos.ideal()
def ideal_eos(self, # state instance ): import eos self.EOS = eos.ideal()