DOLFIN User Manual - FEniCS Project
DOLFIN User Manual - FEniCS Project DOLFIN User Manual - FEniCS Project
DOLFIN User ManualHoffman, Jansson, Logg, Wellsother tensor only involving integration of products of basis functions andtheir derivatives over the reference element.For efficiency in the computation of the element matrices and vectors, FFCprecomputes the tensors that are independent of the geometry of a certaincell.7.6 Assemble matrices and vectorsThe class FEM automates the assembly algorithm, constructing a linear systemof equations from a PDE, given in the form of a variational problem (7.2),with a bilinear form a(·, ·) and a linear form L(·).The classes BilinearForm and LinearForm are automatically generated byFFC, and to assemble the corresponding matrix and vector for the Poissonproblem (7.2) with source term f, we write:Poisson::BilinearForm a;Poisson::LinearForm L(f);Mesh mesh;Mat A;Vec b;FEM::assemble(a,L,A,b,mesh);In the assemble() function the element matrices and vectors are computedby calling the function eval() in the classes Bilinearform and Linearform.The eval() functions at a certain element in the assembly algorithm take asargument an AffineMap object, describing the mapping from the referenceelement to the actual element, by computing the Jacobian J of the mapping(also J −1 and det(J) are computed).48
DOLFIN User ManualHoffman, Jansson, Logg, Wells7.7 Specifying boundary conditions and dataThe boundary conditions are specified by defining a new subclass of the classBoundaryCondition, which we here will name MyBC:class MyBC : public BoundaryCondition{const BoundaryValue operator() (const Point& p){BoundaryValue value;if ( std::abs(p.x - 0.0) < DOLFIN_EPS ) value = 0.0;if ( std::abs(p.x - 1.0) < DOLFIN_EPS ) value = 0.0;if ( std::abs(p.y - 0.0) < DOLFIN_EPS ) value = 0.0;if ( std::abs(p.y - 1.0) < DOLFIN_EPS ) value = 0.0;if ( std::abs(p.z - 0.0) < DOLFIN_EPS ) value = 0.0;if ( std::abs(p.z - 1.0) < DOLFIN_EPS ) value = 0.0;return value;}};where we have assumed homogeneous Dirichlet boundary conditions for theunit cube. We only need to specify the boundary conditions explicitly onthe Dirichlet boundary. On the remaining part of the boundary, homogeneousNeumann boundary conditions are automatically imposed weakly bythe variational form.The boundary conditions are then imposed as an argument to the assemble()function:MyBC bc;FEM::assemble(a,L,A,b,mesh,bc);There is currently no easy way to impose non-homogeneous Neumann boundaryconditions or other combinations of boundary conditions. This will beadded to a future release of DOLFIN.49
- Page 1 and 2: DOLFIN User ManualFebruary 24, 2006
- Page 3 and 4: ContentsAbout this manual 91 Introd
- Page 5 and 6: DOLFIN User ManualHoffman, Jansson,
- Page 7: DOLFIN User ManualHoffman, Jansson,
- Page 12 and 13: DOLFIN User ManualHoffman, Jansson,
- Page 14 and 15: DOLFIN User ManualHoffman, Jansson,
- Page 16 and 17: DOLFIN User ManualHoffman, Jansson,
- Page 18 and 19: DOLFIN User ManualHoffman, Jansson,
- Page 20 and 21: DOLFIN User ManualHoffman, Jansson,
- Page 22 and 23: DOLFIN User ManualHoffman, Jansson,
- Page 25 and 26: Chapter 3Linear algebra◮ Develope
- Page 27 and 28: DOLFIN User ManualHoffman, Jansson,
- Page 29 and 30: Chapter 4The mesh◮ Developer’s
- Page 31 and 32: DOLFIN User ManualHoffman, Jansson,
- Page 33 and 34: Chapter 5Functions◮ Developer’s
- Page 35 and 36: DOLFIN User ManualHoffman, Jansson,
- Page 37 and 38: DOLFIN User ManualHoffman, Jansson,
- Page 39 and 40: DOLFIN User ManualHoffman, Jansson,
- Page 41 and 42: DOLFIN User ManualHoffman, Jansson,
- Page 43: Chapter 6Ordinary differential equa
- Page 46 and 47: DOLFIN User ManualHoffman, Jansson,
- Page 50 and 51: DOLFIN User ManualHoffman, Jansson,
- Page 53 and 54: Chapter 8Nonlinear solver◮ Develo
- Page 55: DOLFIN User ManualHoffman, Jansson,
- Page 58 and 59: DOLFIN User ManualHoffman, Jansson,
- Page 60 and 61: DOLFIN User ManualHoffman, Jansson,
- Page 62 and 63: DOLFIN User ManualHoffman, Jansson,
- Page 65 and 66: Chapter 10The log systemDOLFIN prov
- Page 67 and 68: DOLFIN User ManualHoffman, Jansson,
- Page 69 and 70: DOLFIN User ManualHoffman, Jansson,
- Page 71: DOLFIN User ManualHoffman, Jansson,
- Page 74 and 75: DOLFIN User ManualHoffman, Jansson,
- Page 76 and 77: DOLFIN User ManualHoffman, Jansson,
- Page 78 and 79: DOLFIN User ManualHoffman, Jansson,
- Page 80 and 81: DOLFIN User ManualHoffman, Jansson,
- Page 82 and 83: DOLFIN User ManualHoffman, Jansson,
- Page 85: Bibliography[1] Cygwin, 2005. http:
- Page 88 and 89: v 2 v 0 = (0, 0)DOLFIN User ManualH
- Page 90 and 91: DOLFIN User ManualHoffman, Jansson,
- Page 92 and 93: DOLFIN User ManualHoffman, Jansson,
- Page 94 and 95: DOLFIN User ManualHoffman, Jansson,
- Page 96 and 97: DOLFIN User ManualHoffman, Jansson,
<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wells7.7 Specifying boundary conditions and dataThe boundary conditions are specified by defining a new subclass of the classBoundaryCondition, which we here will name MyBC:class MyBC : public BoundaryCondition{const BoundaryValue operator() (const Point& p){BoundaryValue value;if ( std::abs(p.x - 0.0) < <strong>DOLFIN</strong>_EPS ) value = 0.0;if ( std::abs(p.x - 1.0) < <strong>DOLFIN</strong>_EPS ) value = 0.0;if ( std::abs(p.y - 0.0) < <strong>DOLFIN</strong>_EPS ) value = 0.0;if ( std::abs(p.y - 1.0) < <strong>DOLFIN</strong>_EPS ) value = 0.0;if ( std::abs(p.z - 0.0) < <strong>DOLFIN</strong>_EPS ) value = 0.0;if ( std::abs(p.z - 1.0) < <strong>DOLFIN</strong>_EPS ) value = 0.0;return value;}};where we have assumed homogeneous Dirichlet boundary conditions for theunit cube. We only need to specify the boundary conditions explicitly onthe Dirichlet boundary. On the remaining part of the boundary, homogeneousNeumann boundary conditions are automatically imposed weakly bythe variational form.The boundary conditions are then imposed as an argument to the assemble()function:MyBC bc;FEM::assemble(a,L,A,b,mesh,bc);There is currently no easy way to impose non-homogeneous Neumann boundaryconditions or other combinations of boundary conditions. This will beadded to a future release of <strong>DOLFIN</strong>.49