discontinuous_galerkin_space_time_unsteady_heat_elements.h
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 // Header file for SpaceTimeUnsteadyHeat elements
27 #ifndef OOMPH_DISCONTINUOUS_GALERKIN_SPACE_TIME_UNSTEADY_HEAT_ELEMENTS_HEADER
28 #define OOMPH_DISCONTINUOUS_GALERKIN_SPACE_TIME_UNSTEADY_HEAT_ELEMENTS_HEADER
29 
30 // Config header generated by autoconfig
31 #ifdef HAVE_CONFIG_H
32 #include <oomph-lib-config.h>
33 #endif
34 
35 // Oomph-lib headers
36 #include "generic/Qelements.h"
37 #include "generic/shape.h"
38 #include "generic/projection.h"
39 
40 /// //////////////////////////////////////////////////////////////////////
41 /// //////////////////////////////////////////////////////////////////////
42 /// //////////////////////////////////////////////////////////////////////
43 
44 namespace oomph
45 {
46  //============================================================================
47  /// Base class so that we don't need to know the dimension just to
48  /// set the source function!
49  //============================================================================
50  class SpaceTimeUnsteadyHeatEquationsBase : public virtual FiniteElement
51  {
52  public:
53  /// Function pointer to source function fct(t,x,f(x,t)) -- x
54  /// is a Vector!
55  typedef void (*SpaceTimeUnsteadyHeatSourceFctPt)(const double& time,
56  const Vector<double>& x,
57  double& u);
58 
59  /// Access function: Pointer to source function
61  };
62 
63  //============================================================================
64  /// A class for all isoparametric elements that solve the
65  /// SpaceTimeUnsteadyHeat equations.
66  /// \f[ \frac{\partial^2 u}{\partial x_i^2}=\frac{\partial u}{\partial t}+f(t,x_j) \f]
67  /// This contains the generic maths. Shape functions, geometric
68  /// mapping etc. must get implemented in derived class.
69  /// Note that this class assumes an isoparametric formulation, i.e. that
70  /// the scalar unknown is interpolated using the same shape funcitons
71  /// as the position.
72  //============================================================================
73  template<unsigned SPATIAL_DIM>
75  : public virtual SpaceTimeUnsteadyHeatEquationsBase
76  {
77  public:
78  /// Function pointer to source function fct(t,x,f(x,t)) -- x
79  /// is a Vector!
80  /// DRAIG: Why is this here? There is already one in the base class!
81  typedef void (*SpaceTimeUnsteadyHeatSourceFctPt)(const double& time,
82  const Vector<double>& x,
83  double& u);
84 
85 
86  /// Constructor: Initialises the Source_fct_pt to null and sets
87  /// flag to use ALE formulation of the equations. Also, set Alpha (thermal
88  /// inertia) and Beta (thermal conductivity) parameters to defaults (both
89  /// one for natural scaling).
91  {
92  // Set Alpha parameter to default (one for natural scaling)
94 
95  // Set Beta parameter to default (one for natural scaling)
97  } // End of SpaceTimeUnsteadyHeatEquations
98 
99 
100  /// Broken copy constructor
102  const SpaceTimeUnsteadyHeatEquations& dummy) = delete;
103 
104  /// Disable ALE, i.e. assert the mesh is not moving -- you do this
105  /// at your own risk!
106  void disable_ALE()
107  {
108  // Set the flag to true
109  ALE_is_disabled = true;
110  } // End of disable_ALE
111 
112 
113  /// (Re-)enable ALE, i.e. take possible mesh motion into account
114  /// when evaluating the time-derivative. Note: By default, ALE is
115  /// enabled, at the expense of possibly creating unnecessary work
116  /// in problems where the mesh is, in fact, stationary.
117  void enable_ALE()
118  {
119  // Set the flag to false
120  ALE_is_disabled = false;
121  } // End of enable_ALE
122 
123 
124  /// Compute norm of FE solution
125  void compute_norm(double& norm);
126 
127 
128  /// Output with default number of plot points
129  void output(std::ostream& outfile)
130  {
131  // Number of plot points
132  unsigned nplot = 5;
133 
134  // Output the solution
135  output(outfile, nplot);
136  } // End of output
137 
138 
139  /// Output FE representation of soln: x,y,u or x,y,z,u at
140  /// nplot^SPATIAL_DIM plot points
141  void output(std::ostream& outfile, const unsigned& nplot);
142 
143 
144  /// C_style output with default number of plot points
145  void output(FILE* file_pt)
146  {
147  // Number of plot points
148  unsigned nplot = 5;
149 
150  // Output the solution
151  output(file_pt, nplot);
152  } // End of output
153 
154 
155  /// C-style output FE representation of soln: x,y,u or x,y,z,u at
156  /// nplot^SPATIAL_DIM plot points
157  void output(FILE* file_pt, const unsigned& nplot);
158 
159 
160  /// Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^SPATIAL_DIM
161  /// plot points
162  void output_fct(std::ostream& outfile,
163  const unsigned& nplot,
165 
166 
167  /// Output exact soln: x,y,u_exact or x,y,z,u_exact at
168  /// nplot^SPATIAL_DIM plot points (time-dependent version)
169  virtual void output_fct(
170  std::ostream& outfile,
171  const unsigned& nplot,
172  const double& time,
174 
175 
176  /// Get error and norm against exact solution
177  void compute_error(std::ostream& outfile,
179  double& error,
180  double& norm);
181 
182 
183  /// Get error and norm against exact solution
184  void compute_error(std::ostream& outfile,
186  const double& time,
187  double& error,
188  double& norm);
189 
190 
191  /// C-style output FE representation of soln: x,y,u or x,y,z,u at
192  /// nplot^SPATIAL_DIM plot points
193  void output_element_paraview(std::ofstream& outfile, const unsigned& nplot);
194 
195 
196  /// Number of scalars/fields output by this element. Reimplements
197  /// broken virtual function in base class.
198  unsigned nscalar_paraview() const
199  {
200  // Only one field to output
201  return 1;
202  } // End of nscalar_paraview
203 
204 
205  /// Write values of the i-th scalar field at the plot points. Needs
206  /// to be implemented for each new specific element type.
207  void scalar_value_paraview(std::ofstream& file_out,
208  const unsigned& i,
209  const unsigned& nplot) const
210  {
211 #ifdef PARANOID
212  if (i != 0)
213  {
214  std::stringstream error_stream;
215  error_stream << "Space-time unsteady heat elements only store a single "
216  << "field so i must be 0 rather than " << i << std::endl;
217  throw OomphLibError(
218  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
219  }
220 #endif
221 
222  // Get the number of plot points
223  unsigned local_loop = this->nplot_points_paraview(nplot);
224 
225  // Loop over the plot points
226  for (unsigned j = 0; j < local_loop; j++)
227  {
228  // Storage for the local coordinates
229  Vector<double> s(SPATIAL_DIM + 1);
230 
231  // Get the local coordinate of the required plot point
232  this->get_s_plot(j, nplot, s);
233 
234  // Output the interpolated solution value
235  file_out << this->interpolated_u_ust_heat(s) << std::endl;
236  }
237  } // End of scalar_value_paraview
238 
239 
240  /// Write values of the i-th scalar field at the plot points. Needs
241  /// to be implemented for each new specific element type.
243  std::ofstream& file_out,
244  const unsigned& i,
245  const unsigned& nplot,
246  FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
247  {
248 #ifdef PARANOID
249  if (i != 0)
250  {
251  std::stringstream error_stream;
252  error_stream << "Space-time unsteady heat elements only store a single "
253  << "field so i must be 0 rather than " << i << std::endl;
254  throw OomphLibError(
255  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
256  }
257 #endif
258 
259  // Get the number of plot points
260  unsigned local_loop = this->nplot_points_paraview(nplot);
261 
262  // Loop over the plot points
263  for (unsigned j = 0; j < local_loop; j++)
264  {
265  // Storage for the local coordinates
266  Vector<double> s(SPATIAL_DIM + 1);
267 
268  // Storage for the global coordinates
269  Vector<double> spatial_coordinates(SPATIAL_DIM);
270 
271  // Get the local coordinate of the required plot point
272  this->get_s_plot(j, nplot, s);
273 
274  // Loop over the spatial coordinates
275  for (unsigned i = 0; i < SPATIAL_DIM; i++)
276  {
277  // Assign the i-th spatial coordinate
278  spatial_coordinates[i] = interpolated_x(s, i);
279  }
280 
281  // Exact solution vector (here it's simply a scalar)
282  Vector<double> exact_soln(1, 0.0);
283 
284  // Get the exact solution at this point
285  (*exact_soln_pt)(spatial_coordinates, exact_soln);
286 
287  // Output the interpolated solution value
288  file_out << exact_soln[0] << std::endl;
289  } // for (unsigned j=0;j<local_loop;j++)
290  } // End of scalar_value_fct_paraview
291 
292 
293  /// Write values of the i-th scalar field at the plot points. Needs
294  /// to be implemented for each new specific element type.
296  std::ofstream& file_out,
297  const unsigned& i,
298  const unsigned& nplot,
299  const double& time,
300  FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
301  {
302 #ifdef PARANOID
303  if (i != 0)
304  {
305  std::stringstream error_stream;
306  error_stream << "Space-time unsteady heat elements only store a single "
307  << "field so i must be 0 rather than " << i << std::endl;
308  throw OomphLibError(
309  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
310  }
311 #endif
312 
313  // Get the number of plot points
314  unsigned local_loop = this->nplot_points_paraview(nplot);
315 
316  // Loop over the plot points
317  for (unsigned j = 0; j < local_loop; j++)
318  {
319  // Storage for the local coordinates
320  Vector<double> s(SPATIAL_DIM + 1);
321 
322  // Storage for the time value
323  double interpolated_t = 0.0;
324 
325  // Storage for the global coordinates
326  Vector<double> spatial_coordinates(SPATIAL_DIM);
327 
328  // Get the local coordinate of the required plot point
329  this->get_s_plot(j, nplot, s);
330 
331  // Loop over the spatial coordinates
332  for (unsigned i = 0; i < SPATIAL_DIM; i++)
333  {
334  // Assign the i-th spatial coordinate
335  spatial_coordinates[i] = interpolated_x(s, i);
336  }
337 
338  // Get the time value
339  interpolated_t = interpolated_x(s, SPATIAL_DIM);
340 
341  // Exact solution vector (here it's simply a scalar)
342  Vector<double> exact_soln(1, 0.0);
343 
344  // Get the exact solution at this point
345  (*exact_soln_pt)(interpolated_t, spatial_coordinates, exact_soln);
346 
347  // Output the interpolated solution value
348  file_out << exact_soln[0] << std::endl;
349  } // for (unsigned j=0;j<local_loop;j++)
350  } // End of scalar_value_fct_paraview
351 
352 
353  /// Name of the i-th scalar field. Default implementation
354  /// returns V1 for the first one, V2 for the second etc.
355  std::string scalar_name_paraview(const unsigned& i) const
356  {
357  // If we're outputting the solution
358  if (i == 0)
359  {
360  // There's only one field to output
361  return "U";
362  }
363  // Never get here
364  else
365  {
366  std::stringstream error_stream;
367  error_stream << "These unsteady heat elements only store 1 field, \n"
368  << "but i is currently " << i << std::endl;
369  throw OomphLibError(
370  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
371 
372  // Dummy return
373  return " ";
374  }
375  } // End of scalar_name_paraview
376 
377 
378  /// Access function: Pointer to source function
380  {
381  // Return the source function pointer
382  return Source_fct_pt;
383  } // End of source_fct_pt
384 
385 
386  /// Access function: Pointer to source function. Const version
388  {
389  // Return the source function pointer
390  return Source_fct_pt;
391  }
392 
393 
394  /// Get source term at continous time t and (Eulerian) position x.
395  /// Virtual so it can be overloaded in derived multi-physics elements.
396  virtual inline void get_source_ust_heat(const double& t,
397  const unsigned& ipt,
398  const Vector<double>& x,
399  double& source) const
400  {
401  // If no source function has been set, return zero
402  if (Source_fct_pt == 0)
403  {
404  // Set the source term value to zero
405  source = 0.0;
406  }
407  // Otherwise return the appropriate value
408  else
409  {
410  // Get source strength
411  (*Source_fct_pt)(t, x, source);
412  }
413  } // End of get_source_ust_heat
414 
415 
416  /// Alpha parameter (thermal inertia)
417  const double& alpha() const
418  {
419  // Return the value of Alpha
420  return *Alpha_pt;
421  } // End of alpha
422 
423 
424  /// Pointer to Alpha parameter (thermal inertia)
425  double*& alpha_pt()
426  {
427  // Return the pointer to Alpha
428  return Alpha_pt;
429  } // End of alpha_pt
430 
431 
432  /// Beta parameter (thermal conductivity)
433  const double& beta() const
434  {
435  // Return the pointer to Beta
436  return *Beta_pt;
437  } // End of beta
438 
439 
440  /// Pointer to Beta parameter (thermal conductivity)
441  double*& beta_pt()
442  {
443  // Return the pointer to Beta
444  return Beta_pt;
445  } // End of beta_pt
446 
447 
448  /// Get flux: flux[i]=du/dx_i
449  void get_flux(const Vector<double>& s, Vector<double>& flux) const
450  {
451  // Find out how many nodes there are in the element
452  unsigned n_node = nnode();
453 
454  // Find the index at which the variable is stored
455  unsigned u_nodal_index = u_index_ust_heat();
456 
457  // Set up memory for the shape and test functions
458  Shape psi(n_node);
459 
460  // Set up memory for the derivatives of the shape and test functions
461  DShape dpsidx(n_node, SPATIAL_DIM + 1);
462 
463  // Call the derivatives of the shape and test functions
464  dshape_eulerian(s, psi, dpsidx);
465 
466  // Loop over the entries of the flux vector
467  for (unsigned j = 0; j < SPATIAL_DIM; j++)
468  {
469  // Initialise j-th flux entry to zero
470  flux[j] = 0.0;
471  }
472 
473  // Loop over nodes
474  for (unsigned l = 0; l < n_node; l++)
475  {
476  // Loop over derivative directions
477  for (unsigned j = 0; j < SPATIAL_DIM; j++)
478  {
479  // Update the flux value
480  flux[j] += nodal_value(l, u_nodal_index) * dpsidx(l, j);
481  }
482  } // for (unsigned l=0;l<n_node;l++)
483  } // End of get_flux
484 
485 
486  /// Compute element residual Vector (wrapper)
488  {
489  // Call the generic residuals function with flag set to 0
490  // using a dummy matrix argument
492  residuals, GeneralisedElement::Dummy_matrix, 0);
493  } // End of fill_in_contribution_to_residuals
494 
495 
496  /// Compute element residual Vector and element Jacobian matrix (wrapper)
498  DenseMatrix<double>& jacobian)
499  {
500  // Call the generic routine with the flag set to 1
501  fill_in_generic_residual_contribution_ust_heat(residuals, jacobian, 1);
502  } // End of fill_in_contribution_to_jacobian
503 
504 
505  /// Return FE representation of function value u(s) at local coordinate s
506  inline double interpolated_u_ust_heat(const Vector<double>& s) const
507  {
508  // Find number of nodes
509  unsigned n_node = nnode();
510 
511  // Find the index at which the variable is stored
512  unsigned u_nodal_index = u_index_ust_heat();
513 
514  // Local shape function
515  Shape psi(n_node);
516 
517  // Find values of the shape functions at local coordinate s
518  shape(s, psi);
519 
520  // Initialise value of u
521  double interpolated_u = 0.0;
522 
523  // Loop over the local nodes and sum
524  for (unsigned l = 0; l < n_node; l++)
525  {
526  // Update the interpolated u value
527  interpolated_u += nodal_value(l, u_nodal_index) * psi[l];
528  }
529 
530  // Return the interpolated u value
531  return interpolated_u;
532  } // End of interpolated_u_ust_heat
533 
534 
535  /// Return the index at which the unknown value
536  /// is stored. The default value, 0, is appropriate for single-physics
537  /// problems, when there is only one variable, the value that satisfies the
538  /// unsteady heat equation.
539  /// In derived multi-physics elements, this function should be overloaded
540  /// to reflect the chosen storage scheme. Note that these equations require
541  /// that the unknown is always stored at the same index at each node.
542  virtual inline unsigned u_index_ust_heat() const
543  {
544  // Return the default value
545  return 0;
546  } // End of u_index_ust_heat
547 
548 
549  /// Return FE representation of function value u(s) at local
550  /// coordinate s at previous time t (t=0: present)
551  /// DRAIG: This needs to be broken; doesn't make sense in space-time
552  /// elements!
553  inline double interpolated_u_ust_heat(const unsigned& t,
554  const Vector<double>& s) const
555  {
556  // Find number of nodes
557  unsigned n_node = nnode();
558 
559  // Find the index at which the variable is stored
560  unsigned u_nodal_index = u_index_ust_heat();
561 
562  // Local shape function
563  Shape psi(n_node);
564 
565  // Find values of shape function
566  shape(s, psi);
567 
568  // Initialise value of u
569  double interpolated_u = 0.0;
570 
571  // Loop over the local nodes and sum
572  for (unsigned l = 0; l < n_node; l++)
573  {
574  // Update the interpolated u value
575  interpolated_u += nodal_value(t, l, u_nodal_index) * psi[l];
576  }
577 
578  // Return the interpolated u value
579  return interpolated_u;
580  } // End of interpolated_u_ust_heat
581 
582 
583  /// Calculate du/dt at the n-th local node. Uses suitably
584  /// interpolated value for hanging nodes.
585  double du_dt_ust_heat(const unsigned& n) const
586  {
587  // Storage for the local coordinates
588  Vector<double> s(SPATIAL_DIM + 1, 0.0);
589 
590  // Get the local coordinate at the n-th node
592 
593  // Return the interpolated du/dt value
595  } // End of du_dt_ust_heat
596 
597 
598  /// Return FE representation of function value du/dt(s) at local coordinate
599  /// s
600  inline double interpolated_du_dt_ust_heat(const Vector<double>& s) const
601  {
602  // Find number of nodes
603  unsigned n_node = nnode();
604 
605  // Find the index at which the variable is stored
606  unsigned u_nodal_index = u_index_ust_heat();
607 
608  // Local shape function
609  Shape psi(n_node);
610 
611  // Allocate space for the derivatives of the shape functions
612  DShape dpsidx(n_node, SPATIAL_DIM + 1);
613 
614  // Compute the geometric shape functions and also first derivatives
615  // w.r.t. global coordinates at local coordinate s
616  dshape_eulerian(s, psi, dpsidx);
617 
618  // Initialise value of du/dt
619  double interpolated_dudt = 0.0;
620 
621  // Loop over the local nodes and sum
622  for (unsigned l = 0; l < n_node; l++)
623  {
624  // Update the interpolated du/dt value
625  interpolated_dudt +=
626  nodal_value(l, u_nodal_index) * dpsidx(l, SPATIAL_DIM);
627  }
628 
629  // Return the interpolated du/dt value
630  return interpolated_dudt;
631  } // End of interpolated_du_dt_ust_heat
632 
633 
634  /// Self-test: Return 0 for OK
635  unsigned self_test();
636 
637  /// Shape/test functions and derivs w.r.t. to global coords at
638  /// local coordinate s; return Jacobian of mapping
640  const Vector<double>& s,
641  Shape& psi,
642  DShape& dpsidx,
643  Shape& test,
644  DShape& dtestdx) const = 0;
645 
646 
647  /// Shape/test functions and derivs w.r.t. to global coords at
648  /// integration point ipt; return Jacobian of mapping
650  const unsigned& ipt,
651  Shape& psi,
652  DShape& dpsidx,
653  Shape& test,
654  DShape& dtestdx) const = 0;
655 
656 
657  protected:
658  /// Compute element residual Vector only (if flag=and/or element
659  /// Jacobian matrix
661  Vector<double>& residuals,
662  DenseMatrix<double>& jacobian,
663  const unsigned& flag);
664 
665  /// Pointer to source function:
667 
668  /// Boolean flag to indicate if ALE formulation is disabled when
669  /// time-derivatives are computed. Only set to true if you're sure that
670  /// the mesh is stationary.
671  bool ALE_is_disabled;
672 
673  /// Pointer to Alpha parameter (thermal inertia)
674  double* Alpha_pt;
675 
676  /// Pointer to Beta parameter (thermal conductivity)
677  double* Beta_pt;
678 
679  private:
680  /// Static default value for the Alpha parameter (thermal inertia):
681  /// One for natural scaling
682  static double Default_alpha_parameter;
683 
684  /// Static default value for the Beta parameter (thermal
685  /// conductivity): One for natural scaling
686  static double Default_beta_parameter;
687  };
688 
689 
690  /// ////////////////////////////////////////////////////////////////////////
691  /// ////////////////////////////////////////////////////////////////////////
692  /// ////////////////////////////////////////////////////////////////////////
693 
694 
695  //=========================================================================
696  /// QUnsteadyHeatSpaceTimeElement elements are quadrilateral/brick-
697  /// shaped UnsteadyHeat elements with isoparametric interpolation for
698  /// the function.
699  //=========================================================================
700  template<unsigned SPATIAL_DIM, unsigned NNODE_1D>
702  : public virtual QElement<SPATIAL_DIM + 1, NNODE_1D>,
703  public virtual SpaceTimeUnsteadyHeatEquations<SPATIAL_DIM>
704  {
705  public:
706  /// Constructor: Call constructors for QElement and
707  /// SpaceTimeUnsteadyHeat equations
709  : QElement<SPATIAL_DIM + 1, NNODE_1D>(),
710  SpaceTimeUnsteadyHeatEquations<SPATIAL_DIM>()
711  {
712  }
713 
714  /// Broken copy constructor
717  delete;
718 
719  /// Required number of 'values' (pinned or dofs) at node n
720  inline unsigned required_nvalue(const unsigned& n) const
721  {
722  // Return the appropriate value
723  return Initial_Nvalue;
724  } // End of required_nvalue
725 
726 
727  /// Output function:
728  /// x,t,u or x,y,t,u
729  void output(std::ostream& outfile)
730  {
731  // Call the function in the base class
733  } // End of output
734 
735 
736  /// Output function:
737  /// x,t,u or x,y,t,u at n_plot^(SPATIAL_DIM+1) plot points
738  void output(std::ostream& outfile, const unsigned& n_plot)
739  {
740  // Call the function in the base class
742  } // End of output
743 
744 
745  /// C-style output function:
746  /// x,t,u or x,y,t,u
747  void output(FILE* file_pt)
748  {
749  // Call the function in the base class
751  } // End of output
752 
753 
754  /// C-style output function:
755  /// x,t,u or x,y,t,u at n_plot^(SPATIAL_DIM+1) plot points
756  void output(FILE* file_pt, const unsigned& n_plot)
757  {
758  // Call the function in the base class
760  } // End of output
761 
762 
763  /// Output function for an exact solution:
764  /// x,t,u_exact or x,y,t,u_exact at n_plot^(SPATIAL_DIM+1) plot points
765  void output_fct(std::ostream& outfile,
766  const unsigned& n_plot,
768  {
769  // Call the function in the base class
771  outfile, n_plot, exact_soln_pt);
772  } // End of output_fct
773 
774 
775  /// Output function for a time-dependent exact solution.
776  /// x,t,u_exact or x,y,t,u_exact at n_plot^(SPATIAL_DIM+1) plot points
777  /// (Calls the unsteady version)
778  void output_fct(std::ostream& outfile,
779  const unsigned& n_plot,
780  const double& time,
782  {
783  // Call the function in the base class
785  outfile, n_plot, time, exact_soln_pt);
786  } // End of output_fct
787 
788  /// Shape/test functions & derivs. w.r.t. to global coords. Return Jacobian.
790  Shape& psi,
791  DShape& dpsidx,
792  Shape& test,
793  DShape& dtestdx) const;
794 
795 
796  /// Shape/test functions and derivs w.r.t. to global coords at
797  /// integration point ipt; return Jacobian of mapping
799  const unsigned& ipt,
800  Shape& psi,
801  DShape& dpsidx,
802  Shape& test,
803  DShape& dtestdx) const;
804 
805  protected:
806  private:
807  /// Static array of ints to hold number of variables at nodes:
808  /// Initial_Nvalue[n]
809  static const unsigned Initial_Nvalue;
810  };
811 
812 
813  //======================================================================
814  /// Define the shape functions and test functions and derivatives
815  /// w.r.t. global coordinates and return Jacobian of mapping.
816  ///
817  /// Galerkin: Test functions=shape functions
818  //======================================================================
819  template<unsigned SPATIAL_DIM, unsigned NNODE_1D>
822  Shape& psi,
823  DShape& dpsidx,
824  Shape& test,
825  DShape& dtestdx) const
826  {
827  //--------------------------
828  // Call the basis functions:
829  //--------------------------
830  // Find the element dimension
831  const unsigned el_dim = this->dim();
832 
833  // Get the values of the shape functions and their local derivatives,
834  // temporarily stored in dpsi
835  this->dshape_local(s, psi, dpsidx);
836 
837  // Allocate memory for the inverse jacobian
838  DenseMatrix<double> inverse_jacobian(el_dim);
839 
840  // Now calculate the inverse jacobian
841  const double det =
842  this->local_to_eulerian_mapping(dpsidx, inverse_jacobian);
843 
844  // Now set the values of the derivatives to be dpsidx
845  this->transform_derivatives(inverse_jacobian, dpsidx);
846 
847  //-------------------------
848  // Call the test functions:
849  //-------------------------
850  // Make sure we're using 3D space-time elements
851  if (el_dim != 3)
852  {
853  // Create an output stream
854  std::ostringstream error_message_stream;
855 
856  // Create an error message
857  error_message_stream << "Need 3D space-time elements for this to work!"
858  << std::endl;
859 
860  // Throw the error message
861  throw OomphLibError(error_message_stream.str(),
862  OOMPH_CURRENT_FUNCTION,
863  OOMPH_EXCEPTION_LOCATION);
864  }
865 
866  //--------start_of_dshape_local--------------------------------------
867  // Local storage
868  double test_values[3][NNODE_1D];
869  double dtest_values[3][NNODE_1D];
870 
871  // Index of the total shape function
872  unsigned index = 0;
873 
874  // Call the 1D shape functions and derivatives
875  OneDimLagrange::shape<NNODE_1D>(s[0], test_values[0]);
876  OneDimLagrange::shape<NNODE_1D>(s[1], test_values[1]);
877  OneDimLagrange::dshape<NNODE_1D>(s[0], dtest_values[0]);
878  OneDimLagrange::dshape<NNODE_1D>(s[1], dtest_values[1]);
879 
880  // Set the time discretisation
881  OneDimDiscontinuousGalerkin::shape<NNODE_1D>(s[2], test_values[2]);
882  OneDimDiscontinuousGalerkin::dshape<NNODE_1D>(s[2], dtest_values[2]);
883 
884  // Loop over the nodes in the third local coordinate direction
885  for (unsigned k = 0; k < NNODE_1D; k++)
886  {
887  // Loop over the nodes in the second local coordinate direction
888  for (unsigned j = 0; j < NNODE_1D; j++)
889  {
890  // Loop over the nodes in the first local coordinate direction
891  for (unsigned i = 0; i < NNODE_1D; i++)
892  {
893  // Calculate dtest/ds_0
894  dtestdx(index, 0) =
895  dtest_values[0][i] * test_values[1][j] * test_values[2][k];
896 
897  // Calculate dtest/ds_1
898  dtestdx(index, 1) =
899  test_values[0][i] * dtest_values[1][j] * test_values[2][k];
900 
901  // Calculate dtest/ds_2
902  dtestdx(index, 2) =
903  test_values[0][i] * test_values[1][j] * dtest_values[2][k];
904 
905  // Calculate the index-th entry of test
906  test[index] =
907  test_values[0][i] * test_values[1][j] * test_values[2][k];
908 
909  // Increment the index
910  index++;
911  }
912  } // for (unsigned j=0;j<NNODE_1D;j++)
913  } // for (unsigned k=0;k<NNODE_1D;k++)
914  //--------end_of_dshape_local----------------------------------------
915 
916  // Transform derivatives from dtest/ds to dtest/dx
917  this->transform_derivatives(inverse_jacobian, dtestdx);
918 
919  // Return the determinant value
920  return det;
921  } // End of dshape_and_dtest_eulerian_ust_heat
922 
923 
924  //======================================================================
925  /// Define the shape functions and test functions and derivatives
926  /// w.r.t. global coordinates and return Jacobian of mapping.
927  ///
928  /// Galerkin: Test functions=shape functions
929  //======================================================================
930  template<unsigned SPATIAL_DIM, unsigned NNODE_1D>
933  Shape& psi,
934  DShape& dpsidx,
935  Shape& test,
936  DShape& dtestdx) const
937  {
938  // Find the element dimension
939  const unsigned el_dim = SPATIAL_DIM + 1;
940 
941  // Storage for the local coordinates of the integration point
942  Vector<double> s(el_dim, 0.0);
943 
944  // Set the local coordinate
945  for (unsigned i = 0; i < el_dim; i++)
946  {
947  // Calculate the i-th local coordinate at the ipt-th knot point
948  s[i] = this->integral_pt()->knot(ipt, i);
949  }
950 
951  // Return the Jacobian of the geometrical shape functions and derivatives
952  return dshape_and_dtest_eulerian_ust_heat(s, psi, dpsidx, test, dtestdx);
953  } // End of dshape_and_dtest_eulerian_at_knot_ust_heat
954 
955 
956  /// /////////////////////////////////////////////////////////////////////
957  /// /////////////////////////////////////////////////////////////////////
958  /// /////////////////////////////////////////////////////////////////////
959 
960 
961  //=======================================================================
962  /// Face geometry for the QUnsteadyHeatSpaceTimeElement elements: The
963  /// spatial dimension of the face elements is one lower than that of
964  /// the bulk element but they have the same number of points along their
965  /// 1D edges.
966  //=======================================================================
967  template<unsigned SPATIAL_DIM, unsigned NNODE_1D>
968  class FaceGeometry<QUnsteadyHeatSpaceTimeElement<SPATIAL_DIM, NNODE_1D>>
969  : public virtual QElement<SPATIAL_DIM, NNODE_1D>
970  {
971  public:
972  /// Constructor: Call the constructor for the appropriate
973  /// lower-dimensional QElement
974  FaceGeometry() : QElement<SPATIAL_DIM, NNODE_1D>() {}
975  };
976 
977 
978  /// /////////////////////////////////////////////////////////////////////
979  /// /////////////////////////////////////////////////////////////////////
980  /// /////////////////////////////////////////////////////////////////////
981 
982 
983  //=======================================================================
984  /// Face geometry for the 1D QUnsteadyHeatSpaceTimeElement elements:
985  /// Point elements
986  //=======================================================================
987  template<unsigned NNODE_1D>
988  class FaceGeometry<QUnsteadyHeatSpaceTimeElement<1, NNODE_1D>>
989  : public virtual PointElement
990  {
991  public:
992  /// Constructor: Call the constructor for the appropriate
993  /// lower-dimensional QElement
995  };
996 
997 
998  /// /////////////////////////////////////////////////////////////////////
999  /// /////////////////////////////////////////////////////////////////////
1000  /// /////////////////////////////////////////////////////////////////////
1001 
1002 
1003  //==========================================================
1004  /// SpaceTimeUnsteadyHeat upgraded to become projectable
1005  //==========================================================
1006  template<class UNSTEADY_HEAT_ELEMENT>
1007  class ProjectableUnsteadyHeatSpaceTimeElement
1008  : public virtual ProjectableElement<UNSTEADY_HEAT_ELEMENT>
1009  {
1010  public:
1011  /// Constructor [this was only required explicitly
1012  /// from gcc 4.5.2 onwards...]
1014 
1015 
1016  /// Specify the values associated with field fld. The information
1017  /// is returned in a vector of pairs which comprise the Data object and
1018  /// the value within it, that correspond to field fld.
1020  {
1021 #ifdef PARANOID
1022  // If we're not dealing with the first field
1023  if (fld != 0)
1024  {
1025  // Create a stringstream object to create an error message
1026  std::stringstream error_stream;
1027 
1028  // Create the error string
1029  error_stream << "SpaceTimeUnsteadyHeat elements only store a single "
1030  << "field so fld must be 0 rather than " << fld
1031  << std::endl;
1032 
1033  // Throw an error
1034  throw OomphLibError(
1035  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1036  }
1037 #endif
1038 
1039  // The number of nodes in this element
1040  unsigned nnod = this->nnode();
1041 
1042  // Storage for the pairs
1043  Vector<std::pair<Data*, unsigned>> data_values(nnod);
1044 
1045  // Loop over all nodes
1046  for (unsigned j = 0; j < nnod; j++)
1047  {
1048  // Add the data value and associated field: The node itself
1049  data_values[j] = std::make_pair(this->node_pt(j), fld);
1050  }
1051 
1052  // Return the vector
1053  return data_values;
1054  } // End of data_values_of_field
1055 
1056 
1057  /// Number of fields to be projected: Just one
1059  {
1060  // Return the appropriate value
1061  return 1;
1062  } // End of nfields_for_projection
1063 
1064 
1065  /// Number of history values to be stored for fld-th field.
1066  /// (Note: count includes current value!)
1067  unsigned nhistory_values_for_projection(const unsigned& fld)
1068  {
1069 #ifdef PARANOID
1070  // If we're not dealing with the first field
1071  if (fld != 0)
1072  {
1073  // Create a stringstream object to create an error message
1074  std::stringstream error_stream;
1075 
1076  // Create the error string
1077  error_stream << "SpaceTimeUnsteadyHeat elements only store a single "
1078  << "field so fld must be 0 rather than " << fld
1079  << std::endl;
1080 
1081  // Throw an error
1082  throw OomphLibError(
1083  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1084  }
1085 #endif
1086 
1087  // Return the number of stored values
1088  return this->node_pt(0)->ntstorage();
1089  } // End of nhistory_values_for_projection
1090 
1091 
1092  /// Number of positional history values (Note: count includes
1093  /// current value!)
1095  {
1096  // Return the number of history values stored by the position timestepper
1097  return this->node_pt(0)->position_time_stepper_pt()->ntstorage();
1098  } // End of nhistory_values_for_coordinate_projection
1099 
1100 
1101  /// Return Jacobian of mapping and shape functions of field fld
1102  /// at local coordinate s
1103  double jacobian_and_shape_of_field(const unsigned& fld,
1104  const Vector<double>& s,
1105  Shape& psi)
1106  {
1107 #ifdef PARANOID
1108  // If we're not dealing with the first field
1109  if (fld != 0)
1110  {
1111  // Create a stringstream object to create an error message
1112  std::stringstream error_stream;
1113 
1114  // Create the error string
1115  error_stream << "SpaceTimeUnsteadyHeat elements only store a single "
1116  << "field so fld must be 0 rather than " << fld
1117  << std::endl;
1118 
1119  // Throw an error
1120  throw OomphLibError(
1121  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1122  }
1123 #endif
1124 
1125  // Get the number of dimensions in the element
1126  unsigned n_dim = this->dim();
1127 
1128  // Get the number of nodes in the element
1129  unsigned n_node = this->nnode();
1130 
1131  // Allocate space for the test functions
1132  Shape test(n_node);
1133 
1134  // Allocate space for the derivatives of the shape functions
1135  DShape dpsidx(n_node, n_dim);
1136 
1137  // Allocate space for the derivatives of the test functions
1138  DShape dtestdx(n_node, n_dim);
1139 
1140  // Calculate the shape functions and their derivatives at the local
1141  // coordinate s (and the same for the test functions). On top of this
1142  // calculate the determinant of the Jacobian
1143  double J =
1144  this->dshape_and_dtest_eulerian_ust_heat(s, psi, dpsidx, test, dtestdx);
1145 
1146  // Return the determinant of the Jacobian
1147  return J;
1148  } // End of jacobian_and_shape_of_field
1149 
1150 
1151  /// Return interpolated field fld at local coordinate s, at time
1152  /// level t (t=0: present; t>0: history values)
1153  double get_field(const unsigned& t,
1154  const unsigned& fld,
1155  const Vector<double>& s)
1156  {
1157 #ifdef PARANOID
1158  // If we're not dealing with the first field
1159  if (fld != 0)
1160  {
1161  // Create a stringstream object to create an error message
1162  std::stringstream error_stream;
1163 
1164  // Create the error string
1165  error_stream << "SpaceTimeUnsteadyHeat elements only store a single "
1166  << "field so fld must be 0 rather than " << fld
1167  << std::endl;
1168 
1169  // Throw an error
1170  throw OomphLibError(
1171  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1172  }
1173 #endif
1174 
1175  // Find the index at which the variable is stored
1176  unsigned u_nodal_index = this->u_index_ust_heat();
1177 
1178  // Get the number of nodes in the element
1179  unsigned n_node = this->nnode();
1180 
1181  // Local shape function
1182  Shape psi(n_node);
1183 
1184  // Find values of shape function
1185  this->shape(s, psi);
1186 
1187  // Initialise value of u
1188  double interpolated_u = 0.0;
1189 
1190  // Loop over the local nodes
1191  for (unsigned l = 0; l < n_node; l++)
1192  {
1193  // Update the interpolated solution value
1194  interpolated_u += this->nodal_value(t, l, u_nodal_index) * psi[l];
1195  }
1196 
1197  // Return the interpolated solution value
1198  return interpolated_u;
1199  } // End of get_field
1200 
1201 
1202  /// Return number of values in field fld: One per node
1203  unsigned nvalue_of_field(const unsigned& fld)
1204  {
1205 #ifdef PARANOID
1206  // If we're not dealing with the first field
1207  if (fld != 0)
1208  {
1209  // Create a stringstream object to create an error message
1210  std::stringstream error_stream;
1211 
1212  // Create the error string
1213  error_stream << "SpaceTimeUnsteadyHeat elements only store a single "
1214  << "field so fld must be 0 rather than " << fld
1215  << std::endl;
1216 
1217  // Throw an error
1218  throw OomphLibError(
1219  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1220  }
1221 #endif
1222 
1223  // Return the number of nodes in the element
1224  return this->nnode();
1225  } // End of nvalue_of_field
1226 
1227 
1228  /// Return local equation number of value j in field fld.
1229  int local_equation(const unsigned& fld, const unsigned& j)
1230  {
1231 #ifdef PARANOID
1232  // If we're not dealing with the first field
1233  if (fld != 0)
1234  {
1235  // Create a stringstream object to create an error message
1236  std::stringstream error_stream;
1237 
1238  // Create the error string
1239  error_stream << "SpaceTimeUnsteadyHeat elements only store a single "
1240  << "field so fld must be 0 rather than " << fld
1241  << std::endl;
1242 
1243  // Throw an error
1244  throw OomphLibError(
1245  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1246  }
1247 #endif
1248 
1249  // Get the nodal index of the unknown
1250  const unsigned u_nodal_index = this->u_index_ust_heat();
1251 
1252  // Output the local equation number
1253  return this->nodal_local_eqn(j, u_nodal_index);
1254  } // End of local_equation
1255 
1256 
1257  /// Output FE representation of soln: x,t,u or x,y,t,u
1258  /// at n_plot^(SPATIAL_DIM+1) plot points
1259  void output(std::ostream& outfile, const unsigned& nplot)
1260  {
1261  // Get the dimension of the element
1262  unsigned el_dim = this->dim();
1263 
1264  // Vector of local coordinates
1265  Vector<double> s(el_dim, 0.0);
1266 
1267  // Tecplot header info
1268  outfile << this->tecplot_zone_string(nplot);
1269 
1270  // Get the number of plot points
1271  unsigned num_plot_points = this->nplot_points(nplot);
1272 
1273  // Loop over plot points
1274  for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
1275  {
1276  // Get local coordinates of plot point
1277  this->get_s_plot(iplot, nplot, s);
1278 
1279  // Loop over the coordinate directions
1280  for (unsigned i = 0; i < el_dim; i++)
1281  {
1282  // Output the interpolated coordinates
1283  outfile << this->interpolated_x(s, i) << " ";
1284  }
1285 
1286  // Output the interpolated value of u(s)
1287  outfile << this->interpolated_u_ust_heat(s) << " ";
1288 
1289  // Output the interpolated value of du/dt(s)
1290  outfile << this->interpolated_du_dt_ust_heat(s) << " ";
1291 
1292  // History values of coordinates
1293  unsigned n_prev =
1295 
1296  // Loop over the previous timesteps
1297  for (unsigned t = 1; t < n_prev; t++)
1298  {
1299  // Loop over the coordinate directions
1300  for (unsigned i = 0; i < el_dim; i++)
1301  {
1302  // Output the coordinates
1303  outfile << this->interpolated_x(t, s, i) << " ";
1304  }
1305  } // for (unsigned t=1;t<n_prev;t++)
1306 
1307  // Number of history values of velocities
1308  n_prev = this->node_pt(0)->time_stepper_pt()->ntstorage();
1309 
1310  // Loop over the previous timesteps
1311  for (unsigned t = 1; t < n_prev; t++)
1312  {
1313  // Output the solution
1314  outfile << this->interpolated_u_ust_heat(t, s) << " ";
1315  }
1316 
1317  // Finish the line
1318  outfile << std::endl;
1319  } // for (unsigned iplot=0;iplot<num_plot_points;iplot++)
1320 
1321  // Write tecplot footer (e.g. FE connectivity lists)
1322  this->write_tecplot_zone_footer(outfile, nplot);
1323  } // End of output
1324  };
1325 
1326 
1327  //=======================================================================
1328  /// Face geometry for element is the same as that for the underlying
1329  /// wrapped element
1330  //=======================================================================
1331  template<class ELEMENT>
1332  class FaceGeometry<ProjectableUnsteadyHeatSpaceTimeElement<ELEMENT>>
1333  : public virtual FaceGeometry<ELEMENT>
1334  {
1335  public:
1336  FaceGeometry() : FaceGeometry<ELEMENT>() {}
1337  };
1338 
1339 
1340  //=======================================================================
1341  /// Face geometry of the Face Geometry for element is the same as
1342  /// that for the underlying wrapped element
1343  //=======================================================================
1344  template<class ELEMENT>
1345  class FaceGeometry<
1346  FaceGeometry<ProjectableUnsteadyHeatSpaceTimeElement<ELEMENT>>>
1347  : public virtual FaceGeometry<FaceGeometry<ELEMENT>>
1348  {
1349  public:
1351  };
1352 } // End of namespace oomph
1353 
1354 #endif
static char t char * s
Definition: cfortran.h:568
cstr elem_len * i
Definition: cfortran.h:603
char t
Definition: cfortran.h:568
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Definition: shape.h:278
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
Definition: nodes.cc:879
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: elements.h:4998
virtual unsigned nplot_points_paraview(const unsigned &nplot) const
Return the number of actual plot points for paraview plot with parameter nplot. Broken virtual; can b...
Definition: elements.h:2862
virtual void local_coordinate_of_node(const unsigned &j, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size (broken virtual)
Definition: elements.h:1842
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
Definition: elements.h:2593
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
Definition: elements.h:3161
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition: elements.cc:3962
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
Definition: elements.h:1432
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
Definition: elements.h:2611
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
Definition: elements.h:1759
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
Definition: elements.h:3148
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
Definition: elements.h:3186
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
Definition: elements.cc:3298
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
Definition: elements.h:3174
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
Definition: elements.h:1765
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
Definition: elements.h:227
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
Definition: nodes.h:1022
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition: elements.h:3439
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
double get_field(const unsigned &t, const unsigned &fld, const Vector< double > &s)
Return interpolated field fld at local coordinate s, at time level t (t=0: present; t>0: history valu...
unsigned nhistory_values_for_projection(const unsigned &fld)
Number of history values to be stored for fld-th field. (Note: count includes current value!...
void output(std::ostream &outfile, const unsigned &nplot)
Output FE representation of soln: x,t,u or x,y,t,u at n_plot^(SPATIAL_DIM+1) plot points.
unsigned nhistory_values_for_coordinate_projection()
Number of positional history values (Note: count includes current value!)
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld: One per node.
ProjectableUnsteadyHeatSpaceTimeElement()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)
Return Jacobian of mapping and shape functions of field fld at local coordinate s.
Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)
Specify the values associated with field fld. The information is returned in a vector of pairs which ...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition: Qelements.h:459
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
QUnsteadyHeatSpaceTimeElement(const QUnsteadyHeatSpaceTimeElement< SPATIAL_DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
double dshape_and_dtest_eulerian_at_knot_ust_heat(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
double dshape_and_dtest_eulerian_ust_heat(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape/test functions & derivs. w.r.t. to global coords. Return Jacobian.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,t,u or x,y,t,u at n_plot^(SPATIAL_DIM+1) plot points.
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution. x,t,u_exact or x,y,t,u_exact at n_plot^(SPATIAL_...
QUnsteadyHeatSpaceTimeElement()
Constructor: Call constructors for QElement and SpaceTimeUnsteadyHeat equations.
void output(FILE *file_pt)
C-style output function: x,t,u or x,y,t,u.
void output(std::ostream &outfile)
Output function: x,t,u or x,y,t,u.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,t,u or x,y,t,u at n_plot^(SPATIAL_DIM+1) plot points.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: x,t,u_exact or x,y,t,u_exact at n_plot^(SPATIAL_DIM+1) plot po...
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
unsigned required_nvalue(const unsigned &n) const
Required number of 'values' (pinned or dofs) at node n.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Definition: shape.h:76
Base class so that we don't need to know the dimension just to set the source function!
void(* SpaceTimeUnsteadyHeatSourceFctPt)(const double &time, const Vector< double > &x, double &u)
Function pointer to source function fct(t,x,f(x,t)) – x is a Vector!
virtual SpaceTimeUnsteadyHeatSourceFctPt & source_fct_pt()=0
Access function: Pointer to source function.
A class for all isoparametric elements that solve the SpaceTimeUnsteadyHeat equations.
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^SPATIAL_DIM plot points.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error and norm against exact solution.
virtual void fill_in_generic_residual_contribution_ust_heat(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
double *& beta_pt()
Pointer to Beta parameter (thermal conductivity)
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute element residual Vector (wrapper)
void scalar_value_paraview(std::ofstream &file_out, const unsigned &i, const unsigned &nplot) const
Write values of the i-th scalar field at the plot points. Needs to be implemented for each new specif...
SpaceTimeUnsteadyHeatEquations(const SpaceTimeUnsteadyHeatEquations &dummy)=delete
Broken copy constructor.
void(* SpaceTimeUnsteadyHeatSourceFctPt)(const double &time, const Vector< double > &x, double &u)
Function pointer to source function fct(t,x,f(x,t)) – x is a Vector! DRAIG: Why is this here?...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute element residual Vector and element Jacobian matrix (wrapper)
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Get error and norm against exact solution.
void scalar_value_fct_paraview(std::ofstream &file_out, const unsigned &i, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
Write values of the i-th scalar field at the plot points. Needs to be implemented for each new specif...
double interpolated_u_ust_heat(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
void output(FILE *file_pt)
C_style output with default number of plot points.
virtual void output_fct(std::ostream &outfile, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^SPATIAL_DIM plot points (time-dependent vers...
void output(std::ostream &outfile, const unsigned &nplot)
Output FE representation of soln: x,y,u or x,y,z,u at nplot^SPATIAL_DIM plot points.
const double & alpha() const
Alpha parameter (thermal inertia)
double * Beta_pt
Pointer to Beta parameter (thermal conductivity)
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Reimplements broken virtual function in base class.
SpaceTimeUnsteadyHeatSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
void compute_norm(double &norm)
Compute norm of FE solution.
double * Alpha_pt
Pointer to Alpha parameter (thermal inertia)
unsigned self_test()
Self-test: Return 0 for OK.
double *& alpha_pt()
Pointer to Alpha parameter (thermal inertia)
static double Default_beta_parameter
Static default value for the Beta parameter (thermal conductivity): One for natural scaling.
std::string scalar_name_paraview(const unsigned &i) const
Name of the i-th scalar field. Default implementation returns V1 for the first one,...
virtual double dshape_and_dtest_eulerian_at_knot_ust_heat(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
void output(std::ostream &outfile)
Output with default number of plot points.
double interpolated_du_dt_ust_heat(const Vector< double > &s) const
Return FE representation of function value du/dt(s) at local coordinate s.
const double & beta() const
Beta parameter (thermal conductivity)
void output(FILE *file_pt, const unsigned &nplot)
C-style output FE representation of soln: x,y,u or x,y,z,u at nplot^SPATIAL_DIM plot points.
virtual void fill_in_generic_residual_contribution_ust_heat(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
virtual double dshape_and_dtest_eulerian_ust_heat(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Shape/test functions and derivs w.r.t. to global coords at local coordinate s; return Jacobian of map...
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
void output_element_paraview(std::ofstream &outfile, const unsigned &nplot)
C-style output FE representation of soln: x,y,u or x,y,z,u at nplot^SPATIAL_DIM plot points.
virtual unsigned u_index_ust_heat() const
Return the index at which the unknown value is stored. The default value, 0, is appropriate for singl...
SpaceTimeUnsteadyHeatSourceFctPt Source_fct_pt
Pointer to source function:
double interpolated_u_ust_heat(const unsigned &t, const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s at previous time t (t=0: presen...
void scalar_value_fct_paraview(std::ofstream &file_out, const unsigned &i, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
Write values of the i-th scalar field at the plot points. Needs to be implemented for each new specif...
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed....
double du_dt_ust_heat(const unsigned &n) const
Calculate du/dt at the n-th local node. Uses suitably interpolated value for hanging nodes.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i]=du/dx_i.
SpaceTimeUnsteadyHeatEquations()
Constructor: Initialises the Source_fct_pt to null and sets flag to use ALE formulation of the equati...
void enable_ALE()
(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative....
SpaceTimeUnsteadyHeatSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
static double Default_alpha_parameter
Static default value for the Alpha parameter (thermal inertia): One for natural scaling.
virtual void get_source_ust_heat(const double &t, const unsigned &ipt, const Vector< double > &x, double &source) const
Get source term at continous time t and (Eulerian) position x. Virtual so it can be overloaded in der...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
Definition: timesteppers.h:601
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...