Mesh operations

Accessing functions

Function, e.g. the density are given by an array rho(i,spin), where i ranges over the mesh points associated with the given domain (see domain decomposition), representing

rho( ri, spin )

What is mesh_x_global(mesh, ip) ?

mesh_x_global(mesh, ip) returns a FLOAT vector, corresponding to the coordinates of point ip of the global mesh.

  function mesh_x_global(mesh, ipg) result(xx)
    class(mesh_t),      intent(in) :: mesh
    integer(int64),        intent(in) :: ipg
    FLOAT                          :: xx(1:mesh%box%dim)

    FLOAT :: chi(1:mesh%box%dim)
    integer :: ix(1:mesh%box%dim)

! no push_sub because function is called too frequently

    call mesh_global_index_to_coords(mesh, ipg, ix)
    chi = ix * mesh%spacing
    xx = mesh%coord_system%to_cartesian(chi)

  end function mesh_x_global

Integration

Integration is implemented as a straightforward summation:

 do ip = 1, mesh%np
      dd = dd + ff(ip)
 end do

Differentiation

Taking derivatives is done by finite differences. The points involved in a derivative are defined by the stencil (see below).

Derivatives are discussed in a separate document Derivatives.md.

Note on packed states:

Note on curvilinear meshes:

The mesh::x(:,:) array always contains a regular mesh, which gets ‘distorded’ to a curvilinear mesh by additional function calls.

Domain decomposition

See Domain_Decomposition.md.