Udating unit tests and examples to read from database

This commit is contained in:
James E McClure
2018-05-15 14:04:48 -04:00
parent 6ab72207c8
commit c4b084c306
6 changed files with 124 additions and 32 deletions

View File

@@ -21,6 +21,7 @@ Domain {
n = 80, 80, 80 // Size of local domain (Nx,Ny,Nz)
n_spheres = 1 // Number of spheres
L = 1, 1, 1 // Length of domain (x,y,z)
BC = 0 // Boundary condition type
}
Analysis {

37
example/Piston/input.db Normal file
View File

@@ -0,0 +1,37 @@
Color {
tau = 1.0;
alpha = 1e-2;
beta = 0.95;
phi_s = 0.8;
wp_saturation = 0.7
F = 0, 0, 0
Restart = false
pBC = 0
din = 1.0
dout = 1.0
timestepMax = 200
interval = 1000
tol = 1e-5;
das = 0.1
dbs = 0.9
}
Domain {
nproc = 1, 1, 1 // Number of processors (Npx,Npy,Npz)
n = 80, 80, 80 // Size of local domain (Nx,Ny,Nz)
n_spheres = 1 // Number of spheres
L = 1, 1, 1 // Length of domain (x,y,z)
BC = 0 // Boundary condition type
}
Analysis {
blobid_interval = 1000 // Frequency to perform blob identification
analysis_interval = 1000 // Frequency to perform analysis
restart_interval = 20000 // Frequency to write restart data
vis_interval = 20000 // Frequency to write visualization data
restart_file = "Restart" // Filename to use for restart file (will append rank)
N_threads = 4 // Number of threads to use
load_balance = "independent" // Load balance method to use: "none", "default", "independent"
}

37
example/Sph125/input.db Normal file
View File

@@ -0,0 +1,37 @@
Color {
tau = 1.0;
alpha = 1e-2;
beta = 0.95;
phi_s = 0.8;
wp_saturation = 0.7
F = 0, 0, 0
Restart = false
pBC = 0
din = 1.0
dout = 1.0
timestepMax = 200
interval = 1000
tol = 1e-5;
das = 0.1
dbs = 0.9
}
Domain {
nproc = 1, 1, 1 // Number of processors (Npx,Npy,Npz)
n = 80, 80, 80 // Size of local domain (Nx,Ny,Nz)
n_spheres = 1 // Number of spheres
L = 1, 1, 1 // Length of domain (x,y,z)
BC = 0 // Boundary condition type
}
Analysis {
blobid_interval = 1000 // Frequency to perform blob identification
analysis_interval = 1000 // Frequency to perform analysis
restart_interval = 20000 // Frequency to write restart data
vis_interval = 20000 // Frequency to write visualization data
restart_file = "Restart" // Filename to use for restart file (will append rank)
N_threads = 4 // Number of threads to use
load_balance = "independent" // Load balance method to use: "none", "default", "independent"
}

37
example/Sph1896/input.db Normal file
View File

@@ -0,0 +1,37 @@
Color {
tau = 1.0;
alpha = 1e-2;
beta = 0.95;
phi_s = 0.8;
wp_saturation = 0.7
F = 0, 0, 0
Restart = false
pBC = 0
din = 1.0
dout = 1.0
timestepMax = 200
interval = 1000
tol = 1e-5;
das = 0.1
dbs = 0.9
}
Domain {
nproc = 1, 1, 1 // Number of processors (Npx,Npy,Npz)
n = 80, 80, 80 // Size of local domain (Nx,Ny,Nz)
n_spheres = 1 // Number of spheres
L = 1, 1, 1 // Length of domain (x,y,z)
BC = 0 // Boundary condition type
}
Analysis {
blobid_interval = 1000 // Frequency to perform blob identification
analysis_interval = 1000 // Frequency to perform analysis
restart_interval = 20000 // Frequency to write restart data
vis_interval = 20000 // Frequency to write visualization data
restart_file = "Restart" // Filename to use for restart file (will append rank)
N_threads = 4 // Number of threads to use
load_balance = "independent" // Load balance method to use: "none", "default", "independent"
}

View File

@@ -47,7 +47,7 @@ ADD_LBPM_TEST( TestBubbleDFH )
ADD_LBPM_TEST( TestColorGradDFH )
ADD_LBPM_TEST( TestColorMassBounceback )
ADD_LBPM_TEST( TestPressVel )
ADD_LBPM_TEST( TestPoiseuille )
ADD_LBPM_TEST( TestPoiseuille ../example/Piston/input.db)
ADD_LBPM_TEST( TestForceMoments )
ADD_LBPM_TEST( TestForceD3Q19 )
ADD_LBPM_TEST( TestMomentsD3Q19 )

View File

@@ -11,26 +11,6 @@
std::shared_ptr<Database> loadInputs( int nprocs )
{
const int dim = 12;
std::shared_ptr<Database> db;
if ( exists( "Domain.in" ) ) {
db = std::make_shared<Database>( "Domain.in" );
} else if (nprocs==1) {
db->putVector<int>( "nproc", { 1, 1, 1 } );
db->putVector<int>( "n", { dim, dim, dim } );
db->putScalar<int>( "nspheres", 0 );
db->putVector<double>( "L", { 1, 1, 1 } );
} else if (nprocs==2) {
db->putVector<int>( "nproc", { 1, 1, 1 } );
db->putVector<int>( "n", { dim/2, dim/2, dim/2 } );
db->putScalar<int>( "nspheres", 0 );
db->putVector<double>( "L", { 1, 1, 1 } );
}
db->putScalar<int>( "BC", 0 );
return db;
}
//***************************************************************************************
@@ -54,7 +34,7 @@ int main(int argc, char **argv)
}
// BGK Model parameters
string FILENAME;
string FILENAME = argv[1];
unsigned int nBlocks, nthreads;
int timestepMax, interval;
double tau,Fx,Fy,Fz,tol;
@@ -71,15 +51,15 @@ int main(int argc, char **argv)
Fz = 1e-3; //1.f; // 1e-3;
// Load inputs
auto db = loadInputs( nprocs );
int Nx = db->getVector<int>( "n" )[0];
int Ny = db->getVector<int>( "n" )[1];
int Nz = db->getVector<int>( "n" )[2];
int nprocx = db->getVector<int>( "nproc" )[0];
int nprocy = db->getVector<int>( "nproc" )[1];
int nprocz = db->getVector<int>( "nproc" )[2];
if (rank==0) printf("Loading input database \n");
auto db = std::make_shared<Database>(FILENAME);
auto domain_db= db-> getDatabase("Domain");
int Nx = domain_db->getVector<int>( "n" )[0];
int Ny = domain_db->getVector<int>( "n" )[1];
int Nz = domain_db->getVector<int>( "n" )[2];
int nprocx = domain_db->getVector<int>( "nproc" )[0];
int nprocy = domain_db->getVector<int>( "nproc" )[1];
int nprocz = domain_db->getVector<int>( "nproc" )[2];
if (rank==0){
printf("********************************************************\n");
printf("Sub-domain size = %i x %i x %i\n",Nx,Ny,Nz);
@@ -102,7 +82,7 @@ int main(int argc, char **argv)
double iVol_global = 1.0/Nx/Ny/Nz/nprocx/nprocy/nprocz;
Domain Dm(db);
Domain Dm(domain_db);
Nx += 2;
Ny += 2;