FE-Project
Loading...
Searching...
No Matches
scale_file_history_meshfield.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / File / History
3!!
4!! @par Description
5!! A module for managing file history
6!!
7!! @author Yuta Kawai, Team SCALE
8!<
9!-------------------------------------------------------------------------------
10#include "scaleFElib.h"
12 !-----------------------------------------------------------------------------
13 !
14 !++ Used modules
15 !
16 use scale_precision
17 use scale_io
18 use scale_prc, only: &
19 prc_abort
20
21 use scale_file_history, only: &
22 file_history_setup, &
23 file_history_set_nowdate, &
24 file_history_truncate_1d, &
25 file_history_truncate_2d, &
26 file_history_truncate_3d, &
27 file_history_put, &
28 file_history_write, &
29 file_history_set_dim, &
30 file_history_set_axis, &
31 file_history_query, &
32 file_history_finalize
33
45
46 use scale_meshfield_base, only: &
49
50 !-----------------------------------------------------------------------------
51 implicit none
52 private
53 !-----------------------------------------------------------------------------
54 !
55 !++ Public type and procedures
56 !
57
58 integer, parameter :: nzs = 1
59
60 type :: filehistorymeshfieldcomp
61 class(MeshBase1D), pointer :: mesh1D
62 class(MeshRectDom2D), pointer :: mesh2D
63 class(MeshCubeDom3D), pointer :: mesh3D
64 class(MeshCubedSphereDom2D), pointer :: meshCubedSphere2D
65 class(MeshCubedSphereDom3D), pointer :: meshCubedSphere3D
66
67 integer :: dims1D_size(1)
68 integer :: dims2D_size(2)
69 integer :: dims3D_size(3,nzs)
70
71 character(len=H_SHORT) :: dim_name_postfix
72 contains
73 procedure :: Init => filehistorymeshfieldcomp_init
74 procedure :: Final => filehistorymeshfieldcomp_final
75 procedure, private :: set_dim_axis1D
76 procedure, private :: set_dim_axis2D
77 procedure, private :: set_dim_axis3D
78 procedure, private :: set_dim_axis2D_cubedsphere
79 procedure, private :: set_dim_axis3D_cubedsphere
80 end type filehistorymeshfieldcomp
81
82 integer, parameter :: component_num_max = 32
83 type(filehistorymeshfieldcomp), target :: comp(component_num_max) !< Array of registered components
84
90
92 module procedure file_history_meshfield_put1d
93 module procedure file_history_meshfield_put2d
94 module procedure file_history_meshfield_put3d
95 end interface
96
98 module procedure file_history_meshfield_in1d
99 module procedure file_history_meshfield_in2d
100 module procedure file_history_meshfield_in3d
101 end interface
102
103 !-----------------------------------------------------------------------------
104 !
105 !++ Public parameters & variables
106 !
107 !-----------------------------------------------------------------------------
108 !
109 !++ Private procedures
110 !
111 private :: history_in_regvar
112
113 !-----------------------------------------------------------------------------
114 !
115 !++ Private variables
116 !
117 !----------------------------------------------------------------------------
118
119 integer :: comp_num = 0 !< Number of registered components
120 type(FileHistoryMeshFieldComp), pointer :: default_comp
121
122 character(len=8), parameter :: zs(nzs) = (/ "model " /)
123
124 integer :: FILE_HISTORY_MESHFIELD_STARTDATE(6) !< start time [YYYY MM DD HH MM SS]
125 real(DP) :: FILE_HISTORY_MESHFIELD_STARTSUBSEC !< subsecond part of start time [millisec]
126
127
128 logical, private :: FILE_HISTORY_FILEMESHFILED_DISABLE = .true.
129
130contains
131
132!----------------
133!OCL SERIAL
134 subroutine filehistorymeshfieldcomp_init( this, &
135 mesh1D_, mesh2D_, mesh3D_, &
136 meshcubedsphere2D_, meshcubedsphere3D_, &
137 dim_name_postfix )
138 implicit none
139 class(FileHistoryMeshFieldComp), intent(inout) :: this
140
141 class(MeshBase1d), intent(in), target, optional :: mesh1D_ !< An object of 1D mesh when the computational domain is 1D
142 class(MeshRectDom2d), intent(in), target, optional :: mesh2D_ !< An object of 2D mesh when the computational domain is rectangular
143 class(MeshCubeDom3D), intent(in), target, optional :: mesh3D_ !< An object of 3D mesh when the computational domain is cubed
144 class(MeshCubedSphereDom2D), intent(in), target, optional :: meshCubedsphere2D_ !< An object of 2D mesh when the computational domain is 2D cubed-sphere
145 class(MeshCubedSphereDom3D), intent(in), target, optional :: meshCubedsphere3D_ !< An object of 3D mesh when the computational domain is 3D cubed-sphere
146 character(len=*), intent(in), optional :: dim_name_postfix !< Postfix for dimension names
147 !-----------------------------------------------
148
149 if ( present(dim_name_postfix) ) then
150 this%dim_name_postfix = dim_name_postfix
151 else
152 this%dim_name_postfix = ''
153 end if
154
155 !- Set a pointer to the variable of mesh
156 ! and set the dimension information for each axis
157
158 nullify( this%mesh1D, this%mesh2D, this%mesh3D )
159 nullify( this%meshCubedSphere2D, this%meshCubedsphere3D )
160
161 if ( present(mesh1d_) ) then
162 this%mesh1D => mesh1d_
163 call this%set_dim_axis1D()
164 else if ( present(mesh2d_) ) then
165 this%mesh2D => mesh2d_
166 call this%set_dim_axis2D()
167 else if ( present(mesh3d_) ) then
168 this%mesh3D => mesh3d_
169 this%mesh2D => mesh3d_%mesh2D
170 call this%set_dim_axis3D()
171 else if ( present(meshcubedsphere2d_) ) then
172 this%meshCubedSphere2D => meshcubedsphere2d_
173 call this%set_dim_axis2D_cubedsphere()
174 else if ( present(meshcubedsphere3d_) ) then
175 this%meshCubedSphere3D => meshcubedsphere3d_
176 this%meshCubedSphere2D => meshcubedsphere3d_%mesh2D
177 call this%set_dim_axis3D_cubedsphere()
178 else
179 log_error("FileHistoryMeshFieldComp_Init",*) "Any mesh (mesh1d/2d/3d) are not specified."
180 call prc_abort
181 end if
182
183 return
184 end subroutine filehistorymeshfieldcomp_init
185
186!OCL SERIAL
187 subroutine filehistorymeshfieldcomp_final( this )
188 implicit none
189 class(FileHistoryMeshFieldComp), intent(inout) :: this
190 !-----------------------------------------------
191 return
192 end subroutine filehistorymeshfieldcomp_final
193
194 !> Setup a module for file history
195!OCL SERIAL
197 mesh1D_, mesh2D_, mesh3D_, &
198 meshcubedsphere2D_, meshcubedsphere3D_, &
199 dim_name_postfix_, &
200 registered_comp_id )
201
202 use scale_file_h, only: &
203 file_hshort
204 use scale_prc, only: &
205 prc_masterrank, &
206 prc_myrank, &
207 prc_abort
208 use scale_time, only: &
209 time_nowdate, &
210 time_nowsubsec, &
211 time_startdaysec, &
212 time_dtsec, &
213 time_nowstep
214 use scale_calendar, only: &
215 calendar_get_name
216 implicit none
217
218 class(meshbase1d), intent(in), target, optional :: mesh1d_ !< An object of 1D mesh when the computational domain is 1D
219 class(meshrectdom2d) , intent(in), target, optional :: mesh2d_ !< An object of 2D mesh when the computational domain is rectangular
220 class(meshcubedom3d) , intent(in), target, optional :: mesh3d_ !< An object of 3D mesh when the computational domain is cubed
221 class(meshcubedspheredom2d), intent(in), target, optional :: meshcubedsphere2d_ !< An object of 2D mesh when the computational domain is 2D cubed-sphere
222 class(meshcubedspheredom3d), intent(in), target, optional :: meshcubedsphere3d_ !< An object of 3D mesh when the computational domain is 3D cubed-sphere
223 character(len=*), intent(in), optional :: dim_name_postfix_ !< Postfix for dimension names
224 integer, intent(out), optional :: registered_comp_id
225
226 character(len=H_MID) :: file_history_meshfiled_h_title = 'SCALE-DG FILE_HISTORY_MESHFIELD' !< title of the output file
227 character(len=H_MID) :: file_history_meshfield_t_since
228
229 character(len=FILE_HSHORT) :: calendar
230 real(dp) :: start_daysec
231
232 type(filehistorymeshfieldcomp), pointer :: target_comp
233 integer :: registered_comp_id_
234 !---------------------------------------------------------------------------
235
236 !-
237 if ( comp_num >= component_num_max ) then
238 log_error("FILE_base_meshfield_register_comp",*) 'Exceeding maximum number of components. Check!'
239 call prc_abort
240 end if
241
242 comp_num = comp_num + 1
243 registered_comp_id_ = comp_num
244 if ( present(registered_comp_id) ) then
245 registered_comp_id = registered_comp_id_
246 end if
247
248 target_comp => comp(registered_comp_id_)
249 call target_comp%Init( mesh1d_, mesh2d_, mesh3d_, &
250 meshcubedsphere2d_, meshcubedsphere3d_ , &
251 dim_name_postfix_ )
252
253 !-
254 if ( registered_comp_id_ == 1 ) then
255 default_comp => comp(registered_comp_id_)
256
257 file_history_meshfield_startdate(:) = time_nowdate
258 file_history_meshfield_startsubsec = time_nowsubsec
259
260 start_daysec = time_startdaysec
261 if ( time_nowdate(1) > 0 ) then
262 write(file_history_meshfield_t_since,'(I4.4,5(A1,I2.2))') time_nowdate(1), &
263 '-', time_nowdate(2), &
264 '-', time_nowdate(3), &
265 ' ', time_nowdate(4), &
266 ':', time_nowdate(5), &
267 ':', time_nowdate(6)
268 start_daysec = time_nowsubsec
269 else
270 file_history_meshfield_t_since = ''
271 endif
272
273 ! get calendar name
274 call calendar_get_name( calendar )
275
276 call file_history_setup( file_history_meshfiled_h_title, & ! [IN]
277 h_source, h_institute, & ! [IN]
278 start_daysec, time_dtsec, & ! [IN]
279 time_since = file_history_meshfield_t_since, & ! [IN]
280 calendar = calendar, & ! [IN]
281 default_zcoord = 'model', & ! [IN]
282 myrank = prc_myrank ) ! [IN]
283
284 call file_history_set_nowdate( time_nowdate, time_nowsubsec, time_nowstep )
285
286 file_history_filemeshfiled_disable = .false.
287 end if
288
289 return
290 end subroutine file_history_meshfield_setup
291
292 !> Write history data to the file
293!OCL SERIAL
295 implicit none
296 !-------------------------------------------------
297
298 call file_history_write
299 return
300 end subroutine file_history_meshfield_write
301
302 !> Finalize the file history module
303!OCL SERIAL
305 implicit none
306 !-------------------------------------------------
307
308 call file_history_finalize()
309 call default_comp%Final()
310 return
312
313 !-- 1D
314
315!OCL SERIAL
316 subroutine file_history_meshfield_put1d(hstid, field1d, &
317 registered_comp_id )
318 use scale_file_common_meshfield, only: &
320 implicit none
321 integer, intent(in) :: hstid
322 class(meshfield1d), intent(in) :: field1d
323 integer, intent(in), optional :: registered_comp_id
324
325 logical :: do_put
326 integer :: ldomID
327 real(RP), allocatable :: buf(:)
328
329 type(filehistorymeshfieldcomp), pointer :: target_comp
330 !---------------------------------------------------------------------------
331
332 call history_get_comp( registered_comp_id, & ! (in)
333 target_comp ) ! (out)
334
335 call file_history_query( hstid, do_put )
336 if ( .not. do_put ) return
337
338 !-
339#ifdef _OPENACC
340 do ldomid=1, field1d%mesh%LOCAL_MESH_NUM
341 !$acc update host( field1d%local(ldomID)%val ) async(1)
342 end do
343 !$acc wait(1)
344#endif
345 !-
346 allocate( buf(target_comp%dims1D_size(1)) )
347
348 call file_common_meshfield_put_field1d_cartesbuf( target_comp%mesh1D, field1d, buf )
349 call file_history_put( hstid, buf )
350
351 return
352 end subroutine file_history_meshfield_put1d
353
354!OCL SERIAL
355 subroutine file_history_meshfield_in1d( field1d, desc, standard_name, &
356 registered_comp_id )
357 implicit none
358 class(meshfield1d), intent(in) :: field1d
359 character(len=*), intent(in) :: desc !< description of the item
360 character(len=*), intent(in), optional :: standard_name
361 integer, intent(in), optional :: registered_comp_id
362
363 integer :: hstid
364 logical :: do_put
365 !-------------------------------------------------
366
367 call history_in_regvar( hstid, do_put, & ! (out)
368 field1d, desc, 1, standard_name, 'XYZ' ) ! (in)
369
370 if ( do_put ) call file_history_meshfield_put( hstid, field1d, registered_comp_id )
371
372 return
373 end subroutine file_history_meshfield_in1d
374
375 !-- 2D
376
377!OCL SERIAL
378 subroutine file_history_meshfield_put2d(hstid, field2d, &
379 registered_comp_id )
380 use scale_file_common_meshfield, only: &
383
384 implicit none
385 integer, intent(in) :: hstid
386 class(meshfield2d), intent(in) :: field2d
387 integer, intent(in), optional :: registered_comp_id
388
389 logical :: do_put
390 integer :: ldomID
391 real(RP), allocatable :: buf(:,:)
392
393 type(filehistorymeshfieldcomp), pointer :: target_comp
394 !---------------------------------------------------------------------------
395
396 call history_get_comp( registered_comp_id, & ! (in)
397 target_comp ) ! (out)
398
399 call file_history_query( hstid, do_put )
400 if ( .not. do_put ) return
401
402 !-
403#ifdef _OPENACC
404 do ldomid=1, field2d%mesh%LOCAL_MESH_NUM
405 !$acc update host( field2d%local(ldomID)%val ) async(1)
406 end do
407 !$acc wait(1)
408#endif
409 allocate( buf(target_comp%dims2D_size(1),target_comp%dims2D_size(2)) )
410
411 if ( associated(target_comp%mesh2D) ) then
412 call file_common_meshfield_put_field2d_cartesbuf( target_comp%mesh2D, field2d, buf )
413 else if ( associated(target_comp%meshCubedSphere2D) ) then
415 target_comp%meshCubedSphere2D, field2d, buf )
416 end if
417 call file_history_put( hstid, buf )
418
419 return
420 end subroutine file_history_meshfield_put2d
421
422!OCL SERIAL
423 subroutine file_history_meshfield_in2d( field2d, desc, standard_name, &
424 registered_comp_id )
425 implicit none
426 class(meshfield2d), intent(in) :: field2d
427 character(len=*), intent(in) :: desc !< description of the item
428 character(len=*), intent(in), optional :: standard_name
429 integer, intent(in), optional :: registered_comp_id
430
431 integer :: hstid
432 logical :: do_put
433 !-------------------------------------------------
434
435 call history_in_regvar( hstid, do_put, & ! (out)
436 field2d, desc, 2, standard_name, 'XY' ) ! (in)
437
438 if ( do_put ) call file_history_meshfield_put( hstid, field2d, registered_comp_id )
439
440 return
441 end subroutine file_history_meshfield_in2d
442
443 !-- 3D
444
445!OCL SERIAL
446 subroutine file_history_meshfield_put3d(hstid, field3d, &
447 registered_comp_id )
448 use scale_file_common_meshfield, only: &
451
452 implicit none
453 integer, intent(in) :: hstid
454 class(meshfield3d), intent(in) :: field3d
455 integer, intent(in), optional :: registered_comp_id
456
457 logical :: do_put
458 integer :: ldomID
459 real(RP), allocatable :: buf(:,:,:)
460
461 type(filehistorymeshfieldcomp), pointer :: target_comp
462 !---------------------------------------------------------------------------
463
464 call history_get_comp( registered_comp_id, & ! (in)
465 target_comp ) ! (out)
466
467 call file_history_query( hstid, do_put )
468 if ( .not. do_put ) return
469
470 !-
471#ifdef _OPENACC
472 do ldomid=1, field3d%mesh%LOCAL_MESH_NUM
473 !$acc update host( field3d%local(ldomID)%val ) async(1)
474 end do
475 !$acc wait(1)
476#endif
477
478 allocate( buf(target_comp%dims3D_size(1,1),target_comp%dims3D_size(2,1),target_comp%dims3D_size(3,1)) )
479
480 if ( associated(target_comp%mesh3D) ) then
481 call file_common_meshfield_put_field3d_cartesbuf( target_comp%mesh3D, field3d, buf )
482 else if ( associated(target_comp%meshCubedSphere3D) ) then
484 target_comp%meshCubedSphere3D, field3d, buf )
485 end if
486 call file_history_put( hstid, buf )
487
488 return
489 end subroutine file_history_meshfield_put3d
490
491!OCL SERIAL
492 subroutine file_history_meshfield_in3d( field3d, desc, standard_name, &
493 registered_comp_id )
494 implicit none
495 class(meshfield3d), intent(in) :: field3d
496 character(len=*), intent(in) :: desc !< description of the item
497 character(len=*), intent(in), optional :: standard_name
498 integer, intent(in), optional :: registered_comp_id
499
500 integer :: hstid
501 logical :: do_put
502 !-------------------------------------------------
503
504 call history_in_regvar( hstid, do_put, & ! (out)
505 field3d, desc, 3, standard_name, 'XYZ' ) ! (in)
506
507 if ( do_put ) call file_history_meshfield_put( hstid, field3d, registered_comp_id )
508
509 return
510 end subroutine file_history_meshfield_in3d
511
512!- Private subroutines ---------------
513
514!OCL SERIAL
515 subroutine history_in_regvar( hstid, do_put, &
516 field, desc, ndim, standard_name, dim_type )
517
518 use scale_file_history, only: &
519 file_history_reg
520
521 implicit none
522
523 integer, intent(out) :: hstid
524 logical, intent(out) :: do_put
525 class(meshfieldbase), intent(in) :: field
526 character(len=*), intent(in) :: desc !< description of the item
527 integer, intent(in) :: ndim
528 character(len=*), intent(in), optional :: standard_name
529 character(len=*), intent(in), optional :: dim_type
530
531 logical, parameter :: fill_halo = .false.
532 !------------------------------------------------------
533
534 hstid = -1
535 do_put = .false.
536
537 if ( file_history_filemeshfiled_disable ) return
538
539 ! Check whether the item has been already registered
540 call file_history_reg( field%varname, desc, field%unit, & ! [IN]
541 hstid, & ! [OUT]
542 standard_name=standard_name, & ! [IN]
543 ndims=ndim, & ! [IN]
544 dim_type=dim_type, & ! [IN]
545 fill_halo=fill_halo ) ! [IN]
546
547 if ( hstid < 0 ) return
548
549 ! Check whether it is time to input the item
550 call file_history_query( hstid, do_put ) ! [IN], [OUT]
551
552 return
553 end subroutine history_in_regvar
554
555!OCL SERIAL
556 subroutine history_get_comp( comp_id, & ! (in)
557 comp_ptr ) ! (out)
558 implicit none
559 integer, intent(in), optional :: comp_id
560 type(filehistorymeshfieldcomp), intent(out), pointer :: comp_ptr
561 !--------------------------------------------------------------
562
563 if ( .not. present(comp_id) ) then
564 comp_ptr => default_comp
565 return
566 end if
567
568 if ( comp_id < 1 .or. comp_id > comp_num ) then
569 log_error("FILE_history_get_comp",*) 'Invalid component ID. Check!'
570 call prc_abort
571 end if
572 comp_ptr => comp(comp_id)
573 return
574 end subroutine history_get_comp
575
576!OCL SERIAL
577 subroutine set_dim_axis1d( comp )
578 use scale_file_common_meshfield, only: &
582 use scale_mesh_base1d, only: &
583 dimtype_num => meshbase1d_dimtype_num, &
584 dimtype_x => meshbase1d_dimtypeid_x
585
586 implicit none
587 class(filehistorymeshfieldcomp), intent(inout) :: comp
588
589 type(file_common_meshfield_diminfo) :: dimsinfo(DIMTYPE_NUM)
590 real(RP), allocatable :: x(:)
591 integer :: start(1,1), count(1,1)
592 character(len=H_SHORT) :: dims(1,1)
593 integer :: n, ndim
594 !-------------------------------------------------
595
596 call file_common_meshfield_get_dims1d( comp%mesh1D, comp%dim_name_postfix, & ! (in)
597 dimsinfo ) ! (out)
598
599 comp%dims1D_size(1) = dimsinfo(dimtype_x)%size
600 allocate( x(comp%dims1D_size(1)) )
601 call file_common_meshfield_get_axis1d( comp%mesh1D, dimsinfo, & ! (in)
602 x ) ! (out)
603
604 start(:,:) = 1
605 do n=1, dimtype_num
606 ndim = dimsinfo(n)%ndim
607 dims(1:ndim,1) = dimsinfo(n)%dims(1:ndim)
608 count(1:ndim,1) = dimsinfo(n)%count(1:ndim)
609 call file_history_set_dim ( dimsinfo(n)%type, ndim, 1, dims(1:ndim,:), zs(:), start(1:ndim,:), count(1:ndim,:))
610 end do
611
612 call file_history_set_axis( dimsinfo(dimtype_x)%name, dimsinfo(dimtype_x)%desc, &
613 dimsinfo(dimtype_x)%unit, dimsinfo(dimtype_x)%name, x )
614
615 return
616 end subroutine set_dim_axis1d
617
618!OCL SERIAL
619 subroutine set_dim_axis2d( comp )
620 use scale_file_common_meshfield, only: &
624 use scale_mesh_base2d, only: &
625 dimtype_num => meshbase2d_dimtype_num, &
626 dimtype_x => meshbase2d_dimtypeid_x, &
627 dimtype_y => meshbase2d_dimtypeid_y
628
629 implicit none
630 class(filehistorymeshfieldcomp), intent(inout) :: comp
631
632 type(file_common_meshfield_diminfo) :: dimsinfo(DIMTYPE_NUM)
633 real(RP), allocatable :: x(:), y(:)
634 integer :: start(2,1), count(2,1)
635 character(len=H_SHORT) :: dims(2,1)
636 integer :: n, ndim
637 !-------------------------------------------------
638
639 call file_common_meshfield_get_dims2d( comp%mesh2D, comp%dim_name_postfix, & ! (in)
640 dimsinfo ) ! (out)
641
642 comp%dims2D_size(1) = dimsinfo(dimtype_x)%size
643 comp%dims2D_size(2) = dimsinfo(dimtype_y)%size
644 allocate( x(comp%dims2D_size(1)), y(comp%dims2D_size(2)) )
645 call file_common_meshfield_get_axis2d( comp%mesh2D, dimsinfo, & ! (in)
646 x, y ) ! (out)
647
648 start(:,:) = 1
649
650 do n=1, dimtype_num
651 ndim = dimsinfo(n)%ndim
652 dims(1:ndim,1) = dimsinfo(n)%dims(1:ndim)
653 count(1:ndim,1) = dimsinfo(n)%count(1:ndim)
654 call file_history_set_dim ( dimsinfo(n)%type, ndim, 1, dims(1:ndim,:), zs(:), start(1:ndim,:), count(1:ndim,:))
655 end do
656
657 call file_history_set_axis( dimsinfo(dimtype_x)%name, dimsinfo(dimtype_x)%desc, dimsinfo(dimtype_x)%unit, dimsinfo(dimtype_x)%name, x(:))
658 call file_history_set_axis( dimsinfo(dimtype_y)%name, dimsinfo(dimtype_y)%desc, dimsinfo(dimtype_y)%unit, dimsinfo(dimtype_y)%name, y(:))
659
660 return
661 end subroutine set_dim_axis2d
662
663!OCL SERIAL
664 subroutine set_dim_axis3d( comp )
665 use scale_file_common_meshfield, only: &
669 use scale_mesh_base3d, only: &
670 dimtype_num => meshbase3d_dimtype_num, &
671 dimtype_x => meshbase3d_dimtypeid_x, &
672 dimtype_y => meshbase3d_dimtypeid_y, &
673 dimtype_z => meshbase3d_dimtypeid_z
674
675 implicit none
676 class(filehistorymeshfieldcomp), intent(inout) :: comp
677
678 type(file_common_meshfield_diminfo) :: dimsinfo(DIMTYPE_NUM)
679 real(RP), allocatable :: x(:), y(:), z(:)
680 integer :: start(3,1), count(3,1)
681 character(len=H_SHORT) :: dims(3,1)
682 integer :: n, ndim
683 !-------------------------------------------------
684
685 call file_common_meshfield_get_dims3d( comp%mesh3D, comp%dim_name_postfix, & ! (in)
686 dimsinfo ) ! (out)
687
688 comp%dims2D_size(1) = dimsinfo(dimtype_x)%size
689 comp%dims2D_size(2) = dimsinfo(dimtype_y)%size
690 comp%dims3D_size(1,1) = dimsinfo(dimtype_x)%size
691 comp%dims3D_size(2,1) = dimsinfo(dimtype_y)%size
692 comp%dims3D_size(3,1) = dimsinfo(dimtype_z)%size
693 allocate( x(comp%dims3D_size(1,1)), y(comp%dims3D_size(2,1)), z(comp%dims3D_size(3,1)) )
694 call file_common_meshfield_get_axis3d( comp%mesh3D, dimsinfo, & ! (in)
695 x, y, z ) ! (out)
696
697 start(:,:) = 1
698 do n=1, dimtype_num
699 ndim = dimsinfo(n)%ndim
700 dims(1:ndim,1) = dimsinfo(n)%dims(1:ndim)
701 count(1:ndim,1) = dimsinfo(n)%count(1:ndim)
702 call file_history_set_dim ( dimsinfo(n)%type, ndim, 1, dims(1:ndim,:), zs(:), start(1:ndim,:), count(1:ndim,:))
703 end do
704
705 call file_history_set_axis( dimsinfo(dimtype_x)%name, dimsinfo(dimtype_x)%desc, dimsinfo(dimtype_x)%unit, dimsinfo(dimtype_x)%name, x(:) )
706 call file_history_set_axis( dimsinfo(dimtype_y)%name, dimsinfo(dimtype_y)%desc, dimsinfo(dimtype_y)%unit, dimsinfo(dimtype_y)%name, y(:) )
707 call file_history_set_axis( dimsinfo(dimtype_z)%name, dimsinfo(dimtype_z)%desc, dimsinfo(dimtype_z)%unit, dimsinfo(dimtype_z)%name, z(:), &
708 down=dimsinfo(dimtype_z)%positive_down(1) )
709
710 return
711 end subroutine set_dim_axis3d
712
713!OCL SERIAL
714 subroutine set_dim_axis2d_cubedsphere( comp )
715 use scale_file_common_meshfield, only: &
719 use scale_mesh_base2d, only: &
720 dimtype_num => meshbase2d_dimtype_num, &
721 dimtype_x => meshbase2d_dimtypeid_x, &
722 dimtype_y => meshbase2d_dimtypeid_y
723
724 implicit none
725 class(filehistorymeshfieldcomp), intent(inout) :: comp
726
727 type(file_common_meshfield_diminfo) :: dimsinfo(DIMTYPE_NUM)
728 real(RP), allocatable :: x(:), y(:)
729 integer :: start(2,1), count(2,1)
730 character(len=H_SHORT) :: dims(2,1)
731 integer :: n, ndim
732 !-------------------------------------------------
733
734 call file_common_meshfield_get_dims( comp%meshCubedSphere2D, comp%dim_name_postfix, & ! (in)
735 dimsinfo ) ! (out)
736
737 comp%dims2D_size(1) = dimsinfo(dimtype_x)%size
738 comp%dims2D_size(2) = dimsinfo(dimtype_y)%size
739 allocate( x(comp%dims2D_size(1)), y(comp%dims2D_size(2)) )
740
741 call file_common_meshfield_get_axis( comp%meshCubedSphere2D, dimsinfo, & ! (in)
742 x, y ) ! (out)
743
744 start(:,:) = 1
745
746 do n=1, dimtype_num
747 ndim = dimsinfo(n)%ndim
748 dims(1:ndim,1) = dimsinfo(n)%dims(1:ndim)
749 count(1:ndim,1) = dimsinfo(n)%count(1:ndim)
750 call file_history_set_dim ( dimsinfo(n)%type, ndim, 1, dims(1:ndim,:), zs(:), start(1:ndim,:), count(1:ndim,:))
751 end do
752
753 call file_history_set_axis( dimsinfo(dimtype_x)%name, dimsinfo(dimtype_x)%desc, dimsinfo(dimtype_x)%unit, dimsinfo(dimtype_x)%name, x )
754 call file_history_set_axis( dimsinfo(dimtype_y)%name, dimsinfo(dimtype_y)%desc, dimsinfo(dimtype_y)%unit, dimsinfo(dimtype_y)%name, y )
755
756 return
757 end subroutine set_dim_axis2d_cubedsphere
758
759!OCL SERIAL
760 subroutine set_dim_axis3d_cubedsphere( comp )
761 use scale_file_common_meshfield, only: &
765 use scale_mesh_base3d, only: &
766 dimtype_num => meshbase3d_dimtype_num, &
767 dimtype_x => meshbase3d_dimtypeid_x, &
768 dimtype_y => meshbase3d_dimtypeid_y, &
769 dimtype_z => meshbase3d_dimtypeid_z
770
771 implicit none
772 class(filehistorymeshfieldcomp), intent(inout) :: comp
773
774 type(file_common_meshfield_diminfo) :: dimsinfo(DIMTYPE_NUM)
775 real(RP), allocatable :: x(:), y(:), z(:)
776 integer :: start(3,1), count(3,1)
777 character(len=H_SHORT) :: dims(3,1)
778 integer :: n, ndim
779 !-------------------------------------------------
780
781 call file_common_meshfield_get_dims( comp%meshCubedSphere3D, comp%dim_name_postfix, & ! (in)
782 dimsinfo ) ! (out)
783
784 comp%dims2D_size(1) = dimsinfo(dimtype_x)%size
785 comp%dims2D_size(2) = dimsinfo(dimtype_y)%size
786 comp%dims3D_size(1,1) = dimsinfo(dimtype_x)%size
787 comp%dims3D_size(2,1) = dimsinfo(dimtype_y)%size
788 comp%dims3D_size(3,1) = dimsinfo(dimtype_z)%size
789 allocate( x(comp%dims3D_size(1,1)), y(comp%dims3D_size(2,1)), z(comp%dims3D_size(3,1)) )
790 call file_common_meshfield_get_axis( comp%meshCubedSphere3D, dimsinfo, & ! (in)
791 x, y, z ) ! (out)
792
793 start(:,:) = 1
794 do n=1, dimtype_num
795 ndim = dimsinfo(n)%ndim
796 dims(1:ndim,1) = dimsinfo(n)%dims(1:ndim)
797 count(1:ndim,1) = dimsinfo(n)%count(1:ndim)
798 call file_history_set_dim ( dimsinfo(n)%type, ndim, 1, dims(1:ndim,:), zs(:), start(1:ndim,:), count(1:ndim,:))
799 end do
800
801 call file_history_set_axis( dimsinfo(dimtype_x)%name, dimsinfo(dimtype_x)%desc, dimsinfo(dimtype_x)%unit, dimsinfo(dimtype_x)%name, x )
802 call file_history_set_axis( dimsinfo(dimtype_y)%name, dimsinfo(dimtype_y)%desc, dimsinfo(dimtype_y)%unit, dimsinfo(dimtype_y)%name, y )
803 call file_history_set_axis( dimsinfo(dimtype_z)%name, dimsinfo(dimtype_z)%desc, dimsinfo(dimtype_z)%unit, dimsinfo(dimtype_z)%name, z, &
804 down=dimsinfo(dimtype_z)%positive_down(1) )
805
806 return
807 end subroutine set_dim_axis3d_cubedsphere
808
809!----------------
810
module FElib / Element / Base
subroutine, public file_common_meshfield_get_axis1d(mesh1d, dimsinfo, x, force_uniform_grid)
subroutine, public file_common_meshfield_get_axis3d(mesh3d, dimsinfo, x, y, z, force_uniform_grid)
subroutine, public file_common_meshfield_get_dims1d(mesh1d, dim_name_postfix, dimsinfo)
subroutine, public file_common_meshfield_put_field3d_cubedsphere_cartesbuf(mesh3d, field3d, buf)
subroutine, public file_common_meshfield_put_field2d_cubedsphere_cartesbuf(mesh2d, field2d, buf)
subroutine, public file_common_meshfield_put_field2d_cartesbuf(mesh2d, field2d, buf, force_uniform_grid)
subroutine, public file_common_meshfield_put_field1d_cartesbuf(mesh1d, field1d, buf, force_uniform_grid)
subroutine, public file_common_meshfield_get_dims2d(mesh2d, dim_name_postfix, dimsinfo)
subroutine, public file_common_meshfield_get_dims3d(mesh3d, dim_name_postfix, dimsinfo)
subroutine, public file_common_meshfield_get_axis2d(mesh2d, dimsinfo, x, y, force_uniform_grid)
subroutine, public file_common_meshfield_put_field3d_cartesbuf(mesh3d, field3d, buf, force_uniform_grid)
subroutine, public file_history_meshfield_setup(mesh1d_, mesh2d_, mesh3d_, meshcubedsphere2d_, meshcubedsphere3d_, dim_name_postfix_, registered_comp_id)
Setup a module for file history.
subroutine, public file_history_meshfield_write()
Write history data to the file.
subroutine, public file_history_meshfield_finalize()
Finalize the file history module.
module FElib / Mesh / Local 1D
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 1D
integer, public meshbase1d_dimtype_num
integer, public meshbase1d_dimtypeid_x
module FElib / Mesh / Base 2D
integer, public meshbase2d_dimtypeid_x
integer, public meshbase2d_dimtype_num
integer, public meshbase2d_dimtypeid_y
module FElib / Mesh / Base 3D
integer, public meshbase3d_dimtypeid_y
integer, public meshbase3d_dimtypeid_z
integer, public meshbase3d_dimtype_num
integer, public meshbase3d_dimtypeid_x
module FElib / Mesh / Cubic 3D domain
module FElib / Mesh / Cubed-sphere 2D domain
module FElib / Mesh / Cubed-sphere 3D domain
module FElib / Mesh / Rectangle 2D domain
module FElib / Data / base
Derived type representing a 1D reference element.
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type representing a local mesh for 1D domain.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type to manage a computational mesh (base type for 1D domain)
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a computational mesh (base type for 3D domain)
Derived type to manage a cubic 3D computational domain.
Derived type to manage a cubed-sphere 2D computational domain.
Derived type to manage a cubed-sphere 3D computational domain.
Derived type to manage a rectangular 2D computational domain.
Derived type representing a field with 1D mesh.
Derived type representing a field with 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)