Skip to content

"mesh" block

Current AsFem input files are JSON. The mesh section is a JSON object named "mesh", not the old [mesh] ... [end] text block.

Built-in structured mesh

json { "mesh": { "type": "asfem", "dim": 2, "nx": 20, "ny": 10, "xmin": 0.0, "xmax": 2.0, "ymin": 0.0, "ymax": 1.0, "meshtype": "quad4", "distribution": "asfem", "savemesh": true } }

Imported mesh

json { "mesh": { "type": "msh4", "file": "cookmembrane2d.msh", "distribution": "metis", "savemesh": false } }

Supported type

  • "asfem": built-in 1D, 2D, or 3D structured mesh generator.
  • "msh2": import a Gmsh v2 .msh file.
  • "msh4": import a Gmsh v4 .msh file.
  • "gmsh2": import a .gmsh2 file generated for the Netgen/Gmsh2 importer.

"asfem" options

  • "dim": required integer, must be 1, 2, or 3.
  • "nx": required integer for all dimensions, must be >= 1.
  • "ny": required integer for 2D and 3D, must be >= 1.
  • "nz": required integer for 3D, must be >= 1.
  • "xmin", "xmax", "ymin", "ymax", "zmin", "zmax": optional floating-point bounds. Unset bounds default to 0.0 and 1.0 on the active axes.
  • "meshtype": required string. Supported values are:

text 1D: edge2, edge3, edge4 2D: quad4, quad8, quad9 3D: hex8, hex20, hex27

  • "distribution": optional string. The parser accepts "asfem" and "metis". If omitted, "asfem" is used.
  • "savemesh": optional boolean. If true, AsFem writes input-name-mesh.vtu. For example, case.json becomes case-mesh.vtu.

The parser rejects axis-specific entries that do not match the dimension. For example, "ny" is invalid in 1D, and "zmin"/"zmax" are invalid in 2D.

Imported mesh options

  • "file": required string. The extension must match the import type:

text type = "msh2" -> *.msh type = "msh4" -> *.msh type = "gmsh2" -> *.gmsh2

  • "distribution": optional "asfem" or "metis".
  • "savemesh": optional boolean. If true, AsFem writes input-name-mesh.vtu.

For imported meshes, dim, nx, ny, nz, and meshtype are not used. The mesh topology and physical names come from the mesh file itself.