Skip to content

Commit cda3d97

Browse files
authored
Add aerosol support for host model to couple to TChem using sparse solver (#91)
* add kappa * update to solve for aerosols with cvode * add kappa values to input file * sparse solver working on cpu * fix exec_space complaint in tines cvode version * working cpu code * cpu and gpu working * add dtmin and max iterations * clean up unused code. move cvode stats to function * improve formatting * general clean up * add unit test regarding tchem driver interface code called from c * fix bug in test. simplify the gas mechanism * fix assertions for test * fix issues with non initialized particle values * improve clarity of tchem_driver test * fix indent * remove input files and reorganize test to use cb05+simpol files * remove unused solver configuration options * clean up solver settings. add verbose option for solver stats * add comment regarding time * add support for hipcc for driver test * move constants outside parallel_for. minor format changes * formatting * add flag to print solver stats for test
1 parent 5547143 commit cda3d97

File tree

13 files changed

+833
-126
lines changed

13 files changed

+833
-126
lines changed

src/core/TChem_AerosolModelData.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int AerosolModelData::initChem(YAML::Node &root,
8585
// given the name of species return the YAML::NODE
8686
std::map<std::string, YAML::Node> gas_sp_info;
8787
// 2. get molecular weitghs and density of aerosol_species
88-
std::vector<real_type> mw_aerosol_sp, density_aero_sp;
88+
std::vector<real_type> mw_aerosol_sp, density_aero_sp, kappa_aero_sp;
8989
int i_aero_sp=0;
9090
// loops over species, only make map from aerosol species.
9191
// we assume that map of gas species was previously created in kmd.
@@ -104,6 +104,7 @@ int AerosolModelData::initChem(YAML::Node &root,
104104
// std::cout <<"molecular weight" << item["molecular weight [kg mol-1]"]<<"\n";
105105
mw_aerosol_sp.push_back(item["molecular weight [kg mol-1]"].as<real_type>());
106106
density_aero_sp.push_back(item["density [kg m-3]"].as<real_type>());
107+
kappa_aero_sp.push_back(item["kappa"].as<real_type>());
107108
}
108109
} else
109110
{
@@ -208,10 +209,13 @@ int AerosolModelData::initChem(YAML::Node &root,
208209
auto molecular_weights_host = molecular_weights_.view_host();
209210
aerosol_density_= real_type_1d_dual_view(do_not_init_tag("AMD::aerosol_density_"), nSpec_);
210211
auto aerosol_density_host = aerosol_density_.view_host();
212+
aerosol_kappa_ = real_type_1d_dual_view(do_not_init_tag("AMD::kappa"), nSpec_);
213+
auto aerosol_kappa_host = aerosol_kappa_.view_host();
211214
for (int i = 0; i < nSpec_; i++)
212215
{
213216
molecular_weights_host(i) = mw_aerosol_sp[i];
214217
aerosol_density_host(i) = density_aero_sp[i];
218+
aerosol_kappa_host(i) = kappa_aero_sp[i];
215219
}
216220

217221
molecular_weights_.modify_host();

src/core/TChem_AerosolModelData.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ namespace TChem {
3838
ordinal_type nConstSpec_gas_;
3939
// number of particles
4040
ordinal_type nParticles_{-1};
41-
// aerosol molecular weights and density
42-
real_type_1d_dual_view molecular_weights_, aerosol_density_;
41+
// aerosol molecular weights, density and kappa
42+
real_type_1d_dual_view molecular_weights_, aerosol_density_, aerosol_kappa_;
4343
simpol_phase_transfer_type_1d_dual_view simpol_params_;
4444
ordinal_type nSimpol_tran_;
4545

@@ -93,6 +93,7 @@ namespace TChem {
9393

9494
amcd_real_type_1d_view molecular_weights;
9595
amcd_real_type_1d_view aerosol_density;
96+
amcd_real_type_1d_view aerosol_kappa;
9697

9798
};
9899

@@ -106,6 +107,7 @@ namespace TChem {
106107
data.nSimpol_tran=amd.nSimpol_tran_;
107108
data.molecular_weights = amd.molecular_weights_.template view<SpT>();
108109
data.aerosol_density = amd.aerosol_density_.template view<SpT>();
110+
data.aerosol_kappa = amd.aerosol_kappa_.template view<SpT>();
109111
data.simpol_params = amd.simpol_params_.template view<SpT>();
110112
return data;
111113
}

0 commit comments

Comments
 (0)