done cleaning up the code
This commit is contained in:
parent
d8a1837ba0
commit
d24198e76a
@ -596,13 +596,13 @@ void ScaLBL_GreyscaleColorModel::AssignGreyPoroPermLabels()
|
||||
|
||||
if (rank==0){
|
||||
printf("Image resolution: %.5g [um/voxel]\n",Dm->voxel_length);
|
||||
printf("Number of component labels: %lu \n",NLABELS);
|
||||
printf("Number of Grey-fluid labels: %lu \n",NLABELS);
|
||||
for (unsigned int idx=0; idx<NLABELS; idx++){
|
||||
VALUE=LabelList[idx];
|
||||
POROSITY=PorosityList[idx];
|
||||
PERMEABILITY=PermeabilityList[idx];
|
||||
double volume_fraction = double(label_count_global[idx])/double((Nx-2)*(Ny-2)*(Nz-2)*nprocs);
|
||||
printf(" label=%d: porosity=%.3g, permeability=%.3g [um^2] (=%.3g [voxel^2]), volume fraction=%.3g\n",
|
||||
printf(" grey-fluid label=%d, porosity=%.3g, permeability=%.3g [um^2] (=%.3g [voxel^2]), volume fraction=%.3g\n",
|
||||
VALUE,POROSITY,PERMEABILITY,PERMEABILITY/Dm->voxel_length/Dm->voxel_length,volume_fraction);
|
||||
printf(" effective porosity=%.3g\n",volume_fraction*POROSITY);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ void ScaLBL_GreyscaleModel::AssignComponentLabels(double *Porosity, double *Perm
|
||||
|
||||
if (rank==0){
|
||||
printf("Image resolution: %.5g [um/voxel]\n",Dm->voxel_length);
|
||||
printf("Component labels: %lu \n",NLABELS);
|
||||
printf("Number of component labels: %lu \n",NLABELS);
|
||||
for (unsigned int idx=0; idx<NLABELS; idx++){
|
||||
VALUE=LabelList[idx];
|
||||
POROSITY=PorosityList[idx];
|
||||
|
@ -6,30 +6,29 @@
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
|
||||
#include "common/ScaLBL.h"
|
||||
#include "common/Communication.h"
|
||||
#include "common/MPI.h"
|
||||
#include "models/GreyscaleColorModel.h"
|
||||
#include "common/Utilities.h"
|
||||
//#define WRITE_SURFACES
|
||||
|
||||
//*************************************************************************
|
||||
// Implementation of Greyscale Two-Fluid Color LBM using CUDA
|
||||
//*************************************************************************
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//*****************************************
|
||||
// ***** MPI STUFF ****************
|
||||
//*****************************************
|
||||
// Initialize MPI
|
||||
int rank,nprocs;
|
||||
MPI_Init(&argc,&argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
MPI_Comm_rank(comm,&rank);
|
||||
MPI_Comm_size(comm,&nprocs);
|
||||
{
|
||||
// parallel domain size (# of sub-domains)
|
||||
int nprocx,nprocy,nprocz;
|
||||
int iproc,jproc,kproc;
|
||||
|
||||
// Initialize MPI and error handlers
|
||||
Utilities::startup( argc, argv );
|
||||
|
||||
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||
|
||||
MPI_Comm comm;
|
||||
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
|
||||
int rank = comm_rank(comm);
|
||||
int nprocs = comm_size(comm);
|
||||
|
||||
if (rank == 0){
|
||||
printf("****************************************\n");
|
||||
@ -37,22 +36,36 @@ int main(int argc, char **argv)
|
||||
printf("****************************************\n");
|
||||
}
|
||||
// Initialize compute device
|
||||
int device=ScaLBL_SetDevice(rank);
|
||||
ScaLBL_SetDevice(rank);
|
||||
ScaLBL_DeviceBarrier();
|
||||
MPI_Barrier(comm);
|
||||
|
||||
ScaLBL_GreyscaleColorModel GreyscaleColor(rank,nprocs,comm);
|
||||
PROFILE_ENABLE(1);
|
||||
//PROFILE_ENABLE_TRACE();
|
||||
//PROFILE_ENABLE_MEMORY();
|
||||
PROFILE_SYNCHRONIZE();
|
||||
PROFILE_START("Main");
|
||||
Utilities::setErrorHandlers();
|
||||
|
||||
auto filename = argv[1];
|
||||
ScaLBL_GreyscaleColorModel GreyscaleColor(rank,nprocs,comm);
|
||||
GreyscaleColor.ReadParams(filename);
|
||||
GreyscaleColor.SetDomain(); // this reads in the domain
|
||||
GreyscaleColor.SetDomain();
|
||||
GreyscaleColor.ReadInput();
|
||||
GreyscaleColor.Create(); // creating the model will create data structure to match the pore structure and allocate variables
|
||||
GreyscaleColor.Initialize(); // initializing the model will set initial conditions for variables
|
||||
GreyscaleColor.Run();
|
||||
GreyscaleColor.WriteDebug();
|
||||
}
|
||||
|
||||
PROFILE_STOP("Main");
|
||||
PROFILE_SAVE("lbpm_greyscaleColor_simulator",1);
|
||||
// ****************************************************
|
||||
|
||||
MPI_Barrier(comm);
|
||||
MPI_Finalize();
|
||||
// ****************************************************
|
||||
MPI_Comm_free(&comm);
|
||||
|
||||
} // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||
|
||||
Utilities::shutdown();
|
||||
|
||||
}
|
||||
|
@ -6,33 +6,29 @@
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
|
||||
#include "common/ScaLBL.h"
|
||||
#include "common/Communication.h"
|
||||
#include "common/MPI_Helpers.h"
|
||||
#include "models/GreyscaleModel.h"
|
||||
#include "common/Utilities.h"
|
||||
//#define WRITE_SURFACES
|
||||
|
||||
/*
|
||||
* Simulator for two-phase flow in porous media
|
||||
* James E. McClure 2013-2014
|
||||
*/
|
||||
//****************************************************************
|
||||
// Implementation of Greyscale Single-Fluid LBM using CUDA
|
||||
//****************************************************************
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//*****************************************
|
||||
// ***** MPI STUFF ****************
|
||||
//*****************************************
|
||||
// Initialize MPI
|
||||
int rank,nprocs;
|
||||
MPI_Init(&argc,&argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
MPI_Comm_rank(comm,&rank);
|
||||
MPI_Comm_size(comm,&nprocs);
|
||||
{
|
||||
// parallel domain size (# of sub-domains)
|
||||
|
||||
// Initialize MPI and error handlers
|
||||
Utilities::startup( argc, argv );
|
||||
|
||||
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||
|
||||
MPI_Comm comm;
|
||||
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
|
||||
int rank = comm_rank(comm);
|
||||
int nprocs = comm_size(comm);
|
||||
|
||||
if (rank == 0){
|
||||
printf("********************************************************\n");
|
||||
@ -40,24 +36,37 @@ int main(int argc, char **argv)
|
||||
printf("********************************************************\n");
|
||||
}
|
||||
// Initialize compute device
|
||||
int device=ScaLBL_SetDevice(rank);
|
||||
NULL_USE(device);
|
||||
ScaLBL_SetDevice(rank);
|
||||
ScaLBL_DeviceBarrier();
|
||||
MPI_Barrier(comm);
|
||||
|
||||
ScaLBL_GreyscaleModel Greyscale(rank,nprocs,comm);
|
||||
PROFILE_ENABLE(1);
|
||||
//PROFILE_ENABLE_TRACE();
|
||||
//PROFILE_ENABLE_MEMORY();
|
||||
PROFILE_SYNCHRONIZE();
|
||||
PROFILE_START("Main");
|
||||
Utilities::setErrorHandlers();
|
||||
|
||||
auto filename = argv[1];
|
||||
ScaLBL_GreyscaleModel Greyscale(rank,nprocs,comm);
|
||||
Greyscale.ReadParams(filename);
|
||||
Greyscale.SetDomain(); // this reads in the domain
|
||||
Greyscale.SetDomain();
|
||||
Greyscale.ReadInput();
|
||||
Greyscale.Create(); // creating the model will create data structure to match the pore structure and allocate variables
|
||||
Greyscale.Initialize(); // initializing the model will set initial conditions for variables
|
||||
Greyscale.Run();
|
||||
Greyscale.VelocityField();
|
||||
//Greyscale.WriteDebug();
|
||||
}
|
||||
|
||||
PROFILE_STOP("Main");
|
||||
PROFILE_SAVE("lbpm_greyscale_simulator",1);
|
||||
// ****************************************************
|
||||
|
||||
MPI_Barrier(comm);
|
||||
MPI_Finalize();
|
||||
// ****************************************************
|
||||
MPI_Comm_free(&comm);
|
||||
|
||||
} // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||
|
||||
Utilities::shutdown();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user