libsurf
Programmer's Documentation

smwingmesh.h (r6227/r5337)
1 
2 /* Copyright (C) 2015 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_SMWINGMESH_H
16 #define SURF_SMWINGMESH_H
17 
18 #include "forward.h"
19 #include "smribmesh.h"
20 
21 class NstMesh;
22 class SmWingMesh;
23 
24 extern int nearest_index(const Vector & a, Real b);
25 
39 {
40 public:
41 
43  SmControlSurf(Real v1, Real v2, Real hxc, uint shell, uint rib) :
44  vlo(v1), vhi(v2), xc(hxc), pidshell(shell), pidrib(rib),
45  pidwingrib(0), nhinge(4), cmass(0.0), cspring(0.0) {}
46 
48  Real vlo, vhi;
49 
51  Real xc;
52 
54  uint pidshell;
55 
57  uint pidrib;
58 
60  uint pidwingrib;
61 
63  uint nhinge;
64 
66  Real cmass, cspring;
67 
69  std::string id;
70 
71 private:
72 
73  uint itop, ibot, iv1, iv2;
74  Vct3 psact, pwact, hax;
75  PointList<3> phinge;
76 
77  friend class SmWingMesh;
78 };
79 
93 {
94 public:
95 
97  SmWingMesh(SurfacePtr s) : m_psf(s), m_xbox1(0.25), m_xbox2(0.65) {}
98 
102  void wingBox(Real xc1, Real xc2) {m_xbox1=xc1; m_xbox2=xc2;}
103 
105  uint setTrailingEdgeFlap(Real v1, Real v2, Real hxc,
106  uint pidshell, uint pidrib);
107 
109  uint setTrailingEdgeFlap(const SmControlSurf & cs);
110 
115  void setWebPid(uint pweb, uint ple, uint matcoord=0) {
116  m_mcid = matcoord;
117  m_pid_web = pweb;
118  m_pid_lete = ple;
119  }
120 
124  void addBoxPid(Real vlim, uint pid) {
125  m_pid_vlimits.push_back(vlim);
126  m_pid_wingbox.push_back(pid);
127  }
128 
135  void grid(uint nv, uint nle, uint nwb, uint nte, uint nweb=5);
136 
138  uint rowIndex(Real v) const {
139  return nearest_index(m_vp, v);
140  }
141 
143  const Vct3 & vertex(uint i, uint j) const {return m_pgrid(i,j);}
144 
146  void wingBoxRows(uint idx[]) const {
147  idx[0] = m_giwb2_up;
148  idx[1] = m_giwb1_up;
149  idx[2] = m_giwb1_lo;
150  idx[3] = m_giwb2_lo;
151  }
152 
154  void addQuads(NstMesh & nst);
155 
160  uint createRib(uint vi, uint pid=0, uint mid=0);
161 
163  SmRibMesh & rib(uint irib) {
164  assert(irib < m_ribs.size());
165  return m_ribs[irib];
166  }
167 
173  void findConnectors(uint vi, PointList<3> & pcon) const;
174 
176  void appendControls(XmlElement & xe) const;
177 
178 private:
179 
181  void initLE();
182 
184  Real findUpper(uint iv, Real xc, Real utol=1e-4) const;
185 
187  Real findLower(uint iv, Real xc, Real utol=1e-4) const;
188 
190  bool isMirrored() const;
191 
193  void addControlQuads(NstMesh & nst, Real gap);
194 
196  void connectFlaps(NstMesh & nst) const;
197 
198 private:
199 
201  SurfacePtr m_psf;
202 
204  Vector m_vp;
205 
207  VectorArray m_up;
208 
210  Vector m_ule, m_umean;
211 
213  PointGrid<3> m_pgrid, m_mweb, m_rweb;
214 
216  Real m_xbox1, m_xbox2;
217 
219  uint m_giwb2_up, m_giwb1_up, m_giwb1_lo, m_giwb2_lo;
220 
222  uint m_mcid, m_pid_lete, m_pid_web;
223 
225  Vector m_pid_wingbox, m_pid_vlimits;
226 
228  std::vector<SmControlSurf> m_flaps;
229 
231  std::vector<SmRibMesh> m_ribs;
232 };
233 
234 #endif
void grid(uint nv, uint nle, uint nwb, uint nte, uint nweb=5)
Generate mesh grid.
Definition: smwingmesh.cpp:40
void findConnectors(uint vi, PointList< 3 > &pcon) const
Locate possible connection points.
Definition: smwingmesh.cpp:500
Nastran mesh.
Definition: nstmesh.h:35
std::vector< SmControlSurf > m_flaps
control surface cutout definitions
Definition: smwingmesh.h:228
SmControlSurf(Real v1, Real v2, Real hxc, uint shell, uint rib)
construct default control surface
Definition: smwingmesh.h:43
uint m_giwb2_up
grid dimensions
Definition: smwingmesh.h:219
Real findUpper(uint iv, Real xc, Real utol=1e-4) const
locate relative position on upper side
Definition: smwingmesh.cpp:538
std::vector< SmRibMesh > m_ribs
ribs (possibly with cutouts)
Definition: smwingmesh.h:231
const Vct3 & vertex(uint i, uint j) const
access main shell grid vertex
Definition: smwingmesh.h:143
Template for wing mesh generation.
Definition: smwingmesh.h:92
Real xc
chordwise location of the hinge line (x/c)
Definition: smwingmesh.h:51
bool isMirrored() const
test is wing is symmetric
Definition: smwingmesh.cpp:580
void connectFlaps(NstMesh &nst) const
generate joints between flaps and main wing
Definition: smwingmesh.cpp:425
uint m_mcid
property IDs
Definition: smwingmesh.h:222
void addControlQuads(NstMesh &nst, Real gap)
generate control surface quads
Definition: smwingmesh.cpp:279
void addBoxPid(Real vlim, uint pid)
Define an additional wing-box skin property region.
Definition: smwingmesh.h:124
Description of control surface structure.
Definition: smwingmesh.h:38
uint createRib(uint vi, uint pid=0, uint mid=0)
Generate a chordwise rib.
Definition: smwingmesh.cpp:237
Real findLower(uint iv, Real xc, Real utol=1e-4) const
locate relative position on lower side
Definition: smwingmesh.cpp:559
PointGrid< 3 > m_pgrid
point grids for wingbox webs
Definition: smwingmesh.h:213
void setWebPid(uint pweb, uint ple, uint matcoord=0)
Spar web properties.
Definition: smwingmesh.h:115
uint pidshell
shell property (PID) for upper/lower surface
Definition: smwingmesh.h:54
void appendControls(XmlElement &xe) const
generate control surface xml description for dwfs
Definition: smwingmesh.cpp:509
Real cmass
scalar mass and attachment spring
Definition: smwingmesh.h:66
std::string id
control surface name
Definition: smwingmesh.h:69
Real m_xbox1
wing box limits in terms of chord
Definition: smwingmesh.h:216
SmRibMesh & rib(uint irib)
access rib
Definition: smwingmesh.h:163
Vector m_vp
v-positions
Definition: smwingmesh.h:204
SurfacePtr m_psf
surface object
Definition: smwingmesh.h:201
Real vlo
lower and upper limits in terms of spanwise coordinate
Definition: smwingmesh.h:48
uint pidrib
shell property (PID) for inside ribs
Definition: smwingmesh.h:57
uint nhinge
number of hinges in spanwise direction
Definition: smwingmesh.h:63
Structural mesh for ribs.
Definition: smribmesh.h:26
Vector m_pid_wingbox
wingbox cap PIDs
Definition: smwingmesh.h:225
void addQuads(NstMesh &nst)
add quad elements to Nastran mesh
Definition: smwingmesh.cpp:145
SmWingMesh(SurfacePtr s)
initialize with surface
Definition: smwingmesh.h:97
void initLE()
locate leading edges
Definition: smwingmesh.cpp:478
uint rowIndex(Real v) const
grid row index nearest to span coordinate v
Definition: smwingmesh.h:138
void wingBox(Real xc1, Real xc2)
Define wing-box limits.
Definition: smwingmesh.h:102
void wingBoxRows(uint idx[]) const
row index positions of the wing box cap limits
Definition: smwingmesh.h:146
uint pidwingrib
shell property (PID) for local wing rib (default 0=none)
Definition: smwingmesh.h:60
VectorArray m_up
u-positions
Definition: smwingmesh.h:207
Vector m_ule
u-value at leading-edge
Definition: smwingmesh.h:210
uint setTrailingEdgeFlap(Real v1, Real v2, Real hxc, uint pidshell, uint pidrib)
generate control surface (basic form)
Definition: smwingmesh.cpp:29
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5