55 ProcessVorticity::create,
"Computes vorticity field.");
69 if(
m_f->m_comm->GetRank() == 0)
71 cout <<
"ProcessVorticity: Calculating vorticity..." << endl;
76 int expdim =
m_f->m_graph->GetMeshDimension();
77 int spacedim = expdim;
78 if ((
m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
79 (
m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
83 int nfields =
m_f->m_fielddef[0]->m_fields.size();
86 ASSERTL0(
false,
"Error: Vorticity for a 1D problem cannot "
89 int addfields = (spacedim == 2)? 1:3;
91 int npoints =
m_f->m_exp[0]->GetNpoints();
97 m_f->m_session->LoadParameter(
"Strip_Z",nstrips,1);
99 m_f->m_exp.resize(nfields*nstrips);
101 for (i = 0; i < spacedim*spacedim; ++i)
106 for (i = 0; i < addfields; ++i)
112 for(
int i = 0; i<spacedim; i++)
117 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(),
150 mapping->ContravarToCartesian(vel, vel);
152 if (
m_f->m_exp[0]->GetWaveSpace())
154 for (
int i =0; i<spacedim; ++i )
156 m_f->m_exp[0]->HomogeneousFwdTrans(vel[i], vel[i]);
162 for (
int i =0; i<spacedim; ++i )
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],
188 mapping->CovarToCartesian(tmp, tmp);
189 for(
int j = 0; j<spacedim; j++)
191 Vmath::Vcopy(npoints, tmp[j], 1, grad[i*spacedim+j], 1 );
196 grad[0*spacedim+1], 1,
201 for (i = 0; i < spacedim; ++i)
203 m_f->m_exp[s*nfields+i]->PhysDeriv(vel[i],
207 mapping->CovarToCartesian(tmp, tmp);
208 for(
int j = 0; j<spacedim; j++)
210 Vmath::Vcopy(npoints, tmp[j], 1, grad[i*spacedim+j], 1 );
215 Vmath::Vsub(npoints, grad[2*spacedim+1], 1, grad[1*spacedim+2], 1,
218 Vmath::Vsub(npoints, grad[0*spacedim+2], 1, grad[2*spacedim+0], 1,
221 Vmath::Vsub(npoints, grad[1*spacedim+0], 1, grad[0*spacedim+1], 1,
225 for (i = 0; i < addfields; ++i)
227 int n = s*addfields + i;
228 Exp[n] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
229 Exp[n]->UpdatePhys() = outfield[i];
230 Exp[n]->FwdTrans_IterPerExp(outfield[i],
231 Exp[n]->UpdateCoeffs());
236 for(s = 0; s < nstrips; ++s)
238 for(i = 0; i < addfields; ++i)
240 it =
m_f->m_exp.begin()+s*(nfields+addfields)+nfields+i;
241 m_f->m_exp.insert(it, Exp[s*addfields+i]);
245 vector<string > outname;
248 outname.push_back(
"W_z");
252 outname.push_back(
"W_x");
253 outname.push_back(
"W_y");
254 outname.push_back(
"W_z");
257 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
258 =
m_f->m_exp[0]->GetFieldDefinitions();
259 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
261 for(s = 0; s < nstrips; ++s)
263 for (j = 0; j < nfields + addfields; ++j)
265 for (i = 0; i < FieldDef.size()/nstrips; ++i)
267 int n = s * FieldDef.size()/nstrips + i;
271 FieldDef[n]->m_fields.push_back(outname[j-nfields]);
275 FieldDef[n]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[j]);
277 m_f->m_exp[s*(nfields + addfields)+j]->AppendFieldData(FieldDef[n], FieldData[n]);
282 m_f->m_fielddef = FieldDef;
283 m_f->m_data = FieldData;
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
FieldSharedPtr m_f
Field object.
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
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.