chombo-discharge
CD_FieldSolverImplem.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_FieldSolverImplem_H
13 #define CD_FieldSolverImplem_H
14 
15 // Our includes
16 #include <CD_FieldSolver.H>
17 #include <CD_NamespaceHeader.H>
18 
19 Real
20 FieldSolver::getDielectricPermittivity(const RealVect& a_pos) const
21 {
22  CH_TIME("FieldSolver::getDielectricPermittivity(RealVect a_pos)");
23 
24  const Vector<Dielectric>& dielectrics = m_computationalGeometry->getDielectrics();
25 
26  Real relPerm = 0.0;
27 
28  if (m_multifluidIndexSpace->numPhases() > 1 && dielectrics.size() > 0) {
29 
30  // Find the closest dielectric to position a_pos. This procedure might fail if
31  // the user has two overlapping dielectrics, but those cases are not supported
32  // anyways.
33  Real minDist = std::numeric_limits<Real>::infinity();
34  int closest = 0;
35 
36  for (int i = 0; i < dielectrics.size(); i++) {
37  const RefCountedPtr<BaseIF> func = dielectrics[i].getImplicitFunction();
38 
39  const Real curDist = func->value(a_pos);
40 
41  if (std::abs(curDist) <= std::abs(minDist)) {
42  minDist = curDist;
43  closest = i;
44  }
45  }
46 
47  relPerm = dielectrics[closest].getPermittivity(a_pos);
48  }
49 
50  CH_assert(dielectrics.size() > 0);
51  CH_assert(relPerm > 0.0);
52 
53  return relPerm;
54 }
55 
56 #include <CD_NamespaceFooter.H>
57 
58 #endif
Contains declaration of a base electrostatics solver class.
RefCountedPtr< MultiFluidIndexSpace > m_multifluidIndexSpace
Multifluid index space.
Definition: CD_FieldSolver.H:573
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry.
Definition: CD_FieldSolver.H:578
Real getDielectricPermittivity(const RealVect &a_pos) const
Get relative permittivity at some point in space.
Definition: CD_FieldSolverImplem.H:20