本文整理汇总了C++中CConfig::GetMesh_FileFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfig::GetMesh_FileFormat方法的具体用法?C++ CConfig::GetMesh_FileFormat怎么用?C++ CConfig::GetMesh_FileFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfig
的用法示例。
在下文中一共展示了CConfig::GetMesh_FileFormat方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
/*--- Local variables ---*/
unsigned short iDV, nZone = 1, iFFDBox, iPlane, nPlane, iVar;
double *ObjectiveFunc, *ObjectiveFunc_New, *Gradient, delta_eps, MinPlane, MaxPlane, MinXCoord, MaxXCoord,
**Plane_P0, **Plane_Normal, Volume, Volume_New, Volume_Grad;
vector<double> *Xcoord_Airfoil, *Ycoord_Airfoil, *Zcoord_Airfoil, *Variable_Airfoil;
char grid_file[MAX_STRING_SIZE], buffer_char[50], out_file[MAX_STRING_SIZE];
char *cstr;
ofstream Gradient_file, ObjFunc_file;
int rank = MASTER_NODE;
int size = SINGLE_NODE;
/*--- MPI initialization ---*/
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
MPI_Comm_size(MPI_COMM_WORLD,&size);
#endif
/*--- Pointer to different structures that will be used throughout the entire code ---*/
CFreeFormDefBox** FFDBox = NULL;
CConfig *config = NULL;
CGeometry *boundary = NULL;
CSurfaceMovement *surface_mov = NULL;
/*--- Definition of the class for the definition of the problem ---*/
if (argc == 2) config = new CConfig(argv[1], SU2_GEO, ZONE_0, nZone, 0, VERB_HIGH);
else {
strcpy (grid_file, "default.cfg");
config = new CConfig(grid_file, SU2_GEO, ZONE_0, nZone, 0, VERB_HIGH);
}
/*--- Change the name of the input-output files for the parallel computation ---*/
#ifdef HAVE_MPI
config->SetFileNameDomain(rank+1);
#endif
/*--- Definition of the class for the boundary of the geometry ---*/
boundary = new CBoundaryGeometry(config, config->GetMesh_FileName(), config->GetMesh_FileFormat());
/*--- Set the number of sections, and allocate the memory ---*/
if (boundary->GetnDim() == 2) nPlane = 1;
else nPlane = config->GetnSections();
Xcoord_Airfoil = new vector<double>[nPlane];
Ycoord_Airfoil = new vector<double>[nPlane];
Zcoord_Airfoil = new vector<double>[nPlane];
Variable_Airfoil = new vector<double>[nPlane];
Plane_P0 = new double*[nPlane];
Plane_Normal = new double*[nPlane];
for(iPlane = 0; iPlane < nPlane; iPlane++ ) {
Plane_P0[iPlane] = new double[3];
Plane_Normal[iPlane] = new double[3];
}
ObjectiveFunc = new double[nPlane*20];
ObjectiveFunc_New = new double[nPlane*20];
Gradient = new double[nPlane*20];
for (iVar = 0; iVar < nPlane*20; iVar++) {
ObjectiveFunc[iVar] = 0.0;
ObjectiveFunc_New[iVar] = 0.0;
Gradient[iVar] = 0.0;
}
/*--- Evaluation of the objective function ---*/
if (rank == MASTER_NODE)
cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
/*--- Boundary geometry preprocessing ---*/
if (rank == MASTER_NODE) cout << "Identify vertices." <<endl;
boundary->SetVertex();
/*--- Compute elements surrounding points & points surrounding points ---*/
if (rank == MASTER_NODE) cout << "Setting local point and element connectivity." << endl;
boundary->SetPoint_Connectivity();
boundary->SetEdges();
/*--- Create the control volume structures ---*/
if (rank == MASTER_NODE) cout << "Set boundary control volume structure." << endl;
boundary->SetBoundControlVolume(config, ALLOCATE);
/*--- Compute the surface curvature ---*/
if (rank == MASTER_NODE) cout << "Compute the surface curvature." << endl;
//.........这里部分代码省略.........
示例2: main
int main(int argc, char *argv[]) {
unsigned short iZone, nZone = SINGLE_ZONE;
su2double StartTime = 0.0, StopTime = 0.0, UsedTime = 0.0;
char config_file_name[MAX_STRING_SIZE], *cstr = NULL;
ofstream Gradient_file;
su2double** Gradient;
unsigned short iDV, iDV_Value;
int rank, size;
/*--- MPI initialization, and buffer setting ---*/
#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;
CSurfaceMovement **surface_movement = NULL;
CVolumetricMovement **grid_movement = NULL;
COutput *output = 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);
/*--- Definition of the containers per zones ---*/
config_container = new CConfig*[nZone];
geometry_container = new CGeometry*[nZone];
surface_movement = new CSurfaceMovement*[nZone];
grid_movement = new CVolumetricMovement*[nZone];
for (iZone = 0; iZone < nZone; iZone++) {
config_container[iZone] = NULL;
geometry_container[iZone] = NULL;
grid_movement [iZone] = NULL;
surface_movement[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_DOT, iZone, nZone, 0, VERB_HIGH);
/*--- Set the MPI communicator ---*/
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]);
/*--- Allocate the memory of the current domain, and
divide the grid between the nodes ---*/
geometry_container[iZone] = new CPhysicalGeometry(geometry_aux, config_container[iZone]);
/*--- Deallocate the memory of geometry_aux ---*/
delete geometry_aux;
/*--- Add the Send/Receive boundaries ---*/
//.........这里部分代码省略.........
示例3: main
int main(int argc, char *argv[]) {
bool StopCalc = false;
su2double StartTime = 0.0, StopTime = 0.0, UsedTime = 0.0;
unsigned long ExtIter = 0;
unsigned short iMesh, iZone, nZone, nDim;
char config_file_name[MAX_STRING_SIZE];
char runtime_file_name[MAX_STRING_SIZE];
ofstream ConvHist_file;
int rank = MASTER_NODE;
int size = SINGLE_NODE;
/*--- MPI initialization, and buffer setting ---*/
#ifdef HAVE_MPI
int *bptr, bl;
SU2_MPI::Init(&argc, &argv);
MPI_Buffer_attach( malloc(BUFSIZE), BUFSIZE );
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif
/*--- Create pointers to all of the classes that may be used throughout
the SU2_CFD code. In general, the pointers are instantiated down a
heirarchy over all zones, multigrid levels, equation sets, and equation
terms as described in the comments below. ---*/
CDriver *driver = NULL;
CIteration **iteration_container = NULL;
COutput *output = NULL;
CIntegration ***integration_container = NULL;
CGeometry ***geometry_container = NULL;
CSolver ****solver_container = NULL;
CNumerics *****numerics_container = NULL;
CConfig **config_container = NULL;
CSurfaceMovement **surface_movement = NULL;
CVolumetricMovement **grid_movement = NULL;
CFreeFormDefBox*** FFDBox = NULL;
CInterpolator ***interpolator_container = NULL;
CTransfer ***transfer_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_CFD);
nZone = GetnZone(config->GetMesh_FileName(), config->GetMesh_FileFormat(), config);
nDim = GetnDim(config->GetMesh_FileName(), config->GetMesh_FileFormat());
delete config;
/*--- Definition and of the containers for all possible zones. ---*/
iteration_container = new CIteration*[nZone];
solver_container = new CSolver***[nZone];
integration_container = new CIntegration**[nZone];
numerics_container = new CNumerics****[nZone];
config_container = new CConfig*[nZone];
geometry_container = new CGeometry**[nZone];
surface_movement = new CSurfaceMovement*[nZone];
grid_movement = new CVolumetricMovement*[nZone];
FFDBox = new CFreeFormDefBox**[nZone];
interpolator_container = new CInterpolator**[nZone];
transfer_container = new CTransfer**[nZone];
for (iZone = 0; iZone < nZone; iZone++) {
solver_container[iZone] = NULL;
integration_container[iZone] = NULL;
numerics_container[iZone] = NULL;
config_container[iZone] = NULL;
geometry_container[iZone] = NULL;
surface_movement[iZone] = NULL;
grid_movement[iZone] = NULL;
FFDBox[iZone] = NULL;
interpolator_container[iZone] = NULL;
transfer_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_CFD, iZone, nZone, nDim, VERB_HIGH);
/*--- Definition of the geometry class to store the primal grid in the
partitioning process. ---*/
CGeometry *geometry_aux = NULL;
//.........这里部分代码省略.........
示例4: main
int main(int argc, char *argv[]) {
/*--- Local variables ---*/
unsigned short iMarker, iDim, iDV, iFFDBox, nZone = 1;
unsigned long iVertex, iPoint;
double delta_eps, my_Gradient, Gradient, *Normal, dS;
double *VarCoord, Sensitivity;
double dalpha[3], deps[3], dalpha_deps;
char *cstr;
ofstream Gradient_file, Jacobian_file;
bool *UpdatePoint, Comma;
int rank = MASTER_NODE;
int size = SINGLE_NODE;
#ifndef NO_MPI
/*--- MPI initialization, and buffer setting ---*/
MPI::Init(argc,argv);
rank = MPI::COMM_WORLD.Get_rank();
size = MPI::COMM_WORLD.Get_size();
#endif
/*--- Pointer to different structures that will be used throughout the entire code ---*/
CFreeFormDefBox** FFDBox = NULL;
CConfig *config = NULL;
CGeometry *boundary = NULL;
CSurfaceMovement *surface_mov = NULL;
/*--- Definition of the Class for the definition of the problem ---*/
if (argc == 2) config = new CConfig(argv[1], SU2_GPC, ZONE_0, nZone, VERB_HIGH);
else {
char grid_file[200];
strcpy (grid_file, "default.cfg");
config = new CConfig(grid_file, SU2_GPC, ZONE_0, nZone, VERB_HIGH);
}
#ifndef NO_MPI
/*--- Change the name of the input-output files for the
parallel computation ---*/
config->SetFileNameDomain(rank+1);
#endif
/*--- Definition of the Class for the boundary of the geometry,
note that the orientation of the elements is not checked ---*/
boundary = new CBoundaryGeometry(config, config->GetMesh_FileName(), config->GetMesh_FileFormat());
/*--- Perform the non-dimensionalization, in case any values are needed ---*/
config->SetNondimensionalization(boundary->GetnDim(), ZONE_0);
if (rank == MASTER_NODE)
cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
/*--- Boundary geometry preprocessing ---*/
if (rank == MASTER_NODE) cout << "Identify vertices." <<endl;
boundary->SetVertex();
/*--- Create the control volume structures ---*/
if (rank == MASTER_NODE) cout << "Set boundary control volume structure." << endl;
boundary->SetBoundControlVolume(config, ALLOCATE);
/*--- Load the surface sensitivities from file. This is done only
once: if this is an unsteady problem, a time-average of the surface
sensitivities at each node is taken within this routine. ---*/
if (rank == MASTER_NODE) cout << "Reading surface sensitivities at each node from file." << endl;
boundary->SetBoundSensitivity(config);
/*--- Boolean controlling points to be updated ---*/
UpdatePoint = new bool[boundary->GetnPoint()];
/*--- Definition of the Class for surface deformation ---*/
surface_mov = new CSurfaceMovement();
/*--- Definition of the FFD deformation class ---*/
unsigned short nFFDBox = MAX_NUMBER_FFD;
FFDBox = new CFreeFormDefBox*[nFFDBox];
if (rank == MASTER_NODE)
cout << endl <<"---------- Start gradient evaluation using surface sensitivity ----------" << endl;
/*--- Write the gradient in a external file ---*/
if (rank == MASTER_NODE) {
cstr = new char [config->GetObjFunc_Grad_FileName().size()+1];
strcpy (cstr, config->GetObjFunc_Grad_FileName().c_str());
Gradient_file.open(cstr, ios::out);
/*--- Write an additional file with the geometric Jacobian ---*/
/*--- WARNING: This is only for serial calculations!!! ---*/
if (size == SINGLE_NODE) {
Jacobian_file.open("geo_jacobian.csv", ios::out);
Jacobian_file.precision(15);
/*--- Write the CSV file header ---*/
Comma = false;
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_DV(iMarker) == YES) {
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
iPoint = boundary->vertex[iMarker][iVertex]->GetNode();
if (!Comma) { Jacobian_file << "\t\"DesignVariable\""; Comma = true;}
Jacobian_file << ", " << "\t\"" << iPoint << "\"";
}
}
//.........这里部分代码省略.........
示例5: main
int main(int argc, char *argv[]) {
bool StopCalc = false;
unsigned long StartTime, StopTime, TimeUsed = 0, ExtIter = 0;
unsigned short iMesh, iZone, iSol, nZone, nDim;
ofstream ConvHist_file;
int rank = MASTER_NODE;
#ifndef NO_MPI
/*--- MPI initialization, and buffer setting ---*/
void *buffer, *old_buffer;
int size, bufsize;
bufsize = MAX_MPI_BUFFER;
buffer = new char[bufsize];
MPI::Init(argc, argv);
MPI::Attach_buffer(buffer, bufsize);
rank = MPI::COMM_WORLD.Get_rank();
size = MPI::COMM_WORLD.Get_size();
#ifdef TIME
/*--- Set up a timer for parallel performance benchmarking ---*/
double start, finish, time;
MPI::COMM_WORLD.Barrier();
start = MPI::Wtime();
#endif
#endif
/*--- Create pointers to all of the classes that may be used throughout
the SU2_CFD code. In general, the pointers are instantiated down a
heirarchy over all zones, multigrid levels, equation sets, and equation
terms as described in the comments below. ---*/
COutput *output = NULL;
CIntegration ***integration_container = NULL;
CGeometry ***geometry_container = NULL;
CSolver ****solver_container = NULL;
CNumerics *****numerics_container = NULL;
CConfig **config_container = NULL;
CSurfaceMovement **surface_movement = NULL;
CVolumetricMovement **grid_movement = NULL;
CFreeFormDefBox*** FFDBox = NULL;
/*--- Load in the number of zones and spatial dimensions in the mesh file (If no config
file is specified, default.cfg is used) ---*/
char config_file_name[200];
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 ---*/
CConfig *config = NULL;
config = new CConfig(config_file_name);
/*--- Get the number of zones and dimensions from the numerical grid
(required for variables allocation) ---*/
nZone = GetnZone(config->GetMesh_FileName(), config->GetMesh_FileFormat(), config);
nDim = GetnDim(config->GetMesh_FileName(), config->GetMesh_FileFormat());
/*--- Definition and of the containers for all possible zones. ---*/
solver_container = new CSolver***[nZone];
integration_container = new CIntegration**[nZone];
numerics_container = new CNumerics****[nZone];
config_container = new CConfig*[nZone];
geometry_container = new CGeometry **[nZone];
surface_movement = new CSurfaceMovement *[nZone];
grid_movement = new CVolumetricMovement *[nZone];
FFDBox = new CFreeFormDefBox**[nZone];
for (iZone = 0; iZone < nZone; iZone++) {
solver_container[iZone] = NULL;
integration_container[iZone] = NULL;
numerics_container[iZone] = NULL;
config_container[iZone] = NULL;
geometry_container[iZone] = NULL;
surface_movement[iZone] = NULL;
grid_movement[iZone] = NULL;
FFDBox[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_CFD, iZone, nZone, VERB_HIGH);
#ifndef NO_MPI
/*--- Change the name of the input-output files for a parallel computation ---*/
config_container[iZone]->SetFileNameDomain(rank+1);
#endif
/*--- Perform the non-dimensionalization for the flow equations using the
specified reference values. ---*/
//.........这里部分代码省略.........
示例6: main
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;
}
示例7: main
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();
//.........这里部分代码省略.........
示例8: main
int main(int argc, char *argv[]) {
/*--- Local variables ---*/
unsigned short iDV, nZone = 1, iFFDBox, iPlane, nPlane = 5, iVar;
double ObjectiveFunc[100], ObjectiveFunc_New[100], Gradient[100], delta_eps, MinPlane, MaxPlane, Plane_P0[5][3], Plane_Normal[5][3];
vector<double> Xcoord_Airfoil[5], Ycoord_Airfoil[5], Zcoord_Airfoil[5];
char *cstr;
ofstream Gradient_file, ObjFunc_file;
int rank = MASTER_NODE;
/*--- Initialization ---*/
for (iVar = 0; iVar < 100; iVar++) {
ObjectiveFunc[iVar] = 0.0;
ObjectiveFunc_New[iVar] = 0.0;
Gradient[iVar] = 0.0;
}
#ifndef NO_MPI
/*--- MPI initialization, and buffer setting ---*/
MPI::Init(argc,argv);
rank = MPI::COMM_WORLD.Get_rank();
#endif
/*--- Pointer to different structures that will be used throughout the entire code ---*/
CFreeFormDefBox** FFDBox = NULL;
CConfig *config = NULL;
CGeometry *boundary = NULL;
CSurfaceMovement *surface_mov = NULL;
/*--- Definition of the Class for the definition of the problem ---*/
if (argc == 2) config = new CConfig(argv[1], SU2_GDC, ZONE_0, nZone, VERB_HIGH);
else {
char grid_file[200];
strcpy (grid_file, "default.cfg");
config = new CConfig(grid_file, SU2_GDC, ZONE_0, nZone, VERB_HIGH);
}
#ifndef NO_MPI
/*--- Change the name of the input-output files for the
parallel computation ---*/
config->SetFileNameDomain(rank+1);
#endif
/*--- Definition of the Class for the boundary of the geometry ---*/
boundary = new CBoundaryGeometry(config, config->GetMesh_FileName(), config->GetMesh_FileFormat());
if (rank == MASTER_NODE)
cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
/*--- Boundary geometry preprocessing ---*/
if (rank == MASTER_NODE) cout << "Identify vertices." <<endl;
boundary->SetVertex();
/*--- Create the control volume structures ---*/
if (rank == MASTER_NODE) cout << "Set boundary control volume structure." << endl;
boundary->SetBoundControlVolume(config, ALLOCATE);
/*--- Create plane structure ---*/
if (rank == MASTER_NODE) cout << "Set plane structure." << endl;
if (boundary->GetnDim() == 2) {
nPlane = 1;
Plane_Normal[0][0] = 0.0; Plane_P0[0][0] = 0.0;
Plane_Normal[0][1] = 1.0; Plane_P0[0][1] = 0.0;
Plane_Normal[0][2] = 0.0; Plane_P0[0][2] = 0.0;
}
else if (boundary->GetnDim() == 3) {
nPlane = 5; MinPlane = config->GetSection_Limit(0); MaxPlane = config->GetSection_Limit(1);
for (iPlane = 0; iPlane < nPlane; iPlane++) {
Plane_Normal[iPlane][0] = 0.0; Plane_P0[iPlane][0] = 0.0;
Plane_Normal[iPlane][1] = 1.0; Plane_P0[iPlane][1] = MinPlane + iPlane*(MaxPlane - MinPlane)/double(nPlane-1);
Plane_Normal[iPlane][2] = 0.0; Plane_P0[iPlane][2] = 0.0;
}
}
/*--- Create airfoil section structure ---*/
if (rank == MASTER_NODE) cout << "Set airfoil section structure." << endl;
for (iPlane = 0; iPlane < nPlane; iPlane++) {
boundary->ComputeAirfoil_Section(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, config,
Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
}
if (rank == MASTER_NODE)
cout << endl <<"-------------------- Objective function evaluation ----------------------" << endl;
if (rank == MASTER_NODE) {
/*--- Evaluate objective function ---*/
for (iPlane = 0; iPlane < nPlane; iPlane++) {
if (Xcoord_Airfoil[iPlane].size() != 0) {
cout << "\nSection " << (iPlane+1) << ". Plane (yCoord): " << Plane_P0[iPlane][1] << "." << endl;
ObjectiveFunc[iPlane] = boundary->Compute_MaxThickness(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
ObjectiveFunc[1*nPlane+iPlane] = boundary->Compute_Thickness(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, 0.250000, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
ObjectiveFunc[2*nPlane+iPlane] = boundary->Compute_Thickness(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, 0.333333, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
ObjectiveFunc[3*nPlane+iPlane] = boundary->Compute_Thickness(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, 0.500000, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
ObjectiveFunc[4*nPlane+iPlane] = boundary->Compute_Thickness(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, 0.666666, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
ObjectiveFunc[5*nPlane+iPlane] = boundary->Compute_Thickness(Plane_P0[iPlane], Plane_Normal[iPlane], iPlane, 0.750000, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane], true);
//.........这里部分代码省略.........
示例9: main
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 ---*/
//.........这里部分代码省略.........
示例10: main
int main(int argc, char *argv[]) {
bool StopCalc = false;
double StartTime = 0.0, StopTime = 0.0, UsedTime = 0.0;
unsigned long ExtIter = 0;
unsigned short iMesh, iZone, iSol, nZone, nDim;
char config_file_name[MAX_STRING_SIZE];
char runtime_file_name[MAX_STRING_SIZE];
ofstream ConvHist_file;
int rank = MASTER_NODE;
int size = SINGLE_NODE;
/*--- MPI initialization, and buffer setting ---*/
#ifdef HAVE_MPI
int *bptr, bl;
MPI_Init(&argc, &argv);
MPI_Buffer_attach( malloc(BUFSIZE), BUFSIZE );
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif
/*--- Create pointers to all of the classes that may be used throughout
the SU2_CFD code. In general, the pointers are instantiated down a
heirarchy over all zones, multigrid levels, equation sets, and equation
terms as described in the comments below. ---*/
COutput *output = NULL;
CIntegration ***integration_container = NULL;
CGeometry ***geometry_container = NULL;
CSolver ****solver_container = NULL;
CNumerics *****numerics_container = NULL;
CConfig **config_container = NULL;
CSurfaceMovement **surface_movement = NULL;
CVolumetricMovement **grid_movement = NULL;
CFreeFormDefBox*** FFDBox = 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_CFD);
nZone = GetnZone(config->GetMesh_FileName(), config->GetMesh_FileFormat(), config);
nDim = GetnDim(config->GetMesh_FileName(), config->GetMesh_FileFormat());
/*--- Definition and of the containers for all possible zones. ---*/
solver_container = new CSolver***[nZone];
integration_container = new CIntegration**[nZone];
numerics_container = new CNumerics****[nZone];
config_container = new CConfig*[nZone];
geometry_container = new CGeometry**[nZone];
surface_movement = new CSurfaceMovement*[nZone];
grid_movement = new CVolumetricMovement*[nZone];
FFDBox = new CFreeFormDefBox**[nZone];
for (iZone = 0; iZone < nZone; iZone++) {
solver_container[iZone] = NULL;
integration_container[iZone] = NULL;
numerics_container[iZone] = NULL;
config_container[iZone] = NULL;
geometry_container[iZone] = NULL;
surface_movement[iZone] = NULL;
grid_movement[iZone] = NULL;
FFDBox[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_CFD, iZone, nZone, nDim, VERB_HIGH);
/*--- 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]);
//.........这里部分代码省略.........
示例11: main
int main(int argc, char *argv[]) {
unsigned short iZone, nZone = SINGLE_ZONE, iInst;
su2double StartTime = 0.0, StopTime = 0.0, UsedTime = 0.0;
ofstream ConvHist_file;
char config_file_name[MAX_STRING_SIZE];
int rank = MASTER_NODE;
int size = SINGLE_NODE;
bool fem_solver = false;
bool periodic = false;
bool multizone = 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 ---*/
COutput *output = NULL;
CGeometry ***geometry_container = NULL;
CSolver ***solver_container = NULL;
CConfig **config_container = NULL;
CConfig *driver_config = NULL;
unsigned short *nInst = 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 || argc == 3) { strcpy(config_file_name,argv[1]); }
else { strcpy(config_file_name, "default.cfg"); }
CConfig *config = NULL;
config = new CConfig(config_file_name, SU2_SOL);
if (config->GetKind_Solver() == MULTIZONE) nZone = config->GetnConfigFiles();
else 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 ---*/
solver_container = new CSolver**[nZone];
config_container = new CConfig*[nZone];
geometry_container = new CGeometry**[nZone];
nInst = new unsigned short[nZone];
driver_config = NULL;
for (iZone = 0; iZone < nZone; iZone++) {
solver_container[iZone] = NULL;
config_container[iZone] = NULL;
geometry_container[iZone] = NULL;
nInst[iZone] = 1;
}
/*--- Initialize the configuration of the driver ---*/
driver_config = new CConfig(config_file_name, SU2_SOL, ZONE_0, nZone, 0, VERB_NONE);
/*--- Initialize a char to store the zone filename ---*/
char zone_file_name[MAX_STRING_SIZE];
/*--- Store a boolean for multizone problems ---*/
multizone = (driver_config->GetKind_Solver() == MULTIZONE);
/*--- 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. ---*/
if (multizone){
strcpy(zone_file_name, driver_config->GetConfigFilename(iZone).c_str());
config_container[iZone] = new CConfig(zone_file_name, SU2_SOL, iZone, nZone, 0, VERB_HIGH);
}
else{
config_container[iZone] = new CConfig(config_file_name, SU2_SOL, iZone, nZone, 0, VERB_HIGH);
}
config_container[iZone]->SetMPICommunicator(MPICommunicator);
}
/*--- Set the multizone part of the problem. ---*/
if (driver_config->GetKind_Solver() == MULTIZONE){
for (iZone = 0; iZone < nZone; iZone++) {
/*--- Set the interface markers for multizone ---*/
config_container[iZone]->SetMultizone(driver_config, config_container);
}
}
/*--- Read the geometry for each zone ---*/
//.........这里部分代码省略.........
示例12: main
int main(int argc, char *argv[]) {
unsigned short iZone, nZone = SINGLE_ZONE;
su2double StartTime = 0.0, StopTime = 0.0, UsedTime = 0.0;
ofstream ConvHist_file;
char config_file_name[MAX_STRING_SIZE];
int rank = MASTER_NODE;
int size = SINGLE_NODE;
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 ---*/
COutput *output = NULL;
CGeometry **geometry_container = NULL;
CSolver **solver_container = NULL;
CConfig **config_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 || argc == 3) { strcpy(config_file_name,argv[1]); }
else { strcpy(config_file_name, "default.cfg"); }
CConfig *config = NULL;
config = new CConfig(config_file_name, SU2_SOL);
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 ---*/
solver_container = new CSolver*[nZone];
config_container = new CConfig*[nZone];
geometry_container = new CGeometry*[nZone];
for (iZone = 0; iZone < nZone; iZone++) {
solver_container[iZone] = NULL;
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_SOL, 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]);
//.........这里部分代码省略.........