mesh_remesh
Adaptively remesh .mdpa meshes with MMG via level-set, Hessian, or uniform sizing, then write a new .mdpa while preserving boundaries and reporting field transfer error.
Instructions
Adaptively remesh a .mdpa with MMG (MeshingApplication) and write a new .mdpa; returns before/after mesh summaries, a boundary preservation check and the field transfer error. Needs KratosMeshingApplication built with MMG (see kratos_install). Strategies: 'levelset' refines around a signed distance given as 'region' ({"type": "sphere", "center": [x, y], "radius": r} or {"type": "box", "min": [...], "max": [...]}; "mode": "inside" (default, the whole region gets min_size) or "surface") or as 'distance_expression' in x, y, z; 'hessian' adapts to the second derivatives of the analytic nodal field field_expression stored in the Kratos scalar variable field_variable; 'uniform' remeshes to the single element size min_size. Sizes default to max_size = mean input element size, min_size = max_size/4; the size grows from min_size to max_size over transition_distance (default 3max_size). preserve_sub_model_parts (default: every part with conditions) are checked to keep their conditions and node bounding box; freeze_sub_model_parts additionally forbids MMG from touching their nodes. check_fields ([{"variable": "TEMPERATURE", "expression": "x + 2y"}]) assigns analytic nodal values before remeshing and reports how well the interpolation reproduces them on the new nodes. Elements must be linear simplices (triangles or tetrahedra, not mixed; quads, hexes and quadratic cells are refused up front - convert with mdpa_convert_cells first). The result reports mesh_kind: planar2d (the verified path), volume3d (tetrahedra) or surface3d (triangles spanning z); the 3D kinds are wired to MmgProcess3D / MmgProcess3DSurfaces but not verified against reference numbers, which a warnings entry says. For 'hessian', interpolation_error (default 0.04) is the target P1 interpolation error - smaller means finer. A metric computed on a coarse mesh under-resolves a sharp feature: passes=3 repeats remeshing on the previous result (the analytic field is re-evaluated on every new mesh), which on the worked example halves the interpolation error at the same element count. Instead of field_expression, 'hessian' can adapt to a SOLVED field: field_results is a result-index.json (a job's results index; pick the record with field_time or field_step, default the last one) or a single ASCII .vtk/.vtu file whose point data holds field_variable on exactly this mesh's nodes (matched by coordinates). The transferred field is written to the output .mdpa as a 'Begin NodalData' block and carried between passes. Existing output is only replaced with overwrite=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| passes | No | ||
| region | No | ||
| timeout | No | ||
| max_size | No | ||
| min_size | No | ||
| strategy | No | levelset | |
| overwrite | No | ||
| field_step | No | ||
| field_time | No | ||
| input_mdpa | Yes | ||
| output_mdpa | Yes | ||
| applications | No | ||
| check_fields | No | ||
| field_series | No | ||
| field_results | No | ||
| field_variable | No | ||
| field_expression | No | ||
| distance_expression | No | ||
| interpolation_error | No | ||
| transition_distance | No | ||
| freeze_sub_model_parts | No | ||
| preserve_sub_model_parts | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||