Advects a vector field.
{
int nqtot = fields[0]->GetTotPoints();
ASSERTL1(nConvectiveFields == inarray.num_elements(),
"Number of convective fields and Inarray are not compatible");
Array<OneD, NekDouble > Deriv = Array<OneD, NekDouble> (nqtot*nConvectiveFields);
for(int n = 0; n < nConvectiveFields; ++n)
{
int ndim = advVel.num_elements();
int nPointsTot = fields[0]->GetNpoints();
Array<OneD, NekDouble> gradV0,gradV1,gradV2, tmp, Up;
gradV0 = Array<OneD, NekDouble> (nPointsTot);
tmp = Array<OneD, NekDouble> (nPointsTot);
switch(ndim)
{
case 1:
fields[0]->PhysDeriv(inarray[n],gradV0);
Vmath::Vmul(nPointsTot,gradV0,1,advVel[0],1,outarray[n],1);
Vmath::Vmul(nPointsTot,inarray[n],1,advVel[0],1,gradV0,1);
fields[0]->PhysDeriv(gradV0,tmp);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
break;
case 2:
gradV1 = Array<OneD, NekDouble> (nPointsTot);
fields[0]->PhysDeriv(inarray[n],gradV0,gradV1);
Vmath::Vmul (nPointsTot,gradV0,1,advVel[0],1,outarray[n],1);
Vmath::Vvtvp(nPointsTot,gradV1,1,advVel[1],1,outarray[n],1,outarray[n],1);
Vmath::Vmul(nPointsTot,inarray[n],1,advVel[0],1,gradV0,1);
Vmath::Vmul(nPointsTot,inarray[n],1,advVel[1],1,gradV1,1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
break;
case 3:
gradV1 = Array<OneD, NekDouble> (nPointsTot);
gradV2 = Array<OneD, NekDouble> (nPointsTot);
fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
{
fields[0]->DealiasedProd(advVel[0],gradV0,gradV0,
m_CoeffState);
fields[0]->DealiasedProd(advVel[1],gradV1,gradV1,
m_CoeffState);
fields[0]->DealiasedProd(advVel[2],gradV2,gradV2,
m_CoeffState);
Vmath::Vadd(nPointsTot,gradV0,1,gradV1,1,outarray[n],1);
Vmath::Vadd(nPointsTot,gradV2,1,outarray[n],1,outarray[n],1);
fields[0]->DealiasedProd(inarray[n],advVel[0],gradV0,
m_CoeffState);
fields[0]->DealiasedProd(inarray[n],advVel[1],gradV1,
m_CoeffState);
fields[0]->DealiasedProd(inarray[n],advVel[2],gradV2,
m_CoeffState);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
}
{
Up = Array<OneD, NekDouble> (nPointsTot);
fields[0]->HomogeneousBwdTrans(gradV0,tmp);
Vmath::Vmul(nPointsTot,tmp,1,advVel[0],1,outarray[n],1);
fields[0]->HomogeneousBwdTrans(gradV1,tmp);
Vmath::Vvtvp(nPointsTot,tmp,1,advVel[1],1,outarray[n],1,outarray[n],1);
fields[0]->HomogeneousBwdTrans(gradV2,tmp);
Vmath::Vvtvp(nPointsTot,tmp,1,advVel[2],1,outarray[n],1,outarray[n],1);
fields[0]->HomogeneousBwdTrans(inarray[n],Up);
fields[0]->SetWaveSpace(false);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
fields[0]->SetWaveSpace(true);
fields[0]->HomogeneousFwdTrans(tmp,outarray[n]);
}
{
Vmath::Vmul(nPointsTot,gradV0,1,advVel[0],1,outarray[n],1);
Vmath::Vvtvp(nPointsTot,gradV1,1,advVel[1],1,outarray[n],1,outarray[n],1);
Vmath::Vvtvp(nPointsTot,gradV2,1,advVel[2],1,outarray[n],1,outarray[n],1);
Vmath::Vmul(nPointsTot,inarray[n],1,advVel[0],1,gradV0,1);
Vmath::Vmul(nPointsTot,inarray[n],1,advVel[1],1,gradV1,1);
Vmath::Vmul(nPointsTot,inarray[n],1,advVel[2],1,gradV2,1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
}
else
{
ASSERTL0(
false,
"Dealiasing is not allowed in combination "
"with the Skew-Symmetric advection form for "
"efficiency reasons.");
}
break;
default:
}
}
}