Skip to content

Commit b9c84c7

Browse files
committed
removing dtype_u and dtype_f from frontends
1 parent 292ebdc commit b9c84c7

File tree

74 files changed

+9
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+9
-191
lines changed

pySDC/implementations/problem_classes/PenningTrap_3D.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class penningtrap(ptype):
1414
Example implementing particles in a penning trap
1515
"""
1616

17-
def __init__(self, problem_params, dtype_u=particles, dtype_f=acceleration):
17+
def __init__(self, problem_params, dtype_u=particles, dtype_f=fields):
1818
"""
1919
Initialization routine
2020
2121
Args:
2222
problem_params (dict): custom parameters for the example
2323
dtype_u: particle data type (will be passed parent class)
24-
dtype_f: acceleration data type (will be passed parent class)
24+
dtype_f: fields data type (will be passed parent class)
2525
"""
2626

2727
# these parameters will be used later, so assert their existence
@@ -86,7 +86,7 @@ def eval_f(self, part, t):
8686
N = self.params.nparts
8787

8888
Emat = np.diag([1, 1, -2])
89-
f = fields((3, self.params.nparts))
89+
f = self.dtype_f((3, self.params.nparts))
9090

9191
f.elec.values = self.get_interactions(part)
9292

@@ -222,7 +222,7 @@ def build_f(self, f, part, t):
222222

223223
N = self.params.nparts
224224

225-
rhs = self.dtype_f((3, self.params.nparts))
225+
rhs = acceleration((3, self.params.nparts))
226226

227227
for n in range(N):
228228
rhs.values[:, n] = part.q[n] / part.m[n] * (f.elec.values[:, n] +

pySDC/playgrounds/Allen_Cahn/AllenCahn_contracting_circle_FFT.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ def setup_parameters():
6262
description = dict()
6363
description['problem_class'] = allencahn2d_imex # pass problem class
6464
description['problem_params'] = problem_params # pass problem parameters
65-
description['dtype_u'] = mesh # pass data type for u
66-
description['dtype_f'] = rhs_imex_mesh # pass data type for f
6765
description['sweeper_class'] = imex_1st_order # pass sweeper (see part B)
6866
description['sweeper_params'] = sweeper_params # pass sweeper parameters
6967
description['level_params'] = level_params # pass level parameters

pySDC/playgrounds/Allen_Cahn/AllenCahn_contracting_circle_FFT_PFASST.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ def setup_parameters(nsweeps=None):
6363
description = dict()
6464
description['problem_class'] = allencahn2d_imex # pass problem class
6565
description['problem_params'] = problem_params # pass problem parameters
66-
description['dtype_u'] = mesh # pass data type for u
67-
description['dtype_f'] = rhs_imex_mesh # pass data type for f
6866
description['sweeper_class'] = imex_1st_order # pass sweeper (see part B)
6967
description['sweeper_params'] = sweeper_params # pass sweeper parameters
7068
description['level_params'] = level_params # pass level parameters

pySDC/playgrounds/Allen_Cahn/AllenCahn_contracting_circle_SDC.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ def setup_parameters():
7373
description = dict()
7474
description['problem_class'] = None # pass problem class
7575
description['problem_params'] = problem_params # pass problem parameters
76-
description['dtype_u'] = mesh # pass data type for u
77-
description['dtype_f'] = None # pass data type for f
7876
description['sweeper_class'] = None # pass sweeper (see part B)
7977
description['sweeper_params'] = sweeper_params # pass sweeper parameters
8078
description['level_params'] = level_params # pass level parameters
@@ -101,32 +99,27 @@ def run_SDC_variant(variant=None, inexact=False):
10199
# add stuff based on variant
102100
if variant == 'fully-implicit':
103101
description['problem_class'] = allencahn_fullyimplicit
104-
description['dtype_f'] = mesh
105102
description['sweeper_class'] = generic_implicit
106103
if inexact:
107104
description['problem_params']['newton_maxiter'] = 1
108105
elif variant == 'semi-implicit':
109106
description['problem_class'] = allencahn_semiimplicit
110-
description['dtype_f'] = rhs_imex_mesh
111107
description['sweeper_class'] = imex_1st_order
112108
if inexact:
113109
description['problem_params']['lin_maxiter'] = 10
114110
elif variant == 'semi-implicit_v2':
115111
description['problem_class'] = allencahn_semiimplicit_v2
116-
description['dtype_f'] = rhs_imex_mesh
117112
description['sweeper_class'] = imex_1st_order
118113
if inexact:
119114
description['problem_params']['newton_maxiter'] = 1
120115
elif variant == 'multi-implicit':
121116
description['problem_class'] = allencahn_multiimplicit
122-
description['dtype_f'] = rhs_comp2_mesh
123117
description['sweeper_class'] = multi_implicit
124118
if inexact:
125119
description['problem_params']['newton_maxiter'] = 1
126120
description['problem_params']['lin_maxiter'] = 10
127121
elif variant == 'multi-implicit_v2':
128122
description['problem_class'] = allencahn_multiimplicit_v2
129-
description['dtype_f'] = rhs_comp2_mesh
130123
description['sweeper_class'] = multi_implicit
131124
if inexact:
132125
description['problem_params']['newton_maxiter'] = 1

pySDC/playgrounds/Allen_Cahn/AllenCahn_reference.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ def setup_parameters():
6464
description = dict()
6565
description['problem_class'] = allencahn_fullyimplicit # pass problem class
6666
description['problem_params'] = problem_params # pass problem parameters
67-
description['dtype_u'] = mesh # pass data type for u
68-
description['dtype_f'] = mesh # pass data type for f
6967
description['sweeper_class'] = generic_implicit # pass sweeper (see part B)
7068
description['sweeper_params'] = sweeper_params # pass sweeper parameters
7169
description['level_params'] = level_params # pass level parameters
@@ -122,8 +120,6 @@ def setup_parameters_FFT():
122120
description = dict()
123121
description['problem_class'] = allencahn2d_imex # pass problem class
124122
description['problem_params'] = problem_params # pass problem parameters
125-
description['dtype_u'] = mesh # pass data type for u
126-
description['dtype_f'] = rhs_imex_mesh # pass data type for f
127123
description['sweeper_class'] = imex_1st_order # pass sweeper (see part B)
128124
description['sweeper_params'] = sweeper_params # pass sweeper parameters
129125
description['level_params'] = level_params # pass level parameters

pySDC/playgrounds/Boris/penningtrap_playground.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ def main():
4848
description = dict()
4949
description['problem_class'] = penningtrap
5050
description['problem_params'] = problem_params
51-
description['dtype_u'] = particles
52-
description['dtype_f'] = fields
5351
description['sweeper_class'] = boris_2nd_order
5452
description['sweeper_params'] = sweeper_params
5553
description['level_params'] = level_params

pySDC/playgrounds/Boris/spiraling_particle_ProblemClass.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11

22
import numpy as np
33

4-
from pySDC.core.Problem import ptype
54
from pySDC.implementations.datatype_classes.particles import particles, fields, acceleration
65

6+
from pySDC.core.Problem import ptype
77

88
class planewave_single(ptype):
99
"""
1010
Example implementing a single particle spiraling in a trap
1111
"""
1212

13-
def __init__(self, cparams, dtype_u, dtype_f):
13+
def __init__(self, cparams, dtype_u=particles, dtype_f=fields):
1414
"""
1515
Initialization routine
1616
1717
Args:
1818
cparams: custom parameters for the example
1919
dtype_u: particle data type (will be passed parent class)
20-
dtype_f: acceleration data type (will be passed parent class)
20+
dtype_f: fields data type (will be passed parent class)
2121
"""
2222

2323
# these parameters will be used later, so assert their existence
@@ -45,7 +45,7 @@ def eval_f(self, part, t):
4545
E and B field for the particle (external only)
4646
"""
4747

48-
f = fields((3, self.nparts))
48+
f = self.dtype_f((3, self.nparts))
4949

5050
R = np.linalg.norm(part.pos.values[:, 0], 2)
5151
f.elec.values[0, 0] = self.params.a0 / (R ** 3) * part.pos.values[0, 0]
@@ -68,7 +68,7 @@ def u_init(self):
6868

6969
u0 = self.params.u0
7070
# some abbreviations
71-
u = particles((3, 1))
71+
u = self.dtype_u((3, 1))
7272

7373
u.pos.values[0, 0] = u0[0][0]
7474
u.pos.values[1, 0] = u0[0][1]

pySDC/playgrounds/Boris/spiraling_particle_playground.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ def main(dt, Tend):
4444
description = dict()
4545
description['problem_class'] = planewave_single
4646
description['problem_params'] = problem_params
47-
description['dtype_u'] = particles
48-
description['dtype_f'] = fields
4947
description['sweeper_class'] = boris_2nd_order
5048
description['sweeper_params'] = sweeper_params
5149
description['level_params'] = level_params

pySDC/playgrounds/FEniCS/heat_equation_M.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
description = dict()
4848
description['problem_class'] = fenics_heat_mass
4949
description['problem_params'] = problem_params
50-
description['dtype_u'] = fenics_mesh
51-
description['dtype_f'] = rhs_fenics_mesh
5250
description['sweeper_class'] = imex_1st_order_mass
5351
description['sweeper_params'] = sweeper_params
5452
description['level_params'] = level_params

pySDC/playgrounds/FEniCS/heat_equation_Minv.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
description = dict()
4646
description['problem_class'] = fenics_heat
4747
description['problem_params'] = problem_params
48-
description['dtype_u'] = fenics_mesh
49-
description['dtype_f'] = rhs_fenics_mesh
5048
description['sweeper_class'] = imex_1st_order # pass sweeper (see part B)
5149
description['sweeper_params'] = sweeper_params # pass sweeper parameters
5250
description['level_params'] = level_params # pass level parameters

0 commit comments

Comments
 (0)