Files
LBPM/models/ColorModel.h

99 lines
2.4 KiB
C
Raw Normal View History

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"
2021-09-04 11:25:39 -04:00
#include "analysis/FlowAdaptor.h"
2018-05-16 14:40:38 -04:00
#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;
2021-06-14 16:33:24 -04:00
void AssignComponentLabels(double *phase);
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);
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
};
#endif
2021-02-11 14:31:29 -05:00