MED fichier
usecases/f/UsesCase_MEDmesh_9.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 9 : 2D unstructured mesh with moving grid transformation
22C *
23C *
24C *****************************************************************************
25 program usescase_medmesh_9
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 transformation matrix step 1
50 real*8 trama1(7)
51C transformation matrix step 2
52 real*8 trama2(7)
53
54 parameter(fname = "UsesCase_MEDmesh_9.med")
55 parameter(cmt1 = "A 2D unstructured mesh : 15 nodes, 12 cells")
56 parameter(mdesc = "A 2D unstructured mesh")
57 parameter(mname="2D unstructured mesh")
58 parameter(sdim=2, mdim=2)
59 parameter(nnodes=15,ntria3=8,nquad4=4)
60
61 data axname /"x", "y"/
62 data unname /"cm", "cm"/
63 data inicoo /2.,1., 7.,1., 12.,1., 17.,1., 22.,1.,
64 & 2.,6., 7.,6., 12.,6., 17.,6., 22.,6.,
65 & 2.,11.,7.,11.,12.,11.,17.,11., 22.,11./
66 data triacy /1,7,6, 2,7,1, 3,7,2, 8,7,3,
67 & 13,7,8, 12,7,13, 11,7,12, 6,7,11/
68 data quadcy /3,4,9,8, 4,5,10,9,
69 & 15,14,9,10, 13,8,9,14/
70C transformation matrix (step 1) : rotation about the Y-axis : 45 degrees
71 data trama1 /0.0, 0.0, 0.0, 0.92388, 0.0, 0.38268, 0.0/
72C transformation matrix (step 2) : rotation about the Y-axis : 90 degrees
73 data trama2 /0.0, 0.0, 0.0, 0.707, 0.0, 0.707, 0.0/
74C
75C file creation
76 call mfiope(fid,fname,med_acc_creat,cret)
77 if (cret .ne. 0 ) then
78 print *,"ERROR : file creation"
79 call efexit(-1)
80 endif
81C
82C write a comment in the file
83 call mficow(fid,cmt1,cret)
84 if (cret .ne. 0 ) then
85 print *,"ERROR : write file description"
86 call efexit(-1)
87 endif
88C
89C mesh creation : a 2D unstructured mesh
90 call mmhcre(fid, mname, sdim, mdim, med_unstructured_mesh, mdesc,
91 & "", med_sort_dtit, med_cartesian, axname, unname, cret)
92 if (cret .ne. 0 ) then
93 print *,"ERROR : mesh creation"
94 call efexit(-1)
95 endif
96C
97C
98C initial nodes coordinates in a cartesian axis in full interlace mode
99C (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
100 call mmhcpw(fid, mname, med_no_dt, med_no_it, 0.0d0,
101 & med_compact_stmode, med_no_profile,
102 & med_full_interlace, med_all_constituent,
103 & nnodes, inicoo, cret)
104 if (cret .ne. 0 ) then
105 print *,"ERROR : nodes coordinates"
106 call efexit(-1)
107 endif
108C
109C
110C cells connectivity is defined in nodal mode
111 call mmhypw(fid, mname, med_no_dt, med_no_it, 0.0d0,
112 & med_cell, med_tria3, med_nodal,
113 & med_compact_stmode, med_no_profile,
114 & med_full_interlace, med_all_constituent,
115 & ntria3, triacy, cret)
116 if (cret .ne. 0 ) then
117 print *,"ERROR : triangular cells connectivity"
118 call efexit(-1)
119 endif
120C
121C
122 call mmhypw(fid, mname, med_no_dt, med_no_it, 0.0d0,
123 & med_cell, med_quad4, med_nodal,
124 & med_compact_stmode, med_no_profile,
125 & med_full_interlace, med_all_constituent,
126 & nquad4, quadcy, cret)
127 if (cret .ne. 0 ) then
128 print *,"ERROR : quadrangular cells connectivity"
129 call efexit(-1)
130 endif
131C
132C
133C Mesh deformation (nodes coordinates) in 2 steps
134C A rotation by step for each node
135C
136C STEP 1 : dt1 = 5.5, it = 1
137 call mmhtfw(fid, mname, 1, 1, 5.5d0, trama1, cret)
138C
139C
140C STEP 2 : dt2 = 8.9, it = 1
141 call mmhtfw(fid, mname, 2, 1, 8.9d0, trama2, cret)
142C
143C
144C create family 0 : by default, all mesh entities family number is 0
145 call mfacre(fid, mname,med_no_name, 0, 0, med_no_group, cret)
146 if (cret .ne. 0 ) then
147 print *,"ERROR : create family 0"
148 call efexit(-1)
149 endif
150C
151C
152C close file
153 call mficlo(fid,cret)
154 if (cret .ne. 0 ) then
155 print *,"ERROR : close file"
156 call efexit(-1)
157 endif
158C
159C
160 end
161C
program usescase_medmesh_9
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 mmhtfw(fid, name, numdt, numit, dt, tsf, cret)
Definition: medmesh.f:1249
subroutine mmhypw(fid, name, numdt, numit, dt, entype, geotype, cmode, stmode, pname, swm, dim, n, con, cret)
Definition: medmesh.f:621