Go to the source code of this file.
Functions | |
void | bvals_particle (Grid *pG, Domain *pD) |
void | advect_particles (Grid *pG, Domain *pD) |
Advect particles by qshear*Omega_0*x1*dt for the FARGO algorithm. | |
void | bvals_particle_init (Grid *pG, Domain *pD) |
void | bvals_particle_fun (enum Direction dir, VBCFun_t prob_bc) |
void | bvals_final_particle (Grid *pG, Domain *pD) |
void | dump_particle_history (Grid *pGrid, Domain *pD, Output *pOut) |
Writes particle variables as formatted table. | |
void | dump_parhistory_enroll () |
void | exchange_feedback (Grid *pG, Domain *pD) |
Calls appropriate functions to copy feedback in the ghost zones back to the grid. | |
void | exchange_feedback_init (Grid *pG, Domain *pD) |
Sets function pointers for feedback exchange during initialization, allocates memory for send/receive buffers with MPI. | |
void | exchange_feedback_fun (enum Direction dir, VBCFun_t prob_bc) |
Sets function pointers for user-defined feedback exchange in problem file. | |
void | exchange_feedback_destruct (Grid *pG, Domain *pD) |
Finalize feedback exchange. | |
void | init_particle (Grid *pG, Domain *pD) |
Initialization for particles. | |
void | particle_destruct (Grid *pG) |
Finalization for particles. | |
void | particle_realloc (Grid *pG, long n) |
Enlarge the particle array. | |
void | Integrate_Particles (Grid *pG, Domain *pD) |
Main particle integrator. | |
void | int_par_exp (Grid *pG, Grain *curG, Vector cell1, Real *dv1, Real *dv2, Real *dv3, Real *ts) |
2nd order explicit particle integrator | |
void | int_par_semimp (Grid *pG, Grain *curG, Vector cell1, Real *dv1, Real *dv2, Real *dv3, Real *ts) |
2nd order semi-implicit particle integrator | |
void | int_par_fulimp (Grid *pG, Grain *curG, Vector cell1, Real *dv1, Real *dv2, Real *dv3, Real *ts) |
2nd order fully implicit particle integrator | |
void | int_par_spec (Grid *pG, Grain *curG, Vector cell1, Real *dv1, Real *dv2, Real *dv3, Real *ts) |
2nd order specific particle integrator; This integrator works ONLY in the strong coupling regime (t_stop<h) | |
void | feedback_predictor (Grid *pG) |
Calculate the feedback of the drag force from the particle to the gas. | |
void | feedback_corrector (Grid *pG, Grain *gri, Grain *grf, Vector cell1, Real dv1, Real dv2, Real dv3, Real ts) |
Calculate the feedback of the drag force from the particle to the gas. | |
void | particle_to_grid (Grid *pG, Domain *pD, PropFun_t par_prop) |
Bin the particles to grid cells. | |
void | dump_particle_binary (Grid *pG, Domain *pD, Output *pOut) |
Dump unbinned particles in binary format. | |
int | property_all (const Grain *gr, const GrainAux *grsub) |
Default choice for binning particles to the grid: All the particles are binned, return true for any value. | |
void | get_gasinfo (Grid *pG) |
Calculate the gas information from conserved variables for feedback_predictor. | |
void | getwei_linear (Grid *pG, Real x1, Real x2, Real x3, Vector cell1, Real weight[3][3][3], int *is, int *js, int *ks) |
Get weight using linear interpolation. | |
void | getwei_TSC (Grid *pG, Real x1, Real x2, Real x3, Vector cell1, Real weight[3][3][3], int *is, int *js, int *ks) |
Get weight using Triangular Shaped Cloud (TSC) interpolation Input: pG: grid; x1,x2,x3: global coordinate; cell1: 1 over dx1,dx2,dx3 Output: weight: weight function; is,js,ks: starting cell indices in the grid. | |
void | getwei_QP (Grid *pG, Real x1, Real x2, Real x3, Vector cell1, Real weight[3][3][3], int *is, int *js, int *ks) |
Get weight using quadratic polynomial interpolation. | |
int | getvalues (Grid *pG, Real weight[3][3][3], int is, int js, int ks,#ifndef FEEDBACK Real *rho, Real *u1, Real *u2, Real *u3, Real *cs#else Real *rho, Real *u1, Real *u2, Real *u3, Real *cs, Real *stiff#endif) |
Real | get_ts_epstein (Grid *pG, int type, Real rho, Real cs, Real vd) |
Calculate the stopping time in the Epstein regime. | |
Real | get_ts_general (Grid *pG, int type, Real rho, Real cs, Real vd) |
Calculate the stopping time for the most general case. | |
Real | get_ts_fixed (Grid *pG, int type, Real rho, Real cs, Real vd) |
Return the fixed stopping time. | |
void | feedback_clear (Grid *pG) |
clean the feedback array | |
void | distrFB_pred (Grid *pG, Real weight[3][3][3], int is, int js, int ks,#ifndef BAROTROPIC Vector fb, Real stiffness, Real Elosspar#else Vector fb, Real stiffness#endif) |
void | distrFB_corr (Grid *pG, Real weight[3][3][3], int is, int js, int ks, Vector fb, Real Elosspar) |
Distribute the feedback force to grid cells for the correct step. | |
void | shuffle (Grid *pG) |
Shuffle the particles. |
void advect_particles | ( | Grid * | pG, | |
Domain * | pD | |||
) |
Advect particles by qshear*Omega_0*x1*dt for the FARGO algorithm.
Definition at line 922 of file bvals_particle.c.
References ath_error(), gridshift(), Lx2, my_iproc, my_jproc, my_kproc, n, Omega_0, packing_particle_fargo(), qshear, realloc_recvbuf(), recv_buf, recv_bufsize, send_buf, unpack_particle(), and x2min.
Referenced by main().
void bvals_final_particle | ( | Grid * | pG, | |
Domain * | pD | |||
) |
void bvals_particle | ( | Grid * | pG, | |
Domain * | pD | |||
) |
void bvals_particle_fun | ( | enum Direction | dir, | |
VBCFun_t | prob_bc | |||
) |
void bvals_particle_init | ( | Grid * | pG, | |
Domain * | pD | |||
) |
void distrFB_corr | ( | Grid * | pG, | |
Real | weight[3][3][3], | |||
int | is, | |||
int | js, | |||
int | ks, | |||
Vector | fb, | |||
Real | Elosspar | |||
) |
Distribute the feedback force to grid cells for the correct step.
Input:
Definition at line 595 of file utils_particle.c.
References GPCouple::Eloss, GPCouple::fb1, GPCouple::fb2, GPCouple::fb3, ilp, iup, jlp, jup, klp, kup, and ncell.
Referenced by feedback_corrector().
void distrFB_pred | ( | Grid * | pG, | |
Real | weight[3][3][3], | |||
int | is, | |||
int | js, | |||
int | ks, | |||
#ifndef BAROTROPIC Vector | fb, | |||
Real | stiffness, | |||
Real Elosspar#else Vector | fb, | |||
Real stiffness# | endif | |||
) |
Definition at line 546 of file utils_particle.c.
References GPCouple::Eloss, GPCouple::fb1, GPCouple::fb2, GPCouple::fb3, GPCouple::FBstiff, ilp, iup, jlp, jup, klp, kup, and ncell.
Referenced by feedback_predictor().
void dump_parhistory_enroll | ( | ) |
void dump_particle_binary | ( | Grid * | pG, | |
Domain * | pD, | |||
Output * | pOut | |||
) |
Dump unbinned particles in binary format.
Definition at line 141 of file output_particle.c.
References ath_error(), ath_fname(), getvalues(), getweight, par_getd(), particle_to_grid(), and property_all().
void dump_particle_history | ( | Grid * | pGrid, | |
Domain * | pD, | |||
Output * | pOut | |||
) |
Writes particle variables as formatted table.
Definition at line 87 of file dump_particle_history.c.
References ath_perr(), calloc_1d_array(), calloc_2d_array(), expr_dpar(), free_2d_array(), n, particle_to_grid(), phst_arayfun, phst_scalfun, property_all(), rho, usr_aray_cnt, usr_label_aray, usr_label_scal, and usr_scal_cnt.
void exchange_feedback | ( | Grid * | pG, | |
Domain * | pD | |||
) |
Calls appropriate functions to copy feedback in the ghost zones back to the grid.
The function pointers (*apply_???) are set during initialization by exchange_feedback_init() to be either a user-defined function, or one of the functions corresponding to reflecting, periodic, or outflow. If the left- or right-Grid ID numbers are >= 1 (neighboring grids exist), then MPI calls are used.
Order for updating boundary conditions must always be x3-x2-x1 in order to fill the corner cells properly (opposite to setting MHD B.C.!)
Definition at line 137 of file feedback.c.
References ath_error(), my_iproc, recv_buf, recv_ix1_feedback(), recv_ix2_feedback(), recv_ix3_feedback(), recv_ox1_feedback(), recv_ox2_feedback(), recv_ox3_feedback(), send_ix1_feedback(), send_ix2_feedback(), send_ix3_feedback(), send_ox1_feedback(), send_ox2_feedback(), send_ox3_feedback(), shearingbox_ix1_feedback(), and shearingbox_ox1_feedback().
Referenced by integrate_1d_ctu(), integrate_2d_ctu(), and integrate_3d_ctu().
void exchange_feedback_destruct | ( | Grid * | pG, | |
Domain * | pD | |||
) |
void exchange_feedback_fun | ( | enum Direction | dir, | |
VBCFun_t | prob_bc | |||
) |
Sets function pointers for user-defined feedback exchange in problem file.
Definition at line 630 of file feedback.c.
References apply_ix1, apply_ix2, apply_ix3, apply_ox1, apply_ox2, apply_ox3, ath_perr(), left_x1, left_x2, left_x3, right_x1, right_x2, and right_x3.
void exchange_feedback_init | ( | Grid * | pG, | |
Domain * | pD | |||
) |
Sets function pointers for feedback exchange during initialization, allocates memory for send/receive buffers with MPI.
Definition at line 354 of file feedback.c.
References apply_ix1, apply_ix2, apply_ix3, apply_ox1, apply_ox2, apply_ox3, ath_error(), ath_perr(), get_myGridIndex(), il, iu, jl, ju, kl, ku, Lx1, Lx2, Lx3, my_iproc, my_jproc, my_kproc, par_getd(), par_geti(), recv_buf, send_buf, x1max, x1min, x2max, x2min, x3max, and x3min.
Referenced by main().
void feedback_clear | ( | Grid * | pG | ) |
clean the feedback array
Definition at line 515 of file utils_particle.c.
References GPCouple::Eloss, GPCouple::fb1, GPCouple::fb2, GPCouple::fb3, ilp, iup, jlp, jup, klp, and kup.
Referenced by Integrate_Particles().
void feedback_corrector | ( | Grid * | pG, | |
Grain * | gri, | |||
Grain * | grf, | |||
Vector | cell1, | |||
Real | dv1, | |||
Real | dv2, | |||
Real | dv3, | |||
Real | ts | |||
) |
Calculate the feedback of the drag force from the particle to the gas.
Serves for the corrector step. It deals with one particle at a time. Input: pG: grid with particles; gri,grf: initial and final particles; dv: velocity difference between gri and grf. Output: pG: the array of drag forces exerted by the particle is updated
Definition at line 643 of file integrators_particle.c.
References distrFB_corr(), Get_Force(), and getweight.
Referenced by Integrate_Particles().
void feedback_predictor | ( | Grid * | pG | ) |
Calculate the feedback of the drag force from the particle to the gas.
Serves for the predictor step. It deals with all the particles. Input: pG: grid with particles Output: pG: the array of drag forces exerted by the particle is updated
Definition at line 528 of file integrators_particle.c.
References distrFB_pred(), gasvshift(), get_gasinfo(), get_ts, getvalues(), getweight, ilp, iup, jlp, jup, klp, kup, and rho.
Referenced by integrate_1d_ctu(), integrate_2d_ctu(), and integrate_3d_ctu().
void get_gasinfo | ( | Grid * | pG | ) |
Calculate the gas information from conserved variables for feedback_predictor.
Input: pG: grid (not evolved yet). Output: calculate 3D array grid_v/grid_cs in the grid structure. Calculated are gas velocity and sound speed.
Definition at line 469 of file utils_particle.c.
References ath_error(), Gamma, Gamma_1, GPCouple::grid_cs, GPCouple::grid_d, GPCouple::grid_v1, GPCouple::grid_v2, GPCouple::grid_v3, ilp, iup, jlp, jup, klp, and kup.
Referenced by feedback_predictor().
Calculate the stopping time in the Epstein regime.
Note grrhoa == rho_s*a in normalized unit
Definition at line 426 of file utils_particle.c.
References grrhoa.
Calculate the stopping time for the most general case.
The relavent scale to calculate is:
Definition at line 383 of file utils_particle.c.
int getvalues | ( | Grid * | pG, | |
Real | weight[3][3][3], | |||
int | is, | |||
int | js, | |||
int | ks, | |||
#ifndef FEEDBACK Real * | rho, | |||
Real * | u1, | |||
Real * | u2, | |||
Real * | u3, | |||
Real *cs#else Real * | rho, | |||
Real * | u1, | |||
Real * | u2, | |||
Real * | u3, | |||
Real * | cs, | |||
Real *stiff# | endif | |||
) |
Definition at line 296 of file utils_particle.c.
References C, GPCouple::FBstiff, GPCouple::grid_cs, GPCouple::grid_d, GPCouple::grid_v1, GPCouple::grid_v2, GPCouple::grid_v3, ilp, Iso_csound, iup, jlp, jup, klp, kup, and ncell.
Referenced by dump_particle_binary(), feedback_predictor(), Get_Drag(), and Get_Term().
void getwei_linear | ( | Grid * | pG, | |
Real | x1, | |||
Real | x2, | |||
Real | x3, | |||
Vector | cell1, | |||
Real | weight[3][3][3], | |||
int * | is, | |||
int * | js, | |||
int * | ks | |||
) |
Get weight using linear interpolation.
Input: pG: grid; x1,x2,x3: global coordinate; cell1: 1 over dx1,dx2,dx3 Output: weight: weight function; is,js,ks: starting cell indices in the grid. Note: this interpolation works in any 1-3 dimensions.
Definition at line 84 of file utils_particle.c.
References a, celli(), cellj(), and cellk().
void getwei_QP | ( | Grid * | pG, | |
Real | x1, | |||
Real | x2, | |||
Real | x3, | |||
Vector | cell1, | |||
Real | weight[3][3][3], | |||
int * | is, | |||
int * | js, | |||
int * | ks | |||
) |
Get weight using quadratic polynomial interpolation.
Input: pG: grid; x1,x2,x3: global coordinate; cell1: 1 over dx1,dx2,dx3 Output: weight: weight function; is,js,ks: starting cell indices in the grid. Note: this interpolation works in any 1-3 dimensions.
Definition at line 221 of file utils_particle.c.
References a, celli(), cellj(), and cellk().
void getwei_TSC | ( | Grid * | pG, | |
Real | x1, | |||
Real | x2, | |||
Real | x3, | |||
Vector | cell1, | |||
Real | weight[3][3][3], | |||
int * | is, | |||
int * | js, | |||
int * | ks | |||
) |
Get weight using Triangular Shaped Cloud (TSC) interpolation Input: pG: grid; x1,x2,x3: global coordinate; cell1: 1 over dx1,dx2,dx3 Output: weight: weight function; is,js,ks: starting cell indices in the grid.
Note: this interpolation works in any 1-3 dimensions.
Definition at line 149 of file utils_particle.c.
References a, celli(), cellj(), and cellk().
void init_particle | ( | Grid * | pG, | |
Domain * | pD | |||
) |
Initialization for particles.
Allocate memory for the gas velocity/sound speed array, feedback array. Note we enforce that each type has equal number of particles to ensure equal resolution.
Definition at line 52 of file init_particle.c.
References alamcoeff, ath_error(), calloc_1d_array(), calloc_3d_array(), get_ts, getweight, grid_limit(), grrhoa, ilp, iup, jlp, jup, klp, kup, ncell, par_exist(), par_geti(), par_geti_def(), and tstop0.
Referenced by main().
void int_par_exp | ( | Grid * | pG, | |
Grain * | curG, | |||
Vector | cell1, | |||
Real * | dv1, | |||
Real * | dv2, | |||
Real * | dv3, | |||
Real * | ts | |||
) |
2nd order explicit particle integrator
Input: grid pointer (pG), grain pointer (curG), cell size indicator (cell1) Output: dv1,dv2,dv3: velocity update
Definition at line 415 of file integrators_particle.c.
References Get_Drag(), Get_Force(), and qshear.
Referenced by Integrate_Particles().
void int_par_fulimp | ( | Grid * | pG, | |
Grain * | curG, | |||
Vector | cell1, | |||
Real * | dv1, | |||
Real * | dv2, | |||
Real * | dv3, | |||
Real * | ts | |||
) |
2nd order fully implicit particle integrator
Input: grid pointer (pG), grain pointer (curG), cell size indicator (cell1) Output: dv1,dv2,dv3: velocity update
Definition at line 200 of file integrators_particle.c.
References b0, C, Get_Drag(), Get_Force(), Omega_0, and qshear.
Referenced by Integrate_Particles().
void int_par_semimp | ( | Grid * | pG, | |
Grain * | curG, | |||
Vector | cell1, | |||
Real * | dv1, | |||
Real * | dv2, | |||
Real * | dv3, | |||
Real * | ts | |||
) |
2nd order semi-implicit particle integrator
Input: grid pointer (pG), grain pointer (curG), cell size indicator (cell1) Output: dv1,dv2,dv3: velocity update
Definition at line 320 of file integrators_particle.c.
References Get_Drag(), Get_Force(), Omega_0, and qshear.
Referenced by Integrate_Particles().
void int_par_spec | ( | Grid * | pG, | |
Grain * | curG, | |||
Vector | cell1, | |||
Real * | dv1, | |||
Real * | dv2, | |||
Real * | dv3, | |||
Real * | ts | |||
) |
2nd order specific particle integrator; This integrator works ONLY in the strong coupling regime (t_stop<h)
Input: grid pointer (pG), grain pointer (curG), cell size indicator (cell1) Output: dv1,dv2,dv3: velocity update
Definition at line 485 of file integrators_particle.c.
References Get_Term(), and qshear.
Referenced by Integrate_Particles().
void Integrate_Particles | ( | Grid * | pG, | |
Domain * | pD | |||
) |
Main particle integrator.
Input: Grid which is already evolved in half a time step. Paricles unevolved. Output: particle updated for one full time step; feedback array for corrector updated. Note: This routine allows has the flexibility to freely choose the particle integrator. Should use fully implicit integrator for tightly coupoled particles. Otherwise the semi-implicit integrator performs better.
Definition at line 75 of file integrators_particle.c.
References ath_error(), ath_pout(), Delete_Ghost(), dv1, dv2, dv3, feedback_clear(), feedback_corrector(), Get_Term(), int_par_exp(), int_par_fulimp(), int_par_semimp(), int_par_spec(), JudgeCrossing(), Omega_0, and qshear.
Referenced by integrate_1d_ctu(), integrate_2d_ctu(), and integrate_3d_ctu().
void particle_destruct | ( | Grid * | pG | ) |
Finalization for particles.
Definition at line 165 of file init_particle.c.
References free_1d_array(), free_3d_array(), and grrhoa.
Referenced by main().
void particle_realloc | ( | Grid * | pG, | |
long | n | |||
) |
Enlarge the particle array.
Definition at line 183 of file init_particle.c.
References ath_error().
Referenced by problem(), and unpack_particle().
void particle_to_grid | ( | Grid * | pG, | |
Domain * | pD, | |||
PropFun_t | par_prop | |||
) |
Bin the particles to grid cells.
Definition at line 68 of file output_particle.c.
References getweight, ilp, iup, jlp, jup, klp, kup, and ncell.
Referenced by data_output(), dump_particle_binary(), dump_particle_history(), and Userwork_after_loop().
int property_all | ( | const Grain * | gr, | |
const GrainAux * | grsub | |||
) |
Default choice for binning particles to the grid: All the particles are binned, return true for any value.
Definition at line 279 of file output_particle.c.
Referenced by dump_particle_binary(), dump_particle_history(), problem(), problem_read_restart(), and Userwork_after_loop().
void shuffle | ( | Grid * | pG | ) |
Shuffle the particles.
Input: pG: grid with particles; Output: pG: particles in the linked list are rearranged by the order of their locations that are consistent with grid cell storage.
Definition at line 645 of file utils_particle.c.
References ath_pout(), and quicksort_particle().
Referenced by set_bvals_particle().