5 #include <boost/foreach.hpp>
26 using namespace Input::Type;
34 = EqData().output_fields.make_output_field_selection(
"DualPorosity_Output")
39 "Dual porosity model in transport problems.\n"
40 "Provides computing the concentration of substances in mobile and immobile zone.\n"
44 "Containes region specific data necessary to construct dual porosity model.")
50 Default(
"conc_immobile"),
"List of fields to write to output stream.");
54 *
this += diffusion_rate_immobile
55 .name(
"diffusion_rate_immobile")
56 .desc(
"Diffusion coefficient of non-equilibrium linear exchange between mobile and immobile zone.")
60 *
this += porosity_immobile
61 .name(
"porosity_immobile")
62 .desc(
"Porosity of the immobile zone.")
66 *
this += init_conc_immobile
67 .name(
"init_conc_immobile")
68 .desc(
"Initial concentration of substances in the immobile zone.")
77 output_fields += *
this;
78 output_fields += conc_immobile.name(
"conc_immobile").units(
"M/L^3");
98 for (
unsigned int sbi = 0; sbi <
names_.size(); sbi++)
130 xprintf(
UsrErr,
"Dual porosity model cannot have another descendant dual porosity model.\n");
134 xprintf(
UsrErr,
"Semchem chemistry model is not supported at current time.\n");
137 xprintf(
UsrErr,
"Wrong reaction type in DualPorosity model.\n");
158 xprintf(
UsrErr,
"Dual porosity model cannot have another descendant dual porosity model.\n");
162 xprintf(
UsrErr,
"Semchem chemistry model is not supported at current time.\n");
165 xprintf(
UsrErr,
"Unknown reactions type in DualPorosity model.\n");
178 ASSERT(
time_ !=
nullptr,
"Time governor has not been set yet.\n");
205 for (
unsigned int sbi = 0; sbi <
names_.size(); sbi++)
215 unsigned int index =
el_4_loc[loc_el];
219 for (
int sbi=0; sbi <
names_.size(); sbi++)
231 for (
int sbi=0; sbi<
names_.size(); sbi++)
234 std::shared_ptr<FieldElementwise<3, FieldValue<3>::Scalar> > output_field_ptr(
253 if (sorption_mob !=
nullptr)
258 if (sorption_immob !=
nullptr)
305 double conc_avg = 0.0;
306 unsigned int sbi, sbi_loc;
307 double cm, pcm, ci, pci, por_m, por_imm, temp_exp;
318 for (sbi = 0; sbi <
names_.size(); sbi++)
326 conc_avg = ((por_m * pcm) + (por_imm * pci)) / (por_m + por_imm);
328 if ((conc_avg != 0.0) && (por_imm != 0.0)) {
329 temp_exp = exp(-diff_vec[sbi] * ((por_m + por_imm) / (por_m * por_imm)) *
time_->
dt());
331 cm = (pcm - conc_avg) * temp_exp + conc_avg;
334 ci = (pci - conc_avg) * temp_exp + conc_avg;
345 for (sbi = 0; sbi <
names_.size(); sbi++) {
350 if (por_imm != 0.0) {
351 temp_exp = diff_vec[sbi]*(pci - pcm) *
time_->
dt();
353 cm = temp_exp / por_m + pcm;
356 ci = -temp_exp / por_imm + pci;
371 int sbi, n_subst, ierr, rank, np;
378 for (sbi = 0; sbi < n_subst; sbi++) {
395 VecScatter vconc_out_scatter;
406 for (sbi = 0; sbi <
names_.size(); sbi++) {
412 VecScatterDestroy(&(vconc_out_scatter));