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

Convert between primitive and conservative variables. More...

#include "pluto.h"

Functions

void PrimToCons (double **uprim, double **ucons, int ibeg, int iend)
 
int ConsToPrim (double **ucons, double **uprim, int ibeg, int iend, unsigned char *flag)
 
int EnergySolve (double *u, double *v)
 
int PressureFix (double *u, double *v)
 
int EntropySolve (double *u, double *v)
 

Detailed Description

The PrimToCons() converts an array of primitive quantities to an array of conservative variables for the RMHD equations.

The ConsToPrim() converts an array of conservative quantities to an array of primitive quantities. During the conversion, pressure is normally recovered from total energy unless zone has been tagged with FLAG_ENTROPY. In this case we recover pressure from conserved entropy:

if (FLAG_ENTROPY is TRUE)  --> p = p(S)
else                       --> p = p(E)
Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Oct 4, 2012

Function Documentation

int ConsToPrim ( double **  ucons,
double **  uprim,
int  ibeg,
int  iend,
unsigned char *  flag 
)

Convert from conservative to primitive variables.

Parameters
[in]uconsarray of conservative variables
[out]uprimarray of primitive variables
[in]begstarting index of computation
[in]endfinal index of computation
[out]flagarray of flags tagging zones where conversion went wrong.
Returns
Return (0) if conversion was succesful in every zone [ibeg,iend]. Otherwise, return a non-zero integer number giving the bit flag(s) turned on during the conversion process. In this case, flag contains the failure codes of those zones where where conversion did not go through.
int EnergySolve ( double *  u,
double *  v 
)

Try to recover gas pressure from conserved variables {D, m, E, B}. Return (0) is successful, (1) otherwise.

int EntropySolve ( double *  u,
double *  v 
)

Convert the conservative variables u=[D, m, B, sigma_c] (where sigma_c = D*sigma is the conserved entropy) to primitive variable using a Newton-Raphson/Bisection scheme.

LAST MODIFIED

February 5th by C. Zanni & A. Mignone (zanni.nosp@m.@oat.nosp@m.o.ina.nosp@m.f.it, migno.nosp@m.ne@o.nosp@m.ato.i.nosp@m.naf..nosp@m.it)

int PressureFix ( double *  u,
double *  v 
)

Fix p to a small value, solve for the square of velocity. Then recompute W by solving the velocity-momentum relation and correct energy. Return 0 if succesful, 1 otherwise.

void PrimToCons ( double **  uprim,
double **  ucons,
int  ibeg,
int  iend 
)

Convert primitive variables to conservative variables.

Parameters
[in]uprimarray of primitive variables
[out]uconsarray of conservative variables
[in]begstarting index of computation
[in]endfinal index of computation