2015-06-15 17:54:06 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <exception>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
2015-08-21 16:56:43 -04:00
|
|
|
#include "common/ScaLBL.h"
|
|
|
|
|
#include "common/Communication.h"
|
2018-02-10 20:13:57 -05:00
|
|
|
#include "analysis/TwoPhase.h"
|
2020-03-17 21:44:45 -04:00
|
|
|
#include "common/MPI_Helpers.h"
|
2018-07-29 07:59:23 -04:00
|
|
|
#include "models/MRTModel.h"
|
2015-06-15 17:54:06 -04:00
|
|
|
//#define WRITE_SURFACES
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Simulator for two-phase flow in porous media
|
|
|
|
|
* James E. McClure 2013-2014
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
|
{
|
|
|
|
|
// Initialize MPI
|
2020-03-17 21:44:45 -04:00
|
|
|
int rank,nprocs;
|
2015-06-15 17:54:06 -04:00
|
|
|
MPI_Init(&argc,&argv);
|
2020-03-17 21:44:45 -04:00
|
|
|
MPI_Comm comm = MPI_COMM_WORLD;
|
|
|
|
|
MPI_Comm_rank(comm,&rank);
|
|
|
|
|
MPI_Comm_size(comm,&nprocs);
|
2016-06-04 19:31:44 -04:00
|
|
|
{
|
2018-02-21 11:31:33 -05:00
|
|
|
if (rank == 0){
|
|
|
|
|
printf("********************************************************\n");
|
|
|
|
|
printf("Running Single Phase Permeability Calculation \n");
|
|
|
|
|
printf("********************************************************\n");
|
|
|
|
|
}
|
2019-04-23 16:23:47 -04:00
|
|
|
// Initialize compute device
|
|
|
|
|
int device=ScaLBL_SetDevice(rank);
|
2020-01-22 12:01:29 -05:00
|
|
|
NULL_USE( device );
|
2019-04-23 16:23:47 -04:00
|
|
|
ScaLBL_DeviceBarrier();
|
2020-03-17 21:44:45 -04:00
|
|
|
MPI_Barrier(comm);
|
2019-04-23 16:23:47 -04:00
|
|
|
|
2018-07-29 07:56:10 -04:00
|
|
|
ScaLBL_MRTModel MRT(rank,nprocs,comm);
|
|
|
|
|
auto filename = argv[1];
|
|
|
|
|
MRT.ReadParams(filename);
|
|
|
|
|
MRT.SetDomain(); // this reads in the domain
|
|
|
|
|
MRT.ReadInput();
|
|
|
|
|
MRT.Create(); // creating the model will create data structure to match the pore structure and allocate variables
|
|
|
|
|
MRT.Initialize(); // initializing the model will set initial conditions for variables
|
|
|
|
|
MRT.Run();
|
2018-08-27 11:40:29 -04:00
|
|
|
MRT.VelocityField();
|
2016-06-04 19:31:44 -04:00
|
|
|
}
|
2015-06-15 17:54:06 -04:00
|
|
|
// ****************************************************
|
2020-03-17 21:44:45 -04:00
|
|
|
MPI_Barrier(comm);
|
2015-06-15 17:54:06 -04:00
|
|
|
MPI_Finalize();
|
|
|
|
|
// ****************************************************
|
|
|
|
|
}
|