@@ -1333,33 +1333,14 @@ class TestMPI:
13331333 (257 , 28.67050632840985 )
13341334 ])
13351335 @skipif ('petsc' )
1336- @pytest .mark .parallel (mode = [1 , 2 , 4 , 8 ])
1336+ @pytest .mark .parallel (mode = [2 , 4 , 8 ])
13371337 def test_laplacian_1d (self , nx , unorm , mode ):
13381338 """
13391339 """
13401340 configuration ['compiler' ] = 'custom'
13411341 os .environ ['CC' ] = 'mpicc'
13421342 PetscInitialize ()
13431343
1344- # class SubLeft(SubDomain):
1345- # name = 'subleft'
1346-
1347- # def define(self, dimensions):
1348- # x, = dimensions
1349- # return {x: ('left', 1)}
1350-
1351- # class SubRight(SubDomain):
1352- # name = 'subright'
1353-
1354- # def define(self, dimensions):
1355- # x, = dimensions
1356- # return {x: ('right', 1)}
1357-
1358- # grid = Grid(shape=(nx,), dtype=np.float64)
1359-
1360- # sub1 = SubLeft(grid=grid)
1361- # sub2 = SubRight(grid=grid)
1362-
13631344 class SubSide (SubDomain ):
13641345 def __init__ (self , side = 'left' , grid = None ):
13651346 self .side = side
@@ -1375,19 +1356,18 @@ def define(self, dimensions):
13751356
13761357 u = Function (name = 'u' , grid = grid , space_order = 2 )
13771358 f = Function (name = 'f' , grid = grid , space_order = 2 )
1378- bc = Function (name = 'bc' , grid = grid , space_order = 2 )
1359+
1360+ u0 = Constant (name = 'u0' , value = - 1.0 , dtype = np .float64 )
1361+ u1 = Constant (name = 'u1' , value = - np .exp (1.0 ), dtype = np .float64 )
13791362
13801363 eqn = Eq (- u .laplace , f , subdomain = grid .interior )
13811364
13821365 X = np .linspace (0 , 1.0 , nx ).astype (np .float64 )
13831366 f .data [:] = np .float64 (np .exp (X ))
13841367
1385- bc .data [0 ] = - np .float64 (1.0 ) # u(0) = -1
1386- bc .data [- 1 ] = - np .float64 (np .exp (1.0 )) # u(1) = -e
1387-
13881368 # Create boundary condition expressions using subdomains
1389- bcs = [EssentialBC (u , bc , subdomain = sub1 )]
1390- bcs += [EssentialBC (u , bc , subdomain = sub2 )]
1369+ bcs = [EssentialBC (u , u0 , subdomain = sub1 )]
1370+ bcs += [EssentialBC (u , u1 , subdomain = sub2 )]
13911371
13921372 petsc = PETScSolve ([eqn ] + bcs , target = u , solver_parameters = {'ksp_rtol' : 1e-10 })
13931373
0 commit comments