PLUTO  4.4-patch2
Functions
set_grid.c File Reference

Create global and local grid. More...

#include "pluto.h"

Functions

static void MakeGrid (int, Runtime *, double *, double *, double *)
 
void SetGrid (Runtime *rtime, int *procs, Grid *grid)
 
void FreeGrid (Grid *grid)
 

Detailed Description

Collects functions for allocating memory and defining grid coordinates.

Author
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
Date
April 6, 2020

Function Documentation

◆ FreeGrid()

void FreeGrid ( Grid grid)

Free array memory allocated previously (used by AMR)

◆ MakeGrid()

void MakeGrid ( int  idim,
Runtime rtime,
double *  xlft,
double *  xrgt,
double *  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);

◆ SetGrid()

void SetGrid ( Runtime rtime,
int *  procs,
Grid grid 
)
Parameters
[in]rtimepointer to Runtime structure, used for defining the global grid.
[in]procsan array containing the number of processors along the three diretions (parallel only).
[in]grida pointer to the Grid structure