rapidsim 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rapidsim-0.1.0/LICENSE +21 -0
- rapidsim-0.1.0/MANIFEST.in +4 -0
- rapidsim-0.1.0/PKG-INFO +117 -0
- rapidsim-0.1.0/README.md +102 -0
- rapidsim-0.1.0/include/core/config.h +92 -0
- rapidsim-0.1.0/include/core/init_tool_module.h +71 -0
- rapidsim-0.1.0/include/core/integrator.h +42 -0
- rapidsim-0.1.0/include/core/particle_data.h +63 -0
- rapidsim-0.1.0/include/core/photoevaporation_wrapper.h +15 -0
- rapidsim-0.1.0/include/core/simulation_core.h +76 -0
- rapidsim-0.1.0/include/core/simulation_types.h +259 -0
- rapidsim-0.1.0/include/io/ascii_output.h +230 -0
- rapidsim-0.1.0/include/io/hdf5_output.h +121 -0
- rapidsim-0.1.0/include/io/logger.h +19 -0
- rapidsim-0.1.0/include/io/print_panels.h +20 -0
- rapidsim-0.1.0/include/io/print_terminal.h +21 -0
- rapidsim-0.1.0/include/physics/boundary_conditions.h +172 -0
- rapidsim-0.1.0/include/physics/disk_model.h +110 -0
- rapidsim-0.1.0/include/physics/dust_physics.h +175 -0
- rapidsim-0.1.0/include/physics/gas_physics.h +170 -0
- rapidsim-0.1.0/include/utils/parser.h +101 -0
- rapidsim-0.1.0/include/utils/utils.h +157 -0
- rapidsim-0.1.0/pyproject.toml +28 -0
- rapidsim-0.1.0/rapidsim/__init__.py +2 -0
- rapidsim-0.1.0/rapidsim/run_simulation.py +227 -0
- rapidsim-0.1.0/rapidsim.egg-info/PKG-INFO +117 -0
- rapidsim-0.1.0/rapidsim.egg-info/SOURCES.txt +49 -0
- rapidsim-0.1.0/rapidsim.egg-info/dependency_links.txt +1 -0
- rapidsim-0.1.0/rapidsim.egg-info/entry_points.txt +2 -0
- rapidsim-0.1.0/rapidsim.egg-info/requires.txt +1 -0
- rapidsim-0.1.0/rapidsim.egg-info/top_level.txt +1 -0
- rapidsim-0.1.0/setup.cfg +4 -0
- rapidsim-0.1.0/setup.py +41 -0
- rapidsim-0.1.0/src/core/config.c +35 -0
- rapidsim-0.1.0/src/core/init_tool_module.c +363 -0
- rapidsim-0.1.0/src/core/integrator.c +78 -0
- rapidsim-0.1.0/src/core/main.c +373 -0
- rapidsim-0.1.0/src/core/particle_data.c +106 -0
- rapidsim-0.1.0/src/core/simulation_core.c +527 -0
- rapidsim-0.1.0/src/core/simulation_types.c +42 -0
- rapidsim-0.1.0/src/io/ascii_output.c +758 -0
- rapidsim-0.1.0/src/io/hdf5_output.c +315 -0
- rapidsim-0.1.0/src/io/logger.c +4 -0
- rapidsim-0.1.0/src/io/print_panels.c +134 -0
- rapidsim-0.1.0/src/io/print_terminal.c +123 -0
- rapidsim-0.1.0/src/physics/boundary_conditions.c +204 -0
- rapidsim-0.1.0/src/physics/disk_model.c +130 -0
- rapidsim-0.1.0/src/physics/dust_physics.c +418 -0
- rapidsim-0.1.0/src/physics/gas_physics.c +191 -0
- rapidsim-0.1.0/src/utils/parser.c +485 -0
- rapidsim-0.1.0/src/utils/utils.c +315 -0
rapidsim-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 tnehezd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rapidsim-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rapidsim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python wrapper for RAPID code
|
|
5
|
+
Author: Dóra Tarczay-Nehéz
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: C
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
+
Classifier: Operating System :: MacOS
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: PyYAML
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# RAPID: Representative Approach for Particle-Integrated Disks
|
|
17
|
+
|
|
18
|
+
This repository contains the source code for `RAPID` (Representative Approach for Particle-Integrated Disks), a 1D numerical model developed as part of my PhD research. The model is designed to simulate the dynamics and evolution of dust particles in protoplanetary disks, including dust traps at the edges of an embedded deadzone.
|
|
19
|
+
|
|
20
|
+
The core of the code was originally written in C during my PhD between 2012 and 2015. It has since been restructured into a more modular form to improve its functionality and maintainability.
|
|
21
|
+
|
|
22
|
+
#### ⚠️ 2.2.2 Version: Stable Structure – Ongoing Feature Development
|
|
23
|
+
|
|
24
|
+
The core structure of the codebase has now been finalized, and no further refactoring is planned. The architecture, naming conventions, and overall organization are stable and consistent with the [Coding Standard](docs/CodingStandard.md).
|
|
25
|
+
|
|
26
|
+
However, the project remains under active development in terms of features and capabilities. Please always make sure to `git pull` and stay up to date with the latest release before running simulations.
|
|
27
|
+
|
|
28
|
+
Upcoming and ongoing extensions include:
|
|
29
|
+
|
|
30
|
+
- Additional numerical integrators
|
|
31
|
+
- Dust settling implementation
|
|
32
|
+
(transition from 1D to 1+1D structure)
|
|
33
|
+
- General validation and benchmark test problems
|
|
34
|
+
(e.g. shock tube and other standard test cases)
|
|
35
|
+
|
|
36
|
+
Stay tuned for regular feature updates.
|
|
37
|
+
|
|
38
|
+
## Model Description
|
|
39
|
+
|
|
40
|
+
RAPID is a trajectory-based Lagrangian model that tracks the motion of representative dust particles in the radial direction within an evolving 1D Eulerian gaseous disk. A key feature of this model is that the pressure maximum, which acts as a dust trap, is not a static element but a dynamically evolving phenomenon arising naturally in the vicinity of the embedded dead zone's inner and outer edges.
|
|
41
|
+
|
|
42
|
+
This approach offers computational efficiency due to its 1D nature while providing an effective approximation of particle trajectories. Using RAPID, we can conduct parameter studies to investigate dust mass growth, particle trajectories, and the evolution of feeding zones around pressure bumps, aiming to understand the conditions that facilitate planetesimal formation in protoplanetary disks.
|
|
43
|
+
|
|
44
|
+
This work is based on the methods described in Regály et al. (2017) and Tarczay-Nehéz (2026).
|
|
45
|
+
|
|
46
|
+
## Building and Running the Simulation
|
|
47
|
+
|
|
48
|
+
### Prerequisites
|
|
49
|
+
To build the executable, you need a C compiler (e.g., GCC or Clang) and GNU Make.
|
|
50
|
+
|
|
51
|
+
### Build Instructions
|
|
52
|
+
|
|
53
|
+
To compile the source code, open your terminal and run the following commands:
|
|
54
|
+
|
|
55
|
+
```Bash
|
|
56
|
+
make clean
|
|
57
|
+
make all
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Running a Simulation
|
|
61
|
+
|
|
62
|
+
There are two primary ways to run a simulation:
|
|
63
|
+
|
|
64
|
+
Using a configuration file:
|
|
65
|
+
The `run_simulation.py` Python3 wrapper script can be used to run a series of simulations based on parameters defined in a `config.yaml` file. Simply execute the script in your terminal:
|
|
66
|
+
|
|
67
|
+
```Bash
|
|
68
|
+
python run_simulation.py
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Using command-line arguments:
|
|
72
|
+
Alternatively, you can run the executable directly from the command line by specifying the parameters. A detailed list of all available command-line flags and their corresponding parameters will be provided here shortly.
|
|
73
|
+
|
|
74
|
+
----
|
|
75
|
+
### References
|
|
76
|
+
|
|
77
|
+
If you use this code in your research, please cite the following papers, which provides the theoretical background for the core numerical methods:
|
|
78
|
+
|
|
79
|
+
```bibtex
|
|
80
|
+
@ARTICLE{2017ApJ...851...89R,
|
|
81
|
+
author = {{Reg{\'a}ly}, Zs. and {Juh{\'a}sz}, A. and {Neh{\'e}z}, D.},
|
|
82
|
+
title = "{Interpreting Brightness Asymmetries in Transition Disks: Vortex at Dead Zone or Planet-carved Gap Edges?}",
|
|
83
|
+
journal = {\apj},
|
|
84
|
+
keywords = {accretion, accretion disks, hydrodynamics, methods: numerical, protoplanetary disks, Astrophysics - Earth and Planetary Astrophysics, Astrophysics - Solar and Stellar Astrophysics},
|
|
85
|
+
year = 2017,
|
|
86
|
+
month = dec,
|
|
87
|
+
volume = {851},
|
|
88
|
+
number = {2},
|
|
89
|
+
eid = {89},
|
|
90
|
+
pages = {89},
|
|
91
|
+
doi = {10.3847/1538-4357/aa9a3f},
|
|
92
|
+
archivePrefix = {arXiv},
|
|
93
|
+
eprint = {1711.03548},
|
|
94
|
+
primaryClass = {astro-ph.EP},
|
|
95
|
+
adsurl = {[https://ui.adsabs.harvard.edu/abs/2017ApJ...851...89R](https://ui.adsabs.harvard.edu/abs/2017ApJ...851...89R)},
|
|
96
|
+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@article{TarczayNehez2026,
|
|
101
|
+
author = {Tarczay-Neh{\'e}z, D{\'o}ra},
|
|
102
|
+
date = {2026/02/03},
|
|
103
|
+
date-added = {2026-02-03 12:16:24 +0100},
|
|
104
|
+
date-modified = {2026-02-03 12:16:24 +0100},
|
|
105
|
+
doi = {10.1007/s10569-026-10278-2},
|
|
106
|
+
id = {Tarczay-Neh{\'e}z2026},
|
|
107
|
+
isbn = {1572-9478},
|
|
108
|
+
journal = {Celestial Mechanics and Dynamical Astronomy},
|
|
109
|
+
number = {1},
|
|
110
|
+
pages = {6},
|
|
111
|
+
title = {Trajectory-based dust evolution in disks: first results from the RAPID simulation code},
|
|
112
|
+
url = {https://doi.org/10.1007/s10569-026-10278-2},
|
|
113
|
+
volume = {138},
|
|
114
|
+
year = {2026},
|
|
115
|
+
bdsk-url-1 = {https://doi.org/10.1007/s10569-026-10278-2}}
|
|
116
|
+
}
|
|
117
|
+
|
rapidsim-0.1.0/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# RAPID: Representative Approach for Particle-Integrated Disks
|
|
2
|
+
|
|
3
|
+
This repository contains the source code for `RAPID` (Representative Approach for Particle-Integrated Disks), a 1D numerical model developed as part of my PhD research. The model is designed to simulate the dynamics and evolution of dust particles in protoplanetary disks, including dust traps at the edges of an embedded deadzone.
|
|
4
|
+
|
|
5
|
+
The core of the code was originally written in C during my PhD between 2012 and 2015. It has since been restructured into a more modular form to improve its functionality and maintainability.
|
|
6
|
+
|
|
7
|
+
#### ⚠️ 2.2.2 Version: Stable Structure – Ongoing Feature Development
|
|
8
|
+
|
|
9
|
+
The core structure of the codebase has now been finalized, and no further refactoring is planned. The architecture, naming conventions, and overall organization are stable and consistent with the [Coding Standard](docs/CodingStandard.md).
|
|
10
|
+
|
|
11
|
+
However, the project remains under active development in terms of features and capabilities. Please always make sure to `git pull` and stay up to date with the latest release before running simulations.
|
|
12
|
+
|
|
13
|
+
Upcoming and ongoing extensions include:
|
|
14
|
+
|
|
15
|
+
- Additional numerical integrators
|
|
16
|
+
- Dust settling implementation
|
|
17
|
+
(transition from 1D to 1+1D structure)
|
|
18
|
+
- General validation and benchmark test problems
|
|
19
|
+
(e.g. shock tube and other standard test cases)
|
|
20
|
+
|
|
21
|
+
Stay tuned for regular feature updates.
|
|
22
|
+
|
|
23
|
+
## Model Description
|
|
24
|
+
|
|
25
|
+
RAPID is a trajectory-based Lagrangian model that tracks the motion of representative dust particles in the radial direction within an evolving 1D Eulerian gaseous disk. A key feature of this model is that the pressure maximum, which acts as a dust trap, is not a static element but a dynamically evolving phenomenon arising naturally in the vicinity of the embedded dead zone's inner and outer edges.
|
|
26
|
+
|
|
27
|
+
This approach offers computational efficiency due to its 1D nature while providing an effective approximation of particle trajectories. Using RAPID, we can conduct parameter studies to investigate dust mass growth, particle trajectories, and the evolution of feeding zones around pressure bumps, aiming to understand the conditions that facilitate planetesimal formation in protoplanetary disks.
|
|
28
|
+
|
|
29
|
+
This work is based on the methods described in Regály et al. (2017) and Tarczay-Nehéz (2026).
|
|
30
|
+
|
|
31
|
+
## Building and Running the Simulation
|
|
32
|
+
|
|
33
|
+
### Prerequisites
|
|
34
|
+
To build the executable, you need a C compiler (e.g., GCC or Clang) and GNU Make.
|
|
35
|
+
|
|
36
|
+
### Build Instructions
|
|
37
|
+
|
|
38
|
+
To compile the source code, open your terminal and run the following commands:
|
|
39
|
+
|
|
40
|
+
```Bash
|
|
41
|
+
make clean
|
|
42
|
+
make all
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Running a Simulation
|
|
46
|
+
|
|
47
|
+
There are two primary ways to run a simulation:
|
|
48
|
+
|
|
49
|
+
Using a configuration file:
|
|
50
|
+
The `run_simulation.py` Python3 wrapper script can be used to run a series of simulations based on parameters defined in a `config.yaml` file. Simply execute the script in your terminal:
|
|
51
|
+
|
|
52
|
+
```Bash
|
|
53
|
+
python run_simulation.py
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Using command-line arguments:
|
|
57
|
+
Alternatively, you can run the executable directly from the command line by specifying the parameters. A detailed list of all available command-line flags and their corresponding parameters will be provided here shortly.
|
|
58
|
+
|
|
59
|
+
----
|
|
60
|
+
### References
|
|
61
|
+
|
|
62
|
+
If you use this code in your research, please cite the following papers, which provides the theoretical background for the core numerical methods:
|
|
63
|
+
|
|
64
|
+
```bibtex
|
|
65
|
+
@ARTICLE{2017ApJ...851...89R,
|
|
66
|
+
author = {{Reg{\'a}ly}, Zs. and {Juh{\'a}sz}, A. and {Neh{\'e}z}, D.},
|
|
67
|
+
title = "{Interpreting Brightness Asymmetries in Transition Disks: Vortex at Dead Zone or Planet-carved Gap Edges?}",
|
|
68
|
+
journal = {\apj},
|
|
69
|
+
keywords = {accretion, accretion disks, hydrodynamics, methods: numerical, protoplanetary disks, Astrophysics - Earth and Planetary Astrophysics, Astrophysics - Solar and Stellar Astrophysics},
|
|
70
|
+
year = 2017,
|
|
71
|
+
month = dec,
|
|
72
|
+
volume = {851},
|
|
73
|
+
number = {2},
|
|
74
|
+
eid = {89},
|
|
75
|
+
pages = {89},
|
|
76
|
+
doi = {10.3847/1538-4357/aa9a3f},
|
|
77
|
+
archivePrefix = {arXiv},
|
|
78
|
+
eprint = {1711.03548},
|
|
79
|
+
primaryClass = {astro-ph.EP},
|
|
80
|
+
adsurl = {[https://ui.adsabs.harvard.edu/abs/2017ApJ...851...89R](https://ui.adsabs.harvard.edu/abs/2017ApJ...851...89R)},
|
|
81
|
+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@article{TarczayNehez2026,
|
|
86
|
+
author = {Tarczay-Neh{\'e}z, D{\'o}ra},
|
|
87
|
+
date = {2026/02/03},
|
|
88
|
+
date-added = {2026-02-03 12:16:24 +0100},
|
|
89
|
+
date-modified = {2026-02-03 12:16:24 +0100},
|
|
90
|
+
doi = {10.1007/s10569-026-10278-2},
|
|
91
|
+
id = {Tarczay-Neh{\'e}z2026},
|
|
92
|
+
isbn = {1572-9478},
|
|
93
|
+
journal = {Celestial Mechanics and Dynamical Astronomy},
|
|
94
|
+
number = {1},
|
|
95
|
+
pages = {6},
|
|
96
|
+
title = {Trajectory-based dust evolution in disks: first results from the RAPID simulation code},
|
|
97
|
+
url = {https://doi.org/10.1007/s10569-026-10278-2},
|
|
98
|
+
volume = {138},
|
|
99
|
+
year = {2026},
|
|
100
|
+
bdsk-url-1 = {https://doi.org/10.1007/s10569-026-10278-2}}
|
|
101
|
+
}
|
|
102
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file config.h
|
|
3
|
+
* @brief Global configuration, physical constants, and file handles.
|
|
4
|
+
* * This file contains global variable declarations, preprocessor macros for
|
|
5
|
+
* physical constants, unit conversion factors, and external file pointers
|
|
6
|
+
* used for simulation logging and data management.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#ifndef CONFIG_H
|
|
10
|
+
#define CONFIG_H
|
|
11
|
+
|
|
12
|
+
#include <stdio.h>
|
|
13
|
+
#include <math.h>
|
|
14
|
+
|
|
15
|
+
/** @brief Total number of representative dust particles in the simulation. */
|
|
16
|
+
extern int particle_number;
|
|
17
|
+
|
|
18
|
+
/** @name Simulation Output File Pointers
|
|
19
|
+
* External file handles used for real-time tracking and data export.
|
|
20
|
+
*/
|
|
21
|
+
/**@{*/
|
|
22
|
+
extern FILE *drift_timescale_file; /**< Pointer to the file tracking dust radial drift timescales. */
|
|
23
|
+
extern FILE *current_info_file; /**< Pointer to the file for general simulation status and logging. */
|
|
24
|
+
extern FILE *load_dust_particles_file; /**< Pointer to the input file used for loading initial particle states. */
|
|
25
|
+
/**@}*/
|
|
26
|
+
|
|
27
|
+
#include "simulation_types.h"
|
|
28
|
+
|
|
29
|
+
/** @name Physical Constants and Unit Conversions
|
|
30
|
+
* Macros defining fundamental constants and factors to maintain the simulation's unit system.
|
|
31
|
+
*/
|
|
32
|
+
/**@{*/
|
|
33
|
+
/** @brief Factor to convert surface density to internal simulation units. */
|
|
34
|
+
#define SURFACE_DENSITY_CONVERSION_FACTOR 1.12521e-7
|
|
35
|
+
|
|
36
|
+
/** @brief Gravitational constant in dimensionless form (standardized to 1.0). */
|
|
37
|
+
#define G_DIMENSIONLESS 1.0
|
|
38
|
+
|
|
39
|
+
/** @brief Conversion factor from \f$cm/s\f$ to \f$AU/year\f$, normalized by \f$2\pi\f$. */
|
|
40
|
+
#define CM_PER_SEC_TO_AU_PER_YEAR_2PI 3.35725e-07
|
|
41
|
+
|
|
42
|
+
/** @brief Mass of the Sun in grams (CGS units). */
|
|
43
|
+
#define SOLAR_MASS_IN_GRAMS 1.989e33
|
|
44
|
+
|
|
45
|
+
/** @brief One Astronomical Unit in centimeters (CGS units). */
|
|
46
|
+
#define AU_IN_CM 1.496e13
|
|
47
|
+
|
|
48
|
+
/** @brief Factor to convert days to years. */
|
|
49
|
+
#define DAYS_PER_YEAR_CONVERSION_FACTOR 2.737850787e-3
|
|
50
|
+
|
|
51
|
+
/** @brief Factor to convert years to days. */
|
|
52
|
+
#define YEARS_PER_DAY_CONVERSION_FACTOR 365.242199
|
|
53
|
+
|
|
54
|
+
/** @brief Safety maximum value for timestep calculations. */
|
|
55
|
+
#define TIMESTEP_MAX_SAFETY_LIMIT -10000.0
|
|
56
|
+
|
|
57
|
+
/** @brief Numerical safety factor used for rounding or thresholding operations. */
|
|
58
|
+
#define ROUNDING_FACTOR 1.0
|
|
59
|
+
|
|
60
|
+
/** @brief Current version string of the RAPID simulation core. */
|
|
61
|
+
#define SIM_VERSION "2.2.2"
|
|
62
|
+
/**@}*/
|
|
63
|
+
|
|
64
|
+
/** @name File and Directory Name Constants
|
|
65
|
+
* Global string constants defining the naming convention for input/output files.
|
|
66
|
+
*/
|
|
67
|
+
/**@{*/
|
|
68
|
+
extern const char * const kInitialGasProfileFileName; /**< Filename for the initial gas profile. */
|
|
69
|
+
extern const char * const kInitialDustProfileFileName; /**< Filename for the initial dust profile. */
|
|
70
|
+
extern const char * const kGasDensityProfileFilePrefix; /**< Prefix for time-dependent gas density snapshots. */
|
|
71
|
+
extern const char * const kDustAccumulationFileName; /**< Filename for tracking accumulated dust mass. */
|
|
72
|
+
extern const char * const kDustParticleEvolutionFile; /**< Filename for Lagrangian particle trajectory data. */
|
|
73
|
+
extern const char * const kDriftTimescaleFileName; /**< Filename for storing drift timescale analysis. */
|
|
74
|
+
extern const char * const kDustDensityProfileFilePrefix; /**< Prefix for Eulerian dust density snapshots. */
|
|
75
|
+
extern const char * const kMicronDustDensityProfileFilePrefix; /**< Prefix for small (micron) dust snapshots. */
|
|
76
|
+
extern const char * const kDustMicronParticleEvolutionFile; /**< Evolution file for small dust populations. */
|
|
77
|
+
extern const char * const kDiskConfigFile; /**< Filename for the primary disk configuration input. */
|
|
78
|
+
extern const char * const kLogFilesDirectory; /**< Directory path where log files are stored. */
|
|
79
|
+
extern const char * const kConfigFilesDirectory; /**< Directory path where configuration files reside. */
|
|
80
|
+
extern const char * const kFileNamesSuffix; /**< Common suffix for output files for ASCII files (e.g., .dat or .txt). */
|
|
81
|
+
extern const char * const kCurrentInfoFile; /**< Filename for general runtime info. */
|
|
82
|
+
extern const char * const kDustParticleSizeFileName; /**< Filename for particle size distribution data. */
|
|
83
|
+
extern const char * const kMicronDustParticleSizeFileName; /**< Filename for micron-sized particle size distribution data. */
|
|
84
|
+
extern const char * const kCurrentRuntimeInfoFile; /**< Filename for high-frequency runtime diagnostics. */
|
|
85
|
+
extern const char * const kSnapshotOutputFileNamePrefix; /**< Filename for HDF5 snapshot output. */
|
|
86
|
+
extern const char * const kTimeSeriesForMassAccumulatinFileName; /**< Filename for HDF mass accumulation file. */
|
|
87
|
+
extern const char * const kFileNamesHDF5Suffix; /**< Common suffix for output files for HDF5 files (e.g., .dat or .txt). */
|
|
88
|
+
|
|
89
|
+
extern const int kTerminalWidth; /**< Width of the terminal for formatted output. */
|
|
90
|
+
/**@}*/
|
|
91
|
+
|
|
92
|
+
#endif // CONFIG_H
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file init_tool_module.h
|
|
3
|
+
* @brief Initialization tools and default option management.
|
|
4
|
+
*
|
|
5
|
+
* This module defines the setup structures and functions used to bridge
|
|
6
|
+
* configuration files with the internal disk simulation parameters.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#ifndef INIT_TOOL_MODULE_H
|
|
10
|
+
#define INIT_TOOL_MODULE_H
|
|
11
|
+
|
|
12
|
+
#include <stdbool.h>
|
|
13
|
+
#include "simulation_types.h"
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @struct InitializeDefaultOptions
|
|
17
|
+
* @brief Configuration structure for setting up the initial disk model.
|
|
18
|
+
* * This structure holds all the raw input parameters required to define
|
|
19
|
+
* the disk's physical and numerical setup before the simulation starts.
|
|
20
|
+
*/
|
|
21
|
+
typedef struct {
|
|
22
|
+
bool use_cutoff; /**< Initial condition profile type: false = Normal Power-Law, true = Exponential Cutoff. */
|
|
23
|
+
int n_grid_points; /**< Number of radial grid cells. */
|
|
24
|
+
int n_dust_particles; /**< Total number of Lagrangian dust particles. */
|
|
25
|
+
double r_inner; /**< Inner disk boundary in AU. */
|
|
26
|
+
double r_outer; /**< Outer disk boundary in AU. */
|
|
27
|
+
double sigma0_gas_au; /**< Gas surface density normalization at 1 AU. */
|
|
28
|
+
double sigma_exponent; /**< Power-law exponent for the surface density profile. */
|
|
29
|
+
double r_cutoff; /**< Characteristic exponential scaling/tapering radius in AU (used if ic_type == 2). */
|
|
30
|
+
double n_for_cutoff; /**< Shape/sharpness parameter for the exponential cutoff (typically 2.0 - gamma). */
|
|
31
|
+
double alpha_viscosity; /**< Background Shakura-Sunyaev alpha viscosity. */
|
|
32
|
+
double star_mass; /**< Central star mass in solar units. */
|
|
33
|
+
double aspect_ratio; /**< Disk aspect ratio, \f$h=H/r\f$, at 1 AU. */
|
|
34
|
+
double flaring_index; /**< Power-law index for disk flaring. */
|
|
35
|
+
double density_floor; /**< Minimum allowed gas surface density (Σ_min) to prevent numerical underflow or negative densities. */
|
|
36
|
+
double dust_density_floor; /**< Minimum allowed dust surface density (Σ_min) to prevent numerical underflow or negative densities. */
|
|
37
|
+
double deadzone_r_inner; /**< Inner radius of the Dead Zone in AU. */
|
|
38
|
+
double deadzone_r_outer; /**< Outer radius of the Dead Zone in AU. */
|
|
39
|
+
double deadzone_dr_inner; /**< Smoothing width for the inner Dead Zone edge in AU. */
|
|
40
|
+
double deadzone_dr_outer; /**< Smoothing width for the outer Dead Zone edge in AU. */
|
|
41
|
+
double deadzone_alpha_mod; /**< Reduced alpha viscosity within the Dead Zone. */
|
|
42
|
+
double dust_to_gas_ratio; /**< Global dust-to-gas mass ratio, \f$\epsilon\f$. */
|
|
43
|
+
double total_disk_mass; /**< Total mass of the two components of the disk. */
|
|
44
|
+
double one_size_particle_cm; /**< Size of the large dust population in \f$cm\f$. */
|
|
45
|
+
double two_pop_ratio; /**< Mass ratio between the two dust populations. */
|
|
46
|
+
double micro_size_cm; /**< Size of the small (micron) dust population in \f$cm\f$. */
|
|
47
|
+
double drift_factor; /**< Scaling factor for radial drift velocity. */
|
|
48
|
+
double fragmentation_factor; /**< Efficiency factor for dust fragmentation. */
|
|
49
|
+
char output_base_path[MAX_PATH_LEN]; /**< Base directory path for simulation output. */
|
|
50
|
+
double dust_density_g_cm3; /**< Intrinsic material density of dust grains (e.g., \f 1.6g/cm^3\f$). */
|
|
51
|
+
} InitializeDefaultOptions;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @brief populates the InitializeDefaultOptions structure with hardcoded defaults.
|
|
55
|
+
* * Useful for ensuring all parameters have safe initial values before
|
|
56
|
+
* reading from a configuration file.
|
|
57
|
+
* * @param[out] Pointer to the options structure to be initialized.
|
|
58
|
+
*/
|
|
59
|
+
void initializeDefaultOptions(InitializeDefaultOptions *opt);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @brief Executes the full initialization sequence.
|
|
63
|
+
* * Converts the raw options into a physical disk state, populating the
|
|
64
|
+
* internal arrays for density, pressure, and velocity.
|
|
65
|
+
* * @param[in] opts Pointer to the configured initialization options.
|
|
66
|
+
* @param[out] output_disk_params Pointer to the disk parameters structure to be populated.
|
|
67
|
+
* @return Returns 0 on success, non-zero on failure.
|
|
68
|
+
*/
|
|
69
|
+
int runInitialization(InitializeDefaultOptions *opts, DiskParameters *output_disk_params, SimulationOptions *sim_opts);
|
|
70
|
+
|
|
71
|
+
#endif // INIT_TOOL_MODULE_H
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file integrator.h
|
|
3
|
+
* @brief Numerical integration routines for particle trajectories and growth.
|
|
4
|
+
*
|
|
5
|
+
* This header defines the integrators used to evolve the radial position and
|
|
6
|
+
* physical size of Lagrangian dust particles over time.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#ifndef INTEGRATOR_H
|
|
10
|
+
#define INTEGRATOR_H
|
|
11
|
+
|
|
12
|
+
#include "disk_model.h"
|
|
13
|
+
#include "simulation_types.h"
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @brief Performs a fourth-order Runge-Kutta (RK4) integration step for a single dust particle.
|
|
17
|
+
*
|
|
18
|
+
* This function evolves both the radial position of the particle and its physical radius (size)
|
|
19
|
+
* over a given timestep. It accounts for the aerodynamic drag (radial drift) and,
|
|
20
|
+
* if enabled, the dust growth/fragmentation processes by interpolating local
|
|
21
|
+
* gas properties from the Eulerian grid.
|
|
22
|
+
*
|
|
23
|
+
* @param[in] actual_time Current simulation time.
|
|
24
|
+
* @param[in] particle_radius Current physical radius (grain size) of the dust particle.
|
|
25
|
+
* @param[in] dust_surfacedensity Pointer to the array containing the dust surface density distribution.
|
|
26
|
+
* @param[in] particle_distance_grid Pointer to the grid used for particle-related spatial calculations.
|
|
27
|
+
* @param[in] actual_timestep The time step size (dt) for the integration.
|
|
28
|
+
* @param[in] particle_distance Current radial distance of the particle from the central star.
|
|
29
|
+
* @param[out] particle_distance_new Pointer to store the updated radial distance after the RK4 step.
|
|
30
|
+
* @param[out] particle_radius_new Pointer to store the updated grain size after the growth step.
|
|
31
|
+
* @param[in] disk_params Pointer to the structure containing physical disk parameters and gas arrays.
|
|
32
|
+
* @param[in] simulation_options Pointer to the simulation configuration (e.g., enabling growth models).
|
|
33
|
+
*
|
|
34
|
+
* @note The function uses four intermediate slope calculations (k1, k2, k3, k4) to ensure
|
|
35
|
+
* fourth-order accuracy in the radial trajectory.
|
|
36
|
+
*/
|
|
37
|
+
void integrateParticleRungeKutta4(double actual_time, double particle_radius, const double *dust_surfacedensity, const double *particle_distance_grid,
|
|
38
|
+
double actual_timestep, double particle_distance, double *particle_distance_new, double *particle_radius_new,
|
|
39
|
+
const DiskParameters *disk_params, const SimulationOptions *simulation_options);
|
|
40
|
+
|
|
41
|
+
#endif // INTEGRATOR_H
|
|
42
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file particle_data.h
|
|
3
|
+
* @brief Data structures and utilities for managing dust particle arrays.
|
|
4
|
+
*
|
|
5
|
+
* Defines the ParticleData container used to store particle positions,
|
|
6
|
+
* masses, and surface densities, along with allocation and cleanup
|
|
7
|
+
* routines used by the simulation.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef PARTICLE_DATA_H
|
|
11
|
+
#define PARTICLE_DATA_H
|
|
12
|
+
|
|
13
|
+
#include <stddef.h>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @brief Container for all particle‑related arrays used in the simulation.
|
|
17
|
+
*
|
|
18
|
+
* This structure stores dynamically allocated arrays that describe the
|
|
19
|
+
* spatial distribution, mass distribution, and surface densities of both
|
|
20
|
+
* regular dust particles and micron‑sized dust particles.
|
|
21
|
+
*
|
|
22
|
+
* The arrays are allocated based on the number of particles and whether
|
|
23
|
+
* the two‑population dust model is enabled.
|
|
24
|
+
*/
|
|
25
|
+
typedef struct {
|
|
26
|
+
double (*particle_distance_array)[2]; /**< Radial positions of dust particles (2 columns: r and dr). */
|
|
27
|
+
double (*micron_particle_distance_array)[2]; /**< Radial positions of micron‑sized dust particles. */
|
|
28
|
+
double *dust_particle_mass_grid; /**< Mass grid for dust particles. */
|
|
29
|
+
double *massmicradial_grid; /**< Mass grid for micron‑sized dust particles. */
|
|
30
|
+
double (*dust_particle_mass_array)[5]; /**< Dust particle mass evolution array (5 columns per particle). */
|
|
31
|
+
double (*micron_dust_particle_mass_array)[5]; /**< Micron dust mass evolution array. */
|
|
32
|
+
double *dust_surfacedensity; /**< Dust surface density profile. */
|
|
33
|
+
double *micron_dust_surfacedensity; /**< Micron dust surface density profile. */
|
|
34
|
+
double *particle_distance_grid; /**< Radial grid for dust particles. */
|
|
35
|
+
double *micron_particle_distance_grid; /**< Radial grid for micron dust particles. */
|
|
36
|
+
size_t allocated_particle_number; /**< Number of particles allocated in memory. */
|
|
37
|
+
} ParticleData;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @brief Allocates memory for particle‑related arrays.
|
|
41
|
+
*
|
|
42
|
+
* This function initializes all arrays inside a ParticleData structure
|
|
43
|
+
* based on the number of particles and whether the two‑population dust
|
|
44
|
+
* model is enabled.
|
|
45
|
+
*
|
|
46
|
+
* @param particle_data Pointer to the ParticleData structure to initialize.
|
|
47
|
+
* @param particle_count Number of dust particles to allocate.
|
|
48
|
+
* @param is_twopop_enabled Non‑zero if the micron‑dust population should also be allocated.
|
|
49
|
+
* @return 0 on success, non‑zero on allocation failure.
|
|
50
|
+
*/
|
|
51
|
+
int allocateParticleData(ParticleData *particle_data, size_t particle_count, int is_twopop_enabled);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @brief Frees all memory allocated inside a ParticleData structure.
|
|
55
|
+
*
|
|
56
|
+
* This function releases all dynamically allocated arrays and resets
|
|
57
|
+
* the structure fields to NULL or zero.
|
|
58
|
+
*
|
|
59
|
+
* @param particle_data Pointer to the ParticleData structure to free.
|
|
60
|
+
*/
|
|
61
|
+
void freeParticleData(ParticleData *particle_data);
|
|
62
|
+
|
|
63
|
+
#endif // PARTICLE_DATA_H
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifndef PHOTOEVAPORATION_WRAPPER_H
|
|
2
|
+
#define PHOTOEVAPORATION_WRAPPER_H
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
// void* -ként adjuk át, így a C és a C++ is csont nélkül elfogadja anélkül, hogy ismernék a típust
|
|
9
|
+
void computePhotoevaporationSink(void *disk_opaque);
|
|
10
|
+
|
|
11
|
+
#ifdef __cplusplus
|
|
12
|
+
}
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
#endif // PHOTOEVAPORATION_WRAPPER_H
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file simulation_core.h
|
|
3
|
+
* @brief Core routines for advancing the disk–dust system in time.
|
|
4
|
+
*
|
|
5
|
+
* Contains the main physical update functions used during the simulation:
|
|
6
|
+
* dust drift calculation, timestep determination, and the full time
|
|
7
|
+
* integration loop that evolves gas and dust according to the selected
|
|
8
|
+
* snapshot mode.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef SIMULATION_CORE_H
|
|
12
|
+
#define SIMULATION_CORE_H
|
|
13
|
+
|
|
14
|
+
#include "particle_data.h"
|
|
15
|
+
#include "disk_model.h"
|
|
16
|
+
#include "simulation_types.h"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @brief Computes the radial drift velocity of dust particles in 1D.
|
|
21
|
+
*
|
|
22
|
+
* This function calculates the drift velocity of a dust particle based on
|
|
23
|
+
* its size, the local pressure gradient, gas surface density, gas velocity,
|
|
24
|
+
* and radial position. The result is written into @p drift_velocity.
|
|
25
|
+
*
|
|
26
|
+
* @param particle_radius Radius of the dust particle.
|
|
27
|
+
* @param pressure_gradient Local radial pressure gradient.
|
|
28
|
+
* @param gas_surface_density Gas surface density at the particle location.
|
|
29
|
+
* @param gas_velocity Radial gas velocity.
|
|
30
|
+
* @param radial_distance Radial distance of the particle from the star.
|
|
31
|
+
* @param drift_velocity Output pointer for the computed drift velocity.
|
|
32
|
+
* @param disk_params Pointer to the disk parameter structure.
|
|
33
|
+
*/
|
|
34
|
+
void calculate1DDustDrift(double particle_radius, double pressure_gradient, double gas_surface_density, double gas_velocity, double radial_distance, double *drift_velocity, const DiskParameters *disk_params);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @brief Gets the maximum drift velocity of dust particles.
|
|
38
|
+
*
|
|
39
|
+
* This function iterates through all dust particles and computes their drift velocities,
|
|
40
|
+
* returning the maximum absolute value found.
|
|
41
|
+
*
|
|
42
|
+
* @param particle_data Pointer to the particle data structure.
|
|
43
|
+
* @param particle_number Number of dust particles.
|
|
44
|
+
* @param disk_params Pointer to the disk parameter structure.
|
|
45
|
+
* @param mode SnapshotMode indicating the type of snapshot being processed.
|
|
46
|
+
* @return The maximum drift velocity.
|
|
47
|
+
*/
|
|
48
|
+
double getMaximumDriftVelocity(const ParticleData *particle_data, int particle_number, const DiskParameters *disk_params, SnapshotMode mode);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @brief Computes the simulation time step based on disk parameters.
|
|
52
|
+
*
|
|
53
|
+
* The time step is typically determined by stability constraints such as
|
|
54
|
+
* Courant conditions or drift/growth timescales.
|
|
55
|
+
*
|
|
56
|
+
* @param disk_params Pointer to the DiskParameters structure.
|
|
57
|
+
* @param max_drift_v The maximum drift velocity of the dust particles.
|
|
58
|
+
* @return The computed time step.
|
|
59
|
+
*/
|
|
60
|
+
double calculateTimeStep(const DiskParameters *disk_params, double max_drift_v);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @brief Performs the full time integration loop for the simulation.
|
|
64
|
+
*
|
|
65
|
+
* This function advances the system in time according to the selected
|
|
66
|
+
* snapshot mode, updating disk quantities, dust evolution, and writing
|
|
67
|
+
* output files when necessary.
|
|
68
|
+
*
|
|
69
|
+
* @param mode Snapshot writing mode (e.g., none, periodic, final only).
|
|
70
|
+
* @param disk_params Pointer to the DiskParameters structure to update.
|
|
71
|
+
* @param sim_opts Pointer to the SimulationOptions structure.
|
|
72
|
+
* @param output_files Pointer to the OutputFiles structure for writing results.
|
|
73
|
+
*/
|
|
74
|
+
void timeIntegrationForTheSystem(SnapshotMode mode, DiskParameters *disk_params, SimulationOptions *sim_opts, OutputFiles *output_files);
|
|
75
|
+
|
|
76
|
+
#endif // SIMULATION_CORE_H
|