Comments (3)
Putting here just as an example for now. Should be integrated somewhere later.
import mupif as mp
import numpy as np
import meshio
import meshzoo
points,cells=meshzoo.cube_tetra(np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11))
mm=meshio.Mesh(points,{'tetra':cells})
h5path='12-hm.h5'
xdmfPath='12-hm.xdmf'
with mp.HeavyUnstructuredMesh(h5path='12-hm.h5',mode='overwrite') as mesh:
mesh.fromMeshioMesh(mm,progress=True,chunk=1000)
fieldP=mesh.makeHeavyField(unit='Pa',fieldID=mp.DataID.FID_Pressure,fieldType=mp.FieldType.FT_cellBased,valueType=mp.ValueType.Scalar)
fieldUVW=mesh.makeHeavyField(unit='m/s',fieldID=mp.DataID.FID_Velocity,fieldType=mp.FieldType.FT_cellBased,valueType=mp.ValueType.Vector)
fieldP.value[:]=np.linspace(0,1,len(cells))
mesh.writeXDMF(xdmfPath,fields=[fieldP,fieldUVW]) # this is actually not necessary
print(fieldP.evaluate((.1,.1,.1)))
# load mesh and fields from HDF5, also opens the storage
mesh,fields=mp.HeavyUnstructuredMesh.load(h5path)
print(fields[0].evaluate((.1,.1,.1)))
from mupif.
We are currently using our own convention of naming the HDF5 groups. This could be perhaps aligned with FEniCS conventions; pygimli.meshtoos.exportFenicsHdf5Mesh has a terse documentation on expected HDF5 group names; this should be compatible with Paraview and XDMF as it appears from this post
from mupif.
The code above was integrated into unittests in
mupif/mupif/tests/test_heavydata.py
Lines 499 to 524 in ba850b6
from mupif.
Related Issues (20)
- unittest for crashing Model
- Pass workDirectory path to model __init__ HOT 1
- munin alarms HOT 1
- octree subdivides to tiny cells without limit, until recursion limit is reached HOT 1
- Octree localizer takes 10 minutes to fill for 155k-tetra mesh HOT 6
- tqdm progress bar should show chunks better HOT 1
- Safe termination of JobManager
- tools/ should be revived HOT 2
- Add Dumpable.preDumpHook
- support multiple schedulers
- Convert monitor to and other tools to mupif.monitor (exposed as JSON endpoint in the future) HOT 3
- Clean abstract field class HOT 6
- MuPIF examples HOT 2
- remote logging HOT 1
- checkpointing in workflows
- Export fields to VTK HDF (as an alternative or simplification of .h5 + xdmf)
- temporal field (for both EDM and HeavyStruct) HOT 1
- Add VPN peer human-readable names to montiro API (with external JSON) HOT 1
- Please move new {hpc,pbc}_tool.py to tools/ (should be outside of the module directory)
- Upgrade to Pydantic v2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mupif.