WaveBEM: Unsteady Nonlinear Potential Flow Solver for Ship-Wave Interaction.
boat_surface.cc
Go to the documentation of this file.
1 //---------------------------- step-34.cc ---------------------------
2 // $Id: step-34.cc 18734 2009-04-25 13:36:48Z heltai $
3 // Version: $Name$
4 //
5 // Copyright (C) 2009, 2011 by the deal.II authors
6 //
7 // This file is subject to QPL and may not be distributed
8 // without copyright and license information. Please refer
9 // to the file deal.II/doc/license.html for the text and
10 // further information on this license.
11 //
12 // Authors: Luca Heltai, Cataldo Manigrasso
13 //
14 //---------------------------- step-34.cc ---------------------------
15 
16 
17 // @sect3{Include files}
18 
19 // The program starts with including a bunch
20 // of include files that we will use in the
21 // various parts of the program. Most of them
22 // have been discussed in previous tutorials
23 // already:
24 
25 
26 #include "../include/boat_surface.h"
27 
28 
29 template <int dim>
31 {}
32 
33 template <int dim>
35 {
36 
37 }
38 
39 template <int dim>
41 {
42 
43 
44 
45 }
46 
47 template <int dim>
48 double BoatSurface<dim>::HullFunction(const Point<dim> point) const
49 {
50 
51 
52  double L = 2.5; //wigley
53  double B = L/10.0; //wigley
54  double T = B/1.6; //wigley
55 
56  //double L = 2.5; // ellipse
57  //double B = 0.5; // ellipse
58  //double T = 1; //ellipse
59 
60  double x = point(0);
61  double y = point(1);
62  double z = point(2);
63 
64  double sign_y;
65 
66  if (fabs(y)/y > 0)
67  sign_y = 1;
68  else if (std::abs(y)/y < 0)
69  sign_y = -1;
70  else
71  sign_y = 0;
72 
73  if (std::abs(x) > L/2.0 || z < -T)
74  {
75  return 0.0;
76  }
77  else
78  {
79  if (z > 0.0)
80  {
81  //return sign_y*B/2.0*sqrt(1.0-pow(x/(L/2.0),2.0)); //ellipse
82  return sign_y*B/2.0*(1.0-pow(2.0*x/L,2.0)); //wigley
83  //return 0; //tank
84  }
85  else if (z == -T) //ellipse
86  {
87  // ellipse
88  return 0; // ellipse ---> return y;
89  } // ellipse
90  else
91  {
92  //return sign_y*B/2.0*sqrt(1.0-pow(x/(L/2.0),2.0)); //ellipse
93  return sign_y*B/2.0*(1.0-pow(2.0*x/L,2.0))*(1.0-pow(z/T,2.0)); //wigley
94  //return 0; //tank
95  }
96  }
97 
98 }
99 
100 template <int dim>
102 {
103 
104 
105  double L = 2.5; // wigley
106  double B = L/10.0; // wigley
107  double T = B/1.6; // wigley
108  //double L = 2.5; // ellipse
109  //double B = 0.5; // ellipse
110  //double T = 1; //ellipse
111 
112  double x = point(0);
113  double y = point(1);
114  double z = point(2);
115 
116  double sign_y;
117 
118  if (fabs(y)/y > 0)
119  sign_y = 1;
120  else if (fabs(y)/y < 0)
121  sign_y = -1;
122  else
123  sign_y = 1;
124 
125  Point<dim> nHull;
126 
127  if (std::abs(x) > L/2.0 || z < -T)
128  {
129  return Point<dim>(0.0,1.0,0.0);
130  }
131  else
132  {
133  if (z > 0.0)
134  {
135  nHull = Point<dim>(4.0*B/(L*L)*x,
136  sign_y,
137  0.0); // wigley
138  //nHull = Point<dim>(-2*B*x/L/L/(sqrt(1.0-pow(x/(L/2.0),2.0))),
139  // -sign_y,
140  // 0.0); // ellipse
141  nHull = nHull/nHull.distance(Point<dim>(0,0,0));
142 
143  //nHull = Point<dim>(0.0,1.0,0.0); //nothing
144 
145  return nHull;
146  }
147  //else if (z == -T) //ellipse
148  // { // ellipse
149  // //return Point<dim>(0,0,1); // ellipse
150  // return Point<dim>(0.0,1.0,0.0);
151  // } // ellipse
152  else
153  {
154  nHull = Point<dim>(4.0*B/(L*L)*(1.0-pow(z/T,2.0))*x,
155  sign_y,
156  B/(T*T)*(1.0-pow(2.0*x/L,2.0))*z); // wigley
157  //nHull = Point<dim>(-2*B*x/L/L/(sqrt(1.0-pow(x/(L/2.0),2.0))),
158  // -sign_y,
159  // 0.0); // ellipse
160  nHull = nHull/nHull.distance(Point<dim>(0,0,0));
161  //return Point<dim>(0.0,1.0,0.0); //nothing
162  return nHull;
163  }
164  }
165 
166 }
167 
168 template <int dim>
170 {
171 
172 
173  double L = 2.5; //wigley
174  double B = L/10.0; //wigley
175  double T = B/1.6; //wigley
176 
177  //double L = 2.5; // ellipse
178  //double B = 0.5; // ellipse
179  //double T = 1; //ellipse
180 
181  double x = point(0);
182  double y = point(1);
183  double z = point(2);
184 
185  double sign_y;
186 
187  if (fabs(y)/y > 0)
188  sign_y = 1;
189  else if (std::abs(y)/y < 0)
190  sign_y = -1;
191  else
192  sign_y = 0;
193 
194  if (std::abs(x) > L/2.0 || z < -T)
195  {
196  return 0.0;
197  }
198  else
199  {
200  if (z > 0.0)
201  {
202  double ds_dx = B/2.0*(-pow(2.0/L,2.0)*2*x);
203  double dds_ddx = B/2.0*(-pow(2.0/L,2.0)*2.0);
204  double ds_dz = 0.0;
205  double dds_ddz = 0.0;
206  double dds_dxdz = 0.0;
207  return sign_y*0.5*((1+ds_dx*ds_dx)*dds_ddz -2.0*ds_dx*ds_dz*dds_dxdz + (1+ds_dz*ds_dz)*dds_ddx)/
208  pow(1+ds_dx*ds_dx+ds_dz*ds_dz,1.5);
209  }
210  else
211  {
212  double ds_dx = B/2.0*(-pow(2.0/L,2.0)*2*x)*(1.0-pow(z/T,2.0));
213  double dds_ddx = B/2.0*(-pow(2.0/L,2.0)*2.0)*(1.0-pow(z/T,2.0));
214  double ds_dz = B/2.0*(1.0-pow(2.0*x/L,2.0))*(-pow(1/T,2.0)*2.0*z);
215  double dds_ddz = B/2.0*(1.0-pow(2.0*x/L,2.0))*(-pow(1/T,2.0)*2.0*z);
216  double dds_dxdz = B/2.0*(-pow(2.0/L,2.0)*2*x)*(-pow(1/T,2.0)*2.0*z);
217 
218  return sign_y*0.5*((1+ds_dx*ds_dx)*dds_ddz -2.0*ds_dx*ds_dz*dds_dxdz + (1+ds_dz*ds_dz)*dds_ddx)/
219  pow(1+ds_dx*ds_dx+ds_dz*ds_dz,1.5);
220  }
221  }
222 
223 }
224 
225 
226 template <int dim>
228 (const typename Triangulation< dim-1,dim >::line_iterator &line) const
229 {
231  newp(1) = HullFunction(newp);
232  return newp;
233 }
234 
235 
236 template <int dim>
238 (const typename Triangulation< dim-1,dim >::quad_iterator &quad) const
239 {
240 
242  newp(1) = HullFunction(newp);
243  return newp;
244 }
245 
246 template class BoatSurface<3>;
void parse_parameters(ParameterHandler &prm)
Definition: boat_surface.cc:40
void declare_parameters(ParameterHandler &prm)
Definition: boat_surface.cc:34
Tensor< 1, dim, Type > & T(Point< dim, Type > &p)
Definition: free_surface.h:89
virtual Point< dim > get_new_point_on_quad(const typename Triangulation< dim-1, dim >::quad_iterator &quad) const
numbers::NumberTraits< double >::real_type distance(const Point< dim, double > &p) const
virtual Point< spacedim > get_new_point_on_line(const typename Triangulation< dim, spacedim >::line_iterator &line) const
virtual Point< dim > get_new_point_on_line(const typename Triangulation< dim-1, dim >::line_iterator &line) const
double HullFunction(const Point< dim > point) const
Definition: boat_surface.cc:48
virtual Point< spacedim > get_new_point_on_quad(const typename Triangulation< dim, spacedim >::quad_iterator &quad) const
Point< dim > HullNormal(const Point< dim > point) const
double HullMeanCurvature(const Point< dim > point) const