Esempio n. 1
0
def getPSfromSigmas(
    sigmas,
    sigmaorder=default_sigmaorder,
    dummyvals=False,
    salttype='nom',
):
    """
    From the sigmas of the shape returned in getsimgas(), get a list of power
    supplies for those sigma values.
    """
    CO2s, H2s, CH4s, nATPs, k_corr, Ts, pHs = sigmas

    E = Enc(name='En',
            pH=pHs,
            CO2origin='HTHeatingSalts',
            T=Ts,
            workoutID=True)

    E = Qunc.get_salty_Enc(E, salttype)

    E.composition['CO2(aq)'].activity = E.composition['CO2(aq)'].activity.n + (
        CO2s * E.composition['CO2(aq)'].activity.s)
    E.composition['H2(aq)'].activity = E.composition['H2(aq)'].activity.n + (
        H2s * E.composition['H2(aq)'].activity.s)
    E.composition[
        'Methane(aq)'].activity = E.composition['Methane(aq)'].activity.n + (
            CH4s * E.composition['Methane(aq)'].activity.s)

    # H2O errors not supported yet
    E.composition['H2O(l)'].activity = E.composition['H2O(l)'].activity.n

    return getPS(E, nATPs, k_corr)
Esempio n. 2
0
def get_maintenances(T, pH, E=None, TOM=None, nATP=1.0):
    """
    Get the four maintenance updates at T and pH.

    This may take time to run the first time, it will be quicker if you have
    the database set up in the TOM directory. You can also contact me for a
    copy of the full database.
    """
    PT = 1
    if T < 375:
        if nATP == 1.0:
            PT = tem.MaintenanceRange_nATPs(Trange=[int(T)],
                                            mCH4=3e-8,
                                            Tlst=False,
                                            fraction=False,
                                            Perform=False,
                                            dbpath='../TOM/allMtestc')[0][0]
        elif nATP == 0.5 or nATP == 0.25:
            PT = tem.MaintenanceRange_nATPs(Trange=[int(T)],
                                            mCH4=3e-8,
                                            Tlst=False,
                                            fraction=False,
                                            Perform=False,
                                            dbpath='../TOM/allMtestc')[1][0]
            if PT < 1e-20:
                #correct up for the v low estimates at near 0C
                PT = 1e-12
        elif nATP > 1.5:
            PT = tem.MaintenanceRange_nATPs(
                Trange=[int(T)],
                mCH4=3e-8,
                Tlst=False,
                fraction=False,
                Perform=False,
                dbpath='../../NutMEG-Implementations/TOM/allMtestc')[2][0]

    # make a TOM
    if E == None or TOM == None:
        E = Enc('EncT')
        TOM = getE_TOM(E)
    # make an Enceladus
    TE = es.applications.theory_estimates(TOM, E)
    TE.loc.change_T(T)
    TE.org.get_ESynth(AA=True)
    td = TE.temperature_defenses(T)
    Ti = td['TijhuisAnaerobe']
    # L10.append(td['Lever10pc'])
    L2 = td['Lever2pc']
    return PT, Ti, L2
Esempio n. 3
0
def maintenancemesh(Trange, pHrange, nATP=1.0):
    """Get a meshgrid of maintenance powers."""

    E = Enc('EncT')
    TOM = getE_TOM(E)

    HC = np.ndarray((len(Trange), len(pHrange)))
    Ti = np.ndarray((len(Trange), len(pHrange)))
    L = np.ndarray((len(Trange), len(pHrange)))
    B = np.ndarray((len(Trange), len(pHrange)))

    yindex = 0
    for T in Trange:
        xindex = 0
        for pH in pHrange:
            MPs = get_maintenances(T, pH, E, TOM, nATP=nATP)
            HC[yindex][xindex] = MPs[0]
            Ti[yindex][xindex] = MPs[1]
            L[yindex][xindex] = MPs[2]
            B[yindex][xindex] = 1e-18

            xindex += 1
        yindex += 1
    return HC, Ti, L, B
Esempio n. 4
0
mpl.rcParams['mathtext.fontset'] = 'cm'
mpl.rcParams['xtick.labelsize'] = 14
mpl.rcParams['ytick.labelsize'] = 14
mpl.rc('axes', unicode_minus=False)
mpl.rcParams['hatch.linewidth'] = 2.0
# print(mpl.rcParams.keys()) # to see what can be changed
mpl.rcParams['font.size'] = 14

fig, axs = plt.subplots(nrows=2, ncols=1, figsize=(5, 8))

Ts = range(273, 473)  #range(273,373)
GM1, GATP1 = [], []
GM100, GATP100 = [], []

for T in range(273, 473):
    E = Enc('Enceladus', T=T, depth=0.)
    E.env.P = 1e5
    TOMobj = TOM(E, paramchange={'Basal': 1e-15, 'Tdef': 'None'})

    GM1.append(TOMobj.respiration.net_pathway.std_molar_gibbs / 1000)
    GATP1.append(TOMobj.respiration.ATP_production.std_molar_gibbs / 1000)

    E = Enc('Enceladus', T=T, depth=1.)
    E.env.P = 1e7
    TOMobj = TOM(E, paramchange={'Basal': 1e-15, 'Tdef': 'None'})

    GM100.append(TOMobj.respiration.net_pathway.std_molar_gibbs / 1000)
    GATP100.append(TOMobj.respiration.ATP_production.std_molar_gibbs / 1000)

axs[0].set_title('Methanogenesis')
axs[0].plot(Ts, GM1, color='b', label='1 bar')
Esempio n. 5
0
def getEncEnergetics(
        ocean_pH=8.,
        T=273.15,
        nATP=1.0,
        k_corr=0.,
        CO2origin='pH',  # change to HTHeating later
        output=gEE_default_output,
        quotienttype='salty_endmember'):
    """
    Get the requested parameters in output at the selected parameters of
    ocean_pH, T, nATP, and k_corr.
    """

    outputbools = boolify_output(output)
    outputdict = {}

    E = Enc(name='En', pH=ocean_pH, CO2origin=CO2origin, T=T, workoutID=False)

    if outputbools['Composition']:
        _concs = {}
        for species, rx in E.composition.items():
            _concs[species] = np.array([[
                rx.activity.n, rx.activity.n + rx.activity.s,
                rx.activity.n - rx.activity.s
            ]])
        outputdict['Composition'] = _concs

    if outputbools['CO2Tiger']:
        CO2T = E.get_tigerstripe_CO2(logform=True)
        CO2Tiger = 10**CO2T.n
        CO2Tiger_up = 10**(CO2T.n + CO2T.s)
        CO2Tiger_down = 10**(CO2T.n - CO2T.s)
        outputdict['CO2Tiger'] = np.array(
            [[CO2Tiger, CO2Tiger_do, CO2Tiger_up]])

    if outputbools['Gibbs_Methanogenesis'] or outputbools[
            'PowerSupply'] or outputbools['ATPGibbs'] or outputbools[
                'max_k'] or outputbools['Quotient']:

        # need to do the energetic calculations. This is outsourced to the
        # QuotientUncertainties class.

        Qdict = {}  # dictionary outputs from Qunc

        if quotienttype == 'allunc':
            Qdict = Qunc.Q_allunc(E, nATP, k_corr)
        elif quotienttype == 'salty_endmember':
            Qdict = Qunc.Q_salty_endmember(E, nATP, k_corr)
        elif quotienttype == 'salty_nominal':
            Qdict = Qunc.Q_salty(E, nATP, k_corr, 'nom')
        elif quotienttype == 'salty_high':
            Qdict = Qunc.Q_salty(E, nATP, k_corr, 'high')
        elif quotienttype == 'salty_low':
            Qdict = Qunc.Q_salty(E, nATP, k_corr, 'low')
        else:
            raise ValueError(
                'unrecognised quotienttype, how do you want to consider salt effects?'
            )

        if outputbools['Gibbs_Methanogenesis']:
            outputdict['Gibbs_Methanogenesis'] = Qdict['Gibbs_Methanogenesis']
        if outputbools['Quotient']:
            outputdict['Quotient'] = Qdict['Quotient']
        if outputbools['PowerSupply']:
            outputdict['PowerSupply'] = Qdict['PowerSupply']
        if outputbools['ATPGibbs']:
            outputdict['ATPGibbs'] = Qdict['ATPGibbs']
        if outputbools['max_k']:
            outputdict['max_k'] = Qdict['max_k']

    return outputdict
    R.composition['H2(aq)'].activity = VenusDrop.getgasconc('H2(aq)', 0.8*R.env.P,
      R.env.T, P_bar=R.env.P)
    R.composition['CO2(aq)'].activity = VenusDrop.getgasconc('CO2(aq)', 0.2*R.env.P,
      R.env.T, P_bar=R.env.P)
    return R



Ts=range(273,373)
ks, kTs, met = [],[], []
kTs30, kTs10 = [], []
CO2_30, CO2_10, CO2_18, CO2_500 = [],[],[],[]
H2_30, H2_10, H2_18, H2_500 = [],[],[],[]

for T in Ts:
    E = Enc('Enceladus', T=T, nominals=True)
    E.env.P=182000
    E = concupdate(E)
    TOMobj = TOM(E, paramchange={'Basal':1e-15, 'Tdef':'None'}, fromdata=False)

    ks.append( TOMobj.respiration.net_pathway.rate_constant_RTP)
    met.append(TOMobj.max_metabolic_rate)
    kTs.append(TOMobj.respiration.net_pathway.rate_constant_env)
    for r, mr in TOMobj.respiration.net_pathway.reactants.items():
        if r.name=='CO2(aq)':
            CO2_18.append(r.activity)
        elif r.name=='H2(aq)':
            H2_18.append(r.activity)

    E.env.P = 300000
    E = concupdate(E)
mpl.rcParams['xtick.labelsize'] = 14
mpl.rcParams['ytick.labelsize'] = 14
mpl.rcParams['lines.linewidth'] = 3

mpl.rc('axes', unicode_minus=False)
mpl.rcParams['hatch.linewidth'] = 2.0
# print(mpl.rcParams.keys()) # to see what can be changed
mpl.rcParams['font.size'] = 14

fig, axs = plt.subplots(nrows=1, ncols=1, figsize=(5, 5))

Ts = range(273, 473)
GATP, worseGATP, minGATP, betterGATP, maxGATP = [], [], [], [], []

for T in Ts:
    E = Enc('Enceladus', T=T, depth=0)
    TOMobj = TOM(E, paramchange={'Basal': 1e-15, 'Tdef': 'None'})

    GATP.append(TOMobj.respiration.G_P / 1000)

    # TOMobj.respiration.build_ATP_reaction([0.0002, 0.004, 0.0056, 7.])#[0.00001,0.0004,0.05,7.])

    worseGATP.append(TOMobj.respiration.G_P * 0.5 / 1000)
    minGATP.append(TOMobj.respiration.G_P * 0.25 / 1000)

    # TOMobj.respiration.build_ATP_reaction([0.002,0.022,0.0007,7.])#[0.001,0.04,0.0005,7.])
    betterGATP.append(TOMobj.respiration.G_P * 1.5 / 1000)
    maxGATP.append(TOMobj.respiration.G_P * 2.0 / 1000)

axs.set_title('ATP Production')