Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_plotmtv.F90
Go to the documentation of this file.
1 !**************************************************************
2 ! Copyright INRIA
3 ! Authors :
4 ! TONUS project team
5 !
6 ! This code SeLaLib (for Semi-Lagrangian-Library)
7 ! is a parallel library for simulating the plasma turbulence
8 ! in a tokamak.
9 !
10 ! This software is governed by the CeCILL-B license
11 ! under French law and abiding by the rules of distribution
12 ! of free software. You can use, modify and redistribute
13 ! the software under the terms of the CeCILL-B license as
14 ! circulated by CEA, CNRS and INRIA at the following URL
15 ! "http://www.cecill.info".
16 !**************************************************************
17 
26 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
27 #include "sll_working_precision.h"
28 
29  implicit none
30 
31  public :: &
33 
34  private
35 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
36 
39  module procedure sll_plotmtv_curv_2d
40  end interface sll_o_plotmtv_write
41 
42 contains
43 
46  subroutine sll_plotmtv_curv_2d(nx, ny, xcoord, ycoord, label, error)
47  sll_int32 :: nx
48  sll_int32 :: ny
49  sll_real64, dimension(nx, ny) :: xcoord
50  sll_real64, dimension(nx, ny) :: ycoord
51  character(len=*) :: label
52  sll_int32 :: error
53 
54  sll_int32 :: file_id
55  sll_int32 :: i, j
56  sll_real64 :: x1, y1
57 
58 ! Create new ASCII file (replace if already existing) using default properties
59  open (file=label//'.mtv', &
60  status='replace', &
61  form='formatted', &
62  newunit=file_id, &
63  iostat=error)
64 
65  write (file_id, "(a)") "$DATA=CURVE2D"
66  write (file_id, "('% xmin=',f7.3,' xmax=', f7.3)") minval(xcoord), maxval(xcoord)
67  write (file_id, "('% ymin=',f7.3,' ymax=', f7.3)") minval(ycoord), maxval(ycoord)
68  write (file_id, "(a)") "% equalscale=T"
69  write (file_id, "(a)") "% spline=1"
70  write (file_id, "(a)") "% markertype=2"
71  write (file_id, "(a)") "% pointID=F"
72  write (file_id, "(a)") "% toplabel='"//label//"' "
73 
74  do i = 1, nx
75  do j = 1, ny
76  write (file_id, *) xcoord(i, j), ycoord(i, j)
77  end do
78  write (file_id, *)
79  end do
80  do j = 1, ny
81  do i = 1, nx
82  write (file_id, *) xcoord(i, j), ycoord(i, j)
83  end do
84  write (file_id, *)
85  end do
86 
87  write (file_id, "(a)") "$DATA=CURVE2D"
88  write (file_id, "('% xmin=',f7.3,' xmax=', f7.3)") minval(xcoord), maxval(xcoord)
89  write (file_id, "('% ymin=',f7.3,' ymax=', f7.3)") minval(ycoord), maxval(ycoord)
90  write (file_id, "(a)") "% equalscale=T"
91  write (file_id, "(a)") "% spline=1"
92  write (file_id, "(a)") "% markertype=2"
93  write (file_id, "(a)") "% pointID=F"
94  write (file_id, "(a)") "% toplabel='"//label//" with numbers' "
95 
96  do i = 1, nx
97  do j = 1, ny
98  write (file_id, *) xcoord(i, j), ycoord(i, j)
99  end do
100  write (file_id, *)
101  end do
102  do j = 1, ny
103  do i = 1, nx
104  write (file_id, *) xcoord(i, j), ycoord(i, j)
105  end do
106  write (file_id, *)
107  end do
108 
109 !Numeros des elements
110  do i = 1, nx - 1
111  do j = 1, ny - 1
112  x1 = 0.25_f64*(xcoord(i, j) + xcoord(i + 1, j) + xcoord(i, j + 1) + xcoord(i + 1, j + 1))
113  y1 = 0.25_f64*(ycoord(i, j) + ycoord(i + 1, j) + ycoord(i, j + 1) + ycoord(i + 1, j + 1))
114  write (file_id, "(a)", advance="no") "@text x1="
115  write (file_id, "(g15.3)", advance="no") x1
116  write (file_id, "(a)", advance="no") " y1="
117  write (file_id, "(g15.3)", advance="no") y1
118  write (file_id, "(a)", advance="no") " z1=0. lc=4 ll='"
119  write (file_id, "(2i3)", advance="no") i, j
120  write (file_id, "(a)") "'"
121  end do
122  end do
123 
124  write (file_id, *) "$END"
125  close (file_id)
126 
127  end subroutine sll_plotmtv_curv_2d
128 
129 end module sll_m_plotmtv
130 
Create the mtv file to plot a structured mesh (cartesian or curvilinear)
Implements the functions to write data file plotable by Plotmtv.
subroutine sll_plotmtv_curv_2d(nx, ny, xcoord, ycoord, label, error)
write a data file plotable by plotmtv to visualize a 2d curvilinear mesh
    Report Typos and Errors