Exemplo n.º 1
0
    def _tc(self, rho, T, fase):
        """Custom method for critical enhancement"""

        Tr = T / 304.1282
        rhor = rho / 467.6
        nc = 0.775547504

        # Table 4
        a = [
            0, 3, 6.70697, 0.94604, 0.3, 0.3, 0.39751, 0.33791, 0.77963,
            0.79857, 0.9, 0.02, 0.2
        ]

        # Eq 6
        alfa = 1 - a[10] * arccosh(1 + a[11] * ((1 - Tr)**2)**a[12])

        # Eq 5
        num = rhor * exp(-rhor**a[1] / a[1] - (a[2] * (Tr - 1))**2 -
                         (a[3] * (rhor - 1))**2)
        den1 = pow(
            pow(1 - 1 / Tr + a[4] * pow(pow(rhor - 1, 2), 0.5 / a[5]), 2),
            a[6])
        den2 = pow(pow(a[7] * (rhor - alfa), 2), a[8])
        lc = num / (den1 + den2)**a[9]

        return lc * nc * 4.81384e-3
Exemplo n.º 2
0
def Rz_to_uv(R,z,delta=1.):
    """
    NAME:

       Rz_to_uv

    PURPOSE:

       calculate prolate confocal u and v coordinates from R,z, and delta

    INPUT:

       R - radius

       z - height

       delta= focus

    OUTPUT:

       (u,v)

    HISTORY:

       2012-11-27 - Written - Bovy (IAS)

    """
    coshu, cosv= Rz_to_coshucosv(R,z,delta)
    u= sc.arccosh(coshu)
    v= sc.arccos(cosv)
    return (u,v)
Exemplo n.º 3
0
def get_bulk_Delta(omega_D, Delta_0, T0, initial_guess=None):
    oomega_D = omega_D
    Delta_0 *= 1000/omega_D
    T0 *= 1000/omega_D
    omega_D = 1000

    T0 += 1e-15

    if not initial_guess:
        initial_guess = Delta_0
    
    c = 1/S.arccosh(omega_D / Delta_0)

    def func(z):
        Delta = z[0]
        def integrand(E):
            return Delta*S.tanh(.5*E/T0) / S.sqrt(E**2 - Delta**2 + 1e-9)
        r = S.integrate.quad(integrand, Delta, omega_D,
                             epsrel=1e-5, epsabs=1e-5*Delta/c + 1e-8)
        x = r[0] - Delta/c
        if abs(x) < 1e-40: return 0
        return x

    z = S.optimize.fsolve(func, initial_guess, xtol=1e-4) * oomega_D/1000
    return abs(z)
Exemplo n.º 4
0
    def _tc(self, rho, T, fase):
        """Custom method for critical enhancement"""

        Tr = T/304.1282
        rhor = rho/467.6
        nc = 0.775547504

        # Table 4
        a = [0, 3, 6.70697, 0.94604, 0.3, 0.3, 0.39751, 0.33791, 0.77963,
             0.79857, 0.9, 0.02, 0.2]

        # Eq 6
        alfa = 1-a[10]*arccosh(1+a[11]*((1-Tr)**2)**a[12])

        # Eq 5
        num = rhor*exp(-rhor**a[1]/a[1]-(a[2]*(Tr-1))**2-(a[3]*(rhor-1))**2)
        den1 = pow(pow(1-1/Tr+a[4]*pow(pow(rhor-1, 2), 0.5/a[5]), 2), a[6])
        den2 = pow(pow(a[7]*(rhor-alfa), 2), a[8])
        lc = num / (den1+den2)**a[9]

        return lc*nc*4.81384e-3
Exemplo n.º 5
0
"""

import os
from pyclaw import data
import numpy as np
from numpy import pi, tan, sin
from scipy import sinh, cosh, tanh, arccosh

# Set initial depth:
#d = 0.061  ## now in setrun

# These don't change:
theta = 15. * pi / 180.
epsilon = 0.717
C = arccosh(1. / epsilon)
b = 0.395
w = 0.680
Tprime = 0.082 + 0.004
kb = 2 * C / b
kw = 2 * C / w
x0 = d / tan(theta) + Tprime / sin(theta)


#------------------------------
def setrun(claw_pkg='geoclaw', d_param=None):
    #------------------------------
    """
    Define the parameters used for running Clawpack.

    INPUT:
Exemplo n.º 6
0
# Thermal properties of soil
k = 1.1  #W/mK
rho = 1750  # kg/m3
cp = 1380  # J/kgK

# Boundary conditions
h_air = 10  # Average convective heat transfer coefficient W/m2K
h_rad_sky = 4 * 5.67e-8 * 40**3  # Average radiation heat transfer coefficient

# U-value of energy pile
r1 = 0.028
r2 = r0
l = 0.3
k_conc = 1  # W/mK
S = 2 * sp.pi * H / sp.arccosh((r1**2 + r2**2 - l**2) / (2 * r1 * r2))
#U_ep = k_conc*S/(2*sp.pi*r0*H) # U-value of energy pile
U_ep = 3
print("Shape factor:", S, "U_ep:", U_ep)

# Temperatures
T_ep = -6 + 4 / 3  # Fluid temperature C
T0 = 5  # Initial temperature of soil

# Heating days per one year (days 0-364)
heating_starts = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31  # September 1st
heating_ends = 31 + 28 + 31 + 29  # 30th April

# Printing of iteration rounds
# 0 for no printing/plotting
print_gap = 10  # You can variate this
Exemplo n.º 7
0
def H(L, D):
	return abs((1/15.0)*sc.arccosh(-sc.tan(sc.radians(L)) * sc.tan(sc.radians(23.44)*sc.sin(sc.radians(((D+284)*360)/365.0)))))
Exemplo n.º 8
0
#-*- coding: utf-8 -*-

import scipy as sc #enthält bereits math und numpy
from matplotlib import pyplot as plt

def H(L, D):
	return abs((1/15.0)*sc.arccosh(-sc.tan(sc.radians(L)) * sc.tan(sc.radians(23.44)*sc.sin(sc.radians(((D+284)*360)/365.0)))))

D = 105
L = -40
#print "Sunrise: " + str(H(L, D))

print str(-sc.arccosh(L*(sc.pi/180)) * sc.tan(23.44*(sc.pi/180)*sc.sin((((D+284)*360)/365.0)*(sc.pi/180))))

"""
x2 = sc.linspace(-2., 12., 1000)
plt.plot(x2, (sc.log((x2**2)+5)*sc.cos(0.8*x2)+(3.5*x2))/(sc.e**(x2/10)), 'r')
plt.ylabel('f($x$)')
plt.xlabel('$x$')
plt.grid()
plt.text(5, -5, r'$f(x) = \frac{\ln(x^2+5) \cos(0.8x)+3.5x}{e^{\frac{x}{10}}}$', fontsize=20)
plt.fill_between(x2,(sc.log((x2**2)+5)*sc.cos(0.8*x2)+(3.5*x2))/(sc.e**(x2/10)), 0, color='blue', alpha = 0.2)
plt.show()
"""
Exemplo n.º 9
0
"""

import os
from pyclaw import data
import numpy as np
from numpy import pi,tan,sin
from scipy import sinh,cosh,tanh,arccosh

# Set initial depth:
#d = 0.061  ## now in setrun

# These don't change:
theta = 15. * pi / 180.
epsilon = 0.717
C = arccosh(1. / epsilon)
b = 0.395
w = 0.680
Tprime = 0.082 + 0.004
kb = 2*C / b
kw = 2*C / w
x0 = d/tan(theta) + Tprime/sin(theta)


#------------------------------
def setrun(claw_pkg='geoclaw', d_param = None):
#------------------------------

    """
    Define the parameters used for running Clawpack.