def get_num_cells(self): solution = IO() solution.path = self.path solution.file_prefix = self.file_prefix solution.frame = 0 solution.read_aux = False solution.read_petsc() self.__setattr__('num_cells',solution.x.centers.size) return self
def _PlotFrame(self,frame): solution = IO() solution.path = self.path solution.file_prefix = self.file_prefix solution.frame = frame solution.read_aux = True solution.read_petsc() if solution.num_dim==1: self.PlotQ1D(solution) if solution.num_dim==2: self.PlotQ2D(solution)
def PlotFrames(self): solution = IO() solution.path = self.path solution.file_prefix = self.file_prefix for frame in self.plot_frames: solution.frame = frame solution.read_aux = True solution.read_petsc() if solution.num_dim==1: self.PlotQ1D(solution) if solution.num_dim==2: self.PlotQ2D(solution)
def post_frame_calc(self,frame): solution = IO() solution.path = self.path solution.file_prefix = self.file_prefix solution.frame = frame solution.read_aux = True solution.read_petsc() if solution.num_dim==1: self.QuadField1D(solution,self.quad) self.EMEnergy(solution) elif solution.num_dim==2: self.QuadField2D(solution,self.quad)
def PeakSampleFrame(self,frame,n): solution = IO() solution.path = self.path solution.file_prefix = self.file_prefix solution.frame = frame solution.read_petsc() x = solution.x.centers.copy() # print x.shape for k,mode in enumerate(self.sample_mode): if self.num_dim==1: self.FieldIntensity1D(solution) self.Poyinting1D(solution) self.q_sampled[k,0,n] = solution.t self.S_sampled[k,0,n] = solution.t self.I_sampled[k,0,n] = solution.t maxif = 0.0 if mode=='peak': self.q_sampled[k,1,n],self.q_sampled[k,3,n] = self.PeakSample1D(solution.q[0]) if self.q_sampled[k,1,n]==-99: self.q_sampled[k,1,n] = self.q_sampled[k,1,n-1] self.q_sampled[k,3,n] = self.q_sampled[k,3,n-1] self.q_sampled[k,2,n],self.q_sampled[k,4,n] = self.PeakSample1D(solution.q[1]) if self.q_sampled[k,2,n]==-99: self.q_sampled[k,2,n] = self.q_sampled[k,2,n-1] self.q_sampled[k,4,n] = self.q_sampled[k,4,n-1] self.I_sampled[k,1,n],self.I_sampled[k,2,n] = self.PeakSample1D(self.I) if self.q_sampled[k,1,n]==-99: self.I_sampled[k,1,n] = self.I_sampled[k,1,n-1] self.I_sampled[k,2,n] = self.I_sampled[k,2,n-1] self.S_sampled[k,1,n],self.S_sampled[k,2,n] = self.PeakSample1D(self.S) if self.q_sampled[k,1,n]==-99: self.S_sampled[k,1,n] = self.S_sampled[k,1,n-1] self.S_sampled[k,2,n] = self.S_sampled[k,2,n-1] if mode=='width': self.q_sampled[k,1,n],self.q_sampled[k,3,n] = self.PeakWidth1D(solution.q[0],x) if self.q_sampled[k,1,n]==-99: self.q_sampled[k,1,n] = self.q_sampled[k,1,n-1] self.q_sampled[k,3,n] = self.q_sampled[k,3,n-1] self.q_sampled[k,2,n],self.q_sampled[k,4,n] = self.PeakWidth1D(solution.q[1],x) if self.q_sampled[k,2,n]==-99: self.q_sampled[k,2,n] = self.q_sampled[k,2,n-1] self.q_sampled[k,4,n] = self.q_sampled[k,4,n-1] self.I_sampled[k,1,n],self.I_sampled[k,2,n] = self.PeakWidth1D(self.I,x) if self.q_sampled[k,1,n]==-99: self.I_sampled[k,1,n] = self.I_sampled[k,1,n-1] self.I_sampled[k,2,n] = self.I_sampled[k,2,n-1] self.S_sampled[k,1,n],self.S_sampled[k,2,n] = self.PeakWidth1D(self.S,x) if self.q_sampled[k,1,n]==-99: self.S_sampled[k,1,n] = self.S_sampled[k,1,n-1] self.S_sampled[k,2,n] = self.S_sampled[k,2,n-1]
def get_num_dim(self): solution = IO() solution.path = self.path solution.file_prefix = self.file_prefix solution.frame = 50 solution.read_aux = True solution.read_petsc() self.__setattr__('num_dim',solution.num_dim) if self.num_dim==1: self.RefIndex1D(solution) if self.num_dim==2: self.RefIndex2D(solution) self.__setattr__('cmax',self.co/self.n.min()) self.__setattr__('cmin',self.co/self.n.max()) return self