Merge branch 'membrane' of github.com:JamesEMcClure/LBPM-WIA into membrane
This commit is contained in:
@@ -448,14 +448,14 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||||||
dist[nr18] = W2*psi; //f17 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
dist[nr18] = W2*psi; //f17 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||||
|
|
||||||
// q = 18
|
// q = 18
|
||||||
dist[nr17] = W2*psi; //f18 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
dist[nr17] = W2*psi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__global__ void dvc_ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
__global__ void dvc_ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
||||||
double *Den_charge, double *Psi,
|
double *Den_charge, double *Psi,
|
||||||
double *ElectricField, double tau,
|
double *ElectricField, double *Error, double tau,
|
||||||
double epsilon_LB, bool UseSlippingVelBC,
|
double epsilon_LB, bool UseSlippingVelBC,
|
||||||
int start, int finish, int Np) {
|
int start, int finish, int Np) {
|
||||||
int n;
|
int n;
|
||||||
@@ -597,28 +597,33 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||||||
double *Psi, double *ElectricField,
|
double *Psi, double *ElectricField,
|
||||||
double tau, double epsilon_LB, bool UseSlippingVelBC,
|
double tau, double epsilon_LB, bool UseSlippingVelBC,
|
||||||
int start, int finish, int Np) {
|
int start, int finish, int Np) {
|
||||||
//cudaProfilerStart();
|
|
||||||
|
hipFuncSetCacheConfig( (void*) dvc_ScaLBL_D3Q19_AAodd_Poisson, hipFuncCachePreferL1);
|
||||||
|
|
||||||
dvc_ScaLBL_D3Q19_AAodd_Poisson<<<NBLOCKS,NTHREADS >>>(neighborList, Map,
|
dvc_ScaLBL_D3Q19_AAodd_Poisson<<<NBLOCKS,NTHREADS >>>(neighborList, Map,
|
||||||
dist, Den_charge, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, start, finish, Np);
|
dist, Den_charge, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, start, finish, Np);
|
||||||
|
|
||||||
hipError_t err = hipGetLastError();
|
hipError_t err = hipGetLastError();
|
||||||
if (hipSuccess != err){
|
if (hipSuccess != err){
|
||||||
printf("CUDA error in dvc_ScaLBL_D3Q19_AAodd_Poisson: %s \n",hipGetErrorString(err));
|
printf("Hip error in dvc_ScaLBL_D3Q19_AAodd_Poisson: %s \n",hipGetErrorString(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
||||||
double *Den_charge, double *Psi,
|
double *Den_charge, double *Psi,
|
||||||
double *ElectricField, double tau,
|
double *ElectricField, double *Error, double tau,
|
||||||
double epsilon_LB, bool UseSlippingVelBC,
|
double epsilon_LB, bool UseSlippingVelBC,
|
||||||
int start, int finish, int Np) {
|
int start, int finish, int Np) {
|
||||||
|
|
||||||
|
hipFuncSetCacheConfig( (void*) dvc_ScaLBL_D3Q19_AAeven_Poisson, hipFuncCachePreferL1);
|
||||||
|
|
||||||
|
|
||||||
dvc_ScaLBL_D3Q19_AAeven_Poisson<<<NBLOCKS,NTHREADS >>>( Map, dist, Den_charge, Psi,
|
dvc_ScaLBL_D3Q19_AAeven_Poisson<<<NBLOCKS,NTHREADS >>>( Map, dist, Den_charge, Psi,
|
||||||
ElectricField, tau, epsilon_LB, UseSlippingVelBC, start, finish, Np);
|
ElectricField, Error, tau, epsilon_LB, UseSlippingVelBC, start, finish, Np);
|
||||||
|
|
||||||
hipError_t err = hipGetLastError();
|
hipError_t err = hipGetLastError();
|
||||||
if (hipSuccess != err){
|
if (hipSuccess != err){
|
||||||
printf("CUDA error in dvc_ScaLBL_D3Q19_AAeven_Poisson: %s \n",hipGetErrorString(err));
|
printf("Hip error in dvc_ScaLBL_D3Q19_AAeven_Poisson: %s \n",hipGetErrorString(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,7 +635,7 @@ extern "C" void ScaLBL_D3Q19_Poisson_Init(int *Map, double *dist, double *Psi,
|
|||||||
|
|
||||||
hipError_t err = hipGetLastError();
|
hipError_t err = hipGetLastError();
|
||||||
if (hipSuccess != err){
|
if (hipSuccess != err){
|
||||||
printf("CUDA error in ScaLBL_D3Q19_Poisson_Init: %s \n",hipGetErrorString(err));
|
printf("Hip error in ScaLBL_D3Q19_Poisson_Init: %s \n",hipGetErrorString(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -563,44 +563,7 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||||||
ScaLBL_CopyToHost(Psi_previous.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
ScaLBL_CopyToHost(Psi_previous.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
||||||
}
|
}
|
||||||
if (timestep%analysis_interval==0){
|
if (timestep%analysis_interval==0){
|
||||||
if (tolerance_method.compare("MSE")==0){
|
if (rank==0) printf(" ... getting Poisson solver error \n");
|
||||||
double count_loc=0;
|
|
||||||
double count;
|
|
||||||
double MSE_loc=0.0;
|
|
||||||
ScaLBL_CopyToHost(Psi_host.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
|
||||||
for (int k=1; k<Nz-1; k++){
|
|
||||||
for (int j=1; j<Ny-1; j++){
|
|
||||||
for (int i=1; i<Nx-1; i++){
|
|
||||||
if (Distance(i,j,k) > 0){
|
|
||||||
MSE_loc += (Psi_host(i,j,k) - Psi_previous(i,j,k))*(Psi_host(i,j,k) - Psi_previous(i,j,k));
|
|
||||||
count_loc+=1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
error=Dm->Comm.sumReduce(MSE_loc);
|
|
||||||
count=Dm->Comm.sumReduce(count_loc);
|
|
||||||
error /= count;
|
|
||||||
}
|
|
||||||
else if (tolerance_method.compare("MSE_max")==0){
|
|
||||||
vector<double>MSE_loc;
|
|
||||||
double MSE_loc_max;
|
|
||||||
ScaLBL_CopyToHost(Psi_host.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
|
||||||
for (int k=1; k<Nz-1; k++){
|
|
||||||
for (int j=1; j<Ny-1; j++){
|
|
||||||
for (int i=1; i<Nx-1; i++){
|
|
||||||
if (Distance(i,j,k) > 0){
|
|
||||||
MSE_loc.push_back((Psi_host(i,j,k) - Psi_previous(i,j,k))*(Psi_host(i,j,k) - Psi_previous(i,j,k)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vector<double>::iterator it_max = max_element(MSE_loc.begin(),MSE_loc.end());
|
|
||||||
unsigned int idx_max=distance(MSE_loc.begin(),it_max);
|
|
||||||
MSE_loc_max=MSE_loc[idx_max];
|
|
||||||
error=Dm->Comm.maxReduce(MSE_loc_max);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
double err = 0.0;
|
double err = 0.0;
|
||||||
double max_error = 0.0;
|
double max_error = 0.0;
|
||||||
ScaLBL_CopyToHost(host_Error,ResidualError,sizeof(double)*Np);
|
ScaLBL_CopyToHost(host_Error,ResidualError,sizeof(double)*Np);
|
||||||
@@ -611,9 +574,6 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
error=Dm->Comm.maxReduce(max_error);
|
error=Dm->Comm.maxReduce(max_error);
|
||||||
}
|
|
||||||
ScaLBL_CopyToHost(Psi_previous.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
|
||||||
|
|
||||||
|
|
||||||
/* compute the eletric field */
|
/* compute the eletric field */
|
||||||
//ScaLBL_D3Q19_Poisson_getElectricField(fq, ElectricField, tau, Np);
|
//ScaLBL_D3Q19_Poisson_getElectricField(fq, ElectricField, tau, Np);
|
||||||
|
|||||||
Reference in New Issue
Block a user