Nektar++
Functions
utilities/ExtractCriticalLayer.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include <MultiRegions/ExpList.h>
#include <MultiRegions/ExpList2D.h>
#include "ExtractCriticalLayerFunctions.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 46 of file utilities/ExtractCriticalLayer.cpp.

References Computestreakpositions(), and Nektar::LibUtilities::Import().

47 {
48  int i;
49  NekDouble cr = 0;
50 
51  if(argc !=3)
52  {
53  fprintf(stderr,"Usage: ./ExtractCriticalLayer meshfile fieldfile \n");
54  exit(1);
55  }
56 
57  //------------------------------------------------------------
58  // Create Session file.
60  = LibUtilities::SessionReader::CreateInstance(argc, argv);
61  //-----------------------------------------------------------
62 
63  //-------------------------------------------------------------
64  // Read in mesh from input file
65  SpatialDomains::MeshGraphSharedPtr graphShPt = SpatialDomains::MeshGraph::Read(vSession);
66  //------------------------------------------------------------
67 
68  //-------------------------------------------------------------
69  // Define Streak Expansion
71 
73  ::AllocateSharedPtr(vSession,graphShPt);
74  //---------------------------------------------------------------
75 
76  //----------------------------------------------
77  // Import field file.
78  string fieldfile(argv[argc-1]);
79  vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
80  vector<vector<NekDouble> > fielddata;
81  LibUtilities::Import(fieldfile,fielddef,fielddata);
82  //----------------------------------------------
83 
84  //----------------------------------------------
85  // Copy data from field file
86  string streak_field("w");
87  for(unsigned int i = 0; i < fielddata.size(); ++i)
88  {
89  streak->ExtractDataToCoeffs(fielddef [i],
90  fielddata[i],
91  streak_field,
92  streak->UpdateCoeffs());
93  }
94  //----------------------------------------------
95 
96  int npts;
97  vSession->LoadParameter("NumCriticalLayerPts",npts,30);
98  Array<OneD, NekDouble> x_c(npts);
99  Array<OneD, NekDouble> y_c(npts);
100 
101  NekDouble trans;
102  vSession->LoadParameter("WidthOfLayers",trans,0.1);
103 
104  Computestreakpositions(streak,x_c, y_c,cr,trans);
105 
106  cout << "# x_c y_c" << endl;
107  for(i = 0; i < npts; ++i)
108  {
109  fprintf(stdout,"%12.10lf %12.10lf \n",x_c[i],y_c[i]);
110  //cout << x_c[i] << " " << y_c[i] << endl;
111  }
112 
113 }
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > &ElementIDs)
This function allows for data to be imported from an FLD file when a session and/or communicator is n...
Definition: FieldIO.cpp:293
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void Computestreakpositions(MultiRegions::ExpListSharedPtr &streak, Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc, NekDouble cr, NekDouble trans)
double NekDouble
std::shared_ptr< SessionReader > SessionReaderSharedPtr