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-2025 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
29#include <cassert>
30
31//===== start_of_namespace========================================
32/// Namespace for "global" problem parameters
33//================================================================
34namespace GlobalParameters
35{
36
37 // Independent problem parameters:
38 //--------------------------------
39
40 /// Use spines (true) or not (false)
41 bool Use_spines = true;
42
43 /// Use height control (true) or not (false)?
44 bool Use_height_control = true;
45
46 /// Enumeration for the possible cases
52
53 /// What case are we considering: Choose one from the enumeration Cases
55
56
57 // "Physical parameters"
58 //----------------------
59
60 /// Contact angle and its cos (dependent parameter -- is reassigned)
61 double Gamma = MathematicalConstants::Pi/4.0;
62 double Cos_gamma=cos(Gamma);
63
64 /// Pointer to Data object that stores the prescribed curvature
65 Data* Kappa_pt = 0;
66
67 /// Initial value for kappa
68 double Kappa_initial = 0.0;
69
70 /// Height control value
71 double Controlled_height = 0.0;
72
73 // Resolution parameters
74 //----------------------
75
76 /// Increase or decrease the value of the control parameters?
77 int Step_sign = 1;
78
79 /// Number of steps
80 unsigned Nsteps = 5;
81
82 /// Increment for prescribed curvature
83 double Kappa_increment = -0.05;
84
85 /// Increment for height control
87
88 /// Number of element in bulk mesh at which height control is applied.
89 /// Initialise to 0 -- will be overwritte in
90 /// setup_dependent_parameters_and_sanity_check()
91 unsigned Control_element = 0;
92
93 // Mesh data
94 // ---------
95
96 /// Length and width of the domain
97 double L_x = 1.0;
98 double L_y = 1.0;
99
100 /// Number of elements in the mesh
101 unsigned N_x = 8;
102 unsigned N_y = 8;
103
104 // Spines data
105 // -----------
106
107 /// Min. first spine angle against horizontal plane
108 double Alpha_min = MathematicalConstants::Pi/2.0;
109
110 /// Max. first spine angle against horizontal plane
111 double Alpha_max = MathematicalConstants::Pi/2.0;
112
113 /// Min. second spine angle against horizontal plane
114 double Beta_min = MathematicalConstants::Pi/2.0;
115
116 /// Max. second pine angle against horizontal plane
117 double Beta_max = MathematicalConstants::Pi/2.0;
118
119 /// Should the spines rotate in the x and y directions (true)?
121
122 // end of parameters
123
124 //-------------------------------------------------------
125 /// Setup dependent parameters and perform sanity check
126 //-------------------------------------------------------
128 {
129
130 // Reset initial value for kappa
131 Kappa_initial=0.0;
132
133 // Check that we've got an even number of elements for control element
134 if ((N_x%2!=0)||(N_y%2!=0))
135 {
136 cout << "n_x n_y should even" << endl;
137 abort();
138 }
139
140 // Find control element
142
143 // Set up mesh and spines parameters
145 {
146 // Reset parameters (not realLy used for mesh in this
147 // case but for normalisation of spine rotation)
148 L_x=1.0;
149 L_y=1.0;
150
151 // Rotate outwards
152 Alpha_min=MathematicalConstants::Pi/2.0;
153 Alpha_max=MathematicalConstants::Pi/2.0*0.5;
155 }
156 else if (Case==All_pinned)
157 {
158 // Spines angles for all pinned boundary conditions
159 Alpha_min=MathematicalConstants::Pi/2.0*1.5;
160 Alpha_max=MathematicalConstants::Pi/2.0*0.5;
162 }
163 else if (Case==Barrel_shape)
164 {
165 // Spines angles for barrel shaped validation
166 Alpha_min=MathematicalConstants::Pi/2.0*1.5;
167 Alpha_max=MathematicalConstants::Pi/2.0*0.5;
169 }
171 {
172 // Spines angles for T-junction with non nil contact angle
173 Alpha_min=MathematicalConstants::Pi/2.0*1.5;
174 Alpha_max=MathematicalConstants::Pi/2.0*0.5;
176 }
177 else
178 {
179 std::cout << "Never get here: Case = " << Case << std::endl;
180 assert(false);
181 }
182
183 // Convert angle to cos
184 Cos_gamma = cos(Gamma);
185
186 } // end of set up
187
188 // Spine functions
189 //----------------
190
191 /// Spine basis: The position vector to the basis of the spine
192 /// as a function of the two coordinates x_1 and x_2, and its
193 /// derivatives w.r.t. to these coordinates.
194 /// dspine_B[i][j] = d spine_B[j] / dx_i
195 /// Spines start in the (x_1,x_2) plane at (x_1,x_2).
196 void spine_base_function(const Vector<double>& x,
197 Vector<double>& spine_B,
198 Vector< Vector<double> >& dspine_B)
199 {
200
201 // Bspines and derivatives
202 spine_B[0] = x[0];
203 spine_B[1] = x[1];
204 spine_B[2] = 0.0 ;
205 dspine_B[0][0] = 1.0 ;
206 dspine_B[1][0] = 0.0 ;
207 dspine_B[0][1] = 0.0 ;
208 dspine_B[1][1] = 1.0 ;
209 dspine_B[0][2] = 0.0 ;
210 dspine_B[1][2] = 0.0 ;
211
212 } // End of bspine functions
213
214
215 /// Spine: The spine vector field as a function of the two
216 /// coordinates x_1 and x_2, and its derivatives w.r.t. to these coordinates:
217 /// dspine[i][j] = d spine[j] / dx_i
218 void spine_function(const Vector<double>& xx,
219 Vector<double>& spine,
220 Vector< Vector<double> >& dspine)
221 {
222
223 // Scale lengths
224 Vector<double> x(2,0.0);
225 x[0]=xx[0]/L_x;
226 x[1]=xx[1]/L_y;
227
228 // Which spine orientation do we have?
230 {
231 /// Spines (and derivatives) are independent of x[0] and rotate
232 /// in the x[1]-direction
233 spine[0]=0.0; // Sx
234 dspine[0][0]=0.0; // dSx/dx[0]
235 dspine[1][0]=0.0; // dSx/dx[1]
236
237 spine[1]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[1]); // Sy
238 dspine[0][1]=0.0; // dSy/dx[0]
239 dspine[1][1]=-sin(Alpha_min+(Alpha_max-Alpha_min)*x[1])
240 *(Alpha_max-Alpha_min)/L_y; // dSy/dx[1]
241
242 spine[2]=sin(Alpha_min+(Alpha_max-Alpha_min)*x[1]); // Sz
243 dspine[0][2]=0.0; // dSz/dx[0]
244 dspine[1][2]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[1])
245 *(Alpha_max-Alpha_min)/L_y; // dSz/dx[1]
246 }
247 else
248 {
249 /// Spines are dependent of x[0] AND x[1] and rotate in both directions
250 spine[0]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[0]); // Sx
251 dspine[0][0]=-sin(Alpha_min+(Alpha_max-Alpha_min)*x[0])*
252 (Alpha_max-Alpha_min)/L_x; // dSx/dx[0]
253 dspine[1][0]=0.0; // dSx/dx[1]
254
255 spine[1]=cos(Alpha_min+(Alpha_max-Alpha_min)*x[1]); // Sy
256 dspine[0][1]=0.0; // dSy/dx[0]
257 dspine[1][1]=-sin(Alpha_min+(Alpha_max-Alpha_min)*x[1])*
258 (Alpha_max-Alpha_min)/L_y; // dSy/dx[1]
259
260 spine[2]=1.0; // Sz
261 dspine[0][2]=0.0; // dSz/dx[0]
262 dspine[1][2]=0.0; // dSz/dx[1]
263 }
264
265
266 } // End spine function
267
268 // Exact kappa value
269 //------------------
270 double get_exact_kappa()
271 {
273 {
274
276 {
277 // Mean (!) curvature of spherical cap pinned in the
278 // quarter circular mesh (cylindrical tube)
279 return 4.0*Controlled_height/
281 }
282 else if (Case==Barrel_shape)
283 {
284 // Mean (!) curvature of barrel that goes through
285 // the corners of the rectangular domain
286 return 2.0*Controlled_height/
288 }
289 else
290 {
291 std::cout << "No exact solution for this case..." << std::endl;
292 return 0.0;
293 }
294 }
295 else
296 {
297 // Return prescribed kappa no height control
298 return 999; //Kappa_pt->value(0);
299 }
300 }
301
302
303} // end of namespace
304
305#endif
Namespace for "global" problem parameters.
Definition barrel.cc:45
double Alpha_max
Max. spine angle against horizontal plane.
Definition barrel.cc:99
double L_x
Length and width of the domain.
double Controlled_height
Height control value.
Definition barrel.cc:51
unsigned Control_element
Number of element in bulk mesh at which height control is applied. Initialise to 0 – will be overwrit...
double get_exact_kappa()
Exact kappa.
Definition barrel.cc:54
bool Use_height_control
Use height control (true) or not (false)?
double Controlled_height_increment
Increment for height control.
bool Rotate_spines_in_both_directions
Should the spines rotate in the x and y directions (true)?
double Kappa_increment
Increment for prescribed curvature.
bool Use_spines
Use spines (true) or not (false)
void spine_function(const Vector< double > &x, Vector< double > &spine, Vector< Vector< double > > &dspine)
Spine: The spine vector field as a function of the two coordinates x_1 and x_2, and its derivatives w...
Definition barrel.cc:104
double Beta_max
Max. second pine angle against horizontal plane.
unsigned Nsteps
Number of steps.
unsigned N_x
Number of elements in the mesh.
Data * Kappa_pt
Pointer to Data object that stores the prescribed curvature.
void spine_base_function(const Vector< double > &x, Vector< double > &spine_B, Vector< Vector< double > > &dspine_B)
Spine basis: The position vector to the basis of the spine as a function of the two coordinates x_1 a...
Definition barrel.cc:72
double L_y
Width of domain.
double Gamma
Contact angle and its cos (dependent parameter – is reassigned)
Cases
Enumeration for the possible cases.
double Kappa_initial
Initial value for kappa.
double Alpha_min
Min. spine angle against horizontal plane.
Definition barrel.cc:96
double Cos_gamma
Cos of contact angle.
int Case
What case are we considering: Choose one from the enumeration Cases.
double Beta_min
Min. second spine angle against horizontal plane.
int Step_sign
Increase or decrease the value of the control parameters?
void setup_dependent_parameters_and_sanity_check()
Setup dependent parameters and perform sanity check.