PLUTO  4.4-patch2
Functions
mappers.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 beg, int end, uint16_t *flag)
 

Detailed Description

The PrimToCons() converts an array of primitive quantities to an array of conservative variables for the RHD 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@t.nosp@m.o.inf.nosp@m.n.it)
Date
Nov 27, 2020

Function Documentation

◆ ConsToPrim()

int ConsToPrim ( double **  ucons,
double **  uprim,
int  beg,
int  end,
uint16_t *  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
[in,out]flagarray of flags tagging, in input, zones where entropy must be used to recover pressure and, on output, zones where conversion was not successful.
Returns
Return 0 if conversion was successful in all zones in the range [ibeg,iend]. Return 1 if one or more zones could not be converted correctly and either pressure, density or energy took non-physical values.

◆ PrimToCons()

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