Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the elevation of each vertex in the stage #282

Open
842590879 opened this issue Nov 6, 2024 · 6 comments
Open

the elevation of each vertex in the stage #282

842590879 opened this issue Nov 6, 2024 · 6 comments

Comments

@842590879
Copy link

Hello, how can I obtain the elevation of each vertex in the stage?

@stoiver
Copy link
Member

stoiver commented Nov 7, 2024

Hi @842590879 The answer to your question is actually a little complicated than it might seem depending on how you want to use the the result.

Within the python script you can obtain the values via

stage_vv = domain.quantities['stage'].vertex_values

By the way centroid values similarly can be accessed via

stage_cv = domain.quantities['stage'].centroid_values

If you are running in parallel, these will only access the data on the specific processor.

I would recommend using centroid values as these are essentially uptodate where as vertex values are only guaranteed at the end of a yield step.

You can also access the stage values stored in the sww file, but of course the values will only be available at the yield timesteps. Checkout the SWW_dplotter interface.

@842590879
Copy link
Author

Hi@stoiver, I am trying to achieve a flood effect in cesium, similar to the effect rendered by 3d anuga-viewer. But I found that the vertex_values method using domain.quantities['stage'].vertex_values gave the same vertex elevation. I also tried to change the value of the location parameter in the domain.set_quantity function, but the result was the same. So how do I get the different elevation values for each vertex of each triangle? Thank you very much!

@stoiver
Copy link
Member

stoiver commented Nov 7, 2024

@842590879 are you pulling the data from an sww file (like the viewer) or in real time during a simulation?

@842590879
Copy link
Author

@stoiver Real-time data extraction in the Merewether Flood Case Study Example
vertex = []
for t in domain.evolve(yieldstep=20, duration=300):
dplotter.save_depth_frame(vmin=0.0, vmax=1.0)
domain.print_timestepping_statistics()
vertex.append(domain.quantities['stage'].vertex_values.tolist())
dplotter.make_depth_animation()

@stoiver
Copy link
Member

stoiver commented Nov 13, 2024

@842590879 How are you using the object vector?
The array domain.quantities['stage'].vertex_values is an array with 3 values for each element (triangle). There will be different vertex values for a given vertex location. The vertex values generate a piecewise linear function which is generally discontinuous across edges of the triangles.

Be aware that the size of vector which will grow as the evolution progresses.

@842590879
Copy link
Author

@stoiver Thank you very much for your explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants