10#include "../include_cii/mem.h"
11#include "../include/var_struc.h"
21 double const dr =
config[10];
22 double const dtheta =
config[11];
23 double const r_0 =
config[20];
24 int const Md = (int)
config[3]+2;
26 struct radial_mesh_var rmv;
27 rmv.Rb = (
double*)
ALLOC(Md*
sizeof(
double));
28 rmv.Lb = (
double*)
ALLOC(Md*
sizeof(
double));
29 rmv.RR = (
double*)
ALLOC(Md*
sizeof(
double));
30 rmv.DdrL = (
double*)
ALLOC(Md*
sizeof(
double));
31 rmv.DdrR = (
double*)
ALLOC(Md*
sizeof(
double));
32 rmv.Ddr = (
double*)
ALLOC(Md*
sizeof(
double));
33 rmv.dRc = (
double*)
ALLOC(Md*
sizeof(
double));
34 rmv.vol = (
double*)
ALLOC(Md*
sizeof(
double));
38 rmv.RR[0]=(2.0/3.0*r_0)*cos(0.5*dtheta);
39 for(
int i = 1; i < Md; i++)
41 rmv.Rb[i]=(r_0+(i-1)*dr)*cos(0.5*dtheta);
42 rmv.Lb[i]=(r_0+(i-1)*dr)*sin(0.5*dtheta)*2.0;
44 rmv.RR[i]=(r_0+i*dr-(3*r_0/dr+3*i-2)/(6*r_0/dr+6*i-3)*dr)*cos(0.5*dtheta);
48 printf(
"Mesh of %s has been constructed!\n", example);
59 int const Ncell = (int)
config[3];
65 double *DdrL = rmv->DdrL;
66 double *DdrR = rmv->DdrR;
67 double *Ddr = rmv->Ddr;
68 double *dRc = rmv->dRc;
69 double *vol = rmv->vol;
71 for(
int i = 0; i <= Ncell; i++)
73 dRc[i] = RR[i]-RR[i-1];
74 DdrL[i] = Rb[i+1]-RR[i];
75 DdrR[i] = RR[i]-Rb[i];
76 Ddr[i] = DdrL[i]+DdrR[i];
79 fprintf(stderr,
"ERROR! deltar_r < 0 in cell %d.\n", i);
82 vol[i] = RR[i]*0.5*(Lb[i]+Lb[i+1])*Ddr[i];
84 dRc[Ncell+1] = RR[Ncell+1]-RR[Ncell];
85 DdrR[Ncell+1] = RR[Ncell+1]-Rb[Ncell+1];
86 Ddr[Ncell+1] = Ddr[Ncell];
double config[N_CONF]
Initial configuration data array.
void radial_mesh_update(struct radial_mesh_var *rmv)
This function updates radially symmetric meshing variables after each time step update.
struct radial_mesh_var radial_mesh_init(const char *example)
This function initializes radially symmetric meshing variables.
void radial_mesh_mem_free(struct radial_mesh_var *rmv)
This function free memory for storing radially symmetric meshing variables.