Exemplo n.º 1
0
T_inner['g'] = 1.

# initial condition
A = 0.1
x = 2 * r - r_inner - r_outer
T['g'] = r_inner * r_outer / r - r_inner + 210 * A / np.sqrt(17920 * np.pi) * (
    1 - 3 * x**2 + 3 * x**4 - x**6) * np.sin(theta)**4 * np.cos(4 * phi)

# Parameters and operators
div = lambda A: operators.Divergence(A, index=0)
lap = lambda A: operators.Laplacian(A, c)
grad = lambda A: operators.Gradient(A, c)
dot = lambda A, B: arithmetic.DotProduct(A, B)
cross = lambda A, B: arithmetic.CrossProduct(A, B)
ddt = lambda A: operators.TimeDerivative(A)
LiftTau = lambda A, n: operators.LiftTau(A, b, n)


# Problem
def eq_eval(eq_str):
    return [eval(expr) for expr in split_equation(eq_str)]


problem = problems.IVP(
    [u, p, T, tau_u_inner, tau_T_inner, tau_u_outer, tau_T_outer])
problem.add_equation(eq_eval(
    "Ekman*ddt(u) - Ekman*lap(u) + grad(p) + LiftTau(tau_u_inner,-1) + LiftTau(tau_u_outer,-2) = - Ekman*dot(u,grad(u)) + Rayleigh*r_vec*T - 2*cross(ez, u)"
),
                     condition="ntheta != 0")
problem.add_equation(eq_eval("u = 0"), condition="ntheta == 0")
problem.add_equation(eq_eval("div(u) = 0"), condition="ntheta != 0")
Exemplo n.º 2
0
u_BC = field.Field(dist=d, bases=(b_S2, ), tensorsig=(c, ), dtype=dtype)
u_BC['g'][2] = 0.  # u_r = 0
u_BC['g'][1] = -u0 * np.cos(theta) * np.cos(phi)
u_BC['g'][0] = u0 * np.sin(phi)

# Parameters and operators
ez = field.Field(dist=d, bases=(b, ), tensorsig=(c, ), dtype=dtype)
ez['g'][1] = -np.sin(theta)
ez['g'][2] = np.cos(theta)
div = lambda A: operators.Divergence(A, index=0)
lap = lambda A: operators.Laplacian(A, c)
grad = lambda A: operators.Gradient(A, c)
dot = lambda A, B: arithmetic.DotProduct(A, B)
cross = lambda A, B: arithmetic.CrossProduct(A, B)
ddt = lambda A: operators.TimeDerivative(A)
LiftTau = lambda A: operators.LiftTau(A, b, -1)


# Problem
def eq_eval(eq_str):
    return [eval(expr) for expr in split_equation(eq_str)]


problem = problems.IVP([p, u, tau])
# Equations for ell != 0
problem.add_equation(eq_eval("div(u) = 0"), condition="ntheta != 0")
problem.add_equation(eq_eval(
    "ddt(u) - nu*lap(u) + grad(p) + LiftTau(tau) = - dot(u,grad(u)) - Om*cross(ez, u)"
),
                     condition="ntheta != 0")
problem.add_equation(eq_eval("u(r=1) = u_BC"), condition="ntheta != 0")
Exemplo n.º 3
0
# Parameters and operators
ezB = field.Field(dist=d, bases=(bB, ), dtype=dtype, tensorsig=(c, ))
ezB['g'][1] = -np.sin(theta_B)
ezB['g'][2] = np.cos(theta_B)
ezS = field.Field(dist=d, bases=(bS, ), dtype=dtype, tensorsig=(c, ))
ezS['g'][1] = -np.sin(theta_S)
ezS['g'][2] = np.cos(theta_S)
div = lambda A: operators.Divergence(A, index=0)
lap = lambda A: operators.Laplacian(A, c)
grad = lambda A: operators.Gradient(A, c)
dot = lambda A, B: arithmetic.DotProduct(A, B)
cross = lambda A, B: arithmetic.CrossProduct(A, B)
ddt = lambda A: operators.TimeDerivative(A)
radcomp = lambda A: operators.RadialComponent(A)
angcomp = lambda A: operators.AngularComponent(A)
LiftTauB = lambda A: operators.LiftTau(A, bB, -1)
LiftTauS = lambda A, n: operators.LiftTau(A, bS, n)


# Problem
def eq_eval(eq_str):
    return [eval(expr) for expr in split_equation(eq_str)]


problem = problems.IVP([pB, uB, pS, uS, tB, tS1, tS2])
# Equations for ell != 0, ball
problem.add_equation(eq_eval("div(uB) = 0"), condition="ntheta != 0")
problem.add_equation(eq_eval(
    "ddt(uB) - nu*lap(uB) + grad(pB) + LiftTauB(tB) = - dot(uB,grad(uB)) - Om*cross(ezB, uB)"
),
                     condition="ntheta != 0")