1+
2+ from pySDC import CollocationClasses as collclass
3+
4+ import numpy as np
5+
6+ from ProblemClass_conv import acoustic_1d_imex
7+ from examples .acoustic_1d_imex .HookClass import plot_solution
8+
9+ from pySDC .datatype_classes .mesh import mesh , rhs_imex_mesh
10+ from pySDC .sweeper_classes .imex_1st_order import imex_1st_order
11+ import pySDC .PFASST_stepwise as mp
12+ from pySDC import Log
13+ from pySDC .Stats import grep_stats , sort_stats
14+
15+ from matplotlib import pyplot as plt
16+
17+
18+ if __name__ == "__main__" :
19+
20+ # set global logger (remove this if you do not want the output at all)
21+ logger = Log .setup_custom_logger ('root' )
22+
23+ num_procs = 1
24+
25+ # This comes as read-in for the level class
26+ lparams = {}
27+ lparams ['restol' ] = 1E-14
28+
29+ sparams = {}
30+
31+
32+ # This comes as read-in for the problem class
33+ pparams = {}
34+ pparams ['nvars' ] = [(2 ,250 )]
35+ pparams ['cadv' ] = 0.05
36+ pparams ['cs' ] = 5.0
37+ pparams ['order_adv' ] = 5
38+ pparams ['waveno' ] = 1
39+
40+ # This comes as read-in for the transfer operations
41+ tparams = {}
42+ tparams ['finter' ] = True
43+
44+ # Fill description dictionary for easy hierarchy creation
45+ description = {}
46+ description ['problem_class' ] = acoustic_1d_imex
47+ description ['problem_params' ] = pparams
48+ description ['dtype_u' ] = mesh
49+ description ['dtype_f' ] = rhs_imex_mesh
50+ description ['collocation_class' ] = collclass .CollGaussLobatto
51+ description ['sweeper_class' ] = imex_1st_order
52+ description ['level_params' ] = lparams
53+ description ['hook_class' ] = plot_solution
54+ #description['transfer_class'] = mesh_to_mesh_1d
55+ #description['transfer_params'] = tparams
56+
57+ for order in [3 ]:
58+
59+ # setup parameters "in time"
60+ t0 = 0
61+ Tend = 0.05
62+
63+ if order == 2 :
64+ description ['num_nodes' ] = 2
65+ elif order == 3 :
66+ description ['num_nodes' ] = 3
67+ elif order == 4 :
68+ description ['num_nodes' ] = 3
69+
70+ sparams ['maxiter' ] = 50
71+
72+ # quickly generate block of steps
73+ MS = mp .generate_steps (num_procs ,sparams ,description )
74+
75+ dt = Tend
76+
77+ # get initial values on finest level
78+ P = MS [0 ].levels [0 ].prob
79+ uinit = P .u_exact (t0 )
80+
81+ # call main function to get things done...
82+ uend ,stats = mp .run_pfasst (MS , u0 = uinit , t0 = t0 , dt = dt , Tend = Tend )
83+
84+ # compute exact solution and compare
85+ uex = P .u_exact (Tend )
0 commit comments