add reflection condition for color grad

This commit is contained in:
James McClure 2020-04-03 20:24:29 -04:00
parent 2aeaa3a264
commit e4d836e7fc
4 changed files with 38 additions and 6 deletions

View File

@ -1549,21 +1549,30 @@ void ScaLBL_Communicator::RegularLayout(IntArray map, const double *data, Double
delete [] TmpDat;
}
void ScaLBL_Communicator::Color_BC_z(int *Map, double *Phi, double *Den, double vA, double 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);
if (BoundaryCondition == 5){
ScaLBL_CopySlice_z(Phi,Value,Nx,Ny,Nz,1,0);
}
else {
// 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);
}
//ScaLBL_SetSlice_z(Phi,Value,Nx,Ny,Nz,0);
}
}
void ScaLBL_Communicator::Color_BC_Z(int *Map, double *Phi, double *Den, double vA, double vB){
if (kproc == nprocz-1){
if (BoundaryCondition == 5){
ScaLBL_CopySlice_z(Phi,Value,Nx,Ny,Nz,Nz-2,Nz-1);
}
else {
// 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);
//ScaLBL_SetSlice_z(Phi,Value,Nx,Ny,Nz,Nz-1);
ScaLBL_Color_BC_Z(dvcSendList_Z, Map, Phi, Den, vA, vB, sendCount_Z, N);
}
}
}
void ScaLBL_Communicator::D3Q19_Pressure_BC_z(int *neighborList, double *fq, double din, int time){

View File

@ -143,6 +143,8 @@ extern "C" void ScaLBL_D3Q19_Reflection_BC_Z(int *list, double *dist, int count,
extern "C" void ScaLBL_SetSlice_z(double *Phi, double value, int Nx, int Ny, int Nz, int Slice);
extern "C" void ScaLBL_CopySlice_z(double *Phi, double value, int Nx, int Ny, int Nz, int Source, int Destination);
class ScaLBL_Communicator{
public:
//......................................................................................

View File

@ -1869,7 +1869,7 @@ extern "C" void ScaLBL_D3Q19_AAodd_Color(int *neighborList, int *Map, double *di
const double mrt_V12=0.04166666666666666;
for (int n=start; n<finish; n++){
// read the component number densities
nA = Den[n];
nB = Den[Np + n];
@ -2810,3 +2810,11 @@ extern "C" void ScaLBL_PhaseField_Init(int *Map, double *Phi, double *Den, doubl
}
}
extern "C" void ScaLBL_CopySlice_z(double *Phi, double value, int Nx, int Ny, int Nz, int Source, int Dest){
int n; double value;
for (n=0; n<Nx*Ny; n++){
value = Phi[Source*Nx*Ny+n];
Phi[Dest*Nx*Ny+n] = value;
}
}

View File

@ -1240,6 +1240,15 @@ __global__ void dvc_ScaLBL_SetSlice_z(double *Phi, double value, int Nx, int Ny
}
__global__ void dvc_ScaLBL_CopySlice_z(double *Phi, double value, int Nx, int Ny, int Nz, int Source, int Dest){
int n; double value;
int n = blockIdx.x*blockDim.x + threadIdx.x;
if (n < Nx*Ny){
value = Phi[Source*Nx*Ny+n];
Phi[Dest*Nx*Ny+n] = value;
}
}
__global__ void dvc_ScaLBL_D3Q19_AAeven_Color(int *Map, double *dist, double *Aq, double *Bq, double *Den, double *Phi,
double *Velocity, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
@ -4134,5 +4143,9 @@ extern "C" void ScaLBL_Color_BC_Z(int *list, int *Map, double *Phi, double *Den,
}
}
extern "C" void ScaLBL_CopySlice_z(double *Phi, double value, int Nx, int Ny, int Nz, int Source, int Dest){
int GRID = Nx*Ny / 512 + 1;
dvc_ScaLBL_CopySlice_z<<<GRID,512>>>(Phi,value,Nx,Ny,Nz,Slice,Dest);
}