gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
thermicSolver.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef THERMIC_SOLVER_H
7 #define THERMIC_SOLVER_H
8 
9 #include <map>
10 #include <string>
11 #include "GmshConfig.h"
12 #include "SVector3.h"
13 #include "dofManager.h"
14 #include "simpleFunction.h"
15 #include "functionSpace.h"
16 
17 class GModel;
18 class PView;
19 class groupOfElements;
20 class gLevelset;
21 
23  int _tag;
25  double _tau;
27  LagrangeMultiplierFieldT() : _tag(0), g(nullptr) {}
28 };
29 
30 struct thermicField {
31  int _tag; // tag for the dofManager
32  groupOfElements *g; // support for this field
33  double _k; // diffusivity
34  thermicField() : _tag(0), g(nullptr) {}
35 };
36 
38  int _tag; // tag for the dofManager
40  location onWhat; // on vertices or elements
41  groupOfElements *g; // support for this BC
42  BoundaryConditionT() : _tag(0), onWhat(UNDEF), g(nullptr) {}
43 };
44 
47  dirichletBCT() : BoundaryConditionT(), _f(nullptr) {}
48 };
49 
50 struct neumannBCT : public BoundaryConditionT {
52  neumannBCT() : BoundaryConditionT(), _f(nullptr) {}
53 };
54 // a thermic solver ...
56 protected:
58  int _dim, _tag;
62 
63  // young modulus and poisson coefficient per physical
64  std::vector<thermicField> thermicFields;
65  std::vector<LagrangeMultiplierFieldT> LagrangeMultiplierFields;
66  // neumann BC
67  std::vector<neumannBCT> allNeumann;
68  // dirichlet BC
69  std::vector<dirichletBCT> allDirichlet;
70 
71 public:
72  thermicSolver(int tag)
73  : _tag(tag), pAssembler(nullptr), LagSpace(nullptr), LagrangeMultiplierSpace(nullptr)
74  {
75  }
76 
77  virtual ~thermicSolver()
78  {
79  if(LagSpace) delete LagSpace;
81  if(pAssembler) delete pAssembler;
82  }
83  void assemble(linearSystem<double> *lsys);
84  virtual void setMesh(const std::string &meshFileName);
85  void cutMesh(gLevelset *ls);
86  void setThermicDomain(int phys, double k);
87  void setLagrangeMultipliers(int phys, double tau, int tag,
89  void changeLMTau(int tag, double tau);
90  void setEdgeTemp(int edge, simpleFunction<double> *f);
91  void setFaceTemp(int face, simpleFunction<double> *f);
92  void solve();
94  double computeLagNorm(int tag, simpleFunction<double> *f);
95 #if defined(HAVE_POST)
96  virtual PView *buildTemperatureView(const std::string postFileName);
97  virtual PView *buildLagrangeMultiplierView(const std::string &postFileName);
98  PView *buildErrorEstimateView(const std::string &errorFileName,
100 #endif
101 };
102 
103 #endif
thermicSolver::computeL2Norm
double computeL2Norm(simpleFunction< double > *f)
Definition: thermicSolver.cpp:191
PView
Definition: PView.h:27
thermicField::_k
double _k
Definition: thermicSolver.h:33
BoundaryConditionT::UNDEF
@ UNDEF
Definition: thermicSolver.h:39
thermicSolver::_tag
int _tag
Definition: thermicSolver.h:58
neumannBCT
Definition: thermicSolver.h:50
thermicSolver::~thermicSolver
virtual ~thermicSolver()
Definition: thermicSolver.h:77
LegendrePolynomials::f
void f(int n, double u, double *val)
Definition: orthogonalBasis.cpp:77
BoundaryConditionT::ON_FACE
@ ON_FACE
Definition: thermicSolver.h:39
thermicSolver::assemble
void assemble(linearSystem< double > *lsys)
Definition: thermicSolver.cpp:111
SVector3.h
thermicSolver::setEdgeTemp
void setEdgeTemp(int edge, simpleFunction< double > *f)
Definition: thermicSolver.cpp:91
BoundaryConditionT::location
location
Definition: thermicSolver.h:39
thermicSolver::pModel
GModel * pModel
Definition: thermicSolver.h:57
groupOfElements
Definition: groupOfElements.h:24
BoundaryConditionT::ON_EDGE
@ ON_EDGE
Definition: thermicSolver.h:39
BoundaryConditionT::ON_VOLUME
@ ON_VOLUME
Definition: thermicSolver.h:39
BoundaryConditionT::ON_VERTEX
@ ON_VERTEX
Definition: thermicSolver.h:39
thermicSolver::cutMesh
void cutMesh(gLevelset *ls)
Definition: thermicSolver.cpp:56
dirichletBCT::_f
simpleFunction< double > * _f
Definition: thermicSolver.h:46
thermicSolver::setMesh
virtual void setMesh(const std::string &meshFileName)
Definition: thermicSolver.cpp:27
simpleFunction< double >
gLevelset
Definition: gmshLevelset.h:64
thermicSolver
Definition: thermicSolver.h:55
thermicSolver::_dim
int _dim
Definition: thermicSolver.h:58
thermicSolver::LagrangeMultiplierSpace
FunctionSpace< double > * LagrangeMultiplierSpace
Definition: thermicSolver.h:61
neumannBCT::_f
simpleFunction< double > * _f
Definition: thermicSolver.h:51
GModel
Definition: GModel.h:44
thermicField::g
groupOfElements * g
Definition: thermicSolver.h:32
LagrangeMultiplierFieldT::_f
simpleFunction< double > * _f
Definition: thermicSolver.h:26
dirichletBCT
Definition: thermicSolver.h:45
LagrangeMultiplierFieldT::_tag
int _tag
Definition: thermicSolver.h:23
thermicField::thermicField
thermicField()
Definition: thermicSolver.h:34
thermicSolver::allDirichlet
std::vector< dirichletBCT > allDirichlet
Definition: thermicSolver.h:69
dofManager< double >
BoundaryConditionT::g
groupOfElements * g
Definition: thermicSolver.h:41
LagrangeMultiplierFieldT::LagrangeMultiplierFieldT
LagrangeMultiplierFieldT()
Definition: thermicSolver.h:27
dofManager.h
LagrangeMultiplierFieldT::_tau
double _tau
Definition: thermicSolver.h:25
neumannBCT::neumannBCT
neumannBCT()
Definition: thermicSolver.h:52
thermicSolver::LagrangeMultiplierFields
std::vector< LagrangeMultiplierFieldT > LagrangeMultiplierFields
Definition: thermicSolver.h:65
thermicSolver::changeLMTau
void changeLMTau(int tag, double tau)
Definition: thermicSolver.cpp:71
BoundaryConditionT
Definition: thermicSolver.h:37
BoundaryConditionT::onWhat
location onWhat
Definition: thermicSolver.h:40
thermicField
Definition: thermicSolver.h:30
simpleFunction.h
thermicSolver::setThermicDomain
void setThermicDomain(int phys, double k)
Definition: thermicSolver.cpp:62
thermicSolver::computeLagNorm
double computeLagNorm(int tag, simpleFunction< double > *f)
Definition: thermicSolver.cpp:229
thermicField::_tag
int _tag
Definition: thermicSolver.h:31
thermicSolver::pAssembler
dofManager< double > * pAssembler
Definition: thermicSolver.h:59
thermicSolver::solve
void solve()
Definition: thermicSolver.cpp:40
BoundaryConditionT::BoundaryConditionT
BoundaryConditionT()
Definition: thermicSolver.h:42
thermicSolver::thermicFields
std::vector< thermicField > thermicFields
Definition: thermicSolver.h:64
BoundaryConditionT::_tag
int _tag
Definition: thermicSolver.h:38
FunctionSpace< double >
LagrangeMultiplierFieldT::g
groupOfElements * g
Definition: thermicSolver.h:24
thermicSolver::thermicSolver
thermicSolver(int tag)
Definition: thermicSolver.h:72
dirichletBCT::dirichletBCT
dirichletBCT()
Definition: thermicSolver.h:47
thermicSolver::allNeumann
std::vector< neumannBCT > allNeumann
Definition: thermicSolver.h:67
thermicSolver::setFaceTemp
void setFaceTemp(int face, simpleFunction< double > *f)
Definition: thermicSolver.cpp:101
functionSpace.h
linearSystem
Definition: linearSystem.h:38
thermicSolver::LagSpace
FunctionSpace< double > * LagSpace
Definition: thermicSolver.h:60
thermicSolver::setLagrangeMultipliers
void setLagrangeMultipliers(int phys, double tau, int tag, simpleFunction< double > *f)
Definition: thermicSolver.cpp:80
LagrangeMultiplierFieldT
Definition: thermicSolver.h:22