Hi developers and users,

Can I set neumann/natural BC to my square model? I have gone through all 
examples, which all set the Dirichlet BC. except the ex15(Biharmonic 
Equation). There is a flux boundary condition in ex15 because of the 
4th-order PDE, so May I just take the 'Gradient flux' idea then apply it 
to my 2nd-order PDE? Thanks!

 Liang


copied from ex15 B.C. part:

{
        perf_log.start_event (*"BCs"*);
  
        *const* Real penalty = 1e10;
        *const* Real penalty2 = 1e10;
  
        *for* (*unsigned* *int* s=0; s<elem->n_sides(); s++)
          *if* (elem->neighbor(s) == NULL)
            {
              *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>& face_normals =
                              fe_face->get_normals();
  
                fe_face->reinit(elem, s);
                                                                                
  
                *for* (*unsigned* *int* qp=0; qp<qface->n_points(); qp++)
                  {
                  Number value = exact_solution(qface_point[qp],
                                                es.parameters, *"null"*,
                                                *"void"*);
                  Gradient flux = exact_2D_derivative(qface_point[qp],
                                                        es.parameters,
                                                      *"null"*, *"void"*);
  
                    *for* (*unsigned* *int* i=0; i<phi_face.size(); i++)
                      *for* (*unsigned* *int* j=0; j<phi_face.size(); j++)
                      Ke(i,j) += JxW_face[qp] *
                                 (penalty * phi_face[i][qp] *
                                  phi_face[j][qp] + penalty2
                                  * (dphi_face[i][qp] *
                                  face_normals[qp]) *
                                  (dphi_face[j][qp] *
                                   face_normals[qp]));
  
                    *for* (*unsigned* *int* i=0; i<phi_face.size(); i++)
                      Fe(i) += JxW_face[qp] *
                                    (penalty * value * phi_face[i][qp]
                                     + penalty2 * 
                                     (flux * face_normals[qp])
                                    * (dphi_face[i][qp]
                                       * face_normals[qp]));
  
                  }
            } 
        
        perf_log.stop_event (*"BCs"*);
        } 



------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to