update error analysis for Poisson solver
This commit is contained in:
parent
d3dc35c018
commit
cf4f2b63da
@ -384,7 +384,7 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||||||
|
|
||||||
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) {
|
||||||
int n;
|
int n;
|
||||||
@ -869,6 +869,8 @@ extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
|||||||
|
|
||||||
sum_q = f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18;
|
sum_q = f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18;
|
||||||
error = 8.0*(sum_q - f0) + rho_e;
|
error = 8.0*(sum_q - f0) + rho_e;
|
||||||
|
|
||||||
|
Error[n] = error;
|
||||||
|
|
||||||
psi = 2.0*(f0*(1.0 - rlx) + rlx*(sum_q + 0.125*rho_e));
|
psi = 2.0*(f0*(1.0 - rlx) + rlx*(sum_q + 0.125*rho_e));
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||||||
|
|
||||||
__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;
|
||||||
@ -637,7 +637,7 @@ __global__ void dvc_ScaLBL_D3Q19_Poisson_Init(int *Map, double *dist, double *P
|
|||||||
|
|
||||||
extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
||||||
double *dist, double *Den_charge,
|
double *dist, double *Den_charge,
|
||||||
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();
|
//cudaProfilerStart();
|
||||||
@ -652,12 +652,12 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||||||
|
|
||||||
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) {
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
cudaError_t err = cudaGetLastError();
|
cudaError_t err = cudaGetLastError();
|
||||||
if (cudaSuccess != err){
|
if (cudaSuccess != err){
|
||||||
|
@ -533,6 +533,8 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||||||
//double starttime,stoptime,cputime;
|
//double starttime,stoptime,cputime;
|
||||||
//comm.barrier();
|
//comm.barrier();
|
||||||
//auto t1 = std::chrono::system_clock::now();
|
//auto t1 = std::chrono::system_clock::now();
|
||||||
|
double *host_Error;
|
||||||
|
host_Error = new double [Np];
|
||||||
|
|
||||||
timestep=0;
|
timestep=0;
|
||||||
double error = 1.0;
|
double error = 1.0;
|
||||||
@ -595,7 +597,16 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||||||
error=Dm->Comm.maxReduce(MSE_loc_max);
|
error=Dm->Comm.maxReduce(MSE_loc_max);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ERROR("Error: user-specified tolerance_method cannot be identified; check you input database! \n");
|
double err = 0.0;
|
||||||
|
double max_error = 0.0;
|
||||||
|
ScaLBL_CopyToHost(host_Error,ResidualError,sizeof(double)*Np);
|
||||||
|
for (int idx=0; idx<Np; idx++){
|
||||||
|
err = host_Error[idx]*host_Error[idx];
|
||||||
|
if (err > max_error ){
|
||||||
|
max_error = err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
error=Dm->Comm.maxReduce(max_error);
|
||||||
}
|
}
|
||||||
ScaLBL_CopyToHost(Psi_previous.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
ScaLBL_CopyToHost(Psi_previous.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
||||||
|
|
||||||
@ -721,9 +732,9 @@ void ScaLBL_Poisson::SolvePoissonAAodd(double *ChargeDensity, bool UseSlippingVe
|
|||||||
|
|
||||||
void ScaLBL_Poisson::SolvePoissonAAeven(double *ChargeDensity, bool UseSlippingVelBC){
|
void ScaLBL_Poisson::SolvePoissonAAeven(double *ChargeDensity, bool UseSlippingVelBC){
|
||||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError, tau, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError, tau, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||||
ScaLBL_Comm->Barrier();
|
ScaLBL_Comm->Barrier();
|
||||||
//ScaLBL_Comm->SolidDirichletAndNeumannD3Q7(fq, Psi, Psi_BCLabel);
|
//ScaLBL_Comm->SolidDirichletAndNeumannD3Q7(fq, Psi, Psi_BCLabel);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user