CyprienBosserelle / BG_Flood

Numerical model for simulating shallow water hydrodynamics on the GPU using an Adaptive Mesh Refinment type grid. The model was designed with the goal of simulating inundation (River, Storm surge or tsunami). The model uses a Block Uniform Quadtree approach that runs on the GPU but the adaptive/multi-resolution/AMR is being implemented and not yet operational. The core SWE engine and adaptivity has been inspired and taken from St Venant solver from Basilisk and the CUDA GPU memory model has been inspired by the work from Vacondio _et al._2017)
GNU General Public License v3.0
34 stars 15 forks source link

Implement flexible output Times #113

Open AliceHarang opened 1 month ago

AliceHarang commented 1 month ago

This is link to the task: Add more fexibility in time of output (Projects for FY24/25)

AliceHarang commented 3 weeks ago

Hi Cyp, I have finish most of this branch.

Some little points where I would like to have your point of view:

AliceHarang commented 3 weeks ago

Things to check:

CyprienBosserelle commented 3 weeks ago

Results from my stress testing:

In the code.

I would have though it is easier to convert range to vector directly in the read input. While that may not be very efficient its a pretty low cost overall and easier to maintain in the future

CyprienBosserelle commented 2 weeks ago

Correction

AliceHarang commented 2 weeks ago

Hi @CyprienBosserelle , I saw that you directly read in to create the vector by putting it in "val". Did you managed to keep the default "OutputTimeSteps" by doing this?

CyprienBosserelle commented 2 weeks ago

Not yet, thanks for the reminder. I also broke the test so I need to redo it. I was thinking of doing that in the Sanity check. Most of my changes are just to try to setup for using real dates. but the more I think about it the more difficult it seems...

AliceHarang commented 2 weeks ago

I haven't thought it too much but if we keep the initial structure for the OutputT red but change it in string, we can see if there is a time reference and read them accordingly in the sanity check (as digit or date)?

I suppose all of this would be done in the sanity check after just reading basically the input in the readInput.

Happy to implement this if you this it can work!

CyprienBosserelle commented 2 weeks ago

Now with Dates!

Ok I shuffled a few things around and only had time to do minimal testing. But so far it works!

how to use:

User can now use Toutput for range or single value(s) as long as they are separated by a ,. Multiple ranges can be given and a mix of single values and range.

Ranges are defined with pipe symbol |

While : is commonly used to define ranges it wouldn't work for us. that is because we reserve: for separating time with specifying a date and there would be no way to distinguish between date and range.

Toutput=5.5,0|2.2|4,3.0

Time given in Toutput is either an absolute date or a time relative to the model start time

Toutput=3600.0 means 1 hour after start time!

Now supports units

time can be given with a unit. Toutput=5days,0|2.2s|4h,3.0min

supported units are: second= { "seconds","second","sec","s" }; as 1sec minute = { "minutes","minute","min","m" }; as 60sec hour = { "hours","hour","hrs","hr","h" }; as 3600sec day = { "days","day","d" }; as 243600sec month = { "months","month","mths", "mth", "mon" }; as 3600.0 24.0 30.4375 sec year = { "years","year","yrs", "yr", "y" }; as 3600.0 24.0 * 365.25

Dates are also supported

as unique dates or ranges: Toutput=2020-01-01T00:00:00|2.2s|2020-01-01T00:00:04,2020-01-01T00:00:03

Note that range step can't be a date but instead need to be second or have a unit attached