solidElectricalConduction.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fv::solidElectricalConduction
26 
27 Description
28  This fvModel represents conduction through a solid region. It solves for
29  the electric potential, calculates the current, and applies the
30  corresponding Joule heating source to the energy equation. It requires the
31  user to specify the electric potential field \c phi in the zero directory.
32 
33 Usage
34  Example usage with a constant scalar conductivity:
35  \verbatim
36  solidElectricalConduction
37  {
38  type solidElectricalConduction;
39 
40  sigma 35.5e6; // <-- 'sigma<scalar>' is also accepted
41  }
42  \endverbatim
43 
44  Example usage with a constant tensor conductivity:
45  \verbatim
46  solidElectricalConduction
47  {
48  type solidElectricalConduction;
49 
50  sigma<tensor> (35.5e6 0 0 0 35.5e6 0 0 0 35.5e6);
51  }
52  \endverbatim
53 
54  Example usage with a functional scalar conductivity, and writing the
55  conductivity out for post-processing:
56  \verbatim
57  solidElectricalConduction
58  {
59  type solidElectricalConduction;
60 
61  sigma
62  {
63  type distanceFunction;
64 
65  function
66  {
67  type polynomial;
68  coeffs (35.5e6 1e9);
69  }
70 
71  direction (0 1 0);
72  }
73 
74  writeSigma yes;
75  }
76  \endverbatim
77 
78 SourceFiles
79  solidElectricalConduction.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef solidElectricalConduction_H
84 #define solidElectricalConduction_H
85 
86 #include "fvModel.H"
87 #include "volFields.H"
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 namespace fv
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class solidElectricalConduction Declaration
99 \*---------------------------------------------------------------------------*/
100 
102 :
103  public fvModel
104 {
105  // Private Data
106 
107  //- The electric potential
108  volScalarField phi_;
109 
110  //- The current
112 
113  //- The scalar conductivity
115 
116  //- The tensor conductivity
118 
119  //- Write the conductivity?
120  bool writeSigma_;
121 
122  //- Has the mesh changed since the last solution?
123  bool meshChanged_;
124 
125 
126  // Private Member Functions
127 
128  //- Non-virtual read
129  void readCoeffs(const dictionary& dict);
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("solidElectricalConduction");
136 
137 
138  // Constructors
139 
140  //- Construct from explicit source name and mesh
142  (
143  const word& name,
144  const word& modelType,
145  const fvMesh& mesh,
146  const dictionary& dict
147  );
148 
149  //- Disallow default bitwise copy construction
151 
152 
153  // Member Functions
154 
155  // Checks
156 
157  //- Return the list of fields for which the fvModel adds source term
158  // to the transport equation
159  virtual wordList addSupFields() const;
160 
161 
162  // Evaluate
163 
164  //- Add explicit contribution to compressible energy equation
165  virtual void addSup
166  (
167  const volScalarField& rho,
168  const volScalarField& he,
169  fvMatrix<scalar>& eqn
170  ) const;
171 
172 
173  //- Solve for the electric potential
174  virtual void correct();
175 
176 
177  // Mesh changes
178 
179  //- Update for mesh motion
180  virtual bool movePoints();
181 
182  //- Update topology using the given map
183  virtual void topoChange(const polyTopoChangeMap&);
184 
185  //- Update from another mesh using the given map
186  virtual void mapMesh(const polyMeshMap&);
187 
188  //- Redistribute or update using the given distribution map
189  virtual void distribute(const polyDistributionMap&);
190 
191 
192  // IO
193 
194  //- Read source dictionary
195  virtual bool read(const dictionary& dict);
196 
197  //- Write fvModel data
198  virtual bool write(const bool write = true) const;
199 
200 
201  // Member Operators
202 
203  //- Disallow default bitwise assignment
204  void operator=(const solidElectricalConduction&) = delete;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace fv
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Finite volume model abstract base class.
Definition: fvModel.H:60
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:69
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
This fvModel represents conduction through a solid region. It solves for the electric potential,...
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
solidElectricalConduction(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual void correct()
Solve for the electric potential.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
TypeName("solidElectricalConduction")
Runtime type information.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void addSup(const volScalarField &rho, const volScalarField &he, fvMatrix< scalar > &eqn) const
Add explicit contribution to compressible energy equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool write(const bool write=true) const
Write fvModel data.
void operator=(const solidElectricalConduction &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:63
rho
Definition: pEqn.H:1
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict