|
From: Gareth D. <gar...@gm...> - 2019-03-19 04:14:51
|
Hi,
Here's one way to do it in python.
Beware I haven't tested this code -- but the idea should be clear.
Obviously you'll have to provide your own sww file name and depth
threshold.
If you run out of memory when calling util.get_centoids, then I think
you can adapt the call to 'util.get_centroids' to only get a single
time-slice at once. Have a look at the documentation in
anuga.utilities.plot_utils.py for further details, should this arise.
Cheers,
Gareth.
import numpy as np
from anuga.utilities import plot_utils as util
# Using sww file "merewether_1m.sww"
p = util.get_centroids('merewether_1m.sww')
# Chosen threshold depth for runup
depth_threshold = 0.01
# Make an empty 1d array to hold the max-stage
model_max_stage_over_time = p.time*0.0
# Array with the times
model_times = p.time
for i in range(len(p.time)):
# Array which has stage where (stage > elev + depth_threshold), and
NAN elsewhere
stage_with_non_zero_depth = np.where(p.stage[i,:] > p.elev +
depth_threshold, p.stage[i,:] , np.NAN + 0*p.stage[i,:])
model_max_stage_over_time[i] = np.nanmax(stage_with_non_zero_depth)
On 19/3/19 11:26 am, Muhammad Ibrahim wrote:
>
> Hi,
>
> I have been using ANUGA for quite a decent time on wave flume
> modelling. However, I am struggling to extract the runup time series
> (swash motion) of my simulation. The only way that I can think of is
> to extract the data from the sww file and find the location of min
> depth (threshold depth, thr) at each time (Please refer to my matlab
> script below). This approach is convenient for regular waves but it is
> computationally expensive for random waves (t = 10mins). Note that
> depthc{1} = depth(t,x), i.e. 24000x750 array (0:0.025:600s and
> 0:0.01:7.5m).
>
> Thr = 0.01 m corresponds to the elevation of my runup wires from the bed.
>
> fori=1:nt;
>
> d=depthc{k}(i,:);
>
> d(d<0) = 0
>
> a=find(d<thr,1,'first');
>
> ifisempty(a)==0; %%to omit the data with zero value.
>
> index(i)=a;
>
> elseindex(i)=nx;
>
> end
>
> d(index(i)+1:nx) = NaN
>
> dfilt(i,:) = d
>
> end
>
> xsh=xc(index);
>
> I am not sure whether there is an output_export.py file in ANUGA
> example folder that may solve this problem faster than my matlab
> script. At the moment, it took me more than 24hours to get the output
> on my WORK PC. I hope you can give comments on this matter.
>
> Regards,
> Muhammad
>
> *Muhammad Shazril Idris Ibrahim*
>
> Doctor of Philosophy (Ph.D.) Student – School of Civil Engineering
>
> Room 219 | Building 78
>
> School of Civil Engineering | The University of Queensland | QLD 4072
>
> Australia
>
> M: +614 50220276 | E: Muh...@uq...
>
>
>
> _______________________________________________
> Anuga-user mailing list
> Anu...@li...
> https://lists.sourceforge.net/lists/listinfo/anuga-user
|