common_young_laplace_stuff.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-2022 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 #ifndef OOMPH_COMMON_YOUNG_LAPLACE_STUFF_DOC
27 #define OOMPH_COMMON_YOUNG_LAPLACE_STUFF_DOC
28 #include <assert.h>
29 
30 //===== start_of_namespace========================================
32 //================================================================
33 namespace GlobalParameters
34 {
35 
36  // Independent problem parameters:
37  //--------------------------------
38 
40  bool Use_spines = true;
41 
43  bool Use_height_control = true;
44 
50  };
51 
54 
55 
56  // "Physical parameters"
57  //----------------------
58 
60  double Gamma = MathematicalConstants::Pi/4.0;
61  double Cos_gamma=cos(Gamma);
62 
64  Data* Kappa_pt = 0;
65 
67  double Kappa_initial = 0.0;
68 
70  double Controlled_height = 0.0;
71 
72  // Resolution parameters
73  //----------------------
74 
76  int Step_sign = 1;
77 
79  unsigned Nsteps = 5;
80 
82  double Kappa_increment = -0.05;
83 
86 
90  unsigned Control_element = 0;
91 
92  // Mesh data
93  // ---------
94 
96  double L_x = 1.0;
97  double L_y = 1.0;
98 
100  unsigned N_x = 8;
101  unsigned N_y = 8;
102 
103  // Spines data
104  // -----------
105 
108 
111 
114 
117 
120 
121  // end of parameters
122 
123  //-------------------------------------------------------
125  //-------------------------------------------------------
127  {
128 
129  // Reset initial value for kappa
130  Kappa_initial=0.0;
131 
132  // Check that we've got an even number of elements for control element
133  if ((N_x%2!=0)||(N_y%2!=0))
134  {
135  cout << "n_x n_y should even" << endl;
136  abort();
137  }
138 
139  // Find control element
141 
142  // Set up mesh and spines parameters
144  {
145  // Reset parameters (not realLy used for mesh in this
146  // case but for normalisation of spine rotation)
147  L_x=1.0;
148  L_y=1.0;
149 
150  // Rotate outwards
154  }
155  else if (Case==All_pinned)
156  {
157  // Spines angles for all pinned boundary conditions
161  }
162  else if (Case==Barrel_shape)
163  {
164  // Spines angles for barrel shaped validation
168  }
170  {
171  // Spines angles for T-junction with non nil contact angle
175  }
176  else
177  {
178  std::cout << "Never get here: Case = " << Case << std::endl;
179  assert(false);
180  }
181 
182  // Convert angle to cos
183  Cos_gamma = cos(Gamma);
184 
185  } // end of set up
186 
187  // Spine functions
188  //----------------
189 
195  void spine_base_function(const Vector<double>& x,
196  Vector<double>& spine_B,
197  Vector< Vector<double> >& dspine_B)
198  {
199 
200  // Bspines and derivatives
201  spine_B[0] = x[0];
202  spine_B[1] = x[1];
203  spine_B[2] = 0.0 ;
204  dspine_B[0][0] = 1.0 ;
205  dspine_B[1][0] = 0.0 ;
206  dspine_B[0][1] = 0.0 ;
207  dspine_B[1][1] = 1.0 ;
208  dspine_B[0][2] = 0.0 ;
209  dspine_B[1][2] = 0.0 ;
210 
211  } // End of bspine functions
212 
213 
217  void spine_function(const Vector<double>& xx,
218  Vector<double>& spine,
219  Vector< Vector<double> >& dspine)
220  {
221 
222  // Scale lengths
223  Vector<double> x(2,0.0);
224  x[0]=xx[0]/L_x;
225  x[1]=xx[1]/L_y;
226 
227  // Which spine orientation do we have?
229  {
232  spine[0]=0.0; // Sx
233  dspine[0][0]=0.0; // dSx/dx[0]
234  dspine[1][0]=0.0; // dSx/dx[1]
235 
236  spine[1]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[1]); // Sy
237  dspine[0][1]=0.0; // dSy/dx[0]
238  dspine[1][1]=-sin(Alpha_min+(Alpha_max-Alpha_min)*x[1])
239  *(Alpha_max-Alpha_min)/L_y; // dSy/dx[1]
240 
241  spine[2]=sin(Alpha_min+(Alpha_max-Alpha_min)*x[1]); // Sz
242  dspine[0][2]=0.0; // dSz/dx[0]
243  dspine[1][2]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[1])
244  *(Alpha_max-Alpha_min)/L_y; // dSz/dx[1]
245  }
246  else
247  {
249  spine[0]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[0]); // Sx
250  dspine[0][0]=-sin(Alpha_min+(Alpha_max-Alpha_min)*x[0])*
251  (Alpha_max-Alpha_min)/L_x; // dSx/dx[0]
252  dspine[1][0]=0.0; // dSx/dx[1]
253 
254  spine[1]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[1]); // Sy
255  dspine[0][1]=0.0; // dSy/dx[0]
256  dspine[1][1]=-sin(Alpha_min+(Alpha_max-Alpha_min)*x[1])*
257  (Alpha_max-Alpha_min)/L_y; // dSy/dx[1]
258 
259  spine[2]=1.0; // Sz
260  dspine[0][2]=0.0; // dSz/dx[0]
261  dspine[1][2]=0.0; // dSz/dx[1]
262  }
263 
264 
265  } // End spine function
266 
267  // Exact kappa value
268  //------------------
269  double get_exact_kappa()
270  {
271  if (Use_height_control)
272  {
273 
275  {
276  // Mean (!) curvature of spherical cap pinned in the
277  // quarter circular mesh (cylindrical tube)
278  return 4.0*Controlled_height/
280  }
281  else if (Case==Barrel_shape)
282  {
283  // Mean (!) curvature of barrel that goes through
284  // the corners of the rectangular domain
285  return 2.0*Controlled_height/
287  }
288  else
289  {
290  std::cout << "No exact solution for this case..." << std::endl;
291  return 0.0;
292  }
293  }
294  else
295  {
296  // Return prescribed kappa no height control
297  return 999; //Kappa_pt->value(0);
298  }
299  }
300 
301 
302 } // end of namespace
303 
304 #endif
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
#define assert(e,...)
Definition: Logger.h:744
Matrix< Type, Size, 1 > Vector
\cpp11 Size×1 vector of type Type.
Definition: Eigen/Eigen/src/Core/Matrix.h:515
double Pi
Definition: two_d_biharmonic.cc:235
Global parameters.
Definition: all_foeppl_von_karman/circular_disk.cc:48
double Alpha_max
Max. spine angle against horizontal plane.
Definition: barrel.cc:99
double L_x
------------------—Unsteady Heat Parameters---------------------—
Definition: test_equal_order_galerkin.cc:62
double Controlled_height
Height control value.
Definition: barrel.cc:51
unsigned Control_element
Definition: common_young_laplace_stuff.h:90
double get_exact_kappa()
Exact kappa.
Definition: barrel.cc:54
bool Use_height_control
Use height control (true) or not (false)?
Definition: common_young_laplace_stuff.h:43
double Controlled_height_increment
Increment for height control.
Definition: common_young_laplace_stuff.h:85
bool Rotate_spines_in_both_directions
Should the spines rotate in the x and y directions (true)?
Definition: common_young_laplace_stuff.h:119
unsigned N_y
Number of elements in the y-direction.
Definition: test_equal_order_galerkin.cc:74
double Kappa_increment
Increment for prescribed curvature.
Definition: common_young_laplace_stuff.h:82
bool Use_spines
Use spines (true) or not (false)
Definition: common_young_laplace_stuff.h:40
void spine_function(const Vector< double > &x, Vector< double > &spine, Vector< Vector< double > > &dspine)
Definition: barrel.cc:104
double Beta_max
Max. second pine angle against horizontal plane.
Definition: common_young_laplace_stuff.h:116
unsigned Nsteps
Number of steps.
Definition: common_young_laplace_stuff.h:79
unsigned N_x
Number of elements in the x-direction.
Definition: test_equal_order_galerkin.cc:71
Data * Kappa_pt
Pointer to Data object that stores the prescribed curvature.
Definition: common_young_laplace_stuff.h:64
void spine_base_function(const Vector< double > &x, Vector< double > &spine_B, Vector< Vector< double > > &dspine_B)
Definition: barrel.cc:72
double L_y
Length of the mesh in the y-direction.
Definition: test_equal_order_galerkin.cc:65
double Gamma
Parameter for timescale of step translation.
Definition: two_d_unsteady_heat_2adapt_load_balance.cc:144
Cases
Enumeration for the possible cases.
Definition: common_young_laplace_stuff.h:46
@ Barrel_shape
Definition: common_young_laplace_stuff.h:48
@ All_pinned
Definition: common_young_laplace_stuff.h:47
@ T_junction_with_nonzero_contact_angle
Definition: common_young_laplace_stuff.h:49
@ Spherical_cap_in_cylinder_pinned
Definition: common_young_laplace_stuff.h:46
double Kappa_initial
Initial value for kappa.
Definition: common_young_laplace_stuff.h:67
double Alpha_min
Min. spine angle against horizontal plane.
Definition: barrel.cc:96
double Cos_gamma
Cos of contact angle.
Definition: common_young_laplace_stuff.h:61
int Case
What case are we considering: Choose one from the enumeration Cases.
Definition: common_young_laplace_stuff.h:53
double Beta_min
Min. second spine angle against horizontal plane.
Definition: common_young_laplace_stuff.h:113
int Step_sign
Increase or decrease the value of the control parameters?
Definition: common_young_laplace_stuff.h:76
void setup_dependent_parameters_and_sanity_check()
Setup dependent parameters and perform sanity check.
Definition: common_young_laplace_stuff.h:126
list x
Definition: plotDoE.py:28