2019-11-20 12:20:11 -06:00
|
|
|
/*
|
2020-05-07 13:24:04 -05:00
|
|
|
Copyright 2020 Equinor ASA
|
2020-10-12 05:08:29 -05:00
|
|
|
Copyright Equnior ASA
|
2020-05-07 13:24:04 -05:00
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
greyscale lattice boltzmann model
|
2019-11-20 12:20:11 -06:00
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <exception>
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include "common/Communication.h"
|
2021-01-06 10:58:43 -06:00
|
|
|
#include "common/MPI.h"
|
2019-11-20 12:20:11 -06:00
|
|
|
#include "common/Database.h"
|
|
|
|
#include "common/ScaLBL.h"
|
|
|
|
#include "ProfilerApp.h"
|
|
|
|
#include "threadpool/thread_pool.h"
|
|
|
|
|
2021-11-08 15:58:37 -06:00
|
|
|
class ScaLBL_GreyscaleModel {
|
2019-11-20 12:20:11 -06:00
|
|
|
public:
|
2021-11-08 15:58:37 -06:00
|
|
|
ScaLBL_GreyscaleModel(int RANK, int NP, const Utilities::MPI &COMM);
|
|
|
|
~ScaLBL_GreyscaleModel();
|
|
|
|
|
|
|
|
// functions in they should be run
|
|
|
|
void ReadParams(string filename);
|
|
|
|
void ReadParams(std::shared_ptr<Database> db0);
|
|
|
|
void SetDomain();
|
|
|
|
void ReadInput();
|
|
|
|
void Create();
|
|
|
|
void Initialize();
|
|
|
|
void Run();
|
|
|
|
void WriteDebug();
|
|
|
|
void VelocityField();
|
|
|
|
|
|
|
|
bool Restart, pBC;
|
|
|
|
int timestep, timestepMax;
|
|
|
|
int BoundaryCondition;
|
2020-01-31 14:15:26 -06:00
|
|
|
int CollisionType;
|
2021-11-08 15:58:37 -06:00
|
|
|
double tau;
|
2020-02-01 13:04:39 -06:00
|
|
|
double tau_eff;
|
2021-11-08 15:58:37 -06:00
|
|
|
double Den; //constant density
|
|
|
|
double tolerance;
|
|
|
|
double Fx, Fy, Fz, flux;
|
|
|
|
double din, dout;
|
|
|
|
double dp; //solid particle diameter, unit in voxel
|
2020-01-20 18:29:03 -06:00
|
|
|
double GreyPorosity;
|
2019-11-20 12:20:11 -06:00
|
|
|
|
2021-11-08 15:58:37 -06:00
|
|
|
int Nx, Ny, Nz, N, Np;
|
|
|
|
int rank, nprocx, nprocy, nprocz, nprocs;
|
|
|
|
double Lx, Ly, Lz;
|
|
|
|
|
|
|
|
std::shared_ptr<Domain> Dm; // this domain is for analysis
|
|
|
|
std::shared_ptr<Domain> Mask; // this domain is for lbm
|
|
|
|
std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm;
|
|
|
|
|
2019-11-20 12:20:11 -06:00
|
|
|
// input database
|
|
|
|
std::shared_ptr<Database> db;
|
|
|
|
std::shared_ptr<Database> domain_db;
|
|
|
|
std::shared_ptr<Database> greyscale_db;
|
|
|
|
std::shared_ptr<Database> analysis_db;
|
|
|
|
std::shared_ptr<Database> vis_db;
|
|
|
|
|
2021-11-08 15:58:37 -06:00
|
|
|
signed char *id;
|
|
|
|
int *NeighborList;
|
|
|
|
double *fq;
|
|
|
|
double *Permeability; //grey voxel permeability
|
|
|
|
double *Porosity;
|
|
|
|
double *Velocity;
|
|
|
|
double *Pressure_dvc;
|
2019-11-21 12:43:32 -06:00
|
|
|
IntArray Map;
|
|
|
|
DoubleArray SignDist;
|
|
|
|
DoubleArray Velocity_x;
|
|
|
|
DoubleArray Velocity_y;
|
|
|
|
DoubleArray Velocity_z;
|
2020-01-21 22:24:10 -06:00
|
|
|
DoubleArray PorosityMap;
|
2020-01-29 22:49:36 -06:00
|
|
|
DoubleArray Pressure;
|
2021-11-08 15:58:37 -06:00
|
|
|
|
2019-11-20 12:20:11 -06:00
|
|
|
private:
|
2021-11-08 15:58:37 -06:00
|
|
|
Utilities::MPI comm;
|
|
|
|
|
2023-05-28 10:59:10 -05:00
|
|
|
size_t dist_mem_size;
|
|
|
|
size_t neighborSize;
|
2021-11-08 15:58:37 -06:00
|
|
|
// filenames
|
2019-11-20 12:20:11 -06:00
|
|
|
char LocalRankString[8];
|
|
|
|
char LocalRankFilename[40];
|
|
|
|
char LocalRestartFile[40];
|
2021-11-08 15:58:37 -06:00
|
|
|
|
2019-11-20 12:20:11 -06:00
|
|
|
void AssignComponentLabels(double *Porosity, double *Permeablity);
|
2021-11-08 15:58:37 -06:00
|
|
|
void AssignComponentLabels(double *Porosity, double *Permeability,
|
|
|
|
const vector<std::string> &File_poro,
|
|
|
|
const vector<std::string> &File_perm);
|
2019-11-20 12:20:11 -06:00
|
|
|
};
|