PLUTO
parabolic_flux.c File Reference

Compute diffusion fluxes for explicit time stepping. More...

#include "pluto.h"
Include dependency graph for parabolic_flux.c:

Go to the source code of this file.

Functions

void ParabolicFlux (Data_Arr V, Data_Arr J, double ***T, const State_1D *state, double **dcoeff, int beg, int end, Grid *grid)
 

Detailed Description

Compute diffusion fluxes for explicit time stepping.

Compute parabolic fluxes and corresponding source terms for explicit time stepping only and add them to upwind fluxes. For STS and RKC integration see the ParabolicRHS() function. Note that source terms are only included for viscous terms, since resistivity and thermal conduction do not need any.

Note
For explicit resistive MHD, the EMF is comprised of 2 terms: EMF = E(hyp) + E(par) The correct sequence of steps for building the EMF are:
  • E(hyp) is the flux computed with Riemann solver
  • for STAGGERED_MHD E(hyp) is stored at appropriate location for later re-use by calling CT_StoreEMF
  • Parabolic fluxes are added to the hyperbolic flux (useful only for cell-centered MHD).
Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
P. Tzeferacos (petro.nosp@m.s.tz.nosp@m.efera.nosp@m.cos@.nosp@m.ph.un.nosp@m.ito..nosp@m.it)
Date
Sept 4, 2014

Definition in file parabolic_flux.c.

Function Documentation

void ParabolicFlux ( Data_Arr  V,
Data_Arr  J,
double ***  T,
const State_1D state,
double **  dcoeff,
int  beg,
int  end,
Grid grid 
)

Add the diffusion fluxes to the upwind fluxes for explicit time integration.

Parameters
[in]Vpointer to the 3D array of cell-centered primitive variables
[in,out]statepointer to a State_1D structure
[out]dcoeffthe diffusion coefficients 1D array
[in]beginitial index of computation
[in]endfinal index of computation
[in]gridpointer to an array of Grid structures

Definition at line 34 of file parabolic_flux.c.

50 {
51  int i, j, k, nv;
52 
53 /* -------------------------------------------------
54  1. Viscosity
55  ------------------------------------------------- */
56 
57  #if VISCOSITY == EXPLICIT
58  #ifdef FARGO
59  print ("! ParabolicFlux: FARGO incompatible with explicit viscosity.\n");
60  print (" Try STS or RKC instead\n");
61  QUIT_PLUTO(1);
62  #endif
63  ViscousFlux (V, state->visc_flux, state->visc_src, dcoeff, beg, end, grid);
64  for (i = beg; i <= end; i++){
65  EXPAND(state->flux[i][MX1] -= state->visc_flux[i][MX1]; ,
66  state->flux[i][MX2] -= state->visc_flux[i][MX2]; ,
67  state->flux[i][MX3] -= state->visc_flux[i][MX3]; )
68  #if HAVE_ENERGY
69  state->flux[i][ENG] -= state->visc_flux[i][ENG];
70  #endif
71 
72  }
73  #endif
74 
75 /* -------------------------------------------------
76  2. Thermal conduction
77  ------------------------------------------------- */
78 
79  #if THERMAL_CONDUCTION == EXPLICIT
80  TC_Flux (T, state, dcoeff, beg, end, grid);
81  for (i = beg; i <= end; i++) state->flux[i][ENG] -= state->tc_flux[i][ENG];
82  /* !!!! tc_flux can be redefined as a 1D array since only the energy
83  component is required !!! */
84  #endif
85 
86 /* ----------------------------------------------------------------
87  3. Resistivity.
88  Note for the entropy flux: differently from viscosity and
89  thermal conduction, the contribution to the entropy due to
90  currents is given by J^2 and cannot be expressed as a simple
91  two-point flux difference.
92  This is done in a separate step (...)
93  ---------------------------------------------------------------- */
94 
95  #if (RESISTIVITY == EXPLICIT)
96  ResistiveFlux (V, J, state->res_flux, dcoeff, beg, end, grid);
97  for (i = beg; i <= end; i++){
98 
99  /* ------------------------------------------
100  normal component of magnetic field does
101  not evolve during the current sweep.
102  ------------------------------------------ */
103 
104  state->res_flux[i][BXn] = 0.0;
105 
106  /* ---------------------------------------------------
107  add the parabolic part of the EMF, only for
108  cell-centered MHD. CT is handled in a truly
109  multidimensional way.
110  --------------------------------------------- */
111 
112  EXPAND(state->flux[i][BX1] += state->res_flux[i][BX1]; ,
113  state->flux[i][BX2] += state->res_flux[i][BX2]; ,
114  state->flux[i][BX3] += state->res_flux[i][BX3]; )
115  #if HAVE_ENERGY
116  state->flux[i][ENG] += state->res_flux[i][ENG];
117  #endif
118  }
119  #endif
120 
121 }
#define MX3
Definition: mod_defs.h:22
tuple T
Definition: Sph_disk.py:33
void ViscousFlux(Data_Arr, double **, double **, double **, int, int, Grid *)
Definition: viscous_flux.c:14
#define MX1
Definition: mod_defs.h:20
double ** flux
upwind flux computed with the Riemann solver
Definition: structs.h:149
void TC_Flux(double ***, const State_1D *, double **, int, int, Grid *)
Definition: tc_flux.c:57
double ** visc_src
Viscosity source term.
Definition: structs.h:151
double ** res_flux
Resistive flux (current)
Definition: structs.h:153
double ** visc_flux
Viscosity flux.
Definition: structs.h:150
int BXn
Definition: globals.h:75
int j
Definition: analysis.c:2
#define MX2
Definition: mod_defs.h:21
if(divB==NULL)
Definition: analysis.c:10
int k
Definition: analysis.c:2
void print(const char *fmt,...)
Definition: amrPluto.cpp:497
double ** tc_flux
Thermal conduction flux.
Definition: structs.h:152
#define BX3
Definition: mod_defs.h:27
#define RESISTIVITY
Definition: pluto.h:357
int i
Definition: analysis.c:2
#define BX1
Definition: mod_defs.h:25
#define BX2
Definition: mod_defs.h:26
void ResistiveFlux(Data_Arr V, Data_Arr curlB, double **res_flux, double **dcoeff, int beg, int end, Grid *grid)
Definition: res_flux.c:52
#define QUIT_PLUTO(e_code)
Definition: macros.h:125
#define EXPLICIT
Definition: pluto.h:67

Here is the call graph for this function:

Here is the caller graph for this function: