MED fichier: Fichier source de UsesCase_MEDfield_5.f90

MED fichier

- Documentation MED
- Guides d'utilisation
- Guides de référence

UsesCase_MEDfield_5.f90
Aller à la documentation de ce fichier.
1 !* This file is part of MED.
2 !*
3 !* COPYRIGHT (C) 1999 - 2017 EDF R&D, CEA/DEN
4 !* MED is free software: you can redistribute it and/or modify
5 !* it under the terms of the GNU Lesser General Public License as published by
6 !* the Free Software Foundation, either version 3 of the License, or
7 !* (at your option) any later version.
8 !*
9 !* MED is distributed in the hope that it will be useful,
10 !* but WITHOUT ANY WARRANTY; without even the implied warranty of
11 !* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 !* GNU Lesser General Public License for more details.
13 !*
14 !* You should have received a copy of the GNU Lesser General Public License
15 !* along with MED. If not, see <http://www.gnu.org/licenses/>.
16 !*
17
18 !*
19 !*
20 !* Field use case 5 : read a field with following with computing steps
21 !*
22
23 program usescase_medfield_5
24
25 implicit none
26 include 'med.hf90'
27
28 integer cret
29 integer fid
30 character(64) :: mname
31 ! field name
32 character(64) :: finame = 'TEMPERATURE_FIELD'
33 ! nvalues, local mesh, field type
34 integer nstep, nvals, lcmesh, fitype
35 integer ncompo
36 !geotype
37 integer geotp
38 integer, dimension(MED_N_CELL_FIXED_GEO) :: geotps
39 ! mesh num dt, mesh num it
40 integer mnumdt, mnumit
41 integer csit, numit, numdt, it
42 real*8 dt
43 character(16) :: dtunit
44 ! component name
45 character(16) :: cpname
46 ! component unit
47 character(16) :: cpunit
48 real*8, dimension(:), allocatable :: values
49
50 geotps = med_get_cell_geometry_type
51
52 ! open MED file
53 call mfiope(fid,'UsesCase_MEDfield_4.med',med_acc_rdonly, cret)
54 if (cret .ne. 0 ) then
55 print *,'ERROR : open file'
56 call efexit(-1)
57 endif
58
59 ! ... we know that the MED file has only one field with one component ,
60 ! a real code working would check ...
61 !
62 ! if you know the field name, direct access to field informations
63 call mfdfin(fid,finame,mname,lcmesh,fitype,cpname,cpunit,dtunit,nstep,cret)
64 if (cret .ne. 0 ) then
65 print *,'ERROR : Field info by name ...'
66 call efexit(-1)
67 endif
68 print *, 'Mesh name :', mname
69 print *, 'Local mesh :', lcmesh
70 print *, 'Field type :', fitype
71 print *, 'Component name :', cpname
72 print *, 'Component unit :', cpunit
73 print *, 'Dtunit :', dtunit
74 print *, 'Nstep :', nstep
75
76 ! Read field values for each computing step
77 do csit=1,nstep
78 call mfdcmi(fid,finame,csit,numdt,numit,dt,mnumdt,mnumit,cret)
79 if (cret .ne. 0 ) then
80 print *,'ERROR : Computing step info ...'
81 call efexit(-1)
82 endif
83 print *, 'csit :', csit
84 print *, 'numdt :', numdt
85 print *, 'numit :', numit
86 print *, 'dt :', dt
87 print *, 'mnumdt :', mnumdt
88 print *, 'mnumit :', mnumit
89
90 ! ... In our case, we suppose that the field values are only defined on cells ...
91
92 do it=1,(med_n_cell_fixed_geo)
93
94 geotp = geotps(it)
95
96 call mfdnva(fid,finame,numdt,numit,med_cell,geotp,nvals,cret)
97 if (cret .ne. 0 ) then
98 print *,'ERROR : Read number of values ...'
99 call efexit(-1)
100 endif
101 print *, 'Number of values of type :', geotp, ' :', nvals
102
103 if (nvals .gt. 0) then
104 allocate(values(nvals),stat=cret )
105 if (cret > 0) then
106 print *,'Memory allocation'
107 call efexit(-1)
108 endif
109
110 call mfdrvr(fid,finame,numdt,numit,med_cell,geotp,&
111 med_full_interlace, med_all_constituent,values,cret)
112 if (cret .ne. 0 ) then
113 print *,'ERROR : Read fields values for cells ...'
114 call efexit(-1)
115 endif
116 print *, 'Fields values for cells :', values
117
118 deallocate(values)
119
120 endif
121 enddo
122 enddo
123
124 ! close file
125 call mficlo(fid,cret)
126 if (cret .ne. 0 ) then
127 print *,'ERROR : close file'
128 call efexit(-1)
129 endif
130
131 end program usescase_medfield_5
132
mfdrvr
subroutine mfdrvr(fid, fname, numdt, numit, etype, gtype, swm, cs, val, cret)
Cette fonction permet de lire les valeurs d'un champ définies sur des entités d'un maillage pour une ...
Definition: medfield.f:442
usescase_medfield_5
program usescase_medfield_5
Definition: UsesCase_MEDfield_5.f90:23
mficlo
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:80
mfdfin
subroutine mfdfin(fid, fname, mname, lmesh, type, cname, cunit, dtunit, nc, cret)
Cette fonction permet de lire les informations concernant le champ de nom fieldname.
Definition: medfield.f:259
mfdnva
subroutine mfdnva(fid, fname, numdt, numit, etype, gtype, n, cret)
Cette fonction permet de lire le nombre de valeurs dans un champ pour une séquence de calcul...
Definition: medfield.f:364
mfdcmi
subroutine mfdcmi(fid, fname, it, numdt, numit, dt, mnumdt, mnumit, cret)
Cette fonction permet de lire les informations caractérisant une séquence de calcul : numéro de pas d...
Definition: medfield.f:298
mfiope
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:41