Loading src/ComputationalDomain.cpp +14 −13 Original line number Diff line number Diff line #include "ComputationalDomain.hpp" #include "ParallelTopology.hpp" using namespace std; Loading Loading @@ -146,7 +147,7 @@ void ComputationalDomain::readGlobalGrid(string external_mesh_file) { }; void ComputationalDomain::adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position) { void ComputationalDomain::adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position, DistributedArray &x_field, DistributedArray &y_field, DistributedArray &z_field, ParallelTopology *topo) { /// Copy original position double original_x_position = x_position; Loading @@ -158,13 +159,13 @@ void ComputationalDomain::adjustLocationToClosestGridPoint(double & x_position, /// All points: locate closest grid point double x, y, z, distance; for( int i = 0; i < (gNx + 2); i++ ) { for( int j = 0; j < (gNy + 2); j++ ) { for( int k = 0; k < (gNz + 2); k++ ) { for(int i = topo->iter_common[_INNER_][_INIX_]; i <= topo->iter_common[_INNER_][_ENDX_]; i++) { for(int j = topo->iter_common[_INNER_][_INIY_]; j <= topo->iter_common[_INNER_][_ENDY_]; j++) { for(int k = topo->iter_common[_INNER_][_INIZ_]; k <= topo->iter_common[_INNER_][_ENDZ_]; k++) { /// Geometric stuff x = globx[i]; y = globy[j]; z = globz[k]; x = x_field[I1D(i,j,k)]; y = y_field[I1D(i,j,k)]; z = z_field[I1D(i,j,k)]; /// Distance distance = pow( pow( x - original_x_position, 2.0 ) + pow( y - original_y_position, 2.0 ) + pow( z - original_z_position, 2.0 ), 1.0/2.0 ); /// If minimum distance, update information Loading @@ -189,9 +190,9 @@ void ComputationalDomain::calculateLocalGrid(int lNx, int lNy, int lNz) { y = new double[lNy]; z = new double[lNz]; Nx=lNx; Ny=lNy; Nz=lNz; _lNx_=lNx; _lNy_=lNy; _lNz_=lNz; } Loading @@ -214,17 +215,17 @@ void ComputationalDomain::printDomain() cout<<endl; cout<<"Local x: "<<endl; for(int i=0;i<Nx;i++) for(int i=0;i<_lNx_;i++) cout<<i<<" : "<<x[i]<<" ; "; cout<<endl; cout<<"Local y: "<<endl; for(int i=0;i<Ny;i++) for(int i=0;i<_lNy_;i++) cout<<i<<" : "<<y[i]<<" ; "; cout<<endl; cout<<"Local z: "<<endl; for(int i=0;i<Nz;i++) for(int i=0;i<_lNz_;i++) cout<<i<<" : "<<z[i]<<" ; "; cout<<endl; Loading src/ComputationalDomain.hpp +8 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ #include <cmath> #include <limits> #include "MacroParameters.hpp" #include "DistributedArray.hpp" /// Forward declaration class ParallelTopology; class ComputationalDomain{ public: Loading @@ -30,7 +34,7 @@ class ComputationalDomain{ void calculateLocalGrid(int lNx,int lNy, int lNz); /// Adjust location to closest grid point void adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position); void adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position, DistributedArray &x_field, DistributedArray &y_field, DistributedArray &z_field, ParallelTopology *topo); //Local positions double *x; Loading @@ -45,9 +49,9 @@ class ComputationalDomain{ int gNz; //Local number of cells in each direction int Nx; int Ny; int Nz; int _lNx_; int _lNy_; int _lNz_; //Boundary conditions int bc[6]; Loading src/DistributedArray.cpp +1 −0 Original line number Diff line number Diff line #include "DistributedArray.hpp" #include "ParallelTopology.hpp" DistributedArray::DistributedArray(ParallelTopology* topo, char const* auxName) { size = topo->getSize(); Loading src/DistributedArray.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ #include <iostream> #include "MacroParameters.hpp" #include "ParallelTopology.hpp" /// Forward declaration class ParallelTopology; class DistributedArray{ public: Loading Loading @@ -35,6 +37,7 @@ class DistributedArray{ ParallelTopology* mydomain; char fieldName[30]; }; #endif Loading src/FlowSolverRHEA.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -319,7 +319,7 @@ FlowSolverRHEA::FlowSolverRHEA(const string name_configuration_file) : configura /// Adjust location of 2d data output slices to corresponding closest grid point for(int dos = 0; dos < number_two_dimensional_data_output_slices; ++dos) { mesh->adjustLocationToClosestGridPoint(dos_x_positions[dos], dos_y_positions[dos], dos_z_positions[dos]); mesh->adjustLocationToClosestGridPoint(dos_x_positions[dos], dos_y_positions[dos], dos_z_positions[dos], x_field, y_field, z_field, topo); } /// Construct (initialize) temporal point probes Loading Loading
src/ComputationalDomain.cpp +14 −13 Original line number Diff line number Diff line #include "ComputationalDomain.hpp" #include "ParallelTopology.hpp" using namespace std; Loading Loading @@ -146,7 +147,7 @@ void ComputationalDomain::readGlobalGrid(string external_mesh_file) { }; void ComputationalDomain::adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position) { void ComputationalDomain::adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position, DistributedArray &x_field, DistributedArray &y_field, DistributedArray &z_field, ParallelTopology *topo) { /// Copy original position double original_x_position = x_position; Loading @@ -158,13 +159,13 @@ void ComputationalDomain::adjustLocationToClosestGridPoint(double & x_position, /// All points: locate closest grid point double x, y, z, distance; for( int i = 0; i < (gNx + 2); i++ ) { for( int j = 0; j < (gNy + 2); j++ ) { for( int k = 0; k < (gNz + 2); k++ ) { for(int i = topo->iter_common[_INNER_][_INIX_]; i <= topo->iter_common[_INNER_][_ENDX_]; i++) { for(int j = topo->iter_common[_INNER_][_INIY_]; j <= topo->iter_common[_INNER_][_ENDY_]; j++) { for(int k = topo->iter_common[_INNER_][_INIZ_]; k <= topo->iter_common[_INNER_][_ENDZ_]; k++) { /// Geometric stuff x = globx[i]; y = globy[j]; z = globz[k]; x = x_field[I1D(i,j,k)]; y = y_field[I1D(i,j,k)]; z = z_field[I1D(i,j,k)]; /// Distance distance = pow( pow( x - original_x_position, 2.0 ) + pow( y - original_y_position, 2.0 ) + pow( z - original_z_position, 2.0 ), 1.0/2.0 ); /// If minimum distance, update information Loading @@ -189,9 +190,9 @@ void ComputationalDomain::calculateLocalGrid(int lNx, int lNy, int lNz) { y = new double[lNy]; z = new double[lNz]; Nx=lNx; Ny=lNy; Nz=lNz; _lNx_=lNx; _lNy_=lNy; _lNz_=lNz; } Loading @@ -214,17 +215,17 @@ void ComputationalDomain::printDomain() cout<<endl; cout<<"Local x: "<<endl; for(int i=0;i<Nx;i++) for(int i=0;i<_lNx_;i++) cout<<i<<" : "<<x[i]<<" ; "; cout<<endl; cout<<"Local y: "<<endl; for(int i=0;i<Ny;i++) for(int i=0;i<_lNy_;i++) cout<<i<<" : "<<y[i]<<" ; "; cout<<endl; cout<<"Local z: "<<endl; for(int i=0;i<Nz;i++) for(int i=0;i<_lNz_;i++) cout<<i<<" : "<<z[i]<<" ; "; cout<<endl; Loading
src/ComputationalDomain.hpp +8 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ #include <cmath> #include <limits> #include "MacroParameters.hpp" #include "DistributedArray.hpp" /// Forward declaration class ParallelTopology; class ComputationalDomain{ public: Loading @@ -30,7 +34,7 @@ class ComputationalDomain{ void calculateLocalGrid(int lNx,int lNy, int lNz); /// Adjust location to closest grid point void adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position); void adjustLocationToClosestGridPoint(double & x_position, double & y_position, double & z_position, DistributedArray &x_field, DistributedArray &y_field, DistributedArray &z_field, ParallelTopology *topo); //Local positions double *x; Loading @@ -45,9 +49,9 @@ class ComputationalDomain{ int gNz; //Local number of cells in each direction int Nx; int Ny; int Nz; int _lNx_; int _lNy_; int _lNz_; //Boundary conditions int bc[6]; Loading
src/DistributedArray.cpp +1 −0 Original line number Diff line number Diff line #include "DistributedArray.hpp" #include "ParallelTopology.hpp" DistributedArray::DistributedArray(ParallelTopology* topo, char const* auxName) { size = topo->getSize(); Loading
src/DistributedArray.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ #include <iostream> #include "MacroParameters.hpp" #include "ParallelTopology.hpp" /// Forward declaration class ParallelTopology; class DistributedArray{ public: Loading Loading @@ -35,6 +37,7 @@ class DistributedArray{ ParallelTopology* mydomain; char fieldName[30]; }; #endif Loading
src/FlowSolverRHEA.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -319,7 +319,7 @@ FlowSolverRHEA::FlowSolverRHEA(const string name_configuration_file) : configura /// Adjust location of 2d data output slices to corresponding closest grid point for(int dos = 0; dos < number_two_dimensional_data_output_slices; ++dos) { mesh->adjustLocationToClosestGridPoint(dos_x_positions[dos], dos_y_positions[dos], dos_z_positions[dos]); mesh->adjustLocationToClosestGridPoint(dos_x_positions[dos], dos_y_positions[dos], dos_z_positions[dos], x_field, y_field, z_field, topo); } /// Construct (initialize) temporal point probes Loading