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 