83 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
85 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
88 if((HomoStr ==
"HOMOGENEOUS1D")||(HomoStr ==
"Homogeneous1D")||
89 (HomoStr ==
"1D")||(HomoStr ==
"Homo1D"))
95 if(
m_session->DefinesSolverInfo(
"ModeType"))
101 if(
m_session->DefinesSolverInfo(
"ModeType"))
119 ASSERTL0(
false,
"SolverInfo ModeType not valid");
132 if((HomoStr ==
"HOMOGENEOUS2D")||(HomoStr ==
"Homogeneous2D")||
133 (HomoStr ==
"2D")||(HomoStr ==
"Homo2D"))
143 if((HomoStr ==
"HOMOGENEOUS3D")||(HomoStr ==
"Homogeneous3D")||
144 (HomoStr ==
"3D")||(HomoStr ==
"Homo3D"))
156 if(
m_session->DefinesSolverInfo(
"USEFFT"))
166 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
168 std::string ProjectStr
169 =
m_session->GetSolverInfo(
"PROJECTION");
171 if((ProjectStr ==
"Continuous")||(ProjectStr ==
"Galerkin")||
172 (ProjectStr ==
"CONTINUOUS")||(ProjectStr ==
"GALERKIN"))
176 else if(ProjectStr ==
"DisContinuous")
182 ASSERTL0(
false,
"PROJECTION value not recognised");
187 cerr <<
"Projection type not specified in SOLVERINFO,"
188 "defaulting to continuous Galerkin" << endl;
194 "Base flow must be defined for linearised forms.");
195 string file =
m_session->GetFunctionFilename(
"BaseFlow", 0);
199 if(
m_session->DefinesParameter(
"N_slices"))
208 ASSERTL0(
false,
"Number of slices must be a positive number greater than 1");
226 int nq =
m_base[0]->GetNpoints();
227 Array<OneD,NekDouble> x0(nq);
228 Array<OneD,NekDouble> x1(nq);
229 Array<OneD,NekDouble> x2(nq);
233 m_base[0]->GetCoords(x0,x1,x2);
234 for(
unsigned int i = 0 ; i <
m_base.num_elements(); i++)
239 ifunc->Evaluate(x0,x1,x2,
m_base[i]->UpdatePhys());
241 m_base[i]->SetPhysState(
true);
243 m_base[i]->UpdateCoeffs());
275 for(i = 0 ; i <
m_base.num_elements(); i++)
284 for(i = 0 ; i <
m_base.num_elements(); i++)
303 for(i = 0 ; i <
m_base.num_elements(); i++)
316 for(i = 0 ; i <
m_base.num_elements(); i++)
329 for(i = 0 ; i <
m_base.num_elements(); i++)
333 m_base[i]->SetWaveSpace(
false);
347 for(i = 1 ; i < m_base.num_elements(); i++)
360 ASSERTL0(
false,
"3D fully periodic problems not implemented yet");
370 for(i = 1 ; i < m_base.num_elements(); i++)
380 ASSERTL0(
false,
"Expansion dimension not recognised");
397 for(i = 0 ; i <
m_base.num_elements(); i++)
405 for(i = 0 ; i <
m_base.num_elements(); i++)
422 for(i = 0 ; i <
m_base.num_elements(); i++)
433 for(i = 0 ; i <
m_base.num_elements(); i++)
446 ASSERTL0(
false,
"Expansion dimension not recognised");
462 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
463 std::vector<std::vector<NekDouble> > FieldData;
464 int nqtot =
m_base[0]->GetTotPoints();
470 fld->Import(pInfile, FieldDef, FieldData);
472 int nvar =
m_session->GetVariables().size();
475 if(
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
477 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
481 for(
int j = 0; j < nvar; ++j)
483 for(
int i = 0; i < FieldDef.size(); ++i)
485 if ((
m_session->DefinesSolverInfo(
"HOMOGENEOUS") &&
486 (
m_session->GetSolverInfo(
"HOMOGENEOUS")==
"HOMOGENEOUS1D" ||
487 m_session->GetSolverInfo(
"HOMOGENEOUS")==
"1D" ||
488 m_session->GetSolverInfo(
"HOMOGENEOUS")==
"Homo1D")) &&
495 s = (j == nvar - 1) ? 2 : j;
498 m_base[j]->ExtractDataToCoeffs(
501 FieldDef[i]->m_fields[s],
502 m_base[j]->UpdateCoeffs());
511 &
m_base[j]->UpdateCoeffs()[2*ncplane],1);
517 bool flag = FieldDef[i]->m_fields[j] ==
520 ASSERTL1(flag, (std::string(
"Order of ") + pInfile
521 + std::string(
" data and that defined in "
522 "m_boundaryconditions differs")).c_str());
524 m_base[j]->ExtractDataToCoeffs(FieldDef[i], FieldData[i],
525 FieldDef[i]->m_fields[j],
526 m_base[j]->UpdateCoeffs());
532 m_base[j]->SetWaveSpace(
true);
556 if(
m_session->DefinesParameter(
"N_slices"))
572 Array<OneD, MultiRegions::ExpListSharedPtr > &pFields,
573 const Array<
OneD, Array<OneD, NekDouble> > &pVelocity,
574 const Array<OneD, const NekDouble> &pU,
575 Array<OneD, NekDouble> &pOutarray,
576 int pVelocityComponent,
578 Array<OneD, NekDouble> &pWk)
581 int nPointsTot = pFields[0]->GetNpoints();
582 Array<OneD, NekDouble> grad0,grad1,grad2;
586 Array<OneD, NekDouble> grad_base_u0,grad_base_u1,grad_base_u2;
588 Array<OneD, NekDouble> grad_base_v0,grad_base_v1,grad_base_v2;
590 Array<OneD, NekDouble> grad_base_w0,grad_base_w1,grad_base_w2;
593 grad0 = Array<OneD, NekDouble> (nPointsTot);
594 grad_base_u0 = Array<OneD, NekDouble> (nPointsTot);
595 grad_base_v0 = Array<OneD, NekDouble> (nPointsTot);
596 grad_base_w0 = Array<OneD, NekDouble> (nPointsTot);
604 if (
m_session->GetFunctionType(
"BaseFlow", 0)
614 ASSERTL0(
false,
"Periodic Base flow requires .fld files");
623 pFields[0]->PhysDeriv(pU,grad0);
624 pFields[0]->PhysDeriv(
m_base[0]->GetPhys(),grad_base_u0);
628 Vmath::Vvtvp(nPointsTot,grad_base_u0,1,pVelocity[0],1,pOutarray,1,pOutarray,1);
634 grad1 = Array<OneD, NekDouble> (nPointsTot);
635 grad_base_u1 = Array<OneD, NekDouble> (nPointsTot);
636 grad_base_v1 = Array<OneD, NekDouble> (nPointsTot);
638 pFields[0]->PhysDeriv(pU,grad0,grad1);
641 pFields[0]-> PhysDeriv(
m_base[0]->GetPhys(), grad_base_u0, grad_base_u1);
642 pFields[0]-> PhysDeriv(
m_base[1]->GetPhys(), grad_base_v0, grad_base_v1);
646 switch (pVelocityComponent)
657 Vmath::Vvtvp(nPointsTot,grad_base_u0,1,pVelocity[0],1,pOutarray,1,pOutarray,1);
659 Vmath::Vvtvp(nPointsTot,grad_base_v0,1,pVelocity[1],1,pOutarray,1,pOutarray,1);
671 Vmath::Vvtvp(nPointsTot,grad_base_u1,1,pVelocity[0],1,pOutarray,1,pOutarray,1);
673 Vmath::Vvtvp(nPointsTot,grad_base_v1,1,pVelocity[1],1,pOutarray,1,pOutarray,1);
682 grad1 = Array<OneD, NekDouble> (nPointsTot);
683 grad2 = Array<OneD, NekDouble> (nPointsTot);
684 grad_base_u1 = Array<OneD, NekDouble> (nPointsTot);
685 grad_base_v1 = Array<OneD, NekDouble> (nPointsTot);
686 grad_base_w1 = Array<OneD, NekDouble> (nPointsTot);
688 grad_base_u2 = Array<OneD, NekDouble> (nPointsTot);
689 grad_base_v2 = Array<OneD, NekDouble> (nPointsTot);
690 grad_base_w2 = Array<OneD, NekDouble> (nPointsTot);
692 m_base[0]->PhysDeriv(
m_base[0]->GetPhys(), grad_base_u0, grad_base_u1,grad_base_u2);
693 m_base[0]->PhysDeriv(
m_base[1]->GetPhys(), grad_base_v0, grad_base_v1,grad_base_v2);
694 m_base[0]->PhysDeriv(
m_base[2]->GetPhys(), grad_base_w0, grad_base_w1, grad_base_w2);
699 for(
int i=0; i<grad_base_u2.num_elements();++i)
708 pFields[0]->PhysDeriv(pU, grad0, grad1, grad2);
710 switch (pVelocityComponent)
723 Vmath::Vvtvp(nPointsTot,grad_base_u0,1,pVelocity[0],1,pOutarray,1,pOutarray,1);
725 Vmath::Vvtvp(nPointsTot,grad_base_v0,1,pVelocity[1],1,pOutarray,1,pOutarray,1);
727 Vmath::Vvtvp(nPointsTot,grad_base_w0,1,pVelocity[2],1,pOutarray,1,pOutarray,1);
740 Vmath::Vvtvp(nPointsTot,grad_base_u1,1,pVelocity[0],1,pOutarray,1,pOutarray,1);
742 Vmath::Vvtvp(nPointsTot,grad_base_v1,1,pVelocity[1],1,pOutarray,1,pOutarray,1);
744 Vmath::Vvtvp(nPointsTot,grad_base_w1,1,pVelocity[2],1,pOutarray,1,pOutarray,1);
758 Vmath::Vvtvp(nPointsTot,grad_base_u2,1,pVelocity[0],1,pOutarray,1,pOutarray,1);
760 Vmath::Vvtvp(nPointsTot,grad_base_v2,1,pVelocity[1],1,pOutarray,1,pOutarray,1);
762 Vmath::Vvtvp(nPointsTot,grad_base_w2,1,pVelocity[2],1,pOutarray,1,pOutarray,1);
769 ASSERTL0(
false,
"dimension unknown");
774 Array<OneD, const NekDouble> &inarray,
775 Array<OneD, NekDouble> &outarray,
780 int npoints=
m_base[0]->GetTotPoints();
784 Array<OneD, NekDouble> auxiliary(npoints);
787 Vmath::Svtvp(npoints, cos(0.5*m_slices*BetaT),&inarray[npoints],1,&outarray[0],1,&outarray[0],1);
789 for (
int i = 2; i <
m_slices; i += 2)
791 phase = (i>>1) * BetaT;
793 Vmath::Svtvp(npoints, cos(phase),&inarray[i*npoints],1,&outarray[0],1,&outarray[0],1);
794 Vmath::Svtvp(npoints, sin(phase), &inarray[(i+1)*npoints], 1, &outarray[0], 1,&outarray[0],1);
805 n_exp =
m_base[0]->GetTotPoints();
807 Array<OneD,unsigned int> nrows(n_exp);
808 Array<OneD,unsigned int> ncols(n_exp);
810 nrows = Array<OneD, unsigned int>(n_exp,
m_slices);
811 ncols = Array<OneD, unsigned int>(n_exp,
m_slices);
829 for(
int i = 0; i < n_exp; ++i)
831 BlkMatrix->SetBlock(i,i,loc_mat);
840 int npoints=
m_base[0]->GetTotPoints();
843 int ConvectedFields=
m_base.num_elements()-1;
845 m_interp= Array<OneD, Array<OneD, NekDouble> > (ConvectedFields);
846 for(
int i=0; i<ConvectedFields;++i)
855 char chkout[16] =
"";
856 sprintf(chkout,
"%d", i);
862 for(
int k=0; k< ConvectedFields;++k)
864 #ifdef NEKTAR_USING_FFTW
869 Array<OneD, NekDouble> fft_in(npoints*m_slices);
870 Array<OneD, NekDouble> fft_out(npoints*m_slices);
872 Array<OneD, NekDouble>
m_tmpIN(m_slices);
873 Array<OneD, NekDouble>
m_tmpOUT(m_slices);
884 for(
int i=0; i<npoints; i++)
886 m_FFT->FFTFwdTrans(m_tmpIN =fft_in + i*m_slices, m_tmpOUT =fft_out + i*m_slices);
906 int nrows = blkmat->GetRows();
907 int ncols = blkmat->GetColumns();
909 Array<OneD, NekDouble> sortedinarray(ncols);
910 Array<OneD, NekDouble> sortedoutarray(nrows);
931 Vmath::Zero(sortedinarray.num_elements(),&sortedinarray[0],1);
932 Vmath::Zero(sortedoutarray.num_elements(),&sortedoutarray[0],1);
938 for (
int i = 2; i <
m_slices; i += 2)
947 if(
m_session->DefinesParameter(
"period"))