clean up the greyscaleColor code; GPU only; to be built and tested
This commit is contained in:
parent
02d2e514ed
commit
ca2595e99c
@ -88,14 +88,14 @@ extern "C" void ScaLBL_D3Q19_AAodd_GreyscaleColor(int *d_neighborList, int *Map,
|
||||
double Fx, double Fy, double Fz, int strideY, int strideZ, int start, int finish, int Np);
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
||||
double *Phi,double *Psi, double *GreySolidGrad, double *Poros,double *Perm,double *Vel, double *Pressure,
|
||||
double *Phi, double *GreySolidW, double *Poros,double *Perm,double *Vel, double *Pressure,
|
||||
double rhoA, double rhoB, double tauA, double tauB,double tauA_eff,double tauB_eff, double alpha, double beta,
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, double W, int strideY, int strideZ, int start, int finish, int Np);
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, int strideY, int strideZ, int start, int finish, int Np);
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *d_neighborList, int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
||||
double *Phi,double *Psi, double *GreySolidGrad, double *Poros,double *Perm,double *Vel,double *Pressure,
|
||||
double *Phi, double *GreySolidW, double *Poros,double *Perm,double *Vel,double *Pressure,
|
||||
double rhoA, double rhoB, double tauA, double tauB, double tauA_eff,double tauB_eff, double alpha, double beta,
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, double W, int strideY, int strideZ, int start, int finish, int Np);
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, int strideY, int strideZ, int start, int finish, int Np);
|
||||
|
||||
//extern "C" void ScaLBL_Update_GreyscalePotential(int *Map, double *Phi, double *Psi, double *Poro, double *Perm, double alpha, double W,
|
||||
// int start, int finish, int Np);
|
||||
|
@ -1450,9 +1450,9 @@ __global__ void dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor(int *Map, double *dist,
|
||||
//CP: capillary penalty
|
||||
// also turn off recoloring for grey nodes
|
||||
__global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
||||
double *Phi, double *Psi, double *GreySolidGrad, double *Poros,double *Perm, double *Velocity, double *Pressure,
|
||||
double *Phi, double *GreySolidW, double *Poros,double *Perm, double *Velocity, double *Pressure,
|
||||
double rhoA, double rhoB, double tauA, double tauB,double tauA_eff,double tauB_eff,double alpha, double beta,
|
||||
double Gx, double Gy, double Gz, bool RecoloringOff, double W, int strideY, int strideZ, int start, int finish, int Np){
|
||||
double Gx, double Gy, double Gz, bool RecoloringOff, int strideY, int strideZ, int start, int finish, int Np){
|
||||
|
||||
int n,nn,ijk,nread;
|
||||
int nr1,nr2,nr3,nr4,nr5,nr6;
|
||||
@ -1462,8 +1462,6 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int
|
||||
double fq;
|
||||
// conserved momemnts
|
||||
double rho,jx,jy,jz;
|
||||
//double vx,vy,vz,v_mag;
|
||||
//double ux,uy,uz,u_mag;
|
||||
double ux,uy,uz;
|
||||
// non-conserved moments
|
||||
double m1,m2,m4,m6,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18;
|
||||
@ -1473,18 +1471,13 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int
|
||||
double C,nx,ny,nz; //color gradient magnitude and direction
|
||||
double phi,tau,rho0,rlx_setA,rlx_setB;
|
||||
|
||||
//double GeoFun=0.0;//geometric function from Guo's PRE 66, 036304 (2002)
|
||||
double porosity;
|
||||
double perm;//voxel permeability
|
||||
//double c0, c1; //Guo's model parameters
|
||||
double tau_eff;
|
||||
double mu_eff;//kinematic viscosity
|
||||
double nx_gs,ny_gs,nz_gs;//grey-solid color gradient
|
||||
double nx_phase,ny_phase,nz_phase,C_phase;
|
||||
double Fx,Fy,Fz;
|
||||
double gp1,gp2,gp4,gp6,gp8,gp9,gp10,gp11,gp12,gp13,gp14,gp15,gp16,gp17,gp18;
|
||||
double gp3,gp5,gp7;
|
||||
double Fcpx,Fcpy,Fcpz;//capillary penalty force
|
||||
double W;//greyscale wetting strength
|
||||
|
||||
const double mrt_V1=0.05263157894736842;
|
||||
const double mrt_V2=0.012531328320802;
|
||||
@ -1510,9 +1503,7 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int
|
||||
|
||||
porosity = Poros[n];
|
||||
perm = Perm[n];
|
||||
nx_gs = GreySolidGrad[n+0*Np];
|
||||
ny_gs = GreySolidGrad[n+1*Np];
|
||||
nz_gs = GreySolidGrad[n+2*Np];
|
||||
W = GreySolidW[n];
|
||||
|
||||
// compute phase indicator field
|
||||
phi=(nA-nB)/(nA+nB);
|
||||
@ -1534,98 +1525,61 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int
|
||||
//........................................................................
|
||||
nn = ijk-1; // neighbor index (get convention)
|
||||
m1 = Phi[nn]; // get neighbor for phi - 1
|
||||
gp1 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+1; // neighbor index (get convention)
|
||||
m2 = Phi[nn]; // get neighbor for phi - 2
|
||||
gp2 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideY; // neighbor index (get convention)
|
||||
m3 = Phi[nn]; // get neighbor for phi - 3
|
||||
gp3 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideY; // neighbor index (get convention)
|
||||
m4 = Phi[nn]; // get neighbor for phi - 4
|
||||
gp4 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ; // neighbor index (get convention)
|
||||
m5 = Phi[nn]; // get neighbor for phi - 5
|
||||
gp5 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ; // neighbor index (get convention)
|
||||
m6 = Phi[nn]; // get neighbor for phi - 6
|
||||
gp6 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideY-1; // neighbor index (get convention)
|
||||
m7 = Phi[nn]; // get neighbor for phi - 7
|
||||
gp7 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideY+1; // neighbor index (get convention)
|
||||
m8 = Phi[nn]; // get neighbor for phi - 8
|
||||
gp8 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideY-1; // neighbor index (get convention)
|
||||
m9 = Phi[nn]; // get neighbor for phi - 9
|
||||
gp9 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideY+1; // neighbor index (get convention)
|
||||
m10 = Phi[nn]; // get neighbor for phi - 10
|
||||
gp10 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ-1; // neighbor index (get convention)
|
||||
m11 = Phi[nn]; // get neighbor for phi - 11
|
||||
gp11 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ+1; // neighbor index (get convention)
|
||||
m12 = Phi[nn]; // get neighbor for phi - 12
|
||||
gp12 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ-1; // neighbor index (get convention)
|
||||
m13 = Phi[nn]; // get neighbor for phi - 13
|
||||
gp13 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ+1; // neighbor index (get convention)
|
||||
m14 = Phi[nn]; // get neighbor for phi - 14
|
||||
gp14 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ-strideY; // neighbor index (get convention)
|
||||
m15 = Phi[nn]; // get neighbor for phi - 15
|
||||
gp15 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ+strideY; // neighbor index (get convention)
|
||||
m16 = Phi[nn]; // get neighbor for phi - 16
|
||||
gp16 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ-strideY; // neighbor index (get convention)
|
||||
m17 = Phi[nn]; // get neighbor for phi - 17
|
||||
gp17 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ+strideY; // neighbor index (get convention)
|
||||
m18 = Phi[nn]; // get neighbor for phi - 18
|
||||
gp18 = Psi[nn];
|
||||
//............Compute the Color Gradient...................................
|
||||
nx_phase = -3.0/18.0*(m1-m2+0.5*(m7-m8+m9-m10+m11-m12+m13-m14));
|
||||
ny_phase = -3.0/18.0*(m3-m4+0.5*(m7-m8-m9+m10+m15-m16+m17-m18));
|
||||
nz_phase = -3.0/18.0*(m5-m6+0.5*(m11-m12-m13+m14+m15-m16-m17+m18));
|
||||
C_phase = sqrt(nx_phase*nx_phase+ny_phase*ny_phase+nz_phase*nz_phase);
|
||||
|
||||
//correct the normal color gradient by considering the effect of grey solid
|
||||
nx = nx_phase + (1.0-porosity)*nx_gs;
|
||||
ny = ny_phase + (1.0-porosity)*ny_gs;
|
||||
nz = nz_phase + (1.0-porosity)*nz_gs;
|
||||
if (C_phase==0.0){
|
||||
nx = nx_phase;
|
||||
ny = ny_phase;
|
||||
nz = nz_phase;
|
||||
}
|
||||
|
||||
//...........Normalize the Color Gradient.................................
|
||||
C = sqrt(nx*nx+ny*ny+nz*nz);
|
||||
double ColorMag = C;
|
||||
if (C==0.0) ColorMag=1.0;
|
||||
nx = nx/ColorMag;
|
||||
ny = ny/ColorMag;
|
||||
nz = nz/ColorMag;
|
||||
nx = -3.0/18.0*(m1-m2+0.5*(m7-m8+m9-m10+m11-m12+m13-m14));
|
||||
ny = -3.0/18.0*(m3-m4+0.5*(m7-m8-m9+m10+m15-m16+m17-m18));
|
||||
nz = -3.0/18.0*(m5-m6+0.5*(m11-m12-m13+m14+m15-m16-m17+m18));
|
||||
|
||||
//............Compute the Greyscale Potential Gradient.....................
|
||||
// Fcpx = 0.0;
|
||||
@ -1648,14 +1602,24 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int
|
||||
// //ny = Fcpy/Fcp_mag;
|
||||
// //nz = Fcpz/Fcp_mag;
|
||||
// }
|
||||
Fcpx = -3.0/18.0*(m1-m2+0.5*(m7-m8+m9-m10+m11-m12+m13-m14));
|
||||
Fcpy = -3.0/18.0*(m3-m4+0.5*(m7-m8-m9+m10+m15-m16+m17-m18));
|
||||
Fcpz = -3.0/18.0*(m5-m6+0.5*(m11-m12-m13+m14+m15-m16-m17+m18));
|
||||
Fcpx = nx;
|
||||
Fcpy = ny;
|
||||
Fcpz = nz;
|
||||
double Fcp_mag=sqrt(Fcpx*Fcpx+Fcpy*Fcpy+Fcpz*Fcpz);
|
||||
if (Fcp_mag==0.0); Fcpx=Fcpy=Fcpz=0.0;
|
||||
//NOTE for open node (porosity=1.0),Fcp=0.0
|
||||
Fcpx *= alpha*W*(1.0-porosity)/sqrt(perm);
|
||||
Fcpy *= alpha*W*(1.0-porosity)/sqrt(perm);
|
||||
Fcpz *= alpha*W*(1.0-porosity)/sqrt(perm);
|
||||
|
||||
//...........Normalize the Color Gradient.................................
|
||||
C = sqrt(nx*nx+ny*ny+nz*nz);
|
||||
double ColorMag = C;
|
||||
if (C==0.0) ColorMag=1.0;
|
||||
nx = nx/ColorMag;
|
||||
ny = ny/ColorMag;
|
||||
nz = nz/ColorMag;
|
||||
|
||||
// q=0
|
||||
fq = dist[n];
|
||||
rho = fq;
|
||||
@ -2262,15 +2226,13 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *neighborList, int
|
||||
//CP: capillary penalty
|
||||
// also turn off recoloring for grey nodes
|
||||
__global__ void dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
||||
double *Phi, double *Psi, double *GreySolidGrad, double *Poros,double *Perm, double *Velocity, double *Pressure,
|
||||
double *Phi, double *GreySolidW, double *Poros,double *Perm, double *Velocity, double *Pressure,
|
||||
double rhoA, double rhoB, double tauA, double tauB,double tauA_eff,double tauB_eff, double alpha, double beta,
|
||||
double Gx, double Gy, double Gz, bool RecoloringOff, double W, int strideY, int strideZ, int start, int finish, int Np){
|
||||
double Gx, double Gy, double Gz, bool RecoloringOff, int strideY, int strideZ, int start, int finish, int Np){
|
||||
int ijk,nn,n;
|
||||
double fq;
|
||||
// conserved momemnts
|
||||
double rho,jx,jy,jz;
|
||||
//double vx,vy,vz,v_mag;
|
||||
//double ux,uy,uz,u_mag;
|
||||
double ux,uy,uz;
|
||||
// non-conserved moments
|
||||
double m1,m2,m4,m6,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18;
|
||||
@ -2280,18 +2242,13 @@ __global__ void dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dis
|
||||
double C,nx,ny,nz; //color gradient magnitude and direction
|
||||
double phi,tau,rho0,rlx_setA,rlx_setB;
|
||||
|
||||
//double GeoFun=0.0;//geometric function from Guo's PRE 66, 036304 (2002)
|
||||
double porosity;
|
||||
double perm;//voxel permeability
|
||||
//double c0, c1; //Guo's model parameters
|
||||
double tau_eff;
|
||||
double mu_eff;//kinematic viscosity
|
||||
double nx_gs,ny_gs,nz_gs;//grey-solid color gradient
|
||||
double nx_phase,ny_phase,nz_phase,C_phase;
|
||||
double Fx,Fy,Fz;
|
||||
double gp1,gp2,gp4,gp6,gp8,gp9,gp10,gp11,gp12,gp13,gp14,gp15,gp16,gp17,gp18;
|
||||
double gp3,gp5,gp7;
|
||||
double Fcpx,Fcpy,Fcpz;//capillary penalty force
|
||||
double W;//greyscale wetting strength
|
||||
|
||||
const double mrt_V1=0.05263157894736842;
|
||||
const double mrt_V2=0.012531328320802;
|
||||
@ -2315,11 +2272,10 @@ __global__ void dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dis
|
||||
// read the component number densities
|
||||
nA = Den[n];
|
||||
nB = Den[Np + n];
|
||||
|
||||
porosity = Poros[n];
|
||||
perm = Perm[n];
|
||||
nx_gs = GreySolidGrad[n+0*Np];
|
||||
ny_gs = GreySolidGrad[n+1*Np];
|
||||
nz_gs = GreySolidGrad[n+2*Np];
|
||||
W = GreySolidW[n];
|
||||
|
||||
// compute phase indicator field
|
||||
phi=(nA-nB)/(nA+nB);
|
||||
@ -2341,98 +2297,61 @@ __global__ void dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dis
|
||||
//........................................................................
|
||||
nn = ijk-1; // neighbor index (get convention)
|
||||
m1 = Phi[nn]; // get neighbor for phi - 1
|
||||
gp1 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+1; // neighbor index (get convention)
|
||||
m2 = Phi[nn]; // get neighbor for phi - 2
|
||||
gp2 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideY; // neighbor index (get convention)
|
||||
m3 = Phi[nn]; // get neighbor for phi - 3
|
||||
gp3 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideY; // neighbor index (get convention)
|
||||
m4 = Phi[nn]; // get neighbor for phi - 4
|
||||
gp4 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ; // neighbor index (get convention)
|
||||
m5 = Phi[nn]; // get neighbor for phi - 5
|
||||
gp5 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ; // neighbor index (get convention)
|
||||
m6 = Phi[nn]; // get neighbor for phi - 6
|
||||
gp6 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideY-1; // neighbor index (get convention)
|
||||
m7 = Phi[nn]; // get neighbor for phi - 7
|
||||
gp7 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideY+1; // neighbor index (get convention)
|
||||
m8 = Phi[nn]; // get neighbor for phi - 8
|
||||
gp8 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideY-1; // neighbor index (get convention)
|
||||
m9 = Phi[nn]; // get neighbor for phi - 9
|
||||
gp9 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideY+1; // neighbor index (get convention)
|
||||
m10 = Phi[nn]; // get neighbor for phi - 10
|
||||
gp10 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ-1; // neighbor index (get convention)
|
||||
m11 = Phi[nn]; // get neighbor for phi - 11
|
||||
gp11 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ+1; // neighbor index (get convention)
|
||||
m12 = Phi[nn]; // get neighbor for phi - 12
|
||||
gp12 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ-1; // neighbor index (get convention)
|
||||
m13 = Phi[nn]; // get neighbor for phi - 13
|
||||
gp13 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ+1; // neighbor index (get convention)
|
||||
m14 = Phi[nn]; // get neighbor for phi - 14
|
||||
gp14 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ-strideY; // neighbor index (get convention)
|
||||
m15 = Phi[nn]; // get neighbor for phi - 15
|
||||
gp15 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ+strideY; // neighbor index (get convention)
|
||||
m16 = Phi[nn]; // get neighbor for phi - 16
|
||||
gp16 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk+strideZ-strideY; // neighbor index (get convention)
|
||||
m17 = Phi[nn]; // get neighbor for phi - 17
|
||||
gp17 = Psi[nn];
|
||||
//........................................................................
|
||||
nn = ijk-strideZ+strideY; // neighbor index (get convention)
|
||||
m18 = Phi[nn]; // get neighbor for phi - 18
|
||||
gp18 = Psi[nn];
|
||||
//............Compute the Color Gradient...................................
|
||||
nx_phase = -3.0/18.0*(m1-m2+0.5*(m7-m8+m9-m10+m11-m12+m13-m14));
|
||||
ny_phase = -3.0/18.0*(m3-m4+0.5*(m7-m8-m9+m10+m15-m16+m17-m18));
|
||||
nz_phase = -3.0/18.0*(m5-m6+0.5*(m11-m12-m13+m14+m15-m16-m17+m18));
|
||||
C_phase = sqrt(nx_phase*nx_phase+ny_phase*ny_phase+nz_phase*nz_phase);
|
||||
|
||||
//correct the normal color gradient by considering the effect of grey solid
|
||||
nx = nx_phase + (1.0-porosity)*nx_gs;
|
||||
ny = ny_phase + (1.0-porosity)*ny_gs;
|
||||
nz = nz_phase + (1.0-porosity)*nz_gs;
|
||||
if (C_phase==0.0){
|
||||
nx = nx_phase;
|
||||
ny = ny_phase;
|
||||
nz = nz_phase;
|
||||
}
|
||||
|
||||
//...........Normalize the Color Gradient.................................
|
||||
C = sqrt(nx*nx+ny*ny+nz*nz);
|
||||
double ColorMag = C;
|
||||
if (C==0.0) ColorMag=1.0;
|
||||
nx = nx/ColorMag;
|
||||
ny = ny/ColorMag;
|
||||
nz = nz/ColorMag;
|
||||
nx = -3.0/18.0*(m1-m2+0.5*(m7-m8+m9-m10+m11-m12+m13-m14));
|
||||
ny = -3.0/18.0*(m3-m4+0.5*(m7-m8-m9+m10+m15-m16+m17-m18));
|
||||
nz = -3.0/18.0*(m5-m6+0.5*(m11-m12-m13+m14+m15-m16-m17+m18));
|
||||
|
||||
//............Compute the Greyscale Potential Gradient.....................
|
||||
// Fcpx = 0.0;
|
||||
@ -2455,14 +2374,23 @@ __global__ void dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dis
|
||||
// ny = Fcpy/Fcp_mag;
|
||||
// nz = Fcpz/Fcp_mag;
|
||||
// }
|
||||
Fcpx = -3.0/18.0*(m1-m2+0.5*(m7-m8+m9-m10+m11-m12+m13-m14));
|
||||
Fcpy = -3.0/18.0*(m3-m4+0.5*(m7-m8-m9+m10+m15-m16+m17-m18));
|
||||
Fcpz = -3.0/18.0*(m5-m6+0.5*(m11-m12-m13+m14+m15-m16-m17+m18));
|
||||
Fcpx = nx;
|
||||
Fcpy = ny;
|
||||
Fcpz = nz;
|
||||
double Fcp_mag=sqrt(Fcpx*Fcpx+Fcpy*Fcpy+Fcpz*Fcpz);
|
||||
if (Fcp_mag==0.0); Fcpx=Fcpy=Fcpz=0.0;
|
||||
//NOTE for open node (porosity=1.0),Fcp=0.0
|
||||
Fcpx *= alpha*W*(1.0-porosity)/sqrt(perm);
|
||||
Fcpy *= alpha*W*(1.0-porosity)/sqrt(perm);
|
||||
Fcpz *= alpha*W*(1.0-porosity)/sqrt(perm);
|
||||
|
||||
//...........Normalize the Color Gradient.................................
|
||||
C = sqrt(nx*nx+ny*ny+nz*nz);
|
||||
double ColorMag = C;
|
||||
if (C==0.0) ColorMag=1.0;
|
||||
nx = nx/ColorMag;
|
||||
ny = ny/ColorMag;
|
||||
nz = nz/ColorMag;
|
||||
|
||||
// q=0
|
||||
fq = dist[n];
|
||||
@ -4572,12 +4500,12 @@ extern "C" void ScaLBL_PhaseField_InitFromRestart(double *Den, double *Aq, doubl
|
||||
|
||||
//Model-1 & 4 with capillary pressure penalty
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
||||
double *Phi,double *Psi, double *GreySolidGrad, double *Poros,double *Perm,double *Vel, double *Pressure,
|
||||
double *Phi, double *GreySolidW, double *Poros,double *Perm,double *Vel, double *Pressure,
|
||||
double rhoA, double rhoB, double tauA, double tauB,double tauA_eff,double tauB_eff, double alpha, double beta,
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, double W, int strideY, int strideZ, int start, int finish, int Np){
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, int strideY, int strideZ, int start, int finish, int Np){
|
||||
|
||||
dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP<<<NBLOCKS,NTHREADS >>>(Map, dist, Aq, Bq, Den, Phi, Psi, GreySolidGrad, Poros, Perm, Vel, Pressure,
|
||||
rhoA, rhoB, tauA, tauB, tauA_eff, tauB_eff, alpha, beta, Fx, Fy, Fz, RecoloringOff, W, strideY, strideZ, start, finish, Np);
|
||||
dvc_ScaLBL_D3Q19_AAeven_GreyscaleColor_CP<<<NBLOCKS,NTHREADS >>>(Map, dist, Aq, Bq, Den, Phi, GreySolidW, Poros, Perm, Vel, Pressure,
|
||||
rhoA, rhoB, tauA, tauB, tauA_eff, tauB_eff, alpha, beta, Fx, Fy, Fz, RecoloringOff, strideY, strideZ, start, finish, Np);
|
||||
cudaError_t err = cudaGetLastError();
|
||||
if (cudaSuccess != err){
|
||||
printf("CUDA error in ScaLBL_D3Q19_AAeven_GreyscaleColor_CP: %s \n",cudaGetErrorString(err));
|
||||
@ -4587,12 +4515,12 @@ extern "C" void ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(int *Map, double *dist, do
|
||||
|
||||
//Model-1 & 4 with capillary pressure penalty
|
||||
extern "C" void ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(int *d_neighborList, int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
||||
double *Phi, double *Psi, double *GreySolidGrad, double *Poros,double *Perm,double *Vel,double *Pressure,
|
||||
double *Phi, double *GreySolidW, double *Poros,double *Perm,double *Vel,double *Pressure,
|
||||
double rhoA, double rhoB, double tauA, double tauB, double tauA_eff,double tauB_eff, double alpha, double beta,
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, double W, int strideY, int strideZ, int start, int finish, int Np){
|
||||
double Fx, double Fy, double Fz, bool RecoloringOff, int strideY, int strideZ, int start, int finish, int Np){
|
||||
|
||||
dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP<<<NBLOCKS,NTHREADS >>>(d_neighborList, Map, dist, Aq, Bq, Den, Phi, Psi, GreySolidGrad, Poros, Perm,Vel,Pressure,
|
||||
rhoA, rhoB, tauA, tauB, tauA_eff, tauB_eff,alpha, beta, Fx, Fy, Fz, RecoloringOff, W, strideY, strideZ, start, finish, Np);
|
||||
dvc_ScaLBL_D3Q19_AAodd_GreyscaleColor_CP<<<NBLOCKS,NTHREADS >>>(d_neighborList, Map, dist, Aq, Bq, Den, Phi, GreySolidW, Poros, Perm,Vel,Pressure,
|
||||
rhoA, rhoB, tauA, tauB, tauA_eff, tauB_eff,alpha, beta, Fx, Fy, Fz, RecoloringOff, strideY, strideZ, start, finish, Np);
|
||||
|
||||
cudaError_t err = cudaGetLastError();
|
||||
if (cudaSuccess != err){
|
||||
|
@ -17,7 +17,7 @@ void DeleteArray( const TYPE *p )
|
||||
|
||||
ScaLBL_GreyscaleColorModel::ScaLBL_GreyscaleColorModel(int RANK, int NP, const Utilities::MPI& COMM):
|
||||
rank(RANK), nprocs(NP), Restart(0),timestep(0),timestepMax(0),tauA(0),tauB(0),tauA_eff(0),tauB_eff(0),rhoA(0),rhoB(0),alpha(0),beta(0),
|
||||
Fx(0),Fy(0),Fz(0),flux(0),din(0),dout(0),inletA(0),inletB(0),outletA(0),outletB(0),GreyPorosity(0),RecoloringOff(0),W(0),
|
||||
Fx(0),Fy(0),Fz(0),flux(0),din(0),dout(0),inletA(0),inletB(0),outletA(0),outletB(0),GreyPorosity(0),RecoloringOff(0),
|
||||
Nx(0),Ny(0),Nz(0),N(0),Np(0),nprocx(0),nprocy(0),nprocz(0),BoundaryCondition(0),Lx(0),Ly(0),Lz(0),comm(COMM)
|
||||
{
|
||||
REVERSE_FLOW_DIRECTION = false;
|
||||
@ -44,7 +44,7 @@ void ScaLBL_GreyscaleColorModel::ReadParams(string filename){
|
||||
din=dout=1.0;
|
||||
flux=0.0;
|
||||
RecoloringOff = false;
|
||||
W=1.0;
|
||||
//W=1.0;
|
||||
|
||||
// Color Model parameters
|
||||
if (greyscaleColor_db->keyExists( "timestepMax" )){
|
||||
@ -90,9 +90,6 @@ void ScaLBL_GreyscaleColorModel::ReadParams(string filename){
|
||||
if (greyscaleColor_db->keyExists( "RecoloringOff" )){
|
||||
RecoloringOff = greyscaleColor_db->getScalar<bool>( "RecoloringOff" );
|
||||
}
|
||||
if (greyscaleColor_db->keyExists( "W" )){
|
||||
W = greyscaleColor_db->getScalar<double>( "W" );
|
||||
}
|
||||
inletA=1.f;
|
||||
inletB=0.f;
|
||||
outletA=0.f;
|
||||
@ -300,19 +297,18 @@ void ScaLBL_GreyscaleColorModel::AssignComponentLabels()
|
||||
delete [] phase;
|
||||
}
|
||||
|
||||
void ScaLBL_GreyscaleColorModel::AssignGreySolidLabels()//Model-4
|
||||
void ScaLBL_GreyscaleColorModel::AssignGreySolidLabels()//apply capillary penalty wetting strength W
|
||||
{
|
||||
// ONLY initialize grey nodes
|
||||
// Key input parameters:
|
||||
// 1. GreySolidLabels
|
||||
// labels for grey nodes
|
||||
// 2. GreySolidAffinity
|
||||
// affinity ranges [-1,1]
|
||||
// oil-wet > 0
|
||||
// water-wet < 0
|
||||
// neutral = 0
|
||||
double *SolidPotential_host = new double [Nx*Ny*Nz];
|
||||
double *GreySolidGrad_host = new double [3*Np];
|
||||
// ranges [-1,1]
|
||||
// water-wet > 0
|
||||
// oil-wet < 0
|
||||
// neutral = 0 (i.e. no penalty)
|
||||
double *GreySolidW_host = new double [Np];
|
||||
|
||||
size_t NLABELS=0;
|
||||
signed char VALUE=0;
|
||||
@ -334,117 +330,19 @@ void ScaLBL_GreyscaleColorModel::AssignGreySolidLabels()//Model-4
|
||||
AFFINITY=0.f;//all nodes except the specified grey nodes have grey-solid affinity = 0.0
|
||||
// Assign the affinity from the paired list
|
||||
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
//printf("idx=%i, value=%i, %i, \n",idx, VALUE,LabelList[idx]);
|
||||
if (VALUE == LabelList[idx]){
|
||||
AFFINITY=AffinityList[idx];
|
||||
idx = NLABELS;
|
||||
//Mask->id[n] = 0; // set mask to zero since this is an immobile component
|
||||
}
|
||||
}
|
||||
SolidPotential_host[n] = AFFINITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate grey-solid color-gradient
|
||||
double *Dst;
|
||||
Dst = new double [3*3*3];
|
||||
for (int kk=0; kk<3; kk++){
|
||||
for (int jj=0; jj<3; jj++){
|
||||
for (int ii=0; ii<3; ii++){
|
||||
int index = kk*9+jj*3+ii;
|
||||
Dst[index] = sqrt(double(ii-1)*double(ii-1) + double(jj-1)*double(jj-1)+ double(kk-1)*double(kk-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
double w_face = 1.f;
|
||||
double w_edge = 0.5;
|
||||
double w_corner = 0.f;
|
||||
//local
|
||||
Dst[13] = 0.f;
|
||||
//faces
|
||||
Dst[4] = w_face;
|
||||
Dst[10] = w_face;
|
||||
Dst[12] = w_face;
|
||||
Dst[14] = w_face;
|
||||
Dst[16] = w_face;
|
||||
Dst[22] = w_face;
|
||||
// corners
|
||||
Dst[0] = w_corner;
|
||||
Dst[2] = w_corner;
|
||||
Dst[6] = w_corner;
|
||||
Dst[8] = w_corner;
|
||||
Dst[18] = w_corner;
|
||||
Dst[20] = w_corner;
|
||||
Dst[24] = w_corner;
|
||||
Dst[26] = w_corner;
|
||||
// edges
|
||||
Dst[1] = w_edge;
|
||||
Dst[3] = w_edge;
|
||||
Dst[5] = w_edge;
|
||||
Dst[7] = w_edge;
|
||||
Dst[9] = w_edge;
|
||||
Dst[11] = w_edge;
|
||||
Dst[15] = w_edge;
|
||||
Dst[17] = w_edge;
|
||||
Dst[19] = w_edge;
|
||||
Dst[21] = w_edge;
|
||||
Dst[23] = w_edge;
|
||||
Dst[25] = w_edge;
|
||||
|
||||
for (int k=1; k<Nz-1; k++){
|
||||
for (int j=1; j<Ny-1; j++){
|
||||
for (int i=1; i<Nx-1; i++){
|
||||
int idx=Map(i,j,k);
|
||||
int idx = Map(i,j,k);
|
||||
if (!(idx < 0)){
|
||||
double phi_x = 0.f;
|
||||
double phi_y = 0.f;
|
||||
double phi_z = 0.f;
|
||||
for (int kk=0; kk<3; kk++){
|
||||
for (int jj=0; jj<3; jj++){
|
||||
for (int ii=0; ii<3; ii++){
|
||||
|
||||
int index = kk*9+jj*3+ii;
|
||||
double weight= Dst[index];
|
||||
|
||||
int idi=i+ii-1;
|
||||
int idj=j+jj-1;
|
||||
int idk=k+kk-1;
|
||||
|
||||
if (idi < 0) idi=0;
|
||||
if (idj < 0) idj=0;
|
||||
if (idk < 0) idk=0;
|
||||
if (!(idi < Nx)) idi=Nx-1;
|
||||
if (!(idj < Ny)) idj=Ny-1;
|
||||
if (!(idk < Nz)) idk=Nz-1;
|
||||
|
||||
int nn = idk*Nx*Ny + idj*Nx + idi;
|
||||
double vec_x = double(ii-1);
|
||||
double vec_y = double(jj-1);
|
||||
double vec_z = double(kk-1);
|
||||
double GWNS=SolidPotential_host[nn];
|
||||
phi_x += GWNS*weight*vec_x;
|
||||
phi_y += GWNS*weight*vec_y;
|
||||
phi_z += GWNS*weight*vec_z;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Averages->SDs(i,j,k)<2.0){
|
||||
GreySolidGrad_host[idx+0*Np] = phi_x;
|
||||
GreySolidGrad_host[idx+1*Np] = phi_y;
|
||||
GreySolidGrad_host[idx+2*Np] = phi_z;
|
||||
}
|
||||
else{
|
||||
GreySolidGrad_host[idx+0*Np] = 0.0;
|
||||
GreySolidGrad_host[idx+1*Np] = 0.0;
|
||||
GreySolidGrad_host[idx+2*Np] = 0.0;
|
||||
}
|
||||
}
|
||||
GreySolidW[idx] = AFFINITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (rank==0){
|
||||
printf("Number of Grey-solid labels: %lu \n",NLABELS);
|
||||
for (unsigned int idx=0; idx<NLABELS; idx++){
|
||||
@ -452,14 +350,13 @@ void ScaLBL_GreyscaleColorModel::AssignGreySolidLabels()//Model-4
|
||||
AFFINITY=AffinityList[idx];
|
||||
printf(" grey-solid label=%d, grey-solid affinity=%f\n",VALUE,AFFINITY);
|
||||
}
|
||||
printf("NOTE: grey-solid affinity>0: water-wet || grey-solid affinity<0: oil-wet \n");
|
||||
}
|
||||
|
||||
|
||||
ScaLBL_CopyToDevice(GreySolidGrad, GreySolidGrad_host, 3*Np*sizeof(double));
|
||||
ScaLBL_CopyToDevice(GreySolidW, GreySolidW_host, Np*sizeof(double));
|
||||
ScaLBL_Comm->Barrier();
|
||||
delete [] SolidPotential_host;
|
||||
delete [] GreySolidGrad_host;
|
||||
delete [] Dst;
|
||||
delete [] GreySolidW_host;
|
||||
}
|
||||
////----------------------------------------------------------------------------------------------------------//
|
||||
|
||||
@ -585,70 +482,70 @@ void ScaLBL_GreyscaleColorModel::AssignGreyPoroPermLabels()
|
||||
delete [] Permeability;
|
||||
}
|
||||
|
||||
void ScaLBL_GreyscaleColorModel::AssignGreyscalePotential()
|
||||
{
|
||||
double *psi;//greyscale potential
|
||||
psi = new double[N];
|
||||
|
||||
size_t NLABELS=0;
|
||||
signed char VALUE=0;
|
||||
double AFFINITY=0.f;
|
||||
|
||||
auto LabelList = greyscaleColor_db->getVector<int>( "ComponentLabels" );
|
||||
auto AffinityList = greyscaleColor_db->getVector<double>( "ComponentAffinity" );
|
||||
NLABELS=LabelList.size();
|
||||
|
||||
//first, copy over normal phase field
|
||||
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;
|
||||
VALUE=id[n];
|
||||
// Assign the affinity from the paired list
|
||||
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
//printf("idx=%i, value=%i, %i, \n",idx, VALUE,LabelList[idx]);
|
||||
if (VALUE == LabelList[idx]){
|
||||
AFFINITY=AffinityList[idx];
|
||||
idx = NLABELS;
|
||||
}
|
||||
}
|
||||
// fluid labels are reserved
|
||||
if (VALUE == 1) AFFINITY=1.0;
|
||||
else if (VALUE == 2) AFFINITY=-1.0;
|
||||
psi[n] = AFFINITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//second, scale the phase field for grey nodes
|
||||
double Cap_Penalty=1.f;
|
||||
auto GreyLabelList = greyscaleColor_db->getVector<int>( "GreySolidLabels" );
|
||||
auto PermeabilityList = greyscaleColor_db->getVector<double>( "PermeabilityList" );
|
||||
NLABELS=GreyLabelList.size();
|
||||
|
||||
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;
|
||||
VALUE=id[n];
|
||||
Cap_Penalty=1.f;
|
||||
// Assign the affinity from the paired list
|
||||
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
if (VALUE == GreyLabelList[idx]){
|
||||
Cap_Penalty=alpha*W/sqrt(PermeabilityList[idx]/Dm->voxel_length/Dm->voxel_length);
|
||||
idx = NLABELS;
|
||||
}
|
||||
}
|
||||
//update greyscale potential
|
||||
psi[n] = psi[n]*Cap_Penalty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_CopyToDevice(Psi, psi, N*sizeof(double));
|
||||
ScaLBL_Comm->Barrier();
|
||||
delete [] psi;
|
||||
}
|
||||
//void ScaLBL_GreyscaleColorModel::AssignGreyscalePotential()
|
||||
//{
|
||||
// double *psi;//greyscale potential
|
||||
// psi = new double[N];
|
||||
//
|
||||
// size_t NLABELS=0;
|
||||
// signed char VALUE=0;
|
||||
// double AFFINITY=0.f;
|
||||
//
|
||||
// auto LabelList = greyscaleColor_db->getVector<int>( "ComponentLabels" );
|
||||
// auto AffinityList = greyscaleColor_db->getVector<double>( "ComponentAffinity" );
|
||||
// NLABELS=LabelList.size();
|
||||
//
|
||||
// //first, copy over normal phase field
|
||||
// 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;
|
||||
// VALUE=id[n];
|
||||
// // Assign the affinity from the paired list
|
||||
// for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
// //printf("idx=%i, value=%i, %i, \n",idx, VALUE,LabelList[idx]);
|
||||
// if (VALUE == LabelList[idx]){
|
||||
// AFFINITY=AffinityList[idx];
|
||||
// idx = NLABELS;
|
||||
// }
|
||||
// }
|
||||
// // fluid labels are reserved
|
||||
// if (VALUE == 1) AFFINITY=1.0;
|
||||
// else if (VALUE == 2) AFFINITY=-1.0;
|
||||
// psi[n] = AFFINITY;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //second, scale the phase field for grey nodes
|
||||
// double Cap_Penalty=1.f;
|
||||
// auto GreyLabelList = greyscaleColor_db->getVector<int>( "GreySolidLabels" );
|
||||
// auto PermeabilityList = greyscaleColor_db->getVector<double>( "PermeabilityList" );
|
||||
// NLABELS=GreyLabelList.size();
|
||||
//
|
||||
// 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;
|
||||
// VALUE=id[n];
|
||||
// Cap_Penalty=1.f;
|
||||
// // Assign the affinity from the paired list
|
||||
// for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
// if (VALUE == GreyLabelList[idx]){
|
||||
// Cap_Penalty=alpha*W/sqrt(PermeabilityList[idx]/Dm->voxel_length/Dm->voxel_length);
|
||||
// idx = NLABELS;
|
||||
// }
|
||||
// }
|
||||
// //update greyscale potential
|
||||
// psi[n] = psi[n]*Cap_Penalty;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ScaLBL_CopyToDevice(Psi, psi, N*sizeof(double));
|
||||
// ScaLBL_Comm->Barrier();
|
||||
// delete [] psi;
|
||||
//}
|
||||
|
||||
void ScaLBL_GreyscaleColorModel::Create(){
|
||||
/*
|
||||
@ -695,12 +592,13 @@ void ScaLBL_GreyscaleColorModel::Create(){
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Bq, 7*dist_mem_size);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Den, 2*dist_mem_size);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Phi, sizeof(double)*Nx*Ny*Nz);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Psi, sizeof(double)*Nx*Ny*Nz);//greyscale potential
|
||||
//ScaLBL_AllocateDeviceMemory((void **) &Psi, sizeof(double)*Nx*Ny*Nz);//greyscale potential
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Pressure, sizeof(double)*Np);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Velocity, 3*sizeof(double)*Np);
|
||||
//ScaLBL_AllocateDeviceMemory((void **) &ColorGrad, 3*sizeof(double)*Np);
|
||||
//ScaLBL_AllocateDeviceMemory((void **) &GreySolidPhi, sizeof(double)*Nx*Ny*Nz);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &GreySolidGrad, 3*sizeof(double)*Np);
|
||||
//ScaLBL_AllocateDeviceMemory((void **) &GreySolidGrad, 3*sizeof(double)*Np);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &GreySolidW, sizeof(double)*Np);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Porosity_dvc, sizeof(double)*Np);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Permeability_dvc, sizeof(double)*Np);
|
||||
//...........................................................................
|
||||
@ -744,7 +642,7 @@ void ScaLBL_GreyscaleColorModel::Create(){
|
||||
AssignComponentLabels();//do open/black/grey nodes initialization
|
||||
AssignGreySolidLabels();
|
||||
AssignGreyPoroPermLabels();
|
||||
AssignGreyscalePotential();
|
||||
//AssignGreyscalePotential();
|
||||
Averages->SetParams(rhoA,rhoB,tauA,tauB,Fx,Fy,Fz,alpha,beta,GreyPorosity);
|
||||
ScaLBL_Comm->RegularLayout(Map,Porosity_dvc,Averages->Porosity);//porosity doesn't change over time
|
||||
}
|
||||
@ -1025,9 +923,9 @@ void ScaLBL_GreyscaleColorModel::Run(){
|
||||
ScaLBL_Comm_Regular->SendHalo(Phi);
|
||||
ScaLBL_Comm_Regular_2->SendHalo(Psi);
|
||||
//Model-1&4 with capillary pressure penalty for grey nodes
|
||||
ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(NeighborList, dvcMap, fq, Aq, Bq, Den, Phi, Psi, GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(NeighborList, dvcMap, fq, Aq, Bq, Den, Phi, GreySolidW,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, W, Nx, Nx*Ny, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, Nx, Nx*Ny, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
//Model-1&4
|
||||
//ScaLBL_D3Q19_AAodd_GreyscaleColor(NeighborList, dvcMap, fq, Aq, Bq, Den, Phi,GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
// rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
@ -1055,9 +953,9 @@ void ScaLBL_GreyscaleColorModel::Run(){
|
||||
}
|
||||
|
||||
//Model-1&4 with capillary pressure penalty for grey nodes
|
||||
ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(NeighborList, dvcMap, fq, Aq, Bq, Den, Phi, Psi, GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
ScaLBL_D3Q19_AAodd_GreyscaleColor_CP(NeighborList, dvcMap, fq, Aq, Bq, Den, Phi, GreySolidW,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, W, Nx, Nx*Ny, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, Nx, Nx*Ny, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
//Model-1&4
|
||||
//ScaLBL_D3Q19_AAodd_GreyscaleColor(NeighborList, dvcMap, fq, Aq, Bq, Den, Phi,GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
// rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
@ -1089,9 +987,9 @@ void ScaLBL_GreyscaleColorModel::Run(){
|
||||
ScaLBL_Comm_Regular->SendHalo(Phi);
|
||||
ScaLBL_Comm_Regular_2->SendHalo(Psi);
|
||||
//Model-1&4 with capillary pressure penalty for grey nodes
|
||||
ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(dvcMap, fq, Aq, Bq, Den, Phi, Psi, GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(dvcMap, fq, Aq, Bq, Den, Phi, GreySolidW,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, W, Nx, Nx*Ny, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, Nx, Nx*Ny, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
//Model-1&4
|
||||
//ScaLBL_D3Q19_AAeven_GreyscaleColor(dvcMap, fq, Aq, Bq, Den, Phi,GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
// rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
@ -1119,9 +1017,9 @@ void ScaLBL_GreyscaleColorModel::Run(){
|
||||
}
|
||||
|
||||
//Model-1&4 with capillary pressure penalty for grey nodes
|
||||
ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(dvcMap, fq, Aq, Bq, Den, Phi, Psi, GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
ScaLBL_D3Q19_AAeven_GreyscaleColor_CP(dvcMap, fq, Aq, Bq, Den, Phi, GreySolidW,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, W, Nx, Nx*Ny, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
alpha, beta, Fx, Fy, Fz, RecoloringOff, Nx, Nx*Ny, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
//Model-1&4
|
||||
//ScaLBL_D3Q19_AAeven_GreyscaleColor(dvcMap, fq, Aq, Bq, Den, Phi,GreySolidGrad,Porosity_dvc,Permeability_dvc,Velocity,Pressure,
|
||||
// rhoA, rhoB, tauA, tauB,tauA_eff, tauB_eff,
|
||||
@ -2093,6 +1991,169 @@ void ScaLBL_GreyscaleColorModel::WriteDebug(){
|
||||
// delete [] Dst;
|
||||
//}
|
||||
|
||||
//void ScaLBL_GreyscaleColorModel::AssignGreySolidLabels()//Model-4
|
||||
//{
|
||||
// // ONLY initialize grey nodes
|
||||
// // Key input parameters:
|
||||
// // 1. GreySolidLabels
|
||||
// // labels for grey nodes
|
||||
// // 2. GreySolidAffinity
|
||||
// // affinity ranges [-1,1]
|
||||
// // oil-wet > 0
|
||||
// // water-wet < 0
|
||||
// // neutral = 0
|
||||
// double *SolidPotential_host = new double [Nx*Ny*Nz];
|
||||
// double *GreySolidGrad_host = new double [3*Np];
|
||||
//
|
||||
// size_t NLABELS=0;
|
||||
// signed char VALUE=0;
|
||||
// double AFFINITY=0.f;
|
||||
//
|
||||
// auto LabelList = greyscaleColor_db->getVector<int>( "GreySolidLabels" );
|
||||
// auto AffinityList = greyscaleColor_db->getVector<double>( "GreySolidAffinity" );
|
||||
//
|
||||
// NLABELS=LabelList.size();
|
||||
// if (NLABELS != AffinityList.size()){
|
||||
// ERROR("Error: GreySolidLabels and GreySolidAffinity must be the same length! \n");
|
||||
// }
|
||||
//
|
||||
// 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;
|
||||
// VALUE=id[n];
|
||||
// AFFINITY=0.f;//all nodes except the specified grey nodes have grey-solid affinity = 0.0
|
||||
// // Assign the affinity from the paired list
|
||||
// for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
// //printf("idx=%i, value=%i, %i, \n",idx, VALUE,LabelList[idx]);
|
||||
// if (VALUE == LabelList[idx]){
|
||||
// AFFINITY=AffinityList[idx];
|
||||
// idx = NLABELS;
|
||||
// //Mask->id[n] = 0; // set mask to zero since this is an immobile component
|
||||
// }
|
||||
// }
|
||||
// SolidPotential_host[n] = AFFINITY;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Calculate grey-solid color-gradient
|
||||
// double *Dst;
|
||||
// Dst = new double [3*3*3];
|
||||
// for (int kk=0; kk<3; kk++){
|
||||
// for (int jj=0; jj<3; jj++){
|
||||
// for (int ii=0; ii<3; ii++){
|
||||
// int index = kk*9+jj*3+ii;
|
||||
// Dst[index] = sqrt(double(ii-1)*double(ii-1) + double(jj-1)*double(jj-1)+ double(kk-1)*double(kk-1));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// double w_face = 1.f;
|
||||
// double w_edge = 0.5;
|
||||
// double w_corner = 0.f;
|
||||
// //local
|
||||
// Dst[13] = 0.f;
|
||||
// //faces
|
||||
// Dst[4] = w_face;
|
||||
// Dst[10] = w_face;
|
||||
// Dst[12] = w_face;
|
||||
// Dst[14] = w_face;
|
||||
// Dst[16] = w_face;
|
||||
// Dst[22] = w_face;
|
||||
// // corners
|
||||
// Dst[0] = w_corner;
|
||||
// Dst[2] = w_corner;
|
||||
// Dst[6] = w_corner;
|
||||
// Dst[8] = w_corner;
|
||||
// Dst[18] = w_corner;
|
||||
// Dst[20] = w_corner;
|
||||
// Dst[24] = w_corner;
|
||||
// Dst[26] = w_corner;
|
||||
// // edges
|
||||
// Dst[1] = w_edge;
|
||||
// Dst[3] = w_edge;
|
||||
// Dst[5] = w_edge;
|
||||
// Dst[7] = w_edge;
|
||||
// Dst[9] = w_edge;
|
||||
// Dst[11] = w_edge;
|
||||
// Dst[15] = w_edge;
|
||||
// Dst[17] = w_edge;
|
||||
// Dst[19] = w_edge;
|
||||
// Dst[21] = w_edge;
|
||||
// Dst[23] = w_edge;
|
||||
// Dst[25] = w_edge;
|
||||
//
|
||||
// for (int k=1; k<Nz-1; k++){
|
||||
// for (int j=1; j<Ny-1; j++){
|
||||
// for (int i=1; i<Nx-1; i++){
|
||||
// int idx=Map(i,j,k);
|
||||
// if (!(idx < 0)){
|
||||
// double phi_x = 0.f;
|
||||
// double phi_y = 0.f;
|
||||
// double phi_z = 0.f;
|
||||
// for (int kk=0; kk<3; kk++){
|
||||
// for (int jj=0; jj<3; jj++){
|
||||
// for (int ii=0; ii<3; ii++){
|
||||
//
|
||||
// int index = kk*9+jj*3+ii;
|
||||
// double weight= Dst[index];
|
||||
//
|
||||
// int idi=i+ii-1;
|
||||
// int idj=j+jj-1;
|
||||
// int idk=k+kk-1;
|
||||
//
|
||||
// if (idi < 0) idi=0;
|
||||
// if (idj < 0) idj=0;
|
||||
// if (idk < 0) idk=0;
|
||||
// if (!(idi < Nx)) idi=Nx-1;
|
||||
// if (!(idj < Ny)) idj=Ny-1;
|
||||
// if (!(idk < Nz)) idk=Nz-1;
|
||||
//
|
||||
// int nn = idk*Nx*Ny + idj*Nx + idi;
|
||||
// double vec_x = double(ii-1);
|
||||
// double vec_y = double(jj-1);
|
||||
// double vec_z = double(kk-1);
|
||||
// double GWNS=SolidPotential_host[nn];
|
||||
// phi_x += GWNS*weight*vec_x;
|
||||
// phi_y += GWNS*weight*vec_y;
|
||||
// phi_z += GWNS*weight*vec_z;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (Averages->SDs(i,j,k)<2.0){
|
||||
// GreySolidGrad_host[idx+0*Np] = phi_x;
|
||||
// GreySolidGrad_host[idx+1*Np] = phi_y;
|
||||
// GreySolidGrad_host[idx+2*Np] = phi_z;
|
||||
// }
|
||||
// else{
|
||||
// GreySolidGrad_host[idx+0*Np] = 0.0;
|
||||
// GreySolidGrad_host[idx+1*Np] = 0.0;
|
||||
// GreySolidGrad_host[idx+2*Np] = 0.0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (rank==0){
|
||||
// printf("Number of Grey-solid labels: %lu \n",NLABELS);
|
||||
// for (unsigned int idx=0; idx<NLABELS; idx++){
|
||||
// VALUE=LabelList[idx];
|
||||
// AFFINITY=AffinityList[idx];
|
||||
// printf(" grey-solid label=%d, grey-solid affinity=%f\n",VALUE,AFFINITY);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// ScaLBL_CopyToDevice(GreySolidGrad, GreySolidGrad_host, 3*Np*sizeof(double));
|
||||
// ScaLBL_Comm->Barrier();
|
||||
// delete [] SolidPotential_host;
|
||||
// delete [] GreySolidGrad_host;
|
||||
// delete [] Dst;
|
||||
//}
|
||||
|
||||
|
||||
//--------- This is another old version of calculating greyscale-solid color-gradient modification-------//
|
||||
// **not working effectively, to be deprecated
|
||||
//void ScaLBL_GreyscaleColorModel::AssignGreySolidLabels()
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
double din,dout,inletA,inletB,outletA,outletB;
|
||||
double GreyPorosity;
|
||||
bool RecoloringOff;//recoloring can be turn off for grey nodes if this is true
|
||||
double W;//wetting strength paramter for capillary pressure penalty for grey nodes
|
||||
//double W;//wetting strength paramter for capillary pressure penalty for grey nodes
|
||||
|
||||
int Nx,Ny,Nz,N,Np;
|
||||
int rank,nprocx,nprocy,nprocz,nprocs;
|
||||
@ -67,13 +67,14 @@ public:
|
||||
double *fq, *Aq, *Bq;
|
||||
double *Den, *Phi;
|
||||
//double *GreySolidPhi; //Model 2 & 3
|
||||
double *GreySolidGrad;//Model 1 & 4
|
||||
//double *GreySolidGrad;//Model 1 & 4
|
||||
double *GreySolidW;
|
||||
//double *ColorGrad;
|
||||
double *Velocity;
|
||||
double *Pressure;
|
||||
double *Porosity_dvc;
|
||||
double *Permeability_dvc;
|
||||
double *Psi;
|
||||
//double *Psi;
|
||||
|
||||
private:
|
||||
Utilities::MPI comm;
|
||||
@ -90,7 +91,7 @@ private:
|
||||
void AssignComponentLabels();
|
||||
void AssignGreySolidLabels();
|
||||
void AssignGreyPoroPermLabels();
|
||||
void AssignGreyscalePotential();
|
||||
//void AssignGreyscalePotential();
|
||||
void ImageInit(std::string filename);
|
||||
double MorphInit(const double beta, const double morph_delta);
|
||||
double SeedPhaseField(const double seed_water_in_oil);
|
||||
|
Loading…
Reference in New Issue
Block a user