clean up input for MRT model

This commit is contained in:
James McClure
2019-04-19 11:08:30 -04:00
parent 8e4169cb83
commit 67331e2c53

View File

@@ -22,30 +22,35 @@ void ScaLBL_MRTModel::ReadParams(string filename){
mrt_db = db->getDatabase( "MRT" );
// Color Model parameters
timestepMax = mrt_db->getScalar<int>( "timestepMax" );
tau = mrt_db->getScalar<double>( "tau" );
Fx = mrt_db->getVector<double>( "F" )[0];
Fy = mrt_db->getVector<double>( "F" )[1];
Fz = mrt_db->getVector<double>( "F" )[2];
Restart = mrt_db->getScalar<bool>( "Restart" );
din = mrt_db->getScalar<double>( "din" );
dout = mrt_db->getScalar<double>( "dout" );
flux = mrt_db->getScalar<double>( "flux" );
if (color_db->keyExists( "timestepMax" )){
timestepMax = mrt_db->getScalar<int>( "timestepMax" );
}
if (color_db->keyExists( "tau" )){
tau = mrt_db->getScalar<double>( "tau" );
}
if (color_db->keyExists( "F" )){
Fx = mrt_db->getVector<double>( "F" )[0];
Fy = mrt_db->getVector<double>( "F" )[1];
Fz = mrt_db->getVector<double>( "F" )[2];
}
if (color_db->keyExists( "Restart" )){
Restart = mrt_db->getScalar<bool>( "Restart" );
}
if (color_db->keyExists( "din" )){
din = mrt_db->getScalar<double>( "din" );
}
if (color_db->keyExists( "dout" )){
dout = mrt_db->getScalar<double>( "dout" );
}
if (color_db->keyExists( "flux" )){
flux = mrt_db->getScalar<double>( "flux" );
}
// Read domain parameters
auto L = domain_db->getVector<double>( "L" );
auto size = domain_db->getVector<int>( "n" );
auto nproc = domain_db->getVector<int>( "nproc" );
BoundaryCondition = domain_db->getScalar<int>( "BC" );
Nx = size[0];
Ny = size[1];
Nz = size[2];
Lx = L[0];
Ly = L[1];
Lz = L[2];
nprocx = nproc[0];
nprocy = nproc[1];
nprocz = nproc[2];
if (domain_db->keyExists( "BC" )){
BoundaryCondition = domain_db->getScalar<int>( "BC" );
}
mu=(tau-0.5)/3.0;
}
void ScaLBL_MRTModel::SetDomain(){
@@ -63,6 +68,17 @@ void ScaLBL_MRTModel::SetDomain(){
MPI_Barrier(comm);
Dm->CommInit();
MPI_Barrier(comm);
// Read domain parameters
rank = Dm->rank();
Nx = Dm->Nx;
Ny = Dm->Ny;
Nz = Dm->Nz;
Lx = Dm->Lx;
Ly = Dm->Ly;
Lz = Dm->Lz;
nprocx = Dm->nprocx();
nprocy = Dm->nprocy();
nprocz = Dm->nprocz();
}
void ScaLBL_MRTModel::ReadInput(){
@@ -241,7 +257,7 @@ void ScaLBL_MRTModel::Run(){
Hs=sumReduce( Dm->Comm, Hs);
Xs=sumReduce( Dm->Comm, Xs);
if (rank==0) {
double h = Lz/double((Nz-2)*nprocz);
double h = Dm->voxel_length;
double absperm = h*h*mu*Mask->Porosity()*sqrt(vax*vax+vay*vay+vaz*vaz)/sqrt(Fx*Fx+Fy*Fy+Fz*Fz);
printf(" %f\n",absperm);
FILE * log_file = fopen("Permeability.csv","a");