Anuga-user Digest, Vol 43, Issue 2

21 views
Skip to first unread message

anuga-use...@lists.sourceforge.net

unread,
Mar 1, 2012, 4:02:08 AM3/1/12
to anuga...@lists.sourceforge.net
Send Anuga-user mailing list submissions to
anuga...@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/anuga-user
or, via email, send a message with subject or body 'help' to
anuga-use...@lists.sourceforge.net

You can reach the person managing the list at
anuga-us...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Anuga-user digest..."


Today's Topics:

1. Re: Adding forcing terms to simulate incoming flow
(Silvia Franceschi)
2. Re: Anuga shallow water simulation (Stephen Roberts)


----------------------------------------------------------------------

Message: 1
Date: Thu, 1 Mar 2012 07:46:15 +0100
From: Silvia Franceschi <silvia.f...@gmail.com>
Subject: Re: [Anuga-user] Adding forcing terms to simulate incoming
flow
To: "marcor...@libero.it" <marcor...@libero.it>
Cc: anuga...@lists.sourceforge.net
Message-ID:
<CABCykqK6s86F-DKRLu9LWRjj...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Dear Marco,
for sure you have to provide a NetCDF file for the discharge...
Here a piece of code that translate a normal txt file with 2 coloumns into
a netcdf for Anuga.
I am pretty sure it is not the best solution, but it works for me.

Ciao

Silvia

---------------------------------------------------------------------------------------

from numpy import array, float
from Scientific.IO.NetCDF import NetCDFFile
from anuga.config import netcdf_float
from anuga.abstract_2d_finite_volumes.util import file_function

fid = open(dischargeFile)
lines = fid.readlines()
fid.close()

time = []
q = []
for line in lines:
fields = line.split()
time.append( float(fields[0]))
q.append( float(fields[1]))


# Convert to NetCDF
N = len(time)
T = array(time, float) # Time (seconds)
R = array(q, float) # Values (m3/s)


# Create tms NetCDF file
fid = NetCDFFile(dischargeTmsFile, 'w')
fid.institution = projectFileName + '_simulation'
fid.description = projectFileName + '_simulation'
fid.starttime = 0.0
fid.createDimension('number_of_timesteps', len(T))
fid.createVariable('time', netcdf_float, ('number_of_timesteps',))
fid.variables['time'][:] = T
fid.createVariable('hydrograph', netcdf_float, ('number_of_timesteps',))
fid.variables['hydrograph'][:] = R
fid.close()

# created dischargeTmsFile


On Thu, Feb 9, 2012 at 12:43 PM, marcor...@libero.it <
marcor...@libero.it> wrote:

> Hi all,
>
> I need to simulate a flooding scenario, due to river levee breach. I
> have a discharge hydrograph (flow in m3/s) and I want to use it within
> my simulation.
> First of all, I thought the best way to input my hydrograph would have
> been to use a forcing term, precisely the Inflow class, but I would like
> to have some feedback on this: are there better ways to input localized
> hydrographs, when modeling phenomena like a levee breach?
>
> Secondly, it looks like I can't properly define the hydrograph time
> serie according to the required NetCDF tms format. I tried to format my
> data in a hydrograph.tms file as follows:
>
> t, flow
> 0.0, 0.00
> 0.1, 0.10
> 0.2, 0.30
> 0.3, 0.75
> 0.4, 0.99
> 0.5, 1.20
> 0.6, 1.70
> 0.7, 1.70
> 0.8, 1.70
> 0.9, 1.70
> 1.0, 1.70
>
> and then I called as follow:
>
> hydrograph = Inflow(center=(686010, 923100), radius=2,
> rate=file_function('hydrograph.tms', quantities='flow'))
> domain.forcing_terms.append(hydrograph)
>
> this causes the following error message:
>
> 'Must be a NetCDF File'
>
> Thanks in advance!
> Marco
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Anuga-user mailing list
> Anuga...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/anuga-user
>
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Thu, 01 Mar 2012 20:01:40 +1100
From: Stephen Roberts <stephen...@anu.edu.au>
Subject: Re: [Anuga-user] Anuga shallow water simulation
To: Silvia Franceschi <silvia.f...@gmail.com>
Cc: anuga...@lists.sourceforge.net
Message-ID: <4F4F3AF4...@anu.edu.au>
Content-Type: text/plain; charset="iso-8859-1"

Hi Silvia

On 1/03/2012 5:41 PM, Silvia Franceschi wrote:
> Thanks Steve and Gareth!
> finally I could run a simulation, defnitely happy! :)
> My congratulation for the software, really powerfull!
> I would ask you two more things, sorry for bothering...
> 1. when do you think it would be possible to have a new version of
> Anuga for windows containging also the inlet_operator? I use linux in
> office but my laptop has windows and I would try to make some testing
> at home...

I now use virtualbox with a version of ubuntu installed on my windows
laptop. Then you can follow the ubuntu instructions from the
anuga.anu.edu.au site.

But you can install the latest version of anuga on windows.

You need subversion on your windows machine (tortoise svn seems the best
choice as it integrates into explorer). Once you have that you can
checkout the current version of anuga via svn checkout from location
https://anuga.anu.edu.au/svn/anuga/trunk/anuga_core

You will then need to setup the environment variable PYTHONPATH to point
to the location of the downloaded anuga source directory. (the
installation manual
http://anuga.anu.edu.au/raw-attachment/wiki/WikiStart/anuga_installation_guide-1.2.1.pdf
has an appendix describing how to setup the environment)

I think the mingw compiler is downloaded with the sourceforge
distribution. You should be able to confirm that the compiler is
installed by firing up a cmd window and running the command

gcc

which should return

gcc: no input files

Anyrate once you have the mingw compiler installed you should be able to
go to the directory anuga_core and compile the anuga code via

python compile_all.py

and the run the tests

python test_all.py

Then you should be able to run anuga under windows.

> 2. what boudary condition do you usually use for sections in which you
> need to let the water go outside the domain? In my case I tried with the
> Bout = anuga.Dirichlet_boundary([tide, 0, 0]) # Mean water level
> Bout = anuga.Transmissive_stage_zero_momentum_boundary(domain) #
> Neutral boundary
>
> But in both the cases the domain's boundary seems to be a wall and
> water do not flow out the domani...

Try
Bout = anuga.Dirichlet_boundary([0, 0, 0])

which act like a drain.

Cheers
Steve

>
> Thank you!
>
> Silvia
>
>
>
> On Mon, Feb 27, 2012 at 9:31 PM, Stephen Roberts
> <stephen...@anu.edu.au <mailto:stephen...@anu.edu.au>> wrote:
>
>
> Hi Silvia,
>
> We have recently been working on "operators" and there is one
> called an Inlet_operator.
>
> You define amount of water to be added to a line. By placing the
> line close at the upstream location of your river you can setup a
> specified rate of water coming into your river.
>
> Have a look at the directory "structures" and the script
> "testing_inlet_operator.py"
>
> Cheers
> Steve
>
>
>
> On 28/02/2012 5:43 AM, Silvia Franceschi wrote:
>> Hi all,
>> I am trying to run a shallow water simulation on a river with a
>> defined Inflow_boundary.
>> I am having several issues right now and would appreciate some
>> advice.
>>
>> When I import:
>>
>> from anuga.shallow_water.boundaries import Inflow_boundary
>>
>> and then set the inflow rate to a fixed value:
>>
>> Bin = Inflow_boundary(domain, rate=ref_flow)
>>
>> I get and error that the global variable: epsilon
>> is not set.
>>
>> Looking at the testcases I tried to import:
>> from anuga.config import epsilon
>>
>> but that didn't solve the problem.
>>
>> So I cheated and inside boundary.py I set a variable:
>> epsilon = 1.0e-12
>>
>> at line 399 to make the condition:
>> if slope > epsilon and mannings_n > epsilon:
>>
>> work! :)
>>
>> At that point I have another error a couple of lines later in:
>>
>> q = num.array([elevation + depth, xmomentum, ymomentum], num.Float)
>>
>> which I changed to
>>
>> q = num.array([elevation + depth, xmomentum, ymomentum], num.float)
>>
>> At that point the simulation started. It is running and will take
>> a while, but the last change was too strange to me to be real :)
>> I apologize I am a python ignorant, so I am trying to do what I can.
>>
>> Then I finally read this piece of documentation at the very start
>> of the function:
>>
>> # FIXME (Ole): This is work in progress and definitely not
>> finished.
>> # The associated test has been disabled
>>
>> So at that point I am wondering if it is supposed to work or not.
>> Could you please give me some advice on how such a kind of
>> simulation should be best performed?
>>
>> Thank you very much for any hint.
>>
>> Best regards,
>> Silvia
>>
>>
>> PS: I am using today's latest svn checkout.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Try before you buy = See our experts in action!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-dev2
>>
>>
>> _______________________________________________
>> Anuga-user mailing list
>> Anuga...@lists.sourceforge.net <mailto:Anuga...@lists.sourceforge.net>
>> https://lists.sourceforge.net/lists/listinfo/anuga-user
>
>
> --
> +--------------------------------------------------------------------+
> | 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:stephen...@anu.edu.au |
> | Australian National University |http://www.maths.anu.edu.au/~steve <http://www.maths.anu.edu.au/%7Esteve>|
> | Canberra ACT 0200 AUSTRALIA | ANU CRICOS # 00120C |
> +--------------------------------------------------------------------+
>
>
>


--
+--------------------------------------------------------------------+
| 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:stephen...@anu.edu.au |
| Australian National University | http://www.maths.anu.edu.au/~steve|
| Canberra ACT 0200 AUSTRALIA | ANU CRICOS # 00120C |
+--------------------------------------------------------------------+


-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

------------------------------

_______________________________________________
Anuga-user mailing list
Anuga...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/anuga-user


End of Anuga-user Digest, Vol 43, Issue 2
*****************************************

Reply all
Reply to author
Forward
0 new messages