From 2357cd9dfa175d003b44f8d0036c75be3fbb2698 Mon Sep 17 00:00:00 2001 From: Rex Zhe Li Date: Mon, 13 Sep 2021 09:20:52 -0400 Subject: [PATCH] update options for tolerance_method --- models/PoissonSolver.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/models/PoissonSolver.cpp b/models/PoissonSolver.cpp index 7c2a9bec..37ee1e18 100644 --- a/models/PoissonSolver.cpp +++ b/models/PoissonSolver.cpp @@ -69,8 +69,8 @@ void ScaLBL_Poisson::ReadParams(string filename){ if (electric_db->keyExists( "tolerance" )){ tolerance = electric_db->getScalar( "tolerance" ); } - //'tolerance_method' can be {"sum","max"} - tolerance_method = electric_db->getWithDefault( "tolerance_method", "sum" ); + //'tolerance_method' can be {"MSE","MSE_max"} + tolerance_method = electric_db->getWithDefault( "tolerance_method", "MSE" ); if (electric_db->keyExists( "epsilonR" )){ epsilonR = electric_db->getScalar( "epsilonR" ); } @@ -124,10 +124,10 @@ void ScaLBL_Poisson::ReadParams(string filename){ if (rank==0) printf("LB-Poisson Solver: steady-state MaxTimeStep = %i; steady-state tolerance = %.3g \n", timestepMax,tolerance); if (rank==0) printf(" LB relaxation tau = %.5g \n", tau); if (rank==0) printf("***********************************************************************************\n"); - if (tolerance_method.compare("sum")==0){ + if (tolerance_method.compare("MSE")==0){ if (rank==0) printf("LB-Poisson Solver: Use averaged MSE to check solution convergence.\n"); } - else if (tolerance_method.compare("max")==0){ + else if (tolerance_method.compare("MSE_max")==0){ if (rank==0) printf("LB-Poisson Solver: Use maximum MSE to check solution convergence.\n"); } else{ @@ -575,7 +575,7 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, int timestep_from_Study){ ScaLBL_CopyToHost(Psi_previous.data(),Psi,sizeof(double)*Nx*Ny*Nz); } if (timestep%analysis_interval==0){ - if (tolerance_method.compare("sum")==0){ + if (tolerance_method.compare("MSE")==0){ double count_loc=0; double count; double MSE_loc=0.0; @@ -594,7 +594,7 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, int timestep_from_Study){ count=Dm->Comm.sumReduce(count_loc); error /= count; } - else if (tolerance_method.compare("max")==0){ + else if (tolerance_method.compare("MSE_max")==0){ vectorMSE_loc; double MSE_loc_max; ScaLBL_CopyToHost(Psi_host.data(),Psi,sizeof(double)*Nx*Ny*Nz);