00001
00002
00003
00004
00005
00006
00007 #ifndef QCAD_POISSONSOURCE_HPP
00008 #define QCAD_POISSONSOURCE_HPP
00009
00010 #include "Phalanx_ConfigDefs.hpp"
00011 #include "Phalanx_Evaluator_WithBaseImpl.hpp"
00012 #include "Phalanx_Evaluator_Derived.hpp"
00013 #include "Phalanx_MDField.hpp"
00014
00015 #include "Teuchos_ParameterList.hpp"
00016 #include "Epetra_Vector.h"
00017 #include "Sacado_ParameterAccessor.hpp"
00018 #include "Stokhos_KL_ExponentialRandomField.hpp"
00019 #include "Teuchos_Array.hpp"
00020
00021 #include "Albany_Layouts.hpp"
00022
00023 #include "QCAD_MaterialDatabase.hpp"
00024 #include "QCAD_MeshRegion.hpp"
00025 #include "QCAD_EvaluatorTools.hpp"
00026
00027 namespace QCAD {
00031 template<typename EvalT, typename Traits>
00032 class PoissonSource :
00033 public PHX::EvaluatorWithBaseImpl<Traits>,
00034 public PHX::EvaluatorDerived<EvalT, Traits>,
00035 public Sacado::ParameterAccessor<EvalT, SPL_Traits>,
00036 public EvaluatorTools<EvalT, Traits>
00037 {
00038 public:
00039 typedef typename EvalT::ScalarT ScalarT;
00040 typedef typename EvalT::MeshScalarT MeshScalarT;
00041
00042 PoissonSource(Teuchos::ParameterList& p,
00043 const Teuchos::RCP<Albany::Layouts>& dl);
00044
00045 void postRegistrationSetup(typename Traits::SetupData d,
00046 PHX::FieldManager<Traits>& vm);
00047
00048 void evaluateFields(typename Traits::EvalData d);
00049
00051 ScalarT& getValue(const std::string &n);
00052
00054
00055 static const double kbBoltz;
00056 static const double eps0;
00057 static const double eleQ;
00058 static const double m0;
00059 static const double hbar;
00060 static const double pi;
00061 static const double MAX_EXPONENT;
00062
00063 private:
00064
00066 Teuchos::RCP<const Teuchos::ParameterList>
00067 getValidPoissonSourceParameters() const;
00068
00070 void evaluateFields_elementblocks(typename Traits::EvalData workset);
00071 void evaluateFields_default(typename Traits::EvalData workset);
00072 void evaluateFields_moscap1d(typename Traits::EvalData workset);
00073
00075
00076 struct PoissonSourceSetupInfo;
00077 PoissonSourceSetupInfo source_setup(const std::string& sourceName, const std::string& mtrlCategory,
00078 const typename Traits::EvalData workset);
00079 void source_semiclassical(const typename Traits::EvalData workset, std::size_t cell, std::size_t qp,
00080 const ScalarT& scaleFactor, const PoissonSourceSetupInfo& setup_info);
00081 void source_none (const typename Traits::EvalData workset, std::size_t cell, std::size_t qp,
00082 const ScalarT& scaleFactor, const PoissonSourceSetupInfo& setup_info);
00083 void source_quantum (const typename Traits::EvalData workset, std::size_t cell, std::size_t qp,
00084 const ScalarT& scaleFactor, const PoissonSourceSetupInfo& setup_info);
00085 void source_coulomb (const typename Traits::EvalData workset, std::size_t cell, std::size_t qp,
00086 const ScalarT& scaleFactor, const PoissonSourceSetupInfo& setup_info);
00087 void source_testcoulomb (const typename Traits::EvalData workset, std::size_t cell, std::size_t qp,
00088 const ScalarT& scaleFactor, const PoissonSourceSetupInfo& setup_info);
00089
00090
00092
00094 inline ScalarT computeMBStat(const ScalarT x);
00095
00097 inline ScalarT computeFDIntOneHalf(const ScalarT x);
00098
00100 inline ScalarT computeZeroKFDInt(const ScalarT x);
00101
00103 inline ScalarT computeZeroStat(const ScalarT x);
00104
00105
00107
00109 inline ScalarT fullDopants(const std::string dopType, const ScalarT &x);
00110
00112 ScalarT ionizedDopants(const std::string dopType, const ScalarT &x);
00113
00114
00116
00118 ScalarT eDensityForPoissonSchrodinger(typename Traits::EvalData workset, std::size_t cell,
00119 std::size_t qp, const ScalarT prevPhi, const bool bUsePredCorr, const double Ef, const double fixedOcc);
00120
00121 ScalarT eDensityForPoissonCI(typename Traits::EvalData workset, std::size_t cell,
00122 std::size_t qp, const ScalarT prevPhi, const bool bUsePredCorr, const double Ef, const double fixedOcc);
00123
00124
00126
00128 void source_pointcharges(typename Traits::EvalData workset);
00129
00131 bool pointIsInTetrahedron(const MeshScalarT* cellVertices, const MeshScalarT* position, int nVertices);
00132
00134 bool pointIsInHexahedron(const MeshScalarT* cellVertices, const MeshScalarT* position, int nVertices);
00135
00137 bool pointIsInPolygon(const MeshScalarT* cellVertices, const MeshScalarT* position, int nVertices);
00138
00140 MeshScalarT determinant(const MeshScalarT** mx, int N);
00141
00143 bool sameSideOfPlane(const MeshScalarT* plane0, const MeshScalarT* plane1, const MeshScalarT* plane2,
00144 const MeshScalarT* ptA, const MeshScalarT* ptB);
00145
00146
00148
00151 ScalarT computeFDIntMinusOneHalf(const ScalarT x);
00152
00154 ScalarT computeVxcLDA(const double& relPerm, const double& effMass,
00155 const ScalarT& eDensity);
00156
00157 ScalarT getCellScaleFactor(std::size_t cell, const std::vector<bool>& bEBInRegion, ScalarT init_factor);
00158
00159 ScalarT getReferencePotential(typename Traits::EvalData workset);
00160
00161
00162
00163
00164
00166 std::size_t numQPs;
00167 std::size_t numDims;
00168 std::size_t numNodes;
00169 PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec;
00170 PHX::MDField<MeshScalarT,Cell,Vertex,Dim> coordVecAtVertices;
00171 PHX::MDField<MeshScalarT,Cell,QuadPoint> weights;
00172 PHX::MDField<ScalarT,Cell,QuadPoint> potential;
00173 PHX::MDField<ScalarT,Dim> temperatureField;
00174
00176 PHX::MDField<ScalarT,Cell,QuadPoint> poissonSource;
00177 PHX::MDField<ScalarT,Cell,QuadPoint> chargeDensity;
00178 PHX::MDField<ScalarT,Cell,QuadPoint> electronDensity;
00179 PHX::MDField<ScalarT,Cell,QuadPoint> artCBDensity;
00180 PHX::MDField<ScalarT,Cell,QuadPoint> holeDensity;
00181 PHX::MDField<ScalarT,Cell,QuadPoint> electricPotential;
00182 PHX::MDField<ScalarT,Cell,QuadPoint> ionizedDopant;
00183 PHX::MDField<ScalarT,Cell,QuadPoint> conductionBand;
00184 PHX::MDField<ScalarT,Cell,QuadPoint> valenceBand;
00185 PHX::MDField<ScalarT,Cell,QuadPoint> approxQuanEDen;
00186
00188 ScalarT factor;
00189
00191 ScalarT temperatureName;
00192
00194 std::string device;
00195
00197 std::string nonQuantumRegionSource;
00198 std::string quantumRegionSource;
00199 ScalarT sourceEvecInds[2], prevDensityMixingFactor;
00200 bool imagPartOfCoulombSrc;
00201
00203 std::string carrierStatistics;
00204 std::string incompIonization;
00205
00207 double dopingDonor;
00208 double dopingAcceptor;
00209
00211 double donorActE;
00212 double acceptorActE;
00213
00215 double length_unit_in_m;
00216 double energy_unit_in_eV;
00217
00218
00219
00221 std::vector< Teuchos::RCP<MeshRegion<EvalT, Traits> > > meshRegionList;
00222 std::vector< ScalarT > meshRegionFactors;
00223
00225 struct PointCharge { MeshScalarT position[3]; double charge; int iWorkset, iCell; };
00226 std::vector< PointCharge > pointCharges;
00227 std::size_t numWorksetsScannedForPtCharges;
00228
00230 bool bUsePredictorCorrector;
00231 bool bIncludeVxc;
00232 bool bRealEigenvectors;
00233 int nEigenvectors;
00234 double fixedQuantumOcc;
00235 std::vector< PHX::MDField<ScalarT,Cell,QuadPoint> > eigenvector_Re;
00236 std::vector< PHX::MDField<ScalarT,Cell,QuadPoint> > eigenvector_Im;
00237
00239 Teuchos::RCP<QCAD::MaterialDatabase> materialDB;
00240
00242 std::map<std::string, ScalarT > materialParams;
00243
00245 double oxideWidth;
00246 double siliconWidth;
00247
00249 std::map<std::string, double> mapDBCValue_eb;
00250 std::map<std::string, double> mapDBCValue_ns;
00251
00252
00253 struct PoissonSourceSetupInfo
00254 {
00255 ScalarT qPhiRef;
00256 ScalarT Lambda2;
00257 ScalarT V0;
00258 ScalarT kbT;
00259 double Chi;
00260
00261
00262 double fermiE;
00263 ScalarT eArgOffset, hArgOffset;
00264
00265
00267 ScalarT Nc;
00268 ScalarT Nv;
00269 ScalarT Eg;
00270
00272 std::string fixedChargeType;
00273 ScalarT dopingConc, fixedChargeConc;
00274 ScalarT inArg;
00275
00276
00277 Albany::MDArray prevPhiArray;
00278
00279
00280 double prevDensityFactor;
00281 Albany::MDArray prevDensityArray;
00282
00283
00284 int sourceEvec1, sourceEvec2;
00285 ScalarT coulombPrefactor;
00286
00287
00288 double averagedEffMass;
00289 double relPerm;
00290
00292 ScalarT (QCAD::PoissonSource<EvalT,Traits>::*carrStat) (const ScalarT);
00293
00295 ScalarT (QCAD::PoissonSource<EvalT,Traits>::*ionDopant) (const std::string, const ScalarT&);
00296
00298 ScalarT (QCAD::PoissonSource<EvalT,Traits>::*quantum_edensity_fn)
00299 (typename Traits::EvalData, std::size_t, std::size_t, const ScalarT, const bool, const double, const double);
00300 };
00301
00302 };
00303
00304 }
00305
00306 #endif