Streamer fluid modeling - An overview of ARCoS
1.0
|
General functions to work with FORTRAN-compatible 2d/3d arrays. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "parameters.h"
#include "proto.h"
#include "rz_array.h"
#include "species.h"
Go to the source code of this file.
Functions | |
static void | check_disk_space (void) |
check_disk_space QQQQ | |
rz_array_t * | rz_new_3d_a (int r0, int z0, int r1, int z1, int ntheta) |
Creates a new 3D array structure. | |
rz_array_t * | rz_guest (rz_array_t *host, int r0, int z0, int r1, int z1) |
Creates guest array: This is an array that contains part of another one. | |
void | rz_set_zero (rz_array_t *array) |
Sets the data of an array to zero. | |
void | rz_set_periodic (rz_array_t *array) |
Sets periodic boundary conditions for theta in an array. | |
void | rz_copy_bnd (rz_array_t *from, rz_array_t *to, int sign, REAL *start_from, REAL *start_to, int dim0, int inout_from, int inout_to, int dim1, int dim1_0, int dim1_1, int dim2, int dim2_0, int dim2_1) |
Sets boundaries for one array reading data from other array (but both can be the same: see rz_set_bnd). | |
void | rz_set_bnd (rz_array_t *array, int sign, REAL *astart, int dim0, int inout, int dim1, int dim1_0, int dim1_1, int dim2, int dim2_0, int dim2_1) |
Sets boundary conditions (Neumann/Dirichlet) reading from the array itself. | |
void | rz_free (rz_array_t *array) |
Frees an array. | |
void | rz_copy (rz_array_t *fro, int rfro, int zfro, rz_array_t *to, int rto, int zto, int rn, int zn) |
Copies a sub-array of rn x zn from fro (starting at (rfro, zfro)) to to (starting at (rto, zto)). | |
void | rz_copy_modes (rz_array_t *fro, int rfro, int zfro, rz_array_t *to, int rto, int zto, int rn, int zn, int nmode_fro, int nmode_to) |
Copies a sub-array of the mode nmode of rn x zn from fro (starting at (rfro, zfro)) to to (starting at (rto, zto)). | |
void | rz_dump (rz_array_t *rz_array, const char *fname, const char *mode, int r0, int z0, int r1, int z1) |
Reads or writes a rz_array, depending on the string mode, "r" for reading, "w" for writing. | |
void | rz_dump_3d (rz_array_t *rz_array, const char *fname, const char *mode, int r0, int z0, int r1, int z1, int ntheta) |
rz_dump_3d QQQQ | |
void | rz_axis_dump (const char *fname, int x0, int x1, double delta) |
rz_axis_dump QQQQ | |
Variables | |
long int | used_disk_space = 0 |
General functions to work with FORTRAN-compatible 2d/3d arrays.
Definition in file rz_array.c.
|
static |
check_disk_space QQQQ
Definition at line 437 of file rz_array.c.
rz_array_t* rz_new_3d_a | ( | int | r0, |
int | z0, | ||
int | r1, | ||
int | z1, | ||
int | ntheta | ||
) |
Creates a new 3D array structure.
Definition at line 23 of file rz_array.c.
rz_array_t* rz_guest | ( | rz_array_t * | host, |
int | r0, | ||
int | z0, | ||
int | r1, | ||
int | z1 | ||
) |
Creates guest array: This is an array that contains part of another one.
We use the memory of the original array and do not allocate new memory.
Definition at line 105 of file rz_array.c.
void rz_set_zero | ( | rz_array_t * | array | ) |
Sets the data of an array to zero.
Definition at line 145 of file rz_array.c.
void rz_set_periodic | ( | rz_array_t * | array | ) |
Sets periodic boundary conditions for theta in an array.
Definition at line 153 of file rz_array.c.
void rz_copy_bnd | ( | rz_array_t * | from, |
rz_array_t * | to, | ||
int | sign, | ||
REAL * | start_from, | ||
REAL * | start_to, | ||
int | dim0, | ||
int | inout_from, | ||
int | inout_to, | ||
int | dim1, | ||
int | dim1_0, | ||
int | dim1_1, | ||
int | dim2, | ||
int | dim2_0, | ||
int | dim2_1 | ||
) |
Sets boundaries for one array reading data from other array (but both can be the same: see rz_set_bnd).
Starting at *start_xxx, it sweeps a 2-dimensional subspace of the grid in dimensions dim1 and dim2 (and perpendicular to dim0). There it sets the boudary conditions.
The value of from is multiplied by sign. Thus, if the boundary is itself, is -1 for homogeneous dirichlet and 1 for homogeneous Neumann (though you should better use BND_CND_HNEUMANN and BND_CND_HDIRICHLET)
inout is -1 if we look/set the values on smaller values of dim0 1 if we look at larger values. (though it is better to use BND_INWARD=-1 and BND_OUTWARD=1).
Note: it is better to call this function before rz_set_periodic.
Definition at line 196 of file rz_array.c.
void rz_set_bnd | ( | rz_array_t * | array, |
int | sign, | ||
REAL * | astart, | ||
int | dim0, | ||
int | inout, | ||
int | dim1, | ||
int | dim1_0, | ||
int | dim1_1, | ||
int | dim2, | ||
int | dim2_0, | ||
int | dim2_1 | ||
) |
Sets boundary conditions (Neumann/Dirichlet) reading from the array itself.
For example, to set Neumann conditions at r = 0 (dim0 = R_INDX), we call it as
rz_set_bnd (array, 1, RZTP (array, 0, 0, 0), R_INDX, 1, Z_INDX, z0, z1, THETA_INDX, 0, ntheta);
Definition at line 229 of file rz_array.c.
void rz_free | ( | rz_array_t * | array | ) |
Frees an array.
Definition at line 240 of file rz_array.c.
void rz_copy | ( | rz_array_t * | fro, |
int | rfro, | ||
int | zfro, | ||
rz_array_t * | to, | ||
int | rto, | ||
int | zto, | ||
int | rn, | ||
int | zn | ||
) |
Copies a sub-array of rn x zn from fro (starting at (rfro, zfro)) to to (starting at (rto, zto)).
Definition at line 252 of file rz_array.c.
void rz_copy_modes | ( | rz_array_t * | fro, |
int | rfro, | ||
int | zfro, | ||
rz_array_t * | to, | ||
int | rto, | ||
int | zto, | ||
int | rn, | ||
int | zn, | ||
int | nmode_fro, | ||
int | nmode_to | ||
) |
Copies a sub-array of the mode nmode of rn x zn from fro (starting at (rfro, zfro)) to to (starting at (rto, zto)).
Definition at line 277 of file rz_array.c.
void rz_dump | ( | rz_array_t * | rz_array, |
const char * | fname, | ||
const char * | mode, | ||
int | r0, | ||
int | z0, | ||
int | r1, | ||
int | z1 | ||
) |
Reads or writes a rz_array, depending on the string mode, "r" for reading, "w" for writing.
Note however that we must already have the dimensions of the array in it.
Definition at line 305 of file rz_array.c.
void rz_dump_3d | ( | rz_array_t * | rz_array, |
const char * | fname, | ||
const char * | mode, | ||
int | r0, | ||
int | z0, | ||
int | r1, | ||
int | z1, | ||
int | ntheta | ||
) |
rz_dump_3d QQQQ
Definition at line 354 of file rz_array.c.
void rz_axis_dump | ( | const char * | fname, |
int | x0, | ||
int | x1, | ||
double | delta | ||
) |
rz_axis_dump QQQQ
Definition at line 411 of file rz_array.c.
long int used_disk_space = 0 |
This is the total disk space used so far for the array dumps. It is used to limit the disk space used by a simulation and thus avoid that one simulation gets crazy and stops other simulations that are sharing the same disk space.
Definition at line 13 of file rz_array.c.