FEMTIC
ObservedDataStationNMT2ApparentResistivityAndPhase.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------------
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2021 Yoshiya Usui
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //-------------------------------------------------------------------------------------------------------
24 #ifndef DBLDEF_OBSERVED_DATA_NMT2_APPARENT_RESISTIVITY_AND_PHASE
25 #define DBLDEF_OBSERVED_DATA_NMT2_APPARENT_RESISTIVITY_AND_PHASE
26 
27 #include <vector>
28 #include <complex>
29 
30 #include "Forward3D.h"
32 #include "CommonParameters.h"
33 #include "MeshDataTetraElement.h"
34 
35 // Observed data of apparent resistivity and phase of NMT station ( triangle area )
37  public:
38 
39  // Constructer
41 
42  // Destructer
44 
45  // Read data from input file
46  void inputObservedData( std::ifstream& inFile );
47 
48  // Calulate Impedance tensor
49  void calculateApparentResistivityAndPhase( const double freq, const ObservedDataStationPoint* const ptrStationOfMagneticField, int& icount );
50 
51  // Initialize apparent resistivitu, phase and their errors
53 
54  // Allocate memory for the apparent resistivity, phase and their errors
56 
57  // Output calculated apparent resistivity and phase
58  void outputCalculatedValues() const;
59 
60  // Calulate sensitivity matrix of apparent resistivity and phase
61  void calculateSensitivityMatrix( const double freq, const int nModel,
62  const ObservedDataStationPoint* const ptrStationOfMagneticField,
63  const std::complex<double>* const derivativesOfEMFieldExPol,
64  const std::complex<double>* const derivativesOfEMFieldEyPol,
65  double* const sensitivityMatrix ) const;
66 
67  // Calculate data vector of this PE
68  void calculateResidualVectorOfDataThisPE( const double freq, const int offset, double* vector ) const;
69 
70  // Calulate sum of square of misfit
71  double calculateErrorSumOfSquaresThisPE() const;
72 
73  private:
74 
83 
88  double* m_PhaseXXSD;
89  double* m_PhaseXYSD;
90  double* m_PhaseYXSD;
91  double* m_PhaseYYSD;
92 
101 
110 
119 
120  // Calculate log 10 error of apparent resistivity
121  double calcLog10ErrorOfApparentResistivity( const int freqIDGlobalInSta, const int iComp ) const;
122 
123  // Determine whether to use impedance tensor instead of phase by checking sign differece of real part of impedance tensor
124  bool isUsedImpedanceTensor( const double phaseObs, const double phaseError, const double phaseCalc ) const;
125 
126  // Determine whether to use impedance tensor instead of phase by checking sign differece of real part of impedance tensor from frequeny IDs
127  bool isUsedImpedanceTensorFromFreqIDs( const int freqIDThisPEInSta, const int iComp ) const;
128 
129  // Copy constructer
131 
132  // Copy assignment operator
134 };
135 
136 #endif
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:36
void outputCalculatedValues() const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:729
double * m_PhaseYXObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:81
void inputObservedData(std::ifstream &inFile)
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:289
void calculateSensitivityMatrix(const double freq, const int nModel, const ObservedDataStationPoint *const ptrStationOfMagneticField, const std::complex< double > *const derivativesOfEMFieldExPol, const std::complex< double > *const derivativesOfEMFieldEyPol, double *const sensitivityMatrix) const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:779
int * m_dataIDOfApparentResistivityXY
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:112
~ObservedDataStationNMT2ApparentResistivityAndPhase()
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:84
double * m_apparentResistivityXYCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:94
ObservedDataStationNMT2ApparentResistivityAndPhase(const ObservedDataStationNMT2ApparentResistivityAndPhase &rhs)
void initializeApparentResistivityPhaseAndErrors()
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:518
double * m_PhaseXYObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:80
double * m_PhaseYYResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:109
void calculateResidualVectorOfDataThisPE(const double freq, const int offset, double *vector) const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:894
double * m_apparentResistivityXXCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:93
double * m_PhaseYXCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:99
double * m_apparentResistivityYYCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:96
double * m_apparentResistivityXYResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:103
double * m_apparentResistivityXYSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:85
bool isUsedImpedanceTensorFromFreqIDs(const int freqIDThisPEInSta, const int iComp) const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:998
double * m_apparentResistivityYXObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:77
double * m_apparentResistivityYXSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:86
double * m_PhaseXXResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:106
double * m_PhaseYYObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:82
double * m_apparentResistivityYXCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:95
int * m_dataIDOfPhaseXX
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:115
int * m_dataIDOfPhaseYY
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:118
int * m_dataIDOfApparentResistivityYX
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:113
double * m_PhaseXYSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:89
double * m_apparentResistivityXXSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:84
void calculateApparentResistivityAndPhase(const double freq, const ObservedDataStationPoint *const ptrStationOfMagneticField, int &icount)
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:409
double * m_apparentResistivityYYSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:87
int * m_dataIDOfApparentResistivityXX
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:111
double * m_apparentResistivityYYObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:78
double * m_PhaseXXSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:88
int * m_dataIDOfApparentResistivityYY
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:114
int * m_dataIDOfPhaseYX
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:117
double calcLog10ErrorOfApparentResistivity(const int freqIDGlobalInSta, const int iComp) const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:961
double * m_PhaseXXCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:97
double * m_apparentResistivityYYResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:105
double * m_PhaseYYCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:100
double * m_PhaseYXSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:90
double * m_PhaseXYCalculated
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:98
double * m_PhaseYYSD
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:91
ObservedDataStationNMT2ApparentResistivityAndPhase & operator=(const ObservedDataStationNMT2ApparentResistivityAndPhase &rhs)
bool isUsedImpedanceTensor(const double phaseObs, const double phaseError, const double phaseCalc) const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:985
double * m_PhaseYXResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:108
double * m_PhaseXYResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:107
double * m_PhaseXXObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:79
ObservedDataStationNMT2ApparentResistivityAndPhase()
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:38
void allocateMemoryForCalculatedValues()
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:545
double * m_apparentResistivityXXObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:75
double * m_apparentResistivityXXResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:102
double * m_apparentResistivityYXResidual
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:104
int * m_dataIDOfPhaseXY
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:116
double calculateErrorSumOfSquaresThisPE() const
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.cpp:941
double * m_apparentResistivityXYObserved
Definition: ObservedDataStationNMT2ApparentResistivityAndPhase.h:76
Definition: ObservedDataStationNMT2.h:37
Definition: ObservedDataStationPoint.h:33