C version
The C API can be included in your code as follow:
//Include library
#include "Asali.h"
//Main
int main()
{
//Create composition using Asali vectors format
AsaliVector x,names;
double X[3] = {0.1, 0.2, 0.7};
empty_vector_of_char(&names,3);
set_vector_element_from_char(&names,0,"H2");
set_vector_element_from_char(&names,1,"O2");
set_vector_element_from_char(&names,2,"N2");
vector_from_double_array(&x,3,X);
//Initialize Asali
Asali asali;
initialize(&asali);
//Set up composition/pressure and temperature
set_temperature(&asali,393.15);
set_pressure(&asali,4e05);
set_number_of_species(&asali,get_vector_size(&x));
set_species_names(&asali,names);
set_mole_fraction(&asali,x);
//Properties evaluation
AsaliVector cp;
AsaliMatrix diff;
diff = get_binary_diffusion(&asali);
cp = get_species_mass_specific_heat(&asali);
return 0;
}
Example and database generator can be compiled by typing:
./compile.sh
To convert the Asali database into C code run:
./database-generator
Available thermodynamic and transport properties
ASALI estimates different thermodynamic and transport (asali
is the library object):
Function | Estimated property | Return type | Unit dimension |
---|---|---|---|
get_density(&asali) | Mixture density | double | kg/m3 |
get_mixture_molecular_weight(&asali) | Mixture molecular weight | double | g/mol |
get_mixture_thermal_conductivity(&asali) | Mixture thermal conductivity | double | W/m/K |
get_mixture_viscosity(&asali) | Mixture viscosity | double | Pa*s |
get_mixture_molar_specific_heat(&asali) | Mixture specific heat | double | J/kmol/K |
get_mixture_mass_specific_heat(&asali) | Mixture specific heat | double | J/kg/K |
get_mixture_molar_enthalpy(&asali) | Mixture enthalpy | double | J/kmol |
get_mixture_mass_enthalpy(&asali) | Mixture enthalpy | double | J/kg |
get_mixture_molar_entropy(&asali) | Mixture entropy | double | J/kmol/K |
get_mixture_mass_entropy(&asali) | Mixture entropy | double | J/kg/K |
get_mixture_diffusion(&asali) | Mixture diffusivity | AsaliVector | m2/s |
get_species_thermal_conductivity(&asali) | Single specie thermal conductivity | AsaliVector | W/m/K |
get_species_viscosity(&asali) | Single specie viscosity | AsaliVector | Pa*s |
get_species_molar_specific_heat(&asali) | Single specie specific heat | AsaliVector | J/kmol/K |
get_species_mass_specific_heat(&asali) | Single specie specific heat | AsaliVector | J/kg/K |
get_species_molar_enthalpy(&asali) | Single specie enthalpy | AsaliVector | J/kmol |
get_species_mass_enthalpy(&asali) | Single specie enthalpy | AsaliVector | J/kg |
get_species_molar_entropy(&asali) | Single specie entropy | AsaliVector | J/kmol/K |
get_species_mass_entropy(&asali) | Single specie entropy | AsaliVector | J/kg/K |
get_arithmetic_mean_gas_velocity(&asali) | Single gas velocity | AsaliVector | m/s |
get_mean_free_path(&asali) | Single mean free path | AsaliVector | m |
get_binary_diffusion(&asali) | Single binary diffusion | AsaliMatrix | m2/s |