Nektar++
Loading...
Searching...
No Matches
RigidSolver.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: RigidSolver.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Allows for a moving frame of reference, through adding c * du/dx
32// to the body force, where c is the frame velocity vector
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_SOLVERS_RIGIDSOLVER
37#define NEKTAR_SOLVERS_RIGIDSOLVER
38
39#include <string>
40
48#include <boost/numeric/ublas/io.hpp>
49#include <boost/numeric/ublas/matrix.hpp>
50#include <boost/numeric/ublas/vector.hpp>
51#include <cmath>
52
53namespace Nektar
54{
55
56/***
57 * Solve the body's motion using Newmark-Beta method
58 * M ddx + C dx + K x = F
59 * In discrete form
60 * CoeffMatrix dx = rhs
61 ***/
90
92{
93public:
96 void SetAngle(const Array<OneD, NekDouble> theta);
97 void BodyToInerital(const int dim, const Array<OneD, NekDouble> &body,
98 Array<OneD, NekDouble> &inertial);
99 void IneritalToBody(const int dim, const Array<OneD, NekDouble> &inertial,
101
102private:
104};
105
107{
108public:
110 const MultiRegions::ExpListSharedPtr &pField,
112 void SetMovableDoFs(std::vector<bool> &moveDoFs);
115 Array<OneD, NekDouble> MRFData);
117 const NekDouble &time,
118 Array<OneD, NekDouble> &MRFData);
121 std::map<std::string, std::string> &vParams);
122 inline bool HasFreeDoFs()
123 {
124 return m_hasFreeMotion;
125 };
127
128protected:
130 const TiXmlElement *pSolver);
132 const TiXmlElement *pSolver,
136 std::string expression);
137 void UpdatePrescribed(const NekDouble &time,
138 std::map<int, NekDouble> &Dirs);
140 void SetInitialConditions(std::map<int, NekDouble> &Dirs);
142 const Array<OneD, NekDouble> &forcebody,
143 std::map<int, NekDouble> &Dirs);
145 const bool allowzero,
147 const std::string &FuncName, const std::string &var,
148 std::map<int, LibUtilities::EquationSharedPtr> &result, const int i);
149 void CheckParameters();
150
151private:
153 // bit 1: 1 rotation with only one translational free
154 // bit 0: 0 inertial / 1 body frame
155 // only translational motion or prescribed tranlation with rotational [00]
157 const Array<OneD, NekDouble> &forcebody,
158 std::map<int, NekDouble> &Dirs);
159 // with rotational and all free tranlation [01]
161 const Array<OneD, NekDouble> &forcebody,
162 std::map<int, NekDouble> &Dirs);
163 // with prescribed rotation, 0 y displacement and x free translation [11]
165 const Array<OneD, NekDouble> &forcebody,
166 std::map<int, NekDouble> &Dirs);
177 std::ofstream m_outputStream;
178 std::set<int> m_dirDoFs;
179 // position and velocity
180 // m_vel[0][0,dim], displacement, dim translational + 1 rotation
181 // m_vel[1][0,dim], velocity, dim translational + 1 rotation
182 // m_vel[2][0,dim], acceleration, dim translational + 1 rotation
185 // externel force or moving velocity
186 std::map<int, LibUtilities::EquationSharedPtr> m_extForceFunction;
187 std::map<int, LibUtilities::EquationSharedPtr> m_frameVelFunction;
191 // fluid force
193 // linear system
199 // utility classes
202};
203
204} // namespace Nektar
205
206#endif
void SetAngle(const Array< OneD, NekDouble > theta)
Array< OneD, NekDouble > m_matrix
void IneritalToBody(const int dim, const Array< OneD, NekDouble > &inertial, Array< OneD, NekDouble > &body)
void BodyToInerital(const int dim, const Array< OneD, NekDouble > &body, Array< OneD, NekDouble > &inertial)
Array< OneD, Array< OneD, NekDouble > > m_M
Definition RigidSolver.h:86
Array< OneD, Array< OneD, NekDouble > > m_Matrix
Definition RigidSolver.h:85
void SolveFreeVarMat(Array< OneD, Array< OneD, NekDouble > > u, Array< OneD, NekDouble > force, const NekDouble mass)
void SolveOneFree(Array< OneD, Array< OneD, NekDouble > > u, Array< OneD, NekDouble > force, const Array< OneD, NekDouble > theta, const NekDouble uy, const NekDouble mass)
void SolveFreeFixMat(Array< OneD, Array< OneD, NekDouble > > u, Array< OneD, NekDouble > force)
Array< OneD, NekDouble > m_coeffs
Definition RigidSolver.h:84
std::vector< int > m_index
Definition RigidSolver.h:83
Array< OneD, Array< OneD, NekDouble > > m_C
Definition RigidSolver.h:87
Array< OneD, Array< OneD, NekDouble > > m_K
Definition RigidSolver.h:88
void SetNewmarkBeta(NekDouble beta, NekDouble gamma, NekDouble dt, Array< OneD, NekDouble > M, Array< OneD, NekDouble > C, Array< OneD, NekDouble > K, std::set< int > DirDoFs, int solveType)
void SolvePrescribed(Array< OneD, Array< OneD, NekDouble > > u, std::map< int, NekDouble > motionPrescribed)
Array< OneD, NekDouble > m_pivot
void UpdateMRFData(Array< OneD, NekDouble > &MRFData)
void ParserFunctionToMap(const bool allowzero, const LibUtilities::SessionReaderSharedPtr session, const std::string &FuncName, const std::string &var, std::map< int, LibUtilities::EquationSharedPtr > &result, const int i)
Array< OneD, NekDouble > m_C
void LoadParameters(const LibUtilities::SessionReaderSharedPtr session, const TiXmlElement *pSolver)
Newmark_BetaSolver m_bodySolver
NekDouble m_pivotdistance
std::set< int > m_dirDoFs
Array< OneD, NekDouble > m_inertialPosition
void SetNewmarkBetaSolver(Array< OneD, NekDouble > &AddedMass)
void UpdatePrescribed(const NekDouble &time, std::map< int, NekDouble > &Dirs)
NekDouble EvaluateExpression(const LibUtilities::SessionReaderSharedPtr session, std::string expression)
FrameTransform m_frame
void InitBodySolver(const LibUtilities::SessionReaderSharedPtr session, const TiXmlElement *pSolver, Array< OneD, NekDouble > pivot)
Array< OneD, NekDouble > m_K
NekDouble m_rotaionInertia
void SolveBodyFrame(Array< OneD, Array< OneD, NekDouble > > &bodyVel, const Array< OneD, NekDouble > &forcebody, std::map< int, NekDouble > &Dirs)
void InitObject(const LibUtilities::SessionReaderSharedPtr session, const MultiRegions::ExpListSharedPtr &pField, Array< OneD, NekDouble > pivot)
void SetMovableDoFs(std::vector< bool > &moveDoFs)
std::ofstream m_outputStream
std::map< int, LibUtilities::EquationSharedPtr > m_frameVelFunction
void SetOldFvis(Array< OneD, NekDouble > force)
Array< OneD, NekDouble > m_M
void SetInitialConditions(const LibUtilities::SessionReaderSharedPtr session, Array< OneD, NekDouble > MRFData)
void SolveInertialFrame(Array< OneD, Array< OneD, NekDouble > > &bodyVel, const Array< OneD, NekDouble > &forcebody, std::map< int, NekDouble > &Dirs)
void GetFilterInfo(const LibUtilities::SessionReaderSharedPtr session, std::map< std::string, std::string > &vParams)
Array< OneD, Array< OneD, NekDouble > > m_vel
std::map< int, LibUtilities::EquationSharedPtr > m_extForceFunction
Array< OneD, NekDouble > m_oldFvis
Array< OneD, NekDouble > m_extForceXYZ
void SolveBodyMotion(Array< OneD, Array< OneD, NekDouble > > &bodyVel, const Array< OneD, NekDouble > &forcebody, std::map< int, NekDouble > &Dirs)
void SolveRotOneFree(Array< OneD, Array< OneD, NekDouble > > &bodyVel, const Array< OneD, NekDouble > &forcebody, std::map< int, NekDouble > &Dirs)
NekDouble m_currentTime
void UpdateFrameVelocity(Array< OneD, NekDouble > &aeroforce, const NekDouble &time, Array< OneD, NekDouble > &MRFData)
Updates the forcing array with the current required forcing.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ beta
Gauss Radau pinned at x=-1,.
Definition PointsType.h:59
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.