PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
Functions
set_grid.c File Reference

Set up the global and local grids in the three coordinate directions. More...

#include "pluto.h"

Functions

static void InitializeGrid (Input *, Grid *)
 
static void MakeGrid (int, Input *, double *, double *, double *)
 
void SetGrid (Input *INI, Grid *GXYZ)
 
void FreeGrid (Grid *grid)
 

Detailed Description

Collects functions for allocating memory and defining grid coordinates.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Sep 24, 2012

Function Documentation

void FreeGrid ( Grid grid)

Free array memory allocated previously.

void InitializeGrid ( Input *  INI,
Grid GXYZ 
)
static

Allocate memory for grid arrays, set shortcut pointers for local grids.

void MakeGrid ( int  idim,
Input *  INI,
real *  xlft,
real *  xrgt,
real *  dx 
)
static

Build grid nodes as defined by pluto.ini.

Options are:

'u' = uniform grid, simply defined as

dx = (xR - xL)/npoint, xleft(i) = xl + i*dx, xright(i) = xleft(i) + dx

's' = stretched grid; solve

    dx*( 1 + r + r^2 + r^3 + ... r^(N-1)) = xR - xL

  in the stretching ratio r, provided dx, N, xR and xL are known.
  dx is taken from the closest uniform grid.

'l+' = logarithmic grid, mesh size increases with x; it is defined as

             x + |xL| - xL 
    y = Log[ ------------- ] , with uniform spacing  y(i+1/2) - y(i-1/2) = dy
                 |xL|

    dy = (yR - yL)/N  and dx(i) becomes

    dx(i) = (x(i-) + fabs(xL) - xL)*(10^dy - 1.0);

  NOTE: xR must be positive and xL can take any value different from 0

'l-' = logarithmic grid, mesh size decreases with x; it is defined as

             xR + |xL| - x 
    y = Log[ -------------- ] , with uniform spacing  y(i+1/2) - y(i-1/2) = dy
                 |xL|

   dy = -(yR - yL)/N   

   dx(i) = (x(i-) - fabs(xL) - xR)*(10^dy - 1.0);
void SetGrid ( Input *  INI,
Grid GXYZ 
)
Parameters
[in]INIpointer to Input structure
[out]GXYZpointer to array of Grid structures