From 44e25052b8b665db70c9980a4fadaea29081a936 Mon Sep 17 00:00:00 2001 From: James E McClure Date: Mon, 12 Mar 2018 13:44:05 -0400 Subject: [PATCH] Added conditional to BC loop --- tests/lbpm_color_macro_simulator.cpp | 46 +++++++++++++++++++++------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/tests/lbpm_color_macro_simulator.cpp b/tests/lbpm_color_macro_simulator.cpp index 72b89cfe..41a7faf8 100644 --- a/tests/lbpm_color_macro_simulator.cpp +++ b/tests/lbpm_color_macro_simulator.cpp @@ -354,7 +354,30 @@ int main(int argc, char **argv) MPI_Allreduce(&sum_local,&sum,1,MPI_DOUBLE,MPI_SUM,comm); porosity = sum*iVol_global; if (rank==0) printf("Media porosity = %f \n",porosity); - + //......................................................... + // If external boundary conditions are applied remove solid + if (BoundaryCondition > 0 && Dm.kproc == 0){ + for (k=0; k<3; k++){ + for (j=0;jSDs(n) = max(Averages->SDs(n),1.0*(2.5-k)); + } + } + } + } + if (BoundaryCondition > 0 && Dm.kproc == nprocz-1){ + for (k=Nz-3; kSDs(n) = max(Averages->SDs(n),1.0*(k-Nz+2.5)); + } + } + } + } //......................................................... // don't perform computations at the eight corners id[0] = id[Nx-1] = id[(Ny-1)*Nx] = id[(Ny-1)*Nx + Nx-1] = 0; @@ -441,17 +464,18 @@ int main(int argc, char **argv) ScaLBL_D3Q19_Init(fq, Np); if (rank==0) printf ("Initializing phase field \n"); ScaLBL_PhaseField_Init(dvcMap, Phi, Den, Aq, Bq, Np); - if (Dm.kproc==0){ - ScaLBL_SetSlice_z(Phi,1.0,Nx,Ny,Nz,0); - ScaLBL_SetSlice_z(Phi,1.0,Nx,Ny,Nz,1); - ScaLBL_SetSlice_z(Phi,1.0,Nx,Ny,Nz,2); + if (BoundaryCondition >0 ){ + if (Dm.kproc==0){ + ScaLBL_SetSlice_z(Phi,1.0,Nx,Ny,Nz,0); + ScaLBL_SetSlice_z(Phi,1.0,Nx,Ny,Nz,1); + ScaLBL_SetSlice_z(Phi,1.0,Nx,Ny,Nz,2); + } + if (Dm.kproc == nprocz-1){ + ScaLBL_SetSlice_z(Phi,-1.0,Nx,Ny,Nz,Nz-1); + ScaLBL_SetSlice_z(Phi,-1.0,Nx,Ny,Nz,Nz-2); + ScaLBL_SetSlice_z(Phi,-1.0,Nx,Ny,Nz,Nz-3); + } } - if (Dm.kproc == nprocz-1){ - ScaLBL_SetSlice_z(Phi,-1.0,Nx,Ny,Nz,Nz-1); - ScaLBL_SetSlice_z(Phi,-1.0,Nx,Ny,Nz,Nz-2); - ScaLBL_SetSlice_z(Phi,-1.0,Nx,Ny,Nz,Nz-3); - } - if (Restart == true){ if (rank==0){ printf("Reading restart file! \n");