Appearance
adam_flume_sinks_object
ADAM, FLUME sink particles: the
[sinks]input and the replicated sink list (issue #94, M12).
A sink is a point mass with a position, a velocity and an acceleration. The list is replicated: every rank holds every sink and updates it identically from MPI-reduced sums (D-M12-1), so no sink has an owner and none migrates. Sinks act through self-gravity only (D-M12-2): their mass is CIC-deposited into the density the Poisson solver sees and they feel the mesh gravity at their position (the deposit and the gather live in the common object, which owns the grid). The keys, lists of one value per initial sink (their number is that of mass; none: no initial sink):
| key | value |
|---|---|
x, y, z | positions, inside the domain |
u, v, w | velocities (optional, default 0) |
mass | masses, > 0 |
creation | optional, default .false.: sinks form where the gas meets the Federrath et al. (2010) checks |
accretion | optional, default .true.: the sinks accrete the gas above the threshold within their radius |
merging | optional, default .true.: two bound, converging sinks within an accretion radius merge |
accretion_radius_cells | optional, default 2.5: the accretion radius in cells of the sink's level, in [1, ngc] |
With runtime regridding ([amr] frequency > 0) the sinks live on the finest level allowed: they form there only, the accretion radius is in its cells and their neighbourhood is kept there at every regrid (D-M12-5).
The threshold density is that of a Jeans length of two accretion radii, rho_thr = pi c_s^2 / (4 G r_acc^2), with the cell's own c_s^2 = gamma p / rho (the Jeans length of the M9 marker; issue #94, D-M12-3, D-M12-4).
With the section, [gravity] self_gravity is required and the model must be hydrodynamic (fatal otherwise, issue #94: MHD sinks are a follow-up). The [reference] layer converts the positions (length), the velocities and the masses (rho0 L0^3). Restart: <restart_basename>.sinks, the list in 17 significant digits (read back, the same doubles). History: <output_basename>-sinks_history.dat, one row per sink per save (it time id m x y z u v w).
Source: src/app/flume/common/adam_flume_sinks_object.F90
Dependencies
Contents
- flume_sinks_object
- append
- remove
- load_from_file
- load_restart
- open_history
- save_history
- save_restart
- totals
- description
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
INI_SECTION_NAME | character(len=5) | parameter | INI section name. |
Derived Types
flume_sinks_object
FLUME sink particles, code units.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
is_active | logical | True with a [sinks] section. | |
n | integer(kind=I4P) | Sinks number. | |
m | real(kind=R8P) | allocatable | Masses [n]. |
x | real(kind=R8P) | allocatable | Positions [3,n]. |
v | real(kind=R8P) | allocatable | Velocities [3,n]. |
a | real(kind=R8P) | allocatable | Accelerations from the mesh gravity [3,n]. |
dt_limit | real(kind=R8P) | Time step limit of the current list (refreshed after each update). | |
is_new | logical | allocatable | True for a sink formed this step (its first accretion is unchecked). |
creation | logical | Sinks form from the gas. | |
accretion | logical | Sinks accrete. | |
merging | logical | Sinks merge. | |
r_acc_cells | real(kind=R8P) | Accretion radius in cells. | |
formed | integer(kind=I4P) | Sinks formed since the start of the run. | |
merged | integer(kind=I4P) | Mergers since the start of the run. | |
history_unit | integer(kind=I4P) | Sinks history unit (rank 0). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
append | pass(self) | Append a sink. |
description | pass(self) | Return pretty-printed object description. |
remove | pass(self) | Remove a sink. |
load_from_file | pass(self) | Load [sinks]. |
load_restart | pass(self) | Load the list from .sinks. |
open_history | pass(self) | Open the sinks history (rank 0). |
save_history | pass(self) | Write one history row per sink (rank 0). |
save_restart | pass(self) | Save the list to .sinks (rank 0). |
totals | pass(self) | Return the total mass, momentum and kinetic energy. |
Subroutines
append
Append a sink (every rank, identically: the list is replicated); it is new until its first accretion. The arrays grow by explicit allocation (no reallocation on assignment: under nvfortran it intermittently failed to grow an array in the sink code, issue #94).
fortran
subroutine append(self, m, x, v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | inout | Sinks. | |
m | real(kind=R8P) | in | Mass. | |
x | real(kind=R8P) | in | Position. | |
v | real(kind=R8P) | in | Velocity. |
Call graph
remove
Remove sink s (every rank, identically), by explicit allocation (see append).
fortran
subroutine remove(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | inout | Sinks. | |
s | integer(kind=I4P) | in | Sink to remove. |
Call graph
load_from_file
Load [sinks] and check it.
fortran
subroutine load_from_file(self, file_parameters, model, self_gravity, domain_emin, domain_emax, ngc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | inout | Sinks. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
model | integer(kind=I4P) | in | Physical model id. | |
self_gravity | logical | in | [gravity] self_gravity. | |
domain_emin | real(kind=R8P) | in | Domain minimum abscissa. | |
domain_emax | real(kind=R8P) | in | Domain maximum abscissa. | |
ngc | integer(kind=I4P) | in | Ghost cells number (bounds the accretion radius). |
Call graph
load_restart
Load the list from <basename>.sinks (every rank reads it: the list is replicated).
fortran
subroutine load_restart(self, basename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | inout | Sinks. | |
basename | character(len=*) | in | Restart files basename. |
Call graph
open_history
Open the sinks history (rank 0) and write its header (append, without header, on restart).
fortran
subroutine open_history(self, output_basename, is_restart)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | inout | Sinks. | |
output_basename | character(len=*) | in | Output files basename. | |
is_restart | logical | in | Restarted run flag. |
Call graph
save_history
Write one history row per sink (rank 0), the values times the output factors.
fortran
subroutine save_history(self, it, time, length, velocity, mass)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | in | Sinks. | |
it | integer(kind=I4P) | in | Time iteration. | |
time | real(kind=R8P) | in | Time (output units). | |
length | real(kind=R8P) | in | Output factor of the lengths. | |
velocity | real(kind=R8P) | in | Output factor of the velocities. | |
mass | real(kind=R8P) | in | Output factor of the masses. |
Call graph
save_restart
Save the list to <basename>.sinks (rank 0), 17 significant digits: read back, the same doubles.
fortran
subroutine save_restart(self, basename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | in | Sinks. | |
basename | character(len=*) | in | Restart files basename. |
Call graph
totals
Return the total mass, momentum and kinetic energy of the sinks.
Attributes: pure
fortran
subroutine totals(self, mass, momentum, kinetic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | in | Sinks. | |
mass | real(kind=R8P) | out | Total mass. | |
momentum | real(kind=R8P) | out | Total momentum. | |
kinetic | real(kind=R8P) | out | Total kinetic energy. |
Call graph
Functions
description
Return a pretty-formatted object description.
Returns: character(len=:)
fortran
function description(self) result(desc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_sinks_object) | in | Sinks. |
Call graph