Esempio n. 1
0
    def __init__(self, dim, eleOrder):

        # dimention of the reference element
        self._dim = dendro.scalar("dim")

        # nodal locations of the element
        self._r = dendro.vec("r", eleOrder + 1)

        # weights for the gll quadrature
        self._wgll = dendro.vec("wgll", eleOrder + 1)

        # gauss points for quadrature
        self._g = dendro.vec("g", eleOrder + 1)

        # weights for the gauss quadrature
        self._wg = dendro.vec("w", eleOrder + 1)

        # polynomial Vandermonde matrix evaluated at the reference points
        self._Vr = dendro.mat("Vr", eleOrder + 1, eleOrder + 1)

        # gradient of the polynomial Vandermonde matrix evaluated at the reference points
        self._gradVr = dendro.mat("gradVr", eleOrder + 1, eleOrder + 1)

        # polynomial Vandermonde matrix evaluated at the gauss points
        self._Vg = dendro.mat("Vg", eleOrder + 1, eleOrder + 1)

        # polynomial Vandermonde matrix evaluated at the gauss points
        self._gradVg = dendro.mat("gradVg", eleOrder + 1, eleOrder + 1)

        # Gradient interpolation to the reference points from gauss points
        self._Dr = dendro.mat("gradDr", eleOrder + 1, eleOrder + 1)

        # Gradient interpolation to the gauss points from reference points
        self._Dg = dendro.mat("gradDg", eleOrder + 1, eleOrder + 1)

        # matrix Identity
        self._matI = dendro.matI(eleOrder + 1)

        # parent to child (one child) interpolation
        self._Vph = dendro.mat("Vph", eleOrder + 1, eleOrder + 1)

        # parent to all children interpolation
        self._Vpp = dendro.mat("Vpp", eleOrder + 1, eleOrder + 1)
Esempio n. 2
0
###################################################################
# initialize
###################################################################

l1, l2, l3, l4, eta = symbols('lambda[0] lambda[1] lambda[2] lambda[3] eta')
lf0, lf1 = symbols('lambda_f[0] lambda_f[1]')

# Additional parameters for damping term
R0 = symbols('BSSN_ETA_R0')
ep1, ep2 = symbols('BSSN_ETA_POWER[0] BSSN_ETA_POWER[1]')

xi1, xi2, xi3 = symbols('BSSN_XI[0] BSSN_XI[1] BSSN_XI[2] ')

# declare variables
a = dendro.scalar("alpha", "[pp]")
chi = dendro.scalar("chi", "[pp]")
K = dendro.scalar("K", "[pp]")

Gt = dendro.vec3("Gt", "[pp]")
b = dendro.vec3("beta", "[pp]")
B = dendro.vec3("B", "[pp]")

gt = dendro.sym_3x3("gt", "[pp]")
At = dendro.sym_3x3("At", "[pp]")

Gt_rhs = dendro.vec3("Gt_rhs", "[pp]")

# Lie derivative weight
weight = -Rational(2, 3)
weight_Gt = Rational(2, 3)
Esempio n. 3
0
import dendro
from sympy import *

###############################################################
#  initialize
###############################################################

r = symbols('r')

# declare functions
chi = dendro.scalar("chi", "[pp]")
phi = dendro.scalar("phi", "[pp]")

d = dendro.set_first_derivative('grad')  # first argument is direction
d2s = dendro.set_second_derivative('grad2')  # first 2 arguments are directions
d2 = dendro.d2

###############################################################
#  evolution equations
###############################################################

phi_rhs = sum(d2(i, i, chi) for i in dendro.e_i) - sin(2 * chi) / r**2

chi_rhs = phi

###############################################################
#  evolution equations
###############################################################

outs = [phi_rhs, chi_rhs]
Esempio n. 4
0
#
####################################################################

#!/usr/bin/env/ python3

import dendro
from sympy import *

###################################################################
# initialize
###################################################################

# Declare variables.
# These include the BSSN variables that we need for the Psi4
# calculation.
chi = dendro.scalar("chi", "[pp]")
K = dendro.scalar("K", "[pp]")
Gt = dendro.vec3("Gt", "[pp]")
gt = dendro.sym_3x3("gt", "[pp]")
At = dendro.sym_3x3("At", "[pp]")

# Specify the operators needed for computing first and second derivatives
d = dendro.set_first_derivative('grad')  # first argument is direction
d2 = dendro.set_second_derivative('grad2')  # first 2 arguments are directions
ad = dendro.set_advective_derivative('agrad')  # first argument is direction

# Metric related quantities, i.e. the metric and its inverse
dendro.set_metric(gt)
igt = dendro.get_inverse_metric()

# Christoffels, Ricci, et al
Esempio n. 5
0
lf0, lf1 = symbols('lambda_f[0] lambda_f[1]')

#QG related constants
a_const = symbols('a_const')
b_const = symbols('b_const')
qg_ho_coup = symbols('qg_ho_coup')

PI = 3.14159265358979323846
kappa = 1/(16*PI)

# Additional parameters for damping term
R0 = symbols('QUADGRAV_ETA_R0')
ep1, ep2 = symbols('QUADGRAV_ETA_POWER[0] QUADGRAV_ETA_POWER[1]')

# declare variables
a   = dendro.scalar("alpha", "[pp]")
chi = dendro.scalar("chi", "[pp]")
K   = dendro.scalar("K", "[pp]")

Gt  = dendro.vec3("Gt", "[pp]")
b   = dendro.vec3("beta", "[pp]")
B   = dendro.vec3("B", "[pp]")

gt  = dendro.sym_3x3("gt", "[pp]")
At  = dendro.sym_3x3("At", "[pp]")

Gt_rhs  = dendro.vec3("Gt_rhs", "[pp]")

Rsc = dendro.scalar("Rsc", "[pp]")
Rsch = dendro.scalar("Rsch", "[pp]")
Rtt = dendro.sym_3x3("Rtt", "[pp]")
Esempio n. 6
0
import dendro
from sympy import *

###################################################################
# initialize
###################################################################

l1, l2, l3, l4, eta = symbols('lambda[0] lambda[1] lambda[2] lambda[3] eta')
lf0, lf1 = symbols('lambda_f[0] lambda_f[1]')

# declare variables
a = dendro.scalar("alpha")
chi = dendro.scalar("chi")
K = dendro.scalar("K")

Gt = dendro.vec3("Gt")
b = dendro.vec3("beta")
B = dendro.vec3("B")

gt = dendro.sym_3x3("gt")
At = dendro.sym_3x3("At")

Gt_rhs = dendro.vec3("Gt_rhs")

# Lie derivative weight
weight = -2 / 3
weight_Gt = 2 / 3

# specify the functions for computing first and second derivatives
d = dendro.set_first_derivative('grad')  # first argument is direction
d2 = dendro.set_second_derivative('grad2')  # first 2 arguments are directions
import dendro
from sympy import *

###################################################################
# initialize
###################################################################

l1, l2, l3, l4, eta = symbols('lambda[0] lambda[1] lambda[2] lambda[3] eta')
lf0, lf1 = symbols('lambda_f[0] lambda_f[1]')

# declare variables
a = dendro.scalar("alpha")
chi = dendro.scalar("chi")
K = dendro.scalar("K")

Gt = dendro.vec3("Gt")
b = dendro.vec3("beta")
B = dendro.vec3("B")

gt = dendro.sym_3x3("gt")
At = dendro.sym_3x3("At")

Gt_rhs = dendro.vec3("Gt_rhs")

# Lie derivative weight
weight = -2 / 3
weight_Gt = 2 / 3

# specify the functions for computing first and second derivatives
d = dendro.set_first_derivative('grad')  # first argument is direction
d2 = dendro.set_second_derivative('grad2')  # first 2 arguments are directions
Esempio n. 8
0
#file to generate cuda rhs code
import dendro as dendro
from sympy import *

###################################################################
# initialize cuda variables
###################################################################

l1, l2, l3, l4, eta = symbols('lambda[0] lambda[1] lambda[2] lambda[3] eta')
lf0, lf1 = symbols('lambda_f[0] lambda_f[1]')

# declare variables
a = dendro.scalar("dev_var_in", "[alphaInt+pp]")
chi = dendro.scalar("dev_var_in", "[chiInt+pp]")
K = dendro.scalar("dev_var_in", "[KInt+pp]")

Gt = dendro.vec3_cuda("dev_var_in", "Gt", "[Int+pp]")
b = dendro.vec3_cuda("dev_var_in", "beta", "[Int+pp]")
B = dendro.vec3_cuda("dev_var_in", "B", "[Int+pp]")

gt = dendro.sym_3x3_cuda("dev_var_in", "gt", "[Int+pp]")
At = dendro.sym_3x3_cuda("dev_var_in", "At", "[Int+pp]")

Gt_rhs = dendro.vec3_cuda("dev_var_out", "gt", "[Int+pp]")

# Lie derivative weight
weight = -Rational(2, 3)
weight_Gt = Rational(2, 3)

# specify the functions for computing first and second derivatives
d = dendro.set_first_derivative('grad')  # first argument is direction
Esempio n. 9
0
#
####################################################################

#!/usr/bin/env/ python3

import dendro
from sympy import *

###################################################################
# initialize
###################################################################

# Declare variables.
# These include the BSSN variables that we need for the Psi4
# calculation.
chi = dendro.scalar("chi", "[pp]")
K = dendro.scalar("K", "[pp]")
Gt = dendro.vec3("Gt", "[pp]")
gt = dendro.sym_3x3("gt", "[pp]")
At = dendro.sym_3x3("At", "[pp]")

# Define some symbolic variables that will be used to stage the
# calculation of the constraints.
_ham_s1 = dendro.scalar("ham_s1_", "[pp]")
_ham_s2 = dendro.scalar("ham_s2_", "[pp]")
_mom_s1 = dendro.vec3("mom_s1_", "[pp]")
_mom_s2 = dendro.vec3("mom_s2_", "[pp]")
_mom_s3 = dendro.vec3("mom_s3_", "[pp]")

# Now for the same variables that will be used to generate the code
ham_s1 = dendro.scalar("ham_s1_", "[pp]")
Esempio n. 10
0
# Script to generate rhs equations for quadratic gravity
# Here, we use diagonalize GH system
###############################################################################
import dendro
from sympy import *
from sympy.physics.vector.vector import Vector
from sympy.printing.dot import dotprint
###################################################################
# initialize
###################################################################

l1, l2, l3, l4, eta = symbols('lambda[0] lambda[1] lambda[2] lambda[3] eta')
lf0, lf1 = symbols('lambda_f[0] lambda_f[1]')

# declare variables
RccSc   = dendro.scalar("RccSc", "[pp]")

Vaux  = dendro.vec3("Vaux", "[pp]")

gm  = dendro.sym_3x3("gm", "[pp]")
Rcct  = dendro.sym_3x3("Rcct", "[pp]")

# Lie derivative weight
weight = -Rational(2,3)
weight_Gt = Rational(2,3)

# specify the functions for computing first and second derivatives
d = dendro.set_first_derivative('grad')    # first argument is direction
d2s = dendro.set_second_derivative('grad2')  # first 2 arguments are directions
ad = dendro.set_advective_derivative('agrad')  # first argument is direction
kod = dendro.set_kreiss_oliger_dissipation('kograd')