Пример #1
0
    def simulation_pair(ps, initial_aerosols, V, T0, S0, P0,
                        z_top, dt, max_steps):
        from parcel_model.parcel import AerosolSpecies, ParcelModel, ParcelModelError
        from parcel_model.lognorm import Lognorm
        from parcel_model.micro import activate_ARG, act_fraction
        import numpy as np
        import random
        import os

        try:
            alpha, gamma, V = ps

            fact = z_top/30.
            zs = np.linspace(0, z_top, 100001*fact)
            ts = zs/V

            #print "I would've run with parameters alpha %0.2f and cbv %0.2f" % ps
            pm = ParcelModel(initial_aerosols, V, T0, S0, P0)
            parcel_out, aerosol_out = pm.run(z_top, dt=dt, max_steps=max_steps)
            #run_results = (parcel_out, aerosol_out)
            aerosols = pm.aerosols
        except ParcelModelError, e:
            #results.append((ps, None))
            return None
Пример #2
0
        print iter_count, "%r %r %r" % (Smax, CondenRate, alpha*V/gamma)
        DropletNum = np.sum(Num[WetDp_large])
        ActDp = 0.0
        for i in xrange(1, len(WetDp)):
            if (WetDp[i] > Dpc[i]) and (WetDp[i-1] < Dpc[i]):
                ActDp = DryDp[i]

        ## Iteration logic
        if CondenRate < (alpha*V/gamma):
            Smax1 = Smax*1.0
        else:
            Smax2 = Smax*1.0

        iter_count += 1
        #if iter_count == 9: break

    print "---"*20

    print "    FN2", activate_FN2(V, T, P, initial_aerosols)[0]
    print "   MING", (Smax-1.0)
    print "    ARG", activate_ARG(V, T, P, initial_aerosols)[0]

    parcel = False
    if parcel:
        from parcel_model.parcel import ParcelModel
        pm = ParcelModel(initial_aerosols, V, T0, S0, P0, console=False)
        parcel, aerosols = pm.run(100.0, 0.001)
        print " PARCEL", parcel.S.max()