Added FlipID() to common/Domain.h for random phase initialization with different connectivity

This commit is contained in:
James McClure
2014-06-03 17:47:57 -04:00
parent d3eb524ed4
commit f9a395f6fd
2 changed files with 15 additions and 1 deletions

View File

@@ -315,7 +315,13 @@ inline void GenerateResidual(char *ID, int Nx, int Ny, int Nz, double Saturation
//.......................................................................
}
inline void FlipID(char *ID, int N)
{
for (int n=0; n<N; n++){
if (ID[n] == 1) ID[n] = 2;
else if (ID[n] == 2) ID[n] = 1;
}
}
inline void WriteLocalSolidID(char *FILENAME, char *ID, int N)
{

View File

@@ -493,6 +493,14 @@ int main(int argc, char **argv)
// Generate the residual NWP
if (rank==0) printf("Initializing with NWP saturation = %f \n",wp_saturation);
if (!pBC) GenerateResidual(id,Nx,Ny,Nz,wp_saturation);
// If negative phi_s is chosen, flip the ID for the wetting and non-wetting phase
if (phi_s < 0){
phi_s = -phi_s;
das = (phi_s+1.0)*0.5;
dbs = 1.0 - das;
FlipID(id,Nx*Ny*Nz);
}
#endif
// Set up MPI communication structurese