perform_apm Interface

interface


Calls

interface~~perform_apm~~CallsGraph interface~perform_apm perform_apm proc~perform_apm perform_apm interface~perform_apm->proc~perform_apm allocate_gradient allocate_gradient proc~perform_apm->allocate_gradient allocate_metric_on_particles allocate_metric_on_particles proc~perform_apm->allocate_metric_on_particles allocate_rcb_tree_memory_3d allocate_rcb_tree_memory_3d proc~perform_apm->allocate_rcb_tree_memory_3d allocate_sph_memory allocate_sph_memory proc~perform_apm->allocate_sph_memory assign_h assign_h proc~perform_apm->assign_h com com proc~perform_apm->com deallocate_gradient deallocate_gradient proc~perform_apm->deallocate_gradient deallocate_metric_on_particles deallocate_metric_on_particles proc~perform_apm->deallocate_metric_on_particles deallocate_rcb_tree_memory_3d deallocate_rcb_tree_memory_3d proc~perform_apm->deallocate_rcb_tree_memory_3d deallocate_sph_memory deallocate_sph_memory proc~perform_apm->deallocate_sph_memory density density proc~perform_apm->density density_loop density_loop proc~perform_apm->density_loop exact_nei_tree_update exact_nei_tree_update proc~perform_apm->exact_nei_tree_update h h proc~perform_apm->h interface~check_particle_positions check_particle_positions proc~perform_apm->interface~check_particle_positions interface~correct_center_of_mass correct_center_of_mass proc~perform_apm->interface~correct_center_of_mass interface~impose_equatorial_plane_symmetry impose_equatorial_plane_symmetry proc~perform_apm->interface~impose_equatorial_plane_symmetry iorig iorig proc~perform_apm->iorig none~allocate_apm_fields allocate_apm_fields proc~perform_apm->none~allocate_apm_fields none~discard_atmosphere discard_atmosphere proc~perform_apm->none~discard_atmosphere none~dump_apm_pos dump_apm_pos proc~perform_apm->none~dump_apm_pos none~get_nstar_id_atm get_nstar_id_atm proc~perform_apm->none~get_nstar_id_atm none~place_and_print_ghost_particles place_and_print_ghost_particles proc~perform_apm->none~place_and_print_ghost_particles none~read_pressure_id read_pressure_id proc~perform_apm->none~read_pressure_id none~reallocate_output_fields reallocate_output_fields proc~perform_apm->none~reallocate_output_fields none~validate_position_final validate_position_final proc~perform_apm->none~validate_position_final nu nu proc~perform_apm->nu position_correction position_correction proc~perform_apm->position_correction proc~cartesian_from_spherical cartesian_from_spherical proc~perform_apm->proc~cartesian_from_spherical proc~find_h_backup find_h_backup proc~perform_apm->proc~find_h_backup proc~is_finite_number is_finite_number proc~perform_apm->proc~is_finite_number proc~spherical_from_cartesian spherical_from_cartesian proc~perform_apm->proc~spherical_from_cartesian timer timer proc~perform_apm->timer proc~check_particle_positions check_particle_positions interface~check_particle_positions->proc~check_particle_positions proc~correct_center_of_mass correct_center_of_mass interface~correct_center_of_mass->proc~correct_center_of_mass proc~impose_equatorial_plane_symmetry impose_equatorial_plane_symmetry interface~impose_equatorial_plane_symmetry->proc~impose_equatorial_plane_symmetry none~discard_atmosphere->h none~discard_atmosphere->nu get_density get_density none~discard_atmosphere->get_density none~dump_apm_pos->get_density none~get_nstar_id_atm->proc~is_finite_number get_nstar_id get_nstar_id none~get_nstar_id_atm->get_nstar_id none~place_and_print_ghost_particles->allocate_gradient none~place_and_print_ghost_particles->allocate_metric_on_particles none~place_and_print_ghost_particles->allocate_rcb_tree_memory_3d none~place_and_print_ghost_particles->allocate_sph_memory none~place_and_print_ghost_particles->assign_h none~place_and_print_ghost_particles->deallocate_gradient none~place_and_print_ghost_particles->deallocate_metric_on_particles none~place_and_print_ghost_particles->deallocate_rcb_tree_memory_3d none~place_and_print_ghost_particles->deallocate_sph_memory none~place_and_print_ghost_particles->density_loop none~place_and_print_ghost_particles->h none~place_and_print_ghost_particles->iorig none~place_and_print_ghost_particles->proc~cartesian_from_spherical none~place_and_print_ghost_particles->proc~find_h_backup none~place_and_print_ghost_particles->proc~is_finite_number none~place_and_print_ghost_particles->proc~spherical_from_cartesian none~place_and_print_ghost_particles->timer bilinear_interpolation bilinear_interpolation none~place_and_print_ghost_particles->bilinear_interpolation center center none~place_and_print_ghost_particles->center compute_pressure compute_pressure none~place_and_print_ghost_particles->compute_pressure none~place_and_print_ghost_particles->get_density none~place_and_print_ghost_particles->get_nstar_id nu_output nu_output none~place_and_print_ghost_particles->nu_output pos_input pos_input none~place_and_print_ghost_particles->pos_input sizes sizes none~place_and_print_ghost_particles->sizes get_pressure_id get_pressure_id none~read_pressure_id->get_pressure_id h_output h_output none~reallocate_output_fields->h_output none~reallocate_output_fields->nu_output none~reallocate_output_fields->pos_input validate_position validate_position none~validate_position_final->validate_position indexx indexx proc~check_particle_positions->indexx proc~correct_center_of_mass->com proc~correct_center_of_mass->proc~is_finite_number proc~impose_equatorial_plane_symmetry->com interface~find_particles_above_xy_plane find_particles_above_xy_plane proc~impose_equatorial_plane_symmetry->interface~find_particles_above_xy_plane interface~reflect_particles_xy_plane reflect_particles_xy_plane proc~impose_equatorial_plane_symmetry->interface~reflect_particles_xy_plane proc~find_particles_above_xy_plane find_particles_above_xy_plane interface~find_particles_above_xy_plane->proc~find_particles_above_xy_plane proc~reflect_particles_xy_plane reflect_particles_xy_plane interface~reflect_particles_xy_plane->proc~reflect_particles_xy_plane

Called by

interface~~perform_apm~~CalledByGraph interface~perform_apm perform_apm proc~construct_particles_std construct_particles_std proc~construct_particles_std->interface~perform_apm interface~construct_particles_std construct_particles_std interface~construct_particles_std->proc~construct_particles_std interface~particles particles interface~particles->interface~construct_particles_std program~convergence_test convergence_test program~convergence_test->interface~particles program~sphincs_id sphincs_id program~sphincs_id->interface~particles

public module subroutine perform_apm(get_density, get_nstar_id, get_pressure_id, compute_pressure, npart_output, pos_input, pvol, h_output, nu_output, center, com_star, mass, sizes, eqos, apm_max_it, max_inc, mass_it, correct_nu, nuratio_thres, nuratio_des, use_pressure, adapt_ghosts, move_away_ghosts, nx_gh, ny_gh, nz_gh, ghost_dist, use_atmosphere, remove_atmosphere, print_step, namefile_pos_id, namefile_pos, namefile_results, validate_position, surf)

Arguments

Type IntentOptional Attributes Name
function get_density(x, y, z) result(density)

Returns the baryon mass density at the desired point

Arguments
Type IntentOptional Attributes Name
double precision, intent(in) :: x

coordinate of the desired point

double precision, intent(in) :: y

coordinate of the desired point

double precision, intent(in) :: z

coordinate of the desired point

Return Value double precision

Baryon mass density at

subroutine get_nstar_id(npart, x, y, z, nstar_sph, nstar_id, nlrf_sph, sqg)

Computes the proper baryon number density at the particle positions

Arguments
Type IntentOptional Attributes Name
integer, intent(in) :: npart

Number of real particles (i.e., no ghost particles included here)

double precision, intent(in) :: x(npart)

Array of coordinates

double precision, intent(in) :: y(npart)

Array of coordinates

double precision, intent(in) :: z(npart)

Array of coordinates

double precision, intent(in) :: nstar_sph(npart)

\(\mathrm{SPH}\) proper baryon density

double precision, intent(out) :: nstar_id(npart)

Array to store the computed proper baryon number density

double precision, intent(out) :: nlrf_sph(npart)

Array to store the local rest frame baryon density computed from the \(\mathrm{SPH}\) proper baryon density

double precision, intent(out) :: sqg(npart)

Square root of minus the determinant of the spacetime metric

function get_pressure_id(x, y, z) result(pressure)

Returns the baryon mass density at the desired point

Arguments
Type IntentOptional Attributes Name
double precision, intent(in) :: x

coordinate of the desired point

double precision, intent(in) :: y

coordinate of the desired point

double precision, intent(in) :: z

coordinate of the desired point

Return Value double precision

Baryon mass density at

subroutine compute_pressure(npart, x, y, z, nlrf, eqos, pressure, verbose)
Arguments
Type IntentOptional Attributes Name
integer, intent(in) :: npart

Returns the baryon mass density at the desired point

double precision, intent(in) :: x(npart)

coordinate of the desired point

double precision, intent(in) :: y(npart)

coordinate of the desired point

double precision, intent(in) :: z(npart)

coordinate of the desired point

double precision, intent(in) :: nlrf(npart)

Baryon mass density in the local rest frame

type(eos), intent(in) :: eqos

\(\mathrm{EOS}\) to use

double precision, intent(inout) :: pressure(npart)

Baryon mass density at

logical, intent(in), optional :: verbose

If .TRUE., print informative standard output about how the pressure is computed. Default is .TRUE.

integer, intent(inout) :: npart_output

Initial particle number

double precision, intent(inout), DIMENSION(:,:), ALLOCATABLE :: pos_input

Initial particle positions

double precision, intent(inout), DIMENSION(:), ALLOCATABLE :: pvol

Initial particle volume

double precision, intent(inout), DIMENSION(:), ALLOCATABLE :: h_output

Array to store the smoothing lengths computed at the end of the APM iteration

double precision, intent(inout), DIMENSION(:), ALLOCATABLE :: nu_output

Array to store the baryon number per particle computed at the end of the APM iteration

double precision, intent(in), DIMENSION(3) :: center

Center of the matter object, from the \(\mathrm{ID}\)

double precision, intent(inout), DIMENSION(3) :: com_star

Center of mass of the matter object, from the \(\mathrm{ID}\)

double precision, intent(in) :: mass

Mass of the matter object

double precision, intent(in), DIMENSION(6) :: sizes

Sizes of the matter object

type(eos), intent(in) :: eqos

\(\mathrm{EOS}\) to use when computing the pressure

integer, intent(in) :: apm_max_it

Maximum number of APM iterations, irrespective of the EXIT condition

integer, intent(in) :: max_inc

Sets the EXIT condition: If the average over all the particles of the relative error in the density estimate grows max_inc times, exit the iteration.

logical, intent(in) :: mass_it

If .TRUE. performs a second iteration after the APM one, without moving the particles, changing their mass in order to better match the star density. The mass ratio grows very fast in all the tried experiments, hence the suggested value is .FALSE.

logical, intent(in) :: correct_nu

If .TRUE., the baryon number per particle nu is corrected to include the total baryonic masses of the stars.

double precision, intent(in) :: nuratio_thres

Maximum mass ratio (equivalently baryon number ratio) to be used in the one-time-only final correction of the particle masses to match the star density even better (without moving the particles)

double precision, intent(in) :: nuratio_des

Sets the EXIT condition: If the baryon number ratio is within 2.5% of nuratio_des, exit the iteration Set nuratio_des to 0 to deactivate and exit the APM iteration using max_inc

logical, intent(in) :: use_pressure

If .TRUE., uses the physical pressure computed with the \(\mathrm{EOS}\) using the SPH estimate of the density nlrf_sph, to compute the artificial pressure. Otherwise, the density variable nstar_sph is used to compute the artificial pressure

logical, intent(in) :: adapt_ghosts

If .TRUE., the ghost particles will be placed and have a baryon number such to reproduce the density of the outermost layers (r > 99% of the minimum radius) of the object. If .TRUE., the arguments nx_gh, ny_gh, nz_gh, ghost_dist are ignored; if .FALSE., they are instead used to place the ghost particles

logical, intent(in) :: move_away_ghosts

If .TRUE., the ghost particles will slowly move away from the surface of the star during the iteration (depending on the EXIT condition chosen, this happens in slightly different ways), to allow for the real particles to get closer to the surface

integer, intent(in) :: nx_gh

Number of lattice points in the x direction for ghosts

integer, intent(in) :: ny_gh

Number of lattice points in the y direction for ghosts

integer, intent(in) :: nz_gh

Number of lattice points in the z direction for ghosts

double precision, intent(inout) :: ghost_dist

Distance between the ghost particles and the surface of the matter object considered (star, ejecta, etc...)

logical, intent(inout) :: use_atmosphere

If .TRUE., allows particles to move where the density is 0, and displace them using only the smoothing term. This can be useful when the system has an irregular geometry, as, for example, an ejecta; .FALSE. otherwise

logical, intent(inout) :: remove_atmosphere

If .TRUE., removes the particles placed where the density is 0, at the end of the APM iteration; .FALSE. otherwise

integer, intent(inout) :: print_step

Prints the particle positions to a formatted file every print_step steps

character(len=*), intent(inout), optional :: namefile_pos_id

Name for the formatted file where the initial particle positions and the ghost positions will be printed

character(len=*), intent(inout), optional :: namefile_pos

Name for the formatted file where the particle positions and the ghost positions will be printed every 15 iterations

character(len=*), intent(inout), optional :: namefile_results

Name for the formatted file where various quantities related to the particle distribution, the baryon number particle and the kernel estimate of the density will be printed at the end of the APM iteration

procedure(validate_position_int), optional :: validate_position

Returns 1 if the position is not valid, 0 otherwise

type(surface), intent(in), optional :: surf

Surface of the matter object

Description

Performs the Artificial Pressure Method (APM)

particles object which this PROCEDURE is a member of