From c59dff1d4d72ae758ef5bc3fd19dd86a5068481e Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Fri, 13 Nov 2015 17:36:23 +0100
Subject: [PATCH] use different estimates for trS2, Q and R

stupid multifractality
---
 bfps/NavierStokes.py      | 5 ++++-
 bfps/cpp/fluid_solver.cpp | 8 ++++----
 bfps/cpp/fluid_solver.hpp | 2 +-
 bfps/fluid_base.py        | 3 +++
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/bfps/NavierStokes.py b/bfps/NavierStokes.py
index e5c84a69..e6333f14 100644
--- a/bfps/NavierStokes.py
+++ b/bfps/NavierStokes.py
@@ -123,12 +123,15 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
                     double *spec_vorticity = new double[fs->nshells*9];
                     fs->cospectrum(fs->cvelocity, fs->cvelocity, spec_velocity);
                     fs->cospectrum(fs->cvorticity, fs->cvorticity, spec_vorticity);
+                    max_estimates[0] = max_trS2_estimate;
+                    max_estimates[1] = max_Q_estimate;
+                    max_estimates[2] = max_R_estimate;
                     fs->compute_gradient_statistics(
                         fs->cvelocity,
                         trS2_Q_R_moments,
                         hist_trS2_Q_R,
                         hist_QR2D,
-                        max_vorticity_estimate*max_vorticity_estimate,
+                        max_estimates,
                         histogram_bins,
                         QR2D_histogram_bins);
                     fs->ift_velocity();
diff --git a/bfps/cpp/fluid_solver.cpp b/bfps/cpp/fluid_solver.cpp
index ae89158e..3a6dca4d 100644
--- a/bfps/cpp/fluid_solver.cpp
+++ b/bfps/cpp/fluid_solver.cpp
@@ -544,7 +544,7 @@ void fluid_solver<R>::compute_gradient_statistics( \
         double *moments, \
         ptrdiff_t *hist, \
         ptrdiff_t *QR2D_hist, \
-        double max_estimate, \
+        double max_estimates[], \
         int nbins, \
         int QR2D_nbins) \
 { \
@@ -573,9 +573,9 @@ void fluid_solver<R>::compute_gradient_statistics( \
     dz_u = ra + 4*this->cd->local_size; \
     double binsize[2]; \
     double tmp_max_estimate[4]; \
-    tmp_max_estimate[0] = max_estimate; \
-    tmp_max_estimate[1] = max_estimate; \
-    tmp_max_estimate[2] = max_estimate*sqrt(max_estimate); \
+    tmp_max_estimate[0] = max_estimates[0]; \
+    tmp_max_estimate[1] = max_estimates[1]; \
+    tmp_max_estimate[2] = max_estimates[2]; \
     tmp_max_estimate[3] = 1.0; /* 4th component is gonna be disregarded anyway... */ \
     binsize[0] = 2*tmp_max_estimate[2] / QR2D_nbins; \
     binsize[1] = 2*tmp_max_estimate[1] / QR2D_nbins; \
diff --git a/bfps/cpp/fluid_solver.hpp b/bfps/cpp/fluid_solver.hpp
index 883a3a96..0d184bcc 100644
--- a/bfps/cpp/fluid_solver.hpp
+++ b/bfps/cpp/fluid_solver.hpp
@@ -87,7 +87,7 @@ class fluid_solver:public fluid_solver_base<rnumber>
                 double *moments,
                 ptrdiff_t *histograms_1D,
                 ptrdiff_t *histogram_QR2D,
-                double trS2_max_estimate = 1.0,
+                double max_estimates[3],
                 int nbins_1D = 256,
                 int nbins_2D = 64);
 
diff --git a/bfps/fluid_base.py b/bfps/fluid_base.py
index 9c6b9132..ba1c10a3 100644
--- a/bfps/fluid_base.py
+++ b/bfps/fluid_base.py
@@ -79,6 +79,9 @@ class fluid_particle_base(bfps.code):
         self.parameters['QR2D_histogram_bins'] = 64
         self.parameters['max_velocity_estimate'] = 1.0
         self.parameters['max_vorticity_estimate'] = 1.0
+        self.parameters['max_trS2_estimate'] = 1.0
+        self.parameters['max_Q_estimate'] = 1.0
+        self.parameters['max_R_estimate'] = 1.0
         self.parameters['dealias_type'] = 1
         self.fluid_includes = '#include "fluid_solver.hpp"\n'
         self.fluid_variables = ''
-- 
GitLab