code clean up
This commit is contained in:
parent
2ed34592d0
commit
7cdc358af2
@ -1,81 +1,70 @@
|
|||||||
|
#include <exception>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <iostream>
|
|
||||||
#include <exception>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "models/FreeLeeModel.h"
|
|
||||||
#include "common/Utilities.h"
|
#include "common/Utilities.h"
|
||||||
|
#include "models/FreeLeeModel.h"
|
||||||
|
|
||||||
//#define WRE_SURFACES
|
//*******************************************************************
|
||||||
|
// Implementation of Free-Energy Two-Phase LBM (Lee model)
|
||||||
|
//*******************************************************************
|
||||||
|
|
||||||
/*
|
int main( int argc, char **argv )
|
||||||
* Simulator for two-phase flow in porous media
|
|
||||||
* James E. McClure 2013-2014
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//*************************************************************************
|
|
||||||
// Implementation of Two-Phase Immiscible LBM using CUDA
|
|
||||||
//*************************************************************************
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// Initialize MPI
|
// Initialize
|
||||||
Utilities::startup( argc, argv );
|
Utilities::startup( argc, argv );
|
||||||
Utilities::MPI comm( MPI_COMM_WORLD );
|
|
||||||
int rank = comm.getRank();
|
|
||||||
int nprocs = comm.getSize();
|
|
||||||
|
|
||||||
// Load the input database
|
// Load the input database
|
||||||
auto db = std::make_shared<Database>( argv[1] );
|
auto db = std::make_shared<Database>( argv[1] );
|
||||||
|
|
||||||
// Initialize MPI and error handlers
|
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||||
auto multiple = db->getWithDefault<bool>( "MPI_THREAD_MULTIPLE", true );
|
|
||||||
//Utilities::startup( argc, argv, multiple );
|
|
||||||
//Utilities::MPI::changeProfileLevel( 1 );
|
|
||||||
|
|
||||||
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
|
Utilities::MPI comm( MPI_COMM_WORLD );
|
||||||
|
int rank = comm.getRank();
|
||||||
|
int nprocs = comm.getSize();
|
||||||
|
|
||||||
if (rank == 0){
|
if (rank == 0){
|
||||||
printf("********************************************************\n");
|
printf("********************************************************\n");
|
||||||
printf("Running Free Energy Lee LBM \n");
|
printf("Running Free Energy Lee LBM \n");
|
||||||
printf("********************************************************\n");
|
printf("********************************************************\n");
|
||||||
}
|
}
|
||||||
// Initialize compute device
|
// Initialize compute device
|
||||||
int device=ScaLBL_SetDevice(rank);
|
int device=ScaLBL_SetDevice(rank);
|
||||||
NULL_USE( device );
|
NULL_USE( device );
|
||||||
ScaLBL_DeviceBarrier();
|
ScaLBL_DeviceBarrier();
|
||||||
comm.barrier();
|
comm.barrier();
|
||||||
|
|
||||||
PROFILE_ENABLE(1);
|
PROFILE_ENABLE(1);
|
||||||
//PROFILE_ENABLE_TRACE();
|
//PROFILE_ENABLE_TRACE();
|
||||||
//PROFILE_ENABLE_MEMORY();
|
//PROFILE_ENABLE_MEMORY();
|
||||||
PROFILE_SYNCHRONIZE();
|
PROFILE_SYNCHRONIZE();
|
||||||
PROFILE_START("Main");
|
PROFILE_START("Main");
|
||||||
Utilities::setErrorHandlers();
|
Utilities::setErrorHandlers();
|
||||||
|
|
||||||
auto filename = argv[1];
|
auto filename = argv[1];
|
||||||
ScaLBL_FreeLeeModel LeeModel(rank,nprocs,comm);
|
ScaLBL_FreeLeeModel LeeModel( rank,nprocs,comm );
|
||||||
LeeModel.ReadParams(filename);
|
LeeModel.ReadParams( filename );
|
||||||
LeeModel.SetDomain();
|
LeeModel.SetDomain();
|
||||||
LeeModel.ReadInput();
|
LeeModel.ReadInput();
|
||||||
LeeModel.Create(); // creating the model will create data structure to match the pore structure and allocate variables
|
LeeModel.Create();
|
||||||
LeeModel.Initialize(); // initializing the model will set initial conditions for variables
|
LeeModel.Initialize();
|
||||||
LeeModel.Run();
|
LeeModel.Run();
|
||||||
LeeModel.WriteDebug();
|
LeeModel.WriteDebug();
|
||||||
|
|
||||||
PROFILE_STOP("Main");
|
PROFILE_STOP("Main");
|
||||||
auto file = db->getWithDefault<std::string>( "TimerFile", "lbpm_freelee_simulator" );
|
auto file = db->getWithDefault<std::string>( "TimerFile", "lbpm_freelee_simulator" );
|
||||||
auto level = db->getWithDefault<int>( "TimerLevel", 1 );
|
auto level = db->getWithDefault<int>( "TimerLevel", 1 );
|
||||||
PROFILE_SAVE(file,level);
|
PROFILE_SAVE( file,level );
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
|
|
||||||
|
|
||||||
} // Limit scope so variables that contain communicators will free before MPI_Finialize
|
} // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||||
|
|
||||||
Utilities::shutdown();
|
Utilities::shutdown();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user