Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Shaoying Lu <sylu@al...>  20040503 22:49:35

Hello, I have the following question. All the examples seem to be using Dirichlet boundary contiion. Is there an example for the Nuemann boudnary condition? Or is there some files that would be really helpful for me to implement a Nuemann BC on the basis of example 4 ( the 3d poisson problem)? Thank you very much for your help! Kathy 
From: Steffen Petersen <steffen.petersen@tu...>  20040504 06:56:03

> Hello, > > I have the following question. All the examples seem to be > using Dirichlet > boundary contiion. Is there an example for the Nuemann > boudnary condition? Or is there some files that would be > really helpful for me to implement a > Nuemann BC on the basis of example 4 ( the 3d poisson problem)? > > Thank you very much for your help! > > Kathy > > Yes, there is an example with Neumann BCs. Have a look at example 7. There, the Helmholtz equation is solved on a [1,1]x[1,1] mesh. In this example Neumann conditions with vn_value=1 (and also Robin/mixed conditions with an_value=1) are applied at all parts of the boundary. Steffen 
From: John Peterson <peterson@cf...>  20040504 01:24:30

Hi, The general technique is to build a finite element on the "face" or "edge" which is on the boundary and perform the integral (with a loop over gauss points, i, and j on the face) which appears in your variational statement. Here is a code fragment // Handle boundary conditions for (unsigned int s=0; s<elem>n_sides(); s++) if (elem>neighbor(s) == NULL) // on the boundary { const unsigned int boundary_id = mesh.boundary_info.boundary_id (elem, s); AutoPtr<FEBase> fe_face (FEBase::build(dim, flow_dof_map.variable_type (u_var))); QGauss qface (dim1, Control::quadrature_order()); fe_face>attach_quadrature_rule (&qface); fe_face>reinit (elem, s); const std::vector<std::vector<Real> >& phi_face = fe_face>get_phi(); const std::vector<std::vector<RealGradient> >& dphi_face = fe_face>get_dphi(); const std::vector<Real>& JxW_face = fe_face>get_JxW(); const std::vector<Point>& qface_point = fe_face>get_xyz(); const std::vector<Point>& normals = fe_face>get_normals(); // ... // T Flux boundary values else if (user>is_neumann_boundary(boundary_id, ((coupled) ? "rbm" : "thermal"), "T")) { for (unsigned int qp=0; qp<qface.n_points(); qp++) { // Extract the value which needs to be imposed for the flux // at each Gauss point. const Real val = user>neumann_boundary_value(qface_point[qp], normals[qp], time, ((coupled) ? "rbm" : "thermal"), "T", boundary_id); // Compute the integration on the face for (unsigned int i=0; i<phi_face.size(); i++) Ft(i) += JxW_face[qp]*val*phi_face[i][qp]; } } } 
From: Shaoying Lu <sylu@al...>  20040504 17:01:37

Thanks for the timely reply of John and Steffen. Your advices are really helpful for me to understand the process of defining Nuemann and mixed BC. In my problem the BC's need to be defined at some given segment of the boundary. Here is a followup question based on John's answer: It seems that the boudary type s decided by a user supplied function, user>is_neumann_boudnary() How would one define 'user' or 'user>is_neumann_boundary'? Any comments will be very welcom! Kathy 
From: John Peterson <peterson@cf...>  20040504 18:37:56

Shaoying Lu writes: > Thanks for the timely reply of John and Steffen. Your advices are really > helpful for me to understand the process of defining Nuemann and mixed BC. > > In my problem the BC's need to be defined at some given segment of the > boundary. Here is a followup question based on John's answer: > > It seems that the boudary type s decided by a user supplied function, > > user>is_neumann_boudnary() > > How would one define 'user' or 'user>is_neumann_boundary'? The "user" is a concept that we used in one of our application codes. Basically, the user must have some apriori knowledge of the problem's boundary conditions to complete the is_neumann_boundary() function. A simple (1D) example is: bool is_neumann_boundary(double x) { if ( fabs(x  1.) < 1.e6) return true; else return false; } In this case, the boundary x=1 is a Neumann boundary, so we take the x location of the current element's node to determine if it is on the flux boundary. A more generic function will use boundary IDs. For example, let's say that boundary id 5 is a Neumann boundary for the temperature (T) variable. Then your function would look like: inline bool is_neumann_boundary(const unsigned short int id, const std::string& , const std::string& var_name) { if ((var_name == "T") && (id == 5)) return true; return false; } The boundary_id's for elements are typically specified by an external mesh generator. Or they can be set manually. Here's the function to obtain a boundary_id for Element side s. const unsigned int boundary_id = mesh.boundary_info.boundary_id (elem, s); Good luck, John 
Sign up for the SourceForge newsletter:
No, thanks