コード例 #1
0
def doffwrfin(xi, qeq):
    ra = b.rafun()
    rin = ra * xi
    oin, hin, tauin, hrmax, mdotin, wrfin = rastr(xi, qeq)
    omegaBC = b.oin(rin, hin, mdotin)
    wrfBC = b.fwrfin(rin, hin, mdotin)
    print "oin-omegaBC " + str(oin -
                               omegaBC) + " wrfin-wrfBC " + str(wrfin -
                                                                wrfBC) + '\n'
    #   tauBC, hBC, omegaBC, wrfBC = b.tausolve(xi, mdotin)
    #    print 'eta = '+str(eta)
    return oin - omegaBC, wrfin - wrfBC
コード例 #2
0
def rmesh_qeq(newmu, newmdot, newps):

    b.parset(newmu=newmu,
             newmdot=mdotglobal,
             newps=newps,
             neweta=0.,
             newalpha=0.1)
    d.parset(newmu=newmu,
             newmdot=mdotglobal,
             newps=newps,
             neweta=0.,
             newalpha=0.1)

    qeqmin = 0.85
    qeqmax = 0.95
    nr = 30

    qeq = (qeqmax - qeqmin) * arange(nr) / double(nr - 1) + qeqmin

    ocalc = np.zeros(nr, dtype=double)
    obc = np.zeros(nr, dtype=double)
    hcalc = np.zeros(nr, dtype=double)
    bmax = np.zeros(nr, dtype=double)
    hbc = np.zeros(nr, dtype=double)
    tcalc = np.zeros(nr, dtype=double)
    tbc = np.zeros(nr, dtype=double)
    so = np.zeros(nr, dtype=double)
    st = np.zeros(nr, dtype=double)
    sh = np.zeros(nr, dtype=double)
    smdot = np.zeros(nr, dtype=double)

    t = 1
    k1 = -0.1

    f = open('q' + str(t) + '.txt', 'w')

    for k in arange(nr):
        xi, tc = d.ordiv(newmu, newmdot, newps, 0.0, qeq[k])
        #      tc=ordiv_tc(newmu, newmdot, newps,0.,qeq,xi)
        print "xi= " + str(xi) + '\n'
        print "qeq= " + str(qeq[k]) + '\n'
        rin = xi * b.rafun()
        oo, hh, tt, hrmax, mdotin, ww = d.rastr(xi, qeq[k], tc)
        oin = b.oin(rin, hh, mdotin)
        hin = b.fhin(rin, tt, mdotin)
        wrfin = b.fwrfin(rin, hh, mdotin)
        ocalc[k] = oo
        hcalc[k] = hh
        tcalc[k] = ww
        obc[k] = oin
        hbc[k] = hin
        tbc[k] = wrfin
        so[k] = sign(oo - oin)
        st[k] = sign(tt - tt)
        sh[k] = sign(hin - hh)
        smdot[k] = mdotin
        f.write(
            str(qeq[k]) + ' ' + str(xi) + ' ' + str(oo) + ' ' + str(oin) +
            ' ' + str(hh) + ' ' + str(hin) + ' ' + str(ww) + ' ' + str(wrfin) +
            ' ' + str(mdotin) + '\n')

    f.close()

    plt.clf()
    plot(qeq, smdot, color='k')
    ylabel('$\dot m$')
    xlabel('$qeq$')
    savefig('mdot' + str(t) + '.eps')

    plt.clf()
    plot(qeq, ocalc, color='k')
    plot(qeq, obc, color='r')
    ylabel('$\omega$')
    xlabel('$qeq$')
    ylim(0.1, 1.5)
    savefig('oos' + str(t) + '.eps')

    plt.clf()
    plot(qeq, hcalc, color='k')
    plot(qeq, hbc, color='r')
    ylabel('$h$')
    xlabel('$qeq$')
    yscale('log')
    savefig('h' + str(t) + '.eps')

    plt.clf()
    plot(qeq, tcalc, color='k')
    plot(qeq, tbc, color='r')
    ylabel('$wrf$')
    xlabel('$qeq$')
    yscale('log')
    savefig('wrf' + str(t) + '.eps')
コード例 #3
0
def rmesh(newmu, newmdot, newps):

    b.parset(newmu=newmu,
             newmdot=mdotglobal,
             newp=newps,
             neweta=0.,
             newalpha=0.1)
    d.parset(newmu=newmu,
             newmdot=mdotglobal,
             newp=newps,
             neweta=0.,
             newalpha=0.1)

    qeqmin = 0.1
    qeqmax = 1.
    nr = 10
    pr = 10.
    ximin = 0.1
    ximax = 1.5
    tcmin = 0.01
    tcmax = 2.

    #    qeq=(qeqmax-qeqmin)*arange(nr)/double(nr-1)+qeqmin
    #   xi=(ximax-ximin)*arange(nr)/double(nr-1)+ximin
    #    tc=(tcmax-tcmin)*arange(nr)/double(nr-1)+tcmin

    ocalc = np.zeros([nr, nr, nr], dtype=double)
    obc = np.zeros([nr, nr, nr], dtype=double)
    hcalc = np.zeros([nr, nr, nr], dtype=double)
    bmax = np.zeros([nr, nr, nr], dtype=double)
    hbc = np.zeros([nr, nr, nr], dtype=double)
    tcalc = np.zeros([nr, nr, nr], dtype=double)
    tbc = np.zeros([nr, nr, nr], dtype=double)
    so = np.zeros([nr, nr, nr], dtype=double)
    st = np.zeros([nr, nr, nr], dtype=double)
    sh = np.zeros([nr, nr, nr], dtype=double)
    smdot = np.zeros([nr, nr, nr], dtype=double)

    t = 1
    k1 = -0.1

    f = open('q' + str(t) + '.txt', 'w')

    xi = ximin
    tc = tcmin
    qeq = qeqmin
    i = 0

    for k in arange(nr):
        xi = xi + (ximax - ximin) / pr
        tc = tcmin
        for w in arange(nr):
            tc = tc + (tcmax - tcmin) / pr
            qeq = qeqmin
            for q in arange(nr):
                qeq = qeq + (qeqmax - qeqmin) / pr
                print 'qeq= ' + str(qeq) + ' tc= ' + str(tc) + ' xi= ' + str(
                    xi) + '\n'
                rin = xi * b.rafun()
                oo, hh, tt, hrmax, mdotin, ww = d.rastr(xi, qeq, tc)
                oin = b.oin(rin, hh, mdotin)
                hin = b.fhin(rin, tt, mdotin)
                wrfin = b.fwrfin(rin, hh, mdotin)
                ocalc[k, w, q] = oo
                hcalc[k, w, q] = hh
                tcalc[k, w, q] = ww
                obc[k, w, q] = oin
                hbc[k, w, q] = hin
                tbc[k, w, q] = wrfin
                so[k, w, q] = oo - oin
                st[k, w, q] = ww - wrfin
                sh[k, w, q] = -hin + hh
                smdot[k, w, q] = mdotin
                print i
                i += 1
                f.write(
                    str(qeq) + ' ' + str(xi) + ' ' + str(tc) + ' ' + str(oo) +
                    ' ' + str(oin) + ' ' + str(hh) + ' ' + str(hin) + ' ' +
                    str(ww) + ' ' + str(wrfin) + ' ' + str(mdotin) + ' ' +
                    str(oo - oin) + ' ' + str(ww - wrfin) + ' ' +
                    str(hh - hin) + '\n')

    f.close()
コード例 #4
0
def rastr1(rrin, qeq, newmu=d.mu, newmdot=mdotglobal, newps=ps):

    b.parset(newmu=newmu,
             newmdot=newmdot,
             newps=newps,
             neweta=0.0,
             newalpha=0.1)
    d.parset(newmu=newmu,
             newmdot=newmdot,
             newps=newps,
             neweta=0.0,
             newalpha=0.1)

    ra = b.rafun()
    rin = ra * rrin
    #    print rin
    #    kok=raw_input()
    t = 1
    rout = 100. * rin
    ddr = -3.e-5
    mdot = d.mdotglobal
    mu = d.mu
    print "rastr1: mdot= " + str(mdot) + " mu= " + str(mu) + " \n"
    #    huh=raw_input()

    if (mdot < 1.5):
        ddr *= (mdot / 1.5)
    ddr /= (1. + 0.1 * (b.peq() / ps))
    defac = 0.99

    r = rout
    omega = 1.
    drout = 1e-2
    rlast = rout
    oprev = omega
    rprev = r

    rl = []
    ol = []
    tl = []
    hl = []
    bb = []
    taussa = []
    taussb = []
    hssa = []
    hssb = []
    dt = []
    do = []
    dw = []
    dta = []
    mdot123 = []
    P1m = []
    P3m = []
    qqra = []
    qqad = []
    qqpl = []
    wwrf = []
    ttc = []

    htormax = 0.
    #    mdot=mdotglobal
    wrf = 2. * mdot / r**2 * omega * (sqrt(r) - qeq * sqrt(rin))
    tau = 4. / chi**0.8 * (pi /
                           9.)**0.2 * mdot**0.6 / alpha**0.8 / rout**0.6 * (
                               1. - qeq * (rin / rout)**0.5)**0.6
    #   tau=ftau(wrf,r,tc)
    h = hvert * sqrt(r**3 * wrf / alpha / tau)
    tc = b.ctemp(h, wrf, tau)
    #    print h/r
    hprev = h
    wprev = wrf
    tauprev = tau

    f = open('rastr_new_1.txt', 'w')

    while (r >= rin):
        dr = ddr * (r - rin * defac)
        r1 = r + dr / 2.
        #        print r/rin

        h = hvert * sqrt(r**3 * wrf / alpha / tau)
        #        print h/r

        if (isnan(tau)):
            print "tausolve resulted in NaN"
            return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(
                -1.)
        omega1 = omega + domega(omega, r, tau, mdot, wrf, tc) * dr / 2.
        wrf1 = wrf + dwrf(tau, omega, r) * dr / 2.
        tau1 = tau + dtau(tau, tc, wrf, r, omega, mdot) * dr / 2.
        tc1 = tc + dtemp(tau, tc, wrf, r, omega, mdot) * dr / 2.

        beta1 = beta(tau1, tc1, wrf1)

        #        if((r*r)>(9.*tau1/(4.*64.*pi*tc**4.))):
        if (r < h):
            mdot1 = mdot + dmdot(r, tc, tau) * dr / 2.
        else:
            mdot1 = mdot

        if (wrf1 <= 0.):
            print "negative stress! wrf = " + str(wrf1)
            return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(
                -1.)

        h1 = hvert * sqrt(r1**3 * wrf1 / alpha / tau1)

        if (isnan(tau1)):
            print "tausolve resulted in NaN"
            return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(
                -1.)
        omega = omega + domega(omega1, r1, tau1, mdot1, wrf1, tc1) * dr
        wrf = wrf + dwrf(tau1, omega1, r1) * dr
        tc = tc + dtemp(tau1, tc1, wrf1, r1, omega1, mdot1) * dr

        tau = tau + dtau(tau1, tc1, wrf1, r1, omega1, mdot1) * dr

        P4 = 2. / 3.
        P3 = 1.77526e-5 * alpha * tc1 * tau1 / wrf1
        P1 = 56329.9 * h1 * h1 / tc1 * r1**(-3.)

        #       Qrad=128./9.*tc1**4./tau1

        bet = beta(tau1, tc1, wrf1)

        Stau = Scal(bet)
        Swrf = Pcal(bet)
        Stemp = Qcal(bet)

        part1 = Stau / tau1 * dtau(tau1, tc1, wrf1, r1, omega1, mdot1)
        part2 = Swrf / wrf1 * dwrf(tau1, omega1, r1)
        part3 = Stemp / tc1 * dtemp(tau1, tc1, wrf1, r1, omega1, mdot1)
        part4 = 3. / r * Swrf

        Qrad = -16. / 3. * G(n) * (n + 1.) * tc1**4. * 4. * pi / (tau1)

        Qadv = 2. / (G(n + 1.)) * mdot1 * wrf1 / (alpha * r1 * tau1) * (
            part1 + part2 + part3 + part4)

        Qplus = wrf1 * r1**(-1. / 2.) * (
            domega(omega1, r1, tau1, mdot1, wrf1, tc1) - 3. / 2. * omega1 / r1)

        r += dr

        #       if((r*r)>(9.*tau1/(4.*64.*pi*tc**4.))):
        if (r < h1):
            mdot = mdot + dmdot(r1, tc1, tau1) * dr

        if ((h / r) > htormax):
            htormax = h / r
            rmax = r
        if (r < (rlast / (1. + drout))):
            ttc.append(tc)
            qqra.append(Qrad)
            wwrf.append(wrf)
            qqpl.append(Qplus)
            qqad.append(Qadv)
            P1m.append(P1)
            P3m.append(P3)
            rl.append(r / rin)
            ol.append(omega)
            tl.append(tau)
            hl.append(h / r)
            dt.append(abs(dtemp(tau1, tc1, wrf1, r1, omega1, mdot1)) / tc1)
            do.append(abs(domega(omega1, r1, tau1, mdot1, wrf1, tc1)))
            dw.append(abs(dwrf(tau1, omega1, r1)) / wrf1)
            dta.append(abs(dtau(tau1, tc1, wrf1, r1, omega1, mdot1)) / tau1)
            bb.append(beta1)
            rlast = r
            taussa.append(ss.ftaussa(r, mdot, alpha, rin))
            taussb.append(ss.ftaussb(r, mdot, alpha, rin))
            hssa.append(ss.hssa(mdot, r, rin))
            hssb.append(ss.hssb(r, mdot, alpha, rin))
            mdot123.append(mdot)
            f.write(
                str(r / rin) + ' ' + str(omega) + ' ' + str(h / r) + ' ' +
                str(tau) + ' ' + str(tc) + ' ' + str(wrf) + ' ' +
                str(ss.ftaussa(r, mdot, alpha, rin)) + ' ' +
                str(ss.ftaussb(r, mdot, alpha, rin)) + ' ' + str(Qadv) + ' ' +
                str(Qrad) + ' ' + str(Qplus) + ' ' +
                str(ss.hssa(mdot, r, rin)) + ' ' +
                str(ss.hssb(r, mdot, alpha, rin)) + ' ' + str(mdot) + '\n')

    mdotin = mdot
    tauin = tau
    #    print "tau= "+str(tauin)+'\n'
    #    print mdotin
    #    jjoij=raw_input()
    wrfin = wrf
    #    print wrfin
    #    jjoij=raw_input()
    f.close()

    tcar = asarray(ttc, dtype=double)
    qplus = asarray(qqpl, dtype=double)
    wrfar = asarray(wwrf, dtype=double)
    qadv = asarray(qqad, dtype=double)
    qrad = asarray(qqra, dtype=double)
    p1ar = asarray(P1m, dtype=double)
    p3ar = asarray(P3m, dtype=double)
    rar = asarray(rl, dtype=double)
    oar = asarray(ol, dtype=double)
    tauar = asarray(tl, dtype=double)
    har = asarray(hl, dtype=double)
    taua = asarray(taussa, dtype=double)
    taub = asarray(taussb, dtype=double)
    hrssa = asarray(hssa, dtype=double)
    hrssb = asarray(hssb, dtype=double)
    mdar = asarray(mdot123, dtype=double)
    dtem = asarray(dt, dtype=double)
    dome = asarray(do, dtype=double)
    dwr = asarray(dw, dtype=double)
    dtaau = asarray(dta, dtype=double)
    bbeta = asarray(bb, dtype=double)

    oint = (omega - oprev) * (rin - rprev) / (r - rprev) + oprev
    hint = (h - hprev) * (rin - rprev) / (r - rprev) + hprev
    tint = (tau - tauprev) * (rin - rprev) / (r - rprev) + tauprev
    wint = (wrf - wprev) * (rin - rprev) / (r - rprev) + wprev

    pp = 1. / 4. * (n + 1.) * G(n)

    plt.clf()
    fig = figure()
    plt.subplot(3, 3, 1)
    plot(rar * rin * rrin * 206746., p1ar, color='black', label='P1')
    plot(rar * rin * rrin * 206746., p3ar, color='green', label='P3')
    plot(rar * rin * rrin * 206746.,
         p1ar * 0. + 2. / 3.,
         color='red',
         label='P2')
    plot(rar * rin * rrin * 206746., p3ar * 0. + pp, color='blue', label='P4')
    ylim(0., 7.)
    ylabel('$P1,2,3,4$')
    xlabel('$r$')
    legend()
    #    yscale('log')
    #    xscale('log')

    plt.subplot(3, 3, 2)
    plot(rar * rin * rrin * 206746.,
         qadv / qplus,
         color='red',
         label='Qadv/Qvis')
    plot(rar * rin * rrin * 206746.,
         qrad / qplus,
         color='green',
         label='Qrad/Qvis')
    #   xlim(0.01,5.e10)
    ylabel('flux ratios')
    xlabel('$r$')
    #    yscale('log')
    xscale('log')
    legend()

    plt.subplot(3, 3, 3)
    plot(rar * rin * rrin * 206746., taua, color='blue', label='rad')
    plot(rar * rin * rrin * 206746., taub, color='green', label='gas')
    plot(rar * rin * rrin * 206746., tauar, color='red', label='calc')
    ylabel(r'$\tau$')
    xlabel('$r$')
    yscale('log')
    xscale('log')
    legend()

    plt.subplot(3, 3, 4)
    plot(rar * rin * rrin * 206746., har, color='red', label='calc')
    plot(rar * rin * rrin * 206746.,
         hrssa / rar / rin,
         color='blue',
         label='rad')
    plot(rar * rin * rrin * 206746.,
         hrssb / rar / rin,
         color='green',
         label='gas')
    ylabel('$h/r$')
    xlabel('$r$')
    xscale('log')
    yscale('log')
    legend()

    plt.subplot(3, 3, 5)
    plot(rar * rin * rrin * 206746., wrfar * 2.56787e+21, color='red')
    ylabel(r'$W_{rf}$')
    xlabel('$r$')
    xscale('log')
    yscale('log')

    plt.subplot(3, 3, 6)
    plot(rar * rin * rrin * 206746., mdar / mdotglobal, color='red')
    ylabel(r'$\dot M/\dot M_{0}$')
    xlabel('$r$')
    xscale('log')
    #    yscale('log')

    plt.subplot(3, 3, 7)
    plot(rar * rin * rrin * 206746., oar, color='red')
    ylabel(r'$\Omega/\Omega_{\rm K}$')
    xlabel('$r$')
    xscale('log')
    #    yscale('log')

    plt.subplot(3, 3, 8)
    plot(rar * rin * rrin * 206746., tcar * 9.6e7, color='red')
    ylabel(r'$T_{c}$')
    xlabel('$r$')
    xscale('log')
    yscale('log')
    fig.set_size_inches(15, 15)
    savefig('all.eps')

    plt.clf()
    plot(rar, fabs(qadv / qplus), color='blue')
    ylabel('$Qadv/Qplus$')
    xlabel('$r/rin$')
    #   ylim(0.,10.)
    yscale('log')
    xscale('log')
    savefig('Qadv.eps')

    plt.clf()
    plot(rar, qrad / qplus, color='green')
    ylabel('$Qrad/Qplus$')
    xlabel('$r/rin$')
    #   yscale('log')
    xscale('log')
    savefig('Qrad.eps')

    plt.clf()
    plot(rar, qrad / qplus, color='green', label='Qrad/Qplus')
    plot(rar, qadv / qplus, color='red', label='Qadv/Qplus')
    ylabel('$Q/Qplus$')
    xlabel('$r/rin$')
    #   yscale('log')
    xscale('log')
    legend()
    savefig('Q.eps')

    plt.clf()
    plot(rar, p1ar, color='blue', label='P1')
    plot(rar, p3ar, color='green', label='P3')
    ylabel('$P$')
    xlabel('$r/rin$')
    ylim(0., 10.)
    legend()
    #   yscale('log')
    #    xscale('log')
    savefig('P.eps')

    plt.clf()
    plot(rar, p1ar, color='blue', label='P1')
    plot(rar, p3ar, color='green', label='P3')
    ylabel('$P$')
    xlabel('$r/rin$')
    yscale('log')
    xscale('log')
    legend()
    savefig('Plog.eps')

    plt.clf()
    plot(bbeta, p1ar, color='blue')
    plot(bbeta, p3ar, color='green')
    ylabel('$P$')
    xlabel('$r/rin$')
    ylim(0., 10.)

    #   yscale('log')
    #    xscale('log')
    savefig('P_beta.eps')

    plt.clf()
    plot(rar, taua, color='blue')
    plot(rar, taub, color='green')
    plot(rar, tauar, linestyle='dotted', color='red')
    plot([rin / rin], [tint], 'o')
    ylabel(r'$\tau$')
    xlabel('$r/rin$')
    yscale('log')
    xscale('log')
    savefig('tau.eps')

    plt.clf()
    plot(rar, oar, color='k')
    plot([rin / rin], [oint], 'o')
    ylabel(r'$\omega$')
    xlabel('$r/rin$')
    xscale('log')
    savefig('omega.eps')

    plt.clf()
    plot(rar, har, linestyle='dotted', color='red')
    plot(rar, hrssa / rar / rin, color='blue')
    plot(rar, hrssb / rar / rin, color='green')
    plot([rin / rin], [hint / rin], 'o')
    ylabel('$h/r$')
    xlabel('$r/rin$')
    xscale('log')
    yscale('log')
    savefig('har.eps')

    plt.clf()
    plot(rar, mdar, color='k')
    ylabel(r'$\dot{m}$')
    xlabel('$r/rin$')
    xscale('log')
    yscale('log')
    savefig('mdot.eps')

    if (isnan(omega) | (r > rin)):
        return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.)
    h_in = b.fhin(rin, tau, mdotin)
    #    print h_in
    #    jjoij=raw_input()
    omega_in = b.oin(rin, hint, mdotin)
    #    print omega_in
    #    jjoij=raw_input()
    wrf_in = b.fwrfin(rin, hint, mdotin)
    #    print wrf_in
    #    jjoij=raw_input()

    print "rastr1: omega = " + str(omega) + "; h = " + str(
        h) + "; htormax = " + str(htormax) + "; mdotin = " + str(
            mdot) + "; wrf = " + str(wrf) + "\n"
    print "rastr1: omega_in = " + str(omega_in) + "; h_in = " + str(
        h_in) + " ; wrf_in = " + str(wrf) + "\n"
    print "mdoyin= " + str(mdotin) + ' \n'
    huh = raw_input()
    return rar * rin, tauar
コード例 #5
0
def rastr(rrin, qeq):
    # rrin = xi, the inner disc radius in rA units, qeq

    ra = b.rafun()
    rin = ra * rrin
    t = 1
    rout = routfactor * rin
    print "rastr: rout = " + str(routfactor) + " rin"
    ddr = -1.e-4
    mdot = mdotglobal

    #    ps=10.*peqgen(mu,mdot)

    print "rastr_mdotglobal= " + str(mdotglobal) + '\n'
    print "rastr_mu= " + str(mu) + '\n'

    if (mdot < 1.5):
        ddr *= (mdot / 1.5)
    ddr /= (1. + 0.5 * (b.peq() / ps))
    #    defac=0.99

    r = rout
    omega = 1.
    oprev = omega
    rprev = r

    htormax = 0.
    wrf = 2. * mdot / r**2 * omega * (sqrt(r) - qeq * sqrt(rin))
    wprev = wrf
    #    tc=0.00486297109754*tcqeq
    tau = 4. / chi**0.8 * (pi /
                           9.)**0.2 * mdot**0.6 / alpha**0.8 / rout**0.6 * (
                               1. - qeq * (rin / rout)**0.5)**0.6
    print "n=" + str(n)
    h = hvert * sqrt(r**3 * wrf / alpha / tau)
    tc = b.ctemp(h, wrf, tau)
    print "Tc=" + str(tc)
    #    tc=(2.*n+3.)/2./(n+1.)*wrf/chi/alpha/tau
    #    print "Tc="+str(tc)
    #    rr=raw_input("k")
    # tau=ftau(wrf,r,tc)
    hprev = h
    tauprev = tau
    tprev = tc

    while (r >= rin):
        dr = ddr * (r - rin * defac)
        r1 = r + dr / 2.
        h = hvert * sqrt(r**3 * wrf / alpha / tau)

        if (isnan(tau)):
            print "tausolve resulted in NaN"
            return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(
                -1.)
        omega1 = omega + domega(omega, r, tau, mdot, wrf, tc) * dr / 2.
        wrf1 = wrf + dwrf(tau, omega, r) * dr / 2.
        tau1 = tau + dtau(tau, tc, wrf, r, omega, mdot) * dr / 2.
        tc1 = tc + dtemp(tau, tc, wrf, r, omega, mdot) * dr / 2.
        beta1 = beta(tau1, tc1, wrf1)

        #       if((r*r)>(9.*tau/(4.*64.*pi*tc**4.))):
        if (r < h):
            mdot1 = mdot + dmdot(r, tc, tau) * dr / 2.
        else:
            mdot1 = mdot

        if (wrf1 <= 0.):
            print "negative stress! wrf = " + str(wrf1)
            return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(
                -1.)

#        h1=fh(wrf1,r1,tc1)
        h1 = hvert * sqrt(r1**3 * wrf1 / alpha / tau1)

        if (isnan(tau1)):
            print "tausolve resulted in NaN"
            return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(
                -1.)
        oprev = omega
        omega = omega + domega(omega1, r1, tau1, mdot1, wrf1, tc1) * dr
        wprev = wrf
        wrf = wrf + dwrf(tau1, omega1, r1) * dr
        tcprev = tc
        tc = tc + dtemp(tau1, tc1, wrf1, r1, omega1, mdot1) * dr
        #       tau=ftau(wrf,r,tc)
        tauprev = tau
        tau = tau + dtau(tau1, tc1, wrf1, r1, omega1, mdot1) * dr

        hprev = h
        ##        h=fh(wrf,r,tc)
        #       if((r1*r1)>(9.*tau1/(4.*64.*pi*tc1**4.))):
        if (r < h1):
            mdot = mdot + dmdot(r1, tc1, tau1) * dr
        rprev = r
        r += dr

        if ((h / r) > htormax):
            htormax = h / r
            rmax = r
    mdotin = mdot
    wrfin = wrf

    if (isnan(omega) | (r > rin)):
        return sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.), sqrt(-1.)
    oint = (omega - oprev) * (rin - rprev) / (r - rprev) + oprev
    hint = (h - hprev) * (rin - rprev) / (r - rprev) + hprev
    tint = (tau - tauprev) * (rin - rprev) / (r - rprev) + tauprev
    wint = (wrf - wprev) * (rin - rprev) / (r - rprev) + wprev

    omega_in = b.oin(rin, hint, mdotin)
    wrf_in = b.fwrfin(rin, hint, mdotin)
    #    print "rastr: omega = "+str(omega)+"; h = "+str(h)+"; htormax = "+str(htormax)+"; mdotin = "+str(mdot)+"; wrf = "+str(wrf)+"\n"
    #    print "rastr: omega_in = "+str(omega_in)+"; h_in = "+str(hint)+" ; wrf_in = "+str(wrf)+"\n"
    print str(oint) + ' ' + str(hint) + ' ' + str(tint) + ' ' + str(
        htormax) + ' ' + str(mdotin) + ' ' + str(wint) + '\n'
    return oint, hint, tint, htormax, mdotin, wint