Flow123d  release_3.0.0-973-g92f55e826
semchem_interface.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file semchem_interface.hh
15  * @brief
16  */
17 
18 #ifndef interfaceH
19  #define interfaceH
20 
21 #include "mesh/elements.h"
22 #include "la/distribution.hh"
23 #include <string.h>
24 #include <./input/input_type.hh>
25 #include "fields/field.hh"
26 
27 class Distribution;
28 
29 
31 
32 class Specie
33 {
34 public:
35  /*
36  * Static variable for new input data types input
37  */
39  /*
40  * Constructor.
41  */
42  Specie();
43 private:
44  /*
45  * Identifier.
46  */
47  int id;
48  /*
49  * Electrical charge.
50  */
51  double el_charge;
52  /*
53  * Partial Gib's energy.
54  */
55  double dGf;
56  /*
57  * Partial free enthalpy.
58  */
59  double dHf;
60  /*
61  * Molar mass.
62  */
63  double molar_mass;
64  /*
65  * Activity.
66  */
67  double activity;
68 };
69 
71 {
72 public:
73  /*
74  * Static variable for new input data types input
75  */
77  /*
78  * Constructor.
79  */
81 private:
82  /*
83  * Specification of type of reaction.
84  */
86  /*
87  * Defines species participating reaction.
88  */
90  /*
91  * Stechiometric coeficients describing reaction under consideration.
92  */
94  /*
95  * Reaction orders of all the reactants.
96  */
98  /*
99  * Kinetic constant describing reaction rate.
100  */
102  /*
103  * Appropriate constant describing chemical equilibrium.
104  */
106 
107 };
108 
110 {
111  public:
112  /*
113  * Static variable for new input data types input
114  */
116  /**
117  * Semchem interface is the tool to call a simulation of chemical reactions as a part of transport model. timeStep defines the length of time step for simulation of chemical reactions. nrOfSpecies is the number of transported species. dualPorosity defines type of porosity in examinated soil.
118  */
119  Semchem_interface(double timeStep, Mesh * mesh, int nrOfSpecies, bool dualPorosity); //(int nrOfElements, double ***ConcentrationMatrix, Mesh *mesh);
120  /**
121  * @brief Sets pointer to data of other equations.
122  * @param cross_section is pointer to cross_section data of Darcy flow equation
123  */
125 
127  Field<3, FieldValue<3>::Scalar> *por_imm_,
128  Field<3, FieldValue<3>::Scalar> *phi_);
129  /**
130  * This method has been prepared to enable simulation of chemical reactions via Semchem. porTyp defines type of porosity. ppelm is a pointer to element we want to simulate chemistry in. poradi is ID of such element. conc is a pointer to threedimensional array full of doubles.
131  */
132  void compute_reaction(bool porTyp, ElementIter ppelm, int poradi, double ***conc);
133  /**
134  * The function update_solution(..) calls compute_reaction(..) for every single element in the mesh.
135  */
136  void update_solution(void);
137  /**
138  * This method reads from ini-file the information if a simulation of chemical raections is switched on.
139  */
140  void set_chemistry_computation(void);
141  /**
142  * This method enables to change the length of time step for simulation of chemical reactions.
143  */
144  void set_timestep(double new_timestep);
145  /**
146  * This method reads from ini-file an information if dual porosity is considered in examinated soil.
147  */
148  void set_dual_porosity(void);
149  /**
150  * This method sets the number of elements contained in mesh.
151  */
152  void set_nr_of_elements(int nrOfElements);
153  /**
154  * This method sets the pointer to a three dimensional array of doubles.
155  */
156  void set_concentration_matrix(double ***ConcentrationsMatrix, Distribution *conc_distr, int *el_4_loc);
157  /**
158  * This method sets the pointer to a one dimensional array for converting IDs from local to global.
159  */
160  void set_el_4_loc(int *el_for_loc);
161  /**
162  * This method sets a pointer to mesh describing examinated area.
163  */
164  void set_mesh_(Mesh *mesh);
165  /**
166  * function to set path to an outputfile for semchem-module.
167  */
168  void set_fw_chem(std::string semchem_output_file); //(const char* semchem_output_file);
169  /**
170  * It containes an information if the simulation of chemical reactions is switched on.
171  */
173  /**
174  * It containes an information if the dual porosity is switched on.
175  */
177  /**
178  * It containes an information about how many elements are contained in mesh.
179  */
181  /**
182  * It is a pointer on three dimensional matrix full of doubles.
183  */
185  /**
186  * It is name of an output file for semchem.
187  */
188  char *fw_chem;
189  private:
190  /**
191  * It holds an information about the length of time step for chemical reaction simulation.
192  */
193  double time_step;
194  /**
195  * It is a pointer on mesh.
196  */
198  /**
199  * It describes partitioning of elements between processors.
200  */
202  /**
203  * It enables to change local IDs of elements in mesh into global IDs.
204  */
205  int *el_4_loc;
206  /**
207  * pointer to cross_section data (gets from flow->transport->semchem), for computing element volume
208  */
210 
211  /// pointers to sorption fields from transport
213 };
214 #endif
Semchem_interface::set_chemistry_computation
void set_chemistry_computation(void)
Definition: semchem_interface.cc:248
Semchem_interface::set_nr_of_elements
void set_nr_of_elements(int nrOfElements)
Definition: semchem_interface.cc:260
Semchem_interface::set_cross_section
void set_cross_section(Field< 3, FieldValue< 3 >::Scalar > *cross_section)
Sets pointer to data of other equations.
Definition: semchem_interface.cc:98
Semchem_interface::set_concentration_matrix
void set_concentration_matrix(double ***ConcentrationsMatrix, Distribution *conc_distr, int *el_4_loc)
Definition: semchem_interface.cc:266
Iter
General iterator template. Provides iterator over objects in some container.
Definition: general_iterator.hh:30
Semchem_interface::cross_section
Field< 3, FieldValue< 3 >::Scalar > * cross_section
Definition: semchem_interface.hh:209
string.h
Semchem_interface
Definition: semchem_interface.hh:109
Semchem_interface::distribution
Distribution * distribution
Definition: semchem_interface.hh:201
distribution.hh
Support classes for parallel programing.
Semchem_interface::semchem_on
bool semchem_on
Definition: semchem_interface.hh:172
Specie::dGf
double dGf
Definition: semchem_interface.hh:55
Specie::el_charge
double el_charge
Definition: semchem_interface.hh:51
General_reaction::stoichiometry
int * stoichiometry
Definition: semchem_interface.hh:93
Specie::id
int id
Definition: semchem_interface.hh:47
Semchem_interface::fw_chem
char * fw_chem
Definition: semchem_interface.hh:188
General_reaction::order_of_reaction
double * order_of_reaction
Definition: semchem_interface.hh:97
Semchem_interface::set_el_4_loc
void set_el_4_loc(int *el_for_loc)
Definition: semchem_interface.cc:273
Semchem_interface::por_imm
Field< 3, FieldValue< 3 >::Scalar > * por_imm
Definition: semchem_interface.hh:212
Semchem_interface::set_dual_porosity
void set_dual_porosity(void)
Definition: semchem_interface.cc:254
Semchem_interface::compute_reaction
void compute_reaction(bool porTyp, ElementIter ppelm, int poradi, double ***conc)
Definition: semchem_interface.cc:129
Semchem_interface::input_type
static Input::Type::Record input_type
Definition: semchem_interface.hh:115
equilibrium
@ equilibrium
Definition: semchem_interface.hh:30
Semchem_interface::Semchem_interface
Semchem_interface(double timeStep, Mesh *mesh, int nrOfSpecies, bool dualPorosity)
Definition: semchem_interface.cc:81
Semchem_interface::set_mesh_
void set_mesh_(Mesh *mesh)
Definition: semchem_interface.cc:279
Semchem_interface::time_step
double time_step
Definition: semchem_interface.hh:193
Semchem_interface::mesh_
Mesh * mesh_
Definition: semchem_interface.hh:197
Specie
Definition: semchem_interface.hh:32
Distribution
Definition: distribution.hh:50
Specie::input_type
static Input::Type::Record input_type
Definition: semchem_interface.hh:38
Semchem_interface::update_solution
void update_solution(void)
Definition: semchem_interface.cc:113
elements.h
Specie::activity
double activity
Definition: semchem_interface.hh:67
General_reaction::input_type
static Input::Type::Record input_type
Definition: semchem_interface.hh:76
General_reaction::kinetic_constant
double kinetic_constant
Definition: semchem_interface.hh:101
General_reaction::equilibrim_constant
double equilibrim_constant
Definition: semchem_interface.hh:105
FieldValue_
Definition: field_values.hh:247
Semchem_interface::el_4_loc
int * el_4_loc
Definition: semchem_interface.hh:205
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
Semchem_interface::dual_porosity_on
bool dual_porosity_on
Definition: semchem_interface.hh:176
General_reaction::General_reaction
General_reaction()
General_reaction::type
type_of_reaction type
Definition: semchem_interface.hh:85
Semchem_interface::nr_of_elements
int nr_of_elements
Definition: semchem_interface.hh:180
General_reaction
Definition: semchem_interface.hh:70
input_type.hh
Mesh
Definition: mesh.h:80
Semchem_interface::concentration_matrix
double *** concentration_matrix
Definition: semchem_interface.hh:184
Semchem_interface::phi
Field< 3, FieldValue< 3 >::Scalar > * phi
Definition: semchem_interface.hh:212
Semchem_interface::set_timestep
void set_timestep(double new_timestep)
Definition: semchem_interface.cc:242
General_reaction::species
Specie * species
Definition: semchem_interface.hh:89
kinetics
@ kinetics
Definition: semchem_interface.hh:30
Semchem_interface::set_sorption_fields
void set_sorption_fields(Field< 3, FieldValue< 3 >::Scalar > *por_m_, Field< 3, FieldValue< 3 >::Scalar > *por_imm_, Field< 3, FieldValue< 3 >::Scalar > *phi_)
Definition: semchem_interface.cc:103
slow_kinetics
@ slow_kinetics
Definition: semchem_interface.hh:30
Field
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:83
Specie::Specie
Specie()
Semchem_interface::por_m
Field< 3, FieldValue< 3 >::Scalar > * por_m
pointers to sorption fields from transport
Definition: semchem_interface.hh:212
type_of_reaction
type_of_reaction
Definition: semchem_interface.hh:30
field.hh
Specie::molar_mass
double molar_mass
Definition: semchem_interface.hh:63
Specie::dHf
double dHf
Definition: semchem_interface.hh:59
Semchem_interface::set_fw_chem
void set_fw_chem(std::string semchem_output_file)
Definition: semchem_interface.cc:285