Merge branch '5-surface-exchange-benchmark-with-poet' into 'main'

Resolve "Surface/Exchange benchmark with POET"

Closes #5

See merge request naaice/poet!10
This commit is contained in:
Max Lübke 2023-04-18 14:38:15 +02:00
commit 2e7af244e2
5 changed files with 16 additions and 20 deletions

View File

@ -1,8 +1,8 @@
install(FILES install(FILES
ExBase.pqi ExBase.pqi
ex.R ex.R
#surfex.R surfex.R
#SurfExBase.pqi SurfExBase.pqi
SMILE_2021_11_01_TH.dat SMILE_2021_11_01_TH.dat
DESTINATION DESTINATION
share/poet/bench/surfex share/poet/bench/surfex

View File

@ -1,4 +1,4 @@
## Time-stamp: "Last modified 2023-04-13 17:11:52 mluebke" ## Time-stamp: "Last modified 2023-04-17 15:48:21 mluebke"
database <- normalizePath("../share/poet/bench/surfex/SMILE_2021_11_01_TH.dat") database <- normalizePath("../share/poet/bench/surfex/SMILE_2021_11_01_TH.dat")
input_script <- normalizePath("../share/poet/bench/surfex/SurfExBase.pqi") input_script <- normalizePath("../share/poet/bench/surfex/SurfExBase.pqi")
@ -103,8 +103,11 @@ boundary <- list(
diffu_list <- names(alpha_diffu) diffu_list <- names(alpha_diffu)
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
names(vecinj) <- names(init_cell)
diffusion <- list( diffusion <- list(
init = init_cell, init = as.data.frame(init_cell, check.names = FALSE),
vecinj = vecinj, vecinj = vecinj,
# vecinj_inner = vecinj_inner, # vecinj_inner = vecinj_inner,
vecinj_index = boundary, vecinj_index = boundary,

@ -1 +1 @@
Subproject commit ade4f56605b8d0e81b7ccad510f2db21f46b5ff9 Subproject commit 6a4c14c2857f0ad3558af3f1e1aa7555a805e8e2

View File

@ -385,9 +385,9 @@ protected:
uint32_t prop_count = 0; uint32_t prop_count = 0;
std::vector<std::string> prop_names; std::vector<std::string> prop_names;
std::vector<double> field; std::vector<double> field;
static constexpr uint32_t MODULE_COUNT = 4; static constexpr int MODULE_COUNT = 5;
std::array<std::uint32_t, 4> speciesPerModule{}; std::array<std::uint32_t, MODULE_COUNT> speciesPerModule{};
}; };
} // namespace poet } // namespace poet

View File

@ -68,6 +68,7 @@ void poet::ChemistryModule::RunInitFile(const std::string &input_script_path) {
char exchange = (speciesPerModule[1] == 0 ? -1 : 1); char exchange = (speciesPerModule[1] == 0 ? -1 : 1);
char kinetics = (speciesPerModule[2] == 0 ? -1 : 1); char kinetics = (speciesPerModule[2] == 0 ? -1 : 1);
char equilibrium = (speciesPerModule[3] == 0 ? -1 : 1); char equilibrium = (speciesPerModule[3] == 0 ? -1 : 1);
char surface = (speciesPerModule[4] == 0 ? -1 : 1);
#ifdef POET_USE_PRM #ifdef POET_USE_PRM
std::vector<int> ic1; std::vector<int> ic1;
@ -77,7 +78,7 @@ void poet::ChemistryModule::RunInitFile(const std::string &input_script_path) {
ic1[i] = 1; // Solution 1 ic1[i] = 1; // Solution 1
ic1[nxyz + i] = equilibrium; // Equilibrium 1 ic1[nxyz + i] = equilibrium; // Equilibrium 1
ic1[2 * nxyz + i] = exchange; // Exchange none ic1[2 * nxyz + i] = exchange; // Exchange none
ic1[3 * nxyz + i] = -1; // Surface none ic1[3 * nxyz + i] = surface; // Surface none
ic1[4 * nxyz + i] = -1; // Gas phase none ic1[4 * nxyz + i] = -1; // Gas phase none
ic1[5 * nxyz + i] = -1; // Solid solutions none ic1[5 * nxyz + i] = -1; // Solid solutions none
ic1[6 * nxyz + i] = kinetics; // Kinetics 1 ic1[6 * nxyz + i] = kinetics; // Kinetics 1
@ -92,7 +93,7 @@ void poet::ChemistryModule::RunInitFile(const std::string &input_script_path) {
ic1[i] = 1; // Solution 1 ic1[i] = 1; // Solution 1
ic1[nxyz + i] = equilibrium; // Equilibrium 1 ic1[nxyz + i] = equilibrium; // Equilibrium 1
ic1[2 * nxyz + i] = exchange; // Exchange none ic1[2 * nxyz + i] = exchange; // Exchange none
ic1[3 * nxyz + i] = -1; // Surface none ic1[3 * nxyz + i] = surface; // Surface none
ic1[4 * nxyz + i] = -1; // Gas phase none ic1[4 * nxyz + i] = -1; // Gas phase none
ic1[5 * nxyz + i] = -1; // Solid solutions none ic1[5 * nxyz + i] = -1; // Solid solutions none
ic1[6 * nxyz + i] = kinetics; // Kinetics 1 ic1[6 * nxyz + i] = kinetics; // Kinetics 1
@ -104,7 +105,7 @@ void poet::ChemistryModule::RunInitFile(const std::string &input_script_path) {
#ifndef POET_USE_PRM #ifndef POET_USE_PRM
void poet::ChemistryModule::mergeFieldWithModule(const SingleCMap &input_map, void poet::ChemistryModule::mergeFieldWithModule(const SingleCMap &input_map,
std::uint32_t n_cells) { std::uint32_t n_cells) {
if (is_master) { if (is_master) {
int f_type = CHEM_INIT_SPECIES; int f_type = CHEM_INIT_SPECIES;
@ -171,16 +172,8 @@ void poet::ChemistryModule::mergeFieldWithModule(const SingleCMap &input_map,
const std::vector<std::string> ess_names = old_prop_names; const std::vector<std::string> ess_names = old_prop_names;
for (const auto &name : this->prop_names) { for (int i = 0; i < prop_names.size(); i++) {
auto it_find = std::find(ess_names.begin(), ess_names.end(), name); double value = init_values[i];
double value;
if (it_find != ess_names.end()) {
int index = it_find - ess_names.begin();
value = init_values[index];
} else {
auto map_it = input_map.find(name);
value = map_it->second;
}
std::vector<double> curr_vec(n_cells, value); std::vector<double> curr_vec(n_cells, value);
this->field.insert(field.end(), curr_vec.begin(), curr_vec.end()); this->field.insert(field.end(), curr_vec.begin(), curr_vec.end());
} }