Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 3 : 4 : // This library is free software; you can redistribute it and/or 5 : // modify it under the terms of the GNU Lesser General Public 6 : // License as published by the Free Software Foundation; either 7 : // version 2.1 of the License, or (at your option) any later version. 8 : 9 : // This library is distributed in the hope that it will be useful, 10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 : // Lesser General Public License for more details. 13 : 14 : // You should have received a copy of the GNU Lesser General Public 15 : // License along with this library; if not, write to the Free Software 16 : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 : 18 : #include "libmesh/tensor_tools.h" 19 : #include "libmesh/vector_value.h" 20 : #include "libmesh/tensor_value.h" 21 : #include "libmesh/type_n_tensor.h" 22 : 23 : namespace libMesh 24 : { 25 : namespace TensorTools 26 : { 27 : // Needed for ExactSolution to compile 28 0 : Number curl_from_grad(const VectorValue<Number> &) 29 : { 30 0 : libmesh_error_msg("Operation not defined for scalar quantities."); 31 : } 32 : 33 10648428 : VectorValue<Number> curl_from_grad(const TensorValue<Number> & grad) 34 : { 35 10648428 : const Number duz_dy = grad(2,1); 36 10648428 : const Number duy_dz = grad(1,2); 37 10648428 : const Number dux_dz = grad(0,2); 38 10648428 : const Number duz_dx = grad(2,0); 39 10648428 : const Number duy_dx = grad(1,0); 40 10648428 : const Number dux_dy = grad(0,1); 41 : 42 8873690 : return VectorValue<Number>(duz_dy - duy_dz, 43 8873690 : dux_dz - duz_dx, 44 11535797 : duy_dx - dux_dy); 45 : } 46 : 47 : // Needed for ExactSolution to compile. Will implement when needed. 48 0 : TensorValue<Number> curl_from_grad( const TypeNTensor<3,Number> & /* grad */ ) 49 : { 50 0 : libmesh_not_implemented(); 51 : } 52 : 53 : // Needed for ExactSolution to compile 54 0 : Number div_from_grad( const VectorValue<Number> & /* grad */ ) 55 : { 56 0 : libmesh_error_msg("Operation not defined for scalar quantities."); 57 : } 58 : 59 10648428 : Number div_from_grad( const TensorValue<Number> & grad ) 60 : { 61 10648428 : const Number dux_dx = grad(0,0); 62 10648428 : const Number duy_dy = grad(1,1); 63 10648428 : const Number duz_dz = grad(2,2); 64 : 65 10648428 : return dux_dx + duy_dy + duz_dz; 66 : } 67 : 68 : // Needed for ExactSolution to compile. Will implement when needed. 69 0 : VectorValue<Number> div_from_grad( const TypeNTensor<3,Number> & /* grad */ ) 70 : { 71 0 : libmesh_not_implemented(); 72 : } 73 : 74 : } 75 : }