Nektar++
Functions
utilities/ExtractCriticalLayer.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include <MultiRegions/ExpList.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 45 of file utilities/ExtractCriticalLayer.cpp.

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

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