Index: /palm/trunk/SCRIPTS/.palm.iofiles
===================================================================
--- /palm/trunk/SCRIPTS/.palm.iofiles	(revision 4410)
+++ /palm/trunk/SCRIPTS/.palm.iofiles	(revision 4411)
@@ -85,3 +85,4 @@
 PARTICLE_DATA*             out:lnpe *         $base_data/$run_identifier/OUTPUT         _prt_dat
 #
-WTM_OUTPUT_DATA*           out:tr   *         $base_data/$run_identifier/MONITORING     _wtm
+#WTM_OUTPUT_DATA*           out:tr   *         $base_data/$run_identifier/MONITORING     _wtm
+DATA_1D_TS_WTM_NETCDF*     out:tr   *         $fast_io_catalog/$run_identifier/OUTPUT   _wtm       nc
Index: /palm/trunk/SCRIPTS/palmrungui
===================================================================
--- /palm/trunk/SCRIPTS/palmrungui	(revision 4410)
+++ /palm/trunk/SCRIPTS/palmrungui	(revision 4411)
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Added new features: individual tag for submitted runs, automatic finding of
+# configuration, start of palmbuild from GUI
+# 
+# 4405 2020-02-12 19:11:11Z maronga
 # Major revisions: New layout. Merged with palm job manager (palm_jm).
 # Minor revisions: Misc. bugs fixed.
@@ -127,4 +131,13 @@
         self.load_jobs()
 
+        # look up configuration files and add to combo box
+        
+        self.group_execution.findChild(QtGui.QComboBox,"combo_configuration").addItem("")
+        
+        for files in os.listdir(palm_dir):
+           if files.startswith(".palm.config"):
+              tmpstring = filter(None,files.split(".palm.config."))[0]
+              self.group_execution.findChild(QtGui.QComboBox,"combo_configuration").addItem(tmpstring)
+
         commandline = self.groupBox.findChild(QtGui.QLineEdit,"commandline")
         commandline.setText("")
@@ -154,4 +167,5 @@
 
 
+
     
         QtGui.QApplication.processEvents()
@@ -166,5 +180,5 @@
         
         # Check for empty line
-        palmrunline_save = palmrunline;
+        palmrunline_save = palmrunline
         if (userline != ""):
             palmrunline = "%s %s" % (palmrunline,userline)
@@ -174,4 +188,5 @@
         self.tabWidget.setEnabled(False)
         self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False)
+        self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False)
         self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("wait...")      
         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText("Executing palmrun in xterm...")        
@@ -195,5 +210,5 @@
         
         mString = "xterm %s" % (palmrunline)
-        palmrun.start(mString);
+        palmrun.start(mString)
     
         if( palmrun.waitForStarted() is False ):
@@ -201,5 +216,5 @@
         
         # Wait until palmrun has finished or wait for 200 minutes
-        palmrun.waitForFinished(3600000);        
+        palmrun.waitForFinished(3600000)        
         
         # Jobs has been submitted or aborted. Continuing...
@@ -207,7 +222,8 @@
         filename = "%s/.palmrungui.history" % (palm_dir)
         tmstamp = strftime("%Y/%m/%d %H:%M")
+        tag = str(self.groupBox.findChild(QtGui.QLineEdit,"line_tag").text())
     
         file = open(filename,"a")
-        s = "%s %s\n" % (tmstamp,history_line)
+        s = "%s %s (%s)\n" % (tmstamp,history_line,tag)
         file.write(s)
         file.close()              
@@ -216,6 +232,7 @@
         self.tabWidget.setEnabled(True)
         self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True)
-        self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("Start palmrun") 
-        self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline_save);
+        self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("palmrun") 
+        self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline_save)
+        self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
         
         # Reload recent jobs
@@ -223,4 +240,52 @@
         
         
+        
+    # starts xterm with palmbuild commandline
+    #######################################
+    def startpalmbuild(self):
+        palmbuildline = 'palmbuild -c ' + str(self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText())
+        
+        # Disable the main window
+        self.tabWidget.setEnabled(False)
+        self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False)
+        self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False)  
+        self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText("Executing palmbuild in xterm...")        
+        
+        # Wait until all commands have been executed (ugly) ?
+        #for i in range(0,21):
+        #    qApp->processEvents()       
+        
+        # Start xterm as QProcess
+        palmbuild = QProcess()
+        palmbuild.setProcessChannelMode(QProcess.MergedChannels) # mergedChannels
+        palmbuild.setWorkingDirectory(palm_dir)
+    
+        geomet = self.frameGeometry()
+        
+        posx = geomet.x()+geomet.width()
+        posy = geomet.y()
+      
+        s = " -title \"Executing palmbuild...\" -fa \"Monospace\" -fs 11 -geometry \"80x38+%d+%d\" -e \"" % (posx,posy)
+        palmbuildline = "%s%s;echo -n '--> Press enter to continue...';read yesno\"</dev/stdin" % (s, palmbuildline.replace("\"","\'"))
+        
+        mString = "xterm %s" % (palmbuildline)
+        palmbuild.start(mString)
+    
+        if( palmbuild.waitForStarted() is False ):
+            return
+        
+        # Wait until palmbuild has finished or wait for 200 minutes
+        palmbuild.waitForFinished(3600000)        
+        
+          
+        
+        # Enable main window again
+        self.tabWidget.setEnabled(True)
+        self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True)
+        self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
+        
+        # Reload recent jobs
+        self.recent_jobs(50)
+
     # loads recent jobs 
     ######################################
@@ -235,6 +300,7 @@
         history = file.readlines()
         tmphistory = list()
-        file.close();
-        j = 0;
+        tmptag = list()
+        file.close()
+        j = 0
 
         list_jobname = self.group_history.findChild(QtGui.QListWidget,"list_jobname")
@@ -247,4 +313,5 @@
             timestamp = history[i][:16]
             listitem = history[i][17:len(history[i])-1]
+            tagitem = listitem
             matchitems = list_jobname.findItems(listitem, QtCore.Qt.MatchExactly)
 
@@ -252,9 +319,19 @@
                 listitem = filter(None,listitem.split(" -r"))[1]
                 listitem = filter(None,listitem.split(" -"))[0]
-                listitem = listitem.replace(" ",""); 
-                list_jobname.addItem(listitem);
-                s = "%s (%s)" % (listitem,timestamp)
-                tmphistory.append(s);
+                listitem = listitem.replace(" ","") 
+                list_jobname.addItem(listitem)
+                s = "%s: %s" % (timestamp,listitem)
+                tmphistory.append(s)
+                
+                
+                tagitem = filter(None,tagitem.split(" ("))[1]
+                tagitem = tagitem.replace(")","")  
+                if ( len(tagitem) == 0 ): 
+                   s = "Tag: empty"
+                else:
+                   s = "Tag: %s" % (tagitem)                
+                tmptag.append(s)
                 count = count +1
+
                 j = j+1
                 
@@ -264,9 +341,10 @@
             
         # Send to list
-        list_jobname.clear();
+        list_jobname.clear()
         
         i=0
         while i<len(tmphistory):
-            list_jobname.addItem(tmphistory[i]);
+            list_jobname.addItem(tmphistory[i])
+            list_jobname.item(i).setToolTip(tmptag[i])
             i = i+1
             
@@ -291,7 +369,7 @@
         filename = str(list_jobname.currentItem().text())
             
-        timestamp = filename[len(filename)-17:][:16]
-        jobname = filename[:len(filename) - 19];
-        
+        timestamp = filename[:16]
+        jobname = filename[18:]
+                
         itemint = list_jobname.currentRow()
 
@@ -301,10 +379,13 @@
     
         # Set selected item to jobname
-        list_jobname.item(itemint).setSelected(True);
+        list_jobname.item(itemint).setSelected(True)
     
         # Set selected item to jobname in "available jobs" list
         item2int = self.list_jobs.findItems(jobname,QtCore.Qt.MatchCaseSensitive)
-        self.list_jobs.setCurrentItem(item2int[0])
+        
+        if ( item2int != [] ):
+           self.list_jobs.setCurrentItem(item2int[0])
         self.update_input()
+           
     
         fileDir = "%s/.palmrungui.history" % (palm_dir)
@@ -312,5 +393,5 @@
         history = file.readlines()
         tmphistory = list()
-        file.close();        
+        file.close()        
     
         i = len(history)
@@ -319,5 +400,5 @@
             listitem = filter(None,listitem.split(" -r"))[1]
             listitem = filter(None,listitem.split(" -"))[0]
-            listitem = listitem.replace(" ","");                
+            listitem = listitem.replace(" ","")  
 
             # Select command line with correct timestamp and jobname
@@ -326,7 +407,15 @@
                 palmrunline = palmrunline[17:]
                 palmrunline = palmrunline[:len(palmrunline)-1]
-                self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline);
-                self.setup_gui(palmrunline);
-                self.list_jobname.item(itemint).setSelected(True);    
+                palmrunline = filter(None,palmrunline.split("("))[0]
+                self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline)
+                
+              
+                tag = history[i-1].split('\n')[0]
+                tag = filter(None,tag.split("("))[1]
+                tag = tag.replace(")","")
+
+                self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setText(tag)
+                self.setup_gui(palmrunline)
+                self.list_jobname.item(itemint).setSelected(True)    
                 
                 return
@@ -389,4 +478,5 @@
                 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True) 
                 self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(True)
+                self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
             
             elif ( param[0] == ""):            
@@ -396,4 +486,5 @@
                 self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(False)
                 self.group_advanced.setEnabled(False)
+                self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
                 self.delete_commandline("r")
                 self.change_commandline("a","remove")
@@ -504,4 +595,5 @@
                 self.button_start.setEnabled(True)
                 self.action_save.setEnabled(True)
+                self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
 
         # Change in any other parameter
@@ -528,7 +620,12 @@
     ###################################################################################
     def change_lineinput(self):
-        if ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit, "line_host") ):
-            tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_host").text()
-            self.change_commandline("c",tmptext)
+        if ( self.sender() == self.group_execution.findChild(QtGui.QComboBox, "combo_configuration") ):
+            tmptext = self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText()
+            if tmptext.isEmpty():
+               self.change_commandline("c"," ")
+               self.group_execution.findChild(QtGui.QPushButton,'button_palmbuild').setEnabled(False)
+            else:
+               self.change_commandline("c",tmptext)
+               self.group_execution.findChild(QtGui.QPushButton,'button_palmbuild').setEnabled(True)          
 
         elif ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit,"line_q")):
@@ -819,6 +916,9 @@
                 
             elif ( parameter == "c"):
-                self.group_execution.findChild(QtGui.QLineEdit,"line_host").setText(options) 
-             
+                tmpindex = self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").findText(options,QtCore.Qt.MatchExactly)
+                if tmpindex != -1: 
+                   self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").setCurrentIndex(tmpindex)
+                else:
+                   self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").setCurrentIndex(0)
             elif ( parameter == "q"):
                 self.group_execution.findChild(QtGui.QLineEdit,"line_q").setText(options) 
@@ -975,4 +1075,5 @@
             self.group_advanced.setEnabled(False) 
             self.check_advanced.setEnabled(False) 
+            self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False)
          
         else:
@@ -982,4 +1083,5 @@
             self.group_execution.findChild(QtGui.QComboBox, "drop_job").setEnabled(True) 
             self.group_advanced.setEnabled(True) 
+            self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
          
         self.tabWidget.setCurrentIndex(0)
@@ -1053,10 +1155,12 @@
        
        list_of_files = os.listdir(job_dir)
-             
+      
+
        for i in range(0,len(list_of_files)):
           tmp_file = job_dir + "/" + list_of_files[i]
 
           if ( os.path.isdir(tmp_file) ):
-	     self.list_jobs.addItem(str(list_of_files[i]))
+             self.list_jobs.addItem(str(list_of_files[i]))
+       
 
 
@@ -1310,5 +1414,4 @@
         selection = self.list_output.selectedItems()
         
-        print("test")
         if ( len(selection) != 0 ):
 
Index: /palm/trunk/SCRIPTS/palmrungui_files/mainwindow.ui
===================================================================
--- /palm/trunk/SCRIPTS/palmrungui_files/mainwindow.ui	(revision 4410)
+++ /palm/trunk/SCRIPTS/palmrungui_files/mainwindow.ui	(revision 4411)
@@ -160,4 +160,36 @@
      </property>
     </widget>
+    <widget class="QLineEdit" name="line_tag">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+     <property name="geometry">
+      <rect>
+       <x>430</x>
+       <y>20</y>
+       <width>351</width>
+       <height>20</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_22">
+     <property name="geometry">
+      <rect>
+       <x>340</x>
+       <y>20</y>
+       <width>81</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Custom tag:</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
+     </property>
+    </widget>
    </widget>
    <widget class="QTabWidget" name="tabWidget">
@@ -219,5 +251,5 @@
         <rect>
          <x>310</x>
-         <y>80</y>
+         <y>50</y>
          <width>111</width>
          <height>21</height>
@@ -235,5 +267,5 @@
         <rect>
          <x>230</x>
-         <y>75</y>
+         <y>50</y>
          <width>71</width>
          <height>21</height>
@@ -257,5 +289,5 @@
        </property>
        <property name="text">
-        <string/>
+        <string>10240</string>
        </property>
       </widget>
@@ -286,5 +318,5 @@
        </property>
        <property name="text">
-        <string/>
+        <string>100</string>
        </property>
       </widget>
@@ -360,5 +392,5 @@
        </property>
        <property name="text">
-        <string/>
+        <string>432000</string>
        </property>
       </widget>
@@ -380,17 +412,4 @@
        <property name="alignment">
         <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
-       </property>
-      </widget>
-      <widget class="QLineEdit" name="line_host">
-       <property name="geometry">
-        <rect>
-         <x>100</x>
-         <y>80</y>
-         <width>101</width>
-         <height>20</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string/>
        </property>
       </widget>
@@ -501,8 +520,8 @@
        <property name="geometry">
         <rect>
-         <x>100</x>
-         <y>50</y>
-         <width>251</width>
-         <height>25</height>
+         <x>60</x>
+         <y>55</y>
+         <width>191</width>
+         <height>21</height>
         </rect>
        </property>
@@ -529,10 +548,10 @@
        <item>
         <property name="text">
-         <string>Initial run (coupled atmosphere ocean)</string>
+         <string>Initial run (coupled)</string>
         </property>
        </item>
        <item>
         <property name="text">
-         <string>Restart run (coupled atmosphere ocean)</string>
+         <string>Restart run (coupled)</string>
         </property>
        </item>
@@ -566,7 +585,7 @@
        <property name="geometry">
         <rect>
-         <x>0</x>
+         <x>10</x>
          <y>55</y>
-         <width>91</width>
+         <width>41</width>
          <height>16</height>
         </rect>
@@ -621,4 +640,27 @@
        <property name="scaledContents">
         <bool>true</bool>
+       </property>
+      </widget>
+      <widget class="QPushButton" name="button_palmbuild">
+       <property name="geometry">
+        <rect>
+         <x>310</x>
+         <y>80</y>
+         <width>111</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>(re-)build</string>
+       </property>
+      </widget>
+      <widget class="QComboBox" name="combo_configuration">
+       <property name="geometry">
+        <rect>
+         <x>100</x>
+         <y>80</y>
+         <width>201</width>
+         <height>21</height>
+        </rect>
        </property>
       </widget>
@@ -1484,5 +1526,4 @@
  <tabstops>
   <tabstop>drop_job</tabstop>
-  <tabstop>line_host</tabstop>
   <tabstop>line_q</tabstop>
   <tabstop>line_pe</tabstop>
@@ -1557,6 +1598,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>238</x>
-     <y>406</y>
+     <x>202</x>
+     <y>515</y>
     </hint>
     <hint type="destinationlabel">
@@ -1573,6 +1614,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>276</x>
-     <y>406</y>
+     <x>240</x>
+     <y>515</y>
     </hint>
     <hint type="destinationlabel">
@@ -1589,6 +1630,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>78</x>
-     <y>514</y>
+     <x>82</x>
+     <y>630</y>
     </hint>
     <hint type="destinationlabel">
@@ -1605,6 +1646,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>82</x>
-     <y>534</y>
+     <x>86</x>
+     <y>650</y>
     </hint>
     <hint type="destinationlabel">
@@ -1621,6 +1662,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>63</x>
-     <y>554</y>
+     <x>67</x>
+     <y>670</y>
     </hint>
     <hint type="destinationlabel">
@@ -1727,20 +1768,4 @@
   </connection>
   <connection>
-   <sender>line_host</sender>
-   <signal>textEdited(QString)</signal>
-   <receiver>MainWindow</receiver>
-   <slot>change_lineinput()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>169</x>
-     <y>421</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>26</x>
-     <y>362</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>line_pe</sender>
    <signal>textEdited(QString)</signal>
@@ -1749,6 +1774,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>166</x>
-     <y>446</y>
+     <x>170</x>
+     <y>570</y>
     </hint>
     <hint type="destinationlabel">
@@ -1765,6 +1790,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>189</x>
-     <y>471</y>
+     <x>193</x>
+     <y>595</y>
     </hint>
     <hint type="destinationlabel">
@@ -1781,6 +1806,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>398</x>
-     <y>422</y>
+     <x>402</x>
+     <y>515</y>
     </hint>
     <hint type="destinationlabel">
@@ -1797,6 +1822,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>421</x>
-     <y>471</y>
+     <x>425</x>
+     <y>595</y>
     </hint>
     <hint type="destinationlabel">
@@ -1813,6 +1838,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>396</x>
-     <y>447</y>
+     <x>400</x>
+     <y>570</y>
     </hint>
     <hint type="destinationlabel">
@@ -2053,6 +2078,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>181</x>
-     <y>352</y>
+     <x>185</x>
+     <y>485</y>
     </hint>
     <hint type="destinationlabel">
@@ -2085,6 +2110,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>272</x>
-     <y>572</y>
+     <x>276</x>
+     <y>690</y>
     </hint>
     <hint type="destinationlabel">
@@ -2117,6 +2142,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>174</x>
-     <y>592</y>
+     <x>178</x>
+     <y>710</y>
     </hint>
     <hint type="destinationlabel">
@@ -2149,6 +2174,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>762</x>
-     <y>687</y>
+     <x>692</x>
+     <y>710</y>
     </hint>
     <hint type="destinationlabel">
@@ -2165,6 +2190,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>622</x>
-     <y>687</y>
+     <x>552</x>
+     <y>710</y>
     </hint>
     <hint type="destinationlabel">
@@ -2181,6 +2206,6 @@
    <hints>
     <hint type="sourcelabel">
-     <x>962</x>
-     <y>412</y>
+     <x>932</x>
+     <y>452</y>
     </hint>
     <hint type="destinationlabel">
@@ -2267,4 +2292,52 @@
      <x>1182</x>
      <y>495</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>button_start</sender>
+   <signal>clicked()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>startpalmbuild()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>106</x>
+     <y>756</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>-3</x>
+     <y>672</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>button_palmbuild</sender>
+   <signal>clicked()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>startpalmbuild()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>342</x>
+     <y>552</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>1182</x>
+     <y>748</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>combo_configuration</sender>
+   <signal>currentIndexChanged(QString)</signal>
+   <receiver>MainWindow</receiver>
+   <slot>change_lineinput()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>134</x>
+     <y>547</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>1183</x>
+     <y>538</y>
     </hint>
    </hints>
@@ -2298,4 +2371,5 @@
   <slot>openmenuoutput()</slot>
   <slot>openmenumonitoring()</slot>
+  <slot>startpalmbuild()</slot>
  </slots>
 </ui>
Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 4410)
+++ /palm/trunk/SOURCE/Makefile	(revision 4411)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Added output routines for WTM
+# 
+# 4400 2020-02-10 20:32:41Z suehring
 # Add dependency for data-output module
 # 
@@ -1292,4 +1295,5 @@
 	basic_constants_and_equations_mod.o \
 	cpulog_mod.o \
+	data_output_module.o \
 	mod_kinds.o \
 	modules.o
Index: /palm/trunk/SOURCE/module_interface.f90
===================================================================
--- /palm/trunk/SOURCE/module_interface.f90	(revision 4410)
+++ /palm/trunk/SOURCE/module_interface.f90	(revision 4411)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Added output routines for WTM
+! 
+! 4407 2020-02-13 20:31:44Z knoop
 ! Changed program_debug_output_unit to 9 in dom_init call
 ! 
@@ -514,6 +517,7 @@
         ONLY:  wtm_parin,                                                      &
                wtm_check_parameters,                                           &
+               wtm_init,                                                       &
                wtm_init_arrays,                                                &
-               wtm_init,                                                       &
+               wtm_init_output,                                                &
                wtm_actions,                                                    &
                wtm_rrd_global,                                                 &
@@ -1121,4 +1125,5 @@
 !-- Define module-specific output quantities
     IF ( virtual_measurement )  CALL vm_init_output
+    IF ( wind_turbine )         CALL wtm_init_output
 !
 !-- Leave output-definition state
Index: /palm/trunk/SOURCE/wind_turbine_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 4410)
+++ /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
