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