User Forum of Software BASEMENT

BASEMENT
Basic Simulation Environment for computation of environmental flow and natural hazard simulation
Laboratory of Hydraulics, Hydrology and Glaciology (VAW)
ETH Zurich
Basement_Logo

You are not logged in.

#1 2021-03-23 12:25:07

carygrant
User
Registered: 2020-02-05
Posts: 7

Extracting cross-sectional results

Hello,

I'm trying to extract cross-sectional results (discharge) of a Basement 3 simulation (xdmf). For this I tried to make "BMv3NodestringResults.py" to work but didn't manage so far. Could you specify Python version, a repository where all necessary libraries are accessible and recommend an IDE to be used under Windows?

Alternatively, I'm not sure if Paraview could be used for the same purpose perhaps? If so, how? If anybody could give some hints or record a video on the procedure, it would be great help.

Thanks

Péter

Offline

#2 2021-03-24 10:07:03

Matteo Facchini
Developer
From: Trento
Registered: 2014-09-05
Posts: 281

Re: Extracting cross-sectional results

Hi,

I am assuming you are using windows? It would be useful to read the errors you get.

Anyway, regarding BMv3NodestringResults.py it works with python 3.x. You could install miniconda and take advantage of its virtual environments.

After installing it open the anaconda powershell (in windows just search for anaconda) and just type this commands:

conda create --name bmns python=3.8

you could give this environment the name you wish, I chose bmns

conda activate bmns
conda install h5py

Then go to your folder where you should have put BMv3NodestringResults.py, to do that just type

cd path/to/your/folder

and type

python BMv3NodestringResults.py

This should work, I tested it under windows 10.

As for the IDE I use sublime text and I love it, also because I use it as text editor, for markdown, to code in python, to write with latex...but many people find spyder very useful.

Concerning ParaView you should:

  1. Load your dataset and click "Apply"

  2. Apply the Calculator filter, select "Point Data" under "Attribute type", check "Coordinate results" and copy-paste this formula coordsX*iHat+coordsY*jHat, then click "Apply"

  3. Apply the "Plot Over Line" filter and move the line to the desired location. NOTE that under Point1 and Point2 the last coordinate (z) must be set to 0

  4. scroll down and select the set of parameters you want to plot, they adapt to the time you set

Now you can play around with the resolution and the axis, also set secondary axis and so on.

To export the data, click on the "+" close to the Layout pages and select "SpreadSheet View" (it's the last one) and activate (by clicking on the eye) the PlotOverLine layer in your Pipeline Browser. You can copy-paste this table to excel and do all the graphs you need!

Cheers,
Matteo

EDIT: corrected some typos

Last edited by Matteo Facchini (2021-03-24 14:54:55)

Offline

#3 2021-03-24 11:33:16

carygrant
User
Registered: 2020-02-05
Posts: 7

Re: Extracting cross-sectional results

Cool! Thank you very much for the prompt and detailed reply.
Fyi yesterday I got a bit obsessed with seeking results and upset with all the limitations I have on my office computer. But finally I looked for solutions desperately and managed to run the Python code from within RStudio, which I had available already.

Offline

#4 2021-03-24 14:51:07

Matteo Facchini
Developer
From: Trento
Registered: 2014-09-05
Posts: 281

Re: Extracting cross-sectional results

I am glad you solved your issue.

I find anaconda very versatile and I use it for my every-day python work. I think what's greatest about anaconda is that you can create ad-hoc environments for each task you need to fulfill, install libraries inside environments and then remove everything once you're done. And you can do that with every python version you need.

Offline

Board footer

Powered by FluxBB