Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Common/src/grid_movement_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5829,27 +5829,27 @@ void CSurfaceMovement::SetAirfoil(CGeometry *boundary, CConfig *config) {
/*--- Open the restart file, throw an error if this fails. ---*/

cout << "Enter the name of file with the airfoil information: ";
ierr = scanf("%s", AirfoilFile);
ierr = scanf("%255s", AirfoilFile);
if (ierr == 0) { cout << "No input read!! "<< endl; exit(EXIT_FAILURE); }
airfoil_file.open(AirfoilFile, ios::in);
if (airfoil_file.fail()) {
cout << "There is no airfoil file!! "<< endl;
exit(EXIT_FAILURE);
}
cout << "Enter the format of the airfoil (Selig or Lednicer): ";
ierr = scanf("%s", AirfoilFormat);
ierr = scanf("%14s", AirfoilFormat);
if (ierr == 0) { cout << "No input read!! "<< endl; exit(EXIT_FAILURE); }

cout << "Thickness scaling (1.0 means no scaling)?: ";
ierr = scanf("%lf", &AirfoilScale);
if (ierr == 0) { cout << "No input read!! "<< endl; exit(EXIT_FAILURE); }

cout << "Close the airfoil (Yes or No)?: ";
ierr = scanf("%s", AirfoilClose);
ierr = scanf("%14s", AirfoilClose);
if (ierr == 0) { cout << "No input read!! "<< endl; exit(EXIT_FAILURE); }

cout << "Surface mesh orientation (clockwise, or anticlockwise): ";
ierr = scanf("%s", MeshOrientation);
ierr = scanf("%14s", MeshOrientation);
if (ierr == 0) { cout << "No input read!! "<< endl; exit(EXIT_FAILURE); }

/*--- The first line is the header ---*/
Expand Down
6 changes: 3 additions & 3 deletions Common/src/linear_solvers_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ int rank = 0;
// }
// }

return i;
return (unsigned long) i;

}

Expand Down Expand Up @@ -465,7 +465,7 @@ int rank = 0;
// }

(*residual) = beta;
return i;
return (unsigned long) i;

}

Expand Down Expand Up @@ -601,7 +601,7 @@ unsigned long CSysSolve::BCGSTAB_LinSolver(const CSysVector & b, CSysVector & x,
// }

(*residual) = norm_r;
return i;
return (unsigned long) i;
}

unsigned long CSysSolve::Solve(CSysMatrix & Jacobian, CSysVector & LinSysRes, CSysVector & LinSysSol, CGeometry *geometry, CConfig *config) {
Expand Down
6 changes: 3 additions & 3 deletions Common/src/matrix_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ unsigned long CSysMatrix::Jacobi_Smoother(const CSysVector & b, CSysVector & x,
cout << "# Iteration = " << i << ": |res|/|res0| = " << norm_r/norm0 << ".\n" << endl;
}

return i;
return (unsigned long) i;

}

Expand Down Expand Up @@ -1496,7 +1496,7 @@ unsigned long CSysMatrix::ILU0_Smoother(const CSysVector & b, CSysVector & x, CM
cout << "# Iteration = " << i << ": |res|/|res0| = " << norm_r/norm0 << ".\n" << endl;
}

return i;
return (unsigned int) i;

}

Expand Down Expand Up @@ -1659,7 +1659,7 @@ unsigned long CSysMatrix::LU_SGS_Smoother(const CSysVector & b, CSysVector & x,
cout << "# Iteration = " << i << ": |res|/|res0| = " << norm_r/norm0 << ".\n" << endl;
}

return i;
return (unsigned int) i;

}

Expand Down
153 changes: 77 additions & 76 deletions SU2_CFD/src/numerics_direct_transition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,82 +156,83 @@ CAvgGrad_TransLM::~CAvgGrad_TransLM(void) {
}

void CAvgGrad_TransLM::ComputeResidual(su2double *val_residual, su2double **Jacobian_i, su2double **Jacobian_j, CConfig *config) {

su2double *Density_Grad_i = new su2double[nDim];
su2double *Density_Grad_j = new su2double[nDim];
su2double *Conservative_Grad_i = new su2double[nDim];
su2double *Conservative_Grad_j = new su2double[nDim];
su2double *Primitive_Grad_i = new su2double[nDim];
su2double *Primitive_Grad_j = new su2double[nDim];

/*--- Intermediate values for combining viscosities ---*/
su2double Inter_Viscosity_i, Inter_Viscosity_j, REth_Viscosity_i, REth_Viscosity_j, Inter_Viscosity_Mean, REth_Viscosity_Mean;

/*--- Model constants---*/
su2double sigmaf = 1.0;
su2double sigma_thetat = 2.0;

/*--- Get density ---*/
Density_i = U_i[0];
Density_j = U_j[0];

/*--- Construct combinations of viscosity ---*/
Inter_Viscosity_i = (Laminar_Viscosity_i+Eddy_Viscosity_i/sigmaf);
Inter_Viscosity_j = (Laminar_Viscosity_j+Eddy_Viscosity_j/sigmaf);
Inter_Viscosity_Mean = 0.5*(Inter_Viscosity_i+Inter_Viscosity_j);
REth_Viscosity_i = sigma_thetat*(Laminar_Viscosity_i+Eddy_Viscosity_i);
REth_Viscosity_j = sigma_thetat*(Laminar_Viscosity_j+Eddy_Viscosity_j);
REth_Viscosity_Mean = 0.5*(REth_Viscosity_i+REth_Viscosity_j);

/*--- Compute vector going from iPoint to jPoint ---*/
dist_ij_2 = 0; proj_vector_ij = 0;
for (iDim = 0; iDim < nDim; iDim++) {
Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim];
dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim];
proj_vector_ij += Edge_Vector[iDim]*Normal[iDim];
}
proj_vector_ij = proj_vector_ij/dist_ij_2; // to normalize vectors

/*--- Mean gradient approximation ---*/
for (iVar = 0; iVar < nVar; iVar++) {
Proj_Mean_GradTransVar_Kappa[iVar] = 0.0;
// Proj_Mean_GradTransVar_Edge[iVar] = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {

/* -- Compute primitive grad using chain rule -- */
Density_Grad_i[iDim] = ConsVar_Grad_i[0][iDim];
Density_Grad_j[iDim] = ConsVar_Grad_j[0][iDim];
Conservative_Grad_i[iDim] = TransVar_Grad_i[iVar][iDim];
Conservative_Grad_j[iDim] = TransVar_Grad_j[iVar][iDim];
Primitive_Grad_i[iDim] = 1./Density_i*(Conservative_Grad_i[iDim]-TransVar_i[iVar]*Density_Grad_i[iDim]);
Primitive_Grad_j[iDim] = 1./Density_j*(Conservative_Grad_j[iDim]-TransVar_j[iVar]*Density_Grad_j[iDim]);

/*--- Compute the average primitive gradient and project it in the normal direction ---*/
Mean_GradTransVar[iVar][iDim] = 0.5*(Primitive_Grad_i[iDim] + Primitive_Grad_j[iDim]);
Proj_Mean_GradTransVar_Kappa[iVar] += Mean_GradTransVar[iVar][iDim]*Normal[iDim];
}
}

val_residual[0] = Inter_Viscosity_Mean*Proj_Mean_GradTransVar_Kappa[0];
val_residual[1] = REth_Viscosity_Mean*Proj_Mean_GradTransVar_Kappa[1];

/*--- For Jacobians -> Use of TSL approx. to compute derivatives of the gradients ---*/
if (implicit) {
Jacobian_i[0][0] = (0.5*Proj_Mean_GradTransVar_Kappa[0]-Inter_Viscosity_Mean*proj_vector_ij);
Jacobian_j[0][0] = (0.5*Proj_Mean_GradTransVar_Kappa[0]+Inter_Viscosity_Mean*proj_vector_ij);
Jacobian_i[1][1] = (0.5*Proj_Mean_GradTransVar_Kappa[1]-REth_Viscosity_Mean*proj_vector_ij);
Jacobian_j[1][1] = (0.5*Proj_Mean_GradTransVar_Kappa[1]+REth_Viscosity_Mean*proj_vector_ij);
}

/*--- Free locally allocated memory. For efficiency, these arrays
should really be allocated/deallocated in the constructor/destructor. ---*/
delete [] Density_Grad_i;
delete [] Density_Grad_j;
delete [] Conservative_Grad_i;
delete [] Conservative_Grad_j;
delete [] Primitive_Grad_i;
delete [] Primitive_Grad_j;

/*--- This section is commented out on 04/11/2016
after review of the static scan ---*/
// su2double *Density_Grad_i = new su2double[nDim];
// su2double *Density_Grad_j = new su2double[nDim];
// su2double *Conservative_Grad_i = new su2double[nDim];
// su2double *Conservative_Grad_j = new su2double[nDim];
// su2double *Primitive_Grad_i = new su2double[nDim];
// su2double *Primitive_Grad_j = new su2double[nDim];
//
// /*--- Intermediate values for combining viscosities ---*/
// su2double Inter_Viscosity_i, Inter_Viscosity_j, REth_Viscosity_i, REth_Viscosity_j, Inter_Viscosity_Mean, REth_Viscosity_Mean;
//
// /*--- Model constants---*/
// su2double sigmaf = 1.0;
// su2double sigma_thetat = 2.0;
//
// /*--- Get density ---*/
// Density_i = U_i[0];
// Density_j = U_j[0];
//
// /*--- Construct combinations of viscosity ---*/
// Inter_Viscosity_i = (Laminar_Viscosity_i+Eddy_Viscosity_i/sigmaf);
// Inter_Viscosity_j = (Laminar_Viscosity_j+Eddy_Viscosity_j/sigmaf);
// Inter_Viscosity_Mean = 0.5*(Inter_Viscosity_i+Inter_Viscosity_j);
// REth_Viscosity_i = sigma_thetat*(Laminar_Viscosity_i+Eddy_Viscosity_i);
// REth_Viscosity_j = sigma_thetat*(Laminar_Viscosity_j+Eddy_Viscosity_j);
// REth_Viscosity_Mean = 0.5*(REth_Viscosity_i+REth_Viscosity_j);
//
///*--- Compute vector going from iPoint to jPoint ---*/
//dist_ij_2 = 0; proj_vector_ij = 0;
//for (iDim = 0; iDim < nDim; iDim++) {
// Edge_Vector[iDim] = Coord_j[iDim]-Coord_i[iDim];
// dist_ij_2 += Edge_Vector[iDim]*Edge_Vector[iDim];
// proj_vector_ij += Edge_Vector[iDim]*Normal[iDim];
//}
//proj_vector_ij = proj_vector_ij/dist_ij_2; // to normalize vectors
//
///*--- Mean gradient approximation ---*/
//for (iVar = 0; iVar < nVar; iVar++) {
// Proj_Mean_GradTransVar_Kappa[iVar] = 0.0;
// // Proj_Mean_GradTransVar_Edge[iVar] = 0.0;
// for (iDim = 0; iDim < nDim; iDim++) {
//
// /* -- Compute primitive grad using chain rule -- */
// Density_Grad_i[iDim] = ConsVar_Grad_i[0][iDim];
// Density_Grad_j[iDim] = ConsVar_Grad_j[0][iDim];
// Conservative_Grad_i[iDim] = TransVar_Grad_i[iVar][iDim];
// Conservative_Grad_j[iDim] = TransVar_Grad_j[iVar][iDim];
// Primitive_Grad_i[iDim] = 1./Density_i*(Conservative_Grad_i[iDim]-TransVar_i[iVar]*Density_Grad_i[iDim]);
// Primitive_Grad_j[iDim] = 1./Density_j*(Conservative_Grad_j[iDim]-TransVar_j[iVar]*Density_Grad_j[iDim]);
//
// /*--- Compute the average primitive gradient and project it in the normal direction ---*/
// Mean_GradTransVar[iVar][iDim] = 0.5*(Primitive_Grad_i[iDim] + Primitive_Grad_j[iDim]);
// Proj_Mean_GradTransVar_Kappa[iVar] += Mean_GradTransVar[iVar][iDim]*Normal[iDim];
// }
//}
//
//val_residual[0] = Inter_Viscosity_Mean*Proj_Mean_GradTransVar_Kappa[0];
//val_residual[1] = REth_Viscosity_Mean*Proj_Mean_GradTransVar_Kappa[1];
//
///*--- For Jacobians -> Use of TSL approx. to compute derivatives of the gradients ---*/
//if (implicit) {
// Jacobian_i[0][0] = (0.5*Proj_Mean_GradTransVar_Kappa[0]-Inter_Viscosity_Mean*proj_vector_ij);
// Jacobian_j[0][0] = (0.5*Proj_Mean_GradTransVar_Kappa[0]+Inter_Viscosity_Mean*proj_vector_ij);
// Jacobian_i[1][1] = (0.5*Proj_Mean_GradTransVar_Kappa[1]-REth_Viscosity_Mean*proj_vector_ij);
// Jacobian_j[1][1] = (0.5*Proj_Mean_GradTransVar_Kappa[1]+REth_Viscosity_Mean*proj_vector_ij);
//}
//
// /*--- Free locally allocated memory. For efficiency, these arrays
// should really be allocated/deallocated in the constructor/destructor. ---*/
// delete [] Density_Grad_i;
// delete [] Density_Grad_j;
// delete [] Conservative_Grad_i;
// delete [] Conservative_Grad_j;
// delete [] Primitive_Grad_i;
// delete [] Primitive_Grad_j;
//
}

CAvgGradCorrected_TransLM::CAvgGradCorrected_TransLM(unsigned short val_nDim, unsigned short val_nVar,
Expand Down
Loading