Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_tri_mesh_xmf.F90
Go to the documentation of this file.
2 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3  implicit none
4 
5  public :: &
7 
8  private
9 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 
11 !*****************************************
12 ! XDMF output for VisIt and paraview
13 !*****************************************
14 
15 contains
16 
17  subroutine sll_s_write_tri_mesh_xmf(filename, coor, ntri, nbs, nbt, field, label)
18 
19  character(len=*), intent(in) :: filename
20  character(len=*), intent(in) :: label
21  integer, intent(in) :: nbs
22  integer, intent(in) :: nbt
23  real(8), intent(in) :: coor(2, nbs)
24  integer, intent(in) :: ntri(3, nbt)
25  integer, parameter :: xmf = 99
26  real(8), intent(in) :: field(:)
27  integer :: i, j
28 
29  open (xmf, file=filename//".xmf")
30 
31  write (xmf, "(a)") "<?xml version='1.0'?>"
32  write (xmf, "(a)") "<!DOCTYPE Xdmf SYSTEM 'Xdmf.dtd' []> "
33  write (xmf, "(a)") "<Xdmf Version='2.0'>"
34  write (xmf, "(a)") "<Domain>"
35  write (xmf, "(a)") "<Grid Name='Mesh' GridType='Uniform' >"
36  write (xmf, "(a,i6,a)") "<Topology Type='Triangle' NumberOfElements='", nbt, "'>"
37  write (xmf, "(a,i6,a)") "<DataItem Name='Connections' Format='XML' DataType='Int' Dimensions='", &
38  nbt, " 3'>"
39  do i = 1, nbt
40  write (xmf, "(3i6)") (ntri(j, i) - 1, j=1, 3)
41  end do
42  write (xmf, "(a)") "</DataItem>"
43  write (xmf, "(a)") "</Topology>"
44  write (xmf, "(a)") "<Geometry GeometryType='XY'>"
45  write (xmf, "(a,i6,a)") "<DataItem Format='XML' Dimensions='", nbs, " 2'>"
46  do i = 1, nbs
47  write (xmf, "(2f12.6)") coor(:, i)
48  end do
49  write (xmf, "(a)") "</DataItem>"
50  write (xmf, "(a)") "</Geometry>"
51  write (xmf, "(a)") "<Attribute Name='"//label//"' Center='Node'>"
52  write (xmf, "(a,i6,a)") "<DataItem Format='XML' Datatype='Float' Dimensions='", nbs, "'>"
53  do i = 1, nbs
54  write (xmf, "(f12.6)") field(i)
55  end do
56  write (xmf, "(a)") "</DataItem>"
57  write (xmf, "(a)") "</Attribute>"
58  write (xmf, "(a)") "</Grid>"
59  write (xmf, "(a)") "</Domain>"
60  write (xmf, "(a)") "</Xdmf>"
61 
62  end subroutine sll_s_write_tri_mesh_xmf
63 
64 end module sll_m_tri_mesh_xmf
subroutine, public sll_s_write_tri_mesh_xmf(filename, coor, ntri, nbs, nbt, field, label)
    Report Typos and Errors