Fixing compile warnings
This commit is contained in:
parent
f17bccb389
commit
78c2e710b9
|
@ -189,6 +189,7 @@ std::vector<size_t> getAttDim( int fid, const std::string& att )
|
|||
{
|
||||
std::vector<size_t> dim(1,0);
|
||||
int err = nc_inq_attlen( fid, NC_GLOBAL, att.c_str(), dim.data() );
|
||||
CHECK_NC_ERR( err );
|
||||
return dim;
|
||||
}
|
||||
std::vector<std::string> getVarNames( int fid )
|
||||
|
|
|
@ -169,7 +169,6 @@ void SubPhase::Basic(){
|
|||
|
||||
nb.reset(); wb.reset();
|
||||
|
||||
double nA,nB;
|
||||
double count_w = 0.0;
|
||||
double count_n = 0.0;
|
||||
|
||||
|
@ -297,8 +296,8 @@ void SubPhase::Basic(){
|
|||
double saturation=gwb.V/(gwb.V + gnb.V);
|
||||
double water_flow_rate=gwb.V*(gwb.Px*dir_x + gwb.Py*dir_y + gwb.Pz*dir_z)/gwb.M / Dm->Volume;
|
||||
double not_water_flow_rate=gnb.V*(gnb.Px*dir_x + gnb.Py*dir_y + gnb.Pz*dir_z)/gnb.M/ Dm->Volume;
|
||||
double total_flow_rate = water_flow_rate + not_water_flow_rate;
|
||||
double fractional_flow= water_flow_rate / total_flow_rate;
|
||||
//double total_flow_rate = water_flow_rate + not_water_flow_rate;
|
||||
//double fractional_flow = water_flow_rate / total_flow_rate;
|
||||
|
||||
double h = Dm->voxel_length;
|
||||
double krn = h*h*nu_n*not_water_flow_rate / force_mag ;
|
||||
|
@ -697,7 +696,8 @@ void SubPhase::Full(){
|
|||
}
|
||||
|
||||
|
||||
void SubPhase::AggregateLabels(char *FILENAME){
|
||||
void SubPhase::AggregateLabels( const std::string& filename )
|
||||
{
|
||||
|
||||
int nx = Dm->Nx;
|
||||
int ny = Dm->Ny;
|
||||
|
@ -721,7 +721,7 @@ void SubPhase::AggregateLabels(char *FILENAME){
|
|||
}
|
||||
MPI_Barrier(Dm->Comm);
|
||||
|
||||
Dm->AggregateLabels(FILENAME);
|
||||
Dm->AggregateLabels( filename );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
void Basic();
|
||||
void Full();
|
||||
void Write(int time);
|
||||
void AggregateLabels(char *FILENAME);
|
||||
void AggregateLabels( const std::string& filename );
|
||||
|
||||
private:
|
||||
FILE *TIMELOG;
|
||||
|
|
|
@ -204,6 +204,7 @@ TwoPhase::~TwoPhase()
|
|||
|
||||
void TwoPhase::ColorToSignedDistance(double Beta, DoubleArray &ColorData, DoubleArray &DistData)
|
||||
{
|
||||
NULL_USE( Beta );
|
||||
/*double factor,temp,value;
|
||||
factor=0.5/Beta;
|
||||
// Initialize to -1,1 (segmentation)
|
||||
|
@ -627,8 +628,8 @@ void TwoPhase::ComputeLocal()
|
|||
|
||||
void TwoPhase::AssignComponentLabels()
|
||||
{
|
||||
int LabelNWP=1;
|
||||
int LabelWP=2;
|
||||
//int LabelNWP=1;
|
||||
//int LabelWP=2;
|
||||
// NOTE: labeling the wetting phase components is tricky! One sandstone media had over 800,000 components
|
||||
// NumberComponents_WP = ComputeGlobalPhaseComponent(Dm->Nx-2,Dm->Ny-2,Dm->Nz-2,Dm->rank_info,PhaseID,LabelWP,Label_WP);
|
||||
// treat all wetting phase is connected
|
||||
|
@ -1172,6 +1173,8 @@ void TwoPhase::Reduce()
|
|||
|
||||
void TwoPhase::NonDimensionalize(double D, double viscosity, double IFT)
|
||||
{
|
||||
NULL_USE( viscosity );
|
||||
NULL_USE( IFT );
|
||||
awn_global *= D;
|
||||
ans_global *= D;
|
||||
ans_global *= D;
|
||||
|
|
|
@ -352,6 +352,8 @@ double DECL::EdgeAngle(int edge)
|
|||
|
||||
void Isosurface(DoubleArray &A, const double &v)
|
||||
{
|
||||
NULL_USE( v );
|
||||
|
||||
Point P,Q;
|
||||
Point PlaceHolder;
|
||||
Point C0,C1,C2,C3,C4,C5,C6,C7;
|
||||
|
@ -562,7 +564,7 @@ void Isosurface(DoubleArray &A, const double &v)
|
|||
if (P.z == 1.0 && Q.z == 1.0) HalfEdge[idx_edge][3] = -6; // ghost twin for z=1 face
|
||||
}
|
||||
// Find all the angles
|
||||
for (int idx=0; idx<EdgeCount; idx++){
|
||||
/*for (int idx=0; idx<EdgeCount; idx++){
|
||||
int V1=HalfEdge[idx][0];
|
||||
int V2=HalfEdge[idx][1];
|
||||
int T1= HalfEdge[idx_edge][2];
|
||||
|
@ -570,7 +572,7 @@ void Isosurface(DoubleArray &A, const double &v)
|
|||
if (twin == -1){
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Map vertices to global coordinates
|
||||
for (int idx=0;idx<VertexCount;idx++) {
|
||||
|
|
|
@ -34,9 +34,6 @@ double MorphOpen(DoubleArray &SignDist, signed char *id, std::shared_ptr<Domain>
|
|||
int nx = Dm->Nx;
|
||||
int ny = Dm->Ny;
|
||||
int nz = Dm->Nz;
|
||||
int iproc = Dm->iproc();
|
||||
int jproc = Dm->jproc();
|
||||
int kproc = Dm->kproc();
|
||||
int nprocx = Dm->nprocx();
|
||||
int nprocy = Dm->nprocy();
|
||||
int nprocz = Dm->nprocz();
|
||||
|
@ -122,7 +119,6 @@ double MorphOpen(DoubleArray &SignDist, signed char *id, std::shared_ptr<Domain>
|
|||
int sendtag,recvtag;
|
||||
sendtag = recvtag = 7;
|
||||
|
||||
int x,y,z;
|
||||
int ii,jj,kk;
|
||||
int Nx = nx;
|
||||
int Ny = ny;
|
||||
|
@ -336,9 +332,6 @@ double MorphDrain(DoubleArray &SignDist, signed char *id, std::shared_ptr<Domain
|
|||
int nx = Dm->Nx;
|
||||
int ny = Dm->Ny;
|
||||
int nz = Dm->Nz;
|
||||
int iproc = Dm->iproc();
|
||||
int jproc = Dm->jproc();
|
||||
int kproc = Dm->kproc();
|
||||
int nprocx = Dm->nprocx();
|
||||
int nprocy = Dm->nprocy();
|
||||
int nprocz = Dm->nprocz();
|
||||
|
@ -427,7 +420,6 @@ double MorphDrain(DoubleArray &SignDist, signed char *id, std::shared_ptr<Domain
|
|||
int sendtag,recvtag;
|
||||
sendtag = recvtag = 7;
|
||||
|
||||
int x,y,z;
|
||||
int ii,jj,kk;
|
||||
int Nx = nx;
|
||||
int Ny = ny;
|
||||
|
@ -693,17 +685,11 @@ double MorphDrain(DoubleArray &SignDist, signed char *id, std::shared_ptr<Domain
|
|||
return final_void_fraction;
|
||||
}
|
||||
|
||||
double MorphGrow(DoubleArray &BoundaryDist, DoubleArray &Dist, Array<char> &id, std::shared_ptr<Domain> Dm, double TargetGrowth){
|
||||
|
||||
double MorphGrow(DoubleArray &BoundaryDist, DoubleArray &Dist, Array<char> &id, std::shared_ptr<Domain> Dm, double TargetGrowth)
|
||||
{
|
||||
int Nx = Dm->Nx;
|
||||
int Ny = Dm->Ny;
|
||||
int Nz = Dm->Nz;
|
||||
int iproc = Dm->iproc();
|
||||
int jproc = Dm->jproc();
|
||||
int kproc = Dm->kproc();
|
||||
int nprocx = Dm->nprocx();
|
||||
int nprocy = Dm->nprocy();
|
||||
int nprocz = Dm->nprocz();
|
||||
int rank = Dm->rank();
|
||||
|
||||
double count=0.0;
|
||||
|
|
|
@ -157,6 +157,7 @@ void solve( const Array<float>& VOL, Array<float>& Mean, Array<char>& ID,
|
|||
// int depth = 5;
|
||||
// float sigsq=0.1;
|
||||
int nlm_count = NLM3D( MultiScaleSmooth, Mean, Dist, NonLocalMean, depth, sigsq);
|
||||
NULL_USE( nlm_count );
|
||||
fillFloat.fill(NonLocalMean);
|
||||
}
|
||||
|
||||
|
@ -201,6 +202,7 @@ void refine( const Array<float>& Dist_coarse,
|
|||
// int depth = 3;
|
||||
// float sigsq = 0.1;
|
||||
int nlm_count = NLM3D( MultiScaleSmooth, Mean, Dist, NonLocalMean, depth, sigsq);
|
||||
NULL_USE( nlm_count );
|
||||
fillFloat.fill(NonLocalMean);
|
||||
segment( NonLocalMean, ID, 0.001 );
|
||||
for (size_t i=0; i<ID.length(); i++) {
|
||||
|
|
|
@ -305,4 +305,8 @@ MACRO ( CONFIGURE_LBPM )
|
|||
SET( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
|
||||
SET( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "${TIMER_DIRECTORY}" "${LBPM_INSTALL_DIR}/lib" )
|
||||
ENDIF()
|
||||
# Suppress some common warnings
|
||||
IF ( USING_GCC )
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-unused-parameter")
|
||||
ENDIF()
|
||||
ENDMACRO ()
|
||||
|
|
|
@ -58,6 +58,9 @@ Domain::Domain( int nx, int ny, int nz, int rnk, int npx, int npy, int npz,
|
|||
recvData_xY(NULL), recvData_yZ(NULL), recvData_Xz(NULL), recvData_XY(NULL), recvData_YZ(NULL), recvData_XZ(NULL),
|
||||
id(NULL)
|
||||
{
|
||||
NULL_USE( rnk );
|
||||
NULL_USE( npy );
|
||||
NULL_USE( npz );
|
||||
// set up the neighbor ranks
|
||||
int myrank;
|
||||
MPI_Comm_rank( Comm, &myrank );
|
||||
|
@ -241,7 +244,7 @@ void Domain::initialize( std::shared_ptr<Database> db )
|
|||
INSIST(nprocs == nproc[0]*nproc[1]*nproc[2],"Fatal error in processor count!");
|
||||
}
|
||||
|
||||
void Domain::Decomp(std::string Filename)
|
||||
void Domain::Decomp( const std::string& Filename )
|
||||
{
|
||||
//.......................................................................
|
||||
// Reading the domain information file
|
||||
|
@ -251,7 +254,6 @@ void Domain::Decomp(std::string Filename)
|
|||
int nprocs, nprocx, nprocy, nprocz, nx, ny, nz;
|
||||
int64_t global_Nx,global_Ny,global_Nz;
|
||||
int64_t i,j,k,n;
|
||||
int BC=0;
|
||||
int64_t xStart,yStart,zStart;
|
||||
int checkerSize;
|
||||
//int inlet_layers_x, inlet_layers_y, inlet_layers_z;
|
||||
|
@ -331,7 +333,7 @@ void Domain::Decomp(std::string Filename)
|
|||
if (RANK==0){
|
||||
printf("Input media: %s\n",Filename.c_str());
|
||||
printf("Relabeling %lu values\n",ReadValues.size());
|
||||
for (int idx=0; idx<ReadValues.size(); idx++){
|
||||
for (size_t idx=0; idx<ReadValues.size(); idx++){
|
||||
int oldvalue=ReadValues[idx];
|
||||
int newvalue=WriteValues[idx];
|
||||
printf("oldvalue=%d, newvalue =%d \n",oldvalue,newvalue);
|
||||
|
@ -374,7 +376,7 @@ void Domain::Decomp(std::string Filename)
|
|||
n = k*global_Nx*global_Ny+j*global_Nx+i;
|
||||
//char locval = loc_id[n];
|
||||
char locval = SegData[n];
|
||||
for (int idx=0; idx<ReadValues.size(); idx++){
|
||||
for (size_t idx=0; idx<ReadValues.size(); idx++){
|
||||
signed char oldvalue=ReadValues[idx];
|
||||
signed char newvalue=WriteValues[idx];
|
||||
if (locval == oldvalue){
|
||||
|
@ -387,10 +389,10 @@ void Domain::Decomp(std::string Filename)
|
|||
}
|
||||
}
|
||||
if (RANK==0){
|
||||
for (int idx=0; idx<ReadValues.size(); idx++){
|
||||
for (size_t idx=0; idx<ReadValues.size(); idx++){
|
||||
long int label=ReadValues[idx];
|
||||
long int count=LabelCount[idx];
|
||||
printf("Label=%d, Count=%d \n",label,count);
|
||||
printf("Label=%ld, Count=%ld \n",label,count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,7 +477,7 @@ void Domain::Decomp(std::string Filename)
|
|||
printf("Checkerboard pattern at y outlet for %i layers \n",outlet_layers_y);
|
||||
// use checkerboard pattern
|
||||
for (int k = 0; k<global_Nz; k++){
|
||||
for (int j = yStart + ny*nprocy - outlet_layers_y; i < yStart + ny*nprocy; j++){
|
||||
for (int j = yStart + ny*nprocy - outlet_layers_y; j < yStart + ny*nprocy; j++){
|
||||
for (int i = 0; i<global_Nx; i++){
|
||||
if ( (i/checkerSize + k/checkerSize)%2 == 0){
|
||||
// void checkers
|
||||
|
@ -587,7 +589,7 @@ void Domain::Decomp(std::string Filename)
|
|||
MPI_Barrier(Comm);
|
||||
}
|
||||
|
||||
void Domain::AggregateLabels(char *FILENAME){
|
||||
void Domain::AggregateLabels( const std::string& filename ){
|
||||
|
||||
int nx = Nx;
|
||||
int ny = Ny;
|
||||
|
@ -664,8 +666,7 @@ void Domain::AggregateLabels(char *FILENAME){
|
|||
}
|
||||
}
|
||||
// write the output
|
||||
FILE *OUTFILE;
|
||||
OUTFILE = fopen(FILENAME,"wb");
|
||||
FILE *OUTFILE = fopen(filename.c_str(),"wb");
|
||||
fwrite(FullID,1,full_size,OUTFILE);
|
||||
fclose(OUTFILE);
|
||||
}
|
||||
|
@ -1145,19 +1146,18 @@ void Domain::CommunicateMeshHalo(DoubleArray &Mesh)
|
|||
}
|
||||
|
||||
// Ideally stuff below here should be moved somewhere else -- doesn't really belong here
|
||||
void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq, int Np)
|
||||
void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq, size_t Np)
|
||||
{
|
||||
int q,n;
|
||||
double value;
|
||||
ofstream File(FILENAME,ios::binary);
|
||||
for (n=0; n<Np; n++){
|
||||
for (size_t n=0; n<Np; n++){
|
||||
// Write the two density values
|
||||
value = cDen[n];
|
||||
File.write((char*) &value, sizeof(value));
|
||||
value = cDen[Np+n];
|
||||
File.write((char*) &value, sizeof(value));
|
||||
// Write the even distributions
|
||||
for (q=0; q<19; q++){
|
||||
for (size_t q=0; q<19; q++){
|
||||
value = cfq[q*Np+n];
|
||||
File.write((char*) &value, sizeof(value));
|
||||
}
|
||||
|
@ -1166,16 +1166,15 @@ void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq
|
|||
|
||||
}
|
||||
|
||||
void ReadCheckpoint(char *FILENAME, double *cPhi, double *cfq, int Np)
|
||||
void ReadCheckpoint(char *FILENAME, double *cPhi, double *cfq, size_t Np)
|
||||
{
|
||||
int q=0, n=0;
|
||||
double value=0;
|
||||
ifstream File(FILENAME,ios::binary);
|
||||
for (n=0; n<Np; n++){
|
||||
for (size_t n=0; n<Np; n++){
|
||||
File.read((char*) &value, sizeof(value));
|
||||
cPhi[n] = value;
|
||||
// Read the distributions
|
||||
for (q=0; q<19; q++){
|
||||
for (size_t q=0; q<19; q++){
|
||||
File.read((char*) &value, sizeof(value));
|
||||
cfq[q*Np+n] = value;
|
||||
}
|
||||
|
@ -1183,13 +1182,12 @@ void ReadCheckpoint(char *FILENAME, double *cPhi, double *cfq, int Np)
|
|||
File.close();
|
||||
}
|
||||
|
||||
void ReadBinaryFile(char *FILENAME, double *Data, int N)
|
||||
void ReadBinaryFile(char *FILENAME, double *Data, size_t N)
|
||||
{
|
||||
int n;
|
||||
double value;
|
||||
ifstream File(FILENAME,ios::binary);
|
||||
if (File.good()){
|
||||
for (n=0; n<N; n++){
|
||||
for (size_t n=0; n<N; n++){
|
||||
// Write the two density values
|
||||
File.read((char*) &value, sizeof(value));
|
||||
Data[n] = value;
|
||||
|
@ -1197,7 +1195,7 @@ void ReadBinaryFile(char *FILENAME, double *Data, int N)
|
|||
}
|
||||
}
|
||||
else {
|
||||
for (n=0; n<N; n++) Data[n] = 1.2e-34;
|
||||
for (size_t n=0; n<N; n++) Data[n] = 1.2e-34;
|
||||
}
|
||||
File.close();
|
||||
}
|
||||
|
|
|
@ -177,11 +177,11 @@ public: // Public variables (need to create accessors instead)
|
|||
signed char *id;
|
||||
|
||||
void ReadIDs();
|
||||
void Decomp(std::string Filename);
|
||||
void Decomp( const std::string& filename );
|
||||
void CommunicateMeshHalo(DoubleArray &Mesh);
|
||||
void CommInit();
|
||||
int PoreCount();
|
||||
void AggregateLabels(char *FILENAME);
|
||||
void AggregateLabels( const std::string& filename );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -244,10 +244,10 @@ private:
|
|||
|
||||
};
|
||||
|
||||
void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq, int Np);
|
||||
void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq, size_t Np);
|
||||
|
||||
void ReadCheckpoint(char *FILENAME, double *cDen, double *cfq, int Np);
|
||||
void ReadCheckpoint(char *FILENAME, double *cDen, double *cfq, size_t Np);
|
||||
|
||||
void ReadBinaryFile(char *FILENAME, double *Data, int N);
|
||||
void ReadBinaryFile(char *FILENAME, double *Data, size_t N);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -188,6 +188,12 @@ inline int sumReduce( MPI_Comm comm, int x )
|
|||
MPI_Allreduce(&x,&y,1,MPI_INT,MPI_SUM,comm);
|
||||
return y;
|
||||
}
|
||||
inline long long sumReduce( MPI_Comm comm, long long x )
|
||||
{
|
||||
long long y = 0;
|
||||
MPI_Allreduce(&x,&y,1,MPI_LONG_LONG,MPI_SUM,comm);
|
||||
return y;
|
||||
}
|
||||
inline bool sumReduce( MPI_Comm comm, bool x )
|
||||
{
|
||||
int y = sumReduce( comm, x?1:0 );
|
||||
|
|
|
@ -365,7 +365,7 @@ int ScaLBL_Communicator::MemoryOptimizedLayoutAA(IntArray &Map, int *neighborLis
|
|||
int idx,i,j,k,n;
|
||||
|
||||
// Check that Map has size matching sub-domain
|
||||
if (Map.size(0) != Nx)
|
||||
if ( (int) Map.size(0) != Nx)
|
||||
ERROR("ScaLBL_Communicator::MemoryOptimizedLayout: Map array dimensions do not match! \n");
|
||||
|
||||
// Initialize Map
|
||||
|
@ -1480,7 +1480,6 @@ void ScaLBL_Communicator::RecvHalo(double *data){
|
|||
|
||||
void ScaLBL_Communicator::RegularLayout(IntArray map, const double *data, DoubleArray ®data){
|
||||
// Gets data from the device and stores in regular layout
|
||||
int i,j,k,n,idx;
|
||||
int Nx = map.size(0);
|
||||
int Ny = map.size(1);
|
||||
int Nz = map.size(2);
|
||||
|
@ -1492,11 +1491,10 @@ void ScaLBL_Communicator::RegularLayout(IntArray map, const double *data, Double
|
|||
double value;
|
||||
TmpDat = new double [N];
|
||||
ScaLBL_CopyToHost(&TmpDat[0],&data[0], N*sizeof(double));
|
||||
for (k=0; k<Nz; k++){
|
||||
for (j=0; j<Ny; j++){
|
||||
for (i=0; i<Nx; i++){
|
||||
n=k*Nx*Ny+j*Nx+i;
|
||||
idx=map(i,j,k);
|
||||
for (int k=0; k<Nz; k++){
|
||||
for (int j=0; j<Ny; j++){
|
||||
for (int i=0; i<Nx; i++){
|
||||
auto idx=map(i,j,k);
|
||||
if (!(idx<0)){
|
||||
value=TmpDat[idx];
|
||||
regdata(i,j,k)=value;
|
||||
|
@ -1510,8 +1508,9 @@ void ScaLBL_Communicator::RegularLayout(IntArray map, const double *data, Double
|
|||
}
|
||||
|
||||
|
||||
void ScaLBL_Communicator::Color_BC_z(int *Map, double *Phi, double *Den, double vA, double vB){
|
||||
double Value=(vA-vB)/(vA+vB);
|
||||
void ScaLBL_Communicator::Color_BC_z(int *Map, double *Phi, double *Den, double vA, double vB)
|
||||
{
|
||||
//double Value=(vA-vB)/(vA+vB);
|
||||
if (kproc == 0) {
|
||||
// Set the phase indicator field and density on the z inlet
|
||||
ScaLBL_Color_BC_z(dvcSendList_z, Map, Phi, Den, vA, vB, sendCount_z, N);
|
||||
|
@ -1519,8 +1518,9 @@ void ScaLBL_Communicator::Color_BC_z(int *Map, double *Phi, double *Den, double
|
|||
}
|
||||
}
|
||||
|
||||
void ScaLBL_Communicator::Color_BC_Z(int *Map, double *Phi, double *Den, double vA, double vB){
|
||||
double Value=(vA-vB)/(vA+vB);
|
||||
void ScaLBL_Communicator::Color_BC_Z(int *Map, double *Phi, double *Den, double vA, double vB)
|
||||
{
|
||||
//double Value=(vA-vB)/(vA+vB);
|
||||
if (kproc == nprocz-1){
|
||||
// Set the phase indicator field and density on the Z outlet
|
||||
ScaLBL_Color_BC_Z(dvcSendList_Z, Map, Phi, Den, vA, vB, sendCount_Z, N);
|
||||
|
@ -1528,7 +1528,8 @@ void ScaLBL_Communicator::Color_BC_Z(int *Map, double *Phi, double *Den, double
|
|||
}
|
||||
}
|
||||
|
||||
void ScaLBL_Communicator::D3Q19_Pressure_BC_z(int *neighborList, double *fq, double din, int time){
|
||||
void ScaLBL_Communicator::D3Q19_Pressure_BC_z(int *neighborList, double *fq, double din, int time)
|
||||
{
|
||||
//ScaLBL_D3Q19_Pressure_BC_z(int *LIST,fq,din,Nx,Ny,Nz);
|
||||
if (kproc == 0) {
|
||||
if (time%2==0){
|
||||
|
|
|
@ -186,7 +186,6 @@ void ScaLBL_ColorModel::ReadInput(){
|
|||
if (color_db->keyExists( "image_sequence" )){
|
||||
auto ImageList = color_db->getVector<std::string>( "image_sequence");
|
||||
int IMAGE_INDEX = color_db->getWithDefault<int>( "image_index", 0 );
|
||||
int IMAGE_COUNT = ImageList.size();
|
||||
std::string first_image = ImageList[IMAGE_INDEX];
|
||||
Mask->Decomp(first_image);
|
||||
IMAGE_INDEX++;
|
||||
|
@ -195,9 +194,9 @@ void ScaLBL_ColorModel::ReadInput(){
|
|||
// Read the local domain data
|
||||
auto input_id = readMicroCT( *domain_db, MPI_COMM_WORLD );
|
||||
// Fill the halo (assuming GCW of 1)
|
||||
array<int,3> size0 = { input_id.size(0), input_id.size(1), input_id.size(2) };
|
||||
ArraySize size1 = { Mask->Nx, Mask->Ny, Mask->Nz };
|
||||
ASSERT( size1[0] == size0[0]+2 && size1[1] == size0[1]+2 && size1[2] == size0[2]+2 );
|
||||
array<int,3> size0 = { (int) input_id.size(0), (int) input_id.size(1), (int) input_id.size(2) };
|
||||
ArraySize size1 = { (size_t) Mask->Nx, (size_t) Mask->Ny, (size_t) Mask->Nz };
|
||||
ASSERT( (int) size1[0] == size0[0]+2 && (int) size1[1] == size0[1]+2 && (int) size1[2] == size0[2]+2 );
|
||||
fillHalo<signed char> fill( MPI_COMM_WORLD, Mask->rank_info, size0, { 1, 1, 1 }, 0, 1 );
|
||||
Array<signed char> id_view;
|
||||
id_view.viewRaw( size1, Mask->id );
|
||||
|
@ -216,7 +215,6 @@ void ScaLBL_ColorModel::ReadInput(){
|
|||
// Generate the signed distance map
|
||||
// Initialize the domain and communication
|
||||
Array<char> id_solid(Nx,Ny,Nz);
|
||||
int count = 0;
|
||||
// Solve for the position of the solid phase
|
||||
for (int k=0;k<Nz;k++){
|
||||
for (int j=0;j<Ny;j++){
|
||||
|
@ -233,7 +231,6 @@ void ScaLBL_ColorModel::ReadInput(){
|
|||
for (int k=0;k<Nz;k++){
|
||||
for (int j=0;j<Ny;j++){
|
||||
for (int i=0;i<Nx;i++){
|
||||
int n=k*Nx*Ny+j*Nx+i;
|
||||
// Initialize distance to +/- 1
|
||||
Averages->SDs(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||
}
|
||||
|
@ -266,7 +263,7 @@ void ScaLBL_ColorModel::AssignComponentLabels(double *phase)
|
|||
double label_count_global[NLABELS];
|
||||
// Assign the labels
|
||||
|
||||
for (int idx=0; idx<NLABELS; idx++) label_count[idx]=0;
|
||||
for (size_t idx=0; idx<NLABELS; idx++) label_count[idx]=0;
|
||||
|
||||
for (int k=0;k<Nz;k++){
|
||||
for (int j=0;j<Ny;j++){
|
||||
|
@ -294,7 +291,8 @@ void ScaLBL_ColorModel::AssignComponentLabels(double *phase)
|
|||
// Set Dm to match Mask
|
||||
for (int i=0; i<Nx*Ny*Nz; i++) Dm->id[i] = Mask->id[i];
|
||||
|
||||
for (int idx=0; idx<NLABELS; idx++) label_count_global[idx]=sumReduce( Dm->Comm, label_count[idx]);
|
||||
for (size_t idx=0; idx<NLABELS; idx++)
|
||||
label_count_global[idx]=sumReduce( Dm->Comm, label_count[idx]);
|
||||
|
||||
if (rank==0){
|
||||
printf("Component labels: %lu \n",NLABELS);
|
||||
|
@ -373,16 +371,16 @@ void ScaLBL_ColorModel::Create(){
|
|||
}
|
||||
// check that TmpMap is valid
|
||||
for (int idx=0; idx<ScaLBL_Comm->LastExterior(); idx++){
|
||||
int n = TmpMap[idx];
|
||||
auto n = TmpMap[idx];
|
||||
if (n > Nx*Ny*Nz){
|
||||
printf("Bad value! idx=%i \n");
|
||||
printf("Bad value! idx=%i \n", n);
|
||||
TmpMap[idx] = Nx*Ny*Nz-1;
|
||||
}
|
||||
}
|
||||
for (int idx=ScaLBL_Comm->FirstInterior(); idx<ScaLBL_Comm->LastInterior(); idx++){
|
||||
int n = TmpMap[idx];
|
||||
if (n > Nx*Ny*Nz){
|
||||
printf("Bad value! idx=%i \n");
|
||||
auto n = TmpMap[idx];
|
||||
if ( n > Nx*Ny*Nz ){
|
||||
printf("Bad value! idx=%i \n",n);
|
||||
TmpMap[idx] = Nx*Ny*Nz-1;
|
||||
}
|
||||
}
|
||||
|
@ -553,8 +551,9 @@ void ScaLBL_ColorModel::Run(){
|
|||
}
|
||||
|
||||
if (color_db->keyExists( "residual_endpoint_threshold" )){
|
||||
RESIDUAL_ENDPOINT_THRESHOLD = color_db->getScalar<double>( "residual_endpoint_threshold" );
|
||||
RESIDUAL_ENDPOINT_THRESHOLD = color_db->getScalar<double>( "residual_endpoint_threshold" );
|
||||
}
|
||||
NULL_USE( RESIDUAL_ENDPOINT_THRESHOLD );
|
||||
if (color_db->keyExists( "noise_threshold" )){
|
||||
NOISE_THRESHOLD = color_db->getScalar<double>( "noise_threshold" );
|
||||
USE_BUMP_RATE = true;
|
||||
|
@ -874,7 +873,7 @@ void ScaLBL_ColorModel::Run(){
|
|||
WriteHeader=true;
|
||||
kr_log_file = fopen("relperm.csv","a");
|
||||
if (WriteHeader)
|
||||
fprintf(kr_log_file,"timesteps sat.water eff.perm.oil eff.perm.water eff.perm.oil.connected eff.perm.water.connected eff.perm.oil.disconnected eff.perm.water.disconnected cap.pressure cap.pressure.connected pressure.drop Ca M\n",CURRENT_STEADY_TIMESTEPS,current_saturation,kAeff,kBeff,pAB,viscous_pressure_drop,Ca,Mobility);
|
||||
fprintf(kr_log_file,"timesteps sat.water eff.perm.oil eff.perm.water eff.perm.oil.connected eff.perm.water.connected eff.perm.oil.disconnected eff.perm.water.disconnected cap.pressure cap.pressure.connected pressure.drop Ca M\n");
|
||||
|
||||
fprintf(kr_log_file,"%i %.5g %.5g %.5g %.5g %.5g %.5g %.5g %.5g %.5g %.5g %.5g %.5g\n",CURRENT_STEADY_TIMESTEPS,current_saturation,kAeff,kBeff,kAeff_connected,kBeff_connected,kAeff_disconnected,kBeff_disconnected,pAB,pAB_connected,viscous_pressure_drop,Ca,Mobility);
|
||||
fclose(kr_log_file);
|
||||
|
@ -937,7 +936,7 @@ void ScaLBL_ColorModel::Run(){
|
|||
else if (USE_SEED){
|
||||
delta_volume = volA*Dm->Volume - initial_volume;
|
||||
CURRENT_MORPH_TIMESTEPS += analysis_interval;
|
||||
double massChange = SeedPhaseField(seed_water);
|
||||
//double massChange = SeedPhaseField(seed_water);
|
||||
if (rank==0) printf("***Seed water in oil %f, volume change %f / %f ***\n", seed_water, delta_volume, delta_volume_target);
|
||||
}
|
||||
else if (USE_MORPHOPEN_OIL){
|
||||
|
@ -1010,7 +1009,6 @@ void ScaLBL_ColorModel::Run(){
|
|||
|
||||
double ScaLBL_ColorModel::ImageInit(std::string Filename){
|
||||
|
||||
bool suppress = false;
|
||||
if (rank==0) printf("Re-initializing fluids from file: %s \n", Filename.c_str());
|
||||
Mask->Decomp(Filename);
|
||||
for (int i=0; i<Nx*Ny*Nz; i++) id[i] = Mask->id[i]; // save what was read
|
||||
|
@ -1080,10 +1078,9 @@ double ScaLBL_ColorModel::MorphOpenConnected(double target_volume_change){
|
|||
ComputeGlobalBlobIDs(nx-2,ny-2,nz-2,Dm->rank_info,phase,Averages->SDs,vF,vS,phase_label,Dm->Comm);
|
||||
MPI_Barrier(Dm->Comm);
|
||||
|
||||
int count_oil=0;
|
||||
int count_connected=0;
|
||||
int count_porespace=0;
|
||||
int count_water=0;
|
||||
long long count_connected=0;
|
||||
long long count_porespace=0;
|
||||
long long count_water=0;
|
||||
for (int k=1; k<nz-1; k++){
|
||||
for (int j=1; j<ny-1; j++){
|
||||
for (int i=1; i<nx-1; i++){
|
||||
|
@ -1311,8 +1308,7 @@ double ScaLBL_ColorModel::MorphInit(const double beta, const double target_delta
|
|||
// 1. Copy phase field to CPU
|
||||
ScaLBL_CopyToHost(phase.data(), Phi, N*sizeof(double));
|
||||
|
||||
double count,count_global,volume_initial,volume_final,volume_connected;
|
||||
count = 0.f;
|
||||
double count = 0.f;
|
||||
for (int k=1; k<Nz-1; k++){
|
||||
for (int j=1; j<Ny-1; j++){
|
||||
for (int i=1; i<Nx-1; i++){
|
||||
|
@ -1320,7 +1316,7 @@ double ScaLBL_ColorModel::MorphInit(const double beta, const double target_delta
|
|||
}
|
||||
}
|
||||
}
|
||||
volume_initial = sumReduce( Dm->Comm, count);
|
||||
double volume_initial = sumReduce( Dm->Comm, count);
|
||||
/*
|
||||
sprintf(LocalRankFilename,"phi_initial.%05i.raw",rank);
|
||||
FILE *INPUT = fopen(LocalRankFilename,"wb");
|
||||
|
@ -1352,16 +1348,16 @@ double ScaLBL_ColorModel::MorphInit(const double beta, const double target_delta
|
|||
}
|
||||
}
|
||||
}
|
||||
volume_connected = sumReduce( Dm->Comm, count);
|
||||
double volume_connected = sumReduce( Dm->Comm, count);
|
||||
second_biggest = sumReduce( Dm->Comm, second_biggest);
|
||||
|
||||
int reach_x, reach_y, reach_z;
|
||||
/*int reach_x, reach_y, reach_z;
|
||||
for (int k=0; k<Nz; k++){
|
||||
for (int j=0; j<Ny; j++){
|
||||
for (int i=0; i<Nx; i++){
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// 3. Generate a distance map to the largest object -> phase_distance
|
||||
CalcDist(phase_distance,phase_id,*Dm);
|
||||
|
@ -1417,7 +1413,6 @@ double ScaLBL_ColorModel::MorphInit(const double beta, const double target_delta
|
|||
for (int k=0; k<Nz; k++){
|
||||
for (int j=0; j<Ny; j++){
|
||||
for (int i=0; i<Nx; i++){
|
||||
int n = k*Nx*Ny + j*Nx + i;
|
||||
double d = phase_distance(i,j,k);
|
||||
if (Averages->SDs(i,j,k) > 0.f){
|
||||
if (d < 3.f){
|
||||
|
@ -1441,7 +1436,7 @@ double ScaLBL_ColorModel::MorphInit(const double beta, const double target_delta
|
|||
}
|
||||
}
|
||||
}
|
||||
volume_final= sumReduce( Dm->Comm, count);
|
||||
double volume_final= sumReduce( Dm->Comm, count);
|
||||
|
||||
delta_volume = (volume_final-volume_initial);
|
||||
if (rank == 0) printf("MorphInit: change fluid volume fraction by %f \n", delta_volume/volume_initial);
|
||||
|
|
|
@ -114,7 +114,6 @@ void ScaLBL_DFHModel::SetDomain(){
|
|||
}
|
||||
|
||||
void ScaLBL_DFHModel::ReadInput(){
|
||||
size_t readID;
|
||||
//.......................................................................
|
||||
if (rank == 0) printf("Read input media... \n");
|
||||
//.......................................................................
|
||||
|
|
|
@ -94,7 +94,6 @@ void ScaLBL_MRTModel::SetDomain(){
|
|||
|
||||
void ScaLBL_MRTModel::ReadInput(){
|
||||
int rank=Dm->rank();
|
||||
size_t readID;
|
||||
//.......................................................................
|
||||
//.......................................................................
|
||||
Mask->ReadIDs();
|
||||
|
@ -106,7 +105,6 @@ void ScaLBL_MRTModel::ReadInput(){
|
|||
// Generate the signed distance map
|
||||
// Initialize the domain and communication
|
||||
Array<char> id_solid(Nx,Ny,Nz);
|
||||
int count = 0;
|
||||
// Solve for the position of the solid phase
|
||||
for (int k=0;k<Nz;k++){
|
||||
for (int j=0;j<Ny;j++){
|
||||
|
@ -122,7 +120,6 @@ void ScaLBL_MRTModel::ReadInput(){
|
|||
for (int k=0;k<Nz;k++){
|
||||
for (int j=0;j<Ny;j++){
|
||||
for (int i=0;i<Nx;i++){
|
||||
int n=k*Nx*Ny+j*Nx+i;
|
||||
// Initialize distance to +/- 1
|
||||
Distance(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||
}
|
||||
|
@ -191,7 +188,6 @@ void ScaLBL_MRTModel::Run(){
|
|||
double rlx_setB = 8.f*(2.f-rlx_setA)/(8.f-rlx_setA);
|
||||
|
||||
Minkowski Morphology(Mask);
|
||||
int SIZE=Np*sizeof(double);
|
||||
|
||||
if (rank==0){
|
||||
bool WriteHeader=false;
|
||||
|
|
|
@ -363,7 +363,7 @@ int main(int argc, char **argv)
|
|||
nspheres = domain_db->getScalar<int>( "nspheres");
|
||||
|
||||
//printf("Set domain \n");
|
||||
int BoundaryCondition=1;
|
||||
//int BoundaryCondition=1;
|
||||
//Nz += 2;
|
||||
//Nx = Ny = Nz; // Cubic domain
|
||||
int N = Nx*Ny*Nz;
|
||||
|
@ -396,7 +396,7 @@ int main(int argc, char **argv)
|
|||
int sum = 0;
|
||||
double sum_local;
|
||||
double iVol_global = 1.0/(1.0*(Nx-2)*(Ny-2)*(Nz-2)*nprocs);
|
||||
double porosity, pore_vol;
|
||||
double porosity;
|
||||
//...........................................................................
|
||||
DoubleArray SignDist(Nx,Ny,Nz);
|
||||
//.......................................................................
|
||||
|
@ -450,7 +450,6 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
sum=0;
|
||||
pore_vol = 0.0;
|
||||
for ( k=1;k<Nz-1;k++){
|
||||
for ( j=1;j<Ny-1;j++){
|
||||
for ( i=1;i<Nx-1;i++){
|
||||
|
|
|
@ -193,7 +193,7 @@ int main(int argc, char **argv)
|
|||
// char value;
|
||||
char *id;
|
||||
id = new char[N];
|
||||
double sum, sum_local;
|
||||
double sum;
|
||||
//...........................................................................
|
||||
if (rank == 0) cout << "Setting up bubble..." << endl;
|
||||
double BubbleRadius = 15.5; // Radius of the capillary tube
|
||||
|
@ -516,7 +516,7 @@ int main(int argc, char **argv)
|
|||
DoubleArray PhaseField(Nx,Ny,Nz);
|
||||
ScaLBL_Comm->RegularLayout(Map,Phi,PhaseField);
|
||||
FILE *OUTFILE;
|
||||
sprintf(LocalRankFilename,"Phase.raw",rank);
|
||||
sprintf(LocalRankFilename,"Phase.raw");
|
||||
OUTFILE = fopen(LocalRankFilename,"wb");
|
||||
fwrite(PhaseField.data(),8,N,OUTFILE);
|
||||
fclose(OUTFILE);
|
||||
|
|
|
@ -53,9 +53,6 @@ int main(int argc, char **argv)
|
|||
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("********************************************************\n");
|
||||
|
@ -64,7 +61,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
// Get the rank info
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
Nx += 2;
|
||||
Ny += 2;
|
||||
Nz += 2;
|
||||
|
@ -111,7 +108,6 @@ int main(int argc, char **argv)
|
|||
MPI_Barrier(comm);
|
||||
|
||||
//......................device distributions.................................
|
||||
int dist_mem_size = Np*sizeof(double);
|
||||
int neighborSize=18*Np*sizeof(int);
|
||||
if (rank==0) printf ("Allocating distributions \n");
|
||||
int *NeighborList;
|
||||
|
|
|
@ -49,7 +49,7 @@ extern void GlobalFlipScaLBL_D3Q19_Init(double *dist, IntArray Map, int Np, int
|
|||
{1,1,0},{-1,-1,0},{1,-1,0},{-1,1,0},{1,0,1},{-1,0,-1},{1,0,-1},{-1,0,1},
|
||||
{0,1,1},{0,-1,-1},{0,1,-1},{0,-1,1}};
|
||||
|
||||
int q,i,j,k,n,N;
|
||||
int q,i,j,k;
|
||||
int Cqx,Cqy,Cqz; // Discrete velocity
|
||||
int x,y,z; // Global indices
|
||||
int xn,yn,zn; // Global indices of neighbor
|
||||
|
@ -59,8 +59,6 @@ extern void GlobalFlipScaLBL_D3Q19_Init(double *dist, IntArray Map, int Np, int
|
|||
Y = Ny*nprocy;
|
||||
Z = Nz*nprocz;
|
||||
NULL_USE(Z);
|
||||
N = (Nx+2)*(Ny+2)*(Nz+2); // size of the array including halo
|
||||
|
||||
|
||||
for (k=0; k<Nz; k++){
|
||||
for (j=0; j<Ny; j++){
|
||||
|
@ -104,16 +102,13 @@ extern int GlobalCheckDebugDist(double *dist, IntArray Map, int Np, int Nx, int
|
|||
{
|
||||
|
||||
int returnValue = 0;
|
||||
int q,i,j,k,n,N,idx;
|
||||
int Cqx,Cqy,Cqz; // Discrete velocity
|
||||
int q,i,j,k,idx;
|
||||
int x,y,z; // Global indices
|
||||
int xn,yn,zn; // Global indices of neighbor
|
||||
int X,Y,Z; // Global size
|
||||
X = Nx*nprocx;
|
||||
Y = Ny*nprocy;
|
||||
Z = Nz*nprocz;
|
||||
NULL_USE(Z);
|
||||
N = (Nx+2)*(Ny+2)*(Nz+2); // size of the array including halo
|
||||
for (k=0; k<Nz; k++){
|
||||
for (j=0; j<Ny; j++){
|
||||
for (i=0; i<Nx; i++){
|
||||
|
@ -168,9 +163,6 @@ inline void UnpackID(int *list, int count, char *recvbuf, char *ID){
|
|||
//***************************************************************************************
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//*****************************************
|
||||
// ***** MPI STUFF ****************
|
||||
//*****************************************
|
||||
// Initialize MPI
|
||||
int rank,nprocs;
|
||||
MPI_Init(&argc,&argv);
|
||||
|
@ -178,10 +170,7 @@ int main(int argc, char **argv)
|
|||
MPI_Comm_rank(comm,&rank);
|
||||
MPI_Comm_size(comm,&nprocs);
|
||||
int check;
|
||||
|
||||
{
|
||||
MPI_Request req1[18],req2[18];
|
||||
MPI_Status stat1[18],stat2[18];
|
||||
|
||||
if (rank == 0){
|
||||
printf("********************************************************\n");
|
||||
|
@ -191,11 +180,8 @@ int main(int argc, char **argv)
|
|||
|
||||
// BGK Model parameters
|
||||
string FILENAME;
|
||||
unsigned int nBlocks, nthreads;
|
||||
int timestepMax, interval;
|
||||
double tau,Fx,Fy,Fz,tol;
|
||||
// Domain variables
|
||||
int i,j,k,n;
|
||||
int i,j,k;
|
||||
|
||||
// Load inputs
|
||||
auto db = loadInputs( nprocs );
|
||||
|
@ -223,8 +209,7 @@ int main(int argc, char **argv)
|
|||
char LocalRankFilename[40];
|
||||
sprintf(LocalRankFilename,"ID.%05i",rank);
|
||||
|
||||
char *id;
|
||||
id = new char[Nx*Ny*Nz];
|
||||
auto id = new char[Nx*Ny*Nz];
|
||||
|
||||
/* if (rank==0) printf("Assigning phase ID from file \n");
|
||||
if (rank==0) printf("Initialize from segmented data: solid=0, NWP=1, WP=2 \n");
|
||||
|
@ -237,7 +222,7 @@ int main(int argc, char **argv)
|
|||
for (k=0;k<Nz;k++){
|
||||
for (j=0;j<Ny;j++){
|
||||
for (i=0;i<Nx;i++){
|
||||
n = k*Nx*Ny+j*Nx+i;
|
||||
int n = k*Nx*Ny+j*Nx+i;
|
||||
id[n] = 1;
|
||||
Dm->id[n] = id[n];
|
||||
}
|
||||
|
@ -270,7 +255,7 @@ int main(int argc, char **argv)
|
|||
for (k=1;k<Nz-1;k++){
|
||||
for (j=1;j<Ny-1;j++){
|
||||
for (i=1;i<Nx-1;i++){
|
||||
n = k*Nx*Ny+j*Nx+i;
|
||||
int n = k*Nx*Ny+j*Nx+i;
|
||||
if (id[n] == component){
|
||||
sum_local+=1.0;
|
||||
}
|
||||
|
|
|
@ -32,21 +32,14 @@ int main (int argc, char **argv)
|
|||
}
|
||||
{
|
||||
int i,j,k,n,Np;
|
||||
bool pBC=true;
|
||||
double Lx,Ly,Lz;
|
||||
Lx = Ly = Lz = 1.f;
|
||||
double din,dout;
|
||||
int BC=1;
|
||||
|
||||
// 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];
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
|
||||
Nx += 2; Ny+=2; Nz += 2;
|
||||
Nx = Ny = Nz; // Cubic domain
|
||||
|
@ -55,8 +48,7 @@ int main (int argc, char **argv)
|
|||
//.......................................................................
|
||||
// Assign the phase ID
|
||||
//.......................................................................
|
||||
char *id;
|
||||
id = new char[N];
|
||||
auto id = new char[N];
|
||||
for (k=0;k<Nz;k++){
|
||||
for (j=0;j<Ny;j++){
|
||||
for (i=0;i<Nx;i++){
|
||||
|
@ -160,9 +152,7 @@ int main (int argc, char **argv)
|
|||
ScaLBL_DeviceBarrier(); MPI_Barrier(comm);
|
||||
ScaLBL_CopyToHost(&VEL[0],&dvc_vel[0],SIZE);
|
||||
|
||||
double err,value,Q;
|
||||
|
||||
Q = 0.f;
|
||||
double Q = 0.f;
|
||||
k=1;
|
||||
for (j=1;j<Ny-1;j++){
|
||||
for (i=1;i<Nx-1;i++){
|
||||
|
@ -176,7 +166,7 @@ int main (int argc, char **argv)
|
|||
|
||||
// respect backwards read / write!!!
|
||||
printf("Inlet Flux: input=%f, output=%f \n",flux,Q);
|
||||
err = fabs(flux + Q);
|
||||
double err = fabs(flux + Q);
|
||||
if (err > 1e-12){
|
||||
error = 1;
|
||||
printf(" Inlet error %f \n",err);
|
||||
|
@ -185,7 +175,7 @@ int main (int argc, char **argv)
|
|||
// Consider a larger number of timesteps and simulate flow
|
||||
double Fx, Fy, Fz;
|
||||
double tau = 1.0;
|
||||
double mu=(tau-0.5)/3.0;
|
||||
//double mu=(tau-0.5)/3.0;
|
||||
double rlx_setA=1.0/tau;
|
||||
double rlx_setB = 8.f*(2.f-rlx_setA)/(8.f-rlx_setA);
|
||||
dout=1.f;
|
||||
|
|
|
@ -457,24 +457,16 @@ int main (int argc, char **argv)
|
|||
double *x = new double[1];
|
||||
ASSERT(x!=NULL);
|
||||
}
|
||||
|
||||
// set the error code
|
||||
// Note: the error code should be consistent across all processors
|
||||
int error = 0;
|
||||
|
||||
int Np = 1;
|
||||
int Q = 9;
|
||||
//int Q = 9;
|
||||
|
||||
double Fx = 1.0;
|
||||
double Fy = 1.0;
|
||||
double Fz = 1.0;
|
||||
|
||||
double *dist;
|
||||
double * Velocity;
|
||||
|
||||
dist = new double [19*Np];
|
||||
Velocity = new double [3*Np];
|
||||
|
||||
auto dist = new double [19*Np];
|
||||
//auto Velocity = new double [3*Np
|
||||
|
||||
for (int n=0; n<Np; n++){
|
||||
dist[n] = 0.3333333333333333;
|
||||
|
|
|
@ -24,7 +24,7 @@ int main (int argc, char *argv[])
|
|||
MPI_Comm_rank(comm,&rank);
|
||||
MPI_Comm_size(comm,&nprocs);
|
||||
|
||||
int i,j,k,n;
|
||||
int i,j,k;
|
||||
|
||||
// Load inputs
|
||||
string FILENAME = argv[1];
|
||||
|
@ -36,7 +36,7 @@ int main (int argc, char *argv[])
|
|||
int Ny = domain_db->getVector<int>( "n" )[1];
|
||||
int Nz = domain_db->getVector<int>( "n" )[2];
|
||||
|
||||
std::shared_ptr<Domain> Dm(new Domain(domain_db,comm));
|
||||
auto Dm = std::make_shared<Domain>(domain_db,comm);
|
||||
|
||||
Nx+=2; Ny+=2; Nz+=2;
|
||||
|
||||
|
@ -44,7 +44,7 @@ int main (int argc, char *argv[])
|
|||
|
||||
Dm->CommInit();
|
||||
|
||||
std::shared_ptr<TwoPhase> Averages(new TwoPhase(Dm));
|
||||
auto Averages = std::make_shared<TwoPhase>(Dm);
|
||||
int timestep=0;
|
||||
|
||||
double Cx,Cy,Cz;
|
||||
|
|
|
@ -56,11 +56,7 @@ int main(int argc, char **argv)
|
|||
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];
|
||||
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
|
||||
Nx += 2;
|
||||
Ny += 2;
|
||||
|
|
|
@ -66,9 +66,6 @@ inline void InitializeBubble(ScaLBL_ColorModel &ColorModel, double BubbleRadius)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//*****************************************
|
||||
// ***** MPI STUFF ****************
|
||||
//*****************************************
|
||||
// Initialize MPI
|
||||
int rank,nprocs;
|
||||
MPI_Init(&argc,&argv);
|
||||
|
@ -76,19 +73,6 @@ int main(int argc, char **argv)
|
|||
MPI_Comm_rank(comm,&rank);
|
||||
MPI_Comm_size(comm,&nprocs);
|
||||
// parallel domain size (# of sub-domains)
|
||||
int nprocx,nprocy,nprocz;
|
||||
int iproc,jproc,kproc;
|
||||
int sendtag,recvtag;
|
||||
//*****************************************
|
||||
// MPI ranks for all 18 neighbors
|
||||
//**********************************
|
||||
int rank_x,rank_y,rank_z,rank_X,rank_Y,rank_Z;
|
||||
int rank_xy,rank_XY,rank_xY,rank_Xy;
|
||||
int rank_xz,rank_XZ,rank_xZ,rank_Xz;
|
||||
int rank_yz,rank_YZ,rank_yZ,rank_Yz;
|
||||
//**********************************
|
||||
MPI_Request req1[18],req2[18];
|
||||
MPI_Status stat1[18],stat2[18];
|
||||
|
||||
if (rank == 0){
|
||||
printf("********************************************************\n");
|
||||
|
@ -110,7 +94,6 @@ int main(int argc, char **argv)
|
|||
Ny = CM.Ny;
|
||||
Nz = CM.Nz;
|
||||
N = Nx*Ny*Nz;
|
||||
int dist_mem_size = N*sizeof(double);
|
||||
|
||||
//CM.ReadInput();
|
||||
double radius=0.4*double(Nx);
|
||||
|
@ -142,11 +125,9 @@ int main(int argc, char **argv)
|
|||
CM.Run();
|
||||
int D3Q7[7][3]={{0,0,0},{1,0,0},{-1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0,-1}};
|
||||
// Compare and make sure mass is conserved at every lattice site
|
||||
double *Error;
|
||||
Error = new double [N];
|
||||
double *A_q, *B_q;
|
||||
A_q = new double [7*Np];
|
||||
B_q = new double [7*Np];
|
||||
auto Error = new double[N];
|
||||
auto A_q = new double[7*Np];
|
||||
//auto B_q = new double[7*Np];
|
||||
bool CleanCheck = true;
|
||||
double original,final, sum_q;
|
||||
double total_mass_A_0 = 0.0;
|
||||
|
|
|
@ -14,7 +14,6 @@ void load( const std::string& );
|
|||
void test_NETCDF( UnitTest& ut )
|
||||
{
|
||||
const int rank = comm_rank( MPI_COMM_WORLD );
|
||||
const int size = comm_size( MPI_COMM_WORLD );
|
||||
int nprocx = 2;
|
||||
int nprocy = 2;
|
||||
int nprocz = 2;
|
||||
|
|
|
@ -60,13 +60,11 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
// Get the rank info
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
// const RankInfoStruct rank_info(rank,nprocx,nprocy,nprocz);
|
||||
std::shared_ptr<SubPhase> Averages(new SubPhase(Dm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
auto Averages = std::make_shared<SubPhase>(Dm);
|
||||
Nx += 2;
|
||||
Ny += 2;
|
||||
Nz += 2;
|
||||
int N = Nx*Ny*Nz;
|
||||
//.......................................................................
|
||||
for ( k=1;k<Nz-1;k++){
|
||||
for ( j=1;j<Ny-1;j++){
|
||||
|
|
|
@ -60,12 +60,11 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
// Get the rank info
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
|
||||
Nx += 2;
|
||||
Ny += 2;
|
||||
Nz += 2;
|
||||
int N = Nx*Ny*Nz;
|
||||
//.......................................................................
|
||||
for ( k=1;k<Nz-1;k++){
|
||||
for ( j=1;j<Ny-1;j++){
|
||||
|
|
|
@ -60,13 +60,12 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
// Get the rank info
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
// const RankInfoStruct rank_info(rank,nprocx,nprocy,nprocz);
|
||||
std::shared_ptr<TwoPhase> Averages(new TwoPhase(Dm));
|
||||
auto Averages = std::make_shared<TwoPhase>(Dm);
|
||||
Nx += 2;
|
||||
Ny += 2;
|
||||
Nz += 2;
|
||||
int N = Nx*Ny*Nz;
|
||||
//.......................................................................
|
||||
for ( k=1;k<Nz-1;k++){
|
||||
for ( j=1;j<Ny-1;j++){
|
||||
|
@ -142,7 +141,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
double beta = 0.95;
|
||||
//double beta = 0.95;
|
||||
if (rank==0) printf("initializing the system \n");
|
||||
|
||||
Averages->UpdateSolid();
|
||||
|
|
|
@ -60,12 +60,11 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
// Get the rank info
|
||||
std::shared_ptr<Domain> Dm(new Domain(db,comm));
|
||||
auto Dm = std::make_shared<Domain>(db,comm);
|
||||
|
||||
Nx += 2;
|
||||
Ny += 2;
|
||||
Nz += 2;
|
||||
int N = Nx*Ny*Nz;
|
||||
//.......................................................................
|
||||
for ( k=1;k<Nz-1;k++){
|
||||
for ( j=1;j<Ny-1;j++){
|
||||
|
@ -98,14 +97,13 @@ int main(int argc, char **argv)
|
|||
//.......................................................................
|
||||
// Assign the phase ID field based and the signed distance
|
||||
//.......................................................................
|
||||
double R1,R2,R;
|
||||
double CX,CY,CZ; //CY1,CY2;
|
||||
CX=Nx*nprocx*0.5;
|
||||
CY=Ny*nprocy*0.5;
|
||||
CZ=Nz*nprocz*0.5;
|
||||
R1 = (Nx-2)*nprocx*0.3; // middle radius
|
||||
R2 = (Nx-2)*nprocx*0.1; // donut thickness
|
||||
R = 0.4*nprocx*(Nx-2);
|
||||
auto R1 = (Nx-2)*nprocx*0.3; // middle radius
|
||||
auto R2 = (Nx-2)*nprocx*0.1; // donut thickness
|
||||
//auto R = 0.4*nprocx*(Nx-2);
|
||||
|
||||
Minkowski Object(Dm);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ int main(int argc, char **argv)
|
|||
//.......................................................................
|
||||
int n, nx, ny, nz;
|
||||
char LocalRankFilename[40];
|
||||
char FILENAME[128];
|
||||
|
||||
string filename;
|
||||
double SW;
|
||||
|
@ -239,10 +238,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
MPI_Barrier(comm);
|
||||
|
||||
sprintf(FILENAME,READFILE.c_str());
|
||||
sprintf(FILENAME+strlen(FILENAME),".morph.raw");
|
||||
if (rank==0) printf("Writing file to: %s \n", FILENAME);
|
||||
Mask->AggregateLabels(FILENAME);
|
||||
auto filename2 = READFILE + ".morph.raw";
|
||||
if (rank==0) printf("Writing file to: %s \n", filename2.c_str());
|
||||
Mask->AggregateLabels(filename2);
|
||||
}
|
||||
|
||||
MPI_Barrier(comm);
|
||||
|
|
|
@ -32,10 +32,7 @@ int main(int argc, char **argv)
|
|||
//.......................................................................
|
||||
// Reading the domain information file
|
||||
//.......................................................................
|
||||
int n, nprocx, nprocy, nprocz, nx, ny, nz;
|
||||
char LocalRankString[8];
|
||||
char LocalRankFilename[40];
|
||||
char FILENAME[128];
|
||||
|
||||
string filename;
|
||||
double SW,Rcrit_new;
|
||||
|
@ -43,8 +40,10 @@ int main(int argc, char **argv)
|
|||
filename=argv[1];
|
||||
Rcrit_new=0.f;
|
||||
//SW=strtod(argv[2],NULL);
|
||||
}
|
||||
else ERROR("No input database provided\n");
|
||||
} else {
|
||||
ERROR("No input database provided\n");
|
||||
}
|
||||
NULL_USE( Rcrit_new );
|
||||
// read the input database
|
||||
auto db = std::make_shared<Database>( filename );
|
||||
auto domain_db = db->getDatabase( "Domain" );
|
||||
|
@ -62,19 +61,16 @@ int main(int argc, char **argv)
|
|||
if (rank==0) printf("Performing morphological opening with target saturation %f \n", SW);
|
||||
// GenerateResidual(id,nx,ny,nz,Saturation);
|
||||
|
||||
nx = size[0];
|
||||
ny = size[1];
|
||||
nz = size[2];
|
||||
nprocx = nproc[0];
|
||||
nprocy = nproc[1];
|
||||
nprocz = nproc[2];
|
||||
int nx = size[0];
|
||||
int ny = size[1];
|
||||
int nz = size[2];
|
||||
|
||||
int N = (nx+2)*(ny+2)*(nz+2);
|
||||
size_t N = (nx+2)*(ny+2)*(nz+2);
|
||||
|
||||
std::shared_ptr<Domain> Dm (new Domain(domain_db,comm));
|
||||
std::shared_ptr<Domain> Mask (new Domain(domain_db,comm));
|
||||
// std::shared_ptr<Domain> Dm (new Domain(nx,ny,nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BC));
|
||||
for (n=0; n<N; n++) Dm->id[n]=1;
|
||||
for (size_t n=0; n<N; n++) Dm->id[n]=1;
|
||||
Dm->CommInit();
|
||||
|
||||
signed char *id;
|
||||
|
@ -116,7 +112,6 @@ int main(int argc, char **argv)
|
|||
for (int k=0;k<nz;k++){
|
||||
for (int j=0;j<ny;j++){
|
||||
for (int i=0;i<nx;i++){
|
||||
int n = k*nx*ny+j*nx+i;
|
||||
// Initialize distance to +/- 1
|
||||
SignDist(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||
}
|
||||
|
@ -158,7 +153,6 @@ int main(int argc, char **argv)
|
|||
for (int k=0;k<nz;k++){
|
||||
for (int j=0;j<ny;j++){
|
||||
for (int i=0;i<nx;i++){
|
||||
int n = k*nx*ny+j*nx+i;
|
||||
// Initialize distance to +/- 1
|
||||
SignDist(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||
}
|
||||
|
@ -204,10 +198,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
MPI_Barrier(comm);
|
||||
|
||||
sprintf(FILENAME,READFILE.c_str());
|
||||
sprintf(FILENAME+strlen(FILENAME),".morphdrain.raw");
|
||||
if (rank==0) printf("Writing file to: %s \n", FILENAME);
|
||||
Mask->AggregateLabels(FILENAME);
|
||||
auto filename2 = READFILE + ".morphdrain.raw";
|
||||
if (rank==0) printf("Writing file to: %s \n", filename2.data() );
|
||||
Mask->AggregateLabels( filename2 );
|
||||
}
|
||||
|
||||
MPI_Barrier(comm);
|
||||
|
|
|
@ -32,10 +32,7 @@ int main(int argc, char **argv)
|
|||
//.......................................................................
|
||||
// Reading the domain information file
|
||||
//.......................................................................
|
||||
int n, nprocx, nprocy, nprocz, nx, ny, nz;
|
||||
char LocalRankString[8];
|
||||
char LocalRankFilename[40];
|
||||
char FILENAME[128];
|
||||
|
||||
string filename;
|
||||
double SW,Rcrit_new;
|
||||
|
@ -45,6 +42,7 @@ int main(int argc, char **argv)
|
|||
//SW=strtod(argv[2],NULL);
|
||||
}
|
||||
else ERROR("No input database provided\n");
|
||||
NULL_USE( Rcrit_new );
|
||||
// read the input database
|
||||
auto db = std::make_shared<Database>( filename );
|
||||
auto domain_db = db->getDatabase( "Domain" );
|
||||
|
@ -69,19 +67,16 @@ int main(int argc, char **argv)
|
|||
if (rank==0) printf("Performing morphological opening with target saturation %f \n", SW);
|
||||
// GenerateResidual(id,nx,ny,nz,Saturation);
|
||||
|
||||
nx = size[0];
|
||||
ny = size[1];
|
||||
nz = size[2];
|
||||
nprocx = nproc[0];
|
||||
nprocy = nproc[1];
|
||||
nprocz = nproc[2];
|
||||
int nx = size[0];
|
||||
int ny = size[1];
|
||||
int nz = size[2];
|
||||
|
||||
int N = (nx+2)*(ny+2)*(nz+2);
|
||||
size_t N = (nx+2)*(ny+2)*(nz+2);
|
||||
|
||||
std::shared_ptr<Domain> Dm (new Domain(domain_db,comm));
|
||||
std::shared_ptr<Domain> Mask (new Domain(domain_db,comm));
|
||||
// std::shared_ptr<Domain> Dm (new Domain(nx,ny,nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BC));
|
||||
for (n=0; n<N; n++) Dm->id[n]=1;
|
||||
for (size_t n=0; n<N; n++) Dm->id[n]=1;
|
||||
Dm->CommInit();
|
||||
|
||||
signed char *id;
|
||||
|
@ -119,7 +114,6 @@ int main(int argc, char **argv)
|
|||
for (int k=0;k<nz;k++){
|
||||
for (int j=0;j<ny;j++){
|
||||
for (int i=0;i<nx;i++){
|
||||
int n = k*nx*ny+j*nx+i;
|
||||
// Initialize distance to +/- 1
|
||||
SignDist(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||
}
|
||||
|
@ -161,7 +155,6 @@ int main(int argc, char **argv)
|
|||
for (int k=0;k<nz;k++){
|
||||
for (int j=0;j<ny;j++){
|
||||
for (int i=0;i<nx;i++){
|
||||
int n = k*nx*ny+j*nx+i;
|
||||
// Initialize distance to +/- 1
|
||||
SignDist(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||
}
|
||||
|
@ -207,10 +200,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
MPI_Barrier(comm);
|
||||
|
||||
sprintf(FILENAME,READFILE.c_str());
|
||||
sprintf(FILENAME+strlen(FILENAME),".morphopen.raw");
|
||||
if (rank==0) printf("Writing file to: %s \n", FILENAME);
|
||||
Mask->AggregateLabels(FILENAME);
|
||||
auto filename2 = READFILE + ".morphopen.raw";
|
||||
if (rank==0) printf("Writing file to: %s \n", filename2.data());
|
||||
Mask->AggregateLabels(filename2);
|
||||
}
|
||||
|
||||
MPI_Barrier(comm);
|
||||
|
|
|
@ -23,9 +23,6 @@ using namespace std;
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//*****************************************
|
||||
// ***** MPI STUFF ****************
|
||||
//*****************************************
|
||||
// Initialize MPI
|
||||
int rank,nprocs;
|
||||
MPI_Init(&argc,&argv);
|
||||
|
@ -33,10 +30,6 @@ int main(int argc, char **argv)
|
|||
MPI_Comm_rank(comm,&rank);
|
||||
MPI_Comm_size(comm,&nprocs);
|
||||
{
|
||||
// parallel domain size (# of sub-domains)
|
||||
int nprocx,nprocy,nprocz;
|
||||
int iproc,jproc,kproc;
|
||||
|
||||
if (rank == 0){
|
||||
printf("********************************************************\n");
|
||||
printf("Running Single Phase Permeability Calculation \n");
|
||||
|
@ -44,10 +37,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
// Initialize compute device
|
||||
int device=ScaLBL_SetDevice(rank);
|
||||
NULL_USE( device );
|
||||
ScaLBL_DeviceBarrier();
|
||||
MPI_Barrier(comm);
|
||||
|
||||
|
||||
ScaLBL_MRTModel MRT(rank,nprocs,comm);
|
||||
auto filename = argv[1];
|
||||
MRT.ReadParams(filename);
|
||||
|
|
|
@ -26,10 +26,9 @@ int main(int argc, char **argv)
|
|||
//.......................................................................
|
||||
// Reading the domain information file
|
||||
//.......................................................................
|
||||
int nprocx, nprocy, nprocz, nx, ny, nz, nspheres;
|
||||
double Lx, Ly, Lz;
|
||||
Lx = Ly = Lz = 1.0;
|
||||
int i,j,k,n;
|
||||
int BC=0;
|
||||
|
||||
string filename;
|
||||
if (argc > 1){
|
||||
|
@ -47,12 +46,12 @@ int main(int argc, char **argv)
|
|||
auto ReadValues = domain_db->getVector<char>( "ReadValues" );
|
||||
auto WriteValues = domain_db->getVector<char>( "WriteValues" );
|
||||
|
||||
nx = size[0];
|
||||
ny = size[1];
|
||||
nz = size[2];
|
||||
nprocx = nproc[0];
|
||||
nprocy = nproc[1];
|
||||
nprocz = nproc[2];
|
||||
int nx = size[0];
|
||||
int ny = size[1];
|
||||
int nz = size[2];
|
||||
int nprocx = nproc[0];
|
||||
int nprocy = nproc[1];
|
||||
int nprocz = nproc[2];
|
||||
|
||||
// Check that the number of processors >= the number of ranks
|
||||
if ( rank==0 ) {
|
||||
|
@ -66,10 +65,9 @@ int main(int argc, char **argv)
|
|||
|
||||
char LocalRankFilename[40];
|
||||
|
||||
int rnx,rny,rnz;
|
||||
rnx=2*nx;
|
||||
rny=2*ny;
|
||||
rnz=2*nz;
|
||||
int rnx=2*nx;
|
||||
int rny=2*ny;
|
||||
int rnz=2*nz;
|
||||
|
||||
if (rank==0) printf("Refining mesh to %i x %i x %i \n",rnx,rny,rnz);
|
||||
|
||||
|
@ -128,13 +126,12 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
int ri,rj,rk,rn; //refined mesh indices
|
||||
//char *RefineLabel;
|
||||
//RefineLabel = new char [rnx*rny*rnz];
|
||||
Array <char> RefineLabel(rnx,rny,rnz);
|
||||
for (rk=1; rk<rnz-1; rk++){
|
||||
for (rj=1; rj<rny-1; rj++){
|
||||
for (ri=1; ri<rnx-1; ri++){
|
||||
for (int rk=1; rk<rnz-1; rk++){
|
||||
for (int rj=1; rj<rny-1; rj++){
|
||||
for (int ri=1; ri<rnx-1; ri++){
|
||||
n = rk*rnx*rny+rj*rnx+ri;
|
||||
// starting node for each processor matches exactly
|
||||
i = (ri-1)/2+1;
|
||||
|
|
|
@ -47,11 +47,7 @@ int main(int argc, char **argv)
|
|||
//.......................................................................
|
||||
// Reading the domain information file
|
||||
//.......................................................................
|
||||
int nprocs, nprocx, nprocy, nprocz, nx, ny, nz, nspheres;
|
||||
double Lx, Ly, Lz;
|
||||
int64_t Nx,Ny,Nz;
|
||||
int64_t i,j,k,n;
|
||||
int BC=0;
|
||||
int64_t xStart,yStart,zStart;
|
||||
int checkerSize;
|
||||
int inlet_count_x, inlet_count_y, inlet_count_z;
|
||||
|
@ -112,25 +108,25 @@ int main(int argc, char **argv)
|
|||
ReadType = "8bit";
|
||||
}
|
||||
|
||||
nx = size[0];
|
||||
ny = size[1];
|
||||
nz = size[2];
|
||||
nprocx = nproc[0];
|
||||
nprocy = nproc[1];
|
||||
nprocz = nproc[2];
|
||||
Nx = SIZE[0];
|
||||
Ny = SIZE[1];
|
||||
Nz = SIZE[2];
|
||||
int nx = size[0];
|
||||
int ny = size[1];
|
||||
int nz = size[2];
|
||||
int nprocx = nproc[0];
|
||||
int nprocy = nproc[1];
|
||||
int nprocz = nproc[2];
|
||||
long int Nx = SIZE[0];
|
||||
long int Ny = SIZE[1];
|
||||
long int Nz = SIZE[2];
|
||||
|
||||
printf("Input media: %s\n",Filename.c_str());
|
||||
printf("Relabeling %lu values\n",ReadValues.size());
|
||||
for (int idx=0; idx<ReadValues.size(); idx++){
|
||||
for (size_t idx=0; idx<ReadValues.size(); idx++){
|
||||
int oldvalue=ReadValues[idx];
|
||||
int newvalue=WriteValues[idx];
|
||||
printf("oldvalue=%d, newvalue =%d \n",oldvalue,newvalue);
|
||||
}
|
||||
|
||||
nprocs=nprocx*nprocy*nprocz;
|
||||
int nprocs=nprocx*nprocy*nprocz;
|
||||
|
||||
char *SegData = NULL;
|
||||
// Rank=0 reads the entire segmented data and distributes to worker processes
|
||||
|
@ -172,7 +168,7 @@ int main(int argc, char **argv)
|
|||
n = k*Nx*Ny+j*Nx+i;
|
||||
//char locval = loc_id[n];
|
||||
char locval = SegData[n];
|
||||
for (int idx=0; idx<ReadValues.size(); idx++){
|
||||
for (size_t idx=0; idx<ReadValues.size(); idx++){
|
||||
signed char oldvalue=ReadValues[idx];
|
||||
signed char newvalue=WriteValues[idx];
|
||||
if (locval == oldvalue){
|
||||
|
@ -185,10 +181,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
if (rank==0){
|
||||
for (int idx=0; idx<ReadValues.size(); idx++){
|
||||
for (size_t idx=0; idx<ReadValues.size(); idx++){
|
||||
long int label=ReadValues[idx];
|
||||
long int count=LabelCount[idx];
|
||||
printf("Label=%d, Count=%d \n",label,count);
|
||||
printf("Label=%ld, Count=%ld \n",label,count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +211,7 @@ int main(int argc, char **argv)
|
|||
printf("Checkerboard pattern at y inlet for %i layers \n",inlet_count_y);
|
||||
// use checkerboard pattern
|
||||
for (int k = 0; k<Nz; k++){
|
||||
for (int j = yStart; i < yStart+inlet_count_y; j++){
|
||||
for (int j = yStart; j < yStart+inlet_count_y; j++){
|
||||
for (int i = 0; i<Nx; i++){
|
||||
if ( (i/checkerSize + k/checkerSize)%2 == 0){
|
||||
// void checkers
|
||||
|
@ -272,7 +268,7 @@ int main(int argc, char **argv)
|
|||
printf("Checkerboard pattern at y outlet for %i layers \n",outlet_count_y);
|
||||
// use checkerboard pattern
|
||||
for (int k = 0; k<Nz; k++){
|
||||
for (int j = yStart + ny*nprocy - outlet_count_y; i < yStart + ny*nprocy; j++){
|
||||
for (int j = yStart + ny*nprocy - outlet_count_y; j < yStart + ny*nprocy; j++){
|
||||
for (int i = 0; i<Nx; i++){
|
||||
if ( (i/checkerSize + k/checkerSize)%2 == 0){
|
||||
// void checkers
|
||||
|
@ -306,9 +302,6 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
// Get the rank info
|
||||
int64_t N = (nx+2)*(ny+2)*(nz+2);
|
||||
|
||||
// number of sites to use for periodic boundary condition transition zone
|
||||
int64_t z_transition_size = (nprocz*nz - (Nz - zStart))/2;
|
||||
if (z_transition_size < 0) z_transition_size=0;
|
||||
|
|
|
@ -61,7 +61,7 @@ int main(int argc, char **argv)
|
|||
auto L = domain_db->getVector<double>( "L" );
|
||||
auto size = domain_db->getVector<int>( "n" );
|
||||
auto nproc = domain_db->getVector<int>( "nproc" );
|
||||
int BoundaryCondition = domain_db->getScalar<int>( "BC" );
|
||||
//int BoundaryCondition = domain_db->getScalar<int>( "BC" );
|
||||
int nx = size[0];
|
||||
int ny = size[1];
|
||||
int nz = size[2];
|
||||
|
@ -91,10 +91,10 @@ int main(int argc, char **argv)
|
|||
printf("Number of MPI ranks required: %i \n", nprocx*nprocy*nprocz);
|
||||
printf("Number of MPI ranks used: %i \n", nprocs);
|
||||
printf("Full domain size: %i x %i x %i \n",nx*nprocx,ny*nprocy,nz*nprocz);
|
||||
printf("target value = %f \n",target);
|
||||
printf("background value = %f \n",background);
|
||||
printf("cylinder center = %i, %i, %i \n",center[0],center[1],center[2]);
|
||||
printf("cylinder radius = %f \n",CylRad);
|
||||
printf("target value = %f \n",target);
|
||||
printf("background value = %f \n",background);
|
||||
printf("cylinder center = %i, %i, %i \n",center[0],center[1],center[2]);
|
||||
printf("cylinder radius = %f \n",CylRad);
|
||||
}
|
||||
if ( nprocs < nprocx*nprocy*nprocz ){
|
||||
ERROR("Insufficient number of processors");
|
||||
|
@ -196,19 +196,19 @@ int main(int argc, char **argv)
|
|||
filter_src( *Dm[0], LOCVOL[0] );
|
||||
|
||||
// Set up the mask to be distance to cylinder (crop outside cylinder)
|
||||
if (rank==0) printf("Cropping with cylinder: %i, %i, %i, radius=%f \n",Dm[0]->nprocx()*Nx[0],Dm[0]->nprocy()*Ny[0],Dm[0]->nprocz()*Nz[0],CylRad);
|
||||
if (rank==0) printf("Cropping with cylinder: %i, %i, %i, radius=%f \n",Dm[0]->nprocx()*Nx[0],Dm[0]->nprocy()*Ny[0],Dm[0]->nprocz()*Nz[0],CylRad);
|
||||
for (int k=0;k<Nz[0]+2;k++) {
|
||||
for (int j=0;j<Ny[0]+2;j++) {
|
||||
for (int i=0;i<Nx[0]+2;i++) {
|
||||
float x= float(Dm[0]->iproc()*Nx[0]+i-1);
|
||||
float y= float (Dm[0]->jproc()*Ny[0]+j-1);
|
||||
float z= float(Dm[0]->kproc()*Nz[0]+k-1);
|
||||
float cx = float(center[0] - offset[0]);
|
||||
float cy = float(center[1] - offset[1]);
|
||||
float cz = float(center[2] - offset[2]);
|
||||
//float x= float(Dm[0]->iproc()*Nx[0]+i-1);
|
||||
float y= float (Dm[0]->jproc()*Ny[0]+j-1);
|
||||
float z= float(Dm[0]->kproc()*Nz[0]+k-1);
|
||||
//float cx = float(center[0] - offset[0]);
|
||||
float cy = float(center[1] - offset[1]);
|
||||
float cz = float(center[2] - offset[2]);
|
||||
// distance from the center line
|
||||
MASK(i,j,k) = sqrt((z-cz)*(z-cz) + (y-cy)*(y-cy));
|
||||
//if (sqrt(((z-cz)*(z-cz) + (y-cy)*(y-cy)) ) > CylRad) LOCVOL[0](i,j,k)=background;
|
||||
//if (sqrt(((z-cz)*(z-cz) + (y-cy)*(y-cy)) ) > CylRad) LOCVOL[0](i,j,k)=background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,18 +219,18 @@ int main(int argc, char **argv)
|
|||
float THRESHOLD=0.5*(target+background);
|
||||
float mean_plus=0;
|
||||
float mean_minus=0;
|
||||
float min_value = LOCVOL[0](0);
|
||||
float max_value = LOCVOL[0](0);
|
||||
float min_value = LOCVOL[0](0);
|
||||
float max_value = LOCVOL[0](0);
|
||||
int count_plus=0;
|
||||
int count_minus=0;
|
||||
for (int k=1;k<Nz[0]+1;k++) {
|
||||
for (int j=1;j<Ny[0]+1;j++) {
|
||||
for (int i=1;i<Nx[0]+1;i++) {
|
||||
|
||||
|
||||
//LOCVOL[0](i,j,k) = MASK(i,j,k);
|
||||
|
||||
//LOCVOL[0](i,j,k) = MASK(i,j,k);
|
||||
if (MASK(i,j,k) < CylRad ){
|
||||
auto tmp = LOCVOL[0](i,j,k);
|
||||
auto tmp = LOCVOL[0](i,j,k);
|
||||
/* if ((tmp-background)*(tmp-target) > 0){
|
||||
// direction to background / target is the same
|
||||
if (fabs(tmp-target) > fabs(tmp-background)) tmp=background; // tmp closer to background
|
||||
|
@ -241,20 +241,20 @@ int main(int argc, char **argv)
|
|||
mean_plus += tmp;
|
||||
count_plus++;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
mean_minus += tmp;
|
||||
count_minus++;
|
||||
}
|
||||
if (tmp < min_value) min_value = tmp;
|
||||
if (tmp > max_value) max_value = tmp;
|
||||
}
|
||||
if (tmp < min_value) min_value = tmp;
|
||||
if (tmp > max_value) max_value = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
count_plus=sumReduce( Dm[0]->Comm, count_plus);
|
||||
count_minus=sumReduce( Dm[0]->Comm, count_minus);
|
||||
if (rank==0) printf("minimum value=%f, max value=%f \n",min_value,max_value);
|
||||
if (rank==0) printf("plus=%i, minus=%i \n",count_plus,count_minus);
|
||||
count_plus=sumReduce( Dm[0]->Comm, count_plus);
|
||||
count_minus=sumReduce( Dm[0]->Comm, count_minus);
|
||||
if (rank==0) printf("minimum value=%f, max value=%f \n",min_value,max_value);
|
||||
if (rank==0) printf("plus=%i, minus=%i \n",count_plus,count_minus);
|
||||
ASSERT( count_plus > 0 && count_minus > 0 );
|
||||
MPI_Barrier(comm);
|
||||
mean_plus = sumReduce( Dm[0]->Comm, mean_plus ) / count_plus;
|
||||
|
@ -262,25 +262,25 @@ int main(int argc, char **argv)
|
|||
MPI_Barrier(comm);
|
||||
if (rank==0) printf(" Region 1 mean (+): %f, Region 2 mean (-): %f \n",mean_plus, mean_minus);
|
||||
|
||||
//if (rank==0) printf("Scale the input data (size = %i) \n",LOCVOL[0].length());
|
||||
//if (rank==0) printf("Scale the input data (size = %i) \n",LOCVOL[0].length());
|
||||
for (size_t i=0; i<LOCVOL[0].length(); i++) {
|
||||
if ( MASK(i) > CylRad ){
|
||||
LOCVOL[0](i)=background;
|
||||
if ( MASK(i) > CylRad ){
|
||||
LOCVOL[0](i)=background;
|
||||
}
|
||||
if ( LOCVOL[0](i) >= THRESHOLD ) {
|
||||
auto tmp = LOCVOL[0](i)/ mean_plus;
|
||||
LOCVOL[0](i) = std::min( tmp, 1.0f );
|
||||
}
|
||||
else {
|
||||
else {
|
||||
auto tmp = -LOCVOL[0](i)/mean_minus;
|
||||
LOCVOL[0](i) = std::max( tmp, -1.0f );
|
||||
}
|
||||
//LOCVOL[0](i) = MASK(i);
|
||||
//LOCVOL[0](i) = MASK(i);
|
||||
}
|
||||
|
||||
// Fill the source data for the coarse meshes
|
||||
if (rank==0) printf("Coarsen the mesh for N_levels=%i \n",N_levels);
|
||||
MPI_Barrier(comm);
|
||||
if (rank==0) printf("Coarsen the mesh for N_levels=%i \n",N_levels);
|
||||
MPI_Barrier(comm);
|
||||
PROFILE_START("CoarsenMesh");
|
||||
for (int i=1; i<N_levels; i++) {
|
||||
Array<float> filter(ratio[0],ratio[1],ratio[2]);
|
||||
|
|
|
@ -11,17 +11,11 @@
|
|||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
|
||||
// printf("Radius = %s \n,"RADIUS);
|
||||
int SIZE = N*N*N;
|
||||
int Nx,Ny,Nz;
|
||||
Nx = Ny = Nz = N;
|
||||
int i,j,k,p,q,r;
|
||||
|
||||
// double *Solid; // cylinder
|
||||
// double *Phase; // region of the cylinder
|
||||
// Solid = new double [SIZE];
|
||||
// Phase = new double [SIZE];
|
||||
DoubleArray SignDist(Nx,Ny,Nz);
|
||||
DoubleArray Phase(Nx,Ny,Nz);
|
||||
double fluid_isovalue = 0.0;
|
||||
|
@ -36,9 +30,6 @@ int main (int argc, char **argv)
|
|||
//...........................................................................
|
||||
double awn,ans,aws,lwns,nwp_volume;
|
||||
double As;
|
||||
double dEs,dAwn,dAns; // Global surface energy (calculated by rank=0)
|
||||
double awn_global,ans_global,aws_global,lwns_global,nwp_volume_global;
|
||||
double As_global;
|
||||
// bool add=1; // Set to false if any corners contain nw-phase ( F > fluid_isovalue)
|
||||
int cube[8][3] = {{0,0,0},{1,0,0},{0,1,0},{1,1,0},{0,0,1},{1,0,1},{0,1,1},{1,1,1}}; // cube corners
|
||||
// int count_in=0,count_out=0;
|
||||
|
@ -75,7 +66,6 @@ int main (int argc, char **argv)
|
|||
int n_local_nws_pts;
|
||||
|
||||
int c;
|
||||
int newton_steps = 0;
|
||||
//...........................................................................
|
||||
int ncubes = (Nx-2)*(Ny-2)*(Nz-2); // Exclude the "upper" halo
|
||||
IntArray cubeList(3,ncubes);
|
||||
|
|
Loading…
Reference in New Issue
Block a user