mantaflow  0.10
A framework for fluid simulation
vortexsheet.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3  *
4  * MantaFlow fluid solver framework
5  * Copyright 2011 Tobias Pfaff, Nils Thuerey
6  *
7  * This program is free software, distributed under the terms of the
8  * GNU General Public License (GPL)
9  * http://www.gnu.org/licenses
10  *
11  * Vortex sheets
12  * (warning, the vortex methods are currently experimental, and not fully supported!)
13  *
14  ******************************************************************************/
15 
16 #ifndef _VORTEXSHEET_H
17 #define _VORTEXSHEET_H
18 
19 #include "mesh.h"
20 
21 namespace Manta {
22 
25  VortexSheetInfo() : vorticity(0.0), vorticitySmoothed(0.0), circulation(0.0), smokeAmount(1.0), smokeParticles(0.0) {}
26 
27  Vec3 vorticity;
28  Vec3 vorticitySmoothed;
29  Vec3 circulation;
30  Real smokeAmount, smokeParticles;
31 };
32 
34 struct VorticityChannel : public SimpleTriChannel<VortexSheetInfo> {
35  virtual TriChannel* clone() { VorticityChannel* vc = new VorticityChannel(); *vc = *this; return vc;}
36 };
37 
39 struct TexCoord3Channel : public SimpleNodeChannel<Vec3> {
40  virtual NodeChannel* clone() { TexCoord3Channel* tc = new TexCoord3Channel(); *tc = *this; return tc; }
41 
42  void addInterpol(int a, int b, Real alpha) { data.push_back((1.0-alpha)*data[a] + alpha*data[b]);}
43  void mergeWith(int node, int delnode, Real alpha) { data[node] = 0.5*(data[node]+data[delnode]); }
44 };
45 
47  TurbulenceInfo() : k(0.0), epsilon(0.0) {}
48  TurbulenceInfo(const TurbulenceInfo& a, const TurbulenceInfo& b, Real alpha) : k((1.0-alpha)*a.k+alpha*b.k), epsilon((1.0-alpha)*a.epsilon+alpha*b.epsilon) {}
49  Real k, epsilon;
50 };
51 
53 struct TurbulenceChannel : public SimpleNodeChannel<TurbulenceInfo> {
54  virtual NodeChannel* clone() { TurbulenceChannel* tc = new TurbulenceChannel(); *tc = *this; return tc; }
55 
56  void addInterpol(int a, int b, Real alpha) { data.push_back(TurbulenceInfo(data[a], data[b], alpha)); }
57  void mergeWith(int node, int delnode, Real alpha) { data[node] = TurbulenceInfo(data[node], data[delnode], 0.5); }
58 };
59 
62 PYTHON class VortexSheetMesh : public Mesh {
63 public:
64  PYTHON() VortexSheetMesh(FluidSolver* parent);
65  virtual Mesh* clone();
66 
67  virtual MeshType getType() { return TypeVortexSheet; }
68 
69  inline VortexSheetInfo& sheet(int i) { return mVorticity.data[i]; };
70  inline Vec3& tex1(int i) { return mTex1.data[i]; }
71  inline Vec3& tex2(int i) { return mTex2.data[i]; }
72  inline TurbulenceInfo& turb(int i) { return mTurb.data[i]; }
73  void setReferenceTexOffset(const Vec3& ref) { mTexOffset = ref; }
74  void resetTex1();
75  void resetTex2();
76 
77  PYTHON() void calcCirculation();
78  PYTHON() void calcVorticity();
79  PYTHON() void reinitTexCoords();
80 
81 protected:
82  Vec3 mTexOffset;
83  VorticityChannel mVorticity;
84  TexCoord3Channel mTex1, mTex2;
85  TurbulenceChannel mTurb;
86 };
87 
88 }; // namespace
89 
90 #endif
91 
92 
Definition: commonkernels.h:22
Manages vortex sheet info.
Definition: vortexsheet.h:34
Base class for mesh data channels (texture coords, vorticity, ...)
Definition: mesh.h:90
Stores vortex sheet info.
Definition: vortexsheet.h:24
Manages k-epsilon information.
Definition: vortexsheet.h:53
Basic inlined vector class.
Definition: vectorbase.h:71
Node channel using only a vector.
Definition: mesh.h:77
Definition: vortexsheet.h:46
Triangle mesh class.
Definition: mesh.h:126
Base class for mesh data channels (texture coords, vorticity, ...)
Definition: mesh.h:64
Definition: vortexsheet.h:62
Manages 3D texture coordinates.
Definition: vortexsheet.h:39
Tri channel using only a vector.
Definition: mesh.h:103
Definition: fluidsolver.h:28