SundanceNitscheBC.cpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #include "SundanceNitscheBC.hpp"
00032 #include "SundanceIntegral.hpp"
00033 #include "SundanceCellFilter.hpp"
00034 #include "SundanceQuadratureFamily.hpp"
00035 #include "SundanceVectorCalculus.hpp"
00036 #include "SundanceCellVectorExpr.hpp"
00037 #include "SundanceCellDiameterExpr.hpp"
00038 
00039 namespace Sundance
00040 {
00041 
00042 Expr NitschePoissonDirichletBC(int dim,
00043   const CellFilter& cells,
00044   const QuadratureFamily& quad,
00045   const Expr& kappa,
00046   const Expr& v,
00047   const Expr& u,
00048   const Expr& uBC,
00049   const double& gamma)
00050 {
00051   Expr grad = gradient(dim);
00052   Expr n = CellNormalExpr(dim,"n");
00053   Expr h = new CellDiameterExpr();
00054 
00055   return Integral(cells, -kappa*(v*((n*grad)*u) + (u-uBC)*((n*grad)*v))
00056     + gamma/h * v*(u-uBC), quad);
00057 }
00058 
00059 Expr NitscheStokesNoSlipBC(const CellFilter& cells,
00060   const QuadratureFamily& quad,
00061   const Expr& nu,
00062   const Expr& v,
00063   const Expr& q,
00064   const Expr& u,
00065   const Expr& p,
00066   const Expr& uBC,
00067   const double& gamma1,
00068   const double& gamma2
00069   )
00070 {
00071   TEUCHOS_TEST_FOR_EXCEPT(nu.size() != 1);
00072   TEUCHOS_TEST_FOR_EXCEPT(v.size() != u.size());
00073   TEUCHOS_TEST_FOR_EXCEPT(uBC.size() != u.size());
00074 
00075   int dim = uBC.size();
00076 
00077   Expr grad = gradient(dim);
00078   Expr n = CellNormalExpr(dim,"n");
00079   Expr h = new CellDiameterExpr();
00080   
00081   return Integral(cells,
00082     -nu*(v*((n*grad)*u /*- (n*grad)*uBC*/) + (u-uBC)*((n*grad)*v))
00083     + p*(v*n) + q*((u-uBC)*n)
00084     + gamma1/h * v*(u-uBC) + gamma2/h * (v*n) * ((u-uBC)*n),
00085     quad);
00086 }
00087 
00088 
00089 
00090 }

Site Contact