MFEM  v3.2
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
volta_solver.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_VOLTA_SOLVER
13 #define MFEM_VOLTA_SOLVER
14 
15 #include "../../config/config.hpp"
16 
17 #ifdef MFEM_USE_MPI
18 
19 #include "../common/pfem_extras.hpp"
20 #include <string>
21 #include <map>
22 
23 namespace mfem
24 {
25 
26 using miniapps::H1_ParFESpace;
27 using miniapps::ND_ParFESpace;
28 using miniapps::RT_ParFESpace;
29 using miniapps::ParDiscreteGradOperator;
30 
31 namespace electromagnetics
32 {
33 
35 {
36 public:
37  VoltaSolver(ParMesh & pmesh, int order,
38  Array<int> & dbcs, Vector & dbcv,
39  Array<int> & nbcs, Vector & nbcv,
40  Coefficient & epsCoef,
41  double (*phi_bc )(const Vector&),
42  double (*rho_src)(const Vector&),
43  void (*p_src )(const Vector&, Vector&));
44  ~VoltaSolver();
45 
46  HYPRE_Int GetProblemSize();
47 
48  void PrintSizes();
49 
50  void Assemble();
51 
52  void Update();
53 
54  void Solve();
55 
56  void GetErrorEstimates(Vector & errors);
57 
59 
60  void WriteVisItFields(int it = 0);
61 
62  void InitializeGLVis();
63 
64  void DisplayToGLVis();
65 
66  const ParGridFunction & GetVectorPotential() { return *phi_; }
67 
68 private:
69 
70  int myid_;
71  int num_procs_;
72  int order_;
73 
74  ParMesh * pmesh_;
75 
76  Array<int> * dbcs_;
77  Vector * dbcv_;
78  Array<int> * nbcs_;
79  Vector * nbcv_;
80 
81  VisItDataCollection * visit_dc_;
82 
83  H1_ParFESpace * H1FESpace_;
84  ND_ParFESpace * HCurlFESpace_;
85  RT_ParFESpace * HDivFESpace_;
86 
87  ParBilinearForm * divEpsGrad_;
88  ParBilinearForm * h1Mass_;
89  ParBilinearForm * h1SurfMass_;
90  ParBilinearForm * hCurlMass_;
91  ParBilinearForm * hDivMass_;
92  ParMixedBilinearForm * hCurlHDivEps_;
93  ParMixedBilinearForm * hCurlHDiv_;
94 
96 
97  ParGridFunction * phi_;
98  ParGridFunction * rho_;
99  ParGridFunction * sigma_;
100  ParGridFunction * e_;
101  ParGridFunction * d_;
102  ParGridFunction * p_;
103 
104  Coefficient * epsCoef_;
105  Coefficient * phiBCCoef_;
106  Coefficient * rhoCoef_;
107  VectorCoefficient * pCoef_;
108 
109  double (*phi_bc_ )(const Vector&);
110  double (*rho_src_)(const Vector&);
111  void (*p_src_ )(const Vector&, Vector&);
112 
113  std::map<std::string,socketstream*> socks_;
114 
115  Array<int> ess_bdr_;
116 };
117 
118 } // namespace electromagnetics
119 
120 } // namespace mfem
121 
122 #endif // MFEM_USE_MPI
123 
124 #endif // MFEM_VOLTA_SOLVER
void RegisterVisItFields(VisItDataCollection &visit_dc)
void GetErrorEstimates(Vector &errors)
Data collection with VisIt I/O routines.
Base class Coefficient that may optionally depend on time.
Definition: coefficient.hpp:31
Class for parallel bilinear form.
const ParGridFunction & GetVectorPotential()
Class for parallel bilinear form.
Vector data type.
Definition: vector.hpp:33
Class for parallel grid function.
Definition: pgridfunc.hpp:31
Class for parallel meshes.
Definition: pmesh.hpp:28
VoltaSolver(ParMesh &pmesh, int order, Array< int > &dbcs, Vector &dbcv, Array< int > &nbcs, Vector &nbcv, Coefficient &epsCoef, double(*phi_bc)(const Vector &), double(*rho_src)(const Vector &), void(*p_src)(const Vector &, Vector &))