@@ -70,7 +70,7 @@ def __init__(self, pars):
7070 # pad transfer matrices if necessary
7171 if self .fine .sweep .coll .left_is_node :
7272 self .Pcoll = np .zeros ((self .fine .sweep .coll .num_nodes + 1 , self .coarse .sweep .coll .num_nodes + 1 ))
73- self .Rcoll = self .Pcoll . T
73+ self .Rcoll = np . zeros (( self .coarse . sweep . coll . num_nodes + 1 , self . fine . sweep . coll . num_nodes + 1 ))
7474 self .Pcoll [1 :, 1 :] = Pcoll
7575 self .Rcoll [1 :, 1 :] = Rcoll
7676 else :
@@ -110,7 +110,8 @@ def restrict(self):
110110 tmp_u .append (self .space_transfer .restrict (F .u [m ]))
111111
112112 # restrict collocation values
113- for n in range (0 , SG .coll .num_nodes + 1 ):
113+ G .u [0 ] = tmp_u [0 ]
114+ for n in range (1 , SG .coll .num_nodes + 1 ):
114115 G .u [n ] = self .Rcoll [n , 0 ] * tmp_u [0 ]
115116 for m in range (1 , SF .coll .num_nodes + 1 ):
116117 G .u [n ] += self .Rcoll [n , m ] * tmp_u [m ]
@@ -200,7 +201,8 @@ def prolong(self):
200201 tmp_u .append (self .space_transfer .prolong (G .u [m ] - G .uold [m ]))
201202
202203 # interpolate values in collocation
203- for n in range (0 , SF .coll .num_nodes + 1 ):
204+ F .u [0 ] += tmp_u [0 ]
205+ for n in range (1 , SF .coll .num_nodes + 1 ):
204206 for m in range (0 , SG .coll .num_nodes + 1 ):
205207 F .u [n ] += self .Pcoll [n , m ] * tmp_u [m ]
206208
@@ -245,7 +247,9 @@ def prolong_f(self):
245247 tmp_f .append (self .space_transfer .prolong (G .f [m ] - G .fold [m ]))
246248
247249 # interpolate values in collocation
248- for n in range (0 , SF .coll .num_nodes + 1 ):
250+ F .u [0 ] += tmp_u [0 ]
251+ F .f [0 ] += tmp_f [0 ]
252+ for n in range (1 , SF .coll .num_nodes + 1 ):
249253 for m in range (0 , SG .coll .num_nodes + 1 ):
250254 F .u [n ] += self .Pcoll [n , m ] * tmp_u [m ]
251255 F .f [n ] += self .Pcoll [n , m ] * tmp_f [m ]
0 commit comments