Flow123d  release_2.2.0-914-gf1a3a4f
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  */
124  void set_cross_section(Field<3, FieldValue<3>::Scalar> *cross_section);
125 
126  void set_sorption_fields(Field<3, FieldValue<3>::Scalar> *por_m_,
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
type_of_reaction
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:62
Definition: mesh.h:99
Distribution * distribution
static Input::Type::Record input_type
static Input::Type::Record input_type
double molar_mass
static Input::Type::Record input_type
double *** concentration_matrix
Support classes for parallel programing.
double el_charge
type_of_reaction type
Field< 3, FieldValue< 3 >::Scalar > * por_m
pointers to sorption fields from transport
Record type proxy class.
Definition: type_record.hh:182
Field< 3, FieldValue< 3 >::Scalar > * cross_section
double activity