# HG changeset patch
# User Ashwin Vishnu <avmo@kth.se>
# Date 1447193878 -3600
#      Tue Nov 10 23:17:58 2015 +0100
# Node ID 0340e6f5bb56f0f6b39ce7ba751f0cead58c62a7
# Parent  effcffdf6b2c454417f26440846e2182c1bb3e86
Few bugs, more remain undetected for sw1l forcing

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -10,6 +10,8 @@
 *.out
 *.kate-swp
 \#*\#
+.spyderworkspace
+.spyderproject
 
 doc/_build/*
 doc/**generated/*
diff --git a/fluidsim/base/preprocess/pseudo_spect.py b/fluidsim/base/preprocess/pseudo_spect.py
--- a/fluidsim/base/preprocess/pseudo_spect.py
+++ b/fluidsim/base/preprocess/pseudo_spect.py
@@ -20,15 +20,14 @@
     def __call__(self):
         if self.params.enable:
             self.normalize_init_fields()
-            self.set_viscosity()
             if self.sim.params.FORCING:
-                self.set_forcing_rate()
+                pass#self.set_forcing_rate()
+            self.set_viscosity()            
             self.sim.output.save_info_solver_params_xml(replace=True)
     
     def normalize_init_fields(self):
         """
         A non-dimensionalization procedure for the initialized fields.
-        .. TODO: fix init_fft_from function
         """
         state = self.sim.state
         scale = self.params.init_field_scale
@@ -47,11 +46,7 @@
                 self.sim.state.init_from_uxuyfft(ux_fft, uy_fft)
             except AttributeError:
                 rot_fft = self.oper.rotfft_from_vecfft(ux_fft, uy_fft)
-                self.sim.state.init_fft_from(ux_fft=ux_fft,
-                                             uy_fft=uy_fft,
-                                             rot_fft=rot_fft) 
-                #self.sim.state.init_fft_from({'ux_fft':ux_fft,
-                #                             'uy_fft':uy_fft})
+                self.sim.state.init_fft_from(rot_fft=rot_fft) 
             
     def set_viscosity(self):
         """
@@ -82,7 +77,7 @@
         
         delta_x = self.oper.deltax
         k_max = np.pi / delta_x * self.sim.params.oper.coef_dealiasing # Smallest resolved scale
-        length_scale = C / k_max # OR 1 / k_d, the dissipative wave number
+        length_scale = C * np.pi / k_max # OR np.pi / k_d, the dissipative wave number
     
         if viscosity_scale == 'enstrophy':                     
             omega_0 = self.output.compute_enstrophy()
diff --git a/fluidsim/base/state.py b/fluidsim/base/state.py
--- a/fluidsim/base/state.py
+++ b/fluidsim/base/state.py
@@ -188,4 +188,4 @@
                 raise ValueError(
                     'Do not know how to initialize with key "{}".'.format(key))
             
-                self.state_fft.set_var(key, value)
+            self.state_fft.set_var(key, value)
diff --git a/fluidsim/solvers/sw1l/output/spect_energy_budget.py b/fluidsim/solvers/sw1l/output/spect_energy_budget.py
--- a/fluidsim/solvers/sw1l/output/spect_energy_budget.py
+++ b/fluidsim/solvers/sw1l/output/spect_energy_budget.py
@@ -1279,8 +1279,8 @@
         print(to_print)
 
         to_print = ('plot fluxes 2D' +
-                   ', tmin = {0:8.6g} ; tmax = {1:8.6g} ; delta_t = {2:8.6g}' +
-                   ', imin = {3:8d} ; imax = {4:8d} ; delta_i = {5:8d}'.format(
+                   (', tmin = {0:8.6g} ; tmax = {1:8.6g} ; delta_t = {2:8.6g}' +
+                    ', imin = {3:8d} ; imax = {4:8d} ; delta_i = {5:8d}').format(
                        tmin_plot, tmax_plot, delta_t,
                        imin_plot, imax_plot, delta_i_plot))
         print(to_print)