55 ProcessVorticity::create,
56 "Computes vorticity field.");
70 if (
m_f->m_comm->TreatAsRankZero())
72 cout <<
"ProcessVorticity: Calculating vorticity..." << endl;
77 int expdim =
m_f->m_graph->GetMeshDimension();
78 int spacedim = expdim;
79 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
80 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
84 int nfields =
m_f->m_fielddef[0]->m_fields.size();
87 ASSERTL0(
false,
"Error: Vorticity for a 1D problem cannot "
90 int addfields = (spacedim == 2) ? 1 : 3;
92 int npoints =
m_f->m_exp[0]->GetNpoints();
98 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
100 m_f->m_exp.resize(nfields * nstrips);
102 for (i = 0; i < spacedim * spacedim; ++i)
107 for (i = 0; i < addfields; ++i)
113 for (
int i = 0; i < spacedim; i++)
118 vector<MultiRegions::ExpListSharedPtr> Exp(nstrips * addfields);
123 for (s = 0; s < nstrips; ++s)
128 if (
m_f->m_fieldMetaDataMap.count(
"MappingCartesianVel"))
130 if (
m_f->m_fieldMetaDataMap[
"MappingCartesianVel"] ==
"False")
133 for (
int i = 0; i < spacedim; ++i)
136 if (
m_f->m_exp[0]->GetWaveSpace())
138 m_f->m_exp[0]->HomogeneousBwdTrans(
139 m_f->m_exp[s * nfields + i]->GetPhys(), vel[i]);
144 m_f->m_exp[s * nfields + i]->GetPhys(), 1,
149 mapping->ContravarToCartesian(vel, vel);
151 if (
m_f->m_exp[0]->GetWaveSpace())
153 for (
int i = 0; i < spacedim; ++i)
155 m_f->m_exp[0]->HomogeneousFwdTrans(vel[i], vel[i]);
161 for (
int i = 0; i < spacedim; ++i)
165 m_f->m_exp[s * nfields + i]->GetPhys(), 1,
172 for (
int i = 0; i < spacedim; ++i)
183 for (i = 0; i < spacedim; ++i)
185 m_f->m_exp[s * nfields + i]->PhysDeriv(vel[i], tmp[0], tmp[1]);
186 mapping->CovarToCartesian(tmp, tmp);
187 for (
int j = 0; j < spacedim; j++)
189 Vmath::Vcopy(npoints, tmp[j], 1, grad[i * spacedim + j], 1);
194 grad[0 * spacedim + 1], 1, outfield[0], 1);
198 for (i = 0; i < spacedim; ++i)
200 m_f->m_exp[s * nfields + i]->PhysDeriv(vel[i], tmp[0], tmp[1],
202 mapping->CovarToCartesian(tmp, tmp);
203 for (
int j = 0; j < spacedim; j++)
205 Vmath::Vcopy(npoints, tmp[j], 1, grad[i * spacedim + j], 1);
211 grad[1 * spacedim + 2], 1, outfield[0], 1);
214 grad[2 * spacedim + 0], 1, outfield[1], 1);
217 grad[0 * spacedim + 1], 1, outfield[2], 1);
220 for (i = 0; i < addfields; ++i)
222 int n = s * addfields + i;
224 m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
225 Vmath::Vcopy(npoints, outfield[i], 1, Exp[n]->UpdatePhys(), 1);
226 Exp[n]->FwdTrans_IterPerExp(outfield[i], Exp[n]->UpdateCoeffs());
231 for (s = 0; s < nstrips; ++s)
233 for (i = 0; i < addfields; ++i)
235 it =
m_f->m_exp.begin() + s * (nfields + addfields) + nfields + i;
236 m_f->m_exp.insert(it, Exp[s * addfields + i]);
240 vector<string> outname;
243 outname.push_back(
"W_z");
247 outname.push_back(
"W_x");
248 outname.push_back(
"W_y");
249 outname.push_back(
"W_z");
252 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
253 m_f->m_exp[0]->GetFieldDefinitions();
254 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
256 for (s = 0; s < nstrips; ++s)
258 for (j = 0; j < nfields + addfields; ++j)
260 for (i = 0; i < FieldDef.size() / nstrips; ++i)
262 int n = s * FieldDef.size() / nstrips + i;
266 FieldDef[n]->m_fields.push_back(outname[j - nfields]);
270 FieldDef[n]->m_fields.push_back(
271 m_f->m_fielddef[0]->m_fields[j]);
273 m_f->m_exp[s * (nfields + addfields) + j]->AppendFieldData(
274 FieldDef[n], FieldData[n]);
279 m_f->m_fielddef = FieldDef;
280 m_f->m_data = FieldData;
virtual void Process(po::variables_map &vm)
Write mesh to output file.
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
static GlobalMapping::MappingSharedPtr GetMapping(FieldSharedPtr f)
virtual ~ProcessVorticity()
boost::shared_ptr< Field > FieldSharedPtr
GLOBAL_MAPPING_EXPORT typedef boost::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Abstract base class for processing modules.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.