Esempio n. 1
0
 def __init__(self, simplesphere, params):
     self.simplesphere = simplesphere
     self.params = params
     # Problem fields
     self.v = v = TensorField(simplesphere, rank=1)
     self.p = p = TensorField(simplesphere, rank=0)
     self.state_system = TensorSystem(simplesphere, [self.v, self.p])
     # Work fields
     self.grad_v = TensorField(simplesphere, rank=2)
     self.Fv = TensorField(simplesphere, rank=1)
     self.Fp = TensorField(simplesphere, rank=0)
     self.RHS_system = TensorSystem(simplesphere, [self.Fv, self.Fp])
     # Analysis fields
     self.analysis = {}
     self.om = TensorField(simplesphere, rank=0)
     self.KE = TensorField(simplesphere, rank=0)
     # Build matrices
     self.M, self.L = [], []
     for m in simplesphere.local_m:
         logger.info("Building matrix %i" % m)
         Mm, Lm = self.build_matrices(m)
         self.M.append(Mm)
         self.L.append(Lm)
Esempio n. 2
0
metadata = dict(title='Movie', artist='Matplotlib', comment='Movie support!')
writer = FFMpegWriter(fps=FPS, metadata=metadata)

with writer.saving(fig, "%s/sphere%i_om_coeffs.mp4" %(output_folder, sim_number), dpi):

    for ind in range(first_frame + comm.rank + 1, last_frame + 1, step):
        if ind%100==0: logger.info("Frame: %i" %(ind))

        with np.load(os.path.join(input_folder, 'output_%i.npz' %(ind))) as file:
            if ind == first_frame + comm.rank +1:
                phi = file['phi']
                theta = file['theta']
                L_max = len(theta)-1
                S_max = 4
                simplesphere = SimpleSphere(L_max, S_max)
                omega = TensorField(simplesphere, rank=0)

            om = file['om']
            time = file['t'][0]


        # assign loaded data
        omega.component_fields[0]['g'] = om
        # spectral transform
        omega.forward_phi()
        omega.forward_theta()
        coeffs = omega.coeffs

        #assign coeffs to a numpy array
        coeffs_arr = np.zeros([L_max+1, L_max+1], dtype=complex)
        for m in range(len(coeffs)):