Ejemplo n.º 1
0
def E_atm(theta, lam):
    ### emissivity starts with 1 - T of atmosphere
    T = datalib.ATData(lam)
    ### angular part is the emissivity raised to 1/cos(theta):
    b = 1. / np.cos(theta)
    Eatm = (1 - T)**b
    return Eatm
Ejemplo n.º 2
0
def Patm(EPS_P, EPS_S, T_amb, lam, theta, w):

    dlam = np.abs(lam[0] - lam[1])
    ### Get normal atmospheric transmissivity
    atm_T = datalib.ATData(lam)
    ### Get BB spectrum associated with ambient temperature
    BBs = datalib.BB(lam, T_amb)

    x = 0
    for i in range(0, len(w)):
        patm_som = 0
        angular_mod = 1. / np.cos(theta[i])
        for j in range(0, len(lam)):
            patm_som = patm_som + (
                0.5 * EPS_P[i][j] + 0.5 * EPS_S[i][j]) * BBs[j] * np.cos(
                    theta[i]) * (1 - atm_T[j]**angular_mod) * dlam
        x = x + patm_som * np.sin(theta[i]) * w[i]
    return 2 * np.pi * x
Ejemplo n.º 3
0
def Patm_prime(dim, eps_prime_p, eps_prime_s, T_amb, lam, theta, w):

    dlam = np.abs(lam[1] - lam[0])
    ### get normal atmospheric transmissivity
    atm_T = datalib.ATData(lam)
    ### get BB spectrum associated with ambient temperature
    BBs = datalib.BB(lam, T_amb)
    ### initialize grad
    grad = np.zeros(dim)

    for i in range(0, dim):
        x = 0
        for j in range(0, len(w)):
            patm_prime = 0
            angular_mod = 1. / np.cos(theta[j])
            for k in range(0, len(lam)):
                patm_prime = patm_prime + 0.5 * (eps_prime_p[
                    i, j, k] + eps_prime_s[i, j, k]) * BBs[k] * np.cos(
                        theta[j]) * (1 - atm_T[k]**angular_mod) * dlam
            x = x + patm_prime * np.sin(theta[j]) * w[j]
        grad[i] = 2 * np.pi * x

    return grad
Ejemplo n.º 4
0
    def __init__(self, args):
        ### set up some default attributes
        self.result = 1
        self.mode = args.get('mode')
        #print(" Mode is ",self.mode)
        
        ### There might not always be an input file..
        ### need to make sure we think about to handle this
        self.inputfile = args.get('file')
        
        ### Set default values for all attributes
        ###that are required for actually running
        ### different calculations... will check for
        ### user input on these later
        self.pol = 'p'
        ### default incident angle
        self.theta = 0
        ### default solar angle for coolinglib calculations
        self.theta_sun = 30 * np.pi/180
        ### T_ml is the temperature of the multilayer being modeledd
        self.T_ml = 300
        ### T_amb is the ambient temperature
        self.T_amb = 300
        ### default bandgap wavelength is 2254e-9 m, good value for InGaAsSb
        self.lbg = 2254e-9
        ### default PV is InGaAsSb
        self.PV = "InGaAsSb"
        ### default Temperature of PV cell is 25 deg C 
        ### or 298 K
        self.T_cell = 298
        ### default solar concentration for STPV absorber
        self.solarconc = 600
        ### default is to not use explicit angle dependence of emissivity, etc
        self.explicit_angle = 0
        ### by default, degree of G-L polynomial will not be needed since explicit angle dependence
        ### is not the default but 
        ### we will set it at 7 anyway for now
        self.deg = 7
        
        ### relates to SPP and PA resonances
        self.SPP_Resonance = 0+0j
        self.PA_Resonance = 0+0j
        ### attributes that relate to which quantities should
        ### be computed... the default will be 
        ### only to compute the Fresnel reflection, transmission,
        ### and absorption/emissivity for a structure
        ### all further options must be specified by user
        ### typically stpv emitters will be designed
        ### using different criteria than absorbers
        ### so the two applications will be treated independently
        self.stpv_emitter_calc = 0
        self.stpv_absorber_calc = 0
        ### note there could be a third section for an integrated absorber/emitter
        ### but some thought is required 
        self.cooling_calc = 0
        self.lightbulb_calc = 0
        self.spp_calc = 0
        self.color_calc = 0
        self.fresnel_calc = 1
        self.explicit_angle = 0
        self.resonance = 0
        self.reflective_rgb = np.zeros(3)
        self.thermal_rgb = np.zeros(3)
        self.color_name = 'None'
        
        ### current version only inline_structure method supported
        ### more modes of operation will come in later versions!
        self.inline_structure(args)
            
        ### Now that structure is defined and we have the lambda array, 
        ### allocate other arrays!
        ### Always need normal arrays
        self.reflectivity_array = np.zeros(len(self.lambda_array))
        self.transmissivity_array = np.zeros(len(self.lambda_array))
        self.emissivity_array = np.zeros(len(self.lambda_array))
        self.thermal_emission_array = np.zeros(len(self.lambda_array))
        
        ### In some cases the user may wish to compute
        ### R, T, or eps vs angle at a specific wavelength
        ### we will allocate three arrays for these cases
        ### with a resolution of 0.5 degrees... i.e. they are small!
        self.r_vs_theta = np.zeros(180)
        self.t_vs_theta = np.zeros(180)
        self.eps_vs_theta = np.zeros(180)
        self.theta_array = np.linspace(0,89.5*np.pi/180, 180)
        ### If users selects explicit_angle option, we 
        ### need arrays for R, T, and eps as a function of angle
        ### and polarization, as well
        if (self.explicit_angle):
            ### range is 0 to thetaC
            a = 0
            b = np.pi/2.
            self.x, self.w = np.polynomial.legendre.leggauss(self.deg)
            self.t = 0.5*(self.x + 1)*(b - a) + a
            self.w = self.w * 0.5 * (b-a)
            
            self.reflectivity_array_p = np.zeros((self.deg,len(self.lambda_array)))
            self.reflectivity_array_s = np.zeros((self.deg,len(self.lambda_array)))
            self.transmissivity_array_p = np.zeros((self.deg,len(self.lambda_array)))
            self.transmissivity_array_s = np.zeros((self.deg,len(self.lambda_array)))
            self.emissivity_array_p = np.zeros((self.deg,len(self.lambda_array)))
            self.emissivity_array_s = np.zeros((self.deg,len(self.lambda_array)))
            self.thermal_emission_array_p = np.zeros((self.deg,len(self.lambda_array)))
            self.thermal_emission_array_s = np.zeros((self.deg,len(self.lambda_array)))


            
        ### Get all far-field Fresnel-related quantities:
        ### Reflectivity, Transmissivity, and Absorptivity/Emissivity spectra
        ### Always call the normal version
        self.fresnel()
        
        ### If user selected explict_angle option, call the EA methods as well
        if (self.explicit_angle):
            ### get the Reflectivity, Transmissivity, and Absorptivity/Emissivity
            ### at the angles from the Gauss-Legendre grid
            self.fresnel_ea()
            ### Get the thermal emission at the angles from the
            ### Gauss-Legendre grid
            self.thermal_emission_ea()
        


        ### stpv_calc cooling_calc lightbulb_calc color_calc all
        ### require BB spectrum / thermal emission spectrum
        if (self.stpv_emitter_calc or self.stpv_absorber_calc or self.cooling_calc or self.lightbulb_calc or self.color_calc):
            ### The ThermalEmission() method automatically calculates the BB spectrum
            ### and stores it to self.BBs
            self.thermal_emission()

        #self.ThermalColor()
        ### now that default quantitites have been calculated, start
        ### looking at optional quantities
        ### want to compute stpv quantities with explicit angle dependence?
        if (self.stpv_emitter_calc and self.explicit_angle):
            
            self.stpv_se_ea()
            self.stpv_pd_ea()
            self.stpv_etatpv_ea()
        ### want no explicit angle dependence?
        elif (self.stpv_emitter_calc):
            
            self.stpv_se()
            self.stpv_pd()
            self.stpv_etatpv()
            
        if (self.stpv_absorber_calc):
        
            if (self.explicit_angle):
                self.stpv_etaabs_ea()
            else:
                self.stpv_etaabs()
            
        if (self.color_calc):

            self.ambient_color()
            self.thermal_color()
            
        if (self.lightbulb_calc):
            
            ### Luminous efficiency and efficacy calcs here
            self.luminous_efficiency()
            plt.plot(self.lambda_array*1e9, self.thermal_emission_array, 'red', label = 'Lighbulb Emission')
            plt.plot(self.lambda_array*1e9, self.BBs, 'black', label = 'Blackbody spectrum')
            plt.xlabel('Wavelength (nm)')
            plt.ylabel('Spectral Irradiance (W / m^2 / nm / sr)')
            plt.show()
            
            ### need to validate method for computing luminous efficacy
            #self.luminous_efficacy()
        
        if (self.cooling_calc):
            
            ### will compute the following quantites:
            ### self.radiative_power_val -> at current T_ml, power emitted / unit area
            ### self.solar_power_val -> power absorbed from sun / unit area
            ### self.atmospherical_power_val -> power absorbed from atm at T_amb / unit area
            ### self.cooling_power -> net power flux / unit area from balance of all the above
            self.cooling_power()
            
            AM = datalib.AM(self.lambda_array)
            T_atm = datalib.ATData(self.lambda_array)
            print(self.cooling_power_val," W/m^2 (Total Cooling Power)")
            print(self.radiative_power_val," W/m^2 ((Cooling) Power radiated by structure at ",self.T_ml, "K)")
            print(self.solar_power_val," W/m^2 ((Warming) Power absorbed from sun)")
            print(self.atmospheric_power_val," W/m^2 ((Warming) Power absorbed from atmospheric radiation at ",self.T_amb, "K)")
            plt.xlim(0.3, 2.5)
            plt.plot(self.lambda_array*1e6, self.emissivity_array, 'blue', label = 'Emissivity')
            plt.plot(self.lambda_array*1e6, AM/(1.4*1e9), 'red', label = 'Solar Spectrum')
            plt.xlabel('Wavelength (microns)')
            plt.ylabel('Arb. Units')
            plt.show()
            plt.xlim(2.5, 20)
            plt.plot(self.lambda_array*1e6, T_atm, 'cyan', label = 'Atmospheric Transmissivity')
            plt.plot(self.lambda_array*1e6, self.emissivity_array, 'red', label = 'Emissivity')
            plt.xlabel('Wavelength (microns)')
            plt.ylabel('Arb. Units')
            plt.show()
Ejemplo n.º 5
0
fill_fraction = 0.3
layer = 1
np_slab.layer_alloy(layer,
                    fill_fraction,
                    'Air',
                    'SiO2',
                    'Bruggeman',
                    plot=True)
#np_slab.layer_alloy(layer,fill_fraction,'Air','SiO2','MG', plot = False)
np_slab.thermal_emission_ea()
np_slab.cooling_power()

#%%
# Calculate standard spectra related to radiative cooling
AM = datalib.AM(np_slab.lambda_array)
T_atm = datalib.ATData(np_slab.lambda_array)
BB = datalib.BB(np_slab.lambda_array, np_slab.T_ml)

### plot results!
plt.figure()
mask = (np_slab.lambda_array >= 3000e-9) & (np_slab.lambda_array <= 30000e-9)
plt.plot(np_slab.lambda_array[mask] * 1e6, T_atm[mask], 'cyan')
plt.plot(np_slab.lambda_array[mask] * 1e6, np_slab.emissivity_array[mask],
         'red')
#plt.plot(np_slab.lambda_array[mask]*1e6, np_slab.thermal_emission_array[mask], 'red')

plt.figure()
mask = (np_slab.lambda_array >= 250e-9) & (np_slab.lambda_array <= 3000e-9)
plt.plot(np_slab.lambda_array[mask] * 1e6, np_slab.emissivity_array[mask],
         'blue')
plt.plot(np_slab.lambda_array[mask] * 1e6, AM[mask] / (1.4 * 1e9), 'red')