Interactive viewer and read-only MCP server for code_aster MED results (.med, .rmed).
- Viewer: ParaView-like viewer that runs in the browser or in a VS Code tab. You can browse fields and time steps, show the deformed shape, cut with any plane, read values with a click, inspect Gauss points and export journal figures.
- VS Code extension: right-click a
.medfile → Open in Aster View. - MCP server (
aster-med): lets an AI assistant (Claude Code, Claude Desktop or any MCP client) read numbers, render images, make figures and open the viewer for you. It never runs simulations and never modifies your files. - Three languages: English, Español, Français. You pick the language in the viewer and it is remembered.
The viewer, the images and the MCP server share one reader and one VTK scene, so what the assistant reports is what you see.
A garter spring crushed between two tubes (contact and plasticity, 52 time steps, deformation at true scale): von Mises stress, surface with edges. The result file (1.96 GB) can be downloaded from the v0.4.1 release.
The journal figures are in their own section. The tube and plate pictures come from the two examples in examples/ and are regenerated with python docs/make_images.py.
- Gallery
- Installation
- Quick start
- The viewer
- Journal figures
- Derived components
- MCP server
- Outputs and settings
- How it is verified
- Limitations
- Development
- License and acknowledgements
You need Python 3.10 or newer. It has been tested on Linux (Ubuntu, Python 3.11 and 3.12, VTK 9.7, trame 4).
code_aster itself is not needed: the MED files are read directly with h5py.
One command does everything:
wget -qO- https://raw.githubusercontent.com/tin7/aster-view/main/install.sh | shIt asks for your password (sudo) to install what is missing from the system: Python with venv and pip, and the OpenGL libraries VTK uses. Then it does four things:
- creates a virtual environment in
~/venvs/aster-view; - installs the package (git is not needed);
- links the
aster-viewandaster-mcpcommands into~/.local/bin; - if VS Code is installed, installs the extension.
It takes a few minutes, since VTK and trame are large. Steps 1 to 3 below do the same by hand.
First the system packages (Ubuntu/Debian; a fresh system may lack pip and git):
sudo apt install python3 python3-venv python3-pip gitThen, in a virtual environment (recommended):
python3 -m venv ~/venvs/aster-view
source ~/venvs/aster-view/bin/activate
pip install git+https://github.com/tin7/aster-viewWith conda: conda create -n aster-view python=3.11 -y && conda activate aster-view, then the same pip install line.
If it fails (Ubuntu/Debian):
ensurepip is not availablewhen creating the environment: install the venv module withsudo apt install python3-venv(orpython3.12-venv, matching your Python), delete the half-made~/venvs/aster-viewand create it again.Cannot find command 'git': install git withsudo apt install git, or install from the release archive, which needs no git:pip install https://github.com/tin7/aster-view/archive/refs/tags/v0.4.1.zip.externally-managed-environment:pipran outside the environment; activate it first withsource ~/venvs/aster-view/bin/activate.
This installs two commands:
| command | what it does |
|---|---|
aster-view file.med |
opens the viewer in your browser |
aster-mcp |
the MCP server (started by your MCP client, not by you) |
Dependencies, installed automatically: vtk, trame (+ trame-vtk, trame-vuetify), h5py, numpy, matplotlib and mcp.
Rendering happens off-screen on your machine, and the browser only receives images. No GPU or WebGL is needed.
- Download
aster-view-<version>.vsixfrom the latest release. - In VS Code: Command Palette (
Ctrl+Shift+P) → Extensions: Install from VSIX… → pick the file. - Reload the window.
The extension looks for the aster-view command in your PATH, in ~/.local/bin, in virtual environments under ~/venvs (also ~/.venvs, ~/.virtualenvs, ~/venv) and in conda environments (anaconda3, miniconda3, miniforge3…). If it lives elsewhere, set its full path in the setting Aster View: Executable (e.g. /home/me/somewhere/bin/aster-view). There is no need to choose a Python interpreter in VS Code: the extension runs the aster-view command directly.
The MCP client starts the server itself; you only register the command. Use the full path of aster-mcp, which you can get with which aster-mcp inside the environment.
Claude Code:
claude mcp add --scope user aster-med -- /home/me/venvs/aster-view/bin/aster-mcpClaude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"aster-med": { "command": "/home/me/venvs/aster-view/bin/aster-mcp" }
}
}Other MCP clients: run aster-mcp over stdio.
The repository includes two small examples, both computed with code_aster 17.4:
| example | what it shows |
|---|---|
examples/thick_tube |
quarter of a thick-walled tube under internal pressure (HEXA20, 2.6 MB). Its exact solution is known (Lamé), so it doubles as a test. |
examples/plate_hole |
quarter of a plate with a hole pulled until it yields (HEXA20, elastic-plastic, 3.3 MB): stress concentration, a plastic zone that grows over time, internal variables at the Gauss points. |
git clone https://github.com/tin7/aster-view && cd aster-view
aster-view examples/plate_hole/plate_resu.med --field SIGM_NOEU --comp VMISThe browser opens with the von Mises stress. Things to try:
- the ⊞ button in the toolbar shows the elements;
- in the Pipeline, the eye of Deformed shape turns it on; click its name to change the scale;
- the eye of Cut turns on a cut; click Cut to pick a preset (X, Y, Z, transverse…);
- the eyedropper reads values with a click; they are listed in the Values tab;
- the language and the dark theme are at the top right.
From VS Code: right-click plate_resu.med in the explorer → Open in Aster View (results).
With an MCP client, ask something like "open examples/plate_hole/plate_resu.med in the viewer" or "max hoop stress at the Gauss points in examples/thick_tube/tube_resu.med".
aster-view --help lists the options: --field, --comp, --mesh, --port, --no-browser, --lang es|en|fr, --timeout.
The layout follows ParaView:
-
Toolbar (top):
- color by field and component and, for Gauss-point fields, the value per element (mean, min, max or max |value| of its Gauss points);
- representation, element edges and nodes;
- colormap, invert, rescale to the visible data or over all time steps, color bar;
- click mode, camera and time controls.
-
Pipeline (left): the file and four filters, each with an eye to turn it on or off:
- deformed shape (DEPL × scale);
- threshold by value;
- cut (clip, slice or whole cells);
- axial window.
Clicking an item shows its properties.
-
Tabs below the pipeline:
- Properties of the selected item. For the file: coloring (colormap, bands, range, log scale, symmetric range, color bar), styling (representation, opacity, shading, color and size of edges and nodes), visible groups, view (background, text, axes), saved views and the cylindrical axis.
- Information: the mesh (nodes, cells by type, bounds) and the fields (support, components, time steps).
- Values: the points read with the eyedropper (value, nearest node, coordinates). They follow changes of time step or component.
- Figure: journal figures, see below.
-
Status bar (bottom): field, component and time, the min/max of what is shown and, for Gauss-point fields, the min/max at the Gauss points. Both are shown because the mean per element hides peaks.
-
Top right: language and light/dark theme. Both are remembered.
Mouse.
- Drag to rotate.
- The wheel zooms towards the cursor.
- Shift + drag pans.
- Ctrl + drag rotates in the screen plane.
- Drag the color bar to move it, or pull one of its edges to resize it; near the top or bottom it turns horizontal. Quick placements (right, left, top, bottom) are in Properties → Coloring, and the placement is saved with views and figure recipes.
Click modes (toolbar):
- rotate;
- hand: pan without rotating;
- read a value;
- center the view on a point;
- magnifier: drag a box to zoom into it, like ParaView's Zoom to Box (a single click zooms ×2);
- place the cutting plane.
Cut:
- clip, slice or whole cells;
- presets X, Y, Z, transverse, longitudinal (at angle θ) and facing the camera;
- position along the normal, or origin and normal by hand;
- a draggable plane in 3D;
- the rest of the part translucent.
The viewer listens on localhost only. It exits by itself 10 minutes after its last browser tab is closed.
In VS Code, the viewer opens in a tab. You can open it in several ways:
- right-click the file in the explorer or its tab → Open in Aster View (results);
- Open With… → Aster View (results); from there you can make it the default editor for
*.med; - the Aster View button in the status bar while a
.medfile is open; - the chart button in the title bar of the mesh viewer of VS Code Aster.
Extension settings:
asterView.executable;asterView.openIn:vscodetab or systembrowser;asterView.language:auto= the language last chosen in the viewer; the first time, the VS Code language.
Relation to VS Code Aster. The VS Code Aster extension by Simvia edits .comm/.export files, runs studies and shows meshes and groups. Aster View complements it with the results: fields, time steps, deformed shape, cuts, Gauss points and figures. Both can be installed together.
The Paper figure panel (or the med_figure MCP tool) writes a figure in journal style:
- VTK draws only the geometry: white background and, by default, no shading, so the colors match the color bar exactly;
- matplotlib draws the color bar and labels (DejaVu Sans 9/10 pt, 600 dpi);
- the figure is framed like the current view.
![]() |
![]() |
![]() |
![]() |
The top two are made in the Figure tab (or with med_figure). The bottom two are the plots of med_line and med_history, which use the same style and are also saved as PDF.
Options:
- width of 1, 1.5 or 2 columns;
- horizontal, vertical or no color bar;
- label with mathtext (
$\sigma_\theta$ (MPa)) and a factor for the values (e.g. 1000 to go from m to mm); - length scale bar (with parallel projection).
Output in <output>/<med name>/figuras/:
- PDF and 600 dpi PNG;
- a
.jsonrecipe with the full state and camera, so thatmed_figure(recipe=...)regenerates the same figure later; - the
\includegraphics[width=X\linewidth]line. Its width keeps the font size equal to other one-column figures of an Elsevier two-column article (column = 243 pt).
Besides the components stored in the file, the following are computed:
NORM;DR/DT/DA: cylindrical displacement;SIRR/SITT/SIAA/SIRT/SIRA/SITA: stress in cylindrical coordinates, and the same for any other symmetric tensor stored as<P>XX…<P>YZ;VMISandTRACE.
The cylindrical axis runs along the longest side of the bounding box. It goes through the common center of the nodes when they form rings (full, half or quarter tubes), otherwise through the center of the box. You can change it in the Cylindrical axis panel or with axis_point / axis_dir. The radial direction is taken from the undeformed geometry.
- 2D models (
D_PLAN,C_PLAN,AXIS): the mesh is drawn in the xy plane, seen from the front and with parallel projection. Stress tensors have 4 components (SIXX, SIYY, SIZZ, SIXY);VMISandTRACEare computed from them. Cylindrical components are not offered, because in an axisymmetric model the components already are cylindrical: SIXX = σr, SIYY = σz, SIZZ = σθ. - ELNO fields (
SIGM_ELNO,VARI_ELNO…): one value per node of each element. They are painted like Gauss-point fields (one value per element: mean, min, max or max |value| of its nodes), and statistics and extractions give each value with its element and node. - Several meshes in one file (e.g. two
IMPR_RESUof results on different meshes): each field is read on its own mesh. The viewer shows a Mesh selector in the file properties (and accepts--mesh). The MCP tools take the full field name, e.g.r2d_____DEPL, ormesh=when the same short name exists on more than one mesh;med_infolists the meshes and their fields.
| tool | what it does |
|---|---|
med_info |
mesh, groups and fields (support, components, time steps, profile); detects truncated files |
med_steps |
time steps of a field |
med_stats |
min/max with their location, mean and percentiles, over a group or the whole model |
med_history |
time history over a group, at a node, or at the point nearest to (x, y, z) (table + journal-style plot, PNG and PDF) |
med_line |
profile along a segment, also on a boundary face such as a symmetry plane (CSV + journal-style plot, PNG and PDF) |
med_extract |
raw values with coordinates over a group (CSV) |
med_render |
PNG image with all the viewer controls (any cut plane, threshold, background…), or from a saved view |
med_figure |
journal figure (PDF/PNG/recipe), from parameters or from a recipe |
med_view |
opens the interactive viewer for the user |
med_to_vtu |
.pvd + .vtu series for a ParaView without a MED reader |
Statistics, extractions and histories use the Gauss points themselves. Images paint one value per element. Numbers you report should come from med_stats, med_extract or med_line, not from colors.
The tool descriptions are in English. Option values also accept their Spanish or French labels, e.g. clip_mode="slice", "Sección" or "Section". For files with several meshes, the tools accept mesh=.
Aster View never modifies .med files. Everything it writes goes to <output>/<med name>/: screenshots, CSV files, figures, saved views (vistas/) and VTU files.
<output> is, in this order of priority:
- the environment variable
ASTER_VIEW_OUT; "output_dir"in~/.config/aster-view/config.json;~/aster_view_output.
The same config file stores the language chosen in the viewer:
{ "language": "en", "output_dir": "~/results/aster_view" }The language is chosen in this order: --lang, then the last one chosen in the viewer, then the environment variable ASTER_VIEW_LANG, then the system language, then English.
- Exact solution (
tests/test_reader.py, runs in CI). On the example tube, against Lamé:- σr at the 7 776 Gauss points within 0.6 % of the pressure;
- σθ within 0.25 %;
- σz ≈ 0;
- radial displacement within 4·10⁻⁶ (relative);
- fields at t = 0.5 exactly half of t = 1.
- Against MEDCoupling 9.15, on production code_aster 17.4 files: SIEF_ELGA on HEXA20 identical, Gauss point coordinates within 2·10⁻¹⁵, and a profiled DEPL field (model restricted with
GROUP_MA) with the same NaN and identical values.tests/ref_medcoupling_docker.pyrepeats the comparison on your own files inside the code_aster Docker image. - Against an independent post-processing script: on a production HEXA20 model, the cylindrical stress components reproduced 24 averaged values computed with MEDCoupling, with a maximum difference of 3·10⁻¹⁴ MPa.
- ELNO, 2D and several meshes (
tests/test_formats.py, small code_aster files intests/data):SIGM_ELNOaveraged over the elements around each node equals code_aster'sSIGM_NOEUexactly, so every ELNO value sits on its node;- von Mises from the 4 stress components of 2D models equals code_aster's
SIEQ_ELGA(QUAD8 and TRIA6, to 1e-13); - an axisymmetric tube matches Lamé within 0.3 % of the pressure;
- a file with a 3D and a 2D mesh is read field by field on the right mesh.
- Viewer and MCP server:
pytestcovers off-screen rendering, values per element, picking, saved views, the three languages and all MCP tools end to end over stdio.
- The colors of a Gauss-point field are one value per element (mean, min, max or max |value|), not an extrapolation to the nodes.
- There are no isolines (Contour), vector glyphs, axes grid or side-by-side views yet.
- For pyramids (PY5/P13) the Gauss points are placed at the centroid.
- Tested on Linux only. Windows and macOS should work, since all dependencies have wheels, but they have not been tried.
- If the 3D view stays black (seen under Xvfb, a virtual X display), start the viewer with
VTK_DEFAULT_OPENGL_WINDOW=vtkEGLRenderWindow, or withoutDISPLAY. It never needs a window on screen.
git clone https://github.com/tin7/aster-view && cd aster-view
pip install -e ".[test]"
pytest # all tests (VTK renders off-screen)
pytest -m "not render" # only reader, components and translationsaster_view/medfile.py MED reader (h5py) aster_view/scene.py VTK scene and interaction
aster_view/derived.py derived components aster_view/viewer.py viewer (trame)
aster_view/figure.py journal figures aster_view/server.py MCP server
aster_view/i18n.py texts in es/en/fr, option names aster_view/paraview_colormaps.json
examples/thick_tube/ example 1: tube under pressure (Lamé); mesh script, .comm, .export, result
examples/plate_hole/ example 2: plate with a hole, elastic-plastic
docs/make_images.py regenerates the pictures of this README
vscode/ VS Code extension
tests/ pytest suite; tests/data: small code_aster files (ELNO, 2D, several meshes)
- Regenerating the example needs Docker and the official image:
examples/thick_tube/run.sh(about 30 s). - Building the extension:
cd vscode && npx @vscode/vsce package. - Adding a language: add a column to
UIandCHOICESinaster_view/i18n.py, thenpackage.nls.<lang>.jsonandl10n/bundle.l10n.<lang>.jsoninvscode/.
Bug reports and suggestions are welcome in the issues. If a file does not open or looks wrong, please include med_info output or the error message. Pull requests are welcome too (fixes, element types, languages, features); please run pytest first.
MIT, see LICENSE.










