52 ProcessVorticity::create,
"Computes vorticity field.");
66 cout <<
"ProcessVorticity: Calculating vorticity..." << endl;
70 int expdim =
m_f->m_graph->GetMeshDimension();
71 int spacedim = expdim;
72 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
73 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
77 int nfields =
m_f->m_fielddef[0]->m_fields.size();
80 ASSERTL0(
false,
"Error: Vorticity for a 1D problem cannot "
83 int addfields = (spacedim == 2)? 1:3;
85 int npoints =
m_f->m_exp[0]->GetNpoints();
86 Array<OneD, Array<OneD, NekDouble> > grad(nfields*nfields);
87 Array<OneD, Array<OneD, NekDouble> > outfield(addfields);
88 m_f->m_exp.resize(nfields+addfields);
91 for (i = 0; i < nfields*nfields; ++i)
93 grad[i] = Array<OneD, NekDouble>(npoints);
96 for (i = 0; i < addfields; ++i)
98 outfield[i] = Array<OneD, NekDouble>(npoints);
104 for (i = 0; i < nfields; ++i)
106 m_f->m_exp[i]->PhysDeriv(
m_f->m_exp[i]->GetPhys(),
112 grad[0*nfields+1], 1,
117 for (i = 0; i < nfields; ++i)
120 m_f->m_exp[i]->PhysDeriv(
m_f->m_exp[i]->GetPhys(),
127 Vmath::Vsub(npoints, grad[2*nfields+1], 1, grad[1*nfields+2], 1,
130 Vmath::Vsub(npoints, grad[0*nfields+2], 1, grad[2*nfields+0], 1,
133 Vmath::Vsub(npoints, grad[1*nfields+0], 1, grad[0*nfields+1], 1,
137 for (i = 0; i < addfields; ++i)
139 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
140 m_f->m_exp[nfields + i]->UpdatePhys() = outfield[i];
141 m_f->m_exp[nfields + i]->FwdTrans_IterPerExp(outfield[i],
142 m_f->m_exp[nfields + i]->UpdateCoeffs());
145 vector<string > outname;
148 outname.push_back(
"W_z");
152 outname.push_back(
"W_x");
153 outname.push_back(
"W_y");
154 outname.push_back(
"W_z");
157 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
158 =
m_f->m_exp[0]->GetFieldDefinitions();
159 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
161 for (j = 0; j < nfields + addfields; ++j)
163 for (i = 0; i < FieldDef.size(); ++i)
167 FieldDef[i]->m_fields.push_back(outname[j-nfields]);
171 FieldDef[i]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[j]);
173 m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
177 m_f->m_fielddef = FieldDef;
178 m_f->m_data = FieldData;