Commit 36222c51 authored by Andrea Giannetti's avatar Andrea Giannetti
Browse files

Merge branch 'stellar_heating'

parents 98ad51fa 5ee89011
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ their meaning.

#### The staging configuration file (`etl/stg/config/config.yml`)

The staging config file has two main categories:
The staging config file has three main categories:

* **grid:**
    * grid_type: regular or spherical
@@ -105,6 +105,19 @@ The staging config file has two main categories:
    * velocity_gradient: the value of the velocity gradient for solid-body roation.
    * velocity_gradient_unit: the unit of the velocity gradient, e.g. "km/s/pc"

* **stars:**
  Adding the star configuration section makes the program compute the dust temperature distribution given the properties
  of the stars included. _Caveat:_ be careful, test runs show unexpectedtly low dust temperatures using a blackbody.
    * nstars: the number of stars to include
    * rstars: the radius of the star in cm; it is normally ignored, unless the parameter `istar_sphere` is set to 1
    * mstars: the mass in grams; not used in the current version of RADMC
    * star_positions: x, y, z coordinates of the star in cm, expressed as a list of lists
    * star_fluxes: stellar fluxes at each of the computed lambdas in erg cm$^-2$ s$-1$ Hz$-1$; if negative, interpreted
      as the peak temperature of a blackbody
    * nlambdas: number of wavelengths to compute
    * spacing: log or linear
    * lambdas_micron_limits: the limits in wavelength to consider in the run, expressed in micron

* **lines:**
    * species_to_include: the list of molecular species to include in the RADMC postprocessing, e.g. ['e-ch3oh']
    * molecular_abundances: a dict-like parameter, containing the species name and the corresponding fractional
+1 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ def extract_grid_metadata(config: dict) -> dict:
    grid_metadata['distance_matrix'] = get_distance_matrix(grid_metadata, grid_metadata['centered_indices'])

    grid_metadata['grid_edges'] = get_grid_edges(grid_metadata)
    grid_metadata['continuum_lambdas'] = 100
    return grid_metadata


+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ radmc_input_headers = {
    'wavelength_micron.inp': ['continuum_lambdas'],
    'numberdens_mol.inp': ['iformat', 'ncells'],
    'escprob_lengthscale.inp': ['iformat', 'ncells'],
    'stars.inp': ['iformat', 'nstars', 'continuum_lambdas', 'stars_properties', 'lambdas']
}


+12 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ import sys
from itertools import product
from typing import Union
import sqlalchemy
import shutil
from astropy import units as u
from datetime import datetime
from radmc3dPy import image
@@ -190,7 +191,8 @@ def populate_line_table(config_lines: dict,
def main(grid_tarfile: str,
         run_id: str,
         override_config: Union[dict, None] = None,
         radmc_input_path: Union[str, None] = None) -> str:
         radmc_input_path: Union[str, None] = None,
         compute_dust_temperature: bool = True) -> str:
    # This is necessary, because the lines_mode is needed both in the lines.inp and radmc3d.inp files
    # The reason for splitting the main input file from the rest is that some parameters can be changed
    # independently of the grid for the modeling. The mdl hash should depend on all the mdl parameters, not a subset
@@ -215,8 +217,17 @@ def main(grid_tarfile: str,
    engine = get_pg_engine(logger=logger)

    # Execute radmc
    logger.debug(f'Executing command: {radmc_command}')
    execution_dir = os.getcwd()
    os.chdir(_radmc_input_path)
    if 'stars' in config_stg:
        if compute_dust_temperature is True:
            logger.info('Computing dust temperature distribution using the stars in the configuration file')
            os.system('radmc3d mctherm setthreads 16')
        else:
            logger.info('Using cached dust temperature distribution')
            shutil.copy(os.path.join(execution_dir, 'model', 'data', 'dust_temperature.dat'),
                        os.path.join('.', 'dust_temperature.dat'))
    os.system(radmc_command)
    os.chdir(execution_dir)
    logger.debug(f'Checking presence of file: {os.path.join(_radmc_input_path, "image.out")}')
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,16 @@ grid:
    velocity_gradient: 2
    velocity_gradient_unit: "km/(s pc)"

#stars:
#    nstars: 1
#    rstars: [6.96e10, ]
#    mstars: [1.99e36, ]
#    star_positions: [[0, 0, 0]]
#    star_fluxes: [[-32000,], ]
#    nlambdas: 300
#    spacing: 'log'
#    lambdas_micron_limits: [0.001, 1300]

lines:
    species_to_include: ['e-ch3oh']
    molecular_abundances: {
Loading