コード例 #1
0
ファイル: run.py プロジェクト: ferdinandvanwyk/gs2_analysis
    def read_upar(self, lab_frame=False):
        """
        Read the parallel velocity.
        """

        self.upar_i = field.get_field(self.cdf_file, 'upar_igomega_by_mode', 0)
        self.upar_e = field.get_field(self.cdf_file, 'upar_igomega_by_mode', 1)

        if lab_frame:
            for ix in range(self.nkx):
                for iy in range(self.nky):
                    self.upar_i[:,ix,iy] = self.upar_i[:,ix,iy]* \
                                           np.exp(1j * self.n0 * iy * \
                                                  self.omega * self.t)
                    self.upar_e[:,ix,iy] = self.upar_e[:,ix,iy]* \
                                           np.exp(1j * self.n0 * iy * \
                                                  self.omega * self.t)

        self.upar_i = field.field_to_real_space(self.upar_i)*self.rho_star
        self.upar_e = field.field_to_real_space(self.upar_e)*self.rho_star
コード例 #2
0
ファイル: run.py プロジェクト: ferdinandvanwyk/gs2_analysis
    def read_tperp(self, lab_frame):
        """
        Read the perpendicular temperature.
        """

        self.tperp_i = field.get_field(self.cdf_file, 'tperp_igomega_by_mode', 0)
        self.tperp_e = field.get_field(self.cdf_file, 'tperp_igomega_by_mode', 1)

        if lab_frame:
            for ix in range(self.nkx):
                for iy in range(self.nky):
                    self.tperp_i[:,ix,iy] = self.tperp_i[:,ix,iy]* \
                                            np.exp(1j * self.n0 * iy * \
                                                   self.omega * self.t)
                    self.tperp_e[:,ix,iy] = self.terp_e[:,ix,iy]* \
                                            np.exp(1j * self.n0 * iy * \
                                                   self.omega * self.t)

        # Convert to real space
        self.tperp_i = field.field_to_real_space(self.tperp_i)*self.rho_star
        self.tperp_e = field.field_to_real_space(self.tperp_e)*self.rho_star
コード例 #3
0
ファイル: run.py プロジェクト: ferdinandvanwyk/gs2_analysis
    def read_ntot(self, lab_frame=False):
        """
        Read the 2D density fluctuations from the NetCDF file.
        """

        self.ntot_i = field.get_field(self.cdf_file, 'ntot_igomega_by_mode', 0)
        self.ntot_e = field.get_field(self.cdf_file, 'ntot_igomega_by_mode', 1)

        if lab_frame:
            for ix in range(self.nkx):
                for iy in range(self.nky):
                    self.ntot_i[:,ix,iy] = self.ntot_i[:,ix,iy]* \
                                           np.exp(1j * self.n0 * iy * \
                                                  self.omega * self.t)
                    self.ntot_e[:,ix,iy] = self.ntot_e[:,ix,iy]* \
                                           np.exp(1j * self.n0 * iy * \
                                                  self.omega * self.t)

        # Convert to real space
        self.ntot_i = field.field_to_real_space(self.ntot_i)*self.rho_star
        self.ntot_e = field.field_to_real_space(self.ntot_e)*self.rho_star
コード例 #4
0
ファイル: run.py プロジェクト: ferdinandvanwyk/gs2_analysis
    def read_phi(self, lab_frame=False):
        """
        Read the electrostatic potenential from the NetCDF file.
        """

        self.phi = field.get_field(self.cdf_file, 'phi_igomega_by_mode', None)

        if lab_frame:
            for ix in range(self.nkx):
                for iy in range(self.nky):
                    self.phi[:,ix,iy] = self.phi[:,ix,iy]* \
                                        np.exp(1j * self.n0 * iy * \
                                               self.omega * self.t)

        self.phi = field.field_to_real_space(self.phi)*self.rho_star
コード例 #5
0
ファイル: run.py プロジェクト: ferdinandvanwyk/gs2_analysis
    def calculate_v_exb(self, lab_frame=False):
        """
        Calculates the radial ExB velocity in real space in units of v_th,i.
        """

        phi_k = field.get_field(self.cdf_file, 'phi_igomega_by_mode', None)

        self.v_exb = 1j*self.ky*phi_k

        if lab_frame:
            for ix in range(self.nkx):
                for iy in range(self.nky):
                    self.v_exb[:,ix,iy] = self.v_exb[:,ix,iy]* \
                                          np.exp(1j * self.n0 * iy * \
                                                 self.omega * self.t)

        self.v_exb = field.field_to_real_space(self.v_exb)* \
                     self.rho_star*self.vth
コード例 #6
0
ファイル: run.py プロジェクト: ferdinandvanwyk/gs2_analysis
    def calculate_q(self):
        """
        Calculate the local heat flux Q(x, y) for the ion species.
        """

        # Need phi as a function of kx, ky so read directly from netcdf file
        self.phi = field.get_field(self.cdf_file, 'phi_igomega_by_mode', None)
        self.read_ntot()
        self.read_tperp()
        self.read_tpar()

        # Convert to real space
        v_exb = field.field_to_real_space(1j*self.ky*self.phi)
        ntot_i = self.ntot_i/self.rho_star
        tperp_i = self.tperp_i/self.rho_star
        tpar_i = self.tpar_i/self.rho_star

        self.q = ((tperp_i + tpar_i/2 + 3/2*ntot_i)*v_exb).real/2

        dnorm = self.dtheta/self.bmag/self.gradpar
        wgt = np.sum(dnorm*self.grho)

        self.q = self.q * dnorm[int(self.nth/2)] / wgt