42#include <boost/core/ignore_unused.hpp>
51 "Computes velocity induced by vortex filaments.");
57 "vortex filaments infomation");
74 std::vector<NekDouble> &value)
77 std::vector<int> digs;
78 std::vector<int> dige;
83 if ((cstr[i] >=
'0' && cstr[i] <=
'9') || cstr[i] ==
'.' ||
84 cstr[i] ==
'e' || cstr[i] ==
'E' || cstr[i] ==
'+' ||
107 for (
int j = 0; j < digs.size(); ++j)
109 std::string cuts(cstr + digs[j], dige[j] - digs[j]);
110 value.push_back(std::stod(cuts));
124 else if (s < 1E-3 * sigma)
126 return 1. / (2. * sigma * sigma);
131 return (1. - exp(-s / (2. * sigma * sigma))) / s;
140 if (
m_f->m_exp[0]->GetNumElmts() == 0)
145 string vorfile =
m_config[
"vortex"].as<
string>();
146 ifstream filament(vorfile.c_str());
147 ASSERTL0(filament.is_open(),
"Unable to open file " + vorfile);
148 std::vector<NekDouble> Uniformflow(3, 0.);
152 while (!filament.eof())
155 std::vector<double> value;
157 if (value.size() >= Nparam)
161 for (
int i = 0; i < Nparam; ++i)
167 else if (value.size() == 3)
174 int Np =
m_f->m_exp[0]->GetTotPoints();
177 for (
int i = 0; i < 3; ++i)
182 m_f->m_exp[0]->GetCoords(coord[0], coord[1], coord[2]);
183 for (
int v = 0; v <
m_vortex.size(); ++v)
196 for (
int i = 0; i < 3; ++i)
202 for (
int p = 0;
p < Np; ++
p)
219 ls = ls /
sqrt(ls * ls + 1.);
224 le = le /
sqrt(le * le + 1.);
227 for (
int i = 0; i < 3; ++i)
229 vel[i][
p] += velcoeff * cross[i];
234 m_f->m_variables.resize(3);
235 vector<string> varsname = {
"u",
"v",
"w"};
237 for (
int n = 0; n < 3; ++n)
239 m_f->m_variables[n] = varsname[n];
240 if (n < m_f->m_exp.size())
246 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
248 m_f->m_exp.insert(
m_f->m_exp.begin() + n, Exp);
250 m_f->m_exp[n]->FwdTransLocalElmt(vel[n],
m_f->m_exp[n]->UpdateCoeffs());
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
Abstract base class for processing modules.
static NekDouble Smooths(NekDouble s, NekDouble sigma)
std::vector< std::vector< NekDouble > > m_vortex
void v_Process(po::variables_map &vm) override
Write mesh to output file.
ProcessVortexInducedVelocity(FieldSharedPtr f)
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
static ModuleKey className
static void ParserDouble(const char *cstr, int n, std::vector< NekDouble > &value)
~ProcessVortexInducedVelocity() override
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void Sub(PointGeom &a, PointGeom &b)
void Mult(PointGeom &a, PointGeom &b)
_this = a x b
NekDouble dot(PointGeom &a)
retun the dot product between this and input a
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static const NekDouble kNekZeroTol
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
scalarT< T > sqrt(scalarT< T > in)
Represents a command-line configuration option.