Commit 9e7df55f authored by Gaurav Saxena's avatar Gaurav Saxena

Parallelized Code -- output is 'slightly' different than the serial version of...

Parallelized Code -- output is 'slightly' different than the serial version of the code. Remember decomposition is 1-D in Z direction. To check try with : 1 process to see if output is the same...then with 2 processes then with 4...
parent 2bb697ff
......@@ -115,7 +115,7 @@ Microenvironment::Microenvironment()
thomas_setup_done = false;
diffusion_solver_setup_done = false;
diffusion_decay_solver = empty_diffusion_solver;
//diffusion_decay_solver = empty_diffusion_solver; //-->Gaurav Saxena commented this out (I think it has no effect really)
diffusion_decay_solver = diffusion_decay_solver__constant_coefficients_LOD_3D;
//This line commented by Gaurav Saxena
......@@ -661,10 +661,10 @@ std::vector<double>& Microenvironment::density_vector( int i, int j )
std::vector<double>& Microenvironment::density_vector( int n )
{ return (*p_density_vectors)[ n ]; }
void Microenvironment::simulate_diffusion_decay( double dt )
void Microenvironment::simulate_diffusion_decay( double dt, int mpi_Size, int mpi_Rank, int *mpi_Coords, int *mpi_Dims, MPI_Comm mpi_Cart_comm )
{
if( diffusion_decay_solver )
{ diffusion_decay_solver( *this, dt ); }
{ diffusion_decay_solver( *this, dt, mpi_Size, mpi_Rank, mpi_Coords, mpi_Dims, mpi_Cart_comm ); }
else
{
std::cout << "Warning: diffusion-reaction-source/sink solver not set for Microenvironment object at " << this << ". Nothing happened!" << std::endl;
......@@ -677,7 +677,9 @@ void Microenvironment::simulate_diffusion_decay( double dt )
void Microenvironment::auto_choose_diffusion_decay_solver( void )
{
// set the safest choice
diffusion_decay_solver = diffusion_decay_solver__constant_coefficients_explicit;
//diffusion_decay_solver = diffusion_decay_solver__constant_coefficients_explicit; //-->Gaurav Saxena commented this out as this was causing compilation problems
//because diffusion_decay_solver is a function pointer to a parallel version of 3D solver with constant coefficients ---> later on when we implement 'explicit' solver
//we can uncomment this
std::cout << "Warning: auto-selection of diffusion-decay-source/sink solver not fully implemented!" << std::endl;
......
......@@ -153,7 +153,7 @@ class Microenvironment
Microenvironment();
Microenvironment(std::string name);
void (*diffusion_decay_solver)( Microenvironment&, double);
void (*diffusion_decay_solver)( Microenvironment&, double, int, int, int *, int *, MPI_Comm); //-->Gaurav Saxena changed prototype
void (*bulk_supply_rate_function)( Microenvironment* pMicroenvironment, int voxel_index, std::vector<double>* write_destination );
void (*bulk_supply_target_densities_function)( Microenvironment* pMicroenvironment, int voxel_index, std::vector<double>* write_destination );
void (*bulk_uptake_rate_function)( Microenvironment* pMicroenvironment, int voxel_index, std::vector<double>* write_destination );
......@@ -224,7 +224,7 @@ class Microenvironment
std::vector<double>& density_vector( int n );
/*! advance the diffusion-decay solver by dt time */
void simulate_diffusion_decay( double dt );
void simulate_diffusion_decay( double dt, int mpi_Size, int mpi_Rank, int *mpi_Coords, int *mpi_Dims, MPI_Comm mpi_Cart_comm );//-->Gaurav Saxena changed this prototype
/*! advance the source/sink solver by dt time */
void simulate_bulk_sources_and_sinks( double dt );
......@@ -248,7 +248,7 @@ class Microenvironment
friend void diffusion_decay_solver__constant_coefficients_explicit( Microenvironment& S, double dt );
friend void diffusion_decay_solver__constant_coefficients_explicit_uniform_mesh( Microenvironment& S, double dt );
friend void diffusion_decay_solver__constant_coefficients_LOD_3D( Microenvironment& S, double dt );
friend void diffusion_decay_solver__constant_coefficients_LOD_3D( Microenvironment& S, double dt, int mpi_Size, int mpi_Rank, int *mpi_Coords, int *mpi_Dims, MPI_Comm mpi_Cart_comm ); //-->Gaurav Saxena changed this prototype
friend void diffusion_decay_solver__constant_coefficients_LOD_2D( Microenvironment& S, double dt );
friend void diffusion_decay_explicit_uniform_rates( Microenvironment& M, double dt );
......@@ -270,7 +270,7 @@ extern void diffusion_decay_solver__variable_coefficients_explicit( Microenviron
extern void diffusion_decay_solver__variable_coefficients_explicit_uniform_mesh( Microenvironment& S, double dt );
extern void diffusion_decay_solver__constant_coefficients_LOD_3D( Microenvironment& S, double dt );
extern void diffusion_decay_solver__constant_coefficients_LOD_3D( Microenvironment& S, double dt, int mpi_Size, int mpi_Rank, int *mpi_Coords, int *mpi_Dims, int *mpi_Cart_comm ); //-->Gaurav Saxena changed this prototype
extern void diffusion_decay_solver__constant_coefficients_LOD_2D( Microenvironment& S, double dt );
extern void diffusion_decay_solver__variable_coefficients_LOD_3D( Microenvironment& S, double dt );
......
This diff is collapsed.
This diff is collapsed.
......@@ -55,9 +55,9 @@ namespace BioFVM{
// /*! diffusion-decay solvers for the equation du/dt = D*Laplacian(u) - lambda*u - U(x)*u + M(X)*(uT-u) */
// /*! diffusion-decay solver: 3D LOD implicit (stable method). D and r uniform */
void diffusion_decay_solver__constant_coefficients_LOD_3D( Microenvironment& M, double dt ); // done
void diffusion_decay_solver__constant_coefficients_LOD_3D( Microenvironment& M, double dt, int mpi_Size, int mpi_Rank, int *mpi_Coords, int *mpi_Dims, MPI_Comm mpi_Cart_comm );//-->Gaurav Saxena changed this prototype // done
// /*! diffusion-decay solver: 2D LOD implicit (stable method). D and r uniform */
void diffusion_decay_solver__constant_coefficients_LOD_2D( Microenvironment& M, double dt ); // done
void diffusion_decay_solver__constant_coefficients_LOD_2D( Microenvironment& M, double dt, int mpi_Size, int mpi_Rank, int *mpi_Coords, int *mpi_Dims, MPI_Comm mpi_Cart_comm );//-->Gaurav Saxena changed this function prototype to avoid compilation problems (not yet implemented parallel version) // done
/*! This solves for constant diffusion coefficients on a general mesh using the
explicit stepping for the diffusion operator, and implicit stepping for all
......@@ -70,4 +70,4 @@ void diffusion_decay_solver__constant_coefficients_explicit( Microenvironment& M
void diffusion_decay_solver__constant_coefficients_explicit_uniform_mesh( Microenvironment& M, double dt );
};
#endif
\ No newline at end of file
#endif
No preview for this file type
......@@ -446,13 +446,14 @@ int main( int argc, char* argv[] )
/*------------------------------------------------------------*/
/* MPI Comm Size and Rank */
/* Right now it should be 1-D Z decomposition */
/*------------------------------------------------------------*/
mpi_Dims[0] = 0;
mpi_Dims[1] = 0;
mpi_Dims[2] = 0;
MPI_Dims_create(mpi_Size,3,mpi_Dims);
mpi_Dims[0] = 1;
mpi_Dims[1] = 1;
mpi_Dims[2] = 4;
//MPI_Dims_create(mpi_Size,3,mpi_Dims);
mpi_Is_periodic[0]=0;
mpi_Is_periodic[1]=0;
......@@ -498,7 +499,7 @@ int main( int argc, char* argv[] )
/* Resize local Microenvironment on each process */
/*------------------------------------------------------------*/
microenvironment.resize_space_uniform( minX,maxX,minY,maxY,minZ,maxZ, mesh_resolution,mpi_Dims, mpi_Coords);
microenvironment.resize_space_uniform( minX,maxX,minY,maxY,minZ,maxZ, mesh_resolution, mpi_Dims, mpi_Coords);
microenvironment.display_information( std::cout );
......@@ -564,7 +565,7 @@ int main( int argc, char* argv[] )
(*temp_point_sink->uptake_rates)[0]=0.8;
temp_point_sink->set_internal_uptake_constants(dt);
}
*/
double t = 0.0;
double t_max=5;
......@@ -572,12 +573,12 @@ int main( int argc, char* argv[] )
while( t < t_max )
{
microenvironment.simulate_cell_sources_and_sinks( dt );
microenvironment.simulate_diffusion_decay( dt );
microenvironment.simulate_diffusion_decay( dt, mpi_Size, mpi_Rank, mpi_Coords, mpi_Dims, mpi_Cart_comm );
t += dt;
}
microenvironment.write_to_matlab( "final.mat" );
microenvironment.write_to_matlab( "final.mat", mpi_Rank, mpi_Size, mpi_Cart_comm ); //Remember to use Parallel Version !
std::cout<<"done!"<<std::endl;
*/
/*-------------------------------------------------------------------------*/
/* MPI Finalize */
......
File added
This diff is collapsed.
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=8
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=1
#SBATCH -t 00:05:00
#SBATCH -o output-%j
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment