Esempio n. 1
0
int main(int argc, char *argv[]) {
		  
  /*--- Local variables ---*/
  unsigned short mode, nZone = 1;
  char grid_filename[200];
  bool complete;

  int rank = MASTER_NODE;
#ifndef NO_MPI
  /*--- MPI initialization, and buffer setting ---*/
#ifdef WINDOWS
  MPI_Init(&argc,&argv);
  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
#else
  MPI::Init(argc,argv);
  rank = MPI::COMM_WORLD.Get_rank();
#endif
#endif

  /*--- Declare pointers to class objects ---*/
  CConfig *config = NULL;
  CBoundaryGeometry *boundary = NULL;
 
  /*--- Instatiate an object of the config class
        based on the name of the config file given ---*/
  strcpy(grid_filename, argv[1]);
  config = new CConfig(grid_filename, SU2_GDC, ZONE_0, nZone, 
                         0, VERB_HIGH);

  /*--- Instantiate an object of the boundary-geometry class ---*/
  boundary = new CBoundaryGeometry(config, 
                                   config->GetMesh_FileName(), 
                                   config->GetMesh_FileFormat());
  
  /*--- determine the mode of operation ---*/
  if (argc < 3) {
    if (argc == 2) {
      cout << "\t ------------------------------------------ \t" << endl;
      cout << "\t *** ERROR! PLEASE ENTER A RUNNING MODE *** \t" << endl;
      cout << "\t ------------------------------------------ \t" << endl;
      return EXIT_SUCCESS;
    }
    if (argc == 1) {
      cout << "\t -------------------------------------------------- \t" << endl;
      cout << "\t *** ERROR! PLEASE ENTER A CONFIG FILE AND MODE *** \t" << endl;
      cout << "\t -------------------------------------------------- \t" << endl;
      return EXIT_SUCCESS;
    }
  }
  mode = atoi(argv[2]);
  cout << endl;
  
  switch (mode) {
  
    case 1:
      cout << "\t ------------------------------------ \t" << endl;
      cout << "\t *** AIRFOIL-SECTION-CUTTING MODE *** \t" << endl;
      cout << "\t ------------------------------------ \t" << endl;
      
      /*--- if they exist, delete old versions of files "span," 
            "tracked_points," "Airfoil_Sections.plt," and 
            "coordinates.csv" ---*/
      cout << endl;
      clean_up("span");
      clean_up("tracked_points");
      clean_up("Airfoil_Sections.plt");
      clean_up("coordinates.csv");
      
      /*--- make the sectional cuts along the surfaces of interest and
            write the files "span," "tracked_points," and 
            "Airfoil_Sections.plt" to the current directory ---*/
      Make_Sectional_Cuts(config, boundary);
  
      /*--- find the coordinates of the sections and 
            print to the "coordinate.csv" file ---*/
      Tracked_Points_to_Coords(boundary);
      
      break;
      
    case 2:
      cout << "\t ------------------------------------------ \t" << endl;
      cout << "\t *** SECTIONAL-FORCES MODE (SU2->UMARC) *** \t" << endl;
      cout << "\t ------------------------------------------ \t" << endl;
      
      /*--- recompute the coordinates and rewrite "coordinates.csv" 
            file, just in case the geometry has been deformed since 
            running mode 1. N.B. The original cuts can still be found
            in "Airfoil_Sections.plt" ---*/
      cout << endl;
      clean_up("coordinates.csv");
      Tracked_Points_to_Coords(boundary);
      
      /*--- read the new coordinates, find the corresponding values 
            of pressure from "surface_flow.csv," and write the 
            sectional-forces files cl, cd, and cm ---*/
      complete = Compute_Sectional_Forces();
     

 
      
      
      if (complete == false) {
        cout << endl << "Sectional forces have not been computed properly." << endl;
        return EXIT_SUCCESS;
      }
      
      break;
      
    case 3:
      cout << "\t --------------------------------------------------- \t" << endl;
      cout << "\t *** DEFORMATION-COMMUNICATION MODE (UMARC->SU2) *** \t" << endl;
      cout << "\t --------------------------------------------------- \t" << endl;

      break;
      
    default:
      cout << "\t -------------------------------------------- \t" << endl;
      cout << "\t *** ERROR! PLEASE RUN IN MODE 1, 2, OR 3 *** \t" << endl;
      cout << "\t -------------------------------------------- \t" << endl;
      return EXIT_SUCCESS;
  }
                                   
  /*--- Delete dynamically allocated memory ---*/
	if (config != NULL) delete config;
	if (boundary != NULL) delete boundary;
	
	/*--- End routine ---*/
	cout << endl <<"------------------------- Exit Success (SU2_UMC) ------------------------" << endl << endl;
  
	return EXIT_SUCCESS;
	
}
Esempio n. 2
0
int main(int argc, char *argv[]) {
		  
  /*--- Local variables ---*/
  unsigned short mode, nZone = 1;
  char grid_filename[200];

  int rank = MASTER_NODE;
#ifndef NO_MPI
  /*--- MPI initialization, and buffer setting ---*/
#ifdef WINDOWS
  MPI_Init(&argc,&argv);
  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
#else
  MPI::Init(argc,argv);
  rank = MPI::COMM_WORLD.Get_rank();
#endif
#endif
	
  /*--- Declare pointers to class objects ---*/
  CConfig *config = NULL;
  CBoundaryGeometry *boundary = NULL;
  
  /*--- Instatiate an object of the config class
        based on the name of the config file given ---*/
  strcpy(grid_filename, argv[1]);
  config = new CConfig(grid_filename, SU2_GDC, ZONE_0, nZone, 
                         VERB_HIGH);

  /*--- Instantiate an object of the boundary-geometry class ---*/
  boundary = new CBoundaryGeometry(config, 
                                   config->GetMesh_FileName(), 
                                   config->GetMesh_FileFormat());
  
  /*--- determine the mode of operation ---*/
  mode = atoi(argv[2]);
  cout << endl;
  
  switch (mode) {
  
    case 1:
      cout << "\t ------------------------------------ \t" << endl;
      cout << "\t *** AIRFOIL-SECTION-CUTTING MODE *** \t" << endl;
      cout << "\t ------------------------------------ \t" << endl;
      
      /*--- if they exist, delete old versions of files "span," 
            "tracked_points," "Airfoil_Sections.plt," and
            "coordinates.csv" ---*/
      cout << endl;
      clean_up("span");
      clean_up("tracked_points");
      clean_up("Airfoil_Sections.plt");
      clean_up("coordinates.csv");
      
      /*--- Make the sectional cuts along the surfaces of interest and
            write the files "span," "tracked points," and 
            "Airfoil_Sections.plt" to the current directory ---*/
      Make_Sectional_Cuts(config, boundary);
  
      /*--- find the coordinates of the sections and 
            print to the "coordinate.csv" file ---*/
      Tracked_Points_to_Coords(boundary);
      
      break;
      
    case 2:
      cout << "\t ------------------------------------------ \t" << endl;
      cout << "\t *** SECTIONAL-FORCES MODE (SU2->UMARC) *** \t" << endl;
      cout << "\t ------------------------------------------ \t" << endl;

      break;
      
    case 3:
      cout << "\t --------------------------------------------------- \t" << endl;
      cout << "\t *** DEFORMATION-COMMUNICATION MODE (UMARC->SU2) *** \t" << endl;
      cout << "\t --------------------------------------------------- \t" << endl;

      break;
      
    default:
      cout << "\t -------------------------------------------- \t" << endl;
      cout << "\t *** ERROR! PLEASE RUN IN MODE 1, 2, OR 3 *** \t" << endl;
      cout << "\t -------------------------------------------- \t" << endl;
      return EXIT_SUCCESS;
  }
                                   
  /*--- Delete dynamically allocated memory ---*/
	if (config != NULL) {delete config;}
	if (boundary != NULL) {delete boundary;}
	
	/*--- End routine ---*/
	cout << endl <<"------------------------- Exit Success (SU2_UMC) ------------------------" << endl << endl;
  
	return EXIT_SUCCESS;
	
}