added tolerance to MRT

This commit is contained in:
James McClure 2019-05-09 01:01:15 +02:00
parent 9136b9fc20
commit 52995e2b8a
2 changed files with 16 additions and 1 deletions

View File

@ -21,10 +21,19 @@ void ScaLBL_MRTModel::ReadParams(string filename){
domain_db = db->getDatabase( "Domain" );
mrt_db = db->getDatabase( "MRT" );
tau = 1.0;
timestepMax = 100000;
tolerance = 0.01;
Fx = Fy = 0.0;
Fz = 1.0e-5;
// Color Model parameters
if (mrt_db->keyExists( "timestepMax" )){
timestepMax = mrt_db->getScalar<int>( "timestepMax" );
}
if (mrt_db->keyExists( "tolerance" )){
tolerance = mrt_db->getScalar<int>( "timestepMax" );
}
if (mrt_db->keyExists( "tau" )){
tau = mrt_db->getScalar<double>( "tau" );
}
@ -197,7 +206,9 @@ void ScaLBL_MRTModel::Run(){
if (rank==0) printf("Beginning AA timesteps...\n");
if (rank==0) printf("********************************************************\n");
timestep=0;
while (timestep < timestepMax) {
double error = 1.0;
double flow_rate_previous = 0.0;
while (timestep < timestepMax || error < tolerance) {
//************************************************************************/
timestep++;
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
@ -259,6 +270,9 @@ void ScaLBL_MRTModel::Run(){
}
double flow_rate = (vax*dir_x + vay*dir_y + vaz*dir_z);
error = fabs(flow_rate - flow_rate_previous) / flow_rate;
flow_rate_previous = flow_rate;
//if (rank==0) printf("Computing Minkowski functionals \n");
Morphology.ComputeScalar(Distance,0.f);
//Morphology.PrintAll();

View File

@ -36,6 +36,7 @@ public:
double tau,mu;
double Fx,Fy,Fz,flux;
double din,dout;
double tolerance;
int Nx,Ny,Nz,N,Np;
int rank,nprocx,nprocy,nprocz,nprocs;