def init(heightArg, componentArg="x", u0NormArg=1.0, scaleArg=1.0, hscale=2): import windio global channelHeight, component, u0, u0Norm, scaledZ, values global scaleAll, heightScale wind = windio.readWind() u0 = wind.speed u0Norm=u0NormArg scaleAll = scaleArg heightScale = hscale channelHeight = heightArg component = componentArg # From Fluidity SEM example if(component=="x"): scaledZ=[0.0, 0.05, 0.1, 0.15,0.2, 0.25,0.3, 0.9,1.0] values=[0.0,0.0085,0.032,0.0675,0.096,0.0933,\ 0.069,0.0375,0.0365] elif(component=="y"): scaledZ=[0.0, 0.05, 0.1, 0.15,0.2, 0.25,0.3, 0.9,1.0] values=[0.0,0.0085,0.032,0.0675,0.096,0.0933,\ 0.069,0.0375,0.0365] # scaledZ=[0.0, 0.15,0.2,0.3,0.7,1.0] # values=[0.0,0.02,0.02,0.004,0.001,0.0005] elif(component=="z"): scaledZ=[0.0,0.3,0.9,1.0] values=[0.0,0.015,0.012,0.0]
def init(arg_roughness, ywall1_arg=-10e10, ywall2_arg=10e10, profile="log"): from windio import readWind global boundary, velcomponent, pi global winddir, windspeed, windheight, relaxtime, linesArray global relaxtime global heightdefined, roughnesslength, featureheight, profileType global ywall1, ywall2 pi = 3.1415926535897932384626433832795 profileType = profile # time for boundaries to go from 0 ->u0 m/s # change this if get instabilities roughnesslength = arg_roughness ywall1 = ywall1_arg ywall2 = ywall2_arg wind = readWind() winddir = wind.direction windspeed = wind.speed windheight = wind.u0_height relaxtime = wind.relaxtime featureheight = wind.featureheight linesArray = {} try: grdfile = open("height-grid.xyz", "r") heightdefined = 1 linect = 0 linestr = grdfile.readline() while (linestr): linesArray[linect] = linestr linestr = grdfile.readline() linect = linect + 1 grdfile.close() except IOError: heightdefined = 0
def init(maxval_arg, height_arg, windcomp_arg, scaletime="no"): import windio global maxval, maxheight, winddir, windcomp, pi, relaxtime pi = 3.1415926535897932384626433832795 windcomp = windcomp_arg wind = windio.readWind() winddir = wind.direction if (scaletime == "yes"): relaxtime = wind.relaxtime else: relaxtime = 0 maxval = maxval_arg maxheight = height_arg
def init(arg_boundary, arg_velcomponent, arg_roughness=0.0001): from windio import readWind global boundary, velcomponent, pi global winddir, windspeed, windheight, relaxtime, linesArray global relaxtime global heightdefined, roughnesslength, featureheight pi = 3.1415926535897932384626433832795 # time for boundaries to go from 0 ->u0 m/s # change this if get instabilities boundary = arg_boundary velcomponent = arg_velcomponent roughnesslength = arg_roughness wind = readWind() winddir = wind.direction windspeed = wind.speed windheight = wind.u0_height relaxtime = wind.relaxtime featureheight = wind.featureheight linesArray = {} try: grdfile = open("height-grid.xyz", "r") heightdefined = 1 linect = 0 linestr = grdfile.readline() while (linestr): linesArray[linect] = linestr linestr = grdfile.readline() linect = linect + 1 grdfile.close() except IOError: heightdefined = 0
def init(): from windio import readWind from inflow import val as inflowVal, init as inflowInit from seadefaults import getWindspeedRoughnessData global z0 (u0_arr, z0_arr) = getWindspeedRoughnessData() # Find the free-stream wind speed u0 at 10m inflowInit("west", "u") wind = readWind() u0_10m=inflowVal([0, 0, 10], wind.relaxtime) targ_u0=u0_10m # Find this u0 in array, and interpolate cD accordingly last_u0=0 last_z0=z0_arr[0] z0=z0_arr[0] ix=0 for this_u0 in u0_arr: this_z0=z0_arr[ix] if(targ_u0 > last_u0 and targ_u0 <= this_u0): grad = (this_z0-last_z0)/(this_u0-last_u0) delta = targ_u0-last_u0 z0 = delta * grad + last_z0 # If we are beyond the last defined values of u0/cD, pick the last cD elif(targ_u0 > this_u0): z0 = z0_arr[-1] last_u0=this_u0 last_z0=this_z0 ix=ix+1
def init(): from windio import readWind global boundary, velcomponent, pi global winddir, windspeed, windheight, relaxtime, linesArray global relaxtime global heightdefined pi = 3.1415926535897932384626433832795 # time for boundaries to go from 0 ->u0 m/s # change this if get instabilities wind = readWind() winddir = wind.direction windspeed = wind.speed windheight = wind.u0_height relaxtime = wind.relaxtime heightdefined = 0
def init(height, componentArg="x", \ wall="off", y1=0.0, y2=0.0, \ top="off", ztop=0.0): import windio, math global chanheight, component, uH, zH, uTau global cD, zR global y1val, y2val, sidewall, chanw, wallthresh, vwallthresh global topwall, ztopval chanheight = height component = componentArg # Von Karman K=0.41 y1val = 1.0*y1 y2val = 1.0*y2 ztopval = 1.0*ztop chanw = abs(y1val-y2val) # Distance from wall at which we drop off Reynolds stress wallthresh = 10.0 vwallthresh = 2.5 sidewall = wall topwall = top wind = windio.readWind() uH = wind.speed zH= wind.u0_height zRough = wind.featureheight uTau = uH * K / math.log(zH/zRough)