Skip to content
Snippets Groups Projects
Select Git revision
  • e3ae510d12d0af94f0738845f31dbbce9c593f91
  • master default protected
  • reyz/gear_preSN_feedback
  • zoom-mesh-considerations
  • stars_sidm_iact
  • karapiperis/plasma_beta_rms_in_tensile_instability_correction_taper_function
  • darwin/gear_preSN_fbk_merge
  • darwin/gear_mechanical_feedback
  • karapiperis/consistent_treatment_of_vsig_in_MHD
  • FS_VP_m2_allGrad
  • examples-GravityTests-HydroStatic-halo-issue
  • fof_props
  • FS_VP_m2
  • FS_m2
  • darwin/gear_chemistry_fluxes
  • zoom_mpi_redux
  • mladen/rt_limit_star_timesteps
  • zoom-missing-rebuild-time
  • moving_mesh
  • zoom_truncate_bkg
  • sidm_merge protected
  • v2025.10 protected
  • v2025.04 protected
  • v2025.01 protected
  • v1.0.0 protected
  • v0.9.0 protected
  • v0.8.5 protected
  • v0.8.4 protected
  • v0.8.3 protected
  • v0.8.2 protected
  • v0.8.1 protected
  • v0.8.0 protected
  • v0.7.0 protected
  • v0.6.0 protected
  • v0.5.0 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0-pre protected
  • v0.1 protected
  • v0.0 protected
41 results

equation_of_state.c

Blame
  • user avatar
    Matthieu Schaller authored
    When compiling with the iosthermal equation of state, read the constant thermal energy from the YAML file.
    4f210db4
    History
    equation_of_state.c 2.25 KiB
    /*******************************************************************************
     * This file is part of SWIFT.
     * Copyright (c) 2017 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Lesser General Public License as published
     * by the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU Lesser General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     ******************************************************************************/
    
    /* This object's header. */
    #include "equation_of_state.h"
    
    /* local headers */
    #include "common_io.h"
    
    /* Equation of state for the physics model
     * (temporary ugly solution as a global variable) */
    struct eos_parameters eos;
    
    void eos_init(struct eos_parameters *e, const struct swift_params *params) {
    
    #if defined(EOS_IDEAL_GAS)
    /* nothing to do here */
    #elif defined(EOS_ISOTHERMAL_GAS)
      e->isothermal_internal_energy =
          parser_get_param_float(params, "EoS:isothermal_internal_energy");
    #endif
    }
    
    void eos_print(const struct eos_parameters *e) {
    
    #if defined(EOS_IDEAL_GAS)
      message("Equation of state: Ideal gas.");
    #elif defined(EOS_ISOTHERMAL_GAS)
      message(
          "Equation of state: Isothermal with internal energy "
          "per unit mass set to %f.",
          e->isothermal_internal_energy);
    #endif
    
      message("Adiabatic index gamma: %f.", hydro_gamma);
    }
    
    #if defined(HAVE_HDF5)
    void eos_print_snapshot(hid_t h_grpsph, const struct eos_parameters *e) {
    
      io_write_attribute_f(h_grpsph, "Adiabatic index", hydro_gamma);
    
    #if defined(EOS_IDEAL_GAS)
      io_write_attribute_s(h_grpsph, "Equation of state", "Ideal gas");
    #elif defined(EOS_ISOTHERMAL_GAS)
      io_write_attribute_s(h_grpsph, "Equation of state", "Isothermal gas");
      io_write_attribute_f(h_grpsph, "Thermal energy per unit mass",
                           e->isothermal_internal_energy);
    #endif
    }
    #endif