FOM for tests
This commit is contained in:
parent
d7fc677435
commit
345b43d9f8
|
@ -6,7 +6,7 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "common/ScaLBL.h"
|
||||
#include "common/MPI_Helpers.h"
|
||||
#include "common/MPI.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -166,8 +166,8 @@ int main(int argc, char **argv)
|
|||
// Initialize MPI
|
||||
Utilities::startup( argc, argv );
|
||||
Utilities::MPI comm( MPI_COMM_WORLD );
|
||||
int rank = comm.getRank();
|
||||
int nprocs = comm.getSize();
|
||||
int rank = comm.getRank();
|
||||
int nprocs = comm.getSize();
|
||||
int check;
|
||||
{
|
||||
|
||||
|
@ -262,14 +262,14 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
MPI_Allreduce(&sum_local,&sum,1,MPI_DOUBLE,MPI_SUM,comm);
|
||||
sum = comm.sumReduce( sum_local );
|
||||
double iVol_global=1.f/double((Nx-2)*(Ny-2)*(Nz-2)*nprocx*nprocy*nprocz);
|
||||
porosity = 1.0-sum*iVol_global;
|
||||
if (rank==0) printf("Media porosity = %f \n",porosity);
|
||||
//.......................................................................
|
||||
|
||||
//...........................................................................
|
||||
MPI_Barrier(comm);
|
||||
comm.barrier();
|
||||
if (rank == 0) cout << "Domain set." << endl;
|
||||
//...........................................................................
|
||||
|
||||
|
@ -354,7 +354,7 @@ int main(int argc, char **argv)
|
|||
GlobalFlipScaLBL_D3Q19_Init(fq_host, Map, Np, Nx-2, Ny-2, Nz-2, iproc,jproc,kproc,nprocx,nprocy,nprocz);
|
||||
ScaLBL_CopyToDevice(fq, fq_host, 19*dist_mem_size);
|
||||
ScaLBL_DeviceBarrier();
|
||||
MPI_Barrier(comm);
|
||||
comm.barrier();
|
||||
//*************************************************************************
|
||||
// First timestep
|
||||
ScaLBL_Comm.SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
|
@ -377,8 +377,8 @@ int main(int argc, char **argv)
|
|||
|
||||
//.......create and start timer............
|
||||
double starttime,stoptime,cputime;
|
||||
MPI_Barrier(comm);
|
||||
starttime = MPI_Wtime();
|
||||
comm.barrier();
|
||||
starttime = Utilities::MPI::time();
|
||||
//.........................................
|
||||
|
||||
|
||||
|
@ -397,13 +397,13 @@ int main(int argc, char **argv)
|
|||
//*********************************************
|
||||
|
||||
ScaLBL_DeviceBarrier();
|
||||
MPI_Barrier(comm);
|
||||
comm.barrier();
|
||||
// Iteration completed!
|
||||
timestep++;
|
||||
//...................................................................
|
||||
}
|
||||
//************************************************************************/
|
||||
stoptime = MPI_Wtime();
|
||||
stoptime = Utilities::MPI::time();
|
||||
// cout << "CPU time: " << (stoptime - starttime) << " seconds" << endl;
|
||||
cputime = stoptime - starttime;
|
||||
// cout << "Lattice update rate: "<< double(Nx*Ny*Nz*timestep)/cputime/1000000 << " MLUPS" << endl;
|
||||
|
@ -429,5 +429,6 @@ int main(int argc, char **argv)
|
|||
comm.barrier();
|
||||
Utilities::shutdown();
|
||||
// ****************************************************
|
||||
|
||||
return check;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "common/UnitTest.h"
|
||||
#include "common/Utilities.h"
|
||||
#include "common/MPI_Helpers.h"
|
||||
#include "common/MPI.h"
|
||||
#include "common/Database.h"
|
||||
#include "ProfilerApp.h"
|
||||
|
||||
|
|
|
@ -97,13 +97,13 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
MPI_Barrier(comm);
|
||||
comm.barrier();
|
||||
if (rank==0) printf("Initialized! Converting to Signed Distance function \n");
|
||||
|
||||
double t1 = MPI_Wtime();
|
||||
double t1 = Utilities::MPI::time();
|
||||
DoubleArray Distance(nx,ny,nz);
|
||||
CalcDist(Distance,id,Dm,{false,false,false});
|
||||
double t2 = MPI_Wtime();
|
||||
double t2 = Utilities::MPI::time();
|
||||
if (rank==0)
|
||||
printf("Total time: %f seconds \n",t2-t1);
|
||||
|
||||
|
@ -115,7 +115,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
err = sumReduce( Dm.Comm, err );
|
||||
err = Dm.Comm.sumReduce( err );
|
||||
err = sqrt( err / (nx*ny*nz*nprocs) );
|
||||
if (rank==0)
|
||||
printf("Mean error %0.4f \n", err);
|
||||
|
|
|
@ -172,10 +172,10 @@ int main(int argc, char **argv)
|
|||
double Ai = Object->A();
|
||||
double Hi = Object->H();
|
||||
double Xi = Object->X();
|
||||
Vi=sumReduce( Dm->Comm, Vi);
|
||||
Ai=sumReduce( Dm->Comm, Ai);
|
||||
Hi=sumReduce( Dm->Comm, Hi);
|
||||
Xi=sumReduce( Dm->Comm, Xi);
|
||||
Vi=Dm->Comm.sumReduce( Vi);
|
||||
Ai=Dm->Comm.sumReduce( Ai);
|
||||
Hi=Dm->Comm.sumReduce( Hi);
|
||||
Xi=Dm->Comm.sumReduce( Xi);
|
||||
printf("Vi=%f, Ai=%f, Hi=%f, Xi=%f \n", Vi,Ai,Hi,Xi);
|
||||
|
||||
} // Limit scope so variables that contain communicators will free before MPI_Finialize
|
||||
|
|
Loading…
Reference in New Issue
Block a user