Skip to content
Snippets Groups Projects
Commit 8cf7cdcd authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fix vel gradient stats

first of all, moments were completely broken because fields weren't
prepared properly.
secondly, normalization is not actually required.
parent 76a89274
No related branches found
No related tags found
No related merge requests found
...@@ -566,15 +566,11 @@ void fluid_solver<R>::compute_gradient_statistics( \ ...@@ -566,15 +566,11 @@ void fluid_solver<R>::compute_gradient_statistics( \
ra + cc*this->cd->local_size*2); \ ra + cc*this->cd->local_size*2); \
} \ } \
/* velocity gradient is now stored, in real space, in ra */ \ /* velocity gradient is now stored, in real space, in ra */ \
R *vals_trS2 = this->rv[1]; \
R *vals_Q = this->rv[1] + 2*this->cd->local_size/3; \
R *vals_R = this->rv[1] + 4*this->cd->local_size/3; \
std::fill_n(this->rv[1], 2*this->cd->local_size, 0.0); \ std::fill_n(this->rv[1], 2*this->cd->local_size, 0.0); \
R *dx_u, *dy_u, *dz_u; \ R *dx_u, *dy_u, *dz_u; \
dx_u = ra; \ dx_u = ra; \
dy_u = ra + 2*this->cd->local_size; \ dy_u = ra + 2*this->cd->local_size; \
dz_u = ra + 4*this->cd->local_size; \ dz_u = ra + 4*this->cd->local_size; \
double norm3half = this->normalization_factor*sqrt(this->normalization_factor); \
double binsize[2]; \ double binsize[2]; \
double tmp_max_estimate[4]; \ double tmp_max_estimate[4]; \
tmp_max_estimate[0] = max_estimate; \ tmp_max_estimate[0] = max_estimate; \
...@@ -603,24 +599,22 @@ void fluid_solver<R>::compute_gradient_statistics( \ ...@@ -603,24 +599,22 @@ void fluid_solver<R>::compute_gradient_statistics( \
AxyAyx = dx_u[tindex+1]*dy_u[tindex+0]; \ AxyAyx = dx_u[tindex+1]*dy_u[tindex+0]; \
AyzAzy = dy_u[tindex+2]*dz_u[tindex+1]; \ AyzAzy = dy_u[tindex+2]*dz_u[tindex+1]; \
AzxAxz = dz_u[tindex+0]*dx_u[tindex+2]; \ AzxAxz = dz_u[tindex+0]*dx_u[tindex+2]; \
vals_Q[rindex] = (- ((AxxAxx + AyyAyy + AzzAzz)/2 - AxyAyx - AyzAzy - AzxAxz) / \ this->rv[1][tindex+1] = - ((AxxAxx + AyyAyy + AzzAzz)/2 - AxyAyx - AyzAzy - AzxAxz); \
this->normalization_factor); \ this->rv[1][tindex+2] = - (dx_u[tindex+0]*(AxxAxx/3 + AxyAyx + AzxAxz) + \
vals_R[rindex] = - (dx_u[tindex+0]*(AxxAxx/3 + AxyAyx + AzxAxz) + \ dy_u[tindex+1]*(AyyAyy/3 + AxyAyx + AyzAzy) + \
dy_u[tindex+1]*(AyyAyy/3 + AxyAyx + AyzAzy) + \ dz_u[tindex+2]*(AzzAzz/3 + AzxAxz + AyzAzy) + \
dz_u[tindex+2]*(AzzAzz/3 + AzxAxz + AyzAzy) + \ dx_u[tindex+1]*dy_u[tindex+2]*dz_u[tindex+0] + \
dx_u[tindex+1]*dy_u[tindex+2]*dz_u[tindex+0] + \ dx_u[tindex+2]*dy_u[tindex+0]*dz_u[tindex+1]); \
dx_u[tindex+2]*dy_u[tindex+0]*dz_u[tindex+1]) / norm3half; \ int bin0 = int((this->rv[1][tindex+2] + tmp_max_estimate[2]) / binsize[0]); \
int bin0 = int((vals_R[rindex] + tmp_max_estimate[2]) / binsize[0]); \ int bin1 = int((this->rv[1][tindex+1] + tmp_max_estimate[1]) / binsize[1]); \
int bin1 = int((vals_Q[rindex] + tmp_max_estimate[1]) / binsize[1]); \
if ((bin0 >= 0 && bin0 < QR2D_nbins) && \ if ((bin0 >= 0 && bin0 < QR2D_nbins) && \
(bin1 >= 0 && bin1 < QR2D_nbins)) \ (bin1 >= 0 && bin1 < QR2D_nbins)) \
local_hist[bin1*QR2D_nbins + bin0]++; \ local_hist[bin1*QR2D_nbins + bin0]++; \
Sxy = dx_u[tindex+1]+dy_u[tindex+0]; \ Sxy = dx_u[tindex+1]+dy_u[tindex+0]; \
Syz = dy_u[tindex+2]+dz_u[tindex+1]; \ Syz = dy_u[tindex+2]+dz_u[tindex+1]; \
Szx = dz_u[tindex+0]+dx_u[tindex+2]; \ Szx = dz_u[tindex+0]+dx_u[tindex+2]; \
vals_trS2[rindex] = ((AxxAxx + AyyAyy + AzzAzz + \ this->rv[1][tindex] = (AxxAxx + AyyAyy + AzzAzz + \
(Sxy*Sxy + Syz*Syz + Szx*Szx)/2) / \ (Sxy*Sxy + Syz*Syz + Szx*Szx)/2); \
this->normalization_factor); \
); \ ); \
FFTW(free)(ca); \ FFTW(free)(ca); \
MPI_Allreduce( \ MPI_Allreduce( \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment