updated color model with default parameters

This commit is contained in:
James E McClure 2019-04-19 10:49:55 -04:00
parent 10f3865fb1
commit 8e4169cb83
2 changed files with 65 additions and 30 deletions

View File

@ -119,6 +119,7 @@ void Domain::initialize( std::shared_ptr<Database> db )
auto nproc = d_db->getVector<int>("nproc"); auto nproc = d_db->getVector<int>("nproc");
auto n = d_db->getVector<int>("n"); auto n = d_db->getVector<int>("n");
voxel_length = 1.0;
if (d_db->keyExists( "voxel_length" )){ if (d_db->keyExists( "voxel_length" )){
auto voxel_length = d_db->getScalar<double>("voxel_length"); auto voxel_length = d_db->getScalar<double>("voxel_length");
} }

View File

@ -61,41 +61,65 @@ void ScaLBL_ColorModel::ReadParams(string filename){
color_db = db->getDatabase( "Color" ); color_db = db->getDatabase( "Color" );
analysis_db = db->getDatabase( "Analysis" ); analysis_db = db->getDatabase( "Analysis" );
// set defaults
timestepMax = 100000;
tauA = tauB = 1.0;
rhoA = rhoB = 1.0;
Fx = Fy = Fz = 0.0;
alpha=1e-3;
beta=0.95;
Restart=false;
din=dout=1.0;
flux=0.0;
// Color Model parameters // Color Model parameters
timestepMax = color_db->getScalar<int>( "timestepMax" ); if (color_db->keyExists( "timestepMax" )){
tauA = color_db->getScalar<double>( "tauA" ); timestepMax = color_db->getScalar<int>( "timestepMax" );
tauB = color_db->getScalar<double>( "tauB" ); }
rhoA = color_db->getScalar<double>( "rhoA" ); if (color_db->keyExists( "tauA" )){
rhoB = color_db->getScalar<double>( "rhoB" ); tauA = color_db->getScalar<double>( "tauA" );
Fx = color_db->getVector<double>( "F" )[0]; }
Fy = color_db->getVector<double>( "F" )[1]; if (color_db->keyExists( "tauB" )){
Fz = color_db->getVector<double>( "F" )[2]; tauB = color_db->getScalar<double>( "tauB" );
alpha = color_db->getScalar<double>( "alpha" ); }
beta = color_db->getScalar<double>( "beta" ); if (color_db->keyExists( "rhoA" )){
Restart = color_db->getScalar<bool>( "Restart" ); rhoA = color_db->getScalar<double>( "rhoA" );
din = color_db->getScalar<double>( "din" ); }
dout = color_db->getScalar<double>( "dout" ); if (color_db->keyExists( "rhoB" )){
flux = color_db->getScalar<double>( "flux" ); rhoB = color_db->getScalar<double>( "rhoB" );
}
if (color_db->keyExists( "F" )){
Fx = color_db->getVector<double>( "F" )[0];
Fy = color_db->getVector<double>( "F" )[1];
Fz = color_db->getVector<double>( "F" )[2];
}
if (color_db->keyExists( "alpha" )){
alpha = color_db->getScalar<double>( "alpha" );
}
if (color_db->keyExists( "beta" )){
beta = color_db->getScalar<double>( "beta" );
}
if (color_db->keyExists( "Restart" )){
Restart = color_db->getScalar<bool>( "Restart" );
}
if (color_db->keyExists( "din" )){
din = color_db->getScalar<double>( "din" );
}
if (color_db->keyExists( "dout" )){
dout = color_db->getScalar<double>( "dout" );
}
if (color_db->keyExists( "flux" )){
flux = color_db->getScalar<double>( "flux" );
}
inletA=1.f; inletA=1.f;
inletB=0.f; inletB=0.f;
outletA=0.f; outletA=0.f;
outletB=1.f; outletB=1.f;
// Read domain parameters BoundaryCondition = 0;
auto L = domain_db->getVector<double>( "L" ); if (domain_db->keyExists( "BC" )){
auto size = domain_db->getVector<int>( "n" ); BoundaryCondition = domain_db->getScalar<int>( "BC" );
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 (BoundaryCondition==4) flux *= rhoA; // mass flux must adjust for density (see formulation for details) if (BoundaryCondition==4) flux *= rhoA; // mass flux must adjust for density (see formulation for details)
} }
@ -111,7 +135,17 @@ void ScaLBL_ColorModel::SetDomain(){
MPI_Barrier(comm); MPI_Barrier(comm);
Dm->CommInit(); Dm->CommInit();
MPI_Barrier(comm); MPI_Barrier(comm);
rank = Dm->rank(); // 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_ColorModel::ReadInput(){ void ScaLBL_ColorModel::ReadInput(){