MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChuteWithHopperAndInset.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef CHUTEWITHHOPPERANDINSET_H
27 #define CHUTEWITHHOPPERANDINSET_H
28 #include "ChuteWithHopper.h"
29 #include "Statistics.h"
30 
32 
34 protected:
35 
37 private:
44 
46 public:
47 
50 
52  void constructor()
53  {
55  insetHeight=0.2;
56  insetWidth=0.1;
57  insetAngle=15.0*constants::pi/180.0;
58 
59  }
63 
65  void set_Inset(double height, double width, double angle){
66  if (width>=0.0) {insetWidth = width;} else std::cerr << "WARNING : Inset width must be greater than or equal to zero" << std::endl;
67  if (height>=0.0) {insetHeight = height;} else std::cerr << "WARNING : Inset height must be greater than or equal to zero" << std::endl;
68  if (angle>0.0&&angle<90.0) {insetAngle = angle*constants::pi/180.0;} else std::cerr << "WARNING : Inset angle must be widthin (0,90)" << std::endl;
69  }
70 
72  double get_InsetHeight(){return insetHeight;}
73  double get_InsetWidth(){return insetWidth;}
74  double get_InsetAngle(){return insetAngle;}
75 
77  {
79  add_Inset();
80  }
81 
82  void add_Inset() {
83  //std::cout<<"in ChuteWithHopperAndInset::add_Inset()"<<std::endl;
84  int n = get_NWall();
85  set_NWall(n+2);
86 
87  double s = sin(get_ChuteAngle());
88  double c = cos(get_ChuteAngle());
89 
90  Vec3D A, B, C, temp, normal;
91 
94 
97  B = Vec3D(insetWidth, 0.0, 0.0);
98  C = Vec3D(0.0, 0.0, 0.0);
99 
100  //std::cout<<"PUNTEN ABC INSET, A; "<<A<<", B: "<<B<<", C: "<<C<<std::endl;
101 
103  //std::cout<<"dit zijn shift, A, B, C "<<shift<<' '<<A<<' '<<B<<' '<<C<<' '<<std::endl;
104  A.X+= shift;
105  B.X+= shift;
106  C.X+= shift;
107  //std::cout<<"dit zijn A, B, C na shift "<<A<<' '<<B<<' '<<C<<' '<<std::endl;
108 
109  //std::cout<<"Verplaatsen ???: "<<0.5*(HopperLength-HopperExitLength)<<std::endl;
110  //std::cout<<" "<<std::endl;
111  //std::cout<<"ChuteWithHopperAndInset::add_Inset:"<<std::endl;
112  //std::cout<<"HopperHeight: "<<HopperHeight<<std::endl;
113  //std::cout<<"HopperExitLength: "<<HopperExitLength<<std::endl;
114  //std::cout<<"HopperExitHeight: "<<HopperExitHeight<<std::endl;
115  //std::cout<<"HopperAngle: "<<HopperAngle<<std::endl;
116  //std::cout<<"HopperLength: "<<HopperLength<<std::endl;
117  //std::cout<<" "<<std::endl;
118 
119  //double iets=0.5*(HopperLength-HopperExitLength);
120  //A = A+iets;
121  //B = B+iets;
122  //C = C+iets;
123 
124 
126  temp = B-A;
127  normal = Vec3D(temp.Z,0.0,-temp.X) / sqrt(temp.GetLength2());
128  Walls[n].add_finite_wall(normal, Dot(normal,A));
129  temp = C-B;
130  normal = Vec3D(temp.Z,0.0,-temp.X) / sqrt(temp.GetLength2());
131  Walls[n].add_finite_wall(normal, Dot(normal,B));
132  temp = A-C;
133  normal = Vec3D(temp.Z,0.0,-temp.X)/sqrt(temp.GetLength2());
134  Walls[n].add_finite_wall(normal,Dot(normal,C));
135 
136 
137 
138 
141  B = Vec3D(0.0, 0.0, 0.0);
142  C = Vec3D(0.0, 0.0, insetHeight);
143 
145  A.X+= shift;
146  B.X+= shift;
147  C.X+= shift;
148 
150  temp = B-A;
151  normal = Vec3D(temp.Z,0.0,-temp.X) / sqrt(temp.GetLength2());
152  Walls[n+1].add_finite_wall(normal, Dot(normal,A));
153  temp = C-B;
154  normal = Vec3D(temp.Z,0.0,-temp.X) / sqrt(temp.GetLength2());
155  Walls[n+1].add_finite_wall(normal, Dot(normal,B));
156  temp = A-C;
157  normal = Vec3D(temp.Z,0.0,-temp.X)/sqrt(temp.GetLength2());
158  Walls[n+1].add_finite_wall(normal,Dot(normal,C));
159 
160  }
161 
162  virtual void print(std::ostream& os,bool print_all) {
163  ChuteWithHopper::print(os,print_all);
164  os
165  << "insetHeight:" << insetHeight
166  << ", insetWidth:" << insetWidth
167  << ", insetAngle:" << insetAngle
168  << ", insetAngleDeg:" << insetAngle/constants::pi*180.0
169  << std::endl;
170  }
172 };
173 #endif
double get_InsetHeight()
get function for insetHeight, insetWidth, insetAngle
Mdouble X
Definition: Vector.h:44
friend Mdouble GetLength2(const Vec3D &A)
Definition: Vector.h:183
void constructor()
The actually constructor.
virtual void setup_particles_initial_conditions()
initialize particle position, velocity, radius
double shift
The x position where the Chute starts (defined as the beginning of the hopper)
ChuteWithHopperAndInset has a hopper as inflow.
const Mdouble pi
Definition: ExtendedMath.h:54
double Mdouble
Definition: ExtendedMath.h:33
void set_Inset(double height, double width, double angle)
todo check wether the inset and hopper are colliding todo check wether the resulting opening between ...
ChuteWithHopperAndInset()
public variables
ChuteWithHopper has a hopper as inflow.
Mdouble insetWidth
The width of the inset.
Mdouble insetHeight
protected variables
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
virtual void print(std::ostream &os)
virtual void print(std::ostream &os, bool print_all)
This function std::couts all chute data.
Mdouble Z
Definition: Vector.h:44
virtual void setup_particles_initial_conditions()
initialize particle position, velocity, radius
Mdouble get_ChuteAngle()
Gets chute angle (in radians)
Definition: Chute.h:108
Mdouble insetAngle
The angle of the inset (input in degrees, usage in radians)