refactoring analysis to rely on database for info
This commit is contained in:
parent
6001b6a440
commit
f040c6befc
@ -476,11 +476,9 @@ runAnalysis::commWrapper runAnalysis::getComm( )
|
|||||||
/******************************************************************
|
/******************************************************************
|
||||||
* Constructor/Destructors *
|
* Constructor/Destructors *
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
runAnalysis::runAnalysis( std::shared_ptr<Database> db,
|
runAnalysis::runAnalysis(std::shared_ptr<Database> db, const RankInfoStruct& rank_info, std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm, std::shared_ptr <Domain> Dm,
|
||||||
const RankInfoStruct& rank_info, std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm, std::shared_ptr <Domain> Dm,
|
int Np, bool Regular, IntArray Map ):
|
||||||
int Np, bool Regular, double beta, IntArray Map ):
|
|
||||||
d_Np( Np ),
|
d_Np( Np ),
|
||||||
d_beta( beta ),
|
|
||||||
d_regular ( Regular),
|
d_regular ( Regular),
|
||||||
d_rank_info( rank_info ),
|
d_rank_info( rank_info ),
|
||||||
d_Map( Map ),
|
d_Map( Map ),
|
||||||
@ -518,6 +516,8 @@ runAnalysis::runAnalysis( std::shared_ptr<Database> db,
|
|||||||
|
|
||||||
auto restart_file = db->getScalar<std::string>( "restart_file" );
|
auto restart_file = db->getScalar<std::string>( "restart_file" );
|
||||||
d_restartFile = restart_file + "." + rankString;
|
d_restartFile = restart_file + "." + rankString;
|
||||||
|
|
||||||
|
|
||||||
d_rank = MPI_WORLD_RANK();
|
d_rank = MPI_WORLD_RANK();
|
||||||
writeIDMap(ID_map_struct(),0,id_map_filename);
|
writeIDMap(ID_map_struct(),0,id_map_filename);
|
||||||
// Initialize IO for silo
|
// Initialize IO for silo
|
||||||
@ -714,10 +714,12 @@ AnalysisType runAnalysis::computeAnalysisType( int timestep )
|
|||||||
/******************************************************************
|
/******************************************************************
|
||||||
* Run the analysis *
|
* Run the analysis *
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
void runAnalysis::run( int timestep, TwoPhase& Averages, const double *Phi,
|
void runAnalysis::run( std::shared_ptr<Database> db, TwoPhase& Averages, const double *Phi,
|
||||||
double *Pressure, double *Velocity, double *fq, double *Den)
|
double *Pressure, double *Velocity, double *fq, double *Den)
|
||||||
{
|
{
|
||||||
int N = d_N[0]*d_N[1]*d_N[2];
|
int N = d_N[0]*d_N[1]*d_N[2];
|
||||||
|
|
||||||
|
int timestep = db->getWithDefault<int>( "timestep", 0 );
|
||||||
|
|
||||||
// Check which analysis steps we need to perform
|
// Check which analysis steps we need to perform
|
||||||
auto type = computeAnalysisType( timestep );
|
auto type = computeAnalysisType( timestep );
|
||||||
@ -882,7 +884,7 @@ void runAnalysis::run( int timestep, TwoPhase& Averages, const double *Phi,
|
|||||||
/******************************************************************
|
/******************************************************************
|
||||||
* Run the analysis *
|
* Run the analysis *
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
void runAnalysis::basic( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den)
|
void runAnalysis::basic( std::shared_ptr<Database> db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den)
|
||||||
{
|
{
|
||||||
int N = d_N[0]*d_N[1]*d_N[2];
|
int N = d_N[0]*d_N[1]*d_N[2];
|
||||||
|
|
||||||
|
@ -25,16 +25,16 @@ public:
|
|||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
runAnalysis( std::shared_ptr<Database> db, const RankInfoStruct& rank_info,
|
runAnalysis( std::shared_ptr<Database> db, const RankInfoStruct& rank_info,
|
||||||
std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm, std::shared_ptr <Domain> dm, int Np, bool Regular, double beta, IntArray Map );
|
std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm, std::shared_ptr <Domain> dm, int Np, bool Regular, IntArray Map );
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~runAnalysis();
|
~runAnalysis();
|
||||||
|
|
||||||
//! Run the next analysis
|
//! Run the next analysis
|
||||||
void run( int timestep, TwoPhase &Averages, const double *Phi,
|
void run( std::shared_ptr<Database> db, TwoPhase &Averages, const double *Phi,
|
||||||
double *Pressure, double *Velocity, double *fq, double *Den );
|
double *Pressure, double *Velocity, double *fq, double *Den );
|
||||||
|
|
||||||
void basic( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den );
|
void basic( std::shared_ptr<Database> db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den );
|
||||||
void WriteVisData( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den);
|
void WriteVisData( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den);
|
||||||
|
|
||||||
//! Finish all active analysis
|
//! Finish all active analysis
|
||||||
|
@ -542,7 +542,7 @@ void ScaLBL_ColorModel::Run(){
|
|||||||
PROFILE_START("Loop");
|
PROFILE_START("Loop");
|
||||||
//std::shared_ptr<Database> analysis_db;
|
//std::shared_ptr<Database> analysis_db;
|
||||||
bool Regular = false;
|
bool Regular = false;
|
||||||
runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, beta, Map );
|
runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, Map );
|
||||||
//analysis.createThreads( analysis_method, 4 );
|
//analysis.createThreads( analysis_method, 4 );
|
||||||
while (timestep < timestepMax ) {
|
while (timestep < timestepMax ) {
|
||||||
//if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); }
|
//if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); }
|
||||||
@ -624,7 +624,9 @@ void ScaLBL_ColorModel::Run(){
|
|||||||
|
|
||||||
// Run the analysis
|
// Run the analysis
|
||||||
//analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den );
|
//analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den );
|
||||||
analysis.basic( timestep, *Averages, Phi, Pressure, Velocity, fq, Den );
|
|
||||||
|
analysis_db->putScalar<int>("timestep",timestep);
|
||||||
|
analysis.basic( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den );
|
||||||
|
|
||||||
if (rank==0 && timestep%analysis_interval == 0 && BoundaryCondition > 0){
|
if (rank==0 && timestep%analysis_interval == 0 && BoundaryCondition > 0){
|
||||||
printf("....inlet pressure=%f \n",din);
|
printf("....inlet pressure=%f \n",din);
|
||||||
|
@ -492,7 +492,7 @@ void ScaLBL_DFHModel::Run(){
|
|||||||
|
|
||||||
bool Regular = true;
|
bool Regular = true;
|
||||||
PROFILE_START("Loop");
|
PROFILE_START("Loop");
|
||||||
runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, beta, Map );
|
runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, Map );
|
||||||
while (timestep < timestepMax ) {
|
while (timestep < timestepMax ) {
|
||||||
//if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); }
|
//if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); }
|
||||||
PROFILE_START("Update");
|
PROFILE_START("Update");
|
||||||
@ -573,7 +573,7 @@ void ScaLBL_DFHModel::Run(){
|
|||||||
PROFILE_STOP("Update");
|
PROFILE_STOP("Update");
|
||||||
|
|
||||||
// Run the analysis
|
// Run the analysis
|
||||||
analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den );
|
analysis.run( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den );
|
||||||
}
|
}
|
||||||
analysis.finish();
|
analysis.finish();
|
||||||
PROFILE_STOP("Loop");
|
PROFILE_STOP("Loop");
|
||||||
|
@ -405,7 +405,7 @@ int main(int argc, char **argv)
|
|||||||
//************ MAIN ITERATION LOOP ***************************************/
|
//************ MAIN ITERATION LOOP ***************************************/
|
||||||
PROFILE_START("Loop");
|
PROFILE_START("Loop");
|
||||||
//std::shared_ptr<Database> analysis_db;
|
//std::shared_ptr<Database> analysis_db;
|
||||||
runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, pBC, beta, Map );
|
runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, pBC, Map );
|
||||||
//analysis.createThreads( analysis_method, 4 );
|
//analysis.createThreads( analysis_method, 4 );
|
||||||
while (timestep < timestepMax && err > tol ) {
|
while (timestep < timestepMax && err > tol ) {
|
||||||
//if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); }
|
//if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); }
|
||||||
@ -487,7 +487,7 @@ int main(int argc, char **argv)
|
|||||||
PROFILE_STOP("Update");
|
PROFILE_STOP("Update");
|
||||||
|
|
||||||
// Run the analysis
|
// Run the analysis
|
||||||
analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den );
|
analysis.run( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den );
|
||||||
|
|
||||||
}
|
}
|
||||||
analysis.finish();
|
analysis.finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user