123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
-
-
-
-
-
- #ifndef KERNELV0_INC
- #define KERNELV0_INC
-
- #pragma once
- #include "MerlinObject.h"
- #include "LayeredEarthEM.h"
- #include "PolygonalWireAntenna.h"
- #include "EMEarth1D.h"
-
- #include "ProgressBar.h"
-
- #ifdef LEMMAUSEVTK
-
-
-
-
- #include "vtkCellData.h"
- #include "vtkPointData.h"
- #include "vtkHyperTree.h"
- #include "vtkHyperTree.h"
- #include "vtkHyperTreeGrid.h"
- #include "vtkXMLHyperTreeGridWriter.h"
- #include "vtkHyperTreeCursor.h"
- #ifdef LEMMA_VTK9_SUPPORT
- #include "vtkHyperTreeGridNonOrientedCursor.h"
- #endif
-
- #include "vtkDoubleArray.h"
- #endif
-
- namespace Lemma {
-
-
-
- struct EllipticB {
- Real alpha;
- Real beta;
- Real zeta;
-
- Complex eizt;
-
- Vector3r bhat;
- Vector3r bhatp;
-
- };
-
- template <typename T> int sgn(T val) {
- return (val > T(0)) - (val < T(0));
- }
-
-
-
- class KernelV0 : public MerlinObject {
-
- friend std::ostream &operator<<(std::ostream &stream, const KernelV0 &ob);
-
- protected:
-
-
-
- public:
-
-
-
-
-
- explicit KernelV0 ( const ctor_key& );
-
-
-
- KernelV0 ( const YAML::Node& node, const ctor_key& );
-
-
-
- virtual ~KernelV0 ();
-
-
-
- virtual YAML::Node Serialize() const;
-
-
-
- static std::shared_ptr< KernelV0 > NewSP();
-
-
-
- static std::shared_ptr<KernelV0> DeSerialize(const YAML::Node& node);
-
-
-
- static std::shared_ptr<KernelV0> DeSerialize( const std::string& node ) {
- return KernelV0::DeSerialize(YAML::LoadFile(node));
- }
-
-
-
-
-
-
-
- void CalculateK0 (const std::vector< std::string >& tx, const std::vector< std::string >& rx,
- bool vtkOutput );
-
-
-
-
- void AlignWithAkvoDataset( const YAML::Node& node ) ;
-
-
-
- void AlignWithAkvoDataset( const std::string& file ) {
- AlignWithAkvoDataset( YAML::LoadFile(file) );
- }
-
-
-
- inline void PushCoil( const std::string& label, std::shared_ptr<PolygonalWireAntenna> ant ) {
- TxRx[label] = ant;
- }
-
-
-
-
- inline std::shared_ptr<LayeredEarthEM> GetSigmaModel ( ) {
- return SigmaModel;
- }
-
-
-
- inline MatrixXcr GetKernel ( ) {
- return Kern;
- }
-
-
-
- inline Real GetTolerance ( ) {
- return tol;
- }
-
-
-
- inline VectorXr GetInterfaces ( ) {
- return Interfaces;
- }
-
-
-
- inline VectorXr GetPulseCurrent ( ) {
- return PulseI;
- }
-
-
-
- inline void SetLayeredEarthEM ( std::shared_ptr< LayeredEarthEM > value ) {
- SigmaModel = value;
- return ;
- }
-
-
-
- inline void SetIntegrationSize ( const Vector3r& size ) {
- Size = size;
- return ;
- }
-
-
-
- inline void SetHankelTransformType ( const HANKELTRANSFORMTYPE& type ) {
- HankelType = type;
- return ;
- }
-
-
-
-
- inline void SetMinLevel ( const int& min ) {
- minLevel = min;
- return ;
- }
-
-
-
- inline void SetMaxLevel ( const int& max ) {
- maxLevel = max;
- return ;
- }
-
-
-
- inline void SetIntegrationOrigin ( const Vector3r& origin ) {
- Origin = origin;
- return ;
- }
-
-
-
- inline void SetPulseCurrent ( const VectorXr& Amps ) {
- PulseI = Amps;
- return ;
- }
-
-
-
- inline void SetTemperature(const Real& tempK) {
- Temperature = tempK;
- }
-
-
-
- inline void SetTolerance(const Real& ttol) {
- tol = ttol;
- }
-
-
-
- inline void SetPulseDuration(const Real& taup) {
- Taup = taup;
- }
-
- inline Real GetPulseDuration( ) {
- return Taup;
- }
-
- inline void SetDepthLayerInterfaces( const VectorXr& iface ){
- Interfaces = iface;
- }
-
-
-
- virtual inline std::string GetName() const {
- return CName;
- }
-
- protected:
-
-
-
-
- KernelV0( const KernelV0& ) = delete;
-
- private:
-
-
-
- VectorXcr f( const Vector3r& r, const Real& volume , const Vector3cr& Ht, const Vector3cr& Hr);
-
-
-
-
-
- EllipticB EllipticFieldRep (const Vector3cr& B, const Vector3r& B0hat);
-
- Vector3r ComputeMn0(const Real& Porosity, const Vector3r& B0);
-
- void IntegrateOnOctreeGrid( bool vtkOutput=false );
-
-
-
- void EvaluateKids( const Vector3r& size, const int& level, const Vector3r& cpos,
- const VectorXcr& parentVal );
-
- #ifdef LEMMAUSEVTK
-
-
- #ifdef LEMMA_VTK8_SUPPORT
- void EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
- const VectorXcr& parentVal, vtkHyperTreeGrid* octree, vtkHyperTreeCursor* curse );
- #elif LEMMA_VTK9_SUPPORT
- void EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
- const VectorXcr& parentVal, vtkHyperTree* octree, vtkHyperTreeGridNonOrientedCursor* curse );
- #endif
-
- void GetPosition( vtkHyperTreeCursor* Cursor, Real* p );
- #endif
-
-
-
- int ilay;
- int nleaves;
- int minLevel=0;
- int maxLevel=12;
-
- Real VOLSUM;
- Real tol=1e-11;
- Real Temperature=283.;
- Real Taup = .020;
- Real Larmor;
-
- Vector3r Size;
- Vector3r Origin;
-
- VectorXr PulseI;
- VectorXr Interfaces;
-
- MatrixXcr Kern;
-
- HANKELTRANSFORMTYPE HankelType=ANDERSON801;
-
- std::shared_ptr< LayeredEarthEM > SigmaModel = nullptr;
- std::shared_ptr< FieldPoints > cpoints = nullptr;
-
- std::map< std::string , std::shared_ptr< PolygonalWireAntenna > > TxRx;
- std::map< std::string , std::shared_ptr< EMEarth1D > > EMEarths;
-
- #ifdef LEMMAUSEVTK
- std::map< int, VectorXcr > LeafDict;
- std::map< int, VectorXcr > LeafHt;
- std::map< int, VectorXcr > LeafHr;
- std::map< int, int > LeafDictIdx;
- std::map< int, Real > LeafDictErr;
- #endif
-
- ProgressBar* disp;
- int percent_done;
-
-
- static constexpr Real GAMMA = 2.67518e8;
- static constexpr Real INVSQRT2 = 0.70710678118654746;
- static constexpr Real HBAR = 1.05457148e-34;
- static constexpr Real NH2O = 6.692e28;
- static constexpr Real KB = 1.3805e-23;
- static constexpr Real CHI_N = 3.29e-3;
-
-
- static constexpr auto CName = "KernelV0";
-
- };
- }
-
-
-
-
- #endif
|