Files
LBPM/tests/lbpm_dfh_simulator.cpp

67 lines
2.1 KiB
C++
Raw Normal View History

2018-04-23 13:17:10 -04:00
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <iostream>
#include <exception>
#include <stdexcept>
#include <fstream>
2018-07-02 13:32:25 -04:00
#include "models/DFHModel.h"
//#define WRE_SURFACES
2018-04-23 13:17:10 -04:00
/*
* Simulator for two-phase flow in porous media
2018-07-02 13:32:25 -04:00
* James E. McClure 2013-2014
2018-04-23 13:17:10 -04:00
*/
using namespace std;
//*************************************************************************
2018-07-02 13:32:25 -04:00
// Implementation of Two-Phase Immiscible LBM using CUDA
2018-04-23 13:17:10 -04:00
//*************************************************************************
2018-07-02 13:32:25 -04:00
2018-04-23 13:17:10 -04:00
int main(int argc, char **argv)
{
2018-07-02 13:32:25 -04:00
// Initialize MPI
2020-10-08 11:03:42 -04:00
Utilities::startup( argc, argv );
2020-01-28 08:51:32 -05:00
Utilities::MPI comm( MPI_COMM_WORLD );
int rank = comm.getRank();
int nprocs = comm.getSize();
2020-10-08 11:03:42 -04:00
auto thread_support = Utilities::MPI::queryThreadSupport();
if ( rank==0 && thread_support != Utilities::MPI::ThreadSupport::MULTIPLE )
2021-01-04 19:33:27 -05:00
std::cerr << "Warning: Failed to start MPI with necessary thread support, thread support will be disabled" << std::endl;
2018-07-02 13:32:25 -04:00
{ // Limit scope so variables that contain communicators will free before MPI_Finialize
if (rank == 0){
printf("********************************************************\n");
printf("Running Color LBM \n");
printf("********************************************************\n");
}
PROFILE_ENABLE(1);
//PROFILE_ENABLE_TRACE();
//PROFILE_ENABLE_MEMORY();
PROFILE_SYNCHRONIZE();
PROFILE_START("Main");
Utilities::setErrorHandlers();
auto filename = argv[1];
2020-03-17 21:44:45 -04:00
ScaLBL_DFHModel DFHModel(rank,nprocs,comm);
2018-07-02 13:32:25 -04:00
DFHModel.ReadParams(filename);
DFHModel.SetDomain();
DFHModel.ReadInput();
DFHModel.Create(); // creating the model will create data structure to match the pore structure and allocate variables
DFHModel.Initialize(); // initializing the model will set initial conditions for variables
DFHModel.Run();
DFHModel.WriteDebug();
PROFILE_STOP("Main");
PROFILE_SAVE("lbpm_color_simulator",1);
// ****************************************************
2021-01-05 18:43:44 -05:00
comm.barrier();
2018-07-02 13:32:25 -04:00
} // Limit scope so variables that contain communicators will free before MPI_Finialize
2020-10-08 11:03:42 -04:00
Utilities::shutdown();
2018-04-23 13:17:10 -04:00
}