Commit 4bada636 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

ART FindEigenrays

-use reduced resolution for spreading loss if direction is close to pole to avoid numerical erros
parent c3db79a9
...@@ -239,9 +239,14 @@ void EigenraySearch::CAdaptiveWorker::CalculateEigenraySpreadingLoss(const ITAGe ...@@ -239,9 +239,14 @@ void EigenraySearch::CAdaptiveWorker::CalculateEigenraySpreadingLoss(const ITAGe
const double zReceiver = std::abs( m_pMinDistanceRay->back().position[Vista::Z] ); const double zReceiver = std::abs( m_pMinDistanceRay->back().position[Vista::Z] );
const VistaVector3D& nReceiver = m_pMinDistanceRay->back().wavefrontNormal; const VistaVector3D& nReceiver = m_pMinDistanceRay->back().wavefrontNormal;
if (m_adaptiveRayGrid.MaxAngularResolution() > m_rayAdaptationSettings.accuracy.maxAngleForGeomSpreading || !m_adaptiveRayGrid.Is2D()) if (m_adaptiveRayGrid.MaxDeltaTheta() > m_rayAdaptationSettings.accuracy.maxAngleForGeomSpreading || !m_adaptiveRayGrid.Is2D())
{ {
m_adaptiveRayGrid.ZoomIntoRay(m_pMinDistanceRay, m_rayAdaptationSettings.accuracy.maxAngleForGeomSpreading, m_rayAdaptationSettings.accuracy.maxAngleForGeomSpreading); double dTheta = 180/M_PI * std::acos( nRef[Vista::Z] );
double dDeltaPhi = m_rayAdaptationSettings.accuracy.maxAngleForGeomSpreading;
if (dTheta < 1 || dTheta > 179) //Close to pole
dDeltaPhi *= 10;
m_adaptiveRayGrid.ZoomIntoRay(m_pMinDistanceRay, m_rayAdaptationSettings.accuracy.maxAngleForGeomSpreading, dDeltaPhi);
auto tmpSimulationEngine = Simulation::CEngine( std::make_shared<Simulation::CAbortAtMaxTime>(time) ); auto tmpSimulationEngine = Simulation::CEngine( std::make_shared<Simulation::CAbortAtMaxTime>(time) );
tmpSimulationEngine.settings = m_simulationEngine.settings; tmpSimulationEngine.settings = m_simulationEngine.settings;
tmpSimulationEngine.Run(atmosphere, m_adaptiveRayGrid.NewRaysOfLastAdaptation()); tmpSimulationEngine.Run(atmosphere, m_adaptiveRayGrid.NewRaysOfLastAdaptation());
......
...@@ -181,9 +181,11 @@ void TestSpecialSpreadingLossCase() //In these case, there was a bug with the sp ...@@ -181,9 +181,11 @@ void TestSpecialSpreadingLossCase() //In these case, there was a bug with the sp
//It seems that there is a numerical cancellation during calculation of wavefront surface at the receiver: S = 0 => loss = inf //It seems that there is a numerical cancellation during calculation of wavefront surface at the receiver: S = 0 => loss = inf
const VistaVector3D sourcePosition = VistaVector3D(-20.3577849403681, 100, 1022.15620755078); const VistaVector3D sourcePosition = VistaVector3D(-20.3577849403681, 100, 1022.15620755078);
const VistaVector3D receiverPosition = VistaVector3D(17.5, 100, 1); const VistaVector3D receiverPosition = VistaVector3D(17.5, 100, 1);
engine.eigenraySettings.rayAdaptation.accuracy.maxAngleForGeomSpreading = 0.02; engine.eigenraySettings.rayAdaptation.accuracy.maxAngleForGeomSpreading = 0.01;
std::vector<std::shared_ptr<CRay>> eigenrays = engine.Run(atmosphere, sourcePosition, receiverPosition); std::vector<std::shared_ptr<CRay>> eigenrays = engine.Run(atmosphere, sourcePosition, receiverPosition);
if ( std::isinf(eigenrays[0]->SpreadingLoss()) )
std::cout << "Error in spreading loss calculation: Inf value found." << std::endl;
} }
...@@ -194,15 +196,15 @@ int main(int iNumInArgs, char* pcInArgs[]) ...@@ -194,15 +196,15 @@ int main(int iNumInArgs, char* pcInArgs[])
TestSpecialSpreadingLossCase(); TestSpecialSpreadingLossCase();
//TestSourceReceiverAzimuthAbove324Deg(); TestSourceReceiverAzimuthAbove324Deg();
const CStratifiedAtmosphere homAtmosphere = GetHomogeneousAtmosphere(); const CStratifiedAtmosphere homAtmosphere = GetHomogeneousAtmosphere();
const CStratifiedAtmosphere inhomAtmosphere = GetInhomogeneousAtmosphere(); const CStratifiedAtmosphere inhomAtmosphere = GetInhomogeneousAtmosphere();
//TestSourceAtGround(inhomAtmosphere, "Inhomogeneous"); TestSourceAtGround(inhomAtmosphere, "Inhomogeneous");
//TestReceiverNearGroundSourceElevation(homAtmosphere, "Homogeneous"); TestReceiverNearGroundSourceElevation(homAtmosphere, "Homogeneous");
//TestReceiverNearGroundSourceElevation(inhomAtmosphere, "Inhomogeneous"); TestReceiverNearGroundSourceElevation(inhomAtmosphere, "Inhomogeneous");
//TestReceiverNearGroundSourceAzimuth(inhomAtmosphere, "Inhomogeneous"); TestReceiverNearGroundSourceAzimuth(inhomAtmosphere, "Inhomogeneous");
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment