diff --git a/doc/examples.rst b/doc/examples.rst new file mode 100644 index 0000000000000000000000000000000000000000..285ed09aac75235f6b7eab3f7750ac00b0022693_ZG9jL2V4YW1wbGVzLnJzdA== --- /dev/null +++ b/doc/examples.rst @@ -0,0 +1,7 @@ +Examples +======== + +.. toctree:: + :maxdepth: 2 + + examples/running_simul diff --git a/doc/examples/running_simul.rst b/doc/examples/running_simul.rst new file mode 100644 index 0000000000000000000000000000000000000000..285ed09aac75235f6b7eab3f7750ac00b0022693_ZG9jL2V4YW1wbGVzL3J1bm5pbmdfc2ltdWwucnN0 --- /dev/null +++ b/doc/examples/running_simul.rst @@ -0,0 +1,4 @@ +Running a simple simulation +=========================== + +.. literalinclude:: simul_ns2d.py diff --git a/doc/examples/simul_ns2d.py b/doc/examples/simul_ns2d.py new file mode 100644 index 0000000000000000000000000000000000000000..285ed09aac75235f6b7eab3f7750ac00b0022693_ZG9jL2V4YW1wbGVzL3NpbXVsX25zMmQucHk= --- /dev/null +++ b/doc/examples/simul_ns2d.py @@ -0,0 +1,51 @@ +from math import pi + +from fluidsim.solvers.ns2d.solver import Simul + +import fluiddyn as fld + +params = Simul.create_default_params() + +params.short_name_type_run = 'test' + +params.oper.nx = params.oper.ny = nh = 32 +params.oper.Lx = params.oper.Ly = Lh = 2 * pi + +delta_x = Lh / nh +params.nu_8 = 2.*params.forcing.forcing_rate**(1./3)*delta_x**8 + +params.time_stepping.t_end = 2. + +params.init_fields.type = 'dipole' + +params.FORCING = True +params.forcing.type = 'random' + +params.output.sub_directory = 'examples' + +params.output.periods_print.print_stdout = 0.25 + +params.output.periods_save.phys_fields = 1. +params.output.periods_save.spectra = 0.5 +params.output.periods_save.spatial_means = 0.05 +params.output.periods_save.spect_energy_budg = 0.5 +params.output.periods_save.increments = 0.5 + +params.output.periods_plot.phys_fields = 0.0 + +params.output.ONLINE_PLOT_OK = False + +# params.output.spectra.HAS_TO_PLOT_SAVED = True +# params.output.spatial_means.HAS_TO_PLOT_SAVED = True +# params.output.spect_energy_budg.HAS_TO_PLOT_SAVED = True +# params.output.increments.HAS_TO_PLOT_SAVED = True + +params.output.phys_fields.field_to_plot = 'rot' + +sim = Simul(params) + +sim.output.phys_fields.plot() +sim.time_stepping.start() +sim.output.phys_fields.plot() + +fld.show() diff --git a/doc/index.rst b/doc/index.rst index d57b18c9d0908371641b9c32be5665095ecddeb0_ZG9jL2luZGV4LnJzdA==..285ed09aac75235f6b7eab3f7750ac00b0022693_ZG9jL2luZGV4LnJzdA== 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -43,7 +43,7 @@ install tutorials - + examples Modules Reference ----------------- @@ -56,6 +56,6 @@ fluidsim.solvers fluidsim.util -Scripts and examples --------------------- +Scripts +------- @@ -61,7 +61,7 @@ -FluidSim also comes with scripts and examples. They are organised in -the following directories: +FluidSim also comes with scripts. They are organised in the following +directories: .. autosummary:: :toctree: generated/ @@ -64,10 +64,10 @@ .. autosummary:: :toctree: generated/ - examples.launch - examples.plot_results - examples.util + scripts.launch + scripts.plot_results + scripts.util More ---- diff --git a/doc/ipynb/tuto_user.ipynb b/doc/ipynb/tuto_user.ipynb index d57b18c9d0908371641b9c32be5665095ecddeb0_ZG9jL2lweW5iL3R1dG9fdXNlci5pcHluYg==..285ed09aac75235f6b7eab3f7750ac00b0022693_ZG9jL2lweW5iL3R1dG9fdXNlci5pcHluYg== 100644 --- a/doc/ipynb/tuto_user.ipynb +++ b/doc/ipynb/tuto_user.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 19, + "execution_count": 1, "metadata": { "collapsed": false }, @@ -31,7 +31,123 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "In this tutorial, I'm going to show how to run a simple simulation with a solver already written that solves the 2 dimensional Navier-Stokes equations. I'm also going to present some useful concepts and objects used in the simulation part of FluidDyn." + "In this tutorial, I'm going to show how to run a simple simulation with a solver that solves the 2 dimensional Navier-Stokes equations. I'm also going to present some useful concepts and objects used in FluidSim." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## A minimal simulation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "But fisrt, let's see what is needed to run a very simple simulation. For the initialization (with default parameters):" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*************************************\n", + "Program FluidDyn\n", + "\n", + "solver NS2D, RK4 and sequential,\n", + "type fft: FFTWCY\n", + "nx = 48 ; ny = 48\n", + "Lx = 8. ; Ly = 8.\n", + "path_run =\n", + "/home/pierre/Sim_data/NS2D_L=8.x8._48x48_2015-06-20_00-30-51\n", + "init_fields.type: constant\n", + "Initialization outputs:\n", + "<class 'fluidsim.base.output.increments.Increments'> increments\n", + "<class 'fluidsim.base.output.phys_fields.PhysFieldsBase'> phys_fields\n", + "<class 'fluidsim.solvers.ns2d.output.spectra.SpectraNS2D'> spectra\n", + "<class 'fluidsim.solvers.ns2d.output.spatial_means.SpatialMeansNS2D'> spatial_means\n", + "<class 'fluidsim.solvers.ns2d.output.spect_energy_budget.SpectralEnergyBudgetNS2D'> spect_energy_budg\n", + "\n", + "Memory usage at the end of init. (equiv. seq.): 75.29296875 Mo\n", + "Size of state_fft (equiv. seq.): 0.0192 Mo\n" + ] + } + ], + "source": [ + "from fluidsim.solvers.ns2d.solver import Simul\n", + "params = Simul.create_default_params()\n", + "sim = Simul(params)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And then to run the simulation:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*************************************\n", + "Beginning of the computation\n", + "save state_phys in file state_phys_t=000.000_it=0.hd5\n", + " compute until t = 10\n", + "it = 0 ; t = 0 ; deltat = 0.083333\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + "\n", + "it = 6 ; t = 1.08333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.576 s\n", + "it = 12 ; t = 2.28333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.288 s\n", + "it = 17 ; t = 3.28333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.25 s\n", + "it = 22 ; t = 4.28333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.271 s\n", + "it = 27 ; t = 5.28333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.234 s\n", + "it = 32 ; t = 6.28333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.123 s\n", + "it = 37 ; t = 7.28333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.113 s\n", + "it = 43 ; t = 8.48333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.0508 s\n", + "it = 49 ; t = 9.68333 ; deltat = 0.2\n", + " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", + " estimated remaining duration = 0.0137 s\n", + "Computation completed in 0.538205 s\n", + "path_run =\n", + "/home/pierre/Sim_data/NS2D_L=8.x8._48x48_2015-06-20_00-30-51\n", + "save state_phys in file state_phys_t=010.083_it=51.hd5\n" + ] + } + ], + "source": [ + "sim.time_stepping.start()" ] }, { @@ -45,8 +161,8 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The first thing to do is to import a \"solver\" module. Any solver module has to provide a class called \"Simul\" and an object called \"info_solver\", which is an instance of the class :class:`fluiddyn.simul.base.info_solver_params.InfoSolverPseudoSpectral`. The solver module that we are going to use can be imported like this:" + "The first thing to do is to import a \"Simulation\" class from a \"solver\" module. Any solver module has to provide a class called \"Simul\". We have already seen that the Simul class can be imported like this:" ] }, { "cell_type": "code", @@ -49,8 +165,8 @@ ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -54,16 +170,5 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "'/home/pierre/Dev/fluidsim/fluidsim/solvers/ns2d/solver.pyc'" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ @@ -69,9 +174,8 @@ "source": [ - "from fluidsim.solvers.ns2d import solver\n", - "solver.__file__" + "from fluidsim.solvers.ns2d.solver import Simul" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ @@ -72,11 +176,11 @@ ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "There is also another quite convenient way to import a solver from a string, here \"NS2D\":" + "but there is another convenient way to import it from a string:" ] }, { "cell_type": "code", @@ -79,8 +183,8 @@ ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -84,16 +188,5 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "'/home/pierre/Dev/fluidsim/fluidsim/solvers/ns2d/solver.pyc'" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ @@ -99,6 +192,5 @@ "source": [ - "solver = fld.simul.import_module_solver_from_key('NS2D')\n", - "solver.__file__" + "Simul = fld.simul.import_simul_class_from_key('ns2d')" ] }, { @@ -112,8 +204,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The next step is to create an object `params` from the information contained in the module `solver`:" + "The next step is to create an object ``params`` from the information contained in the class ``Simul``:" ] }, { "cell_type": "code", @@ -116,10 +208,10 @@ ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [], "source": [ @@ -121,12 +213,12 @@ "metadata": { "collapsed": false }, "outputs": [], "source": [ - "params = solver.Simul.create_default_params()" + "params = Simul.create_default_params()" ] }, { "cell_type": "raw", "metadata": {}, "source": [ @@ -127,11 +219,11 @@ ] }, { "cell_type": "raw", "metadata": {}, "source": [ - "The object ``params`` is an instance of the class :class:`fluiddyn.simul.base.info_solver_params.Parameters` (which inherit of :class:`fluiddyn.util.containerxml.ContainerXML`). It is usually a quite complex object containing many attributes. In this case, it contains parameters (if you don't understand the next command, have a look at this section of the official Python tutorial on `the list comprehension <https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions>`_):" + "The object ``params`` is an instance of the class :class:`fluidsim.base.params.Parameters` (which inherits from :class:`fluiddyn.util.paramcontainer.ParamContainer`). It is usually a quite complex object containing many attributes. In this case, it contains many parameters (if you don't understand the next command, you should have a look at the section on `list comprehensions <https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions>`_ of the official Python tutorial):" ] }, { "cell_type": "code", @@ -134,8 +226,8 @@ ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 7, "metadata": { "collapsed": false }, @@ -159,7 +251,7 @@ " 'time_stepping']" ] }, - "execution_count": 23, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -177,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 8, "metadata": { "collapsed": false }, @@ -205,7 +297,7 @@ " '_tag_children']" ] }, - "execution_count": 24, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -218,8 +310,8 @@ "cell_type": "raw", "metadata": {}, "source": [ - "Some of the attributes of ``params`` are simple Python objects and others can be other :class:`fluiddyn.simul.base.info_solver_params.Parameters`:" + "Some of the attributes of ``params`` are simple Python objects and others can be other :class:`fluidsim.base.params.Parameters`:" ] }, { "cell_type": "code", @@ -222,8 +314,8 @@ ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 9, "metadata": { "collapsed": false }, @@ -244,7 +336,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 10, "metadata": { "collapsed": false }, @@ -262,6 +354,7 @@ " 'phys_fields',\n", " 'spatial_means',\n", " 'spect_energy_budg',\n", - " 'spectra']" + " 'spectra',\n", + " 'sub_directory']" ] }, @@ -266,6 +359,6 @@ ] }, - "execution_count": 26, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -278,8 +371,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Therefore, the object `params` contains a tree of parameters. This tree can be represented as xml code:" + "We see that the object `params` contains a tree of parameters. This tree can be represented as xml code:" ] }, { "cell_type": "code", @@ -282,8 +375,8 @@ ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 11, "metadata": { "collapsed": false }, @@ -292,7 +385,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "<fluidsim.base.params.Parameters object at 0x7feb9baf2610>\n", + "<fluidsim.base.params.Parameters object at 0x7f74c646b310>\n", "\n", "<params ONLY_COARSE_OPER=\"False\" short_name_type_run=\"\" beta=\"0.0\" nu_2=\"0.0\"\n", " NEW_DIR_RESULTS=\"True\" nu_4=\"0.0\" nu_8=\"0.0\" FORCING=\"False\"\n", @@ -313,10 +406,11 @@ " <forcing nkmax_forcing=\"5\" nkmin_forcing=\"4\" key_forced=\"rot_fft\"\n", " available_types=\"['proportional', 'random']\" type=\"\"\n", " forcing_rate=\"1\">\n", - " <random type_normalize=\"2nd_degree_eq\"/> \n", + " <random type_normalize=\"2nd_degree_eq\"\n", + " time_correlation=\"based_on_forcing_rate\"/> \n", "\n", " </forcing>\n", "\n", " <time_stepping type_time_scheme=\"RK4\" it_end=\"10\" USE_CFL=\"True\" deltat0=\"0.2\"\n", " t_end=\"10.0\" USE_T_END=\"True\"/> \n", "\n", @@ -317,10 +411,11 @@ "\n", " </forcing>\n", "\n", " <time_stepping type_time_scheme=\"RK4\" it_end=\"10\" USE_CFL=\"True\" deltat0=\"0.2\"\n", " t_end=\"10.0\" USE_T_END=\"True\"/> \n", "\n", - " <output period_refresh_plots=\"1\" ONLINE_PLOT_OK=\"True\" HAS_TO_SAVE=\"True\">\n", + " <output period_refresh_plots=\"1\" HAS_TO_SAVE=\"True\" ONLINE_PLOT_OK=\"True\"\n", + " sub_directory=\"\">\n", " <periods_plot phys_fields=\"0\"/> \n", "\n", " <periods_print print_stdout=\"1.0\"/> \n", @@ -365,7 +460,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 12, "metadata": { "collapsed": false }, @@ -369,17 +464,6 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "'constant'" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "params.nu_2 = 1.\n", @@ -384,7 +468,6 @@ "source": [ "params.nu_2 = 1.\n", - "params.FORCING = False\n", - "params.init_fields.type" + "params.FORCING = False" ] }, { @@ -396,7 +479,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "metadata": { "collapsed": false }, @@ -422,7 +505,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This behaviour is much safer than using a text file or a python file for the parameters. " + "This behaviour is much safer than using a text file or a python file for the parameters. In order to discover the different parameters for a solver, create the ``params`` object in Ipython, print it and use the completion (with the tab key)." ] }, { @@ -441,7 +524,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 14, "metadata": { "collapsed": false }, @@ -453,8 +536,8 @@ "*************************************\n", "Program FluidDyn\n", "\n", - "solver NS2D, RK4 and sequenciel,\n", + "solver NS2D, RK4 and sequential,\n", "type fft: FFTWCY\n", "nx = 48 ; ny = 48\n", "Lx = 8. ; Ly = 8.\n", "path_run =\n", @@ -457,8 +540,8 @@ "type fft: FFTWCY\n", "nx = 48 ; ny = 48\n", "Lx = 8. ; Ly = 8.\n", "path_run =\n", - "/home/pierre/Sim_data/NS2D_L=8.x8._48x48_2015-04-19_18-17-50\n", + "/home/pierre/Sim_data/NS2D_L=8.x8._48x48_2015-06-20_00-30-54\n", "init_fields.type: constant\n", "Initialization outputs:\n", "<class 'fluidsim.base.output.increments.Increments'> increments\n", @@ -467,9 +550,9 @@ "<class 'fluidsim.solvers.ns2d.output.spatial_means.SpatialMeansNS2D'> spatial_means\n", "<class 'fluidsim.solvers.ns2d.output.spect_energy_budget.SpectralEnergyBudgetNS2D'> spect_energy_budg\n", "\n", - "Memory usage at the end of init. (equiv. seq.): 75.234375 Mo\n", + "Memory usage at the end of init. (equiv. seq.): 77.703125 Mo\n", "Size of state_fft (equiv. seq.): 0.0192 Mo\n" ] } ], "source": [ @@ -471,12 +554,12 @@ "Size of state_fft (equiv. seq.): 0.0192 Mo\n" ] } ], "source": [ - "sim = solver.Simul(params)" + "sim = Simul(params)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ @@ -477,11 +560,11 @@ ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "which initializes everything needed to run the simulation. The object `sim` has few attributes:" + "which initializes everything needed to run the simulation. The object `sim` has a limited number of attributes:" ] }, { "cell_type": "code", @@ -484,8 +567,8 @@ ] }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 15, "metadata": { "collapsed": false }, @@ -508,7 +591,7 @@ " 'time_stepping']" ] }, - "execution_count": 31, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -521,8 +604,8 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The object ``sim.info`` is a :class:`fluiddyn.util.paramcontainer.ParamContainer` which contains all the information on the solver (in ``sim.info.solver``) and on specific parameters for this simulation (in ``sim.info.solver``, which is actually the same object as ``sim.params``):" + "The object ``sim.info`` is a :class:`fluiddyn.util.paramcontainer.ParamContainer` which contains all the information on the solver (in ``sim.info.solver``) and on specific parameters for this simulation (in ``sim.info.solver``):" ] }, { "cell_type": "code", @@ -525,8 +608,8 @@ ] }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -547,7 +630,51 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sim.info.solver is sim.info_solver" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sim.info.params is sim.params" + ] + }, + { + "cell_type": "code", + "execution_count": 19, "metadata": { "collapsed": false }, @@ -556,7 +683,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "<fluidsim.solvers.ns2d.solver.InfoSolverNS2D object at 0x7feb9badf450>\n", + "<fluidsim.solvers.ns2d.solver.InfoSolverNS2D object at 0x7f74f573c1d0>\n", "\n", "<solver class_name=\"Simul\" module_name=\"fluidsim.solvers.ns2d.solver\"\n", " short_name=\"NS2D\">\n", @@ -664,7 +791,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 20, "metadata": { "collapsed": false }, @@ -682,6 +809,6 @@ "\n", "it = 6 ; t = 1.08333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.332 s\n", + " estimated remaining duration = 0.359 s\n", "it = 12 ; t = 2.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -686,5 +813,5 @@ "it = 12 ; t = 2.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.272 s\n", + " estimated remaining duration = 0.281 s\n", "it = 17 ; t = 3.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -689,5 +816,5 @@ "it = 17 ; t = 3.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.362 s\n", + " estimated remaining duration = 0.281 s\n", "it = 22 ; t = 4.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -692,5 +819,5 @@ "it = 22 ; t = 4.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.268 s\n", + " estimated remaining duration = 0.199 s\n", "it = 27 ; t = 5.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -695,5 +822,5 @@ "it = 27 ; t = 5.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.216 s\n", + " estimated remaining duration = 0.208 s\n", "it = 32 ; t = 6.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -698,5 +825,5 @@ "it = 32 ; t = 6.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.16 s\n", + " estimated remaining duration = 0.162 s\n", "it = 37 ; t = 7.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -701,5 +828,5 @@ "it = 37 ; t = 7.28333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.129 s\n", + " estimated remaining duration = 0.123 s\n", "it = 43 ; t = 8.48333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -704,5 +831,5 @@ "it = 43 ; t = 8.48333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.0715 s\n", + " estimated remaining duration = 0.0576 s\n", "it = 49 ; t = 9.68333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", @@ -707,5 +834,5 @@ "it = 49 ; t = 9.68333 ; deltat = 0.2\n", " energy = 0.000e+00 ; Delta energy = +0.000e+00\n", - " estimated remaining duration = 0.0142 s\n", - "Computation completed in 0.563576 s\n", + " estimated remaining duration = 0.0126 s\n", + "Computation completed in 0.488285 s\n", "path_run =\n", @@ -711,5 +838,5 @@ "path_run =\n", - "/home/pierre/Sim_data/NS2D_L=8.x8._48x48_2015-04-19_18-17-50\n", + "/home/pierre/Sim_data/NS2D_L=8.x8._48x48_2015-06-20_00-30-54\n", "save state_phys in file state_phys_t=010.083_it=51.hd5\n" ] } diff --git a/examples/__init__.py b/examples/__init__.py deleted file mode 100644 diff --git a/examples/launch/__init__.py b/examples/launch/__init__.py deleted file mode 100644 diff --git a/examples/plot_results/__init__.py b/examples/plot_results/__init__.py deleted file mode 100644 diff --git a/examples/util/__init__.py b/examples/util/__init__.py deleted file mode 100644 diff --git a/fluidsim/solvers/ns2d/solver.py b/fluidsim/solvers/ns2d/solver.py index d57b18c9d0908371641b9c32be5665095ecddeb0_Zmx1aWRzaW0vc29sdmVycy9uczJkL3NvbHZlci5weQ==..285ed09aac75235f6b7eab3f7750ac00b0022693_Zmx1aWRzaW0vc29sdmVycy9uczJkL3NvbHZlci5weQ== 100644 --- a/fluidsim/solvers/ns2d/solver.py +++ b/fluidsim/solvers/ns2d/solver.py @@ -99,7 +99,7 @@ if __name__ == "__main__": - import numpy as np + from math import pi import fluiddyn as fld @@ -107,10 +107,6 @@ params.short_name_type_run = 'test' - nh = 32 - Lh = 2*np.pi - params.oper.nx = nh - params.oper.ny = nh - params.oper.Lx = Lh - params.oper.Ly = Lh + params.oper.nx = params.oper.ny = nh = 32 + params.oper.Lx = params.oper.Ly = Lh = 2 * pi @@ -116,3 +112,3 @@ - # params.oper.type_fft = 'FFTWPY' + delta_x = Lh / nh @@ -118,5 +114,4 @@ - delta_x = params.oper.Lx/params.oper.nx params.nu_8 = 2.*10e-1*params.forcing.forcing_rate**(1./3)*delta_x**8 params.time_stepping.t_end = 1. diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 diff --git a/examples/launch/Old/examples_commands.txt b/scripts/launch/Old/examples_commands.txt similarity index 100% rename from examples/launch/Old/examples_commands.txt rename to scripts/launch/Old/examples_commands.txt diff --git a/examples/launch/Old/job_mpi_python b/scripts/launch/Old/job_mpi_python similarity index 100% rename from examples/launch/Old/job_mpi_python rename to scripts/launch/Old/job_mpi_python diff --git a/examples/launch/Old/job_serial_python b/scripts/launch/Old/job_serial_python similarity index 100% rename from examples/launch/Old/job_serial_python rename to scripts/launch/Old/job_serial_python diff --git a/examples/launch/Old/launch_runs_esubmit.py b/scripts/launch/Old/launch_runs_esubmit.py similarity index 100% rename from examples/launch/Old/launch_runs_esubmit.py rename to scripts/launch/Old/launch_runs_esubmit.py diff --git a/examples/launch/Old/loop_simuls_forcing.py b/scripts/launch/Old/loop_simuls_forcing.py similarity index 100% rename from examples/launch/Old/loop_simuls_forcing.py rename to scripts/launch/Old/loop_simuls_forcing.py diff --git a/examples/launch/Old/loop_simuls_forcingw.py b/scripts/launch/Old/loop_simuls_forcingw.py similarity index 100% rename from examples/launch/Old/loop_simuls_forcingw.py rename to scripts/launch/Old/loop_simuls_forcingw.py diff --git a/examples/launch/Old/loop_simuls_from_file.py b/scripts/launch/Old/loop_simuls_from_file.py similarity index 100% rename from examples/launch/Old/loop_simuls_from_file.py rename to scripts/launch/Old/loop_simuls_from_file.py diff --git a/examples/launch/Old/simul_dipole.py b/scripts/launch/Old/simul_dipole.py similarity index 100% rename from examples/launch/Old/simul_dipole.py rename to scripts/launch/Old/simul_dipole.py diff --git a/examples/launch/Old/simul_forcing.py b/scripts/launch/Old/simul_forcing.py similarity index 100% rename from examples/launch/Old/simul_forcing.py rename to scripts/launch/Old/simul_forcing.py diff --git a/examples/launch/Old/simul_from_file.py b/scripts/launch/Old/simul_from_file.py similarity index 100% rename from examples/launch/Old/simul_from_file.py rename to scripts/launch/Old/simul_from_file.py diff --git a/examples/launch/Old/simul_from_file_arg.py b/scripts/launch/Old/simul_from_file_arg.py similarity index 100% rename from examples/launch/Old/simul_from_file_arg.py rename to scripts/launch/Old/simul_from_file_arg.py diff --git a/examples/launch/Old/simul_noise.py b/scripts/launch/Old/simul_noise.py similarity index 100% rename from examples/launch/Old/simul_noise.py rename to scripts/launch/Old/simul_noise.py diff --git a/examples/launch/Old/simul_wave.py b/scripts/launch/Old/simul_wave.py similarity index 100% rename from examples/launch/Old/simul_wave.py rename to scripts/launch/Old/simul_wave.py diff --git a/scripts/launch/__init__.py b/scripts/launch/__init__.py new file mode 100644 diff --git a/examples/launch/simul_profile.py b/scripts/launch/simul_profile.py similarity index 100% rename from examples/launch/simul_profile.py rename to scripts/launch/simul_profile.py diff --git a/examples/launch/simul_test_conserveE.py b/scripts/launch/simul_test_conserveE.py similarity index 100% rename from examples/launch/simul_test_conserveE.py rename to scripts/launch/simul_test_conserveE.py diff --git a/scripts/plot_results/__init__.py b/scripts/plot_results/__init__.py new file mode 100644 diff --git a/examples/plot_results/dispersion_relationship_SW1l.py b/scripts/plot_results/dispersion_relationship_SW1l.py similarity index 100% rename from examples/plot_results/dispersion_relationship_SW1l.py rename to scripts/plot_results/dispersion_relationship_SW1l.py diff --git a/examples/plot_results/fig_spectra_forcingq.py b/scripts/plot_results/fig_spectra_forcingq.py similarity index 100% rename from examples/plot_results/fig_spectra_forcingq.py rename to scripts/plot_results/fig_spectra_forcingq.py diff --git a/examples/plot_results/fig_spectra_forcingq_diff_c.py b/scripts/plot_results/fig_spectra_forcingq_diff_c.py similarity index 100% rename from examples/plot_results/fig_spectra_forcingq_diff_c.py rename to scripts/plot_results/fig_spectra_forcingq_diff_c.py diff --git a/examples/plot_results/plot_interm.py b/scripts/plot_results/plot_interm.py similarity index 100% rename from examples/plot_results/plot_interm.py rename to scripts/plot_results/plot_interm.py diff --git a/examples/plot_results/plot_many_runs.py b/scripts/plot_results/plot_many_runs.py similarity index 100% rename from examples/plot_results/plot_many_runs.py rename to scripts/plot_results/plot_many_runs.py diff --git a/examples/plot_results/plot_many_things.py b/scripts/plot_results/plot_many_things.py similarity index 100% rename from examples/plot_results/plot_many_things.py rename to scripts/plot_results/plot_many_things.py diff --git a/examples/plot_results/plot_profil_phys.py b/scripts/plot_results/plot_profil_phys.py similarity index 100% rename from examples/plot_results/plot_profil_phys.py rename to scripts/plot_results/plot_profil_phys.py diff --git a/examples/plot_results/plot_spatial_means.py b/scripts/plot_results/plot_spatial_means.py similarity index 100% rename from examples/plot_results/plot_spatial_means.py rename to scripts/plot_results/plot_spatial_means.py diff --git a/examples/plot_results/plot_time_means.py b/scripts/plot_results/plot_time_means.py similarity index 100% rename from examples/plot_results/plot_time_means.py rename to scripts/plot_results/plot_time_means.py diff --git a/examples/plot_results/superp_2Dspectra.py b/scripts/plot_results/superp_2Dspectra.py similarity index 100% rename from examples/plot_results/superp_2Dspectra.py rename to scripts/plot_results/superp_2Dspectra.py diff --git a/scripts/util/__init__.py b/scripts/util/__init__.py new file mode 100644 diff --git a/examples/util/modif_resol_all_dir.py b/scripts/util/modif_resol_all_dir.py similarity index 100% rename from examples/util/modif_resol_all_dir.py rename to scripts/util/modif_resol_all_dir.py diff --git a/examples/util/modif_resolution.py b/scripts/util/modif_resolution.py similarity index 100% rename from examples/util/modif_resolution.py rename to scripts/util/modif_resolution.py