FEMTIC
ObservedDataStationApparentResistivityAndPhase.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_APPARENT_RESISTIVITY_AND_PHASE
25 #define DBLDEF_OBSERVED_DATA_APPARENT_RESISTIVITY_AND_PHASE
26 
27 #include <vector>
28 #include <complex>
29 
30 #include "Forward3D.h"
31 #include "ObservedDataStationMT.h"
32 #include "CommonParameters.h"
33 #include "MeshDataTetraElement.h"
34 
35 // Observed data of apparent resistivity and phase station
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  // Apparent resistivity is ignored for all frequencies
74  bool isApparentResistivityIgnoredForAllFrequencies( const int iComp ) const;
75 
76  private:
77 
86 
91  double* m_PhaseXXSD;
92  double* m_PhaseXYSD;
93  double* m_PhaseYXSD;
94  double* m_PhaseYYSD;
95 
104 
113 
122 
123  // Calculate log 10 error of apparent resistivity
124  double calcLog10ErrorOfApparentResistivity( const int freqIDGlobalInSta, const int iComp ) const;
125 
126  // Determine whether to use impedance tensor instead of phase by checking sign differece of real part of impedance tensor
127  bool isUsedImpedanceTensor( const double phaseObs, const double phaseError, const double phaseCalc ) const;
128 
129  // Determine whether to use impedance tensor instead of phase by checking sign differece of real part of impedance tensor from frequeny IDs
130  bool isUsedImpedanceTensorFromFreqIDs( const int freqIDThisPEInSta, const int iComp ) const;
131 
132  // Copy constructer
134 
135  // Copy assignment operator
137 };
138 #endif
Definition: ObservedDataStationApparentResistivityAndPhase.h:36
int * m_dataIDOfPhaseYY
Definition: ObservedDataStationApparentResistivityAndPhase.h:121
double * m_PhaseYXObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:84
void outputCalculatedValues() const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:824
double calcLog10ErrorOfApparentResistivity(const int freqIDGlobalInSta, const int iComp) const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:1977
double * m_apparentResistivityYYResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:108
int * m_dataIDOfApparentResistivityXX
Definition: ObservedDataStationApparentResistivityAndPhase.h:114
double * m_apparentResistivityYYObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:81
double * m_PhaseXXCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:100
ObservedDataStationApparentResistivityAndPhase(const ObservedDataStationApparentResistivityAndPhase &rhs)
double * m_PhaseXYSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:92
int * m_dataIDOfApparentResistivityXY
Definition: ObservedDataStationApparentResistivityAndPhase.h:115
~ObservedDataStationApparentResistivityAndPhase()
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:85
double * m_apparentResistivityXXResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:105
int * m_dataIDOfPhaseXX
Definition: ObservedDataStationApparentResistivityAndPhase.h:118
double * m_PhaseXYCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:101
double * m_apparentResistivityYXSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:89
double * m_apparentResistivityYYCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:99
double * m_PhaseXXResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:109
ObservedDataStationApparentResistivityAndPhase & operator=(const ObservedDataStationApparentResistivityAndPhase &rhs)
void inputObservedData(std::ifstream &inFile)
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:288
double * m_apparentResistivityXYResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:106
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: ObservedDataStationApparentResistivityAndPhase.cpp:873
bool isApparentResistivityIgnoredForAllFrequencies(const int iComp) const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:1934
void allocateMemoryForCalculatedValues()
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:642
ObservedDataStationApparentResistivityAndPhase()
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:41
double * m_PhaseYXCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:102
int * m_dataIDOfPhaseXY
Definition: ObservedDataStationApparentResistivityAndPhase.h:119
double * m_apparentResistivityYXCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:98
double * m_apparentResistivityYXObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:80
double * m_apparentResistivityXXCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:96
int * m_dataIDOfApparentResistivityYY
Definition: ObservedDataStationApparentResistivityAndPhase.h:117
void calculateApparentResistivityAndPhase(const double freq, const ObservedDataStationPoint *const ptrStationOfMagneticField, int &icount)
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:469
double * m_PhaseYYObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:85
double * m_apparentResistivityXYSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:88
double * m_PhaseXXSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:91
double * m_apparentResistivityYXResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:107
double * m_apparentResistivityXYObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:79
double * m_PhaseYXResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:111
double * m_PhaseYYResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:112
void initializeApparentResistivityPhaseAndErrors()
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:617
double * m_apparentResistivityXYCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:97
double * m_PhaseXYObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:83
double * m_PhaseXYResidual
Definition: ObservedDataStationApparentResistivityAndPhase.h:110
int * m_dataIDOfPhaseYX
Definition: ObservedDataStationApparentResistivityAndPhase.h:120
bool isUsedImpedanceTensor(const double phaseObs, const double phaseError, const double phaseCalc) const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:2006
int * m_dataIDOfApparentResistivityYX
Definition: ObservedDataStationApparentResistivityAndPhase.h:116
double * m_PhaseYYSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:94
double calculateErrorSumOfSquaresThisPE() const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:1916
double * m_apparentResistivityXXObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:78
double * m_PhaseYXSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:93
void calculateResidualVectorOfDataThisPE(const double freq, const int offset, double *vector) const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:1839
double * m_PhaseYYCalculated
Definition: ObservedDataStationApparentResistivityAndPhase.h:103
bool isUsedImpedanceTensorFromFreqIDs(const int freqIDThisPEInSta, const int iComp) const
Definition: ObservedDataStationApparentResistivityAndPhase.cpp:2019
double * m_apparentResistivityYYSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:90
double * m_PhaseXXObserved
Definition: ObservedDataStationApparentResistivityAndPhase.h:82
double * m_apparentResistivityXXSD
Definition: ObservedDataStationApparentResistivityAndPhase.h:87
Definition: ObservedDataStationMT.h:36
Definition: ObservedDataStationPoint.h:33