2nd High Lift Prediction Workshop

Alpha = 7deg , Re = 15E+06 , DLR - F11 configuration

References

High Lift Workshop

Define case name

This is the solver case to be analysed


In [1]:
case_name = 'v2'

Define Data Location

For remote data the interaction will use ssh to securely interact with the data
This uses the reverse connection capability in paraview so that the paraview server can be submitted to a job scheduler
Note: The default paraview server connection will use port 11111


In [2]:
remote_data = True
data_dir='/gpfs/cfms/workarea/projects/hyper_flux/high_lift/7deg_v3'

data_host='jappa@vis03'

remote_server_auto = True

paraview_cmd='mpiexec /gpfs/cfms/apps/bin/pvserver'
if not remote_server_auto:
    paraview_cmd=None

if not remote_data:
    data_host='localhost'
    paraview_cmd=None

Initialise Environment


In [3]:
%pylab inline
from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
import pylab as pl
import math
import numpy as np


Populating the interactive namespace from numpy and matplotlib
paraview version 4.2.0-75-gff3f889

Data Connection

This starts paraview server on remote host and connects


In [4]:
from zutil.post import pvserver_connect
if remote_data:
    pvserver_connect(data_host=data_host,data_dir=data_dir,paraview_cmd=paraview_cmd)


[jappa@vis03] Executing task 'port_test'
Selected Port: 12000
[jappa@vis03] Executing task 'pvserver'
[jappa@vis03] run: /bin/bash -l -c "cd /gpfs/cfms/workarea/projects/hyper_flux/high_lift/7deg_v3 && sleep 2;mpiexec /gpfs/cfms/apps/bin/pvserver -rc --client-host=localhost -sp=12000"
[jappa@vis03] out: 
[jappa@vis03] out: 		   _____ ______ __  __  _____ 
[jappa@vis03] out: 		  / ____|  ____|  \/  |/ ____|
[jappa@vis03] out: 		 | |    | |__  | \  / | (___  
[jappa@vis03] out: 		 | |    |  __| | |\/| |\___ \ 
[jappa@vis03] out: 		 | |____| |    | |  | |____) |
[jappa@vis03] out: 		  \_____|_|    |_|  |_|_____/ 
[jappa@vis03] out:                               
[jappa@vis03] out:                               
[jappa@vis03] out: 
[jappa@vis03] out: ++++++++++++++++++++++++++++: System Data :++++++++++++++++++++++++++++
[jappa@vis03] out: + Hostname = vis03
[jappa@vis03] out: + Kernel = 2.6.32-358.el6.x86_64
[jappa@vis03] out: + RHEL Release = Red Hat Enterprise Linux Server release 6.4 (Santiago)
[jappa@vis03] out: + Uptime = 22:42:15 up 6 days, 12:26, 8 users,
[jappa@vis03] out: + CPU = 2x Intel Xeon X5570 @ 2.93GHz
[jappa@vis03] out: + Memory = 132148768 kB
[jappa@vis03] out: ++++++++++++++++++++++++++++: User Data :++++++++++++++++++++++++++++++
[jappa@vis03] out: + Username = jappa
[jappa@vis03] out: +++++++++++++++++++++++: Contact Information :+++++++++++++++++++++++++
[jappa@vis03] out: + in case of any problems, contact: support@cfms.org.uk
[jappa@vis03] out: + for feedback, contact: feedback@cfms.org.uk 
[jappa@vis03] out: +++++++++++++++++++++: Maintenance Information :+++++++++++++++++++++++
[jappa@vis03] out: + There is no planned maintenance taking place this week
[jappa@vis03] out: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[jappa@vis03] out: 
[jappa@vis03] out: Reported: 1 (out of 1) daemons - 1 (out of 1) procs
[jappa@vis03] out: [jappa@vis03] rtunnel: opened reverse tunnel: (u'127.0.0.1', 34536) -> ('172.20.1.25', 22) -> ('localhost', 11111)
Connecting to client (reverse connection requested)...
[jappa@vis03] out: Connection URL: csrc://localhost:12000
[jappa@vis03] out: Client connected.
[jappa@vis03] out: 

Get control dictionary


In [5]:
from zutil.post import get_case_parameters,print_html_parameters
parameters=get_case_parameters(case_name,data_host=data_host,data_dir=data_dir)

Get status file


In [6]:
from zutil.post import get_status_dict
status=get_status_dict(case_name,data_host=data_host,data_dir=data_dir)
num_procs = str(status['num processor'])

Define test conditions - ETW experiment


In [7]:
from IPython.display import HTML
HTML(print_html_parameters(parameters))


Out[7]:
pressure295000.0
temperature114.0
Reynolds No15100000.0
Ref length347.09
Speed0.0
Mach No0.175

Read experimental data from prediction workshop


In [11]:
from zutil.post import get_csv_data

data_root = 'data/results/results_csv_format'

#meta_comp_results = 'data/results/metacomp_results'
#fluent_comp_results = 'data/results/fluent_results'


exp_data = {'ps01' : {'wing' : {'location': (0.0, 209.67 ,0.0),
                                }, 
                      'flap': {'location': (197.8982043488),
                               'normal' : (0.003629,-0.996368,-0.085077),
                               }, 
                      'slat': {'location': (-217.4733989342),
                               }, 
                      'eta' : 0.15,
                      'eta_index' : 15,
                      },
            'ps02' : {'wing' : {'location': (0.0, 403.87 ,0.0),
                                }, 
                      'flap': {'location': (392.1763409519),
                               'normal' : (0.003626,-0.996367,-0.085081),
                               },
                      'slat': {'location':(-411.7473427342),
                               }, 
                      'eta' : 0.285,
                      'eta_index' : 29,
                      },
            'ps04' : {'wing' : {'location': (0.0, 629.14 ,0.0)},
                      'flap': {'location': (-617.8606667446),
                               'normal' : (0.000246,0.989663,0.143413)
                               },
                      'slat': {'location':(-637.4499817342)
                               },
                      'eta' : 0.449,
                      'eta_index' : 45,
                      },
            'ps05' : {'wing' : {'location': (0.0, 760.30 ,0.0)},
                      'flap': {'location': (-749.2356867151),
                               'normal' : (0.000241,0.989664,0.143404)
                               },
                      'slat': {'location':(-768.8322037342)
                               },
                      'eta' : 0.543,
                       'eta_index' : 54,
                      },
            'ps06' : {'wing' : {'location': (0.0, 952.95 ,0.0)},
                      'flap': {'location': (-942.2476198083),
                               'normal' : (0.000247,0.989663,0.14341)
                               },
                      'slat': {'location':(-961.8352640342)
                               },
                      'eta' : 0.681,
                       'eta_index' : 68,
                      },
            'ps07' : {'wing' : {'location': (0.0, 1001.28 ,0.0)},
                      'flap': {'location': (-990.6836221217),
                               'normal' : (0.000229,0.989666,0.143389)
                               },
                      'slat': {'location':(-1010.3007059342)
                               },
                      'eta' : 0.715,
                       'eta_index' : 72,
                      },
            'ps08' : {'wing' : {'location': (0.0, 1051.35 ,0.0)},
                      'flap': {'location': (-1040.0478582652),
                               'normal' : (0.000244,0.990009,0.141001),
                               },
                      'slat': {'location':(-1060.4835625342),
                               },
                      'eta' : 0.751,
                       'eta_index' : 75,
                      },
            'ps09' : {'wing' : {'location': (0.0, 1145.79 ,0.0)
                                },
                      'flap': {'location': (-1134.5926478846),
                               'normal' : (0.000193,0.990019,0.140931)
                               },
                      'slat': {'location':(-1155.1131106342)
                               }, 
                      'eta' : 0.818,
                       'eta_index' : 82,
                      },
            'ps10' : {'wing' : {'location': (0.0, 1247.68 ,0.0)
                                },
                      'flap': {'location': (-1236.8582935410),
                               'normal' : (0.000301,0.989998,0.141080)
                               },
                      'slat': {'location':(-1257.1962384342)
                               }, 
                      'eta' : 0.891,
                       'eta_index' : 89,
                      },
            'ps11' : {'wing' : {'location': (0.0, 1349.83 ,0.0)
                                },
                      'flap': {'location': (-1339.1385759566),
                               'normal' : (0.000256,0.990007,0.141018)
                               },
                      'slat': {'location':(-1359.5541526342)
                               },
                      'eta' : 0.964,
                       'eta_index' : 96,
                      },
            }

exp_locations = { 'wing': {'normal':[0.0,1.0,0.0],
                           },
                  'slat' : {'normal': [0.003861,0.999926,0.011494],
                            },
                   'flap' : {'normal' : [],
                            },
                 }

# Read data

for key,value in exp_data.iteritems():
    value['wing']['data'] = get_csv_data(data_root+'/cp_'+key+'.csv',
                                header=True,remote=False,delim=',')
    #value['wing']['fluent-data'] = get_csv_data(fluent_comp_results+'/wing_'+str(value['eta_index'])+'_coarse.csv',
    #                                header=True,remote=False,delim=',')
    #value['wing']['metacomp-data'] = get_csv_data(meta_comp_results+'/wing_'+str(value['eta_index'])+'_coarse.csv',
    #                                header=True,remote=False,delim=',')
    value['flap']['data'] = get_csv_data(data_root+'/cp_'+key+'_flap.csv',
                                header=True,remote=False,delim=',')    
    #value['flap']['fluent-data'] = get_csv_data(fluent_comp_results+'/flap_'+str(value['eta_index'])+'_coarse.csv',
    #                                header=True,remote=False,delim=',')
    #value['flap']['metacomp-data'] = get_csv_data(meta_comp_results+'/flap_'+str(value['eta_index'])+'_coarse.csv',
    #                                header=True,remote=False,delim=',')
    value['slat']['data'] = get_csv_data(data_root+'/cp_'+key+'_slat.csv',
                                header=True,remote=False,delim=',')
    #value['slat']['fluent-data'] = get_csv_data(fluent_comp_results+'/slat_'+str(value['eta_index'])+'_coarse.csv',
    #                                header=True,remote=False,delim=',')
    #value['slat']['metacomp-data'] = get_csv_data(meta_comp_results+'/slat_'+str(value['eta_index'])+'_coarse.csv',
    #                                header=True,remote=False,delim=',')

In [ ]:

Cp profiles at different positions


In [9]:
from zutil.post import cp_profile_wall_from_file

def get_cp_profile(file_root,section_loc,section_normal,section_data):
    force_data = cp_profile_wall_from_file(file_root,
                              section_normal,
                              section_loc,
                              func=cp_array,
                              section_data=section_data,
                              alpha=0.0)
    
def cp_array(data_array,pts_array,**kwargs):
    cp_array = data_array.GetPointData()['cp']
    section_data = kwargs['section_data']
    section_data.append((pts_array.GetPoints(),cp_array))

In [12]:
from zutil.post import get_case_root

section_data = {}

for station,val in exp_data.items():
    
    print 'Extracting station: '+station
    
    section_data[station] = {}
    
    for key,data in val.items():
        section_data[station][key] = []
        if key == 'wing':
            #print 'Location: ' + key
            get_cp_profile(get_case_root(case_name,num_procs),
                           data['location'],
                           exp_locations[key]['normal'],
                           section_data[station][key]
                           )
                        
        if key == 'flap':
            get_cp_profile(get_case_root(case_name,num_procs),
                           [0.0,-data['location']/data['normal'][1],0.0],
                           data['normal'],
                           section_data[station][key]
                           )
        if key == 'slat':
            get_cp_profile(get_case_root(case_name,num_procs),
                           [0.0,-data['location']/exp_locations[key]['normal'][1],0.0],
                           exp_locations[key]['normal'],
                           section_data[station][key]
                           )


Extracting station: ps09
Extracting station: ps08
Extracting station: ps07
Extracting station: ps06
Extracting station: ps05
Extracting station: ps04
Extracting station: ps10
Extracting station: ps02
Extracting station: ps01
Extracting station: ps11

In [13]:
for station,val in exp_data.items():
    
    for key,data in val.items():

        section = section_data[station][key]
        
        if len(section) == 3:      
            # First get min loc for each loop
            min_loc = []
            for loop in section:
                pts = loop[0]
                lmin = np.amin(pts[:,0])
                min_loc.append(lmin)

            sort_index = np.argsort(np.array(min_loc))   

            if key == 'wing':
                section_data[station][key] = [section[sort_index[1]]]
            
            if key == 'slat':
                section_data[station][key] = [section[sort_index[0]]]
            
            if key == 'flap':
                section_data[station][key] = [section[sort_index[2]]]

            for loop in section:
                pts = loop[0]
                cp  = loop[1]

                lmin = np.amin(pts[:,0])
                lmax = np.amax(pts[:,0])

                pts[:,0] = (pts[:,0]-lmin)/(lmax-lmin)
                
                zmin = np.amin(pts[:,2])
                zmax = np.amax(pts[:,2])
                
                pts[:,2] = (pts[:,2]-zmin)/(lmax-lmin)
        
        
    #print val['flap']['fluent-data']
    #lmin = np.amin(val['slat']['fluent-data']['X'])
    #lmax = np.amax(val['slat']['fluent-data']['X'])   
    #val['slat']['fluent-data']['X'] = (val['slat']['fluent-data']['X']-lmin)/(lmax-lmin)
    #lmin = np.amin(val['wing']['fluent-data']['X'])
    #lmax = np.amax(val['wing']['fluent-data']['X'])   
    #val['wing']['fluent-data']['X'] = (val['wing']['fluent-data']['X']-lmin)/(lmax-lmin)
    #lmin = np.amin(val['flap']['fluent-data']['X'])
    #lmax = np.amax(val['flap']['fluent-data']['X'])   
    #val['flap']['fluent-data']['X'] = (val['flap']['fluent-data']['X']-lmin)/(lmax-lmin)
    
    #lmin = np.amin(val['slat']['metacomp-data']['X'])
    #lmax = np.amax(val['slat']['metacomp-data']['X'])   
    #val['slat']['metacomp-data']['X'] = (val['slat']['metacomp-data']['X']-lmin)/(lmax-lmin)
    #lmin = np.amin(val['wing']['metacomp-data']['X'])
    #lmax = np.amax(val['wing']['metacomp-data']['X'])   
    #val['wing']['metacomp-data']['X'] = (val['wing']['metacomp-data']['X']-lmin)/(lmax-lmin)
    #lmin = np.amin(val['flap']['metacomp-data']['X'])
    #lmax = np.amax(val['flap']['metacomp-data']['X'])   
    #val['flap']['metacomp-data']['X'] = (val['flap']['metacomp-data']['X']-lmin)/(lmax-lmin)

In [14]:
from matplotlib.backends.backend_pdf import PdfPages
from IPython.display import FileLink, display 

from collections import OrderedDict
import matplotlib.font_manager as fm
prop=fm.FontProperties(size=20)

for station in sorted(exp_data):

    val = exp_data[station]
    
    comp_fig1 = pl.figure(figsize=(30, 10),dpi=150, facecolor='w', edgecolor='k')
    comp_fig1.suptitle('Eta: '+str(val['eta']), fontsize=30, fontweight='bold')

    comp_ax   = comp_fig1.add_subplot(1,3,1)
    comp_ax_w = comp_fig1.add_subplot(1,3,2)
    comp_ax_f = comp_fig1.add_subplot(1,3,3)

    comp_ax.grid(True)
    comp_ax.set_xlabel('x/c', fontsize=20, fontweight='bold')
    comp_ax.set_ylabel('Cp', fontsize=20, fontweight='bold')
    comp_ax.set_title('Slat', fontsize=20, fontweight='bold')
    comp_ax.axis([0,1,1.5,-4.])
    comp_ax2 = comp_ax.twinx()
    comp_ax2.axis([0,1,0,1])

    comp_ax_w.grid(True)
    comp_ax_w.set_xlabel('x/c', fontsize=20, fontweight='bold')
    comp_ax_w.set_ylabel('Cp', fontsize=20, fontweight='bold')
    comp_ax_w.set_title('Main Wing', fontsize=20, fontweight='bold')
    comp_ax_w.axis([0.0,1.0,1.5,-4.])
    comp_ax2_w = comp_ax_w.twinx()
    comp_ax2_w.axis([0,1,-0.5,0.5])

    comp_ax_f.grid(True)
    comp_ax_f.set_xlabel('x/c', fontsize=20, fontweight='bold')
    comp_ax_f.set_ylabel('Cp', fontsize=20, fontweight='bold')
    comp_ax_f.set_title('Flap', fontsize=20, fontweight='bold')
    comp_ax_f.axis([0.0,1.0,1.5,-4.])
    comp_ax2_f = comp_ax_f.twinx()
    comp_ax2_f.axis([0,1,0,1])

    section = section_data[station]['slat'][0]    
    x_loc = section[0][:,0]
    z_loc = section[0][:,2]
    cp    = section[1]
        
    comp_ax.plot(val['slat']['data']['x/c_local'],val['slat']['data']['cp_ETW_RUN238'],'b.', color='b', markersize=25,label = 'Experiment')
    comp_ax.plot(x_loc,cp,'b.', color='r',markersize=20,label = 'zCFD')
    comp_ax2.plot(x_loc,z_loc, color='gray',markersize=20,label = 'Profile')
    #comp_ax.plot(val['slat']['metacomp-data']['X'],val['slat']['metacomp-data']['CP'],'b.',color='k',markersize=20,label='CFD++')
    #comp_ax.plot(val['slat']['fluent-data']['X'],val['slat']['fluent-data']['CP'],'b.',color='g',markersize=20,label='FLUENT')

    section = section_data[station]['wing'][0]    
    x_loc = section[0][:,0]
    z_loc = section[0][:,2]
    cp    = section[1]

    comp_ax_w.plot(val['wing']['data']['x/c_local'],val['wing']['data']['cp_ETW_RUN238'],'b.', color='b', markersize=25, label = 'Experiment')
    comp_ax_w.plot(x_loc,cp ,'b.',color='r',markersize=20,label = 'zCFD')
    comp_ax2_w.plot(x_loc,z_loc, color='gray',markersize=20,label = 'Profile')
    #comp_ax_w.plot(val['wing']['metacomp-data']['X'],val['wing']['metacomp-data']['CP'] ,'b.',color='k',markersize=20,label = 'CFD++')
    #comp_ax_w.plot(val['wing']['fluent-data']['X'],val['wing']['fluent-data']['CP'] ,'b.',color='g',markersize=20,label = 'FLUENT')

    section = section_data[station]['flap'][0]
    x_loc = section[0][:,0]
    z_loc = section[0][:,2]
    cp    = section[1]

    comp_ax_f.plot(val['flap']['data']['x/c_local'],val['flap']['data']['cp_ETW_RUN238'],'b.', color='b', markersize=25,label = 'Experiment')
    comp_ax_f.plot(x_loc,cp, 'b.', color ='r', markersize=20,label = 'zCFD')
    comp_ax2_f.plot(x_loc,z_loc, color='gray',markersize=20,label = 'Profile')
    #comp_ax_f.plot(val['flap']['metacomp-data']['X'],val['flap']['metacomp-data']['CP'], 'b.', color ='k', markersize=20,label = 'CFD++')
    #comp_ax_f.plot(val['flap']['fluent-data']['X'],val['flap']['fluent-data']['CP'], 'b.', color ='g', markersize=20,label = 'FLUENT')

    comp_ax.legend(loc = 'upper right',numpoints=1,prop = prop)
    comp_ax_w.legend(loc = 'upper right',numpoints=1,prop = prop)
    comp_ax_f.legend(loc = 'upper right',numpoints=1,prop = prop)

    comp_fig1.savefig('images/case2b_'+station+'.svg')
    show()


Convergence


In [34]:
from zutil.post import residual_plot, get_case_report
residual_plot(get_case_report(case_name))
show()


Cleaning up


In [15]:
from zutil.post import pvserver_disconnect
if remote_data:
    print 'Disconnecting from remote paraview server connection'
    pvserver_disconnect()
    pass


Disconnecting from remote paraview server connection
Exiting...
[jappa@vis03] out: 

In [ ]: