Skip to content

Commit

Permalink
Merge branch 'dev_cond'
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kitzmann committed Sep 4, 2023
2 parents 0a99d53 + 1a079c4 commit 7602153
Show file tree
Hide file tree
Showing 444 changed files with 171,574 additions and 2,088 deletions.
44 changes: 25 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,33 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})

#define the source files
set(SRC_FASTCHEM
fastchem_src/options.cpp
fastchem_src/calc_densities.cpp
fastchem_src/calc_electron_densities.cpp
fastchem_src/calc_mean_mol_weight.cpp
fastchem_src/calc_species_densities.cpp
fastchem_src/check.cpp
fastchem_src/fastchem.cpp
fastchem_src/get.cpp
fastchem_src/init_add_species.cpp
fastchem_src/init_read_files.cpp
fastchem_src/init_solver.cpp
fastchem_src/init.cpp
fastchem_src/mass_action_constant.cpp
fastchem_src/fastchem_get_set.cpp
fastchem_src/options_read_files.cpp
fastchem_src/set.cpp
fastchem_src/solve_fastchem.cpp
fastchem_src/solver_bisection.cpp
fastchem_src/solver_coeff.cpp
fastchem_src/solver_linsol_quadsol.cpp
fastchem_src/solver_nelder_mead_electron.cpp
fastchem_src/solver_newtsol.cpp
fastchem_src/solver.cpp
fastchem_src/species_struct.cpp)
fastchem_src/elements/element_struct.cpp
fastchem_src/elements/elements.cpp
fastchem_src/elements/read_files.cpp
fastchem_src/gas_phase/molecule_struct.cpp
fastchem_src/gas_phase/gas_phase.cpp
fastchem_src/gas_phase/init_read_files.cpp
fastchem_src/gas_phase/calc_species_densities.cpp
fastchem_src/gas_phase/calculate.cpp
fastchem_src/gas_phase/solver_bisection.cpp
fastchem_src/gas_phase/solver_coeff.cpp
fastchem_src/gas_phase/solver_linsol_quadsol.cpp
fastchem_src/gas_phase/solver_nelder_mead_electron.cpp
fastchem_src/gas_phase/solver_newtsol.cpp
fastchem_src/gas_phase/calc_electron_densities.cpp
fastchem_src/gas_phase/calc_mean_mol_weight.cpp
fastchem_src/gas_phase/init_solver.cpp
fastchem_src/gas_phase/solver.cpp
fastchem_src/condensed_phase/condensed_phase.cpp
fastchem_src/condensed_phase/calculate.cpp
fastchem_src/condensed_phase/solver.cpp
fastchem_src/condensed_phase/condensate_struct.cpp
fastchem_src/condensed_phase/read_condensate_data.cpp)


set(SRC_MAIN
Expand Down Expand Up @@ -127,6 +132,7 @@ else()
target_compile_options(fastchem_lib PRIVATE "-O3")
endif()

file(MAKE_DIRECTORY "output")

#in case we build the executable
if (NOT ONLY_LIBRARY)
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# FastChem 2.1 #
# FastChem Cond (FastChem 3.0) #
#### Authors: Daniel Kitzmann, Joachim Stock ####

# Overview #

FastChem is an equilibrium chemistry code that calculates the chemical composition of the gas phase for given temperatures and pressures. It is based on a semi-analytic approach, described in detail in Stock et al. (2018). The code is optimised for extremely fast and accurate calculations. The new version, FastChem 2, incorporates a revised approach that incorporates the pressure equation directly within the chemistry equations derived from the law of mass action. In contrast to FastChem 1.0, a separate iteration for the pressure is, thus, not required anymore.
FastChem is an equilibrium chemistry code that calculates the chemical composition of the gas and condensed phase for given temperatures and pressures. The calculation of the gas phase is based on a semi-analytic approach, described in detail in Stock et al. (2018) and Stock et al. (2022). The new version 3.0 version of FastChem, called FastChem Cond, adds condensation to the code. It can now compute the chemical composition using equilibrium condensation or the rainout approximation that is commonly used in the field of exoplanets or brown dwarfs. FastChem Cond is described in detail in Kitzmann, Stock & Patzer (2023).

The code is written in object-oriented C++, including template programming that allows the model to run with either double or long double precision. The exact computational precision of long double depends on your compiler and operating system. Long double precision usually allows the model to properly converge for very low temperatures. FastChem has been tested for temperatures as low as 100 K. For many cases, we were also able to obtain converged results for temperatures well below 100 K. As shown by Stock et al. (2018), the model has been successfully tested for temperatures from 100 K to 2500 K and pressures from 1e-13 bar to 1000 bar.
The code is written in object-oriented C++, including template programming that allows the model to run with either double or long double precision. The exact computational precision of long double depends on your compiler and operating system. Long double precision usually allows the model to properly converge for very low temperatures. FastChem has been tested for temperatures as low as 100 K. For many cases, we were also able to obtain converged results for temperatures well below 100 K. Overall, the model has been successfully tested for temperatures from 100 K to 6000 K and pressures from 1e-13 bar to 1000 bar for solar element abundances.

Besides the actual FastChem model, we provide a C++ stand-alone version in the *model_src* folder that allows to calculate the equilibrium chemistry for a given temperature-pressure structure. This stand-alone version can be adapted further to perform also more sophisticated calculations. In addition to the C++ stand-alone version, we also provide a new Python interface for FastChem.
Besides the actual FastChem model, we provide a C++ stand-alone version in the *model_src* folder that allows to calculate the equilibrium chemistry for a given temperature-pressure structure. This stand-alone version can be adapted further to perform also more sophisticated calculations. In addition to the C++ stand-alone version, we also provide the Python interface PyFastChem.


# Python interface #
# PyFastChem #

The new version of FastChem includes a Python interface, PyFastChem, that allows to run the C++ code as a normal Python module. We provide several examples that show how to call FastChem from within a Python script, including the possibility to, for example, iterate over different metallicity values or C/O ratios. The Python examples can be found in the *python* directory.
FastChem includes the Python interface, PyFastChem, that allows to run the C++ code as a normal Python module. PyFastChem is also available as a PyPy package and can easily be installed via pip. We provide several examples that show how to call FastChem from within a Python script, including the possibility to, for example, iterate over different metallicity values or C/O ratios or how to compute chemical compositions with condensation. The Python examples can be found in the *python* directory.


# User guide #
Expand All @@ -27,3 +27,4 @@ This project is Copyright (c) Daniel Kitzmann and Joachim Stock.
FastChem is released under the GNU Public Licence (GPL) 3.0. That means, it can be freely copied, edited, and re-distributed. If the code is re-distributed it has to be released under at least a GPL 3.0 licence as well. The full licence of FastChem can be found in the repository *licence.md* file or under https://www.gnu.org/licenses/gpl-3.0.html.

The user guide is released under the Creative Commons Licence (CC BY SA). Licensees may copy and distribute the work and make derivative works based on it only if they give the authors (Daniel Kitzmann & Joachim Stock) the credits by providing a reference to the original guide and this GitHub repository. Licensees may also distribute derivative works only under a license identical to ("not more restrictive than") the license that governs the original work.

45 changes: 45 additions & 0 deletions _ext/Eigen/Cholesky
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_CHOLESKY_MODULE_H
#define EIGEN_CHOLESKY_MODULE_H

#include "Core"
#include "Jacobi"

#include "src/Core/util/DisableStupidWarnings.h"

/** \defgroup Cholesky_Module Cholesky module
*
*
*
* This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
* Those decompositions are also accessible via the following methods:
* - MatrixBase::llt()
* - MatrixBase::ldlt()
* - SelfAdjointView::llt()
* - SelfAdjointView::ldlt()
*
* \code
* #include <Eigen/Cholesky>
* \endcode
*/

#include "src/Cholesky/LLT.h"
#include "src/Cholesky/LDLT.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Cholesky/LLT_LAPACKE.h"
#endif

#include "src/Core/util/ReenableStupidWarnings.h"

#endif // EIGEN_CHOLESKY_MODULE_H
48 changes: 48 additions & 0 deletions _ext/Eigen/CholmodSupport
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H
#define EIGEN_CHOLMODSUPPORT_MODULE_H

#include "SparseCore"

#include "src/Core/util/DisableStupidWarnings.h"

extern "C" {
#include <cholmod.h>
}

/** \ingroup Support_modules
* \defgroup CholmodSupport_Module CholmodSupport module
*
* This module provides an interface to the Cholmod library which is part of the <a href="http://www.suitesparse.com">suitesparse</a> package.
* It provides the two following main factorization classes:
* - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
* - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).
*
* For the sake of completeness, this module also propose the two following classes:
* - class CholmodSimplicialLLT
* - class CholmodSimplicialLDLT
* Note that these classes does not bring any particular advantage compared to the built-in
* SimplicialLLT and SimplicialLDLT factorization classes.
*
* \code
* #include <Eigen/CholmodSupport>
* \endcode
*
* In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies.
* The dependencies depend on how cholmod has been compiled.
* For a cmake based project, you can use our FindCholmod.cmake module to help you in this task.
*
*/

#include "src/CholmodSupport/CholmodSupport.h"

#include "src/Core/util/ReenableStupidWarnings.h"

#endif // EIGEN_CHOLMODSUPPORT_MODULE_H

0 comments on commit 7602153

Please sign in to comment.