Exodus 8.24
Loading...
Searching...
No Matches
/exodus_for/test/testwtd.f
1C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3C NTESS, the U.S. Government retains certain rights in this software.
4C
5C See packages/seacas/LICENSE for details
6
7 program testwtd
8
9c This is a test program for the Fortran binding of the EXODUS II
10c database write routines using double precision reals.
11
12c history -
13c Original L.A. Schoof
14c 02/25/93 V.R. Yarberry - Added error checks for file creation.
15c 03/04/93 V.R. Yarberry - Fixed bug in expvtt test, ebids was not passed
16c 08/31/93 VRY - updated to match API version 2.00
17
18 include 'exodusII.inc'
19
20 integer iin, iout
21 integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
22 integer num_elem_in_block(2), num_node_sets
23 integer num_side_sets
24 integer i, j, k, m, elem_map(2), connect(4)
25 integer node_list(10), elem_list(10), side_list(10)
26 integer ebids(2),ids(2), num_nodes_per_set(2), num_elem_per_set(2)
27 integer num_df_per_set(2)
28 integer df_ind(2), node_ind(2), elem_ind(2), num_qa_rec, num_info
29 integer num_glo_vars, num_nod_vars, num_ele_vars
30 integer truth_tab(3,2)
31 integer whole_time_step, num_time_steps
32 integer cpu_word_size, io_word_size
33 integer prop_array(2)
34
35 real*8 glob_var_vals(10), nodal_var_vals(8)
36 real*8 time_value, elem_var_vals(20)
37 real*8 x(8), y(8), dummy(1)
38 real*8 attrib(1), dist_fact(8)
39
40 character*(MXSTLN) coord_names(3)
41 character*(MXSTLN) cname
42 character*(MXSTLN) var_names(3)
43 character*(MXSTLN) qa_record(4,2)
44 character*(MXLNLN) inform(3)
45 character*(MXSTLN) prop_names(2)
46
47 logical whole
48
49 data iin /5/, iout /6/
50
51 cpu_word_size = 8
52 io_word_size = 8
53
54c create EXODUS II files
55
56 exoid = excre("test.exo",
57 1 exclob, cpu_word_size, io_word_size, ierr)
58 write (iout,'("after excre for test.exo,id: ",i4,", err=",i3)')
59 1 exoid, ierr
60 write (iout,'(" cpu word size: ",i4," io word size: ",i4)')
61 1 cpu_word_size, io_word_size
62 write (iout,'("after excre, error = ", i4)') ierr
63
64c initialize file with parameters
65
66 num_dim = 2
67 num_nodes = 8
68 num_elem = 2
69 num_elem_blk = 2
70 num_node_sets = 2
71 num_side_sets = 2
72
73 call expini (exoid, "This is a test", num_dim, num_nodes,
74 1 num_elem, num_elem_blk, num_node_sets,
75 2 num_side_sets, ierr)
76
77 write (iout, '("after expini, error = ", i4)' ) ierr
78
79c write nodal coordinates values and names to database
80
81 x(1) = 0.0
82 x(2) = 1.0
83 x(3) = 1.0
84 x(4) = 0.0
85 x(5) = 1.0
86 x(6) = 2.0
87 x(7) = 2.0
88 x(8) = 1.0
89 y(1) = 0.0
90 y(2) = 0.0
91 y(3) = 1.0
92 y(4) = 1.0
93 y(5) = 0.0
94 y(6) = 0.0
95 y(7) = 1.0
96 y(8) = 1.0
97
98 call expcor (exoid, x, y, dummy, ierr)
99 write (iout, '("after expcor, error = ", i4)' ) ierr
100
101 coord_names(1) = "xcoor"
102 coord_names(2) = "ycoor"
103
104 call expcon (exoid, coord_names, ierr)
105 write (iout, '("after expcon, error = ", i4)' ) ierr
106
107c write element order map
108
109 do 10 i = 1, num_elem
110 elem_map(i) = i
11110 continue
112
113 call expmap (exoid, elem_map, ierr)
114 write (iout, '("after expmap, error = ", i4)' ) ierr
115
116c write element block parameters
117
118 num_elem_in_block(1) = 1
119 num_elem_in_block(2) = 1
120
121 ebids(1) = 10
122 ebids(2) = 11
123
124 cname = "quad"
125
126 call expelb (exoid,ebids(1),cname,num_elem_in_block(1),4,1,ierr)
127 write (iout, '("after expelb, error = ", i4)' ) ierr
128
129 call expelb (exoid,ebids(2),cname,num_elem_in_block(2),4,1,ierr)
130 write (iout, '("after expelb, error = ", i4)' ) ierr
131
132c write element block properties
133
134 prop_names(1) = "MATL"
135 prop_names(2) = "DENSITY"
136 call exppn(exoid,exeblk,2,prop_names,ierr)
137 write (iout, '("after exppn, error = ", i4)' ) ierr
138
139 call expp(exoid, exeblk, ebids(1), "MATL", 10, ierr)
140 write (iout, '("after expp, error = ", i4)' ) ierr
141 call expp(exoid, exeblk, ebids(2), "MATL", 20, ierr)
142 write (iout, '("after expp, error = ", i4)' ) ierr
143
144c write element connectivity
145
146 connect(1) = 1
147 connect(2) = 2
148 connect(3) = 3
149 connect(4) = 4
150
151 call expelc (exoid, ebids(1), connect, ierr)
152 write (iout, '("after expelc, error = ", i4)' ) ierr
153
154 connect(1) = 5
155 connect(2) = 6
156 connect(3) = 7
157 connect(4) = 8
158
159 call expelc (exoid, ebids(2), connect, ierr)
160 write (iout, '("after expelc, error = ", i4)' ) ierr
161
162c write element block attributes
163
164 attrib(1) = 3.14159
165 call expeat (exoid, ebids(1), attrib, ierr)
166 write (iout, '("after expeat, error = ", i4)' ) ierr
167
168 attrib(1) = 6.14159
169 call expeat (exoid, ebids(2), attrib, ierr)
170 write (iout, '("after expeat, error = ", i4)' ) ierr
171
172c write individual node sets
173
174 node_list(1) = 100
175 node_list(2) = 101
176 node_list(3) = 102
177 node_list(4) = 103
178 node_list(5) = 104
179
180 dist_fact(1) = 1.0
181 dist_fact(2) = 2.0
182 dist_fact(3) = 3.0
183 dist_fact(4) = 4.0
184 dist_fact(5) = 5.0
185
186c call expnp (exoid, 20, 5, 5, ierr)
187c write (iout, '("after expnp, error = ", i4)' ) ierr
188c call expns (exoid, 20, node_list, ierr)
189c write (iout, '("after expns, error = ", i4)' ) ierr
190c call expnsd (exoid, 20, dist_fact, ierr)
191c write (iout, '("after expnsd, error = ", i4)' ) ierr
192
193 node_list(1) = 200
194 node_list(2) = 201
195 node_list(3) = 202
196
197 dist_fact(1) = 1.1
198 dist_fact(2) = 2.1
199 dist_fact(3) = 3.1
200
201c call expnp (exoid, 21, 3, 3, ierr)
202c write (iout, '("after expnp, error = ", i4)' ) ierr
203c call expns (exoid, 21, node_list, ierr)
204c write (iout, '("after expns, error = ", i4)' ) ierr
205c call expnsd (exoid, 21, dist_fact, ierr)
206c write (iout, '("after expnsd, error = ", i4)' ) ierr
207
208c write concatenated node sets; this produces the same information as
209c the above code which writes individual node sets
210
211 ids(1) = 20
212 ids(2) = 21
213
214 num_nodes_per_set(1) = 5
215 num_nodes_per_set(2) = 3
216
217 num_df_per_set(1) = 5
218 num_df_per_set(2) = 3
219
220 node_ind(1) = 1
221 node_ind(2) = 6
222
223 df_ind(1) = 1
224 df_ind(2) = 6
225
226 node_list(1) = 100
227 node_list(2) = 101
228 node_list(3) = 102
229 node_list(4) = 103
230 node_list(5) = 104
231 node_list(6) = 200
232 node_list(7) = 201
233 node_list(8) = 202
234
235 dist_fact(1) = 1.0
236 dist_fact(2) = 2.0
237 dist_fact(3) = 3.0
238 dist_fact(4) = 4.0
239 dist_fact(5) = 5.0
240 dist_fact(6) = 1.1
241 dist_fact(7) = 2.1
242 dist_fact(8) = 3.1
243
244 call expcns (exoid, ids, num_nodes_per_set, num_df_per_set,
245 1 node_ind, df_ind, node_list, dist_fact, ierr)
246 write (iout, '("after expcns, error = ", i4)' ) ierr
247
248c write node set properties
249
250 prop_names(1) = "FACE"
251 call expp(exoid, exnset, 20, prop_names(1), 4, ierr)
252 write (iout, '("after expp, error = ", i4)' ) ierr
253
254 call expp(exoid, exnset, 21, prop_names(1), 5, ierr)
255 write (iout, '("after expp, error = ", i4)' ) ierr
256
257 prop_array(1) = 1000
258 prop_array(2) = 2000
259
260 prop_names(1) = "VELOCITY"
261 call exppa(exoid, exnset, prop_names(1), prop_array, ierr)
262 write (iout, '("after exppa, error = ", i4)' ) ierr
263
264c write individual side sets
265
266 elem_list(1) = 11
267 elem_list(2) = 12
268
269 side_list(1) = 1
270 side_list(2) = 2
271
272 dist_fact(1) = 30.0
273 dist_fact(2) = 30.1
274 dist_fact(3) = 30.2
275 dist_fact(4) = 30.3
276
277c call expsp (exoid, 30, 2, 4, ierr)
278c write (iout, '("after expsp, error = ", i4)' ) ierr
279
280c call expss (exoid, 30, elem_list, side_list, ierr)
281c write (iout, '("after expss, error = ", i4)' ) ierr
282
283c call expssd (exoid, 30, dist_fact, ierr)
284c write (iout, '("after expssd, error = ", i4)' ) ierr
285
286 elem_list(1) = 13
287 elem_list(2) = 14
288
289 side_list(1) = 3
290 side_list(2) = 4
291
292 dist_fact(1) = 31.0
293 dist_fact(2) = 31.1
294 dist_fact(3) = 31.2
295 dist_fact(4) = 31.3
296
297c call expsp (exoid, 31, 2, 4, ierr)
298c write (iout, '("after expsp, error = ", i4)' ) ierr
299
300c call expss (exoid, 31, elem_list, side_list, ierr)
301c write (iout, '("after expss, error = ", i4)' ) ierr
302
303c call expssd (exoid, 31, dist_fact, ierr)
304c write (iout, '("after expssd, error = ", i4)' ) ierr
305
306c write concatenated side sets; this produces the same information as
307c the above code which writes individual side sets
308
309 ids(1) = 30
310 ids(2) = 31
311
312 num_elem_per_set(1) = 2
313 num_elem_per_set(2) = 2
314
315 num_df_per_set(1) = 4
316 num_df_per_set(2) = 4
317
318 elem_ind(1) = 1
319 elem_ind(2) = 3
320
321 df_ind(1) = 1
322 df_ind(2) = 5
323
324 elem_list(1) = 11
325 elem_list(2) = 12
326 elem_list(3) = 13
327 elem_list(4) = 14
328
329 side_list(1) = 1
330 side_list(2) = 2
331 side_list(3) = 3
332 side_list(4) = 4
333
334 dist_fact(1) = 30.0
335 dist_fact(2) = 30.1
336 dist_fact(3) = 30.2
337 dist_fact(4) = 30.3
338 dist_fact(5) = 31.0
339 dist_fact(6) = 31.1
340 dist_fact(7) = 31.2
341 dist_fact(8) = 31.3
342
343 call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
344 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
345 2 ierr)
346 write (iout, '("after expcss, error = ", i4)' ) ierr
347
348 prop_names(1) = "COLOR"
349 call expp(exoid, exsset, 30, prop_names(1), 100, ierr)
350 write (iout, '("after expp, error = ", i4)' ) ierr
351
352 call expp(exoid, exsset, 31, prop_names(1), 101, ierr)
353 write (iout, '("after expp, error = ", i4)' ) ierr
354
355c write QA records
356
357 num_qa_rec = 2
358
359 qa_record(1,1) = "TESTWTD fortran version"
360 qa_record(2,1) = "testwtd"
361 qa_record(3,1) = "07/07/93"
362 qa_record(4,1) = "15:41:33"
363 qa_record(1,2) = "FASTQ"
364 qa_record(2,2) = "fastq"
365 qa_record(3,2) = "07/07/93"
366 qa_record(4,2) = "16:41:33"
367
368 call expqa (exoid, num_qa_rec, qa_record, ierr)
369 write (iout, '("after expqa, error = ", i4)' ) ierr
370
371c write information records
372
373 num_info = 3
374
375 inform(1) = "This is the first information record."
376 inform(2) = "This is the second information record."
377 inform(3) = "This is the third information record."
378
379 call expinf (exoid, num_info, inform, ierr)
380 write (iout, '("after expinf, error = ", i4)' ) ierr
381
382c write results variables parameters and names
383
384 num_glo_vars = 1
385
386 var_names(1) = "glo_vars"
387
388 call expvp (exoid, "g", num_glo_vars, ierr)
389 write (iout, '("after expvp, error = ", i4)' ) ierr
390 call expvan (exoid, "g", num_glo_vars, var_names, ierr)
391 write (iout, '("after expvan, error = ", i4)' ) ierr
392
393 num_nod_vars = 2
394
395 var_names(1) = "nod_var0"
396 var_names(2) = "nod_var1"
397
398 call expvp (exoid, "n", num_nod_vars, ierr)
399 write (iout, '("after expvp, error = ", i4)' ) ierr
400 call expvan (exoid, "n", num_nod_vars, var_names, ierr)
401 write (iout, '("after expvan, error = ", i4)' ) ierr
402
403 num_ele_vars = 3
404
405 var_names(1) = "ele_var0"
406 var_names(2) = "ele_var1"
407 var_names(3) = "ele_var2"
408
409 call expvp (exoid, "e", num_ele_vars, ierr)
410 write (iout, '("after expvp, error = ", i4)' ) ierr
411 call expvan (exoid, "e", num_ele_vars, var_names, ierr)
412 write (iout, '("after expvan, error = ", i4)' ) ierr
413
414c write element variable truth table
415
416 k = 0
417
418 do 30 i = 1,num_elem_blk
419 do 20 j = 1,num_ele_vars
420 truth_tab(j,i) = 1
42120 continue
42230 continue
423 call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
424 write (iout, '("after expvtt, error = ", i4)' ) ierr
425
426c for each time step, write the analysis results;
427c the code below fills the arrays hist_var_vals, glob_var_vals,
428c nodal_var_vals, and elem_var_vals with values for debugging purposes;
429c obviously the analysis code will populate these arrays
430
431 whole = .true.
432 hist_time_step = 1
433 whole_time_step = 1
434 num_time_steps = 10
435
436 do 110 i = 1, num_time_steps
437 time_value = dble(i)/100
438
439c write time value
440
441 call exptim (exoid, whole_time_step, time_value, ierr)
442 write (iout, '("after exptim, error = ", i4)' ) ierr
443
444c write global variables
445
446 do 50 j = 1, num_glo_vars
447 glob_var_vals(j) = real(j+1) * time_value
44850 continue
449
450 call expgv (exoid, whole_time_step, num_glo_vars,
451 1 glob_var_vals, ierr)
452 write (iout, '("after expgv, error = ", i4)' ) ierr
453
454c write nodal variables
455
456 do 70 k = 1, num_nod_vars
457 do 60 j = 1, num_nodes
458
459 nodal_var_vals(j) = real(k) + (real(j) * time_value)
460
46160 continue
462
463 call expnv (exoid, whole_time_step, k, num_nodes,
464 1 nodal_var_vals, ierr)
465 write (iout, '("after expnv, error = ", i4)' ) ierr
466
46770 continue
468
469c write element variables
470
471 do 100 k = 1, num_ele_vars
472 do 90 j = 1, num_elem_blk
473 do 80 m = 1, num_elem_in_block(j)
474
475 elem_var_vals(m) = real(k+1) + real(j+1) +
476 1 (real(m)*time_value)
477c write(iout,*)'elem_var_val(',m,'): ',elem_var_vals(m)
478
47980 continue
480
481 call expev (exoid, whole_time_step, k, ebids(j),
482 1 num_elem_in_block(j), elem_var_vals, ierr)
483 write (iout, '("after expev, error = ", i4)' ) ierr
484
48590 continue
486100 continue
487
488 whole_time_step = whole_time_step + 1
489
490c update the data file; this should be done at the end of every time
491c step to ensure that no data is lost if the analysis dies
492
493 call exupda (exoid, ierr)
494 write (iout, '("after exupda, error = ", i4)' ) ierr
495
496110 continue
497
498c close the EXODUS files
499
500 call exclos (exoid, ierr)
501 write (iout, '("after exclos, error = ", i4)' ) ierr
502
503 stop
504 end
#define real
Definition exo_jack-windows.c:59
void expgv(int *idexo, int *time_step, int *num_glob_vars, real *glob_var_vals, int *ierr)
Definition exo_jack.c:2184
int excre(char *path, int *clobmode, int *cpu_word_size, int *io_word_size, int *ierr, int pathlen)
Definition exo_jack.c:179
void expini(int *idexo, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets, int *ierr, int titlelen)
Definition exo_jack.c:242
void expcor(int *idexo, real *x_coor, real *y_coor, real *z_coor, int *ierr)
Definition exo_jack.c:558
void expnv(int *idexo, int *time_step, int *nodal_var_index, void_int *num_nodes, real *nodal_var_vals, int *ierr)
Definition exo_jack.c:2215
void expcss(int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, real *side_sets_dist_fact, int *ierr)
Definition exo_jack.c:1771
void expvan(int *idexo, char *var_type, int *num_vars, char *var_names, int *ierr, int var_typelen, int var_nameslen)
Definition exo_jack.c:1942
void expqa(int *idexo, int *num_qa_records, char *qa_record, int *ierr, int qa_recordlen)
Definition exo_jack.c:313
void expeat(int *idexo, entity_id *elem_blk_id, real *attrib, int *ierr)
Definition exo_jack.c:928
void exclos(int *idexo, int *ierr)
Definition exo_jack.c:230
void expev(int *idexo, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, real *elem_var_vals, int *ierr)
Definition exo_jack.c:2270
void expp(int *idexo, int *obj_type, entity_id *obj_id, char *prop_name, entity_id *value, int *ierr, int prop_namelen)
Definition exo_jack.c:1369
void expelb(int *idexo, entity_id *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *ierr, int elem_typelen)
Definition exo_jack.c:764
void expcns(int *idexo, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_dist_index, void_int *node_sets_node_list, real *node_sets_dist_fact, int *ierr)
Definition exo_jack.c:1579
void exppn(int *idexo, int *obj_type, int *num_props, char *prop_names, int *ierr, int prop_nameslen)
Definition exo_jack.c:1228
void expvtt(int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr)
Definition exo_jack.c:2062
void expmap(int *idexo, void_int *elem_map, int *ierr)
Definition exo_jack.c:695
void expelc(int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr)
Definition exo_jack.c:846
void expcon(int *idexo, char *coord_names, int *ierr, int coord_nameslen)
Definition exo_jack.c:576
void expinf(int *idexo, int *num_info, char *info, int *ierr, int infolen)
Definition exo_jack.c:449
void expvp(int *idexo, char *var_type, int *num_vars, int *ierr, int var_typelen)
Definition exo_jack.c:1920
void exppa(int *idexo, int *obj_type, char *prop_name, void_int *values, int *ierr, int prop_namelen)
Definition exo_jack.c:1471
void exupda(int *idexo, int *ierr)
Definition exo_jack.c:236
void exptim(int *idexo, int *time_step, real *time_value, int *ierr)
Definition exo_jack.c:2399