PLaSK library
Loading...
Searching...
No Matches
diffusion2 Namespace Reference

Functions

 evaluate (expr, args)
 
 evaluate_matrix (expr)
 
 evaluate_vector (expr)
 
 _print_Indexed (self, expr)
 
 cpp (v)
 
 _print_cpp (kij, kvals, fvals, file=sys.stdout)
 
 print_cpp (KK, FF, fname=None)
 
 La (i, x, z)
 

Variables

 msize = mpi.Get_size()
 
 mrank = mpi.Get_rank()
 
 _print_Indexed
 
str sidx = lambda i: "e.i{}{}".format(*idx[i])
 
 x
 
 y
 
 X
 
 Y
 
 ξ = x / X
 
 ζ = y / Y
 
 Φ = np.linalg.inv(np.array([[1, 0, 0, 0], [0, 1, 0, 0], [1, 1, 1, 1], [0, 1, 2, 3]])).T
 
list φx = [sum(int(c) * ξ**i for i, c in enumerate(p)) for p in Φ]
 
list φy = [sum(int(c) * ζ**i for i, c in enumerate(p)) for p in Φ]
 
list idx = [(0,0), (0,1), (1,0), (0,2), (0,3), (1,2), (2,0), (2,1), (3,0), (2,2), (2,3), (3,2)]
 
 φ = np.array([φx[idx[i][0]] * φy[idx[i][1]] for i in range(12)])
 
 dφx = np.array([sym.expand(sym.diff(a, x)) for a in φ])
 
 dφy = np.array([sym.expand(sym.diff(a, y)) for a in φ])
 
 U = sym.IndexedBase('U', shape=(4, 4))
 
 u0 = sum(U[idx[k]] * φ[k] for k in range(12))
 
 sep
 
 zx = np.array([0, X])
 
 zy = np.array([0, Y])
 
 J = sym.IndexedBase('J', shape=(2, 2))
 
 Jxy = sym.simplify(sum(J[i,j] * La(i, x, zx) * La(j, y, zy) for i in range(len(zx)) for j in range(len(zy))))
 
 KD
 
 end
 
 KA
 
 KB
 
 u02 = sym.expand(u0**2)
 
 u03 = sym.expand(u0**3)
 
 KC
 
 KK = KD, KA, KB, KC
 
 FB
 
 FC
 
 F0
 
 FF = FB, FC, F0
 
 P = sym.IndexedBase('P', shape=(2,2,2))
 
 G = sym.IndexedBase('G', shape=(2,))
 
 dG = sym.IndexedBase('dG', shape=(2,))
 
 ug = sym.symbols('Ug')
 
list Pxy = [sym.simplify(sum(P[i, j, c] * La(i, x, zx) * La(j, y, zy) for i in range(len(zx)) for j in range(len(zy)))) for c in range(2)]
 
 KL
 
 FL
 

Function Documentation

◆ _print_cpp()

diffusion2._print_cpp (   kij,
  kvals,
  fvals,
  file = sys.stdout 
)
protected

Definition at line 83 of file diffusion2.py.

◆ _print_Indexed()

diffusion2._print_Indexed (   self,
  expr 
)
protected

Definition at line 55 of file diffusion2.py.

◆ cpp()

diffusion2.cpp (   v)

Definition at line 66 of file diffusion2.py.

◆ evaluate()

diffusion2.evaluate (   expr,
  args 
)

Definition at line 22 of file diffusion2.py.

◆ evaluate_matrix()

diffusion2.evaluate_matrix (   expr)

Definition at line 33 of file diffusion2.py.

◆ evaluate_vector()

diffusion2.evaluate_vector (   expr)

Definition at line 45 of file diffusion2.py.

◆ La()

diffusion2.La (   i,
  x,
  z 
)

Definition at line 143 of file diffusion2.py.

◆ print_cpp()

diffusion2.print_cpp (   KK,
  FF,
  fname = None 
)

Definition at line 90 of file diffusion2.py.

Variable Documentation

◆ Φ

diffusion2.Φ = np.linalg.inv(np.array([[1, 0, 0, 0], [0, 1, 0, 0], [1, 1, 1, 1], [0, 1, 2, 3]])).T

Definition at line 112 of file diffusion2.py.

◆ ζ

diffusion2.ζ = y / Y

Definition at line 110 of file diffusion2.py.

◆ ξ

diffusion2.ξ = x / X

Definition at line 109 of file diffusion2.py.

◆ φ

diffusion2.φ = np.array([φx[idx[i][0]] * φy[idx[i][1]] for i in range(12)])

Definition at line 125 of file diffusion2.py.

◆ φx

diffusion2.φx = [sum(int(c) * ξ**i for i, c in enumerate(p)) for p in Φ]

Definition at line 114 of file diffusion2.py.

◆ φy

diffusion2.φy = [sum(int(c) * ζ**i for i, c in enumerate(p)) for p in Φ]

Definition at line 119 of file diffusion2.py.

◆ _print_Indexed

diffusion2._print_Indexed
protected

Definition at line 63 of file diffusion2.py.

◆ dφx

diffusion2.dφx = np.array([sym.expand(sym.diff(a, x)) for a in φ])

Definition at line 127 of file diffusion2.py.

◆ dφy

diffusion2.dφy = np.array([sym.expand(sym.diff(a, y)) for a in φ])

Definition at line 128 of file diffusion2.py.

◆ dG

diffusion2.dG = sym.IndexedBase('dG', shape=(2,))

Definition at line 211 of file diffusion2.py.

◆ end

diffusion2.end

Definition at line 157 of file diffusion2.py.

◆ F0

diffusion2.F0
Initial value:
1= evaluate_vector(lambda i:
2 sym.simplify(sym.integrate(sym.integrate(Jxy * φ[i], (x, 0, X)), (y, 0, Y)))
3)

Definition at line 193 of file diffusion2.py.

◆ FB

diffusion2.FB
Initial value:
1= evaluate_vector(lambda i:
2 sym.simplify(sym.integrate(sym.simplify(sym.integrate(B * u02 * φ[i], (x, 0, X))), (y, 0, Y)))
3)

Definition at line 183 of file diffusion2.py.

◆ FC

diffusion2.FC
Initial value:
1= evaluate_vector(lambda i:
2 sym.simplify(sym.integrate(sym.simplify(sym.integrate(2 * C * u03 * φ[i], (x, 0, X))), (y, 0, Y)))
3)

Definition at line 188 of file diffusion2.py.

◆ FF

diffusion2.FF = FB, FC, F0

Definition at line 199 of file diffusion2.py.

◆ FL

diffusion2.FL
Initial value:
1= evaluate_vector(lambda i:
2 sym.simplify(sym.integrate(sym.integrate(sum(Pxy[i] * (dG[i] * ug - G[i]) for i in range(2)) * φ[i], (x, 0, X)), (y, 0, Y)))
3)

Definition at line 221 of file diffusion2.py.

◆ G

diffusion2.G = sym.IndexedBase('G', shape=(2,))

Definition at line 210 of file diffusion2.py.

◆ idx

list diffusion2.idx = [(0,0), (0,1), (1,0), (0,2), (0,3), (1,2), (2,0), (2,1), (3,0), (2,2), (2,3), (3,2)]

Definition at line 124 of file diffusion2.py.

◆ J

diffusion2.J = sym.IndexedBase('J', shape=(2, 2))

Definition at line 140 of file diffusion2.py.

◆ Jxy

diffusion2.Jxy = sym.simplify(sum(J[i,j] * La(i, x, zx) * La(j, y, zy) for i in range(len(zx)) for j in range(len(zy))))

Definition at line 151 of file diffusion2.py.

◆ KA

diffusion2.KA
Initial value:
1= evaluate_matrix(lambda i,j:
2 sym.simplify(sym.integrate(sym.integrate(A * φ[i] * φ[j], (x, 0, X)), (y, 0, Y)))
3)

Definition at line 159 of file diffusion2.py.

◆ KB

diffusion2.KB
Initial value:
1= evaluate_matrix(lambda i,j:
2 sym.simplify(sym.integrate(sym.integrate(2 * B * u0 * φ[i] * φ[j], (x, 0, X)), (y, 0, Y)))
3)

Definition at line 164 of file diffusion2.py.

◆ KC

diffusion2.KC
Initial value:
1= evaluate_matrix(lambda i,j:
2 sym.simplify(sym.integrate(sym.simplify(sym.integrate(3 * C * u02 * φ[i] * φ[j], (x, 0, X))), (y, 0, Y)))
3)

Definition at line 172 of file diffusion2.py.

◆ KD

diffusion2.KD
Initial value:
1= evaluate_matrix(lambda i,j:
2 sym.simplify(sym.integrate(sym.integrate(D * (dφx[i] * dφx[j] + dφy[i] * dφy[j]), (x, 0, X)), (y, 0, Y)))
3)

Definition at line 154 of file diffusion2.py.

◆ KK

diffusion2.KK = KD, KA, KB, KC

Definition at line 178 of file diffusion2.py.

◆ KL

diffusion2.KL
Initial value:
1= evaluate_matrix(lambda i,j:
2 sym.simplify(sym.integrate(sym.integrate(sum(Pxy[i] * dG[i] for i in range(2)) * φ[i] * φ[j], (x, 0, X)), (y, 0, Y)))
3)

Definition at line 216 of file diffusion2.py.

◆ mrank

diffusion2.mrank = mpi.Get_rank()

Definition at line 19 of file diffusion2.py.

◆ msize

diffusion2.msize = mpi.Get_size()

Definition at line 18 of file diffusion2.py.

◆ P

diffusion2.P = sym.IndexedBase('P', shape=(2,2,2))

Definition at line 209 of file diffusion2.py.

◆ Pxy

list diffusion2.Pxy = [sym.simplify(sum(P[i, j, c] * La(i, x, zx) * La(j, y, zy) for i in range(len(zx)) for j in range(len(zy)))) for c in range(2)]

Definition at line 214 of file diffusion2.py.

◆ sep

diffusion2.sep

Definition at line 135 of file diffusion2.py.

◆ sidx

str diffusion2.sidx = lambda i: "e.i{}{}".format(*idx[i])

Definition at line 81 of file diffusion2.py.

◆ U

diffusion2.U = sym.IndexedBase('U', shape=(4, 4))

Definition at line 130 of file diffusion2.py.

◆ u0

diffusion2.u0 = sum(U[idx[k]] * φ[k] for k in range(12))

Definition at line 131 of file diffusion2.py.

◆ u02

diffusion2.u02 = sym.expand(u0**2)

Definition at line 169 of file diffusion2.py.

◆ u03

diffusion2.u03 = sym.expand(u0**3)

Definition at line 170 of file diffusion2.py.

◆ ug

diffusion2.ug = sym.symbols('Ug')

Definition at line 212 of file diffusion2.py.

◆ x

diffusion2.x

Definition at line 106 of file diffusion2.py.

◆ X

diffusion2.X

Definition at line 107 of file diffusion2.py.

◆ y

diffusion2.y

Definition at line 106 of file diffusion2.py.

◆ Y

diffusion2.Y

Definition at line 107 of file diffusion2.py.

◆ zx

diffusion2.zx = np.array([0, X])

Definition at line 137 of file diffusion2.py.

◆ zy

diffusion2.zy = np.array([0, Y])

Definition at line 138 of file diffusion2.py.