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// Copyright (C) 2006-2023 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Non-inline member function of the flux transport elements class
27 
29 
30 namespace oomph
31 {
32  //=========================================================
33  /// Return the flux as a function of the unknowns
34  //=========================================================
35  template<unsigned DIM>
38  {
39  // Get the wind
40  Vector<double> W(DIM);
41  Vector<double> s(DIM), x(DIM);
42  // Dummy integration point
43  unsigned ipt = 0;
44  this->get_wind_scalar_adv(ipt, s, x, W);
45 
46  // Flux is the wind multiplied by the flux
47  for (unsigned j = 0; j < DIM; j++)
48  {
49  f(0, j) = W[j] * u[0];
50  }
51  }
52 
53  //======================================================================
54  /// Return the flux derivatives as a function of the unknowns
55  //=====================================================================
56  template<unsigned DIM>
59  {
60  const unsigned n_flux = this->nflux();
61 
62  // Get the wind
63  Vector<double> W(DIM);
64  Vector<double> s(DIM), x(DIM);
65  // Dummy integration point
66  unsigned ipt = 0;
67  this->get_wind_scalar_adv(ipt, s, x, W);
68 
69  df_du.initialise(0.0);
70 
71  for (unsigned i = 0; i < n_flux; i++)
72  {
73  for (unsigned j = 0; j < DIM; j++)
74  {
75  df_du(i, j, i) = W[j];
76  }
77  }
78  }
79 
80  template class ScalarAdvectionEquations<1>;
81  template class ScalarAdvectionEquations<2>;
82  template class ScalarAdvectionEquations<3>;
83 
84 } // namespace oomph
static char t char * s
Definition: cfortran.h:568
cstr elem_len * i
Definition: cfortran.h:603
////////////////////////////////////////////////////////////////// //////////////////////////////////...
Definition: matrices.h:1370
void initialise(const T &val)
Initialise all values in the tensor to val.
Definition: matrices.h:1642
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.
void flux(const Vector< double > &u, DenseMatrix< double > &f)
Return the flux as a function of the unknown.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...