191{
192
193
194
195 libmesh_assert_equal_to (system_name, "Poisson");
196
197
199
200
202
203
205
206
207
208
209
211
212
213
214 FEType fe_type = dof_map.variable_type(0);
215
216
217
218
219
220
221
223
224
226
227
228 fe->attach_quadrature_rule (&qrule);
229
230
231
233
234
235
236
238
239
240
241 fe_face->attach_quadrature_rule (&qface);
242
243
244
245
246
247 const std::vector<Real> & JxW = fe->get_JxW();
248
249
250
251
252 const std::vector<Point> & q_point = fe->get_xyz();
253
254
255 const std::vector<std::vector<Real>> & phi = fe->get_phi();
256
257
258
259 const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
260
261
262
263
264
265
266
269
270
271
272
273 std::vector<dof_id_type> dof_indices;
274
275
277
278 auto & pre_matrix = system.
get_matrix(
"preconditioner");
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293 for (
const auto & elem :
mesh.active_local_element_ptr_range())
294 {
295
296
297
298
299 dof_map.dof_indices (elem, dof_indices);
300
301
302
303
304
305
306 const unsigned int n_dofs =
307 cast_int<unsigned int>(dof_indices.size());
308
309
310
311
312
313 fe->reinit (elem);
314
315
316
317 libmesh_assert_equal_to (n_dofs, phi.size());
318
319
320
321
322
323
324
325
326
327
328 Ke.
resize (n_dofs, n_dofs);
329
331
332
333
334 for (unsigned int qp=0; qp<qrule.n_points(); qp++)
335 {
336
337
338
339
340 for (unsigned int i=0; i != n_dofs; i++)
341 for (unsigned int j=0; j != n_dofs; j++)
342 {
343 Ke(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);
344 }
345
346
347
348
349
350 {
351 const Real x = q_point[qp](0);
352 const Real y = q_point[qp](1);
353 const Real eps = 1.e-3;
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
375
376 for (unsigned int i=0; i != n_dofs; i++)
377 Fe(i) += JxW[qp]*fxy*phi[i][qp];
378 }
379 }
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411 {
412
413
414
415
416 for (auto side : elem->side_index_range())
417 if (elem->neighbor_ptr(side) == nullptr)
418 {
419
420
421 const std::vector<std::vector<Real>> & phi_face = fe_face->get_phi();
422
423
424
425 const std::vector<Real> & JxW_face = fe_face->get_JxW();
426
427
428
429
430 const std::vector<Point> & qface_point = fe_face->get_xyz();
431
432
433
434 fe_face->reinit(elem, side);
435
436
437
438
439 libmesh_assert_equal_to (n_dofs, phi_face.size());
440
441
442 for (unsigned int qp=0; qp<qface.n_points(); qp++)
443 {
444
445
446 const Real xf = qface_point[qp](0);
447 const Real yf = qface_point[qp](1);
448
449
450
451 const Real penalty = 1.e10;
452
453
455
456
457 for (unsigned int i=0; i != n_dofs; i++)
458 for (unsigned int j=0; j != n_dofs; j++)
459 Ke(i,j) += JxW_face[qp]*penalty*phi_face[i][qp]*phi_face[j][qp];
460
461
462
463 for (unsigned int i=0; i != n_dofs; i++)
464 Fe(i) += JxW_face[qp]*penalty*
value*phi_face[i][qp];
465 }
466 }
467 }
468
469
470
471
472
473
474 dof_map.constrain_element_matrix_and_vector (Ke, Fe, dof_indices);
475
476
477
478
479
481 pre_matrix.add_matrix(Ke, dof_indices);
483 }
484
485
486}
Number(* exact_solution)(const Point &p, const Parameters &, const std::string &, const std::string &)
Defines a dense matrix for use in Finite Element-type computations.
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Defines a dense vector for use in Finite Element-type computations.
void resize(const unsigned int n)
Resize the vector.
This class handles the numbering of degrees of freedom on a mesh.
const MeshBase & get_mesh() const
const T_sys & get_system(std::string_view name) const
NumericVector< Number > * rhs
The system matrix.
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
const SparseMatrix< Number > & get_system_matrix() const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
This is the MeshBase class.
unsigned int mesh_dimension() const
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
This class implements specific orders of Gauss quadrature.
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix.
const SparseMatrix< Number > & get_matrix(std::string_view mat_name) const
const DofMap & get_dof_map() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real