#include #include #include #include #include #ifndef ARRAY_H_INC #include "Array.h" #define ARRAY_H_INC #endif #include "PointList.h" using namespace std; int main(int argc, char *argv[]) { double d; // double *phase; // double *distance; int i,j,k,p,q,r, n, Nx,Ny,Nz; double vS,vF; double readval; vS = 0.f; vF = 0.f; printf("Solid surface: S(x) = %f \n",vS); printf("Fluid surface: F(x) = %f \n",vF); Nx = Ny = Nz = 64; printf("Domain size is: %i x %i x %i \n",Nx,Ny,Nz); DoubleArray F(Nx,Ny,Nz); DoubleArray S(Nx,Ny,Nz); printf("Reading distance from a file... \n"); ifstream DISTANCE("Distance.in",ios::binary); for (int k=0;k vF, S > vS ****************************************************************** */ // Find blob domains, number of blobs int nblobs = 0; // number of blobs int ncubes = 0; // total number of nodes in any blob int N = (Nx-1)*(Ny-1)*(Nz-1); // total number of nodes IntArray blobs(3,N); // store indices for blobs (cubes) IntArray temp(3,N); // temporary storage array IntArray b(50); // number of nodes in each blob // Loop over z=0 first -> blobs attached to this end considered "connected" for LB simulation i=0; int number=0; for (k=0;k<1;k++){ for (j=0;j vF ){ if ( S(i,j,k) > vS ){ // node i,j,k is in the porespace number = number+ComputeBlob(blobs,nblobs,ncubes,indicator,F,S,vF,vS,i,j,k,temp); } } } } // Specify the blob on the z axis if (ncubes > 0){ b(nblobs) = number; printf("Number of blobs is: %i \n",nblobs); nblobs++; } for (k=0;k vF ){ if ( S(i,j,k) > vS ){ // node i,j,k is in the porespace b(nblobs) = ComputeBlob(blobs,nblobs,ncubes,indicator,F,S,vF,vS,i,j,k,temp); nblobs++; } } } // Otherwise, this point has already been assigned - ignore // Make sure list blob_nodes is large enough if ( nblobs > b.Length-1){ printf("Increasing size of blob list \n"); b = IncreaseSize(b,b.Length); } } } } // Go over all cubes again -> add any that do not contain nw phase bool add=1; // Set to false if any corners contain nw-phase ( F > vF) 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; int nodx,nody,nodz; for (k=0;k -1 ){ // corner occupied by nw-phase -> do not add add = 0; } } if ( add == 1 ){ blobs(0,ncubes) = i; blobs(1,ncubes) = j; blobs(2,ncubes) = k; ncubes++; count_in++; } else { count_out++; } } } } b(nblobs) = count_in; nblobs++; /* **************************************************************** COMPUTE GRADIENT OF F,S CURVATURE OF F ****************************************************************** */ // DTVectorField3D gradF = Gradient(Fluid); // DTVectorField3D gradS = Gradient(Solid); /* **************************************************************** VARIABLES FOR THE PMMC ALGORITHM ****************************************************************** */ double area,awn,aws,ans,lwns; // Initialize arrays for return variables (areas, volumes, etc. for all blobs) DoubleArray nw_areas(nblobs); DoubleArray ns_areas(nblobs); DoubleArray ws_areas(nblobs); DoubleArray nws_length(nblobs); DoubleArray volume(nblobs); // Volumes of every blob for (int a=0; a