Skip to content

Commit

Permalink
renamed to equilibrate
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Apr 26, 2024
1 parent 09f38bc commit a6ffb1e
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
- name: test
working-directory: ${{github.workspace}}/build
run: |
valgrind --error-exitcode=1 --leak-check=full ./test/test_chemequi
valgrind --error-exitcode=1 --leak-check=full ./test/test_equilibrate
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
cmake_minimum_required(VERSION "3.14")

project(EQUICHEM LANGUAGES Fortran C VERSION "0.1.0")
project(EQUILIBRATE LANGUAGES Fortran C VERSION "0.1.0")

set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/modules")
include(cmake/CPM.cmake)

option(BUILD_EXECUTABLES "if ON, then will build the
Fortran executables" ON)


add_subdirectory(src)
add_subdirectory(test)
18 changes: 9 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ CPMAddPackage(
EXCLUDE_FROM_ALL ON
)

add_library(equichem
chemequi_yaml.f90
chemequi_const.f90
chemequi_cea.f90
chemequi.f90
add_library(equilibrate
equilibrate_yaml.f90
equilibrate_const.f90
equilibrate_cea.f90
equilibrate.f90
)

target_link_libraries(equichem
target_link_libraries(equilibrate
fortran-yaml-c
)

# This is important for making Python wrapper
set_property(TARGET equichem PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET equilibrate PROPERTY POSITION_INDEPENDENT_CODE ON)

# Add special compiler flags to Clima
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
target_compile_options(equichem PRIVATE -Wunused -Wimplicit-interface -fimplicit-none)
target_compile_options(equilibrate PRIVATE -Wunused -Wimplicit-interface -fimplicit-none)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(equichem PRIVATE -fcheck=all,no-array-temps)
target_compile_options(equilibrate PRIVATE -fcheck=all,no-array-temps)
endif()
endif()
6 changes: 3 additions & 3 deletions src/chemequi.f90 → src/equilibrate.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module chemequi
use chemequi_const, only: dp, atom_str_len, reac_str_len
use chemequi_cea, only: CEAData
module equilibrate
use equilibrate_const, only: dp, atom_str_len, reac_str_len
use equilibrate_cea, only: CEAData
implicit none
private

Expand Down
36 changes: 18 additions & 18 deletions src/chemequi_cea.f90 → src/equilibrate_cea.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

module chemequi_cea
use chemequi_const, only: dp, atom_str_len, reac_str_len
module equilibrate_cea
use equilibrate_const, only: dp, atom_str_len, reac_str_len
implicit none
private

Expand Down Expand Up @@ -56,8 +56,8 @@ module chemequi_cea

!> INITIALIZE ALL DATA
subroutine SET_DATA(self, fpath, atoms_names, reactants_names)
use chemequi_const, only: N_coeffs, N_temps
use chemequi_yaml, only: check_for_duplicates, ReactantList
use equilibrate_const, only: N_coeffs, N_temps
use equilibrate_yaml, only: check_for_duplicates, ReactantList
class(CEAData), intent(inout) :: self
character(*), intent(in) :: fpath
character(atom_str_len), optional, intent(in) :: atoms_names(:)
Expand Down Expand Up @@ -282,7 +282,7 @@ subroutine SET_DATA(self, fpath, atoms_names, reactants_names)
end subroutine SET_DATA

subroutine read_thermo_yaml(self, rl, fpath)
use chemequi_yaml, only: ReactantList, ShomatePolynomial, Nasa9Polynomial
use equilibrate_yaml, only: ReactantList, ShomatePolynomial, Nasa9Polynomial
class(CEAData), intent(inout) :: self
type(ReactantList), intent(in) :: rl
character(*), intent(in) :: fpath
Expand Down Expand Up @@ -437,7 +437,7 @@ function file_extension(filename) result(ext)
!> Sets id_atoms, where the i-th cell corresponds to names_atoms(i) and contains the index of the same atom in names_atoms_save
!> names_atoms_save(id_atoms(i)) = names_atoms(i)
subroutine da_ATOMS_ID(self)
use chemequi_const, only: N_atoms_save, names_atoms_save
use equilibrate_const, only: N_atoms_save, names_atoms_save
class(CEAData), intent(inout) :: self
integer :: i_atom, i_atom_save
logical :: change
Expand Down Expand Up @@ -470,7 +470,7 @@ subroutine da_ATOMS_ID(self)
end subroutine da_ATOMS_ID

subroutine da_REAC_ATOMS_ID(self)
use chemequi_const, only: N_atoms_save, names_atoms_save
use equilibrate_const, only: N_atoms_save, names_atoms_save
class(CEAData), intent(inout) :: self
integer :: i_reac, i_atom, i_atom_save
logical :: change
Expand Down Expand Up @@ -507,7 +507,7 @@ end subroutine da_REAC_ATOMS_ID

!> Read in provided file all thermodynamic data
subroutine da_READ_THERMO(self, fpath)
use chemequi_yaml, only: Nasa9Polynomial
use equilibrate_yaml, only: Nasa9Polynomial
class(CEAData), intent(inout) :: self
character(*), intent(in) :: fpath
character(len=80) :: file_line, file_line_up
Expand Down Expand Up @@ -743,8 +743,8 @@ end subroutine EASYCHEM

!> Computes the values of C_P_0, H_0 and S_0
subroutine ec_COMP_THERMO_QUANTS(self,temp,N_reac,C_P_0, H_0, S_0)
use chemequi_const, only: R
use chemequi_yaml, only: ShomatePolynomial, Nasa9Polynomial
use equilibrate_const, only: R
use equilibrate_yaml, only: ShomatePolynomial, Nasa9Polynomial
!! I/O
class(CEAData), intent(inout) :: self
real(dp), intent(in) :: temp
Expand Down Expand Up @@ -849,7 +849,7 @@ pure function entropy_shomate(coeffs, T) result(entropy)
recursive subroutine ec_COMP_EQU_CHEM(self, N_atoms_use, N_reac, molfracs_atoms, &
molfracs_reactants, massfracs_reactants, &
temp, press, C_P_0, H_0, S_0, nabla_ad, gamma2, MMW, rho, c_pe)
use chemequi_const, only: amu, kB, masses_atoms_save
use equilibrate_const, only: amu, kB, masses_atoms_save

!! I/O:
class(CEAData), intent(inout) :: self
Expand Down Expand Up @@ -1175,7 +1175,7 @@ end subroutine ec_INIT_ALL_VALS
!> Selects which solid to include next
subroutine ec_INCLUDE_WHICH_SOLID(self,N_atoms_use,N_reac,pi_atom,H_0,S_0,temp, &
n_spec,solid_inclu,neg_cond,dgdnj,remove_cond,inc_next)
use chemequi_const, only: mol, R
use equilibrate_const, only: mol, R
!! I/O
class(CEAData), intent(inout) :: self
integer, intent(in) :: N_atoms_use, N_reac
Expand Down Expand Up @@ -1294,7 +1294,7 @@ end subroutine ec_INIT_COND_VALS
!> Build the small matrix
subroutine ec_PREP_MATRIX_SHORT(self,N_atoms_use, N_reac, molfracs_atoms, N_species, press, temp, &
H_0, S_0, n, n_spec, matrix, vector, solid_indices, N_solids, mu_gas, a_gas)
use chemequi_const, only: mol, R
use equilibrate_const, only: mol, R
!! I/O:
class(CEAData), intent(inout) :: self
INTEGER, intent(in) :: N_atoms_use, N_reac, N_species, N_solids
Expand Down Expand Up @@ -1506,7 +1506,7 @@ end subroutine ec_PREP_MATRIX_SHORT
!> Return the result of one step of computation with small matrix(problem: AX=B)
subroutine ec_UPDATE_ABUNDS_SHORT(self,N_atoms_use,N_reac,N_species,solution_vector,n_spec,pi_atom,&
n,converged,solid_indices,N_solids,mu_gas,a_gas,temp,molfracs_atoms,n_spec_old)
use chemequi_const, only: mol, R
use equilibrate_const, only: mol, R
!! I/O:
class(CEAData), intent(inout) :: self
INTEGER, intent(in) :: N_atoms_use, N_reac, N_species, N_solids
Expand Down Expand Up @@ -1761,7 +1761,7 @@ end subroutine ec_UPDATE_ABUNDS_SHORT
!> Build the big matrix
subroutine ec_PREP_MATRIX_LONG(self,N_atoms_use, N_reac, molfracs_atoms, N_species,press,temp, &
H_0, S_0, n, n_spec, matrix, vector, solid_indices, N_solids)
use chemequi_const, only: mol, R
use equilibrate_const, only: mol, R
!! I/O:
class(CEAData), intent(inout) :: self
INTEGER, intent(in) :: N_atoms_use, N_reac, N_species, N_solids
Expand Down Expand Up @@ -1947,7 +1947,7 @@ end subroutine ec_PREP_MATRIX_LONG
!> Return the result of one step of computation with big matrix(problem: AX=B)
subroutine ec_UPDATE_ABUNDS_LONG(self,N_atoms_use,N_reac,N_species,solution_vector,n_spec,pi_atom,&
n,converged,solid_indices,N_solids,molfracs_atoms,n_spec_old)
use chemequi_const, only: mol
use equilibrate_const, only: mol
!! I/O:
class(CEAData), intent(inout) :: self
INTEGER, intent(in) :: N_atoms_use, N_reac, N_species, N_solids
Expand Down Expand Up @@ -2191,7 +2191,7 @@ end subroutine ec_UPDATE_ABUNDS_LONG
!> Computes the adiabatic gradient
subroutine ec_COMP_ADIABATIC_GRAD(self,N_atoms_use,N_reac,N_spec_eff,n_spec, &
n,H_0,C_P_0,solid_indices,N_solids,temp,nabla_ad,gamma2,c_pe)
use chemequi_const, only: mol, R
use equilibrate_const, only: mol, R

!! I/O:
class(CEAData), intent(inout) :: self
Expand Down Expand Up @@ -2339,7 +2339,7 @@ subroutine ec_COMP_ADIABATIC_GRAD(self,N_atoms_use,N_reac,N_spec_eff,n_spec, &
end subroutine ec_COMP_ADIABATIC_GRAD

subroutine ec_b_0(self,N_atoms_use, molfracs_atoms, b_0_norm, b_0)
use chemequi_const, only: masses_atoms_save
use equilibrate_const, only: masses_atoms_save
class(CEAData), intent(inout) :: self
integer, intent(in) :: N_atoms_use
real(dp), intent(in) :: molfracs_atoms(N_atoms_use)
Expand Down
2 changes: 1 addition & 1 deletion src/chemequi_const.f90 → src/equilibrate_const.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module chemequi_const
module equilibrate_const
use iso_fortran_env, only: dp => real64
implicit none
public
Expand Down
4 changes: 2 additions & 2 deletions src/chemequi_yaml.f90 → src/equilibrate_yaml.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module chemequi_yaml
use chemequi_const, only: dp, s_str_len
module equilibrate_yaml
use equilibrate_const, only: dp, s_str_len
implicit none
private

Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

set(TESTS test_chemequi)
set(TESTS test_equilibrate)

if (BUILD_EXECUTABLES)
foreach(TEST ${TESTS})
add_executable(${TEST} "${TEST}.f90")
target_link_libraries(${TEST} equichem)
target_link_libraries(${TEST} equilibrate)
target_include_directories(${TEST} PUBLIC ${CMAKE_Fortran_MODULE_DIRECTORY})
endforeach()
endif()
2 changes: 1 addition & 1 deletion test/test_chemequi.f90 → test/test_equilibrate.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
program main
use chemequi, only: ChemEquiAnalysis, dp, reac_str_len, atom_str_len
use equilibrate, only: ChemEquiAnalysis, dp, reac_str_len, atom_str_len
implicit none

call test()
Expand Down

0 comments on commit a6ffb1e

Please sign in to comment.