# -*- coding: iso-8859-1 -*-
#-------------------------------------------------------------------------------
#Copyright (C) 2002 - 2003, EDF/R&D/MFTT
#-------------------------------------------------------------------------------
"""
This module defines the radiation scalars boundaries model data management.
This module contains the following classes and function:
- RadiativeBoundariesModel
- RadiativeBoundariesView
- PageText
- RadiativeBoundariesTestCase
"""
#-------------------------------------------------------------------------------
# Library modules import
#-------------------------------------------------------------------------------
import sys, unittest
import Tix
from Tkconstants import *
#-------------------------------------------------------------------------------
# Application modules import
#-------------------------------------------------------------------------------
from Base.Common import *
import Base.Toolbox as Tool
import Base.Dialog as Dialog
import Base.TkPage as TkPage
#-------------------------------------------------------------------------------
# Radiation Scalar Boundaries model class
#-------------------------------------------------------------------------------
class RadiativeBoundariesModel(TkPage.Page):
"""
"""
def __init__(self, case):
"""
Constructor
"""
self.case = case
self.node_ray = self.case.xmlInitNode('radiative_transfer')
self.node_bc = self.case.xmlInitNode('boundary_conditions')
self.node_def = self.node_bc.xmlInitNode('boundary_definition')
self.list_full = [('EPSP' , 'emissivity'),
( 'XLAMP', 'thermal_conductivity'),
( 'EPAP' , 'thickness' ),
( 'FLUX' , 'flux' ),
( 'TEXTP', 'external_temperature_profile'),
( 'TINTP', 'internal_temperature_profile'),
( 'IZFRDP', 'output_zone')]
self.InitDefaultValues()
def InitDefaultValues(self):
"""
Return in a dictionnary which contains default values
"""
self.defValues = {}
self.defValues['emissivity'] = '0.8'
self.defValues['thermal_conductivity'] = '3.0'
self.defValues['thickness'] = '0.10'
self.defValues['flux'] = '0.'
self.defValues['external_temperature_profile'] = '300.'
self.defValues['internal_temperature_profile'] = '300.'
self.defValues['choice_condition'] = 'itpimp'
self.defValues['output_zone'] = '1'
def getRadiativeTransfertModel(self):
return self.node_ray['model']
def getRef(self, type, label):
from BoundConditions import BoundaryConditionsModel
valref = BoundaryConditionsModel(self.case).getRef(type, label)
del BoundaryConditionsModel
return valref
def getBoundDefList(self):
return self.node_def.xmlGetChildNodeList('wall')
def getNodeRayCondition(self, label):
node = self.node_bc.xmlGetChildNode('wall', label=label)
nod_ray_cond = node.xmlInitChildNode('wall_radiative_condition')
return nod_ray_cond
def getTypeOfCondition(self, label):
nod_ray_cond = self.getNodeRayCondition(label)
choice = nod_ray_cond['choice']
if choice:
choice = nod_ray_cond['choice']
else:
choice = self.defValues['choice_condition']
self.setTypeOfCondition(choice, label)
return choice
def getListValRay(self, choice):
list = []
if choice == 'itpimp':
list = ('emissivity', 'internal_temperature_profile', 'output_zone')
elif choice == 'ipgrno':
list = ('emissivity', 'thermal_conductivity', 'thickness',
'external_temperature_profile',
'internal_temperature_profile', 'output_zone')
elif choice == 'iprefl':
list = ('thermal_conductivity', 'thickness',
'external_temperature_profile',
'internal_temperature_profile', 'output_zone')
elif choice == 'ifgrno':
list = ('emissivity', 'flux', 'internal_temperature_profile', 'output_zone')
elif choice == 'ifrefl':
list = ('flux', 'internal_temperature_profile', 'output_zone')
return list
def setTypeOfCondition(self, choice, label):
nod_ray_cond = self.getNodeRayCondition(label)
nod_ray_cond['choice'] = choice
list = self.getListValRay(choice)
for i in list:
if not nod_ray_cond.xmlGetChildNode(i):
nod_ray_cond.xmlSetData(i, self.defValues[i])
def setEmissivity(self, label, val):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('emissivity',val)
def getEmissivity(self, label):
val = self.defValues['emissivity']
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
val = nod_ray_cond.xmlGetString('emissivity')
return val
def setThickness(self, label, val):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('thickness',val)
def getThickness(self, label):
val = self.defValues['thickness']
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
val = nod_ray_cond.xmlGetString('thickness')
return val
def setThermalConductivity(self, label, val):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('thermal_conductivity',val)
def getThermalConductivity(self, label):
val = self.defValues['thermal_conductivity']
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
val = nod_ray_cond.xmlGetString('thermal_conductivity')
return val
def setInternalTemperatureProfile(self, label, val):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('internal_temperature_profile',val)
def getInternalTemperatureProfile(self, label):
val = self.defValues['internal_temperature_profile']
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
val = nod_ray_cond.xmlGetString('internal_temperature_profile')
return val
def setExternalTemperatureProfile(self, label, val):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('external_temperature_profile',val)
def getExternalTemperatureProfile(self, label):
val = self.defValues['external_temperature_profile']
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
val = nod_ray_cond.xmlGetString('external_temperature_profile')
return val
def setFlux(self, label, val):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('flux',val)
def getFlux(self, label):
val = self.defValues['flux']
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
val = nod_ray_cond.xmlGetString('flux')
return val
def setOutputRadiativeZone(self, val, label):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
nod_ray_cond.xmlSetData('output_zone',val)
def getOutputRadiativeZone(self, label):
nod_ray_cond = self.getNodeRayCondition(label)
if not nod_ray_cond.xmlGetNode('output_zone'):
val = self.defValues['output_zone']
else:
## val = nod_ray_cond.xmlGetString('output_zone')
val = nod_ray_cond.xmlGetInt('output_zone')
return val
def setValRay(self, val, var, label):
nod_ray_cond = self.getNodeRayCondition(label)
if nod_ray_cond:
for tt, head in self.list_full:
if tt == var:
nod_ray_cond.xmlSetData(head,val)
def __getValRay(self, rayvar, label):
nod_ray_cond = self.getNodeRayCondition(label)
if not nod_ray_cond.xmlGetNode(rayvar):
val = self.defValues[rayvar]
else:
val = nod_ray_cond.xmlGetString(rayvar)
return val
#-------------------------------------------------------------------------------
# Main class
#-------------------------------------------------------------------------------
class RadiativeBoundariesView(TkPage.Page):
"""
Class to open all Scalars (thermal, user and model) Boundary Conditions Page.
Warning: turbulence variables (k, epsilon, Rij) are not considered
like scalars.
"""
def _tkControlVariables(self):
"""
Tkinter variables declaration.
"""
self.valref = Tix.StringVar()
self.type_cond = Tix.StringVar()
self.epsp = Tix.DoubleVar()
self.xlamp = Tix.DoubleVar()
self.epap = Tix.DoubleVar()
self.flux = Tix.DoubleVar()
self.textp = Tix.DoubleVar()
self.tintp = Tix.DoubleVar()
self.nb_zone = Tix.IntVar()
self.label = ""
def _pageControl(self):
"""
Xml node declaration and supplementary default value settings.
"""
t = PageText()
self.mdl = RadiativeBoundariesModel(self.case)
# Initialize variables concerning the display of the Hlist1
#
self.mousePointedEntry1 = None
self.selectedEntry1 = None
self.currentEntry1 = None
self.entriesNumber1 = 0
def _make_style(self):
"""
Define beautyfull style in order to display columns in the List.
"""
self.style={}
self.style['header'] = Tix.DisplayStyle(Tix.TEXT,
fg='black',
refwindow=self.lf.frame,
anchor=CENTER,
padx=5, pady=2,
font=fB)
## for type in self.typeList.keys():
self.style['wall'+'b'] = Tix.DisplayStyle(Tix.TEXT,
refwindow=self.lf.frame,
padx=5,
## fg=self.typeColor['wall'],
fg="blue",
selectforeground='#fefefe',
font=fB)
self.style['wall'] = Tix.DisplayStyle(Tix.TEXT,
refwindow=self.lf.frame,
padx=5,
anchor=CENTER,
## fg=self.typeColor['wall'],
fg="blue",
selectforeground='#fefefe',
font=fN)
def _createHlist(self):
"""
Create the Hlist for the boundary Regions.
"""
t = PageText()
# Put a simple hierachy into the HList (two levels). Use colors and
# separator widgets (frames) to make the list look fancy
#
self.h1 = Tix.ScrolledHList(self.f1,
options='hlist.columns 3 hlist.header 1' )
self.h1.config(scrollbar="auto +y")
self.h1.hlist.config(browsecmd=self.selectHList,
command=self.selectHList,
bg=wm['hlistbackground'])
self.h1.hsb.config(width=10, bd=1)
self.h1.vsb.config(width=10, bd=1)
self.h1.pack(padx=10, pady=10, side=TOP)
## self.f4.pack(side=TOP)
# First some styles for the headers
#
self._make_style()
# Create the headers
#
self.h1.hlist.header_create(0, itemtype=Tix.TEXT, text=t.LABEL,
style=self.style['header'])
self.h1.hlist.header_create(1, itemtype=Tix.TEXT, text=t.TYPE,
style=self.style['header'])
# Notice that we use 3 columns in the hlist widget. This way when the user
# expands the windows wide, the right side of the header doesn't look
# chopped off. The following line ensures that the 3 column header is
# not shown unless the hlist window is wider than its contents.
#
self.h1.hlist.column_width(2,0)
# Let configure the appearance of the HList subwidget
#
self.h1.hlist.config(separator='.', width=25, height=11, drawbranch=0, indent=10)
# Let configure the width of the columns
#
self.h1.hlist.column_width(0, chars=16)
self.h1.hlist.column_width(1, chars=9)
def addInHlist(self, type, label):
"""
Create the item list associated with the new boundary definition.
"""
self.stbar.busy()
t = PageText()
type = 'wall'
self.entriesNumber = self.entriesNumber + 1
name = 'entry' + repr(self.entriesNumber)
self.h1.hlist.add(name, itemtype=Tix.TEXT,
text=label,
style=self.style[type+'b'])
self.h1.hlist.item_create(name, 1, itemtype=Tix.TEXT,
text=t.WALL,
style=self.style[type])
self.stbar.idle()
def selectHList(self, entry=None):
"""
Browsecmd:
Every single Clik on the Button1 of the mouse send TWO signal to the GUI
the first one when man push the button, and the second one when the
button gets back.
Command:
Every double-Click and Return send only ONE signal to the GUI.
"""
self.selectedEntry1 = self.mousePointedEntry1
self.mousePointedEntry1 = entry
if (self.selectedEntry1 == self.mousePointedEntry1
and self.currentEntry1 != self.mousePointedEntry1):
if entry == None:
msg = "There is an error in the use of the HList1.\n"\
"The selectionned entry is:" + entry + "\n"
raise ValueError, msg
t = PageText()
self.currentEntry1 = entry
# Here we must call the tk function directly without passing in
# Tix.py, because of a bug in tix8.1 in the Hlist.item_cget function
#
h = self.h1.hlist
self.label = h.tk.call(h, 'item', 'cget', entry, 0, '-text')
valref = self.mdl.getRef('wall', self.label)
self.valref.set(valref)
self.f4.pack_forget()
if self.mdl.getRadiativeTransfertModel == "off":
self.s2.pack_forget()
self.f3.pack_forget()
else:
self.s2.pack(side=TOP, fill=Y, pady=10)
self.f3.pack(side=TOP, fill=X, pady=10)
self.putTypeofCondition()
def setVariablesForCondition(self, cond, event=None):
"""
Put variables for the type of condition choised.
"""
t = PageText()
list , frad = self.getListVariablesForCondition(cond)
self.setRadiativeWall(list, frad)
def getListVariablesForCondition(self, cond):
"""
Get list of variables for condition choosed and put good window
"""
t = PageText()
self.f4.pack_forget()
self.f41.pack_forget()
self.f42.pack_forget()
self.f43.pack_forget()
self.f44.pack_forget()
self.f45.pack_forget()
self.s2.pack(side=TOP, fill=X, pady=10)
self.f4.pack(side=TOP, fill=X, pady=10)
## self.type_cond.set(cond)
if cond == 'itpimp':
list = [(0, self.epsp, t.EPSP, '', 'EPSP'),
(1, self.tintp, t.TINTP, 'K', 'TINTP')]
self.f41 = Tix.Frame(self.f4, relief=FLAT)
self.f41.pack(side=TOP, fill=X, pady=10)
frad = self.f41
if cond == 'ipgrno':
list = [(0, self.epsp, t.EPSP, '', 'EPSP'),
(1, self.xlamp, t.XLAMP, 'W/m/K', 'XLAMP'),
(2, self.epap, t.EPAP, 'm', 'EPAP'),
(3, self.textp, t.TEXTP, 'K', 'TEXTP'),
(4, self.tintp, t.TINTP, 'K', 'TINTP')]
self.f42 = Tix.Frame(self.f4, relief=FLAT)
self.f42.pack(side=TOP, fill=X, pady=10)
frad = self.f42
if cond == 'iprefl':
list = [(0, self.xlamp,t.XLAMP, 'W/m/K', 'XLAMP'),
(1, self.epap, t.EPAP, 'm', 'EPAP'),
(2, self.textp,t.TEXTP, 'K', 'TEXTP'),
(3, self.tintp,t.TINTP, 'K', 'TINTP')]
self.f43 = Tix.Frame(self.f4, relief=FLAT)
self.f43.pack(side=TOP, fill=X, pady=10)
frad = self.f43
if cond == 'ifgrno':
list = [(0, self.epsp, t.EPSP, '', 'EPSP'),
(1, self.flux, t.FLUX, 'W/m2', 'FLUX'),
(2, self.tintp, t.TINTP, 'K', 'TINTP')]
self.f44 = Tix.Frame(self.f4, relief=FLAT)
self.f44.pack(side=TOP, fill=X, pady=10)
frad = self.f44
if cond == 'ifrefl':
list = [(0, self.flux, t.FLUX, 'W/m2', 'FLUX'),
(1, self.tintp, t.TINTP, 'K', 'TINTP')]
self.f45 = Tix.Frame(self.f4, relief=FLAT)
self.f45.pack(side=TOP, fill=X, pady=10)
frad = self.f45
return list, frad
def putTypeofCondition(self, event=None):
"""
Put variables for the type of condition choised.
"""
self.stbar.busy()
cond = self.mdl.getTypeOfCondition(self.label)
self.typray.config(value=cond)
self.setVariablesForCondition(cond)
self.stbar.idle()
## def getTypeofCondition(self, type_fac, event=None):
def getTypeofCondition(self, event=None):
"""
Get variables for the type of condition choised.
"""
self.stbar.busy()
cond = self.type_cond.get()
if cond:
self.mdl.setTypeOfCondition(cond, self.label)
self.setVariablesForCondition(cond,self.label)
self.stbar.idle()
def setRadiativeWall(self, list, frad):
"""
Create the Page layout.
"""
t = PageText()
l = len(list)
self.entval = [0]*l
#initialisation of values
self.epsp.set(self.mdl.getEmissivity(self.label))
self.xlamp.set(self.mdl.getThermalConductivity(self.label))
self.epap.set(self.mdl.getThickness(self.label))
self.textp.set(self.mdl.getExternalTemperatureProfile(self.label))
self.tintp.set(self.mdl.getInternalTemperatureProfile(self.label))
self.flux.set(self.mdl.getFlux(self.label))
self.nb_zone.set(self.mdl.getOutputRadiativeZone(self.label))
for i, var, tt, unit, key in list:
Tix.Label(frad, width=20, text=tt).grid(row=i, column=0, pady=5, padx=10)
self.entval[i]= Tix.Entry(frad, width=10, textvariable=var)
self.entval[i].grid(row=i, column=1, pady=5, padx=10)
Tix.Label(frad,width=8, text=unit).grid(row=i, column=2, ipady=1,pady=5)
self.entval[i].event_add("<<Event3>>", "<Return>", "<Leave>", "<FocusOut>")
self.entval[i].bind("<<Event3>>", TkPage.Callback(self.getValRay,i, var, key))
self.balloon.bind_widget(self.entval[i], balloonmsg=t.KEYWORD+key)
# number of zone
Tix.Label(frad, width=25, text=t.ZONE).grid(row=l, column=0, pady=5, padx=10)
self.valzone = Tix.Entry(frad, width=10, textvariable=self.nb_zone)
self.valzone.grid(row=l, column=1, pady=5, padx=10)
self.valzone.event_add("<<Event3>>", "<Return>", "<Leave>", "<FocusOut>")
self.valzone.bind("<<Event3>>", self.getZone)
def getValRay(self, i, var, key, event=None):
self.stbar.busy()
if key in ['EPSP','EPAP']:
if self.check2.isSPositive(self.entval[i], var):
self.mdl.setValRay(var.get(), key, self.label)
return var.get()
else:
if self.check2.hasType(self.entval[i], var):
self.mdl.setValRay(var.get(), key, self.label)
return var.get()
self.stbar.idle()
def getZone(self, event=None):
self.stbar.busy()
if self.check2.isSPositive(self.valzone, self.nb_zone):
self.mdl.setOutputRadiativeZone(self.nb_zone.get(), self.label)
return self.nb_zone.get()
self.stbar.idle()
def _createWidgets(self):
"""
Create the Page layout.
"""
t = PageText()
self.lf = Tix.LabelFrame(self.myPage, bd=2, label=t.SCALARS_BOUNDARIES, relief=FLAT)
self.lf.label.config(font=fT)
self.lf.pack(side=TOP, fill=X, padx=6, pady=6)
f0 = Tix.Frame(self.lf.frame, relief=SUNKEN)
f0.pack(side=TOP, anchor=W)
self.f1 = Tix.Frame(f0, relief=SUNKEN)
self.f1.pack(side=LEFT, padx=10)
self.s1 = Tix.Frame(f0, width=2, bd=2, relief=SUNKEN)
self.s1.pack(side=LEFT, fill=Y, pady=10)
self.f2 = Tix.Frame(f0, relief=FLAT)
self.f2.pack(side=LEFT)
self.s2 = Tix.Frame(self.lf.frame, height=2, bd=2, relief=SUNKEN)
## self.f2 = Tix.Frame(f0, relief=FLAT)
## self.f2.pack(side=LEFT)
Tix.Label(self.f2, text=t.REF).grid(row=0,column=0,padx=3)
self.ref = Tix.Entry(self.f2, width=25, relief=GROOVE,bd=2,
bg='lightblue', textvariable=self.valref)
self.ref.grid(row=1, column=0, sticky=E)
scroll = Tix.Scrollbar(self.f2, orient=HORIZONTAL, width=10, bd=2,
command=TkPage.Callback(self._scrollHandler, self.ref))
scroll.grid(row=2, column=0, sticky=E+W)
self.ref['xscrollcommand'] = scroll.set
self.ref.config(state=DISABLED)
# windows for menubutton for choice of condition type of radiation
self.f3 = Tix.Frame(self.lf.frame, relief=FLAT)
Tix.Label(self.f3, text=t.TYPE_COND).grid(row=0,column=0,padx=3)
self.typray = Tix.OptionMenu(self.f3, options='menubutton.width 30')
self.typray.menubutton.config(bd=2, relief=RAISED)
self.typray.menu.config()
self.typray.grid(row=0,column=1, padx=3)
self.typray.add_command('itpimp', label=t.ITPIMP)
self.typray.add_command('ipgrno', label=t.IPGRNO)
self.typray.add_command('iprefl', label=t.IPREFL)
self.typray.add_command('ifgrno', label=t.IFRGNO)
self.typray.add_command('ifrefl', label=t.IFREFL)
self.typray.config(variable=self.type_cond, command= self.getTypeofCondition)
## command= TkPage.Callback(self.getTypeofCondition, self.label))
self.balloon.bind_widget(self.typray, balloonmsg=t.KEYWORD+'ISOTHP')
# windows for radiation variables to see with choice of menubutton
self.f4 = Tix.Frame(self.lf.frame, relief=FLAT)
self.f41 = Tix.Frame(self.f4, relief=FLAT)
self.f42 = Tix.Frame(self.f4, relief=FLAT)
self.f43 = Tix.Frame(self.f4, relief=FLAT)
self.f44 = Tix.Frame(self.f4, relief=FLAT)
self.f45 = Tix.Frame(self.f4, relief=FLAT)
self._createHlist()
def _initializeWidgets(self):
"""
Extract resquested informations from XML document.
This informations are used to initialize the widgets.
For this page default values of all widgets are necessary
included in the XML file.
"""
boundList = []
self.entriesNumber = 0
nodeList = self.mdl.getBoundDefList()
if nodeList:
for node in nodeList:
label = node['label']
self.mdl.getTypeOfCondition(label)
if (label) not in boundList:
boundList.append(label)
self.addInHlist('wall', label)
#-------------------------------------------------------------------------------
# Text and messages for this page
#-------------------------------------------------------------------------------
class PageText:
"""
Storage of all texts and messages for this page.
"""
def __init__(self):
# 1) Texts
#
if Tool.GuiParam.lang == 'fr':
self.BOUNDARY_REGIONS = "Zones de frontière"
self.EPSP = "Emissivite"
self.XLAMP = "Conductivité"
self.TEXTP = "Température externe"
self.TINTP = "Température initiale"
self.FLUX = "Flux de conduction"
self.INLET = "entrée"
self.OUTLET = "sortie"
self.LABEL = "Étiquette"
self.LABEL_SCA = "Nom du scalaire"
self.NUM = "n°"
self.OFF = "non"
self.ON = "oui"
self.SCALARS = "Scalaires"
self.SCALARS_BOUNDARIES = "Conditions aux limites des scalaires"
self.SYMMETRY = "symétrie"
self.ITPIMP = "Paroi grise ou noire\n"\
" + profil de température interne imposé"
self.IPGRNO = "Paroi grise ou noire\n"\
" + profil de température externe imposé"
self.IPREFL = "Paroi réfléchissante\n"\
" + profil de température externe imposé"
self.IFRGNO = "Paroi grise ou noire\n"\
" + flux de conduction imposé en paroi"
self.IFREFL = "Paroi réfléchissante\n"\
" + flux de conduction imposé en paroi"
self.UNDEFINED = "indéfini"
self.WALL = "paroi"
self.NAME = "Nom du Scalaire"
self.REF = "Référence(s)"
self.TYPE = "Type"
self.TYPE_COND = "Type de condition"
self.VALUE = "Valeur"
self.COEFF1 = "Coefficient\nd'échange"
self.COEFF = "Coeff. éch."
self.LAMBDA = "Lambda"
self.EPSILON = "Epsilon"
self.EPAP = "Epaisseur"
self.DIRICHLET = "Dirichlet"
self.NEUMANN = "Neumann"
self.KEYWORD = "Mot clé Code_Saturne: "
self.ZONE = "Zone de post-processing : n°"
else:
self.BOUNDARY_REGIONS = "Boundary regions"
self.EPSP = "Emissivite"
self.XLAMP = "Conductivité"
self.TEXTP = "Température externe"
self.TINTP = "Température initiale"
self.FLUX = "Flux de conduction"
self.INLET = "inlet"
self.OUTLET = "outlet"
self.LABEL = "Label"
self.LABEL_SCA = "Scalar name"
self.NUM = " # "
self.OFF = "off"
self.ON = "on"
self.SCALARS = "Scalars"
self.SCALARS_BOUNDARIES = "Scalars boundaries"
self.SYMMETRY = "symmetry"
self.ITPIMP = "Paroi grise ou noire\n"\
" + profil de température interne imposé"
self.IPGRNO = "Paroi grise ou noire\n"\
" + profil de température externe imposé"
self.IPREFL = "Paroi réfléchissante\n"\
" + profil de température externe imposé"
self.IFRGNO = "Paroi grise ou noire\n"\
" + flux de conduction imposé en paroi"
self.IFREFL = "Paroi réfléchissante\n"\
" + flux de conduction imposé en paroi"
self.TYPE = "Type"
self.UNDEFINED = "undefined"
self.WALL = "wall"
self.NAME = "Scalar Name"
self.REF = "Referency(ies)"
self.TYPE = "Type"
self.TYPE_COND = "Type of condition"
self.VALUE = "Value"
self.COEFF1 = "Exchange\nCoefficient"
self.COEFF = "Exch. Coeff"
self.LAMBDA = "Lambda"
self.EPSILON = "Epsilon"
self.EPAP = "Thickness"
self.DIRICHLET = "Dirichlet"
self.NEUMANN = "Neumann"
self.KEYWORD = "Code_Saturne keyword: "
self.ZONE = "Post-processing zone: n°"
# 2) Messages
#
if Tool.GuiParam.lang == 'fr':
self.MSG_SYMMETRY = "Aucune information\nutilisateur\nn'est nécessaire"
self.MSG_UNDEFINED = "Intervention utilisateur obligatoire\n"\
"dans le sous-programe USCLIM"
else:
self.MSG_SYMMETRY = "No user input is required"
self.MSG_UNDEFINED = "User-coding is required "\
"in the subroutine USCLIM"
#-------------------------------------------------------------------------------
# TurbulenceModel test case
#-------------------------------------------------------------------------------
class RadiativeBoundariesTestCase(unittest.TestCase):
"""
"""
def setUp(self):
"""
This method is executed before all "check" methods.
"""
from Base.XMLengine import Case
from Base.XMLinitialize import XMLinit
Tool.GuiParam.lang = 'en'
self.case = Case()
XMLinit(self.case)
self.node_bc = self.case.xmlInitNode('boundary_conditions')
def tearDown(self):
"""
This method is executed after all "check" methods.
"""
del self.case
def xmlNewFile(self):
"""Private method to return a xml document."""
xml.doc = '<?xml version="1.0" encoding="utf-8"?>'\
'<TestCase case="CASE" study="STUDY" version="0.0">'\
'<solution_domain/>'\
'<thermophysical_models>'\
'<boundary_conditions>'\
'<boundary_definition/>'\
'<wall label="wall_1"/>'\
'<wall label="wall_2"/>'\
'<wall label="wall_3"/>'\
'<wall label="wall_4"/>'\
'<wall label="wall_5"/>'\
'<wall label="wall_6"/>'\
'<wall label="wall_7"/>'\
'<wall label="wall_8"/>'\
'</boundary_conditions>'
return xml.doc
def checkRadiativeBoundariesInstantiation(self):
"""
Check whether the RadiativeBoundariesModel class could be instantiated
"""
model = None
model = RadiativeBoundariesModel(self.case)
assert model != None, 'Could not instantiate RadiativeBoundariesModel'
def checkGetBoundDefList(self):
"""
Check whether the ScalarBoundariesModel class could be get list of wall balises
"""
mdl = RadiativeBoundariesModel(self.case)
list = mdl.getBoundDefList()
def suite():
testSuite = unittest.makeSuite(RadiativeBoundariesTestCase, "check")
return testSuite
def runTest():
print "RadiativeBoundariesTestCase"
runner = unittest.TextTestRunner()
runner.run(suite())
#-------------------------------------------------------------------------------
# End
#-------------------------------------------------------------------------------
syntax highlighted by Code2HTML, v. 0.9.1