{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Zero Pressure Gradient Flat Plate\n", "\n", "![plate](http://turbmodels.larc.nasa.gov/FlatPlate/Grids/plateBCpic.jpg)\n", " \n", "#### References\n", " \n", "http://turbmodels.larc.nasa.gov/flatplate.html" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define case name\n", "This is the solver case to be analysed" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from collections import OrderedDict\n", "case_dict = OrderedDict(( ('plate_medium',{ 'label' : '(68x48 cells)','face_area':0.075823,}),\n", " ('plate_medium_f20',{'label' : '(68x48 cells)','face_area':0.075823,}),\n", " ('plate_medium_f50',{'label' : '(68x48 cells)','face_area':0.075823,}),\n", " ('plate_medium_f100',{'label' : '(68x48 cells)','face_area':0.075823,}),\n", " ('plate_medium_f300',{'label' : '(68x48 cells)','face_area':0.075823,}),\n", " ('plate_fine',{'label' : '(544x384 cells)','face_area':0.075823/8.0,})\n", " ))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define Data Location\n", "For remote data the interaction will use ssh to securely interact with the data
\n", "This uses the reverse connection capability in paraview so that the paraview server can be submitted to a job scheduler
\n", "Note: The default paraview server connection will use port 11111" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "remote_data = True\n", "remote_server_auto = True\n", "\n", "data_host='dstandingford@vis03'\n", "data_dir='/gpfs/thirdparty/zenotech/home/dstandingford/VALIDATION/PLATE'\n", "paraview_cmd='mpiexec /gpfs/cfms/apps/zCFD/bin/pvserver'\n", "job_queue='westmere'\n", "job_ntasks=4\n", "job_ntaskpernode=2\n", "job_project='hyperflux'\n", "\n", "if not remote_server_auto:\n", " paraview_cmd=None\n", "\n", "if not remote_data:\n", " data_host='localhost'\n", " paraview_cmd=None\n", "\n", "# from zutil.post import data_location_form_html\n", "# data_location_form_html()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## zCFD Validation and regression" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "VALIDATING PLATE CASE\n", "REGRESSION PLATE CASE\n" ] } ], "source": [ "# Validation criteria is the value of the friction coefficient [0.0024 < c_f < 0.0028] at x = 0.97\n", "validate = True\n", "regression = True\n", "if (validate):\n", " valid = True\n", " valid_lower = 0.0024\n", " valid_upper = 0.0028\n", " print 'VALIDATING PLATE CASE'\n", " \n", "if (regression):\n", " print 'REGRESSION PLATE CASE' " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Initialise Environment" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n", "paraview version 4.2.0-77-g31a1d2a\n" ] } ], "source": [ "%pylab inline\n", "from paraview.simple import *\n", "paraview.simple._DisableFirstRenderCameraReset()\n", "import pylab as pl\n", "import math\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Data Connection\n", "This starts paraview server on remote host and connects" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Testing passwordless ssh access\n", "-> Passed\n", "Attempting to find unused port\n", "[dstandingford@vis03] Executing task 'run_uname'\n", "[dstandingford@vis03] Executing task 'port_test'\n", "[dstandingford@vis03] Executing task 'port_test'\n", "Selected Port: 12002\n", "Starting pvserver connect\n", "[dstandingford@vis03] Executing task 'port_test'\n", "Starting pvserver process\n", "[dstandingford@vis03] Executing task 'pvserver'\n", "[dstandingford@vis03] run: /bin/bash -l -c \"cd /gpfs/thirdparty/zenotech/home/dstandingford/VALIDATION/PLATE && sleep 2;mpiexec /gpfs/cfms/apps/zCFD/bin/pvserver -rc --client-host=localhost -sp=12002\"\n", "[dstandingford@vis03] out: \n", "[dstandingford@vis03] out: \t\t _____ ______ __ __ _____ \n" ] }, { "ename": "AttributeError", "evalue": "'NoneType' object has no attribute 'InstantiateGroupPrototypes'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m__connectionCreatedCallback\u001b[0;34m(obj, string)\u001b[0m\n\u001b[1;32m 3138\u001b[0m \u001b[0msid\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetEventCallDataSessionId\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3139\u001b[0m \u001b[0;31m# this creates the Connection object if needed.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3140\u001b[0;31m \u001b[0mGetConnectionFromSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msid\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3141\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3142\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__connectionClosedCallback\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstring\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36mGetConnectionFromSession\u001b[0;34m(session)\u001b[0m\n\u001b[1;32m 3126\u001b[0m \u001b[0;31m# it implies that the we simply may not have received the\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3127\u001b[0m \u001b[0;31m# ConnectionCreatedEvent event yet. Create a connection object.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3128\u001b[0;31m \u001b[0mc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mConnection\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msid\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3129\u001b[0m \u001b[0mConnections\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3130\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, connectionId, session)\u001b[0m\n\u001b[1;32m 1930\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1931\u001b[0m \u001b[0;31m# Build the list of available proxies for this connection.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1932\u001b[0;31m \u001b[0m_createModules\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mModules\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1933\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1934\u001b[0m \u001b[0;31m# additionally, if the proxy definitions change, we monitor them.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m_createModules\u001b[0;34m(m)\u001b[0m\n\u001b[1;32m 2561\u001b[0m modules for all know proxy groups.\"\"\"\n\u001b[1;32m 2562\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2563\u001b[0;31m \u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msources\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcreateModule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sources'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2564\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfilters\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcreateModule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'filters'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2565\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwriters\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcreateModule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'writers'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36mcreateModule\u001b[0;34m(groupName, mdl)\u001b[0m\n\u001b[1;32m 2593\u001b[0m \u001b[0mpxm\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mProxyManager\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2594\u001b[0m \u001b[0;31m# Use prototypes to find all proxy types.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2595\u001b[0;31m \u001b[0mpxm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mInstantiateGroupPrototypes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgroupName\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2596\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2597\u001b[0m \u001b[0mdebug\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 1750\u001b[0m \u001b[0;32mexcept\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1751\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1752\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSMProxyManager\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1753\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1754\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mLoadState\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloader\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mAttributeError\u001b[0m: 'NoneType' object has no attribute 'InstantiateGroupPrototypes'" ] }, { "name": "stdout", "output_type": "stream", "text": [ "[dstandingford@vis03] out: \t\t / ____| ____| \\/ |/ ____|\n", "[dstandingford@vis03] out: \t\t | | | |__ | \\ / | (___ \n", "[dstandingford@vis03] out: \t\t | | | __| | |\\/| |\\___ \\ \n", "[dstandingford@vis03] out: \t\t | |____| | | | | |____) |\n", "[dstandingford@vis03] out: \t\t \\_____|_| |_| |_|_____/ \n", "[dstandingford@vis03] out: \n", "[dstandingford@vis03] out: ++++++++++++++++++++++++++++: System Data :++++++++++++++++++++++++++++\n", "[dstandingford@vis03] out: + Hostname = vis03\n", "[dstandingford@vis03] out: + Kernel = 2.6.32-358.el6.x86_64\n", "[dstandingford@vis03] out: + RHEL Release = Red Hat Enterprise Linux Server release 6.4 (Santiago)\n", "[dstandingford@vis03] out: + Uptime = 14:00:01 up 54 days, 3:38, 48 users,\n", "[dstandingford@vis03] out: ++++++++++++++++++++++++++++: User Data :++++++++++++++++++++++++++++++\n", "[dstandingford@vis03] out: + Username = dstandingford\n", "[dstandingford@vis03] out: +++++++++++++++++++++++: Contact Information :+++++++++++++++++++++++++\n", "[dstandingford@vis03] out: + in case of any problems, contact: support@cfms.org.uk\n", "[dstandingford@vis03] out: + for feedback, contact: feedback@cfms.org.uk \n", "[dstandingford@vis03] out: +++++++++++++++++++++: Maintenance Information :+++++++++++++++++++++++\n" ] }, { "ename": "AttributeError", "evalue": "'NoneType' object has no attribute 'InstantiateGroupPrototypes'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/simple.pyc\u001b[0m in \u001b[0;36m_switchToActiveConnectionCallback\u001b[0;34m(caller, event)\u001b[0m\n\u001b[1;32m 1598\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mservermanager\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1599\u001b[0m \u001b[0msession\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mservermanager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvtkSMProxyManager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetProxyManager\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetActiveSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1600\u001b[0;31m \u001b[0mconnection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mservermanager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGetConnectionFromSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1601\u001b[0m \u001b[0mSetActiveConnection\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconnection\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1602\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36mGetConnectionFromSession\u001b[0;34m(session)\u001b[0m\n\u001b[1;32m 3126\u001b[0m \u001b[0;31m# it implies that the we simply may not have received the\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3127\u001b[0m \u001b[0;31m# ConnectionCreatedEvent event yet. Create a connection object.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3128\u001b[0;31m \u001b[0mc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mConnection\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msid\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3129\u001b[0m \u001b[0mConnections\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3130\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, connectionId, session)\u001b[0m\n\u001b[1;32m 1930\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1931\u001b[0m \u001b[0;31m# Build the list of available proxies for this connection.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1932\u001b[0;31m \u001b[0m_createModules\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mModules\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1933\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1934\u001b[0m \u001b[0;31m# additionally, if the proxy definitions change, we monitor them.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m_createModules\u001b[0;34m(m)\u001b[0m\n\u001b[1;32m 2561\u001b[0m modules for all know proxy groups.\"\"\"\n\u001b[1;32m 2562\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2563\u001b[0;31m \u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msources\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcreateModule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sources'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2564\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfilters\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcreateModule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'filters'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2565\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwriters\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcreateModule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'writers'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36mcreateModule\u001b[0;34m(groupName, mdl)\u001b[0m\n\u001b[1;32m 2593\u001b[0m \u001b[0mpxm\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mProxyManager\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2594\u001b[0m \u001b[0;31m# Use prototypes to find all proxy types.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2595\u001b[0;31m \u001b[0mpxm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mInstantiateGroupPrototypes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgroupName\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2596\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2597\u001b[0m \u001b[0mdebug\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/servermanager.pyc\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 1750\u001b[0m \u001b[0;32mexcept\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1751\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1752\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSMProxyManager\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1753\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1754\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mLoadState\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloader\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mAttributeError\u001b[0m: 'NoneType' object has no attribute 'InstantiateGroupPrototypes'" ] }, { "name": "stdout", "output_type": "stream", "text": [ "[dstandingford@vis03] out: + There is no planned maintenance taking place this week\n", "[dstandingford@vis03] out: +++++: Group Home Directory Quota Usage (updated every 10 mins) +++++\n", "[dstandingford@vis03] out: + GPFS storage used: 2096.24 GB ( 83.85 % ) - 403.76 GB remaining\n", "[dstandingford@vis03] out: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "[dstandingford@vis03] out: " ] }, { "ename": "RuntimeError", "evalue": "'connection' cannot be empty.", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mzutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpost\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpvserver_connect\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mremote_data\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mpvserver_connect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata_host\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdata_host\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mdata_dir\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdata_dir\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mparaview_cmd\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mparaview_cmd\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m/Users/David/Documents/zPost/python/zutil/post.pyc\u001b[0m in \u001b[0;36mpvserver_connect\u001b[0;34m(**kwargs)\u001b[0m\n\u001b[1;32m 924\u001b[0m \u001b[0;31m# time.sleep(6)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 925\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 926\u001b[0;31m \u001b[0mReverseConnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparaview_port\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 927\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 928\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/simple.pyc\u001b[0m in \u001b[0;36mReverseConnect\u001b[0;34m(port)\u001b[0m\n\u001b[1;32m 93\u001b[0m \u001b[0mDisconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mglobals\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 94\u001b[0m \u001b[0mconnection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mservermanager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReverseConnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mport\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 95\u001b[0;31m \u001b[0m_initializeSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconnection\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 96\u001b[0m \u001b[0m_add_functions\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mglobals\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconnection\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/paraview.app/Contents/Python/paraview/simple.pyc\u001b[0m in \u001b[0;36m_initializeSession\u001b[0;34m(connection)\u001b[0m\n\u001b[1;32m 1430\u001b[0m by API in this module.\"\"\"\n\u001b[1;32m 1431\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mconnection\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1432\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"'connection' cannot be empty.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1433\u001b[0m \u001b[0mcontroller\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mservermanager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mParaViewPipelineController\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1434\u001b[0m \u001b[0mcontroller\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mInitializeSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconnection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mRuntimeError\u001b[0m: 'connection' cannot be empty." ] } ], "source": [ "from zutil.post import pvserver_connect\n", "if remote_data:\n", " pvserver_connect(data_host=data_host,data_dir=data_dir,paraview_cmd=paraview_cmd)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get control dictionary" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from zutil.post import get_case_parameters,print_html_parameters\n", "parameters={}\n", "for case_name in case_dict:\n", " print 'case name = ' + case_name\n", " parameters[case_name] = get_case_parameters(case_name,data_host=data_host,data_dir=data_dir)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get status file" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from zutil.post import get_status_dict\n", "status=get_status_dict(case_name,data_host=data_host,data_dir=data_dir)\n", "num_procs = str(status['num processor'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Define test conditions" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from IPython.display import HTML\n", "for case_name in case_dict:\n", " HTML(print_html_parameters(parameters[case_name]))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Analysis constants\n", "import zutil\n", "reference_area = 2.0\n", "bl_position = 0.97\n", "mach = parameters['plate_fine']['IC_1']['V']['Mach']\n", "print 'mach = %.2f'%(mach)\n", "kappa = 1.402\n", "print 'kappa = %.3f'%(kappa)\n", "R = 287.058\n", "print 'R = %.3f'%(R)\n", "temperature = zutil.to_kelvin(540.0)\n", "print 'temperature = %.2f'%(temperature) + ' Kelvin'\n", "pressure = parameters['plate_fine']['IC_1']['pressure']\n", "print 'pressure = %.2f'%(pressure) + ' Pascals'\n", "\n", "density = pressure/(R*temperature)\n", "print 'density = %.2f'%(density) + ' kg/m^3'\n", "speed_of_sound = sqrt(kappa*pressure/density)\n", "print 'speed_of_sound = %.2f'%(speed_of_sound) + ' m/s'\n", "u_ref = mach*speed_of_sound \n", "print 'u_ref = %.2f'%(u_ref) + ' m/s'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plotting functions" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from zutil.post import get_case_root, get_case_report\n", "from zutil.post import get_csv_data,get_fw_csv_data\n", "from zutil.post import for_each\n", "def plot_theory(ax, filename):\n", " df = get_fw_csv_data(filename,widths=[16,16,16,16,16])\n", " ax.plot(df[1], df[0], color='grey', label='$\\mathbf{u^{+}=y^{+}}$') \n", " ax.plot(df[2], df[0], color='grey', label='Log law') \n", "\n", "def plot_comparison(ax,filename):\n", " df = get_fw_csv_data(filename,widths=[16,14],skiprows=2) \n", " ax.plot(df[0], df[1], color='red', label='CFL3D (545x385 points)') \n", " \n", "def velocity_plot(data,pts,**kwargs):\n", " ax = kwargs['axis']\n", " chart_label = kwargs['chart_label']\n", " ax.plot(data.GetPointData()['vprof'], pts.GetPoints()[:,2], label=chart_label) \n", "\n", "def plot_velocity_profile(ax,file_root,label,face_area):\n", " wall = PVDReader( FileName=file_root+'_wall.pvd' )\n", " drag = MinMax(Input=wall)\n", " drag.Operation = \"SUM\"\n", " drag.UpdatePipeline()\n", " drag_client = servermanager.Fetch(drag)\n", " cd = drag_client.GetCellData().GetArray(\"frictionforce\").GetValue(0)\n", " wall_slice = Slice(Input=wall, SliceType=\"Plane\" )\n", " wall_slice.SliceType.Normal = [1.0,0.0,0.0]\n", " wall_slice.SliceType.Origin = [bl_position, 0.0, 0.0]\n", " wall_slice.UpdatePipeline()\n", " wall_slice_client = servermanager.Fetch(wall_slice)\n", " nu = wall_slice_client.GetCellData().GetArray(\"nu\").GetValue(0)\n", " utau = wall_slice_client.GetCellData().GetArray(\"ut\").GetValue(0)\n", " yplus = wall_slice_client.GetCellData().GetArray(\"yplus\").GetValue(0)\n", " cf = wall_slice_client.GetCellData().GetArray(\"frictionforce\").GetValue(0)\n", " wall_vel = wall_slice_client.GetCellData().GetArray(\"V\").GetValue(0)\n", " wall_vel = 0.0\n", " symmetry = PVDReader( FileName=file_root+'_symmetry.pvd' )\n", " CellDatatoPointData1 = CellDatatoPointData(Input=symmetry)\n", " CellDatatoPointData1.PassCellData = 1\n", " # Removes second symmetry plane keeping y max\n", " Clip1 = Clip(Input=CellDatatoPointData1, ClipType=\"Plane\" )\n", " Clip1.ClipType.Normal = [0.0,1.0,0.0]\n", " Clip1.ClipType.Origin = [0.0, -0.5, 0.0]\n", " Clip2 = Clip(Input=Clip1, ClipType=\"Plane\" )\n", " Clip2.ClipType.Normal = [0.0,0.0,1.0]\n", " Clip2.ClipType.Origin = [0.0, 0.0, 0.05]\n", " Clip2.InsideOut = 1\n", " Slice1 = Slice(Input=Clip2, SliceType=\"Plane\" )\n", " Slice1.SliceType.Normal = [1.0,0.0,0.0]\n", " Slice1.SliceType.Origin = [bl_position, 0.0, 0.0]\n", " Calculator2 = Calculator(Input=Slice1)\n", " Calculator2.AttributeMode = 'Point Data'\n", " Calculator2.Function = '(V.iHat - '+ str(wall_vel) +')'\n", " Calculator2.ResultArrayName = 'vprof'\n", " Calculator2.UpdatePipeline()\n", " sorted_line = PlotOnSortedLines(Input=Calculator2)\n", " sorted_line.UpdatePipeline()\n", " extract_client = servermanager.Fetch(sorted_line) \n", " chart_label = (('$\\mathbf{y^{+} = %.2f}$')%(yplus) + (' $\\mathbf{C_d=%.6f}$'%(cd/reference_area)) \n", " + (' $\\mathbf{C_f=%.5f}$'%(cf/face_area)) + ' ' + label)\n", " for_each(extract_client,velocity_plot,axis=ax,chart_label=chart_label)\n", " \n", "def bl_plot(data,pts,**kwargs):\n", " ax = kwargs['axis']\n", " chart_label = kwargs['chart_label']\n", " ax.plot(data.GetPointData()['yp'][1:], data.GetPointData()['up'][1:], label=chart_label) \n", "\n", "def get_case_cf(file_root,label,face_area):\n", " wall = PVDReader( FileName=file_root+'_wall.pvd' )\n", " wall_slice = Slice(Input=wall, SliceType=\"Plane\" )\n", " wall_slice.SliceType.Normal = [1.0,0.0,0.0]\n", " wall_slice.SliceType.Origin = [bl_position, 0.0, 0.0]\n", " wall_slice.UpdatePipeline()\n", " wall_slice_client = servermanager.Fetch(wall_slice)\n", " cf = wall_slice_client.GetCellData().GetArray(\"frictionforce\").GetValue(0)/face_area\n", " return(cf) \n", " \n", "def plot_profile(ax,file_root,label):\n", " wall = PVDReader( FileName=file_root+'_wall.pvd' )\n", " wall_slice = Slice(Input=wall, SliceType=\"Plane\" )\n", " wall_slice.SliceType.Normal = [1.0,0.0,0.0]\n", " wall_slice.SliceType.Origin = [bl_position, 0.0, 0.0]\n", " wall_slice.UpdatePipeline()\n", " wall_slice_client = servermanager.Fetch(wall_slice)\n", " nu = wall_slice_client.GetCellData().GetArray(\"nu\").GetValue(0)\n", " utau = wall_slice_client.GetCellData().GetArray(\"ut\").GetValue(0)\n", " yplus = wall_slice_client.GetCellData().GetArray(\"yplus\").GetValue(0)\n", " t = wall_slice_client.GetCellData().GetArray(\"T\").GetValue(0)\n", " p = wall_slice_client.GetCellData().GetArray(\"p\").GetValue(0)\n", " rho = wall_slice_client.GetCellData().GetArray(\"rho\").GetValue(0)\n", " wall_vel = wall_slice_client.GetCellData().GetArray(\"V\").GetValue(0)\n", " symmetry = PVDReader( FileName=file_root+'_symmetry.pvd' )\n", " CellDatatoPointData1 = CellDatatoPointData(Input=symmetry)\n", " CellDatatoPointData1.PassCellData = 1\n", " # Removes second symmetry plane keeping y max\n", " Clip1 = Clip(Input=CellDatatoPointData1, ClipType=\"Plane\" )\n", " Clip1.ClipType.Normal = [0.0,1.0,0.0]\n", " Clip1.ClipType.Origin = [0.0, -0.5, 0.0]\n", " Clip2 = Clip(Input=Clip1, ClipType=\"Plane\" )\n", " Clip2.ClipType.Normal = [0.0,0.0,1.0]\n", " Clip2.ClipType.Origin = [0.0, 0.0, 0.05]\n", " Clip2.InsideOut = 1\n", " Slice1 = Slice(Input=Clip2, SliceType=\"Plane\" )\n", " Slice1.SliceType.Normal = [1.0,0.0,0.0]\n", " Slice1.SliceType.Origin = [bl_position, 0.0, 0.0]\n", " Calculator1 = Calculator(Input=Slice1)\n", " Calculator1.AttributeMode = 'Point Data'\n", " Calculator1.Function = 'log10(coords.kHat * '+str(utau)+'/'+str(nu)+')'\n", " Calculator1.ResultArrayName = 'yp'\n", " Calculator2 = Calculator(Input=Calculator1)\n", " Calculator2.AttributeMode = 'Point Data'\n", " Calculator2.Function = '(V.iHat - '+ str(wall_vel) +')/ '+str(utau)\n", " Calculator2.ResultArrayName = 'up'\n", " Calculator2.UpdatePipeline()\n", " sorted_line = PlotOnSortedLines(Input=Calculator2)\n", " sorted_line.UpdatePipeline()\n", " extract_client = servermanager.Fetch(sorted_line) \n", " chart_label = ('$\\mathbf{y^{+}}$ = %.2f '%yplus \n", " + ('$\\mathbf{u_{T}$ = %.2f ')%utau + label)\n", " for_each(extract_client,bl_plot,axis=ax,chart_label=chart_label)\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot comparison with Law of the Wall" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from zutil.post import ProgressBar\n", "pbar = ProgressBar()\n", "fig = figure(figsize=(10, 10),dpi=150, facecolor='w', edgecolor='#E48B25')\n", "\n", "ax = fig.add_subplot(1,1,1)\n", "ax.grid(True)\n", "ax.set_xlabel('$\\mathbf{\\log(y^{+})}$', fontsize=24, fontweight='bold', color = '#5D5858')\n", "ax.set_ylabel('$\\mathbf{u^{+}}$', fontsize=24, fontweight='bold', color = '#5D5858')\n", "ax.set_title('Zero Pressure Gradient Flat Plate \\n Law of the wall \\n', fontsize=20, fontweight='normal', color = '#E48B25')\n", "ax.axis([0,5,0,30])\n", "\n", "for tick in ax.xaxis.get_major_ticks():\n", " tick.label.set_fontsize(18) \n", " tick.label.set_fontweight('normal') \n", " tick.label.set_color('#E48B25')\n", "for tick in ax.yaxis.get_major_ticks():\n", " tick.label.set_fontsize(18)\n", " tick.label.set_fontweight('normal') \n", " tick.label.set_color('#E48B25')\n", " \n", "plot_theory(ax,'data/u+y+theory.csv');\n", "plot_comparison(ax,'data/flatplate_u+y+_sst.dat');\n", "\n", "for case in case_dict:\n", " case_name = case\n", " label = case_dict[case]['label']\n", " plot_profile(ax,get_case_root(case_name,str(num_procs)),label)\n", " pbar+=5\n", " \n", "legend = ax.legend(loc='best', shadow=False, fontsize=16)\n", "legend.get_frame().set_facecolor('white')\n", "\n", "pbar.complete()\n", "show()\n", "fig.savefig(\"images/flat_plate_bl_profile_a.png\", transparent=\"True\")\n", "from IPython.display import FileLink, display \n", "display(FileLink('images/flat_plate_bl_profile_a.png')) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot Velocity Profile" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "pbar = ProgressBar()\n", "fig = figure(figsize=(10, 10), dpi=150, facecolor='w', edgecolor='#E48B25')\n", "ax = fig.add_subplot(1,1,1)\n", "ax.grid(True)\n", "ax.set_xlabel('speed (m/s)', fontsize=24, fontweight='normal', color = '#5D5858')\n", "ax.set_ylabel('$\\mathbf{z}$ (m)', fontsize=24, fontweight='normal', color = '#5D5858')\n", "ax.set_title('Zero Pressure Gradient Flat Plate \\n Velocity profile \\n', fontsize=20, \n", " fontweight='normal', color = '#E48B25')\n", "ax.set_xlim([0.0,70.0])\n", "ax.set_ylim([0.0,0.025])\n", "\n", "df = get_fw_csv_data('data/flatplate_u_sst.dat',widths=[16,14],skiprows=2) \n", "ax.plot(df[0]*u_ref, df[1], color='red', label='CFL3D (545x385 points)') \n", "\n", "pbar+=5\n", "for case in case_dict:\n", " case_name = case\n", " label = case_dict[case]['label']\n", " plot_velocity_profile(ax,get_case_root(case_name,str(num_procs)),label,case_dict[case]['face_area'])\n", " pbar+=5\n", " \n", "for tick in ax.xaxis.get_major_ticks():\n", " tick.label.set_fontsize(18) \n", " tick.label.set_fontweight('normal') \n", " tick.label.set_color('#E48B25')\n", "for tick in ax.yaxis.get_major_ticks():\n", " tick.label.set_fontsize(18)\n", " tick.label.set_fontweight('normal') \n", " tick.label.set_color('#E48B25') \n", " \n", "ax.legend(loc='best', shadow=False, fontsize=16)\n", "legend.get_frame().set_facecolor('white')\n", "pbar+=5\n", "pbar.complete()\n", "fig.savefig(\"images/flat_plate_bl_profile_b.png\", transparent=\"True\")\n", "show()\n", "display(FileLink('images/flat_plate_bl_profile_b.png')) \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Mesh Convergence" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "pbar = ProgressBar()\n", "fig = figure(figsize=(10, 10),dpi=150, facecolor='w', edgecolor='#E48B25')\n", "ax = fig.add_subplot(1,1,1)\n", "\n", "ax.grid(True)\n", "ax.set_xlabel('$\\mathbf{h=(1/N)^{1/2}}$', fontsize=24, fontweight='bold', color = '#5D5858')\n", "ax.set_ylabel('$\\mathbf{C_f}$ at $\\mathbf{x=0.97}$', fontsize=24, fontweight='bold', color = '#5D5858')\n", "ax.set_title('Zero Pressure Gradient Flat Plate \\n Mesh Convergence ($\\mathbf{N}$ = $\\mathbf{n}$ x $\\mathbf{m}$) \\n', fontsize=20, \n", " fontweight='normal', color = '#E48B25')\n", "\n", "df = get_fw_csv_data('data/cf_convergence_sst_fun3d.dat',widths=[8,13,12,21],skiprows=3) \n", "ax.plot(df[2], df[3], color='red', marker='o',label='FUN3D') \n", "df = get_fw_csv_data('data/cf_convergence_sst_cfl3d.dat',widths=[8,13,12,21],skiprows=3) \n", "ax.plot(df[2], df[3], color='blue', marker='o',label='CFL3D')\n", "pbar+=5\n", "\n", "h = []\n", "cf = []\n", "for case in case_dict:\n", " case_name = case\n", " label = case_dict[case]['label']\n", " if (label=='(68x48 cells)'):\n", " N = 68*48\n", " elif (label=='(544x384 cells)'):\n", " N = 544*384\n", " h.append(1.0/sqrt(N))\n", " cf_temp = get_case_cf(get_case_root(case_name,str(num_procs)),label,case_dict[case]['face_area']) \n", " cf.append(cf_temp)\n", " if (validate):\n", " if ((cf_temp < valid_lower) or (cf_temp > valid_upper)):\n", " valid = False\n", " print 'INVALID: ' + case + ' ' + str(valid_lower) + ' ' + str(cf_temp) + ' ' + str(valid_upper)\n", " pbar+=5\n", "\n", "ax.plot(h, cf, color='green', marker='o',label='zCFD') \n", "pbar+=5\n", "\n", "ax.legend(loc='best', shadow=False, fontsize=16)\n", "legend.get_frame().set_facecolor('white')\n", "pbar+=5\n", "\n", "for tick in ax.xaxis.get_major_ticks():\n", " tick.label.set_fontsize(18) \n", " tick.label.set_fontweight('normal') \n", " tick.label.set_color('#E48B25')\n", " tick.label.set_rotation(37.5)\n", "for tick in ax.yaxis.get_major_ticks():\n", " tick.label.set_fontsize(18)\n", " tick.label.set_fontweight('normal')\n", " tick.label.set_color('#E48B25') \n", "\n", "fig.savefig(\"images/flat_plate_mesh_conv_profile.png\")\n", "pbar.complete()\n", "show()\n", "from IPython.display import FileLink, display \n", "display(FileLink('images/flat_plate_mesh_conv_profile.png')) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Convergence" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from zutil.post import residual_plot, get_case_report\n", "for case_name in case_dict:\n", " residual_plot(get_case_report(case_name))\n", "show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Check Validation " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "if (validate):\n", " if (valid):\n", " print 'VALIDATION = PASS :-)'\n", " else:\n", " print 'VALIDATION = FAIL :-(' " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "if (regression):\n", " import pandas as pd\n", " pd.options.display.float_format = '{:,.6f}'.format\n", " print 'REGRESSION DATA'\n", " regress = {'version' : ['v0.0' , 'v0.1' , 'CURRENT'], \n", " 'h[0]' : [0.017504, 0.017504, h[0]],\n", " 'h[1]' : [0.017504, 0.017504, h[1]],\n", " 'h[2]' : [0.017504, 0.017504, h[2]],\n", " 'h[3]' : [0.017504, 0.017504, h[3]],\n", " 'h[4]' : [0.017504, 0.017504, h[4]],\n", " 'h[5]' : [0.002188, 0.002188, h[5]],\n", " 'cf[0]' : [0.002045, 0.002045, cf[0]],\n", " 'cf[1]' : [0.002007, 0.002007, cf[1]],\n", " 'cf[2]' : [0.002014, 0.002014, cf[2]],\n", " 'cf[3]' : [0.002026, 0.002026, cf[3]],\n", " 'cf[4]' : [0.002085, 0.002085, cf[4]],\n", " 'cf[5]' : [0.002338, 0.002338, cf[5]],\n", " }\n", " regression_table = pd.DataFrame(regress, columns=['version',\n", " 'h[0]','h[1]','h[2]','h[3]','h[4]','h[5]',\n", " 'cf[0]','cf[1]','cf[2]','cf[3]','cf[4]','cf[5]'])\n", " print regression_table" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Cleaning up" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "if remote_data:\n", " print 'Disconnecting from remote paraview server connection'\n", " Disconnect()\n", " pass" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "toggle input" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }