Index: palm/trunk/SOURCE/wind_turbine_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 4360)
+++ palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 4411)
@@ -8,5 +8,5 @@
 ! version.
 !
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
+! PALM is distributed in the hope that it will be useful, but WITHOUT ANYr
 ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 ! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! Added output in NetCDF format using DOM (only netcdf4-parallel is supported).
+! Old ASCII output is still available at the moment.
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -111,10 +115,12 @@
         ONLY:  coupling_char,                                                  &
                debug_output,                                                   &
-               dt_3d, dz, message_string, simulated_time,                      &
-               wind_turbine, initializing_actions
+               dt_3d, dz, end_time, message_string, time_since_reference_point,&
+               wind_turbine, initializing_actions, origin_date_time
 
     USE cpulog,                                                                &
         ONLY:  cpu_log, log_point_s
 
+    USE data_output_module
+        
     USE grid_variables,                                                        &
         ONLY:  ddx, dx, ddy, dy
@@ -133,4 +139,9 @@
     PRIVATE
 
+    
+    
+    CHARACTER(LEN=100) ::  variable_name  !< name of output variable
+    CHARACTER(LEN=30) :: nc_filename 
+    
 !
 !-- Variables specified in the namelist wind_turbine_par
@@ -139,9 +150,20 @@
     INTEGER(iwp) ::  nturbines = 1   !< number of turbines
 
+    
+    
+    REAL(wp), DIMENSION(:), POINTER   ::  output_values_1d_pointer !< pointer for 2d output array
+    REAL(wp), POINTER                 ::  output_values_0d_pointer !< pointer for 2d output array  
+    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET   ::  output_values_1d_target !< pointer for 2d output array
+    REAL(wp), TARGET                ::  output_values_0d_target !< pointer for 2d output array     
+    
     LOGICAL ::  pitch_control = .FALSE.   !< switch for use of pitch controller
     LOGICAL ::  speed_control = .FALSE.   !< switch for use of speed controller
     LOGICAL ::  yaw_control   = .FALSE.   !< switch for use of yaw controller
     LOGICAL ::  tl_cor        = .FALSE.    !< switch for use of tip loss correct.
-
+    
+    LOGICAL ::  initial_write_coordinates = .FALSE. 
+
+    REAL(wp) ::  dt_wtm          = 1.0_wp
+    
     REAL(wp) ::  segment_length  = 1.0_wp          !< length of the segments, the rotor area is divided into
                                                    !< (in tangential direction, as factor of MIN(dx,dy,dz))
@@ -151,6 +173,7 @@
     REAL(wp) ::  tilt            = 0.0_wp          !< vertical tilt of the rotor [degree] ( positive = backwards )
 
+
     REAL(wp), DIMENSION(1:100) ::  dtow             = 0.0_wp  !< tower diameter [m]
-    REAL(wp), DIMENSION(1:100) ::  omega_rot        = 0.9_wp  !< inital or constant rotor speed [rad/s]
+    REAL(wp), DIMENSION(1:100), TARGET ::  omega_rot        = 0.9_wp  !< inital or constant rotor speed [rad/s]
     REAL(wp), DIMENSION(1:100) ::  phi_yaw          = 0.0_wp  !< yaw angle [degree] ( clockwise, 0 = facing west )
     REAL(wp), DIMENSION(1:100) ::  pitch_add        = 0.0_wp  !< constant pitch angle
@@ -384,4 +407,8 @@
     END INTERFACE wtm_check_parameters
 
+    INTERFACE wtm_data_output
+       MODULE PROCEDURE wtm_data_output
+    END INTERFACE wtm_data_output
+    
     INTERFACE wtm_init_arrays
        MODULE PROCEDURE wtm_init_arrays
@@ -392,4 +419,8 @@
     END INTERFACE wtm_init
 
+    INTERFACE wtm_init_output
+       MODULE PROCEDURE wtm_init_output
+    END INTERFACE wtm_init_output
+    
     INTERFACE wtm_actions
        MODULE PROCEDURE wtm_actions
@@ -409,5 +440,7 @@
            wtm_parin,                                                          &
            wtm_check_parameters,                                               &
+           wtm_data_output,                                                    &
            wtm_init_arrays,                                                    &
+           wtm_init_output,                                                    &
            wtm_init,                                                           &
            wtm_actions,                                                        &
@@ -878,8 +911,11 @@
        IMPLICIT NONE
 
+       
+  
        INTEGER(iwp) ::  i  !< running index
        INTEGER(iwp) ::  j  !< running index
        INTEGER(iwp) ::  k  !< running index
        
+      
 !
 !--    Help variables for the smearing function       
@@ -1255,4 +1291,8 @@
        CALL wtm_read_blade_tables
 
+       
+   
+       
+     
        IF ( debug_output )  CALL debug_message( 'wtm_init', 'end' )
  
@@ -1260,4 +1300,248 @@
 
 
+    
+    SUBROUTINE wtm_init_output
+    
+    
+        INTEGER(iwp) ::  ntimesteps               !< number of timesteps defined in NetCDF output file
+        INTEGER(iwp) ::  ntimesteps_max = 80000   !< number of maximum timesteps defined in NetCDF output file
+        INTEGER(iwp) ::  return_value             !< returned status value of called function
+       
+        INTEGER(iwp) ::  n  !< running index       
+      
+        INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ndim !< dummy to write dimension   
+       
+       
+!
+!--    Create NetCDF output file
+       nc_filename = 'DATA_1D_TS_WTM_NETCDF' // TRIM( coupling_char )      
+       return_value = dom_def_file( nc_filename, 'netcdf4-parallel' )
+                                                                          
+       ntimesteps = MIN( CEILING(                                                 &
+                     ( end_time - MAX( time_turbine_on, time_since_reference_point )&
+                     ) / MAX( 0.1_wp, dt_wtm ) ), ntimesteps_max )
+
+       
+!
+!--    Define dimensions in output file
+       ALLOCATE( ndim(1:nturbines) )
+       DO  n = 1, nturbines
+          ndim(n) = n
+       ENDDO
+       return_value = dom_def_dim( nc_filename,                                &
+                                   dimension_name = 'turbine',                 &
+                                   output_type = 'int32',                      &
+                                   bounds = (/1_iwp, nturbines/),              &
+                                   values_int32 = ndim )
+       DEALLOCATE( ndim )
+
+       
+!
+!--    time
+       return_value = dom_def_dim( nc_filename,                                &
+                                   dimension_name = 'time',                   &
+                                   output_type = 'real32',                      &
+                                   bounds = (/1_iwp, ntimesteps/),             &
+                                   values_realwp = (/0.0_wp/) )   
+       
+ 
+!
+!--    x
+       variable_name = 'x'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,              &
+                                   dimension_names = (/'turbine'/),            &
+                                   output_type = 'real32' )
+!
+!--    y
+       variable_name = 'y'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,              &
+                                   dimension_names = (/'turbine'/),            &
+                                   output_type = 'real32' )
+
+       variable_name = 'z'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,              &
+                                   dimension_names = (/'turbine'/),            &
+                                   output_type = 'real32' )
+                                   
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'time',                     &
+                                   attribute_name = 'units',                 &
+                                   value = 'seconds since ' // origin_date_time )
+                                   
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'x',                        &
+                                   attribute_name = 'units',                 &
+                                   value = 'm' )
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'y',                        &
+                                   attribute_name = 'units',                 &
+                                   value = 'm' )      
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'z',                        &
+                                   attribute_name = 'units',                 &
+                                   value = 'm' )                                   
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'x',                        &
+                                   attribute_name = 'long_name',                 &
+                                   value = 'x location of rotor center' )
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'y',                        &
+                                   attribute_name = 'long_name',                 &
+                                   value = 'y location of rotor center' )      
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'z',                        &
+                                   attribute_name = 'long_name',                 &
+                                   value = 'z location of rotor center' )     
+                                   
+                                   
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'turbine_name',             &
+                                   attribute_name = 'long_name',                 &
+                                   value = 'turbine name')   
+ 
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'time',                     &
+                                   attribute_name = 'standard_name',             &
+                                   value = 'time')
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'time',                     &
+                                   attribute_name = 'axis',                    &
+                                   value = 'T')
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'x',                        &
+                                   attribute_name = 'axis',                    &
+                                   value = 'X' )
+
+       return_value = dom_def_att( nc_filename,                        &
+                                   variable_name = 'y',                        &
+                                   attribute_name = 'axis',                    &
+                                   value = 'Y' )                                  
+
+
+       variable_name = 'rotor_speed'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'rad/s' )
+  
+       variable_name = 'generator_speed'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'rad/s' )
+      
+      
+       variable_name = 'generator_torque'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'Nm' )  
+        
+       variable_name = 'rotor_torque'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'Nm' )
+
+       variable_name = 'pitch_angle'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'degrees' )     
+                                   
+       variable_name = 'generator_power'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'W' )  
+                                   
+       variable_name = 'rotor_power'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'W' )  
+                                   
+        variable_name = 'rotor_thrust'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'N' )    
+                                   
+                                   
+       variable_name = 'wind_direction'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'degrees' )  
+                                   
+       variable_name = 'yaw_angle'
+       return_value = dom_def_var( nc_filename,                        &
+                                   variable_name = variable_name,      &
+                                   dimension_names = (/ 'turbine', 'time' /),     &
+                                   output_type = 'real32' )
+  
+       return_value = dom_def_att( nc_filename,                  &
+                                   variable_name = variable_name,        &
+                                   attribute_name = 'units',           &
+                                   value = 'degrees' )  
+                                   
+    END SUBROUTINE
+    
 !------------------------------------------------------------------------------!
 ! Description:
@@ -1595,5 +1879,5 @@
        INTEGER(iwp) ::  ring             !<
        INTEGER(iwp) ::  ii, jj, kk       !<
-    
+        
        REAL(wp)     ::  flag               !< flag to mask topography grid points
        REAL(wp)     ::  sin_rot, cos_rot   !<
@@ -1604,5 +1888,5 @@
        
        REAL(wp) ::  dist_u_3d, dist_v_3d, dist_w_3d  !< smearing distances
-
+      
        
 !
@@ -1619,5 +1903,5 @@
 
 
-       IF ( simulated_time >= time_turbine_on ) THEN
+       IF ( time_since_reference_point >= time_turbine_on ) THEN
 
 !
@@ -2399,9 +2683,14 @@
           ENDIF
 
+          
+          
+          
           DO inot = 1, nturbines
 
+
+          
              IF ( myid == 0 ) THEN
                 IF ( openfile_turb_mod(400+inot)%opened )  THEN
-                   WRITE ( 400+inot, 106 ) simulated_time, omega_rot(inot),    &
+                   WRITE ( 400+inot, 106 ) time_since_reference_point, omega_rot(inot),    &
                              omega_gen(inot), torque_gen_old(inot),            &
                              torque_total(inot), pitch_add(inot),              &
@@ -2419,5 +2708,5 @@
                                            turbine_id ), FORM='FORMATTED' )
                    WRITE ( 400+inot, 105 ) inot
-                   WRITE ( 400+inot, 106 ) simulated_time, omega_rot(inot),    &
+                   WRITE ( 400+inot, 106 ) time_since_reference_point, omega_rot(inot),    &
                              omega_gen(inot), torque_gen_old(inot),            &
                              torque_total(inot), pitch_add(inot),              &
@@ -2434,6 +2723,13 @@
           ENDDO                                    !-- end of loop over turbines
 
-       ENDIF
-
+          
+          
+       ENDIF   
+
+
+!
+!--    NetCDF output, should be moved
+       CALL wtm_data_output
+       
        CALL cpu_log( log_point_s(61), 'wtm_forces', 'stop' )
        
@@ -2449,5 +2745,6 @@
                    F12.1,1X,F12.1,4X,F7.2,4X,F7.2)
 
-
+           
+                   
     END SUBROUTINE wtm_forces
 
@@ -2692,5 +2989,5 @@
 !
 !--       Apply the x-component of the force to the u-component of the flow:
-          IF ( simulated_time >= time_turbine_on )  THEN
+          IF ( time_since_reference_point >= time_turbine_on )  THEN
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -2715,5 +3012,5 @@
 !
 !--       Apply the y-component of the force to the v-component of the flow:
-          IF ( simulated_time >= time_turbine_on )  THEN
+          IF ( time_since_reference_point >= time_turbine_on )  THEN
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -2735,5 +3032,5 @@
 !
 !--       Apply the z-component of the force to the w-component of the flow:
-          IF ( simulated_time >= time_turbine_on )  THEN
+          IF ( time_since_reference_point >= time_turbine_on )  THEN
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -2781,5 +3078,5 @@
 !
 !--       Apply the x-component of the force to the u-component of the flow:
-          IF ( simulated_time >= time_turbine_on )  THEN
+          IF ( time_since_reference_point >= time_turbine_on )  THEN
              DO  k = nzb+1,  MAXVAL(k_hub) + MAXVAL(k_smear)
 !
@@ -2799,5 +3096,5 @@
 !
 !--       Apply the y-component of the force to the v-component of the flow:
-          IF ( simulated_time >= time_turbine_on )  THEN
+          IF ( time_since_reference_point >= time_turbine_on )  THEN
              DO  k = nzb+1,  MAXVAL(k_hub) + MAXVAL(k_smear)
                 tend_nac_y = 0.5_wp * nac_cd_surf(k,j,i) *                     &
@@ -2815,5 +3112,5 @@
 !
 !--       Apply the z-component of the force to the w-component of the flow:
-          IF ( simulated_time >= time_turbine_on )  THEN
+          IF ( time_since_reference_point >= time_turbine_on )  THEN
              DO  k = nzb+1,  MAXVAL(k_hub) + MAXVAL(k_smear)
                 tend(k,j,i) = tend(k,j,i) - rot_tend_z(k,j,i)                  &
@@ -2832,3 +3129,151 @@
     END SUBROUTINE wtm_actions_ij
 
+    
+    SUBROUTINE wtm_data_output
+    
+    
+       INTEGER(iwp)       ::  t_ind = 0       !< time index
+   
+       INTEGER(iwp) ::  return_value             !< returned status value of called function
+    
+!
+!--    At the first call of this routine write the spatial coordinates.
+       IF ( .NOT. initial_write_coordinates )  THEN
+          ALLOCATE ( output_values_1d_target(1:nturbines) )
+          output_values_1d_target = rcx(1:nturbines)
+          output_values_1d_pointer => output_values_1d_target      
+          return_value = dom_write_var( nc_filename,                              &
+                                     'x',                                         &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1/),                        &
+                                     bounds_end   = (/nturbines/) )
+
+          output_values_1d_target = rcy(1:nturbines)
+          output_values_1d_pointer => output_values_1d_target      
+          return_value = dom_write_var( nc_filename,                              &
+                                     'y',                                         &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1/),                        &
+                                     bounds_end   = (/nturbines/) )
+
+          output_values_1d_target = rcz(1:nturbines)
+          output_values_1d_pointer => output_values_1d_target      
+          return_value = dom_write_var( nc_filename,                              &
+                                     'z',                                         &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1/),                        &
+                                     bounds_end   = (/nturbines/) )                                       
+                                        
+          initial_write_coordinates = .TRUE.
+          DEALLOCATE ( output_values_1d_target )
+       ENDIF
+          
+       t_ind = t_ind + 1
+          
+       ALLOCATE ( output_values_1d_target(1:nturbines) )
+       output_values_1d_target = omega_rot(:)
+       output_values_1d_pointer => output_values_1d_target
+          
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'rotor_speed',                               &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = omega_gen(:)
+       output_values_1d_pointer => output_values_1d_target    
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'generator_speed',                           &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = torque_gen_old(:)
+       output_values_1d_pointer => output_values_1d_target    
+
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'generator_torque',                          &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = torque_total(:)
+       output_values_1d_pointer => output_values_1d_target    
+    
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'rotor_torque',                              &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = pitch_add(:)
+       output_values_1d_pointer => output_values_1d_target    
+
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'pitch_angle',                               &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = torque_gen_old(:)*omega_gen(:)*gen_eff
+       output_values_1d_pointer => output_values_1d_target    
+    
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'generator_power',                           &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       DO inot = 1, nturbines
+          output_values_1d_target(inot) = torque_total(inot)*omega_rot(inot)*air_dens
+       ENDDO
+       output_values_1d_pointer => output_values_1d_target    
+                                        
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'rotor_power',                               &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = thrust_rotor(:)
+       output_values_1d_pointer => output_values_1d_target    
+    
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'rotor_thrust',                              &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = wdir(:)*180.0_wp/pi
+       output_values_1d_pointer => output_values_1d_target    
+          
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'wind_direction',                            &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_1d_target = (phi_yaw(:))*180.0_wp/pi
+       output_values_1d_pointer => output_values_1d_target    
+
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'yaw_angle',                                 &
+                                     values_realwp_1d = output_values_1d_pointer, &
+                                     bounds_start = (/1, t_ind/),                 &
+                                     bounds_end   = (/nturbines, t_ind /) )
+
+       output_values_0d_target = time_since_reference_point
+       output_values_0d_pointer => output_values_0d_target
+    
+       return_value = dom_write_var( nc_filename,                                 &
+                                     'time',                                      &
+                                     values_realwp_0d = output_values_0d_pointer, &
+                                     bounds_start = (/t_ind/),                    &
+                                     bounds_end   = (/t_ind/) )         
+          
+       DEALLOCATE ( output_values_1d_target )
+       
+    
+    END SUBROUTINE wtm_data_output
+    
  END MODULE wind_turbine_model_mod
