Hi Dian,

 

Internally [when doing computations], ANUGA stores flow properties at centroid values – these are the ‘real’ flow properties, averaged over each triangle. The edge and vertex values are computed from the centroid values by (discontinuous) extrapolation. They represent both the flow properties, and the numerical extrapolation strategies we use to get a stable solution.  

 

However, the sww files by default only store vertex values (smoothly), unless you tell them to also store centroids as described previously.

 

If you do not store the centroid values in the swwfile, AND you do not store vertex values uniquely [i.e. default configuration], then the back-calculated centroid value (based on the vertex value) may not be the same as the true centroid value. Mostly it will be close, but large deviations are possible near wet-dry boundaries (particularly in velocity).

 

If you do not store centroid values in the swwfile, but you DO store vertex values uniquely, then the back calculated centroid values will be correct.

 

The approach I tend to use is to store centroid values directly, and also store smooth vertex values (since the latter are needed e.g. for ANUGA viewer, and actually I think at present we don’t have an option to not store vertices).

 

Hope that answers your question.  

 

Cheers,

Gareth.

 

From: Fariza Dian [mailto:frzdian@gmail.com]
Sent: Wednesday, 19 March 2014 3:35 PM
To: Davies Gareth
Cc: Regla Duthit; anuga-user@lists.sourceforge.net
Subject: Re: [Anuga-user] [DKIM] Anuga-user Digest, Vol 66, Issue 3 [SEC=UNCLASSIFIED]

 

Hi Gareth,

Thanks for the great suggestion Gareth, I totally agree with you,  that I also observed the small deviation in terms of the momentum vector between 'before' and 'after' reconstruction procedure. But in visual, the difference almost can not be observed by eyes. In overall I agree that the perfectly same result may not be achieved if we apply this procedure.

As your suggestion I will try to modify the procedure and see what the difference if the centroid values are stored in the sww files instead and read it.

But I have a questions, is the centroid value similar between the one read directly from the last result and the centroid value automatically calculated by ANUGA from the node value (in case if we read the vertex value from sww)?

Thanks

 


Fariza Dian Prasetyo

Phone: +62-817310788

e-mail: frzdian@gmail.com
 

 

On Wed, Mar 19, 2014 at 10:47 AM, <Gareth.Davies@ga.gov.au> wrote:

Hi Regla,

One thing to be aware of, in addition to Dian's points, is that ANUGA's computations rely on a discontinuous representation of the flow properties at each vertex.

However, by default, ANUGA stores flow properties at vertices "smoothly" inside the swwfile. Basically it averages the multiple flow values at each vertex before writing them out, to save file space.  You can turn this off with domain.set_store_vertices_uniquely(True).

If you try to restart the simulation based on an swwfile with smooth vertex storage, then the results may not be identical to a simulation with no restart (simply because there is more information in the discontinuous representation of the flow, which cannot be exactly reconstructed from the smoothed version).

It should be possible to get around this by storing the flow values at centroids in the swwfile (domain.set_store_centroids=True) and reading those in instead.

I have never tried this though.

Best of luck,
Gareth.

-----Original Message-----
From: anuga-user-request@lists.sourceforge.net [mailto:anuga-user-request@lists.sourceforge.net]
Sent: Tuesday, 18 March 2014 6:36 PM
To: anuga-user@lists.sourceforge.net
Subject: [DKIM] Anuga-user Digest, Vol 66, Issue 3

Send Anuga-user mailing list submissions to
        anuga-user@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-user-request@lists.sourceforge.net

You can reach the person managing the list at
        anuga-user-owner@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. Restart from a last time step (Regla)
   2. Re: Restart from a last time step (Fariza Dian)


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

Message: 1
Date: Mon, 17 Mar 2014 10:13:33 -0300
From: Regla <duthit@gmail.com>
Subject: [Anuga-user] Restart from a last time step
To: Stephen Roberts <stephen.roberts@anu.edu.au>
Cc: "anuga-user@lists.sourceforge.net"
        <anuga-user@lists.sourceforge.net>
Message-ID:
        <CAO6kJMz0W2grLW-r_7-d9ziw6y23WSrEYtnMAjL1JL6YdiygFQ@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello dear all,

I left an Anuga experiment running into my lab during this weekend but there was a power problem.

Can you help me to restart form the last time step computed by the model?

What should I  do??

Thanks,
regla



--
Regla


*...ser m?e ? uma experi?ncia maravilhosa...o amor ? mais
incondicional..."O pessimista queixa-se do vento, o otimista espera que ele
mude e o realista ajusta as velas."...**WILLIAM GEORGE WARD, Te?logo
ingl?s, 1812-1882**.*
*"D? a quem voc? ama : Asas para voar... Ra?zes para voltar... Motivos para
ficar. "*
*  (Dalai Lama)*

*"Se um dia tiver que escolher entre o mundo e o amor... Lembre-se: Se
escolher o mundo ficar? sem o amor; mas se escolher o amor, com ele voc?
conquistar? o mundo."** (Albert Einstein)*
*"A vida ? uma pe?a de teatro que n?o permite ensaios... Por isso, *
*cante,ria, dance, chore e viva intensamente cada momento de sua vida, *
*antes que a cortina se feche e a pe?a termine sem aplausos..."* (Charles
Chaplin.*)
*"Dubium sapientiae initium"* *(**Rene Descartes**)*
*_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`*
-------------- next part --------------
An HTML attachment was scrubbed...

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

Message: 2
Date: Tue, 18 Mar 2014 14:35:42 +0700
From: Fariza Dian <frzdian@gmail.com>
Subject: Re: [Anuga-user] Restart from a last time step
To: Regla <duthit@gmail.com>
Cc: "anuga-user@lists.sourceforge.net"
        <anuga-user@lists.sourceforge.net>
Message-ID:
        <CAOYkgA1vVChOGbOEUuZQivoRgtK6W0i64Np9P--Tf55xKNnEMQ@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello Regla,

Sometimes, I also do the similar procedure with what you intend to do.
Especially if I want to check the simulation result by stopping the
simulation process temporally. After I make sure that the result is good, I
continue the simulation process.

*#1.* If you are doing the simulation with parallel computing, you have to
merge first all of the *.sww files part for each processor. You may use the
function located in

 *anuga_core/source/anuga/utilities/sww_merge.py*

This is because the merge function doesn't work if the computer is suddenly
shut down.


*#2.* From the *.sww files you can dump all the latest simulation result
which are stored as the 'quantity' object including the *xmomentum*,
*ymomentum*, *stage* and *elevation* from each nodes of the mesh (in my
case I prefer to dump those quantities as  .txt files). This procedure can
be implemented like this.

.....
*import* numpy *as* np

f_mesh  = .... #your mesh file

mesh_instance = importMeshFromFile(f_mesh)
domain = pmesh_to_domain_instance(mesh_instance, Domain)


#Function for convert quantity value to node
*def* dump_value_from_netCDF_to_node_value_file(domain,name,vert):
    triang = domain.get_triangles()
    node_val = np.zeros((len(triang[:,1]),len(triang[1,:])))
    *for* k *in* xrange(len(triang[:,1])):
        *for* j *in* xrange(len(triang[1,:])):
           node_val[k,j]=vert[triang[k,j]]
    fo = name+'.txt'
    np.savetxt(fo,node_val,delimiter=' ')

#Taking data from netCDF
from anuga.utilities import plot_utils as util

sww_in = .... #your sww file
min_storable_height = 0.001

f_result = util.get_output(sww_in,min_storable_height)
topo = f_result.elev                  # elevation file
n_time = f_result.time.shape[0]       # total of time series

# Take the other quantities at the latest time from SWW file
ntime = ntime - 1
xmomentum = f_result.xmom[ntime]      # 'xmomentum' quantity
ymomentum = f_result.ymom[ntime]      # 'ymomentum' quantity
stage = f_result.stage[ntime]         # 'stage'     quantity


print 'Dumping xmomentum......'

fo_elev_name = 'last_elev'
fo_xmom_name = 'last_xmom'
fo_ymom_name = 'last_ymom'
fo_stage_name= 'last_stage'


# Dump xmomentum
dump_value_from_netCDF_to_node_value_file
(domain,name=fo_xmom_name,vert=xmomentum)

# Dump ymomentum
dump_value_from_netCDF_to_node_value_file
(domain,name=fo_ymom_name,vert=ymomentum)

# Dump stage
dump_value_from_netCDF_to_node_value_file
(domain,name=fo_stage_name,vert=stage)

# Dump elevation
dump_value_from_netCDF_to_node_value_file
(domain,name=fo_elev_name,vert=topo)


*#3.* The last procedure is using the quantity previously dumped into text
file as the initial condition for restarting your simulation process. Note
that the mesh file must be same. This procedure can be easily implemented
like this
.....
  *import* numpy *as* np

  #Read the previous data
  stage_last = np.loadtxt('last_stage.txt',delimiter=' ')
  xmom_last = np.loadtxt('last_xmom.txt', delimiter=' ')
  ymom_last = np.loadtxt('last_ymom.txt',delimiter=' ')

  elev_last = np.loadtxt('last_elev.txt',delimiter=' ')

  inistage = stage_last
  xmom = xmom_last
  ymom = ymom_last

  # Store the latest quantity as the initial condition of the simulation
  domain.set_quantity('elevation',elev_last)
  domain.set_quantity('stage',inistage)
  domain.set_quantity('xmomentum',xmom)
  domain.set_quantity('ymomentum',ymom)

.....

So based on my experience, the most important thing is we can take all the
quantity stored at each node. Hopefully those procedures can solve your
problem ;)



Fariza Dian Prasetyo
*Phone: *+62-817310788
*e-mail*: frzdian@gmail.com



2014-03-17 20:13 GMT+07:00 Regla <duthit@gmail.com>:

> Hello dear all,
>
> I left an Anuga experiment running into my lab during this weekend but
> there was a power problem.
>
> Can you help me to restart form the last time step computed by the model?
>
> What should I  do??
>
> Thanks,
> regla
>
>
>
> --
> Regla
>
>
> *...ser m?e ? uma experi?ncia maravilhosa...o amor ? mais incondicional...
> "O pessimista queixa-se do vento, o otimista espera que ele mude e o
> realista ajusta as velas."...**WILLIAM GEORGE WARD, Te?logo ingl?s,
> 1812-1882**.*
> *"D? a quem voc? ama : Asas para voar... Ra?zes para voltar... Motivos
> para ficar. "*
> *  (Dalai Lama) *
>
> *"Se um dia tiver que escolher entre o mundo e o amor... Lembre-se: Se
> escolher o mundo ficar? sem o amor; mas se escolher o amor, com ele voc?
> conquistar? o mundo."** (Albert Einstein)*
> *"A vida ? uma pe?a de teatro que n?o permite ensaios... Por isso, *
> *cante,ria, dance, chore e viva intensamente cada momento de sua vida, *
> *antes que a cortina se feche e a pe?a termine sem aplausos..."* (Charles
> Chaplin.*)
> *"Dubium sapientiae initium"* *(**Rene Descartes**)*
>
> *_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`_?.??(`*
>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Anuga-user mailing list
> Anuga-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/anuga-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...

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

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

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

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


End of Anuga-user Digest, Vol 66, Issue 3
*****************************************

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
-------------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Anuga-user mailing list
Anuga-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/anuga-user

 

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
-------------------------------------------------------------------------------------------------------------------------