Commit a112493a authored by Andrea Giannetti's avatar Andrea Giannetti
Browse files

Added hot core specs to the database.

parent 7e07713e
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -421,3 +421,24 @@ def parse_input_main() -> Tuple[str, str, float, float, list, int]:
    return _tdust_model_type, _model_type, dust_temperatures, densities, line_pairs, n_processes


def read_abundance_variation_schema(line_config: dict) -> dict:
    """
    Read and fill the abundance variation schema, defined as a step function
    :param line_config: the dictionary of the line configurations, for the abundances
    :return: the dictionary of the abundance variations per species, with the abundance jump factot and the temperature
        threshold at which evaporation happens
    """
    species_list = list(line_config['molecular_abundances'].keys())
    results_dict = {}
    for species in species_list:
        results_dict[species] = {
            'threshold': 20,
            'abundance_jump': 1
        }
        if 'hot_core_specs' in line_config.keys():
            if species in line_config['hot_core_specs']:
                results_dict[species] = line_config['hot_core_specs'][species]
    return results_dict


+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ from assets.commons import (load_config_file,
                            setup_logger,
                            compute_unique_hash_filename,
                            get_value_if_specified,
                            read_abundance_variation_schema,
                            cleanup_directory)
from assets.constants import (radmc_options_mapping,
                              radmc_lines_mode_mapping)
@@ -125,11 +126,14 @@ def populate_species_and_partner_table(config_lines: dict,
    :param grid_zipfile: the name of the grid tarfile
    :param run_id: the run unique identifier
    """
    hot_core_specs = read_abundance_variation_schema(line_config=config_lines)
    for (species, collision_partner) in product(config_lines['species_to_include'], config_lines['collision_partners']):
        species_partner_dict = {
            'zipped_grid_name': f'{grid_zipfile}',
            'species_to_include': species,
            'molecular_abundance': config_lines['molecular_abundances'][species],
            'threshold': hot_core_specs[species]['threshold'],
            'abundance_jump': hot_core_specs[species]['abundance_jump'],
            'collision_partner': collision_partner,
            'molecular_abundance_collision_partner': config_lines['molecular_abundances'][collision_partner],
            'created_on': executed_on,
+2 −0
Original line number Diff line number Diff line
@@ -118,6 +118,8 @@ class SpeciesAndPartners(Base):
    zipped_grid_name = Column(String(150), primary_key=True)
    species_to_include = Column(String(100), primary_key=True)
    molecular_abundance = Column(Float)
    threshold = Column(Float)
    abundance_jump = Column(Float)
    collision_partner = Column(String(100), primary_key=True)
    molecular_abundance_collision_partner = Column(Float)
    created_on = Column(DateTime)
+2 −21
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ from assets.commons import (compute_power_law_radial_profile,
                            validate_parameter,
                            setup_logger,
                            cleanup_directory,
                            get_value_if_specified)
                            get_value_if_specified,
                            read_abundance_variation_schema)
from assets.constants import (mean_molecular_mass,
                              radmc_input_headers,
                              radmc_lines_mode_mapping)
@@ -315,26 +316,6 @@ def write_molecular_number_density_profiles(profiles: dict,
                          grid_metadata=grid_metadata)


def read_abundance_variation_schema(line_config: dict) -> dict:
    """
    Read and fill the abundance variation schema, defined as a step function
    :param line_config: the dictionary of the line configurations, for the abundances
    :return: the dictionary of the abundance variations per species, with the abundance jump factot and the temperature
        threshold at which evaporation happens
    """
    species_list = list(line_config['molecular_abundances'].keys())
    results_dict = {}
    for species in species_list:
        if species in line_config['hot_core_specs']:
            results_dict[species] = line_config['hot_core_specs'][species]
        else:
            results_dict[species] = {
                'threshold': 20,
                'abundance_jump': 1
            }
    return results_dict


def compute_molecular_number_density_hot_core(gas_number_density_profile: np.array,
                                              abundance: float,
                                              temperature_profile: np.array,