Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JOSS Reviews: Plots do not work for flying snake example #34

Closed
OSUmageed opened this issue Jul 3, 2017 · 4 comments
Closed

JOSS Reviews: Plots do not work for flying snake example #34

OSUmageed opened this issue Jul 3, 2017 · 4 comments

Comments

@OSUmageed
Copy link

OSUmageed commented Jul 3, 2017

Functionality: The plotting scripts don't work in flying snake examples.

plotForceCoefficients throws an IndexError (same error in 2.7 and 3.6):

[info] registering simulation ...
        - description: None
        - software: cuibm
        - directory: /home/osumageed/software/cuIBM/examples/flyingSnake/Re1000AoA30

[info] reading forces ...
/home/osumageed/anaconda/envs/py36/lib/python3.6/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
/home/osumageed/anaconda/envs/py36/lib/python3.6/site-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
Traceback (most recent call last):
  File "scripts/plotForceCoefficients.py", line 15, in <module>
    simulation.get_mean_forces(limits=time_limits)
  File "/home/osumageed/anaconda/envs/py36/lib/python3.6/site-packages/snake-0.3-py3.6.egg/snake/simulation.py", line 106, in get_mean_forces
    order=order)
  File "/home/osumageed/anaconda/envs/py36/lib/python3.6/site-packages/snake-0.3-py3.6.egg/snake/force.py", line 90, in get_mean
    'start': self.times[mask[0]],
IndexError: index 0 is out of bounds for axis 0 with size 0

plotVorticity just doesn't make a plot or create images folder.

@mesnardo
Copy link
Member

mesnardo commented Jul 5, 2017

Hi @OSUmageed

Thank you for reporting this problem.

Can you tell for how long you ran the simulation of the snake?
(What is the last time value in the file forces located in the simulation directory?)

The python script plotForceCoefficients.py is trying to compute the mean forces between 32 and 64 time-units of flow simulation and it looks like it does not find force values within this time range.
If you want, you can either change the time limits or comments some lines directly in the script.

Also, note that the scripts should be run from the root directory of the simulation.
For example:

cd $CUIBM_DIR/examples/flyingSnakes/Re1000AoA30
python scripts/plotForceCoefficients.py

About plotVorticity.py, can you provide the error message?

@OSUmageed
Copy link
Author

Hi @mesnardo

Here's the full output for the run (This is Ubuntu 16.04):

I already copy pasted the original output below, but I figured it out. I'm sure you'll see it immediately but the explanation is at the bottom.

Parsing YAML file with simulation parameters ...
Parsing YAML file with flow conditions ...
Parsing YAML file with grid info ...
Parsing YAML file with bodies info ...


Flow parameters
---------------
nu = 0.001

Domain
------
1704 x 1704

Simulation parameters
---------------------
dt = 0.0004
scaleCV = 5
startStep = 0
nt = 10
nsave = 20000
Convection time scheme = 2nd Order Adams-Bashforth
Diffusion time scheme  = Crank-Nicolson

Velocity Solve
--------------
Solver = BICGSTAB
Preconditioner = Diagonal
Relative tolerance = 1e-05
Absolute tolerance = 0

Poisson Solve
-------------
Solver = CG
Preconditioner = Smoothed Aggregation
Relative tolerance = 1e-05
Absolute tolerance = 0

Output parameters
-----------------
Output folder = .
nsave = 20000

Device Properties
-----------------
Name = Tesla K40c
Number = 0
Compute capability = 3.5
ECC Enabled = yes

Immersed Boundary Method
------------------------
Taira & Colonius

Initializing common parts ...
Initializing bodies ...
Initializing arrays ...
Initializing matrices ...
Initialization complete: Memory Usage 2.98 / 11.2 GB


        assembleMatrices       0.3306
            assembleRHS1       0.0001
            assembleRHS2       0.0291
             generateBC1       0.0004
               generateC       0.2097
              generateQT       0.0831
              generateRN       0.0004
        initialiseArrays       0.4139
        initialiseBodies       0.3404
        initialiseCommon       0.0002
                  output       0.0263
         preconditioner2       1.3384
          projectionStep       0.0501
    solveIntermediateVel       0.2803
            solvePoisson      64.7947
              transposeE       0.0006
             transposeQT       0.0241
                updateQT       0.0000
-------------------------------------
                   TOTAL      67.9224

This is the forces file

0.0004	1282.27	702.34	
0.0008	5.55621	1.46305	
0.0012	5.36462	1.33546	
0.0016	4.93083	1.19025	
0.002	4.54265	1.06749	
0.0024	4.18473	0.959942	
0.0028	3.8556	0.86622	
0.0032	3.55488	0.785058	
0.0036	3.2817	0.715073	
0.004	3.03469	0.654877	

Explanation.

The simParams.yaml file for the flying snake simulations has nt = 10.

Easy fix, but the simulation takes a while. Maybe in the examples folder there could be a Readme that tells the user which simulations take a long time to run or an option to output something like "100/1000 timesteps complete" while the simulation is running.

Now they work as long as that hardwired time range is valid.

mesnardo added a commit that referenced this issue Jul 5, 2017
Referring to issue #34.

For long runs, we add a README in the corresponding example directories that
provides the runtime obtained on a specific GPU device with information on how
to change the number of time steps to run or the frequency of saving of the flow
solution.

Fo the flying-snake examples, we also provide information about the time range
used in the Python post-processing script `plotForceCoefficients.py` to
compute the mean force coefficients and Strouhal number.

In the README of the project directory, we also provide the runtimes of most
examples (with the type of GPU used) as well as information on how to change
the number of time steps or the frequency of saving.
@mesnardo
Copy link
Member

mesnardo commented Jul 5, 2017

You are right, the simulations for the flying snake take a while to complete.

Actually, I pushed a simParams.yaml file for only 10 time steps but it should be 200,000 time steps to compute 80 time units of flow simulation (as it was done in Krishnan et al., 2014).
Therefore, I increase the number of time steps to 200,000.

As you suggested, I also placed a README in each snake examples as well as in the flapping-wing example to let the users know that those are long runs. (I am providing the runtime for the GPU device used.)
In those READMEs, I also mention how to change the number of time steps and the frequency of saving.

In the README of the project directory, we now provide the runtime (and the GPU used) for most examples with, again, information on how to change the number of time steps and the saving frequency.

@OSUmageed
Copy link
Author

Looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants