-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mo_setsox testing finished--ready for PR
- Loading branch information
Showing
8 changed files
with
232 additions
and
676 deletions.
There are no files selected for viewing
Submodule mam_x_validation
updated
14 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// mam4xx: Copyright (c) 2022, | ||
// Battelle Memorial Institute and | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#include <mam4xx/mam4.hpp> | ||
|
||
#include <mam4xx/aero_config.hpp> | ||
#include <skywalker.hpp> | ||
#include <validation.hpp> | ||
|
||
using namespace skywalker; | ||
using namespace mam4; | ||
using namespace haero; | ||
void calc_ph_values(Ensemble *ensemble) { | ||
ensemble->process([=](const Input &input, Output &output) { | ||
// Ensemble parameters | ||
// Declare array of strings for input names | ||
std::string input_variables[] = {"dt"}; | ||
|
||
std::string input_arrays[] = {"temperature", "patm", "xlwc", "t_factor", | ||
"xso2", "xso4", "xhnm", "so4_fact", | ||
"Ra", "xkw", "const0"}; | ||
|
||
// Iterate over input_variables and error if not in input | ||
for (std::string name : input_variables) { | ||
if (!input.has(name.c_str())) { | ||
std::cerr << "Required name for variable: " << name << std::endl; | ||
exit(1); | ||
} | ||
} | ||
// Iterate over input_arrays and error if not in input | ||
for (std::string name : input_arrays) { | ||
if (!input.has_array(name.c_str())) { | ||
std::cerr << "Required name for array: " << name << std::endl; | ||
exit(1); | ||
} | ||
} | ||
|
||
// Parse input | ||
const Real temperature = input.get_array("temperature")[0]; | ||
const Real patm = input.get_array("patm")[0]; | ||
const Real xlwc = input.get_array("xlwc")[0]; | ||
const Real t_factor = input.get_array("t_factor")[0]; | ||
const Real xso2 = input.get_array("xso2")[0]; | ||
const Real xso4 = input.get_array("xso4")[0]; | ||
const Real xhnm = input.get_array("xhnm")[0]; | ||
const Real so4_fact = input.get_array("so4_fact")[0]; | ||
const Real Ra = input.get_array("Ra")[0]; | ||
const Real xkw = input.get_array("xkw")[0]; | ||
const Real const0 = input.get_array("const0")[0]; | ||
|
||
bool converged; | ||
Real xph; | ||
|
||
mam4::mo_setsox::calc_ph_values(temperature, patm, xlwc, t_factor, xso2, | ||
xso4, xhnm, so4_fact, Ra, xkw, const0, | ||
converged, xph); | ||
|
||
output.set("converged", converged); | ||
output.set("xph", xph); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// mam4xx: Copyright (c) 2022, | ||
// Battelle Memorial Institute and | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#include <mam4xx/mam4.hpp> | ||
|
||
#include <mam4xx/aero_config.hpp> | ||
#include <skywalker.hpp> | ||
#include <validation.hpp> | ||
|
||
using namespace skywalker; | ||
using namespace mam4; | ||
using namespace haero; | ||
void calc_sox_aqueous(Ensemble *ensemble) { | ||
ensemble->process([=](const Input &input, Output &output) { | ||
// Ensemble parameters | ||
// Declare array of strings for input names | ||
std::string input_variables[] = {"dt"}; | ||
|
||
std::string input_arrays[] = { | ||
"const0", "dtime", "h2o2g", "heo3", "heso2", "modal_aerosols", | ||
"o3g", "patm", "rah2o2", "rao3", "so2g", "t_factor", | ||
"xh2o2", "xhnm", "xlwc", "xso2", "xso4", "xso4_init"}; | ||
|
||
// Iterate over input_variables and error if not in input | ||
for (std::string name : input_variables) { | ||
if (!input.has(name.c_str())) { | ||
std::cerr << "Required name for variable: " << name << std::endl; | ||
exit(1); | ||
} | ||
} | ||
// Iterate over input_arrays and error if not in input | ||
for (std::string name : input_arrays) { | ||
if (!input.has_array(name.c_str())) { | ||
std::cerr << "Required name for array: " << name << std::endl; | ||
exit(1); | ||
} | ||
} | ||
|
||
// Parse input | ||
const Real const0 = input.get_array("const0")[0]; | ||
const Real dt = input.get_array("dtime")[0]; | ||
const Real h2o2g = input.get_array("h2o2g")[0]; | ||
const Real heo3 = input.get_array("heo3")[0]; | ||
const Real heso2 = input.get_array("heso2")[0]; | ||
const bool modal_aerosols = input.get_array("modal_aerosols")[0]; | ||
const Real o3g = input.get_array("o3g")[0]; | ||
const Real patm = input.get_array("patm")[0]; | ||
const Real rah2o2 = input.get_array("rah2o2")[0]; | ||
const Real rao3 = input.get_array("rao3")[0]; | ||
const Real so2g = input.get_array("so2g")[0]; | ||
const Real t_factor = input.get_array("t_factor")[0]; | ||
const Real xhnm = input.get_array("xhnm")[0]; | ||
const Real xlwc = input.get_array("xlwc")[0]; | ||
|
||
Real xso2 = input.get_array("xso2")[0]; | ||
Real xso4 = input.get_array("xso4")[0]; | ||
Real xso4_init = input.get_array("xso4_init")[0]; | ||
Real xh2o2 = input.get_array("xh2o2")[0]; | ||
|
||
Real xdelso4hp; | ||
|
||
mam4::mo_setsox::calc_sox_aqueous(modal_aerosols, rah2o2, h2o2g, so2g, o3g, | ||
rao3, patm, dt, t_factor, xlwc, const0, | ||
xhnm, heo3, heso2, xso2, xso4, xso4_init, | ||
xh2o2, xdelso4hp); | ||
|
||
output.set("xso2", xso2); | ||
output.set("xso4", xso4); | ||
output.set("xso4_init", xso4_init); | ||
output.set("xh2o2", xh2o2); | ||
output.set("xdelso4hp_ik", xdelso4hp); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// mam4xx: Copyright (c) 2022, | ||
// Battelle Memorial Institute and | ||
// National Technology & Engineering Solutions of Sandia, LLC (NTESS) | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#include <mam4xx/mam4.hpp> | ||
|
||
#include <mam4xx/aero_config.hpp> | ||
#include <skywalker.hpp> | ||
#include <validation.hpp> | ||
|
||
using namespace skywalker; | ||
using namespace mam4; | ||
using namespace haero; | ||
void calc_ynetpos(Ensemble *ensemble) { | ||
ensemble->process([=](const Input &input, Output &output) { | ||
// Ensemble parameters | ||
// Declare array of strings for input names | ||
std::string input_variables[] = {"dt"}; | ||
|
||
std::string input_arrays[] = {"yph", "fact1_so2", "fact2_so2", | ||
"fact3_so2", "fact4_so2", "Eco2", | ||
"Eh2o", "Eso4", "so4_fact"}; | ||
|
||
// Iterate over input_variables and error if not in input | ||
for (std::string name : input_variables) { | ||
if (!input.has(name.c_str())) { | ||
std::cerr << "Required name for variable: " << name << std::endl; | ||
exit(1); | ||
} | ||
} | ||
// Iterate over input_arrays and error if not in input | ||
for (std::string name : input_arrays) { | ||
if (!input.has_array(name.c_str())) { | ||
std::cerr << "Required name for array: " << name << std::endl; | ||
exit(1); | ||
} | ||
} | ||
|
||
// Parse input | ||
const Real yph = input.get_array("yph")[0]; | ||
const Real fact1_so2 = input.get_array("fact1_so2")[0]; | ||
const Real fact2_so2 = input.get_array("fact2_so2")[0]; | ||
const Real fact3_so2 = input.get_array("fact3_so2")[0]; | ||
const Real fact4_so2 = input.get_array("fact4_so2")[0]; | ||
const Real Eco2 = input.get_array("Eco2")[0]; | ||
const Real Eh2o = input.get_array("Eh2o")[0]; | ||
const Real Eso4 = input.get_array("Eso4")[0]; | ||
const Real so4_fact = input.get_array("so4_fact")[0]; | ||
|
||
Real xph; | ||
Real ynetpos; | ||
|
||
mam4::mo_setsox::calc_ynetpos(yph, fact1_so2, fact2_so2, fact3_so2, | ||
fact4_so2, Eco2, Eh2o, Eso4, so4_fact, xph, | ||
ynetpos); | ||
|
||
output.set("xph", xph); | ||
output.set("ynetpos", ynetpos); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.