From fe9990d5ad94cf6ca41605ec985ced3335f3a0e8 Mon Sep 17 00:00:00 2001
From: Joern Behrens <joern.behrens@uni-hamburg.de>
Date: Thu, 10 Feb 2022 14:46:32 +0100
Subject: [PATCH] bug fixes in plotting, and initialization

---
 .../src/options-sphere/ADV_semilagrange_stacked.F90   |  8 ++++----
 flash2d/src/options-sphere/ADV_wind_stacked.f90       |  1 +
 flash2d/src/options-sphere/IO_vtu_stacked.F90         | 11 ++++++++---
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/flash2d/src/options-sphere/ADV_semilagrange_stacked.F90 b/flash2d/src/options-sphere/ADV_semilagrange_stacked.F90
index ea1c1ed..2972464 100644
--- a/flash2d/src/options-sphere/ADV_semilagrange_stacked.F90
+++ b/flash2d/src/options-sphere/ADV_semilagrange_stacked.F90
@@ -543,6 +543,10 @@
 
         CALL grid_createinitial(p_ghand, c_filename=p_param%io%c_triangfile)
 
+!---------- initialize wind field calculation
+
+        CALL slm_windinit(p_param)
+
 !---------- initialize grid and adapt at steep gradients
 
         i_cnt= 0
@@ -557,10 +561,6 @@
 
         CALL grid_timeduplicate(p_ghand(i_timeplus), p_ghand(i_time))
 
-!---------- initialize wind field calculation
-
-        CALL slm_windinit(p_param)
-
 !---------- if an old experiment is to be continued from stored data:
 
       ELSE new_experiment
diff --git a/flash2d/src/options-sphere/ADV_wind_stacked.f90 b/flash2d/src/options-sphere/ADV_wind_stacked.f90
index b1267a9..3ce8d14 100644
--- a/flash2d/src/options-sphere/ADV_wind_stacked.f90
+++ b/flash2d/src/options-sphere/ADV_wind_stacked.f90
@@ -390,6 +390,7 @@
 
       r_stclayerpressure(1:i_stcnumlayers) = r_alt(1:i_stcnumlayers)
 
+
 !---------- allocate current data arrays
       WRITE(GRID_parameters%ioout,*) &
         '***** reading NetCDF file core data ...               *****'
diff --git a/flash2d/src/options-sphere/IO_vtu_stacked.F90 b/flash2d/src/options-sphere/IO_vtu_stacked.F90
index 8b102f7..d589285 100644
--- a/flash2d/src/options-sphere/IO_vtu_stacked.F90
+++ b/flash2d/src/options-sphere/IO_vtu_stacked.F90
@@ -73,6 +73,11 @@ CONTAINS
 !> \param[in] i_zcoordinate   Use the i_zcoordinate component of p_nodedata
 !!                            also as z-coordinate
 #endif
+#ifdef VTU_OUTPUTSTC
+!> \param[in] i_layers        For stacked 2.5D spherical: number of stacked layers
+!> \param[in] r_height        For stacked 2.5D spherical: array of layer heights, used for 
+!!                            computing the z-coordinate (distance from sphere midpoint)
+#endif
 !> \param[in] l_continuous    Write continuous node data.
 !!                            This needs less space than discontinuous.
 !!                            default: .true.
@@ -406,9 +411,9 @@ SUBROUTINE plot_vtu(p_mesh, c_filename, &
 	  CALL grid_error(c_error='[plot_vtu]: could not allocate aux. stc values arrays')
 	END IF
     DO i_cnt = 1, i_nodedata
-      IF (p_nodedata(i_cnt)%c_name(1:5) == 'layer') THEN
-        c_layer = p_nodedata(i_cnt)%c_name(6:15)
-        READ(i_hcnt,'(I8)') c_layer
+      IF (p_nodedata(i_cnt)%c_name(1:6) == ' layer') THEN
+        c_layer = p_nodedata(i_cnt)%c_name(7:22)
+        READ(c_layer,*) i_hcnt
         i_stcbeg = p_mesh%i_nnumber*(i_hcnt-1)+1
         i_stcend = p_mesh%i_nnumber*i_hcnt
         r_stcval(1:1,i_stcbeg:i_stcend) = p_nodedata(i_cnt)%p_vdata(1:1,:)
-- 
GitLab