Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

density.c File Reference

SPH density computation and smoothing length determination. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <mpi.h>
#include "allvars.h"
#include "proto.h"

Go to the source code of this file.

Defines

#define boxSize_X   boxSize
#define boxHalf_X   boxHalf
#define boxSize_Y   boxSize
#define boxHalf_Y   boxHalf
#define boxSize_Z   boxSize
#define boxHalf_Z   boxHalf

Functions

void density (void)
void density_evaluate (int target, int mode)
int dens_compare_key (const void *a, const void *b)


Detailed Description

SPH density computation and smoothing length determination.

This file contains the "first SPH loop", where the SPH densities and some auxiliary quantities are computed. If the number of neighbours obtained falls outside the target range, the correct smoothing length is determined iteratively, if needed.

Definition in file density.c.


Define Documentation

#define boxHalf_X   boxHalf
 

Definition at line 28 of file density.c.

Referenced by density(), hydro_force(), and ngb_treeallocate().

#define boxHalf_Y   boxHalf
 

Definition at line 34 of file density.c.

Referenced by density(), hydro_force(), and ngb_treeallocate().

#define boxHalf_Z   boxHalf
 

Definition at line 40 of file density.c.

Referenced by density(), hydro_force(), and ngb_treeallocate().

#define boxSize_X   boxSize
 

Definition at line 27 of file density.c.

Referenced by density(), hydro_force(), and ngb_treeallocate().

#define boxSize_Y   boxSize
 

Definition at line 33 of file density.c.

Referenced by density(), hydro_force(), and ngb_treeallocate().

#define boxSize_Z   boxSize
 

Definition at line 39 of file density.c.

Referenced by density(), hydro_force(), and ngb_treeallocate().


Function Documentation

int dens_compare_key const void *  a,
const void *  b
 

This routine is a comparison kernel used in a sort routine to group particles that are exported to the same processor.

Definition at line 607 of file density.c.

Referenced by density().

void density void   ) 
 

This function computes the local density for each active SPH particle, the number of neighbours in the current smoothing radius, and the divergence and curl of the velocity field. The pressure is updated as well. If a particle with its smoothing region is fully inside the local domain, it is not exported to the other processors. The function also detects particles that have a number of neighbours outside the allowed tolerance range. For these particles, the smoothing length is adjusted accordingly, and the density computation is executed again. Note that the smoothing length is not allowed to fall below the lower bound set by MinGasHsml.

< For 3D-normalized kernel

< adiabatic index of simulated gas

< maxmimum number of steps for SPH neighbour iteration

< For 3D-normalized kernel

< For 3D-normalized kernel

< maxmimum number of steps for SPH neighbour iteration

Definition at line 56 of file density.c.

References All, boxHalf_X, boxHalf_Y, boxHalf_Z, global_data_all_processes::BoxSize, boxSize_X, boxSize_Y, boxSize_Z, global_data_all_processes::BunchSizeDensity, global_data_all_processes::CPU_EnsureNgb, global_data_all_processes::CPU_HydCommSumm, global_data_all_processes::CPU_HydCompWalk, global_data_all_processes::CPU_HydImbalance, sph_particle_data::CurlVel, dens_compare_key(), DensDataGet, DensDataIn, DensDataPartialResult, DensDataResult, sph_particle_data::Density, density_evaluate(), global_data_all_processes::DesNumNgb, densdata_out::DhsmlDensity, sph_particle_data::DhsmlDensityFactor, densdata_out::Div, sph_particle_data::DivVel, dmax(), sph_particle_data::DtEntropy, endrun(), sph_particle_data::Entropy, Exportflag, GAMMA, densdata_in::Hsml, sph_particle_data::Hsml, particle_data::ID, densdata_in::Index, sph_particle_data::Left, MAXITER, global_data_all_processes::MaxNumNgbDeviation, global_data_all_processes::MinGasHsml, N_gas, densdata_out::Ngb, NTask, NUMDIMS, sph_particle_data::NumNgb, NumSphUpdate, P, densdata_in::Pos, particle_data::Pos, pow(), sph_particle_data::Pressure, densdata_out::Rho, sph_particle_data::Right, sph_particle_data::Rot, densdata_out::Rot, second(), SphP, TAG_DENS_A, TAG_DENS_B, densdata_in::Task, ThisTask, particle_data::Ti_begstep, global_data_all_processes::Ti_Current, particle_data::Ti_endstep, global_data_all_processes::Timebase_interval, timediff(), particle_data::Type, densdata_in::Vel, and sph_particle_data::VelPred.

Referenced by compute_accelerations().

void density_evaluate int  target,
int  mode
 

This function represents the core of the SPH density computation. The target particle may either be local, or reside in the communication buffer.

< Coefficients for SPH spline kernel and its derivative

< Coefficient for kernel normalization. Note: 4.0/3 * PI = 4.188790204786

< For 3D-normalized kernel

Definition at line 467 of file density.c.

References All, DensDataGet, DensDataResult, sph_particle_data::Density, densdata_out::DhsmlDensity, sph_particle_data::DhsmlDensityFactor, densdata_out::Div, sph_particle_data::DivVel, FLOAT, sph_particle_data::Hsml, densdata_in::Hsml, KERNEL_COEFF_1, KERNEL_COEFF_2, KERNEL_COEFF_3, KERNEL_COEFF_5, KERNEL_COEFF_6, particle_data::Mass, global_data_all_processes::MaxPart, densdata_out::Ngb, ngb_treefind_variable(), Ngblist, NORM_COEFF, NUMDIMS, sph_particle_data::NumNgb, P, particle_data::Pos, densdata_in::Pos, densdata_out::Rho, sph_particle_data::Rot, densdata_out::Rot, SphP, densdata_in::Vel, and sph_particle_data::VelPred.

Referenced by density().


Generated on Sun May 22 17:33:30 2005 for GADGET-2 by  doxygen 1.3.9.1