generalised_newtonian_Tnavier_stokes_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$
7 //LIC//
8 //LIC// $LastChangedDate$
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 functions for triangle/tet NS elements
31 
33 
34 
35 
36 namespace oomph
37 {
38 
39 //////////////////////////////////////////////////////////////////////
40 //////////////////////////////////////////////////////////////////////
41 //////////////////////////////////////////////////////////////////////
42 
43 
44 //========================================================================
45 /// Unpin all internal pressure dofs.
46 //========================================================================
47  template<unsigned DIM>
50  {
51  unsigned n_pres = this->npres_nst();
52  // loop over pressure dofs
53  for(unsigned l=0;l<n_pres;l++)
54  {
55  // unpin internal pressure
56  this->internal_data_pt(P_nst_internal_index)->unpin(l);
57  }
58  }
59 
60 
61 //=========================================================================
62 /// Add to the set \c paired_load_data pairs containing
63 /// - the pointer to a Data object
64 /// and
65 /// - the index of the value in that Data object
66 /// .
67 /// for all values (pressures, velocities) that affect the
68 /// load computed in the \c get_load(...) function.
69 //=========================================================================
70 template<unsigned DIM>
72 identify_load_data(std::set<std::pair<Data*,unsigned> > &paired_load_data)
73 {
74  //Find the index at which the velocity is stored
75  unsigned u_index[DIM];
76  for(unsigned i=0;i<DIM;i++) {u_index[i] = this->u_index_nst(i);}
77 
78  //Loop over the nodes
79  unsigned n_node = this->nnode();
80  for(unsigned n=0;n<n_node;n++)
81  {
82  //Loop over the velocity components and add pointer to their data
83  //and indices to the vectors
84  for(unsigned i=0;i<DIM;i++)
85  {
86  paired_load_data.insert(std::make_pair(this->node_pt(n),u_index[i]));
87  }
88  }
89 
90  // Identify the pressure data
91  identify_pressure_data(paired_load_data);
92 }
93 
94 
95 //=========================================================================
96 /// Add to the set \c paired_pressue_data pairs containing
97 /// - the pointer to a Data object
98 /// and
99 /// - the index of the value in that Data object
100 /// .
101 /// for all pressures values that affect the
102 /// load computed in the \c get_load(...) function.
103 //=========================================================================
104 template<unsigned DIM>
106 identify_pressure_data(std::set<std::pair<Data*,unsigned> >
107  &paired_pressure_data)
108 {
109  //Loop over the internal data
110  unsigned n_internal = this->ninternal_data();
111  for(unsigned l=0;l<n_internal;l++)
112  {
113  unsigned nval=this->internal_data_pt(l)->nvalue();
114  //Add internal data
115  for (unsigned j=0;j<nval;j++)
116  {
117  paired_pressure_data.insert(std::make_pair(this->internal_data_pt(l),j));
118  }
119  }
120 }
121 
122 
123 
124 
125 ///////////////////////////////////////////////////////////////////////////
126 ///////////////////////////////////////////////////////////////////////////
127 ///////////////////////////////////////////////////////////////////////////
128 
129 //2D Taylor--Hood
130 
131 //Set the data for the number of Variables at each node
132 template<>
134 Initial_Nvalue[6]={3,3,3,2,2,2};
135 
136 //Set the data for the pressure conversion array
137 template<>
139 Pconv[3]={0,1,2};
140 
141 //3D Taylor--Hood
142 //Set the data for the number of Variables at each node
143 template<>
145 Initial_Nvalue[10]={4,4,4,4,3,3,3,3,3,3};
146 
147 //Set the data for the pressure conversion array
148 template<>
150 
151 
152 //========================================================================
153 /// Unpin all pressure dofs, incl the mid-face/side ones where
154 /// they have been allocated (e.g. in the refineable version of this
155 /// element).
156 //========================================================================
157 template<unsigned DIM>
160 {
161  unsigned n_node = this->nnode();
162  // loop over nodes
163  for(unsigned l=0;l<n_node;l++)
164  {
165  if (this->node_pt(l)->nvalue()==DIM+1)
166  {
167  // unpin pressure dof
168  this->node_pt(l)->unpin(DIM);
169  }
170  }
171 }
172 
173 //========================================================================
174 /// Pin all nodal pressure dofs, incl the mid-face/side ones where
175 /// they have been allocated (e.g. in the refineable version of this
176 /// element).
177 //========================================================================
178 template<unsigned DIM>
181 {
182  // Loop over all nodes and pin pressure
183  unsigned n_node = this->nnode();
184  for(unsigned n=0;n<n_node;n++)
185  {
186  if (this->node_pt(n)->nvalue()==DIM+1)
187  {
188  this->node_pt(n)->pin(DIM);
189  }
190  }
191 }
192 
193 //========================================================================
194 /// Unpin the proper nodal pressure dofs which are not hanging.
195 //========================================================================
196 template<unsigned DIM>
199 {
200 
201  // Loop over all pressure nodes and unpin if they're not hanging
202  unsigned n_pres = npres_nst();
203  for(unsigned l=0;l<n_pres;l++)
204  {
205  Node* nod_pt = this->node_pt(Pconv[l]);
206  if (!nod_pt->is_hanging(DIM)) {nod_pt->unpin(DIM);}
207  }
208 }
209 
210 
211 //=========================================================================
212 /// Add to the set \c paired_load_data pairs containing
213 /// - the pointer to a Data object
214 /// and
215 /// - the index of the value in that Data object
216 /// .
217 /// for all values (pressures, velocities) that affect the
218 /// load computed in the \c get_load(...) function.
219 //=========================================================================
220 template<unsigned DIM>
222 identify_load_data(std::set<std::pair<Data*,unsigned> > &paired_load_data)
223 {
224  //Loop over the nodes
225  unsigned n_node = this->nnode();
226  for(unsigned n=0;n<n_node;n++)
227  {
228  //Loop over the velocity components and add pointer to their data
229  //and indices to the vectors
230  for(unsigned i=0;i<DIM;i++)
231  {
232  paired_load_data.insert(std::make_pair(this->node_pt(n),i));
233  }
234  }
235 
236  //Add the pressure data
237  identify_pressure_data(paired_load_data);
238 }
239 
240 //=========================================================================
241 /// Add to the set \c paired_load_data pairs containing
242 /// - the pointer to a Data object
243 /// and
244 /// - the index of the value in that Data object
245 /// .
246 /// for all values (pressures, velocities) that affect the
247 /// load computed in the \c get_load(...) function.
248 //=========================================================================
249 template<unsigned DIM>
251 identify_pressure_data(std::set<std::pair<Data*,unsigned> > &paired_load_data)
252 {
253  //Loop over the pressure data
254  unsigned n_pres= npres_nst();
255  for(unsigned l=0;l<n_pres;l++)
256  {
257  //The DIMth entry in each nodal data is the pressure, which
258  //affects the traction
259  paired_load_data.insert(std::make_pair(this->node_pt(Pconv[l]),DIM));
260  }
261 }
262 
263 //====================================================================
264 //// Force build of templates
265 //====================================================================
268 
271 
272 }
void unpin(const unsigned &i)
Unpin the i-th stored variable.
Definition: nodes.h:386
void identify_load_data(std::set< std::pair< Data *, unsigned > > &paired_load_data)
Add to the set paired_load_data pairs of pointers to data objects and unsignedegers that index the va...
cstr elem_len * i
Definition: cfortran.h:607
void identify_pressure_data(std::set< std::pair< Data *, unsigned > > &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
bool is_hanging() const
Test whether the node is geometrically hanging.
Definition: nodes.h:1207
void identify_pressure_data(std::set< std::pair< Data *, unsigned > > &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
void identify_load_data(std::set< std::pair< Data *, unsigned > > &paired_load_data)
Add to the set paired_load_data pairs containing.
void unpin_proper_nodal_pressure_dofs()
Unpin the proper nodal pressure dofs.