macro_element_node_update_element.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-2024 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//====================================================================
27 
28 namespace oomph
29 {
30  /// ////////////////////////////////////////////////////////////////////
31  /// ////////////////////////////////////////////////////////////////////
32  // MacroElementNodeUpdateNodes
33  /// ////////////////////////////////////////////////////////////////////
34  /// ////////////////////////////////////////////////////////////////////
35 
36 
37  //========================================================================
38  /// Excute the update function: Update the current (and if
39  /// update_all_time_levels_for_new_node==true also the previous)
40  /// nodal position. Also update the current nodal values if
41  /// an auxiliary update function is defined.
42  /// Note: Updating of previous positions is only required (and should
43  /// only be performed for) newly created MacroElementNodeUpdateNodes
44  /// i.e. when this function is called from...
45  /// If a node is hanging, its position is determined via its hanging
46  /// node constraints after updating the position of its master nodes.
47  //========================================================================
49  const bool& update_all_time_levels_for_new_node)
50  {
51  // Number of time levels that need to be updated
52  unsigned ntime;
53  if (update_all_time_levels_for_new_node)
54  {
55  // Present value plus the previous values
57  }
58  else
59  {
60  // Just the present value
61  ntime = 1;
62  }
63 
64  // Is it a hanging node?
65  if (is_hanging())
66  {
67  // Loop over all master nodes and update their position
68  // That's all we need to update the position of hanging nodes!
69  // (Recall that for hanging nodes Node::x(...) is not
70  // guaranteed to be kept up-to-date; the (constrained!) nodal
71  // position of hanging nodes must be determined via
72  // Node::position() which determines the position
73  // via the hanging node constraints from the position of
74  // the master nodes)
75  unsigned nmaster = hanging_pt()->nmaster();
76  for (unsigned imaster = 0; imaster < nmaster; imaster++)
77  {
78  dynamic_cast<MacroElementNodeUpdateNode*>(
79  hanging_pt()->master_node_pt(imaster))
80  ->node_update(update_all_time_levels_for_new_node);
81  }
82  }
83  // Node isn't hanging --> update it directly
84  else
85  {
86  // If no update element is defined, keep the nodal positions where
87  // they were (i.e. don't do anything), else update
88  if (Node_update_element_pt != 0)
89  {
90  // Vector of local coordinates
91  unsigned n_dim = ndim();
92  Vector<double> x_new(n_dim);
93 
94  // Loop over time levels
95  for (unsigned t = 0; t < ntime; t++)
96  {
97  // Update via macro element representation
99  for (unsigned i = 0; i < n_dim; i++)
100  {
101  x(t, i) = x_new[i];
102  }
103  }
104  }
105  }
106 
107  // Perform auxiliary update of function values? Node passes itself
108  // to this function so its position etc. is available to the auxiliary
109  // node update function.
110  if (Aux_node_update_fct_pt != 0)
111  {
113  }
114  }
115 
116 } // namespace oomph
cstr elem_len * i
Definition: cfortran.h:603
char t
Definition: cfortran.h:568
void get_x(const Vector< double > &s, Vector< double > &x) const
Global coordinates as function of local coordinates. Either via FE representation or via macro-elemen...
Definition: elements.h:1889
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
Definition: nodes.h:791
unsigned nmaster() const
Return the number of master nodes.
Definition: nodes.h:785
////////////////////////////////////////////////////////////////////
void node_update(const bool &update_all_time_levels_for_new_node=false)
Update the current nodal position. If required, perform the auxiliary update of nodal values....
Vector< double > S_in_node_update_element
Vector containing the node's local coordinates in node update element.
FiniteElement * Node_update_element_pt
Pointer to finite element that performs the node update by referring to its macro-element representat...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
Definition: nodes.h:1228
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
AuxNodeUpdateFctPt Aux_node_update_fct_pt
Pointer to auxiliary update function – this can be used to update any nodal values following the upda...
Definition: nodes.h:967
TimeStepper * Position_time_stepper_pt
Pointer to the timestepper associated with the position data.
Definition: nodes.h:932
bool is_hanging() const
Test whether the node is geometrically hanging.
Definition: nodes.h:1285
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...