MED fichier
usecases/f/UsesCase_MEDmesh_6.f
1C* This file is part of MED.
2C*
3C* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4C* MED is free software: you can redistribute it and/or modify
5C* it under the terms of the GNU Lesser General Public License as published by
6C* the Free Software Foundation, either version 3 of the License, or
7C* (at your option) any later version.
8C*
9C* MED is distributed in the hope that it will be useful,
10C* but WITHOUT ANY WARRANTY; without even the implied warranty of
11C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12C* GNU Lesser General Public License for more details.
13C*
14C* You should have received a copy of the GNU Lesser General Public License
15C* along with MED. If not, see <http://www.gnu.org/licenses/>.
16C*
17
18C******************************************************************************
19C * How to create an unstructured mesh
20C *
21C * Use case 6 : a 2D unstructured mesh with the following features
22C * computing steps, profiles and nodes coordinates evolution.
23C *
24C *****************************************************************************
25 program usescase_medmesh_6
26C
27 implicit none
28 include 'med.hf77'
29C
30C
31 integer cret
32 integer*8 fid
33
34C
35 character (MED_NAME_SIZE) mname
36 character (MED_NAME_SIZE) fname
37 character (MED_COMMENT_SIZE) cmt1,mdesc
38 integer sdim, mdim
39C axis name
40 character (MED_SNAME_SIZE) axname(2)
41C unit name
42 character (MED_SNAME_SIZE) unname(2)
43 real*8 inicoo(30)
44 integer nnodes, ntria3, nquad4
45C tria connectivity
46 integer triacy(24)
47C quad connectivity
48 integer quadcy(16)
49C new_coordinates_step1
50 real*8 nwcos1(6)
51C profile1name
52 character (MED_NAME_SIZE) prof1n
53C profile1
54 integer profi1(3)
55C profile1size
56 integer pro1sz
57C new_coordinates_step2
58 real*8 nwcos2(6)
59C profile2name
60 character (MED_NAME_SIZE) prof2n
61C profile2
62 integer profi2(3)
63C profile2size
64 integer pro2sz
65
66 parameter(fname = "UsesCase_MEDmesh_6.med")
67 parameter(cmt1 = "A 2D unstructured mesh : 15 nodes, 12 cells")
68 parameter(mdesc = "A 2D unstructured mesh")
69 parameter(mname="2D unstructured mesh")
70 parameter(sdim=2, mdim=2)
71 parameter(nnodes=15,ntria3=8,nquad4=4)
72
73 data axname /"x", "y"/
74 data unname /"cm", "cm"/
75 data inicoo /2.,1., 7.,1., 12.,1., 17.,1., 22.,1.,
76 & 2.,6., 7.,6., 12.,6., 17.,6., 22.,6.,
77 & 2.,11.,7.,11.,12.,11.,17.,11., 22.,11./
78 data triacy /1,7,6, 2,7,1, 3,7,2, 8,7,3,
79 & 13,7,8, 12,7,13, 11,7,12, 6,7,11/
80 data quadcy /3,4,9,8, 4,5,10,9,
81 & 15,14,9,10, 13,8,9,14/
82
83C new coordinates (step 1) for nodes 13, 14 and 15
84 data nwcos1 /12.,15., 17.,15., 22.,15./
85 parameter(prof1n="UPPER_QUAD4_PROFILE")
86 data profi1 /13, 14, 15/
87 parameter(pro1sz=3)
88
89C new coordinates (step 2) for nodes 8, 9 and 10
90 data nwcos2 /12.,10., 17.,10., 22.,10./
91 parameter(prof2n="MIDDLE_QUAD4_PROFILE")
92 data profi2 /8, 9, 10/
93 parameter(pro2sz=3)
94C
95C file creation
96 call mfiope(fid,fname,med_acc_creat,cret)
97 if (cret .ne. 0 ) then
98 print *,"ERROR : file creation"
99 call efexit(-1)
100 endif
101C
102C write a comment in the file
103 call mficow(fid,cmt1,cret)
104 if (cret .ne. 0 ) then
105 print *,"ERROR : write file description"
106 call efexit(-1)
107 endif
108C
109C create the profiles in the file
110 call mpfprw(fid,prof1n,pro1sz,profi1,cret)
111 if (cret .ne. 0 ) then
112 print *,"ERROR : create profile"
113 call efexit(-1)
114 endif
115C
116C create the profiles in the file
117 call mpfprw(fid,prof2n,pro2sz,profi2,cret)
118 if (cret .ne. 0 ) then
119 print *,"ERROR : create profile"
120 call efexit(-1)
121 endif
122C
123C mesh creation : a 2D unstructured mesh
124 call mmhcre(fid, mname, sdim, mdim, med_unstructured_mesh, mdesc,
125 & "", med_sort_dtit, med_cartesian, axname, unname, cret)
126 if (cret .ne. 0 ) then
127 print *,"ERROR : mesh creation"
128 call efexit(-1)
129 endif
130C
131C
132C initial nodes coordinates in a cartesian axis in full interlace mode
133C (X1,Y1, X2,Y2, X3,Y3, ...)
134 call mmhcpw(fid, mname, med_no_dt, med_no_it, 0.0d0,
135 & med_compact_stmode, med_no_profile,
136 & med_full_interlace, med_all_constituent,
137 & nnodes, inicoo, cret)
138 if (cret .ne. 0 ) then
139 print *,"ERROR : nodes coordinates"
140 call efexit(-1)
141 endif
142C
143C
144C cells connectivity is defined in nodal mode
145 call mmhypw(fid, mname, med_no_dt, med_no_it, 0.0d0,
146 & med_cell, med_tria3, med_nodal,
147 & med_compact_stmode, med_no_profile,
148 & med_full_interlace, med_all_constituent,
149 & ntria3, triacy, cret)
150 if (cret .ne. 0 ) then
151 print *,"ERROR : triangular cells connectivity"
152 call efexit(-1)
153 endif
154C
155C
156 call mmhypw(fid, mname, med_no_dt, med_no_it, 0.0d0,
157 & med_cell, med_quad4, med_nodal,
158 & med_compact_stmode, med_no_profile,
159 & med_full_interlace, med_all_constituent,
160 & nquad4, quadcy, cret)
161 if (cret .ne. 0 ) then
162 print *,"ERROR : quadrangular cells connectivity"
163 call efexit(-1)
164 endif
165C
166C
167C Mesh deformation (nodes coordinates) in 2 steps
168C The nodes modified are identified by a profile
169C
170C STEP 1 : dt1 = 5.5, it = 1
171 call mmhcpw(fid, mname, 1, 1, 5.5d0,
172 & med_compact_stmode, prof1n,
173 & med_full_interlace, med_all_constituent,
174 & nnodes, nwcos1, cret)
175 if (cret .ne. 0 ) then
176 print *,"ERROR : nodes coordinates"
177 call efexit(-1)
178 endif
179C
180C
181C STEP 2 : dt2 = 8.9, it = 1
182 call mmhcpw(fid, mname, 2, 1, 8.9d0,
183 & med_compact_stmode, prof2n,
184 & med_full_interlace, med_all_constituent,
185 & nnodes, nwcos2, cret)
186 if (cret .ne. 0 ) then
187 print *,"ERROR : nodes coordinates"
188 call efexit(-1)
189 endif
190C
191C
192C create family 0 : by default, all mesh entities family number is 0
193 call mfacre(fid, mname,med_no_name, 0, 0, med_no_group, cret)
194 if (cret .ne. 0 ) then
195 print *,"ERROR : create family 0"
196 call efexit(-1)
197 endif
198C
199C
200C close file
201 call mficlo(fid,cret)
202 if (cret .ne. 0 ) then
203 print *,"ERROR : close file"
204 call efexit(-1)
205 endif
206C
207C
208 end
209C
program usescase_medmesh_6
subroutine mfacre(fid, name, fname, fnum, ngro, gname, cret)
Cette routine permet la création d'une famille portant sur les entités d'un maillage.
Definition: medfamily.f:19
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:42
subroutine mficow(fid, cmt, cret)
Ecriture d'un descripteur dans un fichier MED.
Definition: medfile.f:99
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:82
subroutine mmhcre(fid, name, sdim, mdim, mtype, desc, dtunit, stype, atype, aname, aunit, cret)
Cette routine permet de créer un maillage dans un fichier.
Definition: medmesh.f:20
subroutine mmhcpw(fid, name, numdt, numit, dt, stm, pname, swm, dim, n, coo, cret)
Definition: medmesh.f:340
subroutine mmhypw(fid, name, numdt, numit, dt, entype, geotype, cmode, stmode, pname, swm, dim, n, con, cret)
Definition: medmesh.f:621
subroutine mpfprw(fid, pname, psize, profil, cret)
Definition: medprofile.f:21