Clone wiki

jCODE-public / running the code

Running the code

Several files are necessary to run a simulation

  • input : text file with all simulation parameters
  • grid : binary file describing the geometry of the simulation (x,y,z)
  • data : binary file with all necessary variables (density, momentum, energy,...)

This page describes

  • initialization
  • running
  • monitoring

The boundary layer case is taken as an example.


First, go in the directory


You will find one file


This input file contains all the information needed to initialize the code. To perform the initialization, we use the program init_flow. Just type

~/jcode/bin/init_flow input

This will create two new files

  • grid
  • data.init

With these two files, you are ready to run the code.


To run the code on a single processor, you have two options

~/jcode/bin/jcode input


/opt/mpich2/bin/mpiexec -np 1 ~/jcode/bin/jcode input

The first option is similar to any serial code. The second option says to run through mpiexec with 1 processor (-np 1).

To run with 2 processors, you can either set

use manual domain decomposition : .false.

or manually change the number of processors listed in the input file

processor decomposition : 2 1 1

and then you can type

/opt/mpich2/bin/mpiexec -np 2 ~/jcode/bin/jcode input

As you run the code, you should see something like

   1 process reporting for duty

Simulation is 2D
  Grid size :  513 x  129 x    1 points
    min grid spacing =  6.13E-03 at (   1,    1,    1)
    max grid spacing =  8.67E-02 at (   1,  129,    1)

New forward run:

       0, time =  0.00000E+00, dt =  3.03937E-03
       1, time =  3.03937E-03, dt =  3.03937E-03
       2, time =  6.07874E-03, dt =  3.03936E-03
       3, time =  9.11810E-03, dt =  3.03936E-03
       4, time =  1.21574E-02, dt =  3.03935E-03
       5, time =  1.51968E-02, dt =  3.03935E-03
       6, time =  1.82361E-02, dt =  3.03934E-03
       7, time =  2.12755E-02, dt =  3.03934E-03
       8, time =  2.43148E-02, dt =  3.03933E-03
       9, time =  2.73541E-02, dt =  3.03933E-03
      10, time =  3.03935E-02, dt =  3.03933E-03

The number of processors and grid diagnostics are first reported. This includes the number of grid points and the min/max grid spacing. Next, the columns correspond to

  • # : number of the timestep
  • Time : running time of the simulation
  • dt/cfl : The minimum timestep or the maximum CFL, depending on the time stepping configuration.

In addition, two directories have been created

  • monitor : contains files to monitor the behavior of the code
  • ensight-3D : contains files used to visualize the flow field


The first step in postprocessing the result is to use the files in the monitor directory. On this page, we will present only briefly one of these files. Let's consider


The header of the file (the first line) lists the name of each column. We would like to know how the maximum velocity in the domain changes with time. A useful program to use is


For instance, to plot the function Umax(t), we will type

plot 'monitor/velocity' using 2:3 with linespoints

or alternatively

p 'monitor/velocity' u 2:3 w lp

This command plots (p) from file ('monitor/velocity') Umax (column 3) as a function of time (column 2). As you can see, the maximum velocity decreases due to viscous forces. The decay is exponential. To quit gnuplot, type