ChemicalFemPhysics
The GeMA Standard Chemical FEM Physics Plugin
Loading...
Searching...
No Matches
gmpNeuralNetworkReaction.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
26#ifndef _GEMA_PLUGIN_CHEMICAL_NEURALNETWORK_REACTION_H_
27#define _GEMA_PLUGIN_CHEMICAL_NEURALNETWORK_REACTION_H_
28
30#include <gmSimulationData.h>
31#include <gmpFemNeuralNetwork.h>
32#include <IPhreeqc.hpp>
33
34
36class GMP_CHEMICAL_FEM_PHYSICS_API_EXPORT GmpNeuralNetworkReaction : public GmpChemicalFemPhysics
37{
38public:
39 GmpNeuralNetworkReaction(GmSimulationData* simulation, QString id, QString description, const GmLogCategory& logger);
41
42 // Comments on the base class
43 virtual const char* pluginType() const { return "neuralNetwork"; }
44
45 // Comments on the base class
46 virtual const QVariantMap* physicsMetaDataMap();
47
48 // Comments on the base class
49 virtual bool checkLoadedData();
50
51 // Comments on the base class
52 virtual bool beforeElementStiffnessLoop(const GmpFemMatrixSet& elemMatrices, const GmpFemVectorSet& elemVectors);
53
54 // save IPhreeqc Results value to node mesh attributes for Initial Conditions
55 virtual bool saveIPhreeqcValuesToMeshIC(IPhreeqc& R, int node);
56
57 virtual void runfile(IPhreeqc& R);
58 virtual void SetOutputFile(IPhreeqc& R);
60 // Fill parameters to solution and equilibrium reaction
61 virtual GmVector fillSolutionParameters(GmCellAccessor* ac, const GmElement* e, const GmVector* coord, int ip) const;
62 virtual GmMatrix fillEquilibriumParameters(GmCellAccessor* ac, const GmElement* e, const GmVector* coord, int ip) const;
63
64 // Get results after convergence
65 virtual bool calcDerivedResults(bool nonLinearSolver);
66
67 // method to run Iphreeqc at every node fo the mesh
68 virtual bool runNeuralNetwork();
69 // funtion to run Iphreeqc to calculate initial condition to mesh
70 virtual bool runInitIphreeqcNodes();
71
72
73 // read node reaction values
74 virtual void getReactionValues(const GmElement* e, const GmVector& Rg, GmVector& Re, int pos) const;
75
76 // Fill vector for element data
77 virtual void FillElementalReaction(const GmElement* e, GmVector& elemFe, const GmVector& Fr, int pos) const;
78
79protected:
80 // See comments on the base class
81 virtual bool checkAndLoadPrivateData(LuaTable& table);
82 // Fills reaction rate contribution
83 virtual bool reactionRate(const GmElement* e, const GmVector* ip, int ipIndex, const GmVector& N,
84 const GmVector& C, double wtJ, GmVector& elemFe, GmMatrix& elemK,
85 bool needsFe, bool needsK);
86
89 {
92 RUNFILENAMW_ID,
93 SRc_A_ID,
94 SRd_A_ID,
95 POROS_A_ID,
96
97 // --- NO ADDING BELOW THIS LINE
99 };
100
103 {
107 SIndexOld_NA_ID,
109 PHOld_NA_ID,
111 EqRxnOld_NA_ID,
113 MineralOld_NA_ID,
115 poroMOld_NA_ID,
117 CtrateOld_NA_ID,
118
119 // ------ NO ADDING BELOW THIS LINE
121 };
122
124 {
126
127
128 // --- NO ADDING BELOW THIS LINE
130 };
131
132private:
133 IPhreeqc _IPhreeqcReaction; // IPhreeqc reaction
134 GmpFemNeuralNetwork* _net;
135};
136
137#endif
Basic class for chemical fem physics. Treats the diffusion and convective terms of the transport equa...
Definition gmpChemicalFemPhysics.h:35
virtual const QVariantMap * physicsMetaDataMap()
Returns a pointer to the basic chemical physics attribute map, built when the function is called for ...
Definition gmpChemicalFemPhysics.cpp:95
virtual bool reactionRate(const GmElement *e, const GmVector *ip, int ipIndex, const GmVector &N, const GmVector &C, double wtJ, GmVector &elemFe, GmMatrix &elemK, bool needsFe, bool needsK)=0
Virtual function called by fillElementData() for each integration point so that derived classes can a...
@ NUM_ATTRIBUTE_IDS
The number of attribute ids above.
Definition gmpChemicalFemPhysics.h:84
virtual bool calcDerivedResults(bool nonLinearSolver)
Calc velocity and flow on nodes and/or Gauss points.
Definition gmpChemicalFemPhysics.cpp:1030
virtual bool checkLoadedData()
Checks the existance of the velocity accessor, and also sizes for the dispersion and retardation coef...
Definition gmpChemicalFemPhysics.cpp:176
@ NUM_GA_IDS
The number of gauss attribute ids above.
Definition gmpChemicalFemPhysics.h:107
@ NUM_NA_IDS
The number of node attribute ids above.
Definition gmpChemicalFemPhysics.h:97
Extends the basic chemical physics transport equation by providing reaction rates based on the Iphree...
Definition gmpNeuralNetworkReaction.h:37
ANNGaussAttributeIds
Definition gmpNeuralNetworkReaction.h:124
@ NUM_GA_IDS
The number of gauss attributes.
Definition gmpNeuralNetworkReaction.h:129
GmpFemNeuralNetwork * _net
Neural network data.
Definition gmpNeuralNetworkReaction.h:134
ANNPhysicsAttributeIds
Additional IDs for physics attributes.
Definition gmpNeuralNetworkReaction.h:89
@ NUM_ATTRIBUTE_IDS
The number of attribute ids above.
Definition gmpNeuralNetworkReaction.h:98
@ REACTION_TYPE_ID
Id for retrieving the reaction type physics attribute.
Definition gmpNeuralNetworkReaction.h:91
ANNNodeAttributeIds
IDs for physics node attributes.
Definition gmpNeuralNetworkReaction.h:103
@ PH_NA_ID
Base Id for pH solution.
Definition gmpNeuralNetworkReaction.h:108
@ NUM_NA_IDS
The number of node attribute ids above.
Definition gmpNeuralNetworkReaction.h:120
@ SIndex_NA_ID
Base Id for Saturation index.
Definition gmpNeuralNetworkReaction.h:106
@ Ctrate_NA_ID
Base Id for Kinetics reaction Control.
Definition gmpNeuralNetworkReaction.h:116
@ poroM_NA_ID
Base Id for porosity variation.
Definition gmpNeuralNetworkReaction.h:114
@ Mineral_NA_ID
Base Id for mineral for reaction.
Definition gmpNeuralNetworkReaction.h:112
@ EqRxn_NA_ID
Base Id for Reaction in equillibrium.
Definition gmpNeuralNetworkReaction.h:110
@ IonSolOld_NA_ID
Base Id for history of Ion transport node attribute(s)
Definition gmpNeuralNetworkReaction.h:105
arma::mat GmMatrix
arma::vec GmVector
Declaration of the GmpChemicalFemPhysics classes.