tensor_tools.C
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 #include "libmesh/tensor_tools.h" 00019 #include "libmesh/vector_value.h" 00020 #include "libmesh/tensor_value.h" 00021 #include "libmesh/type_n_tensor.h" 00022 00023 namespace libMesh 00024 { 00025 namespace TensorTools 00026 { 00027 // Needed for ExactSolution to compile 00028 Number curl_from_grad( const VectorValue<Number>& ) 00029 { 00030 libMesh::err << "Operation not defined for scalar quantities." << std::endl; 00031 libmesh_error(); 00032 } 00033 00034 VectorValue<Number> curl_from_grad( const TensorValue<Number>& grad ) 00035 { 00036 const Number duz_dy = grad(2,1); 00037 const Number duy_dz = grad(1,2); 00038 const Number dux_dz = grad(0,2); 00039 const Number duz_dx = grad(2,0); 00040 const Number duy_dx = grad(1,0); 00041 const Number dux_dy = grad(0,1); 00042 00043 return VectorValue<Number>( duz_dy - duy_dz, dux_dz - duz_dx, duy_dx - dux_dy); 00044 } 00045 00046 // Needed for ExactSolution to compile. Will implement when needed. 00047 TensorValue<Number> curl_from_grad( const TypeNTensor<3,Number>& /* grad */ ) 00048 { 00049 libmesh_not_implemented(); 00050 } 00051 00052 // Needed for ExactSolution to compile 00053 Number div_from_grad( const VectorValue<Number>& /* grad */ ) 00054 { 00055 libMesh::err << "Operation not defined for scalar quantities." << std::endl; 00056 libmesh_error(); 00057 } 00058 00059 Number div_from_grad( const TensorValue<Number>& grad ) 00060 { 00061 const Number dux_dx = grad(0,0); 00062 const Number duy_dy = grad(1,1); 00063 const Number duz_dz = grad(2,2); 00064 00065 return dux_dx + duy_dy + duz_dz; 00066 } 00067 00068 // Needed for ExactSolution to compile. Will implement when needed. 00069 VectorValue<Number> div_from_grad( const TypeNTensor<3,Number>& /* grad */ ) 00070 { 00071 libmesh_not_implemented(); 00072 } 00073 00074 } 00075 }
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:49 UTC
Hosted By: