From: Stephen R. <ste...@an...> - 2009-05-02 11:42:37
|
Hi Drew, Could you provide your full script file. It seems that you must be trying to set a boundary condition using the tag "offshore" but it looks like you are using a rectangular region which only has boundary tags, "left" 'right' 'top' and 'bottom'. > I appreciate any help/insight that y'all can provide. As an aside, I > was very happy to find an open source FEM model like this. What are > your plans for it? Do you have any plans to put it 3d? add salinity? > other water quality? sediment? Just wondering and thanks again > > Thanks for that. The code is actually based on finite volumes (not finite elements, well actually the calculation of the fitting, does use finite elements). The code is intrincially 2D so it is unlikely we will go to 3D (I guess 3D could be implemented as a large number of layers). But yes we are interested in salinity and other water quality. Indeed one of our users John Jakeman, has implemented a version with a tracer quantity which is advected by the flow defined by stage, xmomentum and ymomentum. I have cc-ed him on this message. Also sediment is of interest. If you are interested in looking at developing these areas we would be more than interested in helping. Cheers Steve Drew Ackerman wrote: > I am trying to test ANUGA on some estuaries of interest to me. I'm > working on putting tides into an offshore rectangular grid extending off > the shore to -30m. I want to force the boundary with a tide. I put my > tides from a CSV into a TMS file using the code at the bottom of this post. > > I'm unclear on how to get the tidal boundary moving. My boundary > section of the code is > > Br = Reflective_boundary(domain) # Solid reflective wall > Bt = Transmissive_boundary(domain) # Continue all values on boundary > Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values > > Bf = Field_boundary('Tides.tms',domain) > domain.set_boundary({'top': Br, 'left': Br, 'bottom': Bf, 'right': Br}) > > I have tried using "Field_boundary" and "File_boundary" but get the same > error message (immediately below). What am I doing wrong? There is a > mention in the manual to use an SWW file but I wouldn't think that the > boundary condition needs that many dimensions, attributes and variables. > > I appreciate any help/insight that y'all can provide. As an aside, I > was very happy to find an open source FEM model like this. What are > your plans for it? Do you have any plans to put it 3d? add salinity? > other water quality? sediment? Just wondering and thanks again. > > drew > > ###################BOUNDARY SECTION OF CODE############################ > > Br = Reflective_boundary(domain) # Solid reflective wall > Bt = Transmissive_boundary(domain) # Continue all values on boundary > Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values > > Bf = Field_boundary('Tides.tms',domain) > domain.set_boundary({'top': Br, 'left': Br, 'bottom': Bf, 'right': Br}) > > ###################ERROR MESSAGE############################ > > Available boundary tags ['top', 'right', 'left', 'bottom'] > Time = 0.0000, steps=0 (85895s) > Boundary values at time 0.0000: > offshore: > Sorry no information available about tag offshore and quantity stage > Sorry no information available about tag offshore and quantity > xmomentum > Sorry no information available about tag offshore and quantity > ymomentum > > Traceback (most recent call last): > File "runoffshore.py", line 126, in <module> > for t in domain.evolve(yieldstep = 600, finaltime = 10000): > File > "C:\Python25\lib\site-packages\anuga\shallow_water\shallow_water_domain.py", > line 445, in evolve > skip_initial_step=skip_initial_step): > File > "C:\Python25\lib\site-packages\anuga\abstract_2d_finite_volumes\domain.py", > line 1137, in evolve > self.evolve_one_euler_step(yieldstep,finaltime) > File > "C:\Python25\lib\site-packages\anuga\abstract_2d_finite_volumes\domain.py", > line 1212, in evolve_one_euler_step > self.update_boundary() > File > "C:\Python25\lib\site-packages\anuga\abstract_2d_finite_volumes\domain.py", > line 1404, in update_boundary > def update_boundary(self): > File > "C:\Python25\lib\site-packages\anuga\abstract_2d_finite_volumes\domain.py", > line 1419, in update_boundary > q = B.evaluate(vol_id, edge_id) > File > "C:\Python25\lib\site-packages\anuga\shallow_water\shallow_water_domain.py", > line 1138, in evaluate > q = self.file_boundary.evaluate(vol_id, edge_id) > File > "C:\Python25\lib\site-packages\anuga\abstract_2d_finite_volumes\generic_boundary_conditions.py", > line 297, in eva > luate > res = self.F(t, point_id = i) > File > "C:\Python25\lib\site-packages\anuga\fit_interpolate\interpolate.py", > line 859, in __call__ > if t > self.time[-1]: raise Exception(msg) > Exception: Time interval [0.0000000000000000:14.5520999999999990] does > not match model time: 14.6048906301426950 > > > ####################################################################### > #####################CSV TO NETCDF CODE############################# > from Numeric import * > from Scientific.IO.NetCDF import * > import time > import csv > import array > > def getUserName(): > try: > import os, pwd, string > except ImportError: > return 'unknown user' > pwd_entry = pwd.getpwuid(os.getuid()) > name = string.strip(string.splitfields(pwd_entry[4], ',')[0]) > if name == '': > name = pwd_entry[0] > return name > > # > # Creating a file > # > file = NetCDFFile('Tides.tms', 'w') > > # define attributes > file.institution = "SCCWRP" > file.description = "Tidal boundary for estuary" > file.starttime = 0.0 > > # define dimensions > file.createDimension('number_of_timesteps', 4192) > VarDim = ('number_of_timesteps', ) > > f_time = file.createVariable('time', Float, VarDim) > f_stage= file.createVariable('stage', Float, VarDim) > f_xmo = file.createVariable('xmomentum', Float, VarDim) > f_ymo = file.createVariable('ymomentum', Float, VarDim) > > fname='SMTides.csv' > value_lists = list(csv.reader(open(fname, 'r'))) > first = [x for (x,y) in value_lists] > second = [y for (x,y) in value_lists] > > i=0 > while i < 4192: > f_time[i]=float(first[i]) > f_stage[i]=float(second[i]) > i = i + 1 > > print i > > f_xmo[:]=0. > f_ymo[:]=0. > > file.close() > ####################################################################### > > -- +--------------------------------------------------------------------+ | Steve Roberts | My Office: (61)(2) 6125 4445 | | Department of Mathematics | Math Office: (61)(2) 6125 2908 | | Mathematical Sciences Institute| Fax: (61)(2) 6125 4984 | | John Dedman Building #27 | mailto:ste...@an... | | Australian National University | http://www.maths.anu.edu.au/~steve| | Canberra ACT 0200 AUSTRALIA | ANU CRICOS # 00120C | +--------------------------------------------------------------------+ |