scalar_advection_elements.cc
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Version 1.0; svn revision $LastChangedRevision: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Non-inline member function of the flux transport elements class
31 
33 
34 namespace oomph
35 {
36  //=========================================================
37  /// \short Return the flux as a function of the unknowns
38  //=========================================================
39  template<unsigned DIM>
42  {
43  //Get the wind
44  Vector<double> W(DIM);
45  Vector<double> s(DIM), x(DIM);
46  //Dummy integration point
47  unsigned ipt=0;
48  this->get_wind_scalar_adv(ipt,s,x,W);
49 
50  //Flux is the wind multiplied by the flux
51  for(unsigned j=0;j<DIM;j++) {f(0,j) = W[j]*u[0];}
52  }
53 
54  //======================================================================
55  /// \short Return the flux derivatives as a function of the unknowns
56  //=====================================================================
57  template<unsigned DIM>
60  {
61  const unsigned n_flux = this->nflux();
62 
63  //Get the wind
64  Vector<double> W(DIM);
65  Vector<double> s(DIM), x(DIM);
66  //Dummy integration point
67  unsigned ipt=0;
68  this->get_wind_scalar_adv(ipt,s,x,W);
69 
70  df_du.initialise(0.0);
71 
72  for(unsigned i=0;i<n_flux;i++)
73  {
74  for(unsigned j=0;j<DIM;j++)
75  {
76  df_du(i,j,i) = W[j];
77  }
78  }
79  }
80 
81  template class ScalarAdvectionEquations<1>;
82  template class ScalarAdvectionEquations<2>;
83  template class ScalarAdvectionEquations<3>;
84 
85 }
void flux(const Vector< double > &u, DenseMatrix< double > &f)
Return the flux as a function of the unknown.
void initialise(const T &val)
Initialise all values in the tensor to val.
Definition: matrices.h:1581
cstr elem_len * i
Definition: cfortran.h:607
A Rank 3 Tensor class.
Definition: matrices.h:1337
static char t char * s
Definition: cfortran.h:572
Base class for advection equations.
void dflux_du(const Vector< double > &u, RankThreeTensor< double > &df_du)
Return the flux derivatives as a function of the unknowns.