Skip to content

Commit 8cf9f87

Browse files
committed
Merge pull request #27 from danielru/add_boussinesq_transfer
add transfer class for boussineqs
2 parents 09954a1 + bc047a2 commit 8cf9f87

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from pySDC.Transfer import transfer
2+
from pySDC.datatype_classes.mesh import mesh, rhs_imex_mesh
3+
4+
class mesh_to_mesh_2d(transfer):
5+
"""
6+
Custon transfer class, implements Transfer.py
7+
8+
This implementation is just a dummy for particles with no functionality. It can be used to check if in the particle
9+
setups the number of iterations is halved once two levels are used.
10+
11+
Attributes:
12+
fine: reference to the fine level
13+
coarse: reference to the coarse level
14+
init_f: number of variables on the fine level (whatever init represents there)
15+
init_c: number of variables on the coarse level (whatever init represents there)
16+
"""
17+
18+
def __init__(self,fine_level,coarse_level,params):
19+
"""
20+
Initialization routine
21+
22+
Args:
23+
fine_level: fine level connected with the transfer operations (passed to parent)
24+
coarse_level: coarse level connected with the transfer operations (passed to parent)
25+
"""
26+
super(mesh_to_mesh_2d,self).__init__(fine_level,coarse_level,params)
27+
pass
28+
29+
def restrict_space(self,F):
30+
"""
31+
Dummy restriction routine
32+
33+
Args:
34+
F: the fine level data (easier to access than via the fine attribute)
35+
36+
"""
37+
38+
if isinstance(F,mesh):
39+
G = mesh(F)
40+
elif isinstance(F,rhs_imex_mesh):
41+
G = rhs_imex_mesh(F)
42+
else:
43+
print('Transfer error')
44+
exit()
45+
return G
46+
47+
def prolong_space(self,G):
48+
"""
49+
Dummy prolongation routine
50+
51+
Args:
52+
G: the coarse level data (easier to access than via the coarse attribute)
53+
"""
54+
55+
if isinstance(G,mesh):
56+
F = mesh(G)
57+
elif isinstance(G,rhs_imex_mesh):
58+
F = rhs_imex_mesh(G)
59+
else:
60+
print('Transfer error')
61+
exit()
62+
return F

0 commit comments

Comments
 (0)