## Re: [Libmesh-users] Boundary Conditions using DiffSystem

 Re: [Libmesh-users] Boundary Conditions using DiffSystem From: Roy Stogner - 2008-08-12 22:59:05 ``` On Tue, 12 Aug 2008, Nasser Mohieddin Abukhdeir wrote: > I'm trying to implement Dirichlet boundary conditions in a 1D > problem using DiffSystem. There isn't really an example to cover this, > so I just want to verify what I came up with makes sense, where two > variables "B" and "lB" should be zero at the domain boundaries x=0,1 > (note, using numerical jacobians for now): At first glance this looks correct, but it may be overkill. It's actually not necessary to do anything special in 1D. You might not think that a 1D element has "sides" that you can integrate over, but in recent (0.6.0 or so?) libMesh versions we now have a "NodeElem" object whose job is to let you do just that: Dirichlet boundary conditions (or any boundary conditions) expressed as quadrature loops on sides now work correctly even when the side is a single point. I'd add a 1D case to example 18 to make this clear, but 1D incompressible flow is so dull that people would wonder why the option was even there. --- Roy ```

 [Libmesh-users] Boundary Conditions using DiffSystem From: Nasser Mohieddin Abukhdeir - 2008-08-12 22:04:06 ```Hi: I'm trying to implement Dirichlet boundary conditions in a 1D problem using DiffSystem. There isn't really an example to cover this, so I just want to verify what I came up with makes sense, where two variables "B" and "lB" should be zero at the domain boundaries x=0,1 (note, using numerical jacobians for now): const Real penalty = 1.e10; if (elem->contains_point(Point(0.,0.))||elem->contains_point(Point(1.,0.))) { for(unsigned int s=0; sn_sides(); s++) { if(elem->neighbor(s) == NULL) { Number B = side_value(B_var, s), lB = side_value(lB_var, s); Real B_value = 0.; Real lB_value = 0.; for (unsigned int i=0; i != n_B_dofs; i++) { F1(i) += JxW_side[s] * penalty * (B - B_value) * phi_side[i][s]; F2(i) += JxW_side[s] * penalty * (lB - lB_value) * phi_side[i][s]; } } } } -- Nasser Mohieddin Abukhdeir Graduate Student (Materials Modeling Research Group) McGill University - Department of Chemical Engineering http://webpages.mcgill.ca/students/nabukh/web/ http://mmrg.chemeng.mcgill.ca/ ```
 Re: [Libmesh-users] Boundary Conditions using DiffSystem From: Roy Stogner - 2008-08-12 22:59:05 ``` On Tue, 12 Aug 2008, Nasser Mohieddin Abukhdeir wrote: > I'm trying to implement Dirichlet boundary conditions in a 1D > problem using DiffSystem. There isn't really an example to cover this, > so I just want to verify what I came up with makes sense, where two > variables "B" and "lB" should be zero at the domain boundaries x=0,1 > (note, using numerical jacobians for now): At first glance this looks correct, but it may be overkill. It's actually not necessary to do anything special in 1D. You might not think that a 1D element has "sides" that you can integrate over, but in recent (0.6.0 or so?) libMesh versions we now have a "NodeElem" object whose job is to let you do just that: Dirichlet boundary conditions (or any boundary conditions) expressed as quadrature loops on sides now work correctly even when the side is a single point. I'd add a 1D case to example 18 to make this clear, but 1D incompressible flow is so dull that people would wonder why the option was even there. --- Roy ```