The refine command is used to create more elements. The method in which these new elements are formed is based on the refine_option chosen. The refine criteria used in these methods are defined in the Grid Refinement Section.


The refinement choice is followed on the command line by options that are needed for the type of refinement chosen. See the details for each refine_option for a description of parameters specific to the refine type. See examples below for various formats. In general the refine arguments include:

refine / refine_option / field / interpolation / refine_type / :range / xvalue / [ xvalue2 / xvalue3 / inclusive_flag ]

refine_option: indicates the choice of refinement method. The choices for first parameter are:

refine_type specifies what object will be refined and how that object will be refined:

element in 3D will refine elements by placing a point in the center of the element.

     in 2D (triangle) will refine element by refining all edges of the triangle.

face in 3D will refine facets by placing a point in the center of the facet.

     in 2D (triangle) will refine face by refining all edges of the face.

edge will refine edges by placing a point on the midpoint of the edge.

faceedge will refine facets by refining all edges of the facet.

tetedge will refine elements by refining all edges of the element.

field must refer to a previously defined attribute of the current Mesh Object.

interpolation specifies how to interpolate the field to give field values to the new nodes created. The implemented values are linear, log, and sinh.

range is the selection of points designated by node numbers for ifirst,ilast,istride or pset,get,pname. /1,0,0/ will select all nodes in the Mesh object.

xvalue [/xvalue2/xvalue3/] is the real number usually indicating a size for the different refine options. Most of the refine options do not use the second and third values so their places will be empty ///. See examples.

inclusion_flag is an optional flag specifing if refinement is an inclusive or an exclusive operation. By default, all operations are exclusive. For inclusive, if an edge refinement is specified restricted to a pset, then an edge is eligible for refinement if either or both of the end points belong to the pset selected. If the inclusion_flag is exclusive then both end points must be in the pset. The implemented values are inclusive and exclusive.


Quad and hexahedral elements may be refined creating quad tree and octree meshes. Three new Mesh object attributes are added during this operation. The refine_type must be element. The refine_option must be constant, junction or maxsize. The values for /xvalue/xvalue2/xvalue3/ should be /-1.,0.,0./. For an element set, use the shortened syntax refine/element_set/eltset,get,esetname.

The element attributes added to the Mesh object are:

itetlev(ie) is an integer with the level of refinement. An unrefined mesh element has itetlev(ie)=0, one level of refinement itetlev(ie)=1, etc.

itetkid(ie) is a pointer to a child element number. If nothing has been done to change element numbering, it is element number of the first child element created and the rest of the children are in sequence after the first child. If itetkid(ie)=0 , the element has not been refined further.

itetpar(ie)is a pointer to the parent element at refinement level  itetlev(ie)-1.

Quad meshes will have 4 children for each refined element. Hex meshes will have 8 children. The children are generated sequentially; The first child will contain the first local node of the parent element, the other elements are created in the order shown in this diagram.

For example in the picture below, element e1 is refined to create 8 children, c1, c2, c3, c4, c5, c6, c7, c8.

Label Element # itetlev itetkid itetpar  
e1 1 0 2 0
c1 2 1 0 1
c2 3 1 0 1
c3 4 1 0 1
c4 5 1 0 1
c5 6 1 0 1
c6 7 1 0 1
c7 8 1 0 1
c8 9 1 0 1

One can control refinement so that a hex is broken into either 8, 4 or 2 elements and a quad is broken into either 4 or 2 elements. This is controlled with the principal refine direction choice (prd_choice) parameter. This syntax works assuming imt values are greater or equal to zero with principal refine direction chosen through a combination of “123” prd_choice indicators as defined below. The command line used is:

refine/constant/itetclr/linear/element/1,0,0/-1.,0.,0./exclusive/amr prd_choice

or with element selection (based on pset and inclusive/exclusive options): refine/constant/imt1/linear/element/pset,get,pname/-1.,0.,0./inclusive/ amr prd_choice

prd_choice indicates the chosen principal refinement direction based on the local hex element topology as defined by edge numbers, for instance, quad edge 1 is in the x direction relative to the local topology.

= 1 refine along x direction, 1 hex->2 hex, 1 quad->2 quad (quad edges 1 and 4)

= 2 refine along y direction, 1 hex->2 hex, 1 quad->2 quad (quad edges 2 and 3)

= 3 refine along z direction, 1 hex->2 hex, 1 quad->4 quad

= 12 refine along x and y direction, 1 hex->4 hex, 1 quad->4 quad

= 13 refine along x and z direction, 1 hex->4 hex, 1 quad->4 quad

= 23 refine along y and z direction, 1 hex->4 hex, 1 quad->4 quad

= 123 refine xyz with prd amr routines, 1 hex->8 hex, 1 quad->4 quad

= 0 refine xyz with default amr refinement, 1 hex->8 hex, 1 quad->4 quad


refine/refine_option/ [field]/ [interpolation]/refine_type /ifirst, ilast, istride/xrefine/yrefine/zrefine/inclusive_flag/



refine/interface/// edge/pset,get,psetname

refine/element_set / eltset,get,esetname

refine/eltset / eltset,get,esetname


refine / maxsize///edge /pset,get,something / .25

will refine element where edge is longer than .25

refine/constant/concentration/log /edge/1,0,0/25.0///inclusive

will refine where concentration is greater than 25.

refine /addpts///et /pset,get,newpoints/

refine explicitly by adding the new nodes in the set newpoints

refine /rivara///edge/pset,get,p1/.5///inclusive

refine all edges containing at least one node in pset p1 that are longer than .5. Using the ‘rivera’ algorithm may result in edges not containing nodes in the pset to be refined.


rivera_truncated, exclusive will refine only edges both of whose endpoints are in the selected pset named p1


rivara_boundary will only refine boundary edges.


will refine based on .28 distance to the surface named ptop.

refine/edge\_list///edge/1 2 23 47

will refine the edge with endpoints 1 and 2 AND the edge with endpoints 23 and 47.

eltset / elem3 / id\_elem1 / eq / 3
refine/eltset / eltset,get, elem3

will create a node set from the element set named elem3 and refine using the constant option.


create a quadtree refined quad mesh

eltset / elm2 / itetclr / eq / 2
pset/ pelm2 / eltset elm2

refine the material 2 elements of a hex mesh , do not refine in the vertical direction


refine the material 2 elements of a hex mesh , refine only in the vertical direction