Esempio n. 1
0
int main(int argc, char *argv[]) {
	
	char buffer_vtk[100], buffer_plt[100]; 
	string MeshFile;
	unsigned short nZone = 1;
    
#ifndef NO_MPI
#ifdef WINDOWS
	MPI_Init(&argc,&argv);
#else
    MPI::Init(argc, argv);
#endif
#endif
  
	/*--- Definition of the class for the definition of the problem ---*/
	CConfig *config;
	if (argc == 2) config = new CConfig(argv[1], SU2_PBC, ZONE_0, nZone, 0, VERB_HIGH);
	else {
		char grid_file[200];
		strcpy (grid_file, "default.cfg");
		config = new CConfig(grid_file, SU2_PBC, ZONE_0, nZone, 0, VERB_HIGH);
	}

	/*--- Definition of the class for the geometry ---*/
	CGeometry *geometry; geometry = new CGeometry;
	geometry = new CPhysicalGeometry(config, ZONE_0, nZone);
  
  /*--- Perform the non-dimensionalization, in case any values are needed ---*/
  config->SetNondimensionalization(geometry->GetnDim(), ZONE_0);
  
	cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
	
	/*--- Compute elements surrounding points, points surrounding points, and elements surrounding elements ---*/
	cout << "Setting local point and element connectivity." <<endl; 
	geometry->SetEsuP(); geometry->SetPsuP(); geometry->SetEsuE();
	
	/*--- Check the orientation before computing geometrical quantities ---*/
	cout << "Checking the numerical grid orientation." <<endl;
	geometry->SetBoundVolume(); geometry->Check_Orientation(config);
	
	/*--- Create the edge structure ---*/
	cout << "Identifying edges and vertices." <<endl; 
	geometry->SetEdges(); geometry->SetVertex(config); 
	
	/*--- Compute center of gravity ---*/
	cout << "Computing centers of gravity." << endl;
	geometry->SetCG();
  
	/*--- Create the control volume structures ---*/
	cout << "Setting the control volume structure." << endl; 
	geometry->SetControlVolume(config, ALLOCATE);
	geometry->SetBoundControlVolume(config, ALLOCATE);
	
	cout << endl <<"-------------------- Setting the periodic boundaries --------------------" << endl;

	/*--- Set periodic boundary conditions ---*/
	geometry->SetPeriodicBoundary(config);
	
  /*--- Original grid for debugging purposes ---*/
  strcpy (buffer_plt, "periodic_original.plt"); geometry->SetTecPlot(buffer_plt);
 
	/*--- Create a new grid with the right periodic boundary ---*/
	CGeometry *periodic; periodic = new CPeriodicGeometry(geometry, config);
	periodic->SetPeriodicBoundary(geometry, config);
	periodic->SetMeshFile(geometry, config, config->GetMesh_Out_FileName());
	
	/*--- Output of the grid for debuging purposes ---*/
  strcpy (buffer_plt, "periodic_halo.plt"); periodic->SetTecPlot(buffer_plt);
	
#ifndef NO_MPI
#ifdef WINDOWS
	MPI_Finalize();
#else
	MPI::Finalize();
#endif
#endif
    
	/*--- End solver ---*/
	cout << endl <<"------------------------- Exit Success (SU2_PBC) ------------------------" << endl << endl;
	
	return EXIT_SUCCESS;
}
Esempio n. 2
0
int main(int argc, char *argv[]) {
	
	/*--- Variable definitions ---*/
	char file_name[200];
  unsigned short nZone = 1;
  
#ifndef NO_MPI
#ifdef WINDOWS
	MPI_Init(&argc,&argv);
#else
	MPI::Init(argc, argv);
#endif
#endif
	
	/*--- Definition of the config problem ---*/
	CConfig *config;
	if (argc == 2) config = new CConfig(argv[1], SU2_MAC, ZONE_0, nZone, VERB_HIGH);
	else { strcpy (file_name, "default.cfg"); config = new CConfig(file_name, SU2_MAC, ZONE_0, nZone, VERB_HIGH); }
	
	/*--- Definition of the Class for the geometry ---*/
	CGeometry *geometry; geometry = new CGeometry;
	geometry = new CPhysicalGeometry(config, ZONE_0, nZone);
	
  /*--- Perform the non-dimensionalization, in case any values are needed ---*/
  config->SetNondimensionalization(geometry->GetnDim(), ZONE_0);
  
	cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
	
	/*--- Compute elements surrounding points, points surrounding points, and elements surronding elements ---*/
	cout << "Setting local point and element connectivity." <<endl;
	geometry->SetEsuP(); geometry->SetPsuP(); geometry->SetEsuE();
	
	/*--- Check the orientation before computing geometrical quantities ---*/
	cout << "Check numerical grid orientation." <<endl;
	geometry->SetBoundVolume(); geometry->Check_Orientation(config);
	
	/*--- Create the edge structure ---*/
	cout << "Identify faces, edges and vertices." <<endl;
	geometry->SetFaces(); geometry->SetEdges(); geometry->SetVertex(config); geometry->SetCG();
	
	/*--- Create the control volume structures ---*/
	cout << "Set control volume structure." << endl;
	geometry->SetControlVolume(config, ALLOCATE); geometry->SetBoundControlVolume(config, ALLOCATE);
	
	/*--- Set the near-field and interface boundary conditions  ---*/
	geometry->MatchNearField(config);
	
	if (config->GetKind_Adaptation() != NONE) {
		
		cout << endl <<"--------------------- Start numerical grid adaptation -------------------" << endl;
		
		/*-- Definition of the Class for grid adaptation ---*/
		CGridAdaptation *grid_adaptation;
		grid_adaptation = new CGridAdaptation(geometry, config);
		
		/*--- Read the flow solution and/or the adjoint solution
		 and choose the elements to adapt ---*/
		if ((config->GetKind_Adaptation() != NONE) && (config->GetKind_Adaptation() != FULL)
				&& (config->GetKind_Adaptation() != WAKE) && (config->GetKind_Adaptation() != TWOPHASE)
				&& (config->GetKind_Adaptation() != SMOOTHING) && (config->GetKind_Adaptation() != SUPERSONIC_SHOCK))
			grid_adaptation->GetFlowSolution(geometry, config);
		
		switch (config->GetKind_Adaptation()) {
			case NONE:
				break;
			case SMOOTHING:
				config->SetSmoothNumGrid(true);
				grid_adaptation->SetNo_Refinement(geometry, 1);
				break;
			case FULL:
				grid_adaptation->SetComplete_Refinement(geometry, 1);
				break;
			case WAKE:
				grid_adaptation->SetWake_Refinement(geometry, 1);
				break;
			case TWOPHASE:
				grid_adaptation->SetTwoPhase_Refinement(geometry, 1);
				break;
			case SUPERSONIC_SHOCK:
				grid_adaptation->SetSupShock_Refinement(geometry, config);
				break;
			case FULL_FLOW:
				grid_adaptation->SetComplete_Refinement(geometry, 1);
				break;
			case FULL_ADJOINT:
				grid_adaptation->GetAdjSolution(geometry, config);
				grid_adaptation->SetComplete_Refinement(geometry, 1);
				break;
			case FULL_LINEAR:
				grid_adaptation->GetLinSolution(geometry, config);
				grid_adaptation->SetComplete_Refinement(geometry, 1);
				break;
			case GRAD_FLOW:
				grid_adaptation->SetIndicator_Flow(geometry, config, 1);
				break;
			case GRAD_ADJOINT:
				grid_adaptation->GetAdjSolution(geometry, config);
				grid_adaptation->SetIndicator_Adj(geometry, config, 1);
				break;
			case GRAD_FLOW_ADJ:
				grid_adaptation->GetAdjSolution(geometry, config);
				grid_adaptation->SetIndicator_FlowAdj(geometry, config);
				break;
			case COMPUTABLE:
				grid_adaptation->GetAdjSolution(geometry, config);
				grid_adaptation->GetFlowResidual(geometry, config);
				grid_adaptation->SetIndicator_Computable(geometry, config);
				break;
			case REMAINING:
				cout << "Adaptation method not implemented."<< endl;
				cout << "Press any key to exit..." << endl;
				cin.get();
				exit(1);
				break;
			case ROBUST:
				grid_adaptation->GetFlowResidual(geometry, config);
				grid_adaptation->GetAdjResidual(geometry, config);
				grid_adaptation->SetIndicator_Robust(geometry, config);
				break;
			case COMPUTABLE_ROBUST:
				grid_adaptation->GetAdjSolution(geometry, config);
				grid_adaptation->GetLinResidual(geometry, config);
				grid_adaptation->SetIndicator_Computable_Robust(geometry, config);
				break;
			default :
				cout << "The adaptation is not defined" << endl;
		}
		
		/*--- Perform an homothetic adaptation of the grid ---*/
		CPhysicalGeometry *geo_adapt; geo_adapt = new CPhysicalGeometry;
		
		cout << "Homothetic grid adaptation" << endl;
		if (geometry->GetnDim() == 2) grid_adaptation->SetHomothetic_Adaptation2D(geometry, geo_adapt, config);
		if (geometry->GetnDim() == 3) grid_adaptation->SetHomothetic_Adaptation3D(geometry, geo_adapt, config);
    
		/*--- Smooth the numerical grid coordinates ---*/
		if (config->GetSmoothNumGrid()) {
			cout << "Preprocessing for doing the implicit smoothing." << endl;
			geo_adapt->SetEsuP(); geo_adapt->SetPsuP(); geo_adapt->SetEsuE();
			geo_adapt->SetBoundVolume(); geo_adapt->Check_Orientation(config);
			geo_adapt->SetEdges(); geo_adapt->SetVertex(config);
			cout << "Implicit smoothing of the numerical grid coordinates." << endl;
			geo_adapt->SetCoord_Smoothing(5, 1.5, config);
		}
		
		/*--- Original and adapted grid ---*/
    strcpy (file_name, "original_grid.plt");
    geometry->SetTecPlot(file_name);
    
		/*--- Write the adaptation sensor ---*/
		grid_adaptation->WriteAdaptSensor(geometry, file_name);
		
    strcpy (file_name, "adapted_grid.plt");
    geo_adapt->SetTecPlot(file_name);
    strcpy (file_name, "adapted_surface.plt");
    geo_adapt->SetBoundTecPlot(config,file_name);
		
		/*--- Write the new adapted grid, including the modified boundaries surfaces ---*/
		geo_adapt->SetMeshFile(config, config->GetMesh_Out_FileName());
    
    
		/*--- Write the restart file ---*/
		if ((config->GetKind_Adaptation() != SMOOTHING) && (config->GetKind_Adaptation() != FULL) &&
				(config->GetKind_Adaptation() != WAKE) && (config->GetKind_Adaptation() != TWOPHASE) &&
				(config->GetKind_Adaptation() != SUPERSONIC_SHOCK))
			grid_adaptation->SetRestart_FlowSolution(config, geo_adapt, config->GetRestart_FlowFileName());
		
		if ((config->GetKind_Adaptation() == GRAD_FLOW_ADJ) || (config->GetKind_Adaptation() == GRAD_ADJOINT)
				|| (config->GetKind_Adaptation() == FULL_ADJOINT) || (config->GetKind_Adaptation() == ROBUST)
				|| (config->GetKind_Adaptation() == COMPUTABLE) || (config->GetKind_Adaptation() == COMPUTABLE_ROBUST) ||
				(config->GetKind_Adaptation() == REMAINING))
			grid_adaptation->SetRestart_AdjSolution(config, geo_adapt, config->GetRestart_AdjFileName());
		
		if ((config->GetKind_Adaptation() == FULL_LINEAR) || (config->GetKind_Adaptation() == COMPUTABLE_ROBUST)) {
			grid_adaptation->SetRestart_LinSolution(config, geo_adapt, config->GetRestart_LinFileName());
		}
	}
	else {
    strcpy (file_name, "original_grid.plt");
    geometry->SetTecPlot(file_name);
		geometry->SetMeshFile (config, config->GetMesh_Out_FileName());
	}
  
#ifndef NO_MPI
#ifdef WINDOWS
	MPI_Finalize();
#else
	MPI::Finalize();
#endif
#endif
	
	/*--- End solver ---*/
	cout << endl <<"------------------------- Exit Success (SU2_MAC) ------------------------" << endl << endl;
  
	return EXIT_SUCCESS;
}
Esempio n. 3
0
int main(int argc, char *argv[]) {
	
	/*--- Variable definitions ---*/
  
  unsigned short iZone, nZone = SINGLE_ZONE;
  su2double StartTime = 0.0, StopTime = 0.0, UsedTime = 0.0;
  char config_file_name[MAX_STRING_SIZE];
  char file_name[MAX_STRING_SIZE];
  int rank, size;
  string str;
	bool periodic = false;
  
  /*--- MPI initialization ---*/
  
#ifdef HAVE_MPI
  SU2_MPI::Init(&argc,&argv);
  SU2_MPI::Comm MPICommunicator(MPI_COMM_WORLD);
#else
  SU2_Comm MPICommunicator(0);
#endif

  rank = SU2_MPI::GetRank();
  size = SU2_MPI::GetSize();
	
  /*--- Pointer to different structures that will be used throughout the entire code ---*/
  
  CConfig **config_container         = NULL;
  CGeometry **geometry_container     = NULL;
  
  /*--- Load in the number of zones and spatial dimensions in the mesh file (if no config
   file is specified, default.cfg is used) ---*/
  
  if (argc == 2) { strcpy(config_file_name,argv[1]); }
  else { strcpy(config_file_name, "default.cfg"); }
  
	  /*--- Read the name and format of the input mesh file to get from the mesh
   file the number of zones and dimensions from the numerical grid (required
   for variables allocation)  ---*/

  CConfig *config = NULL;
  config = new CConfig(config_file_name, SU2_DEF);

  nZone    = CConfig::GetnZone(config->GetMesh_FileName(), config->GetMesh_FileFormat(), config);
  periodic = CConfig::GetPeriodic(config->GetMesh_FileName(), config->GetMesh_FileFormat(), config);

  /*--- Definition of the containers per zones ---*/
  
  config_container = new CConfig*[nZone];
  geometry_container = new CGeometry*[nZone];
  
  for (iZone = 0; iZone < nZone; iZone++) {
    config_container[iZone]       = NULL;
    geometry_container[iZone]     = NULL;
  }
  
  /*--- Loop over all zones to initialize the various classes. In most
   cases, nZone is equal to one. This represents the solution of a partial
   differential equation on a single block, unstructured mesh. ---*/
  
  for (iZone = 0; iZone < nZone; iZone++) {
    
    /*--- Definition of the configuration option class for all zones. In this
     constructor, the input configuration file is parsed and all options are
     read and stored. ---*/
    
    config_container[iZone] = new CConfig(config_file_name, SU2_MSH, iZone, nZone, 0, VERB_HIGH);
    config_container[iZone]->SetMPICommunicator(MPICommunicator);
    
    /*--- Definition of the geometry class to store the primal grid in the partitioning process. ---*/
    
    CGeometry *geometry_aux = NULL;
    
    /*--- All ranks process the grid and call ParMETIS for partitioning ---*/
    
    geometry_aux = new CPhysicalGeometry(config_container[iZone], iZone, nZone);
    
    /*--- Color the initial grid and set the send-receive domains (ParMETIS) ---*/
    
    geometry_aux->SetColorGrid_Parallel(config_container[iZone]);
    
    /*--- Until we finish the new periodic BC implementation, use the old
     partitioning routines for cases with periodic BCs. The old routines 
     will be entirely removed eventually in favor of the new methods. ---*/

    if (periodic) {
      geometry_container[iZone] = new CPhysicalGeometry(geometry_aux, config_container[iZone]);
    } else {
      geometry_container[iZone] = new CPhysicalGeometry(geometry_aux, config_container[iZone], periodic);
    }
    
    /*--- Deallocate the memory of geometry_aux ---*/
    
    delete geometry_aux;
    
    /*--- Add the Send/Receive boundaries ---*/
    
    geometry_container[iZone]->SetSendReceive(config_container[iZone]);
    
    /*--- Add the Send/Receive boundaries ---*/
    
    geometry_container[iZone]->SetBoundaries(config_container[iZone]);
    
  }
  
  /*--- Set up a timer for performance benchmarking (preprocessing time is included) ---*/
  
#ifdef HAVE_MPI
  StartTime = MPI_Wtime();
#else
  StartTime = su2double(clock())/su2double(CLOCKS_PER_SEC);
#endif
  
	cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
	
	/*--- Compute elements surrounding points, points surrounding points, and elements surronding elements ---*/
  
	cout << "Setting local point and element connectivity." <<endl;
	geometry_container[ZONE_0]->SetPoint_Connectivity(); geometry_container[ZONE_0]->SetElement_Connectivity();
	
	/*--- Check the orientation before computing geometrical quantities ---*/
  geometry_container[ZONE_0]->SetBoundVolume();
  if (config_container[ZONE_0]->GetReorientElements()) {
		cout << "Check numerical grid orientation." <<endl;
		geometry_container[ZONE_0]->Check_IntElem_Orientation(config_container[ZONE_0]); geometry_container[ZONE_0]->Check_BoundElem_Orientation(config_container[ZONE_0]);
  }
	
	/*--- Create the edge structure ---*/
  
	cout << "Identify faces, edges and vertices." <<endl;
	geometry_container[ZONE_0]->SetFaces(); geometry_container[ZONE_0]->SetEdges(); geometry_container[ZONE_0]->SetVertex(config_container[ZONE_0]); geometry_container[ZONE_0]->SetCoord_CG();
	
	/*--- Create the control volume structures ---*/
  
	cout << "Set control volume structure." << endl;
	geometry_container[ZONE_0]->SetControlVolume(config_container[ZONE_0], ALLOCATE); geometry_container[ZONE_0]->SetBoundControlVolume(config_container[ZONE_0], ALLOCATE);

	
	if ((config_container[ZONE_0]->GetKind_Adaptation() != NONE) && (config_container[ZONE_0]->GetKind_Adaptation() != PERIODIC)) {
		
		cout << endl <<"--------------------- Start numerical grid adaptation -------------------" << endl;
		
		/*-- Definition of the Class for grid adaptation ---*/
    
		CGridAdaptation *grid_adaptation;
		grid_adaptation = new CGridAdaptation(geometry_container[ZONE_0], config_container[ZONE_0]);
		
		/*--- Read the flow solution and/or the adjoint solution
		 and choose the elements to adapt ---*/
    
		if ((config_container[ZONE_0]->GetKind_Adaptation() != FULL)
				&& (config_container[ZONE_0]->GetKind_Adaptation() != WAKE) && (config_container[ZONE_0]->GetKind_Adaptation() != SMOOTHING) && (config_container[ZONE_0]->GetKind_Adaptation() != SUPERSONIC_SHOCK))
			grid_adaptation->GetFlowSolution(geometry_container[ZONE_0], config_container[ZONE_0]);
		
		switch (config_container[ZONE_0]->GetKind_Adaptation()) {
			case NONE:
				break;
			case SMOOTHING:
				config_container[ZONE_0]->SetSmoothNumGrid(true);
				grid_adaptation->SetNo_Refinement(geometry_container[ZONE_0], 1);
				break;
			case FULL:
				grid_adaptation->SetComplete_Refinement(geometry_container[ZONE_0], 1);
				break;
			case WAKE:
				grid_adaptation->SetWake_Refinement(geometry_container[ZONE_0], 1);
				break;
			case SUPERSONIC_SHOCK:
				grid_adaptation->SetSupShock_Refinement(geometry_container[ZONE_0], config_container[ZONE_0]);
				break;
			case FULL_FLOW:
				grid_adaptation->SetComplete_Refinement(geometry_container[ZONE_0], 1);
				break;
			case FULL_ADJOINT:
				grid_adaptation->GetAdjSolution(geometry_container[ZONE_0], config_container[ZONE_0]);
				grid_adaptation->SetComplete_Refinement(geometry_container[ZONE_0], 1);
				break;
			case GRAD_FLOW:
				grid_adaptation->SetIndicator_Flow(geometry_container[ZONE_0], config_container[ZONE_0], 1);
				break;
			case GRAD_ADJOINT:
				grid_adaptation->GetAdjSolution(geometry_container[ZONE_0], config_container[ZONE_0]);
				grid_adaptation->SetIndicator_Adj(geometry_container[ZONE_0], config_container[ZONE_0], 1);
				break;
			case GRAD_FLOW_ADJ:
				grid_adaptation->GetAdjSolution(geometry_container[ZONE_0], config_container[ZONE_0]);
				grid_adaptation->SetIndicator_FlowAdj(geometry_container[ZONE_0], config_container[ZONE_0]);
				break;
			case COMPUTABLE:
				grid_adaptation->GetAdjSolution(geometry_container[ZONE_0], config_container[ZONE_0]);
				grid_adaptation->GetFlowResidual(geometry_container[ZONE_0], config_container[ZONE_0]);
				grid_adaptation->SetIndicator_Computable(geometry_container[ZONE_0], config_container[ZONE_0]);
				break;
			case REMAINING:
        SU2_MPI::Error("Adaptation method not implemented.", CURRENT_FUNCTION);
				break;
			default :
				cout << "The adaptation is not defined" << endl;
		}
		
		/*--- Perform an homothetic adaptation of the grid ---*/
    
		CPhysicalGeometry *geo_adapt; geo_adapt = new CPhysicalGeometry;
		
		cout << "Homothetic grid adaptation" << endl;
		if (geometry_container[ZONE_0]->GetnDim() == 2) grid_adaptation->SetHomothetic_Adaptation2D(geometry_container[ZONE_0], geo_adapt, config_container[ZONE_0]);
		if (geometry_container[ZONE_0]->GetnDim() == 3) grid_adaptation->SetHomothetic_Adaptation3D(geometry_container[ZONE_0], geo_adapt, config_container[ZONE_0]);
    
		/*--- Smooth the numerical grid coordinates ---*/
    
		if (config_container[ZONE_0]->GetSmoothNumGrid()) {
			cout << "Preprocessing for doing the implicit smoothing." << endl;
			geo_adapt->SetPoint_Connectivity(); geo_adapt->SetElement_Connectivity();
			geo_adapt->SetBoundVolume();
			if (config_container[ZONE_0]->GetReorientElements()) {
				geo_adapt->Check_IntElem_Orientation(config_container[ZONE_0]); geo_adapt->Check_BoundElem_Orientation(config_container[ZONE_0]);
			}
			geo_adapt->SetEdges(); geo_adapt->SetVertex(config_container[ZONE_0]);
			cout << "Implicit smoothing of the numerical grid coordinates." << endl;
			geo_adapt->SetCoord_Smoothing(5, 1.5, config_container[ZONE_0]);
		}
		
		/*--- Original and adapted grid ---*/
    strcpy (file_name, "original_grid.dat");
    geometry_container[ZONE_0]->SetTecPlot(file_name, true);
    strcpy (file_name, "original_surface.dat");
    geometry_container[ZONE_0]->SetBoundTecPlot(file_name, true, config_container[ZONE_0]);
    
		/*--- Write the adapted grid sensor ---*/
    
    strcpy (file_name, "adapted_grid.dat");
    geo_adapt->SetTecPlot(file_name, true);
    strcpy (file_name, "adapted_surface.dat");
    geo_adapt->SetBoundTecPlot(file_name, true, config_container[ZONE_0]);
		
		/*--- Write the new adapted grid, including the modified boundaries surfaces ---*/
    
		geo_adapt->SetMeshFile(config_container[ZONE_0], config_container[ZONE_0]->GetMesh_Out_FileName());
    
    
		/*--- Write the restart file ---*/
    
		if ((config_container[ZONE_0]->GetKind_Adaptation() != SMOOTHING) && (config_container[ZONE_0]->GetKind_Adaptation() != FULL) &&
				(config_container[ZONE_0]->GetKind_Adaptation() != WAKE) &&
				(config_container[ZONE_0]->GetKind_Adaptation() != SUPERSONIC_SHOCK))
			grid_adaptation->SetRestart_FlowSolution(config_container[ZONE_0], geo_adapt, config_container[ZONE_0]->GetRestart_FlowFileName());
		
		if ((config_container[ZONE_0]->GetKind_Adaptation() == GRAD_FLOW_ADJ) || (config_container[ZONE_0]->GetKind_Adaptation() == GRAD_ADJOINT)
				|| (config_container[ZONE_0]->GetKind_Adaptation() == FULL_ADJOINT) || (config_container[ZONE_0]->GetKind_Adaptation() == COMPUTABLE) ||
				(config_container[ZONE_0]->GetKind_Adaptation() == REMAINING))
			grid_adaptation->SetRestart_AdjSolution(config_container[ZONE_0], geo_adapt, config_container[ZONE_0]->GetRestart_AdjFileName());
		
	}
	else {
    
    if (config_container[ZONE_0]->GetKind_Adaptation() == PERIODIC) {
      
      cout << endl <<"-------------------- Setting the periodic boundaries --------------------" << endl;
      
      /*--- Set periodic boundary conditions ---*/
      
      geometry_container[ZONE_0]->SetPeriodicBoundary(config_container[ZONE_0]);
      
      /*--- Original grid for debugging purposes ---*/
      
      strcpy (file_name, "periodic_original.dat"); geometry_container[ZONE_0]->SetTecPlot(file_name, true);
      
      /*--- Create a new grid with the right periodic boundary ---*/
      
      CGeometry *periodic; periodic = new CPeriodicGeometry(geometry_container[ZONE_0], config_container[ZONE_0]);
      periodic->SetPeriodicBoundary(geometry_container[ZONE_0], config_container[ZONE_0]);
      periodic->SetMeshFile(geometry_container[ZONE_0], config_container[ZONE_0], config_container[ZONE_0]->GetMesh_Out_FileName());
      
      /*--- Output of the grid for debuging purposes ---*/
      
      strcpy (file_name, "periodic_halo.dat"); periodic->SetTecPlot(file_name, true);
      
    }
    
    if (config_container[ZONE_0]->GetKind_Adaptation() == NONE) {
      strcpy (file_name, "original_grid.dat");
      geometry_container[ZONE_0]->SetTecPlot(file_name, true);
      geometry_container[ZONE_0]->SetMeshFile(config_container[ZONE_0], config_container[ZONE_0]->GetMesh_Out_FileName());
    }
    
	}
  
  if (rank == MASTER_NODE)
    cout << endl <<"------------------------- Solver Postprocessing -------------------------" << endl;
  
  if (geometry_container != NULL) {
    for (iZone = 0; iZone < nZone; iZone++) {
      if (geometry_container[iZone] != NULL) {
        delete geometry_container[iZone];
      }
    }
    delete [] geometry_container;
  }
  if (rank == MASTER_NODE) cout << "Deleted CGeometry container." << endl;
  
  
  if (config_container != NULL) {
    for (iZone = 0; iZone < nZone; iZone++) {
      if (config_container[iZone] != NULL) {
        delete config_container[iZone];
      }
    }
    delete [] config_container;
  }
  if (rank == MASTER_NODE) cout << "Deleted CConfig container." << endl;
  
  delete config;
  config = NULL;

  /*--- Synchronization point after a single solver iteration. Compute the
   wall clock time required. ---*/
  
#ifdef HAVE_MPI
  StopTime = MPI_Wtime();
#else
  StopTime = su2double(clock())/su2double(CLOCKS_PER_SEC);
#endif
  
  /*--- Compute/print the total time for performance benchmarking. ---*/
  
  UsedTime = StopTime-StartTime;
  if (rank == MASTER_NODE) {
    cout << "\nCompleted in " << fixed << UsedTime << " seconds on "<< size;
    if (size == 1) cout << " core." << endl; else cout << " cores." << endl;
  }
  
  /*--- Exit the solver cleanly ---*/
  
	cout << endl <<"------------------------- Exit Success (SU2_MSH) ------------------------" << endl << endl;
  
  /*--- Finalize MPI parallelization ---*/
  
#ifdef HAVE_MPI
  SU2_MPI::Finalize();
#endif
  
  return EXIT_SUCCESS;
  
}