From 66941e2e6717d7944687d85e4234387f8681c1db Mon Sep 17 00:00:00 2001
From: Joern Behrens <joern.behrens@uni-hamburg.de>
Date: Sun, 6 Mar 2022 19:40:32 +0100
Subject: [PATCH] corrected lat determination and spherical correction

---
 flash2d/src/options-sphere/ADV_wind_stacked.f90   |  4 ----
 flash2d/src/options-sphere/SLM_simple_stacked.f90 | 10 +++++++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/flash2d/src/options-sphere/ADV_wind_stacked.f90 b/flash2d/src/options-sphere/ADV_wind_stacked.f90
index a50e3bd..af2458c 100644
--- a/flash2d/src/options-sphere/ADV_wind_stacked.f90
+++ b/flash2d/src/options-sphere/ADV_wind_stacked.f90
@@ -535,10 +535,6 @@
           END IF
         END IF
       END DO determine_lat
-      IF(REAL(r_lat(i_lat),GRID_SR) .LT. r_coord(2)) THEN
-        i_loy = i_lat-1
-        i_hiy = i_lat
-      END IF
       
 
 !---------- calculate weights for bilinear interpolation
diff --git a/flash2d/src/options-sphere/SLM_simple_stacked.f90 b/flash2d/src/options-sphere/SLM_simple_stacked.f90
index 6b9ce24..9b7677c 100644
--- a/flash2d/src/options-sphere/SLM_simple_stacked.f90
+++ b/flash2d/src/options-sphere/SLM_simple_stacked.f90
@@ -512,12 +512,16 @@
 !---------- calculate Euklidean norm
 
       r_e  = eukl_norm(r_displ)
-      r_rat= r_e/ GRID_RADIUS
+      zero_wind: IF(r_e .LT. GRID_eps) THEN
+        r_corct= r_displ
+      ELSE zero_wind      
+        r_rat= r_e/ GRID_RADIUS
 
 !---------- calculate correction
 
-      r_c  = tan(r_rat)/r_rat
-      r_corct= r_displ* r_c
+        r_c  = tan(r_rat)/r_rat
+        r_corct= r_displ* r_c
+      END IF zero_wind
 
       RETURN
       END FUNCTION sphere_correct
-- 
GitLab