53 ProcessVorticity::create,
"Computes vorticity field.");
67 cout <<
"ProcessVorticity: Calculating vorticity..." << endl;
71 int expdim =
m_f->m_graph->GetMeshDimension();
72 int spacedim = expdim;
73 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
74 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
78 int nfields =
m_f->m_fielddef[0]->m_fields.size();
81 ASSERTL0(
false,
"Error: Vorticity for a 1D problem cannot "
84 int addfields = (spacedim == 2)? 1:3;
86 int npoints =
m_f->m_exp[0]->GetNpoints();
92 m_f->m_session->LoadParameter(
"Strip_Z",nstrips,1);
94 m_f->m_exp.resize(nfields*nstrips);
96 for (i = 0; i < nfields*nfields; ++i)
101 for (i = 0; i < addfields; ++i)
106 vector<MultiRegions::ExpListSharedPtr> Exp(nstrips*addfields);
108 for(s = 0; s < nstrips; ++s)
113 for (i = 0; i < nfields; ++i)
115 m_f->m_exp[s*nfields+i]->PhysDeriv(
m_f->m_exp[s*nfields+i]->GetPhys(),
121 grad[0*nfields+1], 1,
126 for (i = 0; i < nfields; ++i)
129 m_f->m_exp[s*nfields+i]->PhysDeriv(
m_f->m_exp[s*nfields+i]->GetPhys(),
136 Vmath::Vsub(npoints, grad[2*nfields+1], 1, grad[1*nfields+2], 1,
139 Vmath::Vsub(npoints, grad[0*nfields+2], 1, grad[2*nfields+0], 1,
142 Vmath::Vsub(npoints, grad[1*nfields+0], 1, grad[0*nfields+1], 1,
146 for (i = 0; i < addfields; ++i)
148 int n = s*addfields + i;
149 Exp[n] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
150 Exp[n]->UpdatePhys() = outfield[i];
151 Exp[n]->FwdTrans_IterPerExp(outfield[i],
152 Exp[n]->UpdateCoeffs());
157 for(s = 0; s < nstrips; ++s)
159 for(i = 0; i < addfields; ++i)
161 it =
m_f->m_exp.begin()+s*(nfields+addfields)+nfields+i;
162 m_f->m_exp.insert(it, Exp[s*addfields+i]);
166 vector<string > outname;
169 outname.push_back(
"W_z");
173 outname.push_back(
"W_x");
174 outname.push_back(
"W_y");
175 outname.push_back(
"W_z");
178 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
179 =
m_f->m_exp[0]->GetFieldDefinitions();
180 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
182 for(s = 0; s < nstrips; ++s)
184 for (j = 0; j < nfields + addfields; ++j)
186 for (i = 0; i < FieldDef.size()/nstrips; ++i)
188 int n = s * FieldDef.size()/nstrips + i;
192 FieldDef[n]->m_fields.push_back(outname[j-nfields]);
196 FieldDef[n]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[j]);
198 m_f->m_exp[s*(nfields + addfields)+j]->AppendFieldData(FieldDef[n], FieldData[n]);
203 m_f->m_fielddef = FieldDef;
204 m_f->m_data = FieldData;
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
FieldSharedPtr m_f
Field object.
virtual ~ProcessVorticity()
boost::shared_ptr< Field > FieldSharedPtr
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
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.