Files
LBPM/models/ColorModel.h

127 lines
3.4 KiB
C
Raw Normal View History

2018-06-11 15:19:05 -04:00
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
2020-10-12 06:08:29 -04:00
Copyright Equnior ASA
2018-06-11 15:19:05 -04: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/>.
*/
2018-05-16 14:40:38 -04:00
/*
Implementation of color lattice boltzmann model
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <iostream>
#include <exception>
#include <stdexcept>
#include <fstream>
#include "common/Communication.h"
#include "analysis/TwoPhase.h"
#include "analysis/runAnalysis.h"
2021-01-04 23:48:21 -05:00
#include "common/MPI.h"
2018-05-16 14:40:38 -04:00
#include "ProfilerApp.h"
#include "threadpool/thread_pool.h"
#ifndef ScaLBL_ColorModel_INC
#define ScaLBL_ColorModel_INC
2018-05-16 14:40:38 -04:00
class ScaLBL_ColorModel{
public:
2021-01-05 15:50:07 -05:00
ScaLBL_ColorModel(int RANK, int NP, const Utilities::MPI& COMM);
2018-05-16 14:46:11 -04:00
~ScaLBL_ColorModel();
2018-05-16 14:40:38 -04:00
// functions in they should be run
2018-05-16 15:08:47 -04:00
void ReadParams(string filename);
2018-05-17 10:34:36 -04:00
void ReadParams(std::shared_ptr<Database> db0);
2018-05-19 17:28:39 -04:00
void SetDomain();
2018-05-16 14:40:38 -04:00
void ReadInput();
void Create();
void Initialize();
void Run();
double Run(int returntime);
2018-05-18 17:24:17 -04:00
void WriteDebug();
2021-02-11 14:31:29 -05:00
void getPhaseField(DoubleArray &f);
2018-05-16 14:40:38 -04:00
2018-05-16 15:08:47 -04:00
bool Restart,pBC;
bool REVERSE_FLOW_DIRECTION;
2018-05-16 14:40:38 -04:00
int timestep,timestepMax;
2018-05-16 15:08:47 -04:00
int BoundaryCondition;
2018-05-16 14:40:38 -04:00
double tauA,tauB,rhoA,rhoB,alpha,beta;
double Fx,Fy,Fz,flux;
double din,dout,inletA,inletB,outletA,outletB;
int Nx,Ny,Nz,N,Np;
2018-05-18 17:24:17 -04:00
int rank,nprocx,nprocy,nprocz,nprocs;
2018-05-16 14:40:38 -04:00
double Lx,Ly,Lz;
2018-05-16 15:15:01 -04:00
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;
2018-07-02 13:32:25 -04:00
std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm_Regular;
2019-03-19 16:36:02 -04:00
//std::shared_ptr<TwoPhase> Averages;
std::shared_ptr<SubPhase> Averages;
2018-05-17 09:55:28 -04:00
// input database
std::shared_ptr<Database> db;
std::shared_ptr<Database> domain_db;
std::shared_ptr<Database> color_db;
std::shared_ptr<Database> analysis_db;
2019-09-11 16:15:36 -04:00
std::shared_ptr<Database> vis_db;
2018-05-16 14:40:38 -04:00
IntArray Map;
2019-03-29 06:46:48 -04:00
signed char *id;
2018-07-02 13:32:25 -04:00
int *NeighborList;
int *dvcMap;
double *fq, *Aq, *Bq;
double *Den, *Phi;
double *ColorGrad;
double *Velocity;
double *Pressure;
private:
2021-01-05 00:04:59 -05:00
Utilities::MPI comm;
2018-06-13 10:09:55 -04:00
int dist_mem_size;
int neighborSize;
// filenames
char LocalRankString[8];
char LocalRankFilename[40];
char LocalRestartFile[40];
2018-05-16 15:08:47 -04:00
//int rank,nprocs;
2018-05-17 10:34:36 -04:00
void LoadParams(std::shared_ptr<Database> db0);
2018-05-19 17:28:39 -04:00
void AssignComponentLabels(double *phase);
double ImageInit(std::string filename);
double MorphInit(const double beta, const double morph_delta);
double SeedPhaseField(const double seed_water_in_oil);
2019-05-01 16:32:51 -04:00
double MorphOpenConnected(double target_volume_change);
2018-05-16 14:40:38 -04:00
};
2021-02-11 14:31:29 -05:00
class FlowAdaptor{
public:
FlowAdaptor(ScaLBL_ColorModel &M);
~FlowAdaptor();
double MoveInterface(ScaLBL_ColorModel &M);
double UpdateFractionalFlow(ScaLBL_ColorModel &M);
void Flatten(ScaLBL_ColorModel &M);
2021-02-11 14:31:29 -05:00
DoubleArray phi;
DoubleArray phi_t;
private:
int Nx, Ny, Nz;
int timestep;
int timestep_previous;
};
#endif
2021-02-11 14:31:29 -05:00