File tree 7 files changed +82
-70
lines changed
4108f87eb9b678931168ffba26e2c302
9561cf6cd1a70079b986f4eb31580cbd
9ed4657d08dda04de30e6463e2f58d75
7 files changed +82
-70
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ <h3>Weak formulation<a class="headerlink" href="#weak-formulation" title="Link t
135
135
\forall \ K \in \mathcal{T} \right\}
136
136
\]</ div >
137
137
< p > and considering the boundary conditions</ p >
138
- < div class ="amsmath math notranslate nohighlight " id ="equation-46dc1b42-6e2f-4e54-9a6c-e8cdbc7e69ee ">
139
- < span class ="eqno "> (1)< a class ="headerlink " href ="#equation-46dc1b42-6e2f-4e54-9a6c-e8cdbc7e69ee " title ="Permalink to this equation "> </ a > </ span > \[\begin{align}
138
+ < div class ="amsmath math notranslate nohighlight " id ="equation-4645999e-9631-4a07-a981-facbeb708596 ">
139
+ < span class ="eqno "> (1)< a class ="headerlink " href ="#equation-4645999e-9631-4a07-a981-facbeb708596 " title ="Permalink to this equation "> </ a > </ span > \[\begin{align}
140
140
u &= 0 \quad {\rm on} \ \partial\Omega, \\
141
141
\nabla^{2} u &= 0 \quad {\rm on} \ \partial\Omega,
142
142
\end{align}\]</ div >
Original file line number Diff line number Diff line change 376
376
reason = ksp .getConvergedReason ()
377
377
assert reason > 0 , f"Krylov solver has not converged { reason } ."
378
378
ksp .view ()
379
+
380
+ sigma .x .scatter_forward ()
381
+ u .x .scatter_forward ()
379
382
# -
380
383
381
384
# We save the solution `u` in VTX format:
Original file line number Diff line number Diff line change 2
2
"cells" : [
3
3
{
4
4
"cell_type" : " markdown" ,
5
- "id" : " 6d0de063 " ,
5
+ "id" : " 09e1e263 " ,
6
6
"metadata" : {},
7
7
"source" : [
8
8
" # Matrix-free conjugate gradient solver for the Poisson equation\n " ,
73
73
{
74
74
"cell_type" : " code" ,
75
75
"execution_count" : null ,
76
- "id" : " 633f21a3 " ,
76
+ "id" : " 2f8640b8 " ,
77
77
"metadata" : {},
78
78
"outputs" : [],
79
79
"source" : [
83
83
{
84
84
"cell_type" : " code" ,
85
85
"execution_count" : null ,
86
- "id" : " 77d44a81 " ,
86
+ "id" : " 13e718b0 " ,
87
87
"metadata" : {},
88
88
"outputs" : [],
89
89
"source" : [
93
93
{
94
94
"cell_type" : " code" ,
95
95
"execution_count" : null ,
96
- "id" : " c350213f " ,
96
+ "id" : " 615215ca " ,
97
97
"metadata" : {},
98
98
"outputs" : [],
99
99
"source" : [
104
104
},
105
105
{
106
106
"cell_type" : " markdown" ,
107
- "id" : " d2b90a39 " ,
107
+ "id" : " 29c41679 " ,
108
108
"metadata" : {},
109
109
"source" : [
110
110
" We begin by using {py:func}`create_rectangle\n " ,
117
117
{
118
118
"cell_type" : " code" ,
119
119
"execution_count" : null ,
120
- "id" : " ef89e9a2 " ,
120
+ "id" : " 59d9fcb4 " ,
121
121
"metadata" : {},
122
122
"outputs" : [],
123
123
"source" : [
130
130
{
131
131
"cell_type" : " code" ,
132
132
"execution_count" : null ,
133
- "id" : " 05ab025a " ,
133
+ "id" : " 23d7d3cf " ,
134
134
"metadata" : {},
135
135
"outputs" : [],
136
136
"source" : [
141
141
},
142
142
{
143
143
"cell_type" : " markdown" ,
144
- "id" : " 4973aa5c " ,
144
+ "id" : " 2cb5311d " ,
145
145
"metadata" : {},
146
146
"source" : [
147
147
" The second argument to {py:class}`functionspace\n " ,
160
160
{
161
161
"cell_type" : " code" ,
162
162
"execution_count" : null ,
163
- "id" : " 75da6849 " ,
163
+ "id" : " 16f3a3b8 " ,
164
164
"metadata" : {},
165
165
"outputs" : [],
166
166
"source" : [
171
171
},
172
172
{
173
173
"cell_type" : " markdown" ,
174
- "id" : " 0ba60b91 " ,
174
+ "id" : " 6a579079 " ,
175
175
"metadata" : {},
176
176
"source" : [
177
177
" We now find the degrees of freedom that are associated with the boundary\n " ,
182
182
{
183
183
"cell_type" : " code" ,
184
184
"execution_count" : null ,
185
- "id" : " e22d9aff " ,
185
+ "id" : " cfa4e800 " ,
186
186
"metadata" : {},
187
187
"outputs" : [],
188
188
"source" : [
191
191
},
192
192
{
193
193
"cell_type" : " markdown" ,
194
- "id" : " 8cc5bd5f " ,
194
+ "id" : " e467d0cd " ,
195
195
"metadata" : {},
196
196
"source" : [
197
197
" and use {py:func}`dirichletbc <dolfinx.fem.dirichletbc>` to define the\n " ,
204
204
{
205
205
"cell_type" : " code" ,
206
206
"execution_count" : null ,
207
- "id" : " 0417e4e1 " ,
207
+ "id" : " 01c64818 " ,
208
208
"metadata" : {},
209
209
"outputs" : [],
210
210
"source" : [
215
215
},
216
216
{
217
217
"cell_type" : " markdown" ,
218
- "id" : " 0f5dcdab " ,
218
+ "id" : " c4118571 " ,
219
219
"metadata" : {},
220
220
"source" : [
221
221
" Next, we express the variational problem using UFL."
224
224
{
225
225
"cell_type" : " code" ,
226
226
"execution_count" : null ,
227
- "id" : " 8e75993b " ,
227
+ "id" : " 5b28ea99 " ,
228
228
"metadata" : {},
229
229
"outputs" : [],
230
230
"source" : [
239
239
},
240
240
{
241
241
"cell_type" : " markdown" ,
242
- "id" : " 491ba0a7 " ,
242
+ "id" : " 03d2c7b3 " ,
243
243
"metadata" : {},
244
244
"source" : [
245
245
" For the matrix-free solvers we also define a second linear form `M` as\n " ,
255
255
{
256
256
"cell_type" : " code" ,
257
257
"execution_count" : null ,
258
- "id" : " e9dcce17 " ,
258
+ "id" : " 8d9d214e " ,
259
259
"metadata" : {},
260
260
"outputs" : [],
261
261
"source" : [
266
266
},
267
267
{
268
268
"cell_type" : " markdown" ,
269
- "id" : " b2554be0 " ,
269
+ "id" : " 25683822 " ,
270
270
"metadata" : {},
271
271
"source" : [
272
272
" ### Matrix-free conjugate gradient solver\n " ,
280
280
{
281
281
"cell_type" : " code" ,
282
282
"execution_count" : null ,
283
- "id" : " cb7604ba " ,
283
+ "id" : " c89a4652 " ,
284
284
"metadata" : {},
285
285
"outputs" : [],
286
286
"source" : [
295
295
{
296
296
"cell_type" : " code" ,
297
297
"execution_count" : null ,
298
- "id" : " ffdcdc3d " ,
298
+ "id" : " 66a71f44 " ,
299
299
"metadata" : {},
300
300
"outputs" : [],
301
301
"source" : [
306
306
},
307
307
{
308
308
"cell_type" : " markdown" ,
309
- "id" : " 1392e1d3 " ,
309
+ "id" : " 4e4cddab " ,
310
310
"metadata" : {
311
311
"lines_to_next_cell" : 2
312
312
},
319
319
{
320
320
"cell_type" : " code" ,
321
321
"execution_count" : null ,
322
- "id" : " b8b59727 " ,
322
+ "id" : " aaaf5b9c " ,
323
323
"metadata" : {
324
324
"lines_to_next_cell" : 2
325
325
},
342
342
},
343
343
{
344
344
"cell_type" : " markdown" ,
345
- "id" : " 9f501d90 " ,
345
+ "id" : " 5f984d8a " ,
346
346
"metadata" : {
347
347
"lines_to_next_cell" : 2
348
348
},
358
358
{
359
359
"cell_type" : " code" ,
360
360
"execution_count" : null ,
361
- "id" : " 5bc758ce " ,
361
+ "id" : " 0751935d " ,
362
362
"metadata" : {},
363
363
"outputs" : [],
364
364
"source" : [
404
404
},
405
405
{
406
406
"cell_type" : " markdown" ,
407
- "id" : " 6a58bc16 " ,
407
+ "id" : " b1f812a2 " ,
408
408
"metadata" : {},
409
409
"source" : [
410
410
" This matrix-free solver is now used to compute the finite element\n " ,
415
415
{
416
416
"cell_type" : " code" ,
417
417
"execution_count" : null ,
418
- "id" : " 030fd6bf " ,
418
+ "id" : " 5faa3342 " ,
419
419
"metadata" : {},
420
420
"outputs" : [],
421
421
"source" : [
427
427
{
428
428
"cell_type" : " code" ,
429
429
"execution_count" : null ,
430
- "id" : " 4a61a258 " ,
430
+ "id" : " 4d1b614d " ,
431
431
"metadata" : {},
432
432
"outputs" : [],
433
433
"source" : [
438
438
{
439
439
"cell_type" : " code" ,
440
440
"execution_count" : null ,
441
- "id" : " 88c02771 " ,
441
+ "id" : " 3a20d761 " ,
442
442
"metadata" : {},
443
443
"outputs" : [],
444
444
"source" : [
450
450
{
451
451
"cell_type" : " code" ,
452
452
"execution_count" : null ,
453
- "id" : " c09de5fd " ,
453
+ "id" : " 495faaa8 " ,
454
454
"metadata" : {},
455
455
"outputs" : [],
456
456
"source" : [
You can’t perform that action at this time.
0 commit comments