Beispiel #1
0
def generateArgoData():
    with open("C:\\Users\\NOOK\\Documents\\argo.csv", 'rt') as f:
        reader = csv.reader(f)
        fields = list(reader)
        print(len(fields))
        argo = empty((0, 4))
        for i in range(1, len(fields)):
            P_dPa = float(fields[i][5])
            T_C = float(fields[i][6])
            psal_psu = float(fields[i][7])
            row = array([
                10000 * P_dPa, T_C + 273.15, psal_psu,
                sw.dens(psal_psu, T90conv(T_C), P_dPa)
            ]).reshape(1, 4)
            argo = concatenate((argo, row))
        print(argo[1])
        print(argo[1] / (argo[1][3] * 9.806))
        with open("C:\\Users\\NOOK\\Documents\\argoRho.csv", 'wt') as o:
            writer = csv.writer(o,
                                delimiter=',',
                                quotechar='"',
                                quoting=csv.QUOTE_NONE)
            for i in range(0, argo.shape[0]):
                writer.writerow([
                    str(argo[i][0]),
                    str(argo[i][1]),
                    str(argo[i][2]),
                    str(argo[i][3])
                ])
Beispiel #2
0
def regenerateDeriv(
    t,
    y,
    Twater,
    mair,
    TPair,
    Pdepth,
    dPIO,
    extend=False
):  # t - Temperature of air; y - mass of water, T water, mass air
    # dm/dT = 1/(dT/dm)
    # dT/dm = Cp_w * (T_w - T_a) dm/dt / (Cp_a * m_a)
    P = TPair / t  # cuurent constant volume pressure
    sal = 36.39
    Cp_water = sw.eos80.cp(sal, T90conv(Twater - 273.15), P / 10000)
    rho_water = sw.eos80.dens(sal, T90conv(Twater - 273.15), P / 10000)
    air.set_TP(t, P)
    Cv_air = air.Cvg
    #     print(t, P, Cp_water,rho_water,Cv_air)
    dTdm = (Twater - t) * Cp_water / (Cv_air * mair)
    if (dTdm == 0):
        dmdT = 0
    else:
        dmdT = 1.0 / dTdm
    dpumpdT = 0
    dturbinedT = 0
    dPin = P - Pdepth
    dPout = P - (Pdepth + dPIO)
    if (dPin >= 0):  # interior pressure higher; pumped input required
        dpumpdT += -dPin / rho_water * dmdT
    else:  # exterior pressure higher; input thru turbine
        dturbinedT += -dPin / rho_water * dmdT
    if (dPout >= 0):  # interior pressure higher; exhaust thru turbine
        dturbinedT += dPout / rho_water * dmdT
    else:  # exterior pressure higher; pumped output required
        dpumpdT += dPout / rho_water * dmdT
    if (extend):
        return (dmdT, dpumpdT, dturbinedT, t * dmdT, P, dPin, dPout)
    else:
        return (dmdT, dpumpdT, dturbinedT, t * dmdT)
Beispiel #3
0
def isothermalWaterUsed(TP, H, Twater, Pintake, rhoWater):
    sal = 36.39
    Cp_water = sw.eos80.cp(sal, T90conv(Twater - 273.15), TP[1] / 10000)
    dT = TP[0] - Twater
    m_water = abs(H / (Cp_water * dT))
    #     print(H, Cp_water, dT, m_water)
    dPin = TP[1] - Pintake
    pumpH = 0
    turbineH = 0
    if (dPin >= 0):  # interior pressure higher; pumped input required
        pumpH += -dPin / rhoWater * m_water
    else:  # exterior pressure higher; input thru turbine
        turbineH += -dPin / rhoWater * m_water
    return [
        m_water, pumpH, turbineH, m_water * TP[0]
    ]  # (water-mass [kg], pump-energy [J], turbine-energy [J], water-mass * mean-temperature)
Beispiel #4
0
def generateArgoData() :
    with open("C:\\Users\\NOOK\\Documents\\argo.csv", 'rt') as f:
        reader = csv.reader(f)
        fields = list(reader)
        argo = empty( (0, 9) )
        P0 = 0
        depth = 0
        for i in range(1,len(fields)) :
            P_dPa = float(fields[i][5])
            T_C = float(fields[i][6])
            psal_psu = float(fields[i][7])
            rho = sw.dens(psal_psu, T90conv(T_C), P_dPa)
            g = sw.eos80.g(-depth, 28)
            d = sw.eos80.dpth(P_dPa, 28)
            dh = d - depth
            if (dh > 0) :
                depth = d
                row = array([10000*P_dPa, T_C+273.15, psal_psu, rho, dh, depth, 0, 0, g]).reshape(1,9)
                argo = concatenate((argo, row))
                P0 = 10000*P_dPa
            
            if (depth > 1000) :
                break
    return (argo)
Beispiel #5
0
 def test_raise(self):
     with self.assertRaises(NameError):
         T90conv(self.temp, t_type='T10')
Beispiel #6
0
 def test_roundtrip(self):
     T68 = T68conv(self.temp)
     T90 = T90conv(T68, t_type='T68')
     np.testing.assert_array_almost_equal(T90, self.temp)
Beispiel #7
0
            rho = sw.dens(psal_psu, T90conv(T_C), P_dPa)
            g = sw.eos80.g(-depth, 28)
            d = sw.eos80.dpth(P_dPa, 28)
            dh = d - depth
            if (dh > 0) :
                depth = d
                row = array([10000*P_dPa, T_C+273.15, psal_psu, rho, dh, depth, 0, 0, g]).reshape(1,9)
                argo = concatenate((argo, row))
                P0 = 10000*P_dPa
            
            if (depth > 1000) :
                break
    return (argo)

def writeArgoData(argo) :
        with open("C:\\Users\\NOOK\\Documents\\argoRho.csv", 'wt') as o:
            writer = csv.writer(o, delimiter=',', quotechar='"', quoting=csv.QUOTE_NONE, lineterminator='\n')
            for i in range(0, argo.shape[0]) :
                writer.writerow([str(argo[i][0]), str(argo[i][1]), str(argo[i][2]), str(argo[i][3]),
                                 str(argo[i][4]), str(argo[i][5]), str(argo[i][6]), str(argo[i][7]), str(argo[i][8]) ])    
                

if __name__ == '__main__':
    argo = generateArgoData()
    print(argo[0,:])
    print(argo[-1,:])
    for i in range(0, argo.shape[0]) :
        argo[i,6] = sw.dens(argo[i,2], T90conv(argo[0,1]-273.15), argo[i,0]/10000)
        argo[i,7] = sw.dens(argo[i,2], T90conv(argo[-1,1]-273.15), argo[i,0]/10000)
    writeArgoData(argo)