Peano
Loading...
Searching...
No Matches
IntergridOperators.py
Go to the documentation of this file.
1import numpy as np
2from .finiteelement import DGScalarElement
3
5
6 def __init__(self, dim, coarse_order, fine_order):
7 self.coarse_order = coarse_order
8 self.fine_order = fine_order
9 self.coarse_element = DGScalarElement(dim, coarse_order)
10 self.fine_element = DGScalarElement(dim, fine_order)
11
12 def prolongation(self):
13 """
14 Return the local prolongation matrix of size fine_element.ndof x coarse_element.ndof
15 """
16 coarse_ndof = self.coarse_element.ndof
17 fine_ndof = self.fine_element.ndof
18 Prolongation_matrix = np.zeros((fine_ndof, coarse_ndof))
19 for i in range(fine_ndof):
20 for j in range(coarse_ndof):
21 Prolongation_matrix[i, j] = self.coarse_element.evaluate(j, self.fine_element.nodes[i])
22
23 return Prolongation_matrix
24
25 def restriction(self):
26 """
27 Return the local restriction matrix of size coarse_element.ndof x fine_element.ndof
28 This is the transposed prolongation matrix
29 """
30 return np.transpose(self.prolongation())
31
32 def injection(self):
33 """
34 Return the local "injection" or "interpolation" matrix of size coarse_element.ndof x fine_element.ndof
35 """
36 coarse_ndof = self.coarse_element.ndof
37 fine_ndof = self.fine_element.ndof
38 Injection_matrix = np.zeros((coarse_ndof, fine_ndof))
39 for i in range(coarse_ndof):
40 for j in range(fine_ndof):
41 Injection_matrix[i, j] = self.fine_element.evaluate(j, self.coarse_element.nodes[i])
42
43 return Injection_matrix
restriction(self)
Return the local restriction matrix of size coarse_element.ndof x fine_element.ndof This is the trans...
injection(self)
Return the local "injection" or "interpolation" matrix of size coarse_element.ndof x fine_element....
prolongation(self)
Return the local prolongation matrix of size fine_element.ndof x coarse_element.ndof.