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(nqtot*nConvectiveFields);
for(int n = 0; n < nConvectiveFields; ++n)
{
int ndim = advVel.num_elements();
Array<OneD, Array<OneD, NekDouble> > AdvVel (advVel.num_elements());
Array<OneD, NekDouble> Outarray;
int nPointsTot = fields[0]->GetNpoints();
Array<OneD, NekDouble> grad0,grad1,grad2,wkSp;
{
nPointsTot = fields[0]->Get1DScaledTotPoints(OneDptscale);
}
grad0 = Array<OneD, NekDouble> (nPointsTot);
int nadv = advVel.num_elements();
{
AdvVel[0] = Array<OneD, NekDouble> (nPointsTot*(nadv+1));
for(int i = 0; i < nadv; ++i)
{
if(i)
{
AdvVel[i] = AdvVel[i-1]+nPointsTot;
}
fields[0]->PhysInterp1DScaled(OneDptscale,advVel[i],AdvVel[i]);
}
Outarray = AdvVel[nadv-1] + nPointsTot;
}
else
{
for(int i = 0; i < nadv; ++i)
{
AdvVel[i] = advVel[i];
}
Outarray = outarray[n];
}
wkSp = Array<OneD, NekDouble> (nPointsTot);
switch(ndim)
{
case 1:
fields[0]->PhysDeriv(inarray[n],grad0);
Vmath::Vmul(nPointsTot,grad0,1,advVel[0],1,outarray[n],1);
break;
case 2:
{
grad1 = Array<OneD, NekDouble> (nPointsTot);
fields[0]->PhysDeriv(inarray[n],grad0,grad1);
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad0,wkSp);
fields[0]->PhysInterp1DScaled(OneDptscale,grad1,wkSp);
}
Vmath::Vmul (nPointsTot,grad0,1,AdvVel[0],1,Outarray,1);
Vmath::Vvtvp(nPointsTot,grad1,1,AdvVel[1],1,Outarray,1,Outarray,1);
{
fields[0]->PhysGalerkinProjection1DScaled(OneDptscale,Outarray,outarray[n]);
}
}
break;
case 3:
grad1 = Array<OneD, NekDouble> (fields[0]->GetNpoints());
grad2 = Array<OneD, NekDouble> (fields[0]->GetNpoints());
{
fields[0]->PhysDeriv(inarray[n],grad0,grad1,grad2);
fields[0]->DealiasedProd(advVel[0],grad0,grad0,
m_CoeffState);
fields[0]->DealiasedProd(advVel[1],grad1,grad1,
m_CoeffState);
fields[0]->DealiasedProd(advVel[2],grad2,grad2,
m_CoeffState);
Vmath::Vadd(nPointsTot,grad2,1,outarray[n],1,outarray[n],1);
}
{
fields[0]->PhysDeriv(advVel[n],grad0,grad1);
outarray[n]);
fields[0]->HomogeneousBwdTrans(outarray[n],grad2);
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad0,wkSp);
}
else
{
Vmath::Vmul(nPointsTot,grad0,1,AdvVel[0],1,Outarray,1);
}
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad1,wkSp);
Outarray,1);
}
else
{
Outarray,1);
}
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad2,wkSp);
Vmath::Vvtvp(nPointsTot,wkSp,1,AdvVel[2],1,Outarray,1,Outarray,1);
fields[0]->PhysGalerkinProjection1DScaled(OneDptscale,Outarray,grad2);
fields[0]->HomogeneousFwdTrans(grad2,outarray[n]);
}
else
{
Vmath::Vvtvp(nPointsTot,grad2,1,AdvVel[2],1,Outarray,1,grad0,1);
fields[0]->HomogeneousFwdTrans(grad0,outarray[n]);
}
}
{
fields[0]->PhysDeriv(inarray[n],grad0,grad1,grad2);
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad0,wkSp);
}
else
{
Vmath::Vmul(nPointsTot,grad0,1,AdvVel[0],1,Outarray,1);
}
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad1,wkSp);
Outarray,1);
}
else
{
Outarray,1);
}
{
fields[0]->PhysInterp1DScaled(OneDptscale,grad2,wkSp);
Vmath::Vvtvp(nPointsTot,wkSp,1,AdvVel[2],1,Outarray,1,Outarray,1);
fields[0]->PhysGalerkinProjection1DScaled(OneDptscale,Outarray,outarray[n]);
}
else
{
Vmath::Vvtvp(nPointsTot,grad2,1,AdvVel[2],1,Outarray,1,outarray[n],1);
}
}
{
fields[0]->PhysDeriv(inarray[n],grad0,grad1,grad2);
fields[0]->HomogeneousBwdTrans(grad0, outarray[n]);
fields[0]->DealiasedProd(advVel[0], outarray[n], grad0,
fields[0]->HomogeneousBwdTrans(grad1,outarray[n]);
fields[0]->DealiasedProd(advVel[1], outarray[n], grad1,
fields[0]->HomogeneousBwdTrans(grad2,outarray[n]);
fields[0]->DealiasedProd(advVel[2], outarray[n], grad2,
fields[0]->HomogeneousFwdTrans(grad0,outarray[n]);
}
else
{
ASSERTL0(
false,
"Advection term calculation not implented or "
"possible with the current problem set up");
}
break;
default:
}
}
}