コード例 #1
0
ファイル: check2DMeshPoly.py プロジェクト: Achyut2404/nodalDG
# Testing script for 2 dimensional mesh import

import functions2D
import numpy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
#Order of points
NPoints=40
#Order of polynomials
Ni=1
Nj=5
#Calculation
#Create Mesh
[x,y]=functions2D.Nodes2D(NPoints)
[r,s]=functions2D.xytors(x,y)
#Create Polynomials
[a,b]=functions2D.rstoab(r,s)
P=functions2D.Simplex2DP(a,b,Ni,Nj)
#Check Vandermonde
NVander=10
Vander=functions2D.Vandermonde2D(NVander, r, s)
gradVander=functions2D.GradVandermonde2D(NVander,r,s)
print Vander.shape
print gradVander[0].shape
print gradVander[1].shape
#Plot

plt.figure(1)
plt.scatter(x,y,c=P,cmap=cm.jet)
コード例 #2
0
ファイル: check2DMeshPoly.py プロジェクト: Achyut2404/nodalDG
# Testing script for 2 dimensional mesh import

import functions2D
import numpy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
#Order of points
NPoints = 40
#Order of polynomials
Ni = 1
Nj = 5
#Calculation
#Create Mesh
[x, y] = functions2D.Nodes2D(NPoints)
[r, s] = functions2D.xytors(x, y)
#Create Polynomials
[a, b] = functions2D.rstoab(r, s)
P = functions2D.Simplex2DP(a, b, Ni, Nj)
#Check Vandermonde
NVander = 10
Vander = functions2D.Vandermonde2D(NVander, r, s)
gradVander = functions2D.GradVandermonde2D(NVander, r, s)
print Vander.shape
print gradVander[0].shape
print gradVander[1].shape
#Plot

plt.figure(1)
plt.scatter(x, y, c=P, cmap=cm.jet)
コード例 #3
0
ファイル: initiate2D.py プロジェクト: Achyut2404/nodalDG
# Purpose : Setup script, building operators, grid, metric, and connectivity tables.

import globalVar2D as glb
import functions2D
import numpy

# Definition of constants
glb.Nfp = glb.N+1
glb.Np = (glb.N+1)*(glb.N+2)/2
glb.Nfaces=3
glb.NODETOL = 1e-12

# Compute nodal set
[glb.x,glb.y] = functions2D.Nodes2D(glb.N)
[glb.r,glb.s] = functions2D.xytors(glb.x,glb.y)

# Build reference element matrices
glb.V = functions2D.Vandermonde2D(glb.N,glb.r,glb.s)
glb.invV = numpy.linalg.inv(glb.V)
glb.MassMatrix = glb.invV.transpose().dot(glb.invV)
[glb.Dr,glb.Ds] = functions2D.Dmatrices2D(glb.N, glb.r, glb.s, glb.V)

# build coordinates of all the nodes
va = glb.EToV[:,0]
vb = glb.EToV[:,1]
vc = glb.EToV[:,2]
glb.x = 0.5*(-numpy.array([(glb.r+glb.s)]).transpose().dot(numpy.array([glb.VX[va]]))+numpy.array([(1+glb.r)]).transpose().dot(numpy.array([glb.VX[vb]]))+numpy.array([(1+glb.s)]).transpose().dot(numpy.array([glb.VX[vc]])))
glb.y = 0.5*(-numpy.array([(glb.r+glb.s)]).transpose().dot(numpy.array([glb.VY[va]]))+numpy.array([(1+glb.r)]).transpose().dot(numpy.array([glb.VY[vb]]))+numpy.array([(1+glb.s)]).transpose().dot(numpy.array([glb.VY[vc]])))

# find all the nodes that lie on each edge
コード例 #4
0
ファイル: initiate2D.py プロジェクト: Achyut2404/nodalDG
# Purpose : Setup script, building operators, grid, metric, and connectivity tables.

import globalVar2D as glb
import functions2D
import numpy

# Definition of constants
glb.Nfp = glb.N + 1
glb.Np = (glb.N + 1) * (glb.N + 2) / 2
glb.Nfaces = 3
glb.NODETOL = 1e-12

# Compute nodal set
[glb.x, glb.y] = functions2D.Nodes2D(glb.N)
[glb.r, glb.s] = functions2D.xytors(glb.x, glb.y)

# Build reference element matrices
glb.V = functions2D.Vandermonde2D(glb.N, glb.r, glb.s)
glb.invV = numpy.linalg.inv(glb.V)
glb.MassMatrix = glb.invV.transpose().dot(glb.invV)
[glb.Dr, glb.Ds] = functions2D.Dmatrices2D(glb.N, glb.r, glb.s, glb.V)

# build coordinates of all the nodes
va = glb.EToV[:, 0]
vb = glb.EToV[:, 1]
vc = glb.EToV[:, 2]
glb.x = 0.5 * (
    -numpy.array([(glb.r + glb.s)]).transpose().dot(numpy.array([glb.VX[va]]))
    + numpy.array([(1 + glb.r)]).transpose().dot(numpy.array([glb.VX[vb]])) +
    numpy.array([(1 + glb.s)]).transpose().dot(numpy.array([glb.VX[vc]])))