15 int main(
int argc, 
char *argv[])
 
   18     int surfID, nfiles, nStart;
 
   22         fprintf(stderr,
"Usage: FldAddWSS meshfile nfiles infld BoundaryID\n");
 
   26     surfID = boost::lexical_cast<
int>(argv[argc - 1]);
 
   27     nfiles = boost::lexical_cast<
int>(argv[2]);
 
   29     vector<string> infiles(nfiles), outfiles(nfiles);
 
   39         string basename = argv[3];
 
   40         basename = basename.substr(0, basename.find_last_of(
"."));
 
   41         stringstream filename2;
 
   42         filename2 << basename << 
"_wss.fld";
 
   43         filename2 >> outfiles[0];
 
   47         string basename = argv[3];
 
   48         basename = basename.substr(basename.find_last_of(
"t")+1, basename.find_last_of(
".")-basename.find_last_of(
"t"));
 
   49         stringstream filename3;
 
   50         filename3 << basename;
 
   53         for (i = 0; i< nfiles; ++i)
 
   56             string extension = 
".fld";
 
   57             basename = basename.substr(0, basename.find_first_of(
"_"));
 
   58             stringstream filename, filename2;
 
   59             filename << basename << 
"_t" << i + nStart << extension;
 
   60             filename >> infiles[i];
 
   61             filename2 << basename << 
"_t" << i +nStart << 
"_wss.fld";
 
   62             filename2 >> outfiles[i];
 
   66     argv[argc - 1] = argv[argc - 2];
 
   67     argv[argc - 3] = argv[argc - 2]; 
 
   74     string meshfile(argv[argc-4]);
 
   81     m_kinvis = vSession->GetParameter(
"Kinvis");
 
   86     string fieldfile(argv[3]);
 
   87     vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
 
   88     vector<vector<NekDouble> > fielddata;
 
   94     int expdim  = graphShPt->GetMeshDimension();
 
   95     int nfields = fielddef[0]->m_fields.size()-1;
 
   96     int addfields = (nfields == 3)? 4:3;
 
   97     int nstress = (nfields == 3)? 6:3;
 
  105             ASSERTL0(
false,
"Expansion dimension not recognised");
 
  111             ASSERTL0(
false,
"Not implemented in 2D");
 
  119             for(i = 1; i < nfields; ++i)
 
  131                                     vSession->GetVariable(0));
 
  133             m_locToGlobalMap = firstfield->GetLocalToGlobalMap();
 
  136             for(i = 1; i < nfields; ++i)
 
  140                                         vSession->GetVariable(i));
 
  143             for(i = 0; i < addfields; ++i)
 
  147                                         vSession->GetVariable(0));
 
  152             ASSERTL0(
false,
"Expansion dimension not recognised");
 
  159     int n, cnt, elmtid, nq, offset, nt, boundary, nfq;
 
  171     for (
int fileNo = 0; fileNo < nfiles ; ++fileNo)
 
  182         for(j = 0; j < nfields; ++j)
 
  184             for(i = 0; i < fielddata.size(); ++i)
 
  186                 vel[j]->ExtractDataToCoeffs(fielddef[i],
 
  188                                             fielddef[i]->m_fields[j],
 
  189                                             vel[j]->UpdateCoeffs());
 
  192             vel[j]->BwdTrans(vel[j]->GetCoeffs(),vel[j]->UpdatePhys());
 
  195         for(j = 0; j < addfields; ++j)
 
  197             for(i = 0; i < fielddata.size(); ++i)
 
  199                 shear[j]->ExtractDataToCoeffs(fielddef[i],
 
  201                                               fielddef[i]->m_fields[0],
 
  202                                               shear[j]->UpdateCoeffs());
 
  206             shear[j]->BwdTrans(shear[j]->GetCoeffs(),shear[j]->UpdatePhys());
 
  214         nt = shear[0]->GetNpoints();
 
  217         for(j = 0; j < addfields; ++j)
 
  223         shear[0]->GetBoundaryToElmtMap(BoundarytoElmtID,BoundarytoTraceID);        
 
  226         for(j = 0; j < addfields; ++j)
 
  228             BndExp[j]   = shear[j]->GetBndCondExpansions();
 
  232         for(cnt = n = 0; n < BndExp[0].num_elements(); ++n)
 
  237                 for(i = 0; i < BndExp[0][n]->GetExpSize(); ++i, cnt++)
 
  240                     elmtid = BoundarytoElmtID[cnt];
 
  241                     elmt   = shear[0]->GetExp(elmtid);
 
  242                     nq     = elmt->GetTotPoints();
 
  243                     offset = shear[0]->GetPhys_Offset(elmtid);
 
  247                     for(j = 0; j < nfields*nfields; ++j)
 
  252                     for(j = 0; j < nstress; ++j)
 
  269                         boundary = BoundarytoTraceID[cnt];
 
  275                             = elmt->GetFaceNormal(boundary);
 
  278                         for(j = 0; j < nstress; ++j)
 
  285                         U = vel[0]->GetPhys() + offset;
 
  286                         V = vel[1]->GetPhys() + offset;
 
  287                         W = vel[2]->GetPhys() + offset;
 
  290                         elmt->PhysDeriv(U,grad[0],grad[1],grad[2]);
 
  291                         elmt->PhysDeriv(V,grad[3],grad[4],grad[5]);
 
  292                         elmt->PhysDeriv(W,grad[6],grad[7],grad[8]);
 
  296                         Vmath::Smul (nq,(2*m_kinvis),grad[0],1,stress[0],1);
 
  298                         Vmath::Smul (nq,(2*m_kinvis),grad[4],1,stress[1],1);
 
  300                         Vmath::Smul (nq,(2*m_kinvis),grad[8],1,stress[2],1);
 
  312                         for(j = 0; j < nstress; ++j)
 
  314                             elmt->GetFacePhysVals(boundary,bc,stress[j],fstress[j]); 
 
  318                         for (j = 0; j< addfields; j++)
 
  320                             values[j] = BndExp[j][n]->UpdateCoeffs() + BndExp[j][n]->GetCoeff_Offset(i);
 
  327                                            normals[1],1,fstress[3],1,Sx,1);
 
  332                                            normals[1],1,fstress[1],1,Sy,1);
 
  337                                            normals[1],1,fstress[5],1,Sz,1);
 
  344                                            normals[1][0],fstress[3],1,Sx,1);
 
  349                                            normals[1][0],fstress[1],1,Sy,1);
 
  354                                            normals[1][0],fstress[5],1,Sz,1);
 
  362                                            normals[1],1, Sy,1,values2,1);
 
  363                             Vmath::Vvtvp  (nfq,normals[2],1, Sz,1,values2,1,values2,1);
 
  370                             bc->FwdTrans(Sx, values[0]);
 
  374                             bc->FwdTrans(Sy, values[1]);
 
  378                             bc->FwdTrans(Sz, values[2]);
 
  384                                            normals[1][0],Sy,1,values2,1);
 
  385                             Vmath::Svtvp(nfq,normals[2][0],Sz,1,values2,1,values2,1);
 
  391                             bc->FwdTrans(Sx, values[0]);
 
  395                             bc->FwdTrans(Sy, values[1]);
 
  399                             bc->FwdTrans(Sz, values[2]);
 
  404                         Vmath::Vvtvvtp(nfq, Sx, 1, Sx, 1, Sy, 1, Sy, 1, S, 1);
 
  407                         bc->FwdTrans(S, values[3]); 
 
  413                 cnt += BndExp[0][n]->GetExpSize();
 
  418         for(j = 0; j < addfields; ++j)
 
  420             int ncoeffs = shear[j]->GetNcoeffs();
 
  423             output=shear[j]->UpdateCoeffs();
 
  425             int nGlobal=m_locToGlobalMap->GetNumGlobalCoeffs();
 
  433             for(i = 0; i < BndExp[j].num_elements(); ++i)
 
  438                     for(k = 0; k < (BndExp[j][i])->GetNcoeffs(); ++k)
 
  440                         sign = m_locToGlobalMap->GetBndCondCoeffsToGlobalCoeffsSign(bndcnt);
 
  441                         outarray[map[bndcnt++]] = sign * coeffs[k];
 
  446                     bndcnt += BndExp[j][i]->GetNcoeffs();
 
  449             m_locToGlobalMap->GlobalToLocal(outarray,output);
 
  455         std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
 
  456             = shear[0]->GetFieldDefinitions();
 
  457         std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
 
  459         vector<string > outname;
 
  467             outname.push_back(
"Tx");
 
  468             outname.push_back(
"Ty");
 
  469             outname.push_back(
"Tz");
 
  470             outname.push_back(
"Tw");
 
  473         for(j = 0; j < nfields + addfields; ++j)
 
  475             for(i = 0; i < FieldDef.size(); ++i)
 
  479                     FieldDef[i]->m_fields.push_back(fielddef[i]->m_fields[j]);
 
  480                     vel[j]->AppendFieldData(FieldDef[i], FieldData[i]);
 
  484                     FieldDef[i]->m_fields.push_back(outname[j-nfields]);
 
  485                     shear[j-nfields]->AppendFieldData(FieldDef[i], FieldData[i]);
 
#define ASSERTL0(condition, msg)
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool. 
#define sign(a, b)
return the sign(b)*a 
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x) 
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y 
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y 
boost::shared_ptr< ContField2D > ContField2DSharedPtr
int main(int argc, char *argv[])
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file. 
int GetTotPoints() const 
This function returns the total number of quadrature points used in the element. 
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class. 
boost::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y. 
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object. 
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector): 
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
vvtvvtp (scalar times vector plus scalar times vector): 
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap)
Write a field file in serial only. 
boost::shared_ptr< ContField3D > ContField3DSharedPtr
boost::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Geometry is curved or has non-constant factors. 
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.