FE-Project
Loading...
Searching...
No Matches
scale_file_base_meshfield.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / File / Base
3!!
4!! @par Description
5!! A base module for outputting data with MeshField type
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_file_h
19 use scale_prc, only: &
20 prc_abort
21 use scale_file_h, only: &
22 file_file_max
23
27 use scale_mesh_base1d, only: &
28 mf1d_dimtype_x => meshbase1d_dimtypeid_x, &
29 mf1d_dtype_num => meshbase1d_dimtype_num
30 use scale_mesh_base2d, only: &
31 mf2d_dimtype_x => meshbase2d_dimtypeid_x, &
32 mf2d_dimtype_y => meshbase2d_dimtypeid_y, &
33 mf2d_dtype_num => meshbase2d_dimtype_num
34 use scale_mesh_base3d, only: &
35 mf3d_dimtype_x => meshbase3d_dimtypeid_x, &
36 mf3d_dimtype_y => meshbase3d_dimtypeid_y, &
37 mf3d_dimtype_z => meshbase3d_dimtypeid_z, &
38 mf3d_dtype_num => meshbase3d_dimtype_num
39
51
54
55 !-----------------------------------------------------------------------------
56 implicit none
57 private
58 !-----------------------------------------------------------------------------
59 !
60 !++ Public type & procedures
61 !
62
63 !> Derived type to manage file output with MeshField data for each component
64 type :: filebasemeshfieldcomp
65 character(len=H_SHORT) :: comp_name !< Name of the component
66 integer, allocatable :: vars_ncid(:) !< Array to save variable IDs provided by NetCDF library
67 character(len=H_SHORT) :: dim_name_postfix !< Postfix of dimension name for each component
68
69 integer :: write_buf_amount
70
71 integer :: mesh_type_id !< Mesh type ID
72 class(MeshBase1D), pointer :: mesh1D !< Pointer to 1D mesh object
73 class(MeshRectDom2D), pointer :: mesh2D !< Pointer to 2D rectangular mesh object
74 class(MeshCubedSphereDom2D), pointer :: meshCS2D !< Pointer to 2D cubed-sphere mesh object
75 class(MeshCubeDom3D), pointer :: mesh3D !< Pointer to 3D cube mesh object
76 class(MeshCubedSphereDom3D), pointer :: meshCS3D !< Pointer to 3D cubed-sphere mesh object
77 type(FILE_common_meshfield_diminfo), allocatable :: dimsinfo(:)
78
79 logical :: force_uniform_grid
80 end type filebasemeshfieldcomp
81
82
83 integer, parameter :: component_num_max = 32 !< Maximum number of components to be registered
84
85 !> Derived type to manage file output with MeshField data
86 type, public :: file_base_meshfield
87 integer :: fid
88
89 integer :: comp_num !< Number of registered components
90 type(filebasemeshfieldcomp) :: comp(component_num_max) !< Array of registered components
91
92 integer :: main_comp_id !< Registered component ID of main component
93
94 logical :: file_axes_written !< Flag to check whether axes are written or not
95 contains
96 procedure :: init => file_base_meshfield_init
97 procedure :: register_comp => file_base_meshfield_register_comp
98 procedure :: open => file_base_meshfield_open
99 procedure :: create => file_base_meshfield_create
100
101 !-
102 procedure :: file_base_meshfield_def_var1
103 procedure :: file_base_meshfield_def_var2
104 generic :: def_var => file_base_meshfield_def_var1, file_base_meshfield_def_var2
105 procedure :: end_def => file_base_meshfield_enddef
106 !-
107 procedure :: file_base_meshfield_write_var1d
108 generic :: write_var1d => file_base_meshfield_write_var1d
109 procedure :: file_base_meshfield_write_var2d
110 generic :: write_var2d => file_base_meshfield_write_var2d
111 procedure :: file_base_meshfield_write_var3d
112 generic :: write_var3d => file_base_meshfield_write_var3d
113 !-
114 procedure :: put_globalattribute_time => file_base_meshfield_put_global_attribute_time
115 !-
116 procedure :: file_base_meshfield_read_var1d
117 procedure :: file_base_meshfield_read_var1d_local
118 procedure :: file_base_meshfield_read_var2d
119 procedure :: file_base_meshfield_read_var2d_local
120 procedure :: file_base_meshfield_read_var3d
121 procedure :: file_base_meshfield_read_var3d_local
122 generic :: read_var => &
123 file_base_meshfield_read_var1d, file_base_meshfield_read_var1d_local, &
124 file_base_meshfield_read_var2d, file_base_meshfield_read_var2d_local, &
125 file_base_meshfield_read_var3d, file_base_meshfield_read_var3d_local
126
127 !-
128 procedure :: get_commoninfo => file_base_meshfield_get_commoninfo
129 procedure :: get_datainfo => file_base_meshfield_get_datainfo
130 procedure :: get_varstepsize => file_base_meshfield_get_varstepsize
131 !-
132 procedure :: close => file_base_meshfield_close
133 procedure :: final => file_base_meshfield_final
134
135 !- Private procedures
136 procedure, private :: get_comp_ptr => file_base_meshfield_get_comp
137 end type file_base_meshfield
138
139 !-----------------------------------------------------------------------------
140 !
141 !++ Public parameters & variables
142 !
143 !-----------------------------------------------------------------------------
144 !
145 !++ Private procedures
146 !
147 !-------------------
148
149 private :: def_axes
150 private :: write_axes
151
152 integer, parameter :: meshtype_1d = 1
153 integer, parameter :: meshtype_2d_rectdom = 2
154 integer, parameter :: meshtype_2d_cubedsphere = 3
155 integer, parameter :: meshtype_3d_cubedom = 4
156 integer, parameter :: meshtype_3d_cubedsphere = 5
157
158contains
159 !> Initialize an object to manage file output with MeshField data.
160 !! The given component is registered as the main component.
161 !!
162 subroutine file_base_meshfield_init( this, & ! (inout)
163 var_num, & ! (in)
164 comp_name, & ! (in)
165 dim_name_postfix, & ! (in)
166 mesh1d, & ! (in)
167 mesh2d, meshcubedsphere2d, & ! (in)
168 mesh3d, meshcubedsphere3d, & ! (in)
169 force_uniform_grid ) ! (in)
170 implicit none
171
172 class(file_base_meshfield), intent(inout) :: this
173 integer, intent(in) :: var_num !< Number of output variables
174 character(len=*), optional, intent(in) :: comp_name !< Name of the main component
175 character(len=*), optional, intent(in) :: dim_name_postfix !< Postfix of dimension name for each component
176 class(meshbase1d), target, optional, intent(in) :: mesh1d !< 1D mesh object
177 class(meshrectdom2d), target, optional, intent(in) :: mesh2d !< 2D rectangular mesh object
178 class(meshcubedspheredom2d), target, optional, intent(in) :: meshcubedsphere2d !< 2D cubed-sphere mesh object
179 class(meshcubedom3d), target, optional, intent(in) :: mesh3d !< 3D cube mesh object
180 class(meshcubedspheredom3d), target, optional, intent(in) :: meshcubedsphere3d !< 3D cubed-sphere mesh object
181 logical, intent(in), optional :: force_uniform_grid !< Flag to output data on uniform grid
182
183 character(len=H_MID) :: comp_name_
184 character(len=H_SHORT) :: dim_name_postfix_
185 !--------------------------------------------------
186
187 this%fid = -1
188 this%comp_num = 0
189
190 if (present(comp_name)) then
191 comp_name_ = comp_name
192 else
193 comp_name_ = "main component"
194 end if
195
196 if (present(dim_name_postfix)) then
197 dim_name_postfix_ = dim_name_postfix
198 else
199 dim_name_postfix_ = ""
200 end if
201
202 ! Register mesh and output information with main component
203 call this%Register_comp( this%main_comp_id, & ! (out)
204 comp_name_, var_num, dim_name_postfix_, & ! (in)
205 mesh1d, mesh2d, meshcubedsphere2d, mesh3d, meshcubedsphere3d, & ! (in)
206 force_uniform_grid ) ! (in)
207
208 !-
209 this%File_axes_written = .false.
210
211 return
212 end subroutine file_base_meshfield_init
213
214 !> Register mesh and output information with each model component
215 subroutine file_base_meshfield_register_comp( this, &
216 registered_comp_id, & ! (out)
217 comp_name, & ! (in)
218 var_num, & ! (in)
219 dim_name_postfix, & ! (in)
220 mesh1d, & ! (in)
221 mesh2d, meshcubedsphere2d, & ! (in)
222 mesh3d, meshcubedsphere3d, & ! (in)
223 force_uniform_grid ) ! (in)
224
225 use scale_file_common_meshfield, only: &
227 implicit none
228 class(file_base_meshfield), intent(inout), target :: this
229 integer, intent(out) :: registered_comp_id !< Registered component ID
230 integer, intent(in) :: var_num !< Number of variables to be registered
231 character(len=*), intent(in) :: comp_name !< Name of the component to be registered
232 character(len=*), intent(in) :: dim_name_postfix !< Postfix of dimension name for each component
233 class(meshbase1d), target, optional, intent(in) :: mesh1d !< 1D mesh object
234 class(meshrectdom2d), target, optional, intent(in) :: mesh2d !< 2D rectangular mesh object
235 class(meshcubedspheredom2d), target, optional, intent(in) :: meshcubedsphere2d !< 2D cubed-sphere mesh object
236 class(meshcubedom3d), target, optional, intent(in) :: mesh3d !< 3D cube mesh object
237 class(meshcubedspheredom3d), target, optional, intent(in) :: meshcubedsphere3d !< 3D cubed-sphere mesh object
238 logical, intent(in), optional :: force_uniform_grid !< Flag to output data on uniform grid
239
240 type(filebasemeshfieldcomp), pointer :: comp_ptr
241
242 logical :: check_specify_mesh
243 !------------------------------------------------------------------------------
244
245 if ( this%comp_num >= component_num_max ) then
246 log_error("FILE_base_meshfield_register_comp",*) 'Exceeding maximum number of components. Check!'
247 call prc_abort
248 end if
249
250 this%comp_num = this%comp_num + 1
251 registered_comp_id = this%comp_num
252
253 comp_ptr => this%comp(registered_comp_id)
254 comp_ptr%comp_name = trim(comp_name)
255 comp_ptr%write_buf_amount = 0
256 comp_ptr%dim_name_postfix = trim(dim_name_postfix)
257
258 !-
259 allocate( comp_ptr%vars_ncid(var_num) )
260 comp_ptr%vars_ncid(:) = -1
261
262
263 !- Register mesh information
264
265 check_specify_mesh = .false.
266 nullify( comp_ptr%mesh1D, comp_ptr%mesh2D, comp_ptr%mesh3D )
267 nullify( comp_ptr%meshCS2D, comp_ptr%meshCS3D )
268
269 if (present(mesh1d)) then
270 comp_ptr%mesh1D => mesh1d
271 comp_ptr%mesh_type_id = meshtype_1d
272 check_specify_mesh = .true.
273
274 allocate( comp_ptr%dimsinfo(mf1d_dtype_num) )
275 call file_common_meshfield_get_dims( mesh1d, comp_ptr%dim_name_postfix, & ! (in)
276 comp_ptr%dimsinfo(:) ) ! (out)
277 end if
278 if (present(mesh2d)) then
279 comp_ptr%mesh2D => mesh2d
280 comp_ptr%mesh_type_id = meshtype_2d_rectdom
281 check_specify_mesh = .true.
282
283 allocate( comp_ptr%dimsinfo(mf2d_dtype_num) )
284 call file_common_meshfield_get_dims( mesh2d, comp_ptr%dim_name_postfix, & ! (in)
285 comp_ptr%dimsinfo(:) ) ! (out)
286 end if
287 if (present(meshcubedsphere2d)) then
288 comp_ptr%meshCS2D => meshcubedsphere2d
289 comp_ptr%mesh_type_id = meshtype_2d_cubedsphere
290 check_specify_mesh = .true.
291
292 allocate( comp_ptr%dimsinfo(mf2d_dtype_num) )
293 call file_common_meshfield_get_dims( meshcubedsphere2d, comp_ptr%dim_name_postfix, & ! (in)
294 comp_ptr%dimsinfo(:) ) ! (out)
295 end if
296 if (present(mesh3d)) then
297 comp_ptr%mesh3D => mesh3d
298 comp_ptr%mesh2D => mesh3d%mesh2D
299 comp_ptr%mesh_type_id = meshtype_3d_cubedom
300 check_specify_mesh = .true.
301
302 allocate( comp_ptr%dimsinfo(mf3d_dtype_num) )
303 call file_common_meshfield_get_dims( mesh3d, comp_ptr%dim_name_postfix, & ! (in)
304 comp_ptr%dimsinfo(:) ) ! (out)
305 end if
306 if (present(meshcubedsphere3d)) then
307 comp_ptr%meshCS3D => meshcubedsphere3d
308 comp_ptr%meshCS2D => meshcubedsphere3d%mesh2D
309 comp_ptr%mesh_type_id = meshtype_3d_cubedsphere
310 check_specify_mesh = .true.
311
312 allocate( comp_ptr%dimsinfo(mf3d_dtype_num) )
313 call file_common_meshfield_get_dims( meshcubedsphere3d, comp_ptr%dim_name_postfix, & ! (in)
314 comp_ptr%dimsinfo(:) ) ! (out)
315 end if
316
317 if ( present(force_uniform_grid) ) then
318 comp_ptr%force_uniform_grid = force_uniform_grid
319 else
320 comp_ptr%force_uniform_grid = .false.
321 end if
322
323 if (.not. check_specify_mesh) then
324 log_error("FILE_base_meshfield_register_comp",*) 'Specify a mesh among mesh1D, 2D, and 3D. Check!'
325 call prc_abort
326 end if
327
328 return
329 end subroutine file_base_meshfield_register_comp
330
331 !> Open file
332 subroutine file_base_meshfield_open( this, & ! (inout)
333 basename, myrank ) ! (in)
334
335 use scale_file, only: &
336 file_open
337 implicit none
338
339 class(file_base_meshfield), intent(inout) :: this
340 character(*), intent(in) :: basename
341 integer, intent(in), optional :: myrank
342 !--------------------------------------------------------------
343
344 call file_open( basename, & ! [in]
345 this%fid, & ! [out]
346 rankid=myrank ) ! [in]
347
348 return
349 end subroutine file_base_meshfield_open
350
351 !> Create file
352 subroutine file_base_meshfield_create( &
353 this, basename, title, dtype, &
354 fileexisted, &
355 myrank, tunits, calendar )
356
357 use scale_file, only: &
358 file_create
359 implicit none
360
361 class(file_base_meshfield), intent(inout) :: this
362 character(*), intent(in) :: basename
363 character(*), intent(in) :: title
364 character(*), intent(in) :: dtype
365 logical, intent(out) :: fileexisted
366 integer, intent(in), optional :: myrank
367 character(*), intent(in), optional :: calendar
368 character(*), intent(in), optional :: tunits
369
370 integer :: i
371 !--------------------------------------------------------------
372
373 call file_create( basename, & ! [IN]
374 title, & ! [IN]
375 h_source, & ! [IN]
376 h_institute, & ! [IN]
377 this%fid, & ! [OUT]
378 fileexisted, & ! [OUT]
379 rankid = myrank, & ! [IN]
380 time_units = tunits, & ! [IN]
381 aggregate = .false., & ! [IN]
382 calendar = calendar ) ! [IN]
383
384 if ( .not. fileexisted ) then
385 do i=1, this%comp_num
386 call def_axes( this%comp(i), this%fid, dtype )
387 end do
388 this%File_axes_written = .false.
389 end if
390
391 return
392 end subroutine file_base_meshfield_create
393
394 !> Define a variable in the file with MeshField data
395 subroutine file_base_meshfield_def_var1( this, & ! (inout)
396 field, desc, vid, dim_type_id, datatype, & ! (in)
397 standard_name, timeinv, nsteps, & ! (in)
398 comp_id ) ! (in)
399 implicit none
400
401 class(file_base_meshfield), intent(inout) :: this
402 class(meshfieldbase), intent(in) :: field
403 character(len=*), intent(in) :: desc
404 integer, intent(in) :: dim_type_id
405 integer, intent(in) :: vid
406 character(len=*), intent(in) :: datatype
407 character(len=*), optional, intent(in) :: standard_name
408 real(dp), optional, intent(in) :: timeinv
409 integer, optional, intent(in) :: nsteps
410 integer, optional, intent(in) :: comp_id
411 !--------------------------------------------------------------
412
413 call this%Def_Var( field%varname, field%unit, &
414 desc, vid, dim_type_id, datatype, standard_name, timeinv, nsteps, comp_id )
415
416 return
417 end subroutine file_base_meshfield_def_var1
418
419 !> Define a variable in the file with MeshField data
420 subroutine file_base_meshfield_def_var2( this, & ! (inout)
421 varname, units, desc, vid, dim_type_id, datatype, & ! (in)
422 standard_name, timeinv, nsteps, comp_id ) ! (in)
423
424 use scale_file, only: &
425 file_opened, &
426 file_def_variable, &
427 file_set_attribute
428 implicit none
429
430 class(file_base_meshfield), intent(inout) :: this
431 character(len=*), intent(in) :: varname
432 character(len=*), intent(in) :: units
433 character(len=*), intent(in) :: desc
434 integer, intent(in) :: dim_type_id
435 integer, intent(in) :: vid
436 character(len=*), intent(in) :: datatype
437 character(len=*), optional, intent(in) :: standard_name
438 real(dp), optional, intent(in) :: timeinv
439 integer, optional, intent(in) :: nsteps
440 integer, optional, intent(in) :: comp_id
441
442 integer :: i_dtype
443 integer :: ndim
444 character(len=H_MID) :: standard_name_
445
446 type(filebasemeshfieldcomp), pointer :: comp_ptr
447 !--------------------------------------------------------------
448
449 call this%get_comp_ptr( comp_id, & ! (in)
450 comp_ptr ) ! (out)
451
452 i_dtype = get_dtype(datatype)
453
454 if ( present(nsteps) ) then
455 comp_ptr%write_buf_amount = comp_ptr%write_buf_amount + comp_ptr%dimsinfo(dim_type_id)%size * nsteps
456 else
457 comp_ptr%write_buf_amount = comp_ptr%write_buf_amount + comp_ptr%dimsinfo(dim_type_id)%size
458 end if
459 if ( present(standard_name) ) then
460 standard_name_ = standard_name
461 else
462 standard_name_ = ""
463 end if
464
465 ndim = comp_ptr%dimsinfo(dim_type_id)%ndim
466 if ( present(timeinv) ) then
467 call file_def_variable( this%fid, varname, desc, units, standard_name_, &
468 ndim, comp_ptr%dimsinfo(dim_type_id)%dims(1:ndim), i_dtype, comp_ptr%vars_ncid(vid), &
469 time_int=timeinv )
470 else
471 call file_def_variable( this%fid, varname, desc, units, standard_name_, &
472 ndim, comp_ptr%dimsinfo(dim_type_id)%dims(1:ndim), i_dtype, comp_ptr%vars_ncid(vid) )
473 end if
474
475 return
476 end subroutine file_base_meshfield_def_var2
477
478 !> End definition of variables in the file with MeshField data
479 subroutine file_base_meshfield_enddef( this ) ! (inout)
480
481 use scale_file, only: &
482 file_opened, &
483 file_enddef
484 implicit none
485 class(file_base_meshfield), intent(inout) :: this
486
487 integer :: start(3)
488 integer :: i
489 !--------------------------------------------------------------
490
491 if (this%fid == -1) return
492
493 call file_enddef( this%fid )
494
495 if ( .not. this%File_axes_written ) then
496 start(:) = 1
497 do i=1, this%comp_num
498 call write_axes( this%comp(i), this%fid, start(:) )
499 end do
500 this%File_axes_written = .true.
501 end if
502
503 return
504 end subroutine file_base_meshfield_enddef
505
506 !> Write a 1D variable in the file with MeshField data
507!OCL_SERIAL
508 subroutine file_base_meshfield_write_var1d( this, & ! (inout)
509 vid, field1d, sec_str, sec_end, & ! (in)
510 comp_id ) ! (in)
511
512 use scale_file, only: &
513 file_opened, &
514 file_write
515 use scale_file_common_meshfield, only: &
517 implicit none
518
519 class(file_base_meshfield), intent(inout) :: this
520 integer, intent(in) :: vid
521 class(meshfield1d), intent(in) :: field1d
522 real(dp), intent(in) :: sec_str
523 real(dp), intent(in) :: sec_end
524 integer, intent(in), optional :: comp_id
525
526 real(rp), allocatable :: buf(:)
527 integer :: dims(1)
528 integer :: start(1)
529
530 integer :: ldomid
531
532 type(filebasemeshfieldcomp), pointer :: comp_ptr
533 !-------------------------------------------------
534
535 call this%get_comp_ptr( comp_id, & ! (in)
536 comp_ptr ) ! (out)
537
538 if ( this%fid /= -1 ) then
539 start(:) = 1
540 dims(1) = comp_ptr%dimsinfo(mf1d_dimtype_x)%size
541 allocate( buf(dims(1)) )
542
543#ifdef _OPENACC
544 do ldomid=1, field1d%mesh%LOCAL_MESH_NUM
545 !$acc update host( field1d%local(ldomID)%val ) async(1)
546 end do
547 !$acc wait(1)
548#endif
549
550 call file_common_meshfield_put_field1d_cartesbuf( comp_ptr%mesh1D, field1d, buf(:), &
551 comp_ptr%force_uniform_grid )
552
553 call file_write( comp_ptr%vars_ncid(vid), buf(:), & ! (in)
554 sec_str, sec_end, start=start ) ! (in)
555 end if
556
557 return
558 end subroutine file_base_meshfield_write_var1d
559
560 !> Write a 2D variable in the file with MeshField data
561!OCL_SERIAL
562 subroutine file_base_meshfield_write_var2d( this, & ! (inout)
563 vid, field2d, sec_str, sec_end, & ! (in)
564 comp_id ) ! (in)
565
566 use scale_file, only: &
567 file_opened, &
568 file_write
569 use scale_file_common_meshfield, only: &
572 implicit none
573
574 class(file_base_meshfield), intent(inout) :: this
575 integer, intent(in) :: vid
576 class(meshfield2d), intent(in) :: field2d
577 real(dp), intent(in) :: sec_str
578 real(dp), intent(in) :: sec_end
579 integer, intent(in), optional :: comp_id
580 real(rp), allocatable :: buf(:,:)
581 integer :: dims(2)
582 integer :: start(2)
583
584 integer :: ldomid
585
586 type(filebasemeshfieldcomp), pointer :: comp_ptr
587 !-------------------------------------------------
588
589 call this%get_comp_ptr( comp_id, & ! (in)
590 comp_ptr ) ! (out)
591
592 if ( this%fid /= -1 ) then
593 start(:) = 1
594 dims(1) = comp_ptr%dimsinfo(mf2d_dimtype_x)%size
595 dims(2) = comp_ptr%dimsinfo(mf2d_dimtype_y)%size
596 allocate( buf(dims(1),dims(2)) )
597
598#ifdef _OPENACC
599 do ldomid=1, field2d%mesh%LOCAL_MESH_NUM
600 !$acc update host( field2d%local(ldomID)%val ) async(1)
601 end do
602 !$acc wait(1)
603#endif
604
605 if ( associated(comp_ptr%mesh2D) ) then
606 call file_common_meshfield_put_field2d_cartesbuf( comp_ptr%mesh2D, field2d, buf(:,:), &
607 comp_ptr%force_uniform_grid )
608 else if ( associated(comp_ptr%meshCS2D) ) then
609 call file_common_meshfield_put_field2d_cubedsphere_cartesbuf( comp_ptr%meshCS2D, field2d, buf(:,:) )
610 end if
611 call file_write( comp_ptr%vars_ncid(vid), buf(:,:), & ! (in)
612 sec_str, sec_end, start=start ) ! (in)
613 end if
614
615 return
616 end subroutine file_base_meshfield_write_var2d
617
618 !> Write a 3D variable in the file with MeshField data
619!OCL_SERIAL
620 subroutine file_base_meshfield_write_var3d( this, & ! (inout)
621 vid, field3d, sec_str, sec_end, & ! (in)
622 comp_id ) ! (in)
623
624 use scale_file, only: &
625 file_opened, &
626 file_write
627 use scale_file_common_meshfield, only: &
630 use scale_prof
631 implicit none
632
633 class(file_base_meshfield), intent(inout) :: this
634 integer, intent(in) :: vid
635 class(meshfield3d), intent(in) :: field3d
636 real(dp), intent(in) :: sec_str
637 real(dp), intent(in) :: sec_end
638 integer, intent(in), optional :: comp_id
639
640 real(rp), allocatable :: buf(:,:,:)
641 integer :: dims(3)
642 integer :: start(3)
643
644 integer :: ldomid
645
646 type(filebasemeshfieldcomp), pointer :: comp_ptr
647 !-------------------------------------------------
648
649 call this%get_comp_ptr( comp_id, & ! (in)
650 comp_ptr ) ! (out)
651
652 if ( this%fid /= -1 ) then
653 start(:) = 1
654 dims(1) = comp_ptr%dimsinfo(mf3d_dimtype_x)%size
655 dims(2) = comp_ptr%dimsinfo(mf3d_dimtype_y)%size
656 dims(3) = comp_ptr%dimsinfo(mf3d_dimtype_z)%size
657 allocate( buf(dims(1),dims(2),dims(3)) )
658
659#ifdef _OPENACC
660 do ldomid=1, field3d%mesh%LOCAL_MESH_NUM
661 !$acc update host( field3d%local(ldomID)%val ) async(1)
662 end do
663 !$acc wait(1)
664#endif
665
666 if ( associated(comp_ptr%mesh3D) ) then
667 call file_common_meshfield_put_field3d_cartesbuf( comp_ptr%mesh3D, field3d, buf(:,:,:), &
668 comp_ptr%force_uniform_grid )
669 else if ( associated(comp_ptr%meshCS3D) ) then
670 call file_common_meshfield_put_field3d_cubedsphere_cartesbuf( comp_ptr%meshCS3D, field3d, buf(:,:,:) )
671 end if
672
673 call file_write( comp_ptr%vars_ncid(vid), buf(:,:,:), & ! (in)
674 sec_str, sec_end, start ) ! (in)
675 end if
676
677 return
678 end subroutine file_base_meshfield_write_var3d
679
680 !> Get common information of the file with MeshField data
681 subroutine file_base_meshfield_get_commoninfo( this, & ! (in)
682 title, source, institution ) ! (out)
683 use scale_file, only: &
684 file_get_attribute
685 implicit none
686
687 class(file_base_meshfield), intent(in) :: this
688 character(len=FILE_HMID), intent(out), optional :: title !< Title of the file
689 character(len=FILE_HMID), intent(out), optional :: source !< Source of the file
690 character(len=FILE_HMID), intent(out), optional :: institution !< Institution of the file
691 !-------------------------------------------------
692
693 if ( present(title) ) call file_get_attribute( this%fid, 'global', 'title', title )
694 if ( present(source) ) call file_get_attribute( this%fid, 'global', 'source', source )
695 if ( present(institution) ) call file_get_attribute( this%fid, 'global', 'institution', institution )
696
697 return
698 end subroutine file_base_meshfield_get_commoninfo
699
700 !> Get the number of time steps associated with the variable in the file
701 subroutine file_base_meshfield_get_varstepsize( this, varname, & ! (in)
702 len ) ! (out)
703 use scale_file, only: &
704 file_get_stepsize
705 implicit none
706
707 class(file_base_meshfield), intent(in) :: this
708 character(*), intent(in) :: varname !< Name of the variable
709 integer, intent(out) :: len !< Number of time steps associated with the variable
710 !-------------------------------------------------
711
712 call file_get_stepsize( this%fid, varname, & ! (in)
713 len ) ! (out)
714
715 return
716 end subroutine file_base_meshfield_get_varstepsize
717
718 !> Get information of the variable in the file with MeshField data
719 subroutine file_base_meshfield_get_datainfo( this, varname, istep, & ! (in)
720 description, units, standard_name, & ! (out)
721 time_start, time_end, time_units, calendar ) ! (out)
722 use scale_file, only: &
723 file_get_datainfo
724 implicit none
725
726 class(file_base_meshfield), intent(in) :: this
727 character(*), intent(in) :: varname !< Name of the variable
728 integer, intent(in), optional :: istep !< Time step of the variable
729 character(len=FILE_HMID), intent(out), optional :: description !< Description of the variable
730 character(len=FILE_HSHORT), intent(out), optional :: units !< Units of the variable
731 character(len=FILE_HMID), intent(out), optional :: standard_name !< Standard name of the variable
732 real(dp), intent(out), optional :: time_start !< Start time of the variable
733 real(dp), intent(out), optional :: time_end !< End time of the variable
734 character(len=FILE_HMID), intent(out), optional :: time_units !< Time units of the variable
735 character(len=FILE_HSHORT), intent(out), optional :: calendar !< Calendar name
736 !-------------------------------------------------
737
738 call file_get_datainfo( this%fid, varname, istep=istep, & ! (in)
739 description=description, units=units, standard_name=standard_name, & ! (out)
740 time_start=time_start, time_end=time_end, time_units=time_units, calendar=calendar ) ! (out)
741
742 return
743 end subroutine file_base_meshfield_get_datainfo
744
745 !> Read a 1D variable in the file with MeshField data
746!OCL_SERIAL
747 subroutine file_base_meshfield_read_var1d( this, & ! (inout)
748 dim_typeid, varname, & ! (in)
749 field1d, & ! (inout)
750 step, allow_missing, comp_id ) ! (in)
751
752 use scale_file, only: &
753 file_read
754 use scale_file_common_meshfield, only: &
756
757 implicit none
758
759 class(file_base_meshfield), intent(inout) :: this
760 integer, intent(in) :: dim_typeid
761 character(*), intent(in) :: varname
762 class(meshfield1d), intent(inout) :: field1d
763 integer, intent(in), optional :: step
764 logical, intent(in), optional :: allow_missing
765 integer, intent(in), optional :: comp_id
766
767 real(rp), allocatable :: buf(:)
768 integer :: dims(1)
769 integer :: start(1) ! start offset of globale variable
770
771 type(filebasemeshfieldcomp), pointer :: comp_ptr
772 !-------------------------------------------------
773
774 if ( this%fid /= -1 ) then
775 call this%get_comp_ptr( comp_id, & ! (in)
776 comp_ptr ) ! (out)
777
778 start(:) = 1
779 dims(1) = comp_ptr%dimsinfo(dim_typeid)%size
780 allocate( buf(dims(1)) )
781
782 call file_read( this%fid, varname, & ! (in)
783 buf(:), & ! (out)
784 step=step, allow_missing=allow_missing ) ! (in)
785
786 call file_common_meshfield_set_cartesbuf_field1d( comp_ptr%mesh1D, buf(:), &
787 field1d )
788 end if
789
790 return
791 end subroutine file_base_meshfield_read_var1d
792
793 !> Read a 1D variable with local mesh in the file
794!OCL_SERIAL
795 subroutine file_base_meshfield_read_var1d_local( this, & ! (inout)
796 dim_typeid, varname, lcmesh, i0_s, & ! (in)
797 val, & ! (out)
798 step, allow_missing, comp_id ) ! (in)
799
800 use scale_file, only: &
801 file_read
802 use scale_file_common_meshfield, only: &
804
805 implicit none
806
807 class(file_base_meshfield), intent(inout) :: this
808 integer, intent(in) :: dim_typeid
809 character(*), intent(in) :: varname
810 class(localmesh1d), intent(in) :: lcmesh
811 integer, intent(in) :: i0_s
812 real(rp), intent(out) :: val(lcmesh%refelem1d%np,lcmesh%nea)
813 integer, intent(in), optional :: step
814 logical, intent(in), optional :: allow_missing
815 integer, intent(in), optional :: comp_id
816 real(rp), allocatable :: buf(:)
817 integer :: dims(1)
818 integer :: start(1) ! start offset of globale variable
819
820 type(filebasemeshfieldcomp), pointer :: comp_ptr
821 !-------------------------------------------------
822
823 if ( this%fid /= -1 ) then
824 call this%get_comp_ptr( comp_id, & ! (in)
825 comp_ptr ) ! (out)
826
827 start(:) = 1
828 dims(1) = comp_ptr%dimsinfo(dim_typeid)%size
829 allocate( buf(dims(1)) )
830
831 call file_read( this%fid, varname, & ! (in)
832 buf(:), & ! (out)
833 step=step, allow_missing=allow_missing ) ! (in)
834
836 lcmesh, buf(:), i0_s, &
837 val(:,:) )
838 end if
839
840 return
841 end subroutine file_base_meshfield_read_var1d_local
842
843 !> Read a 2D variable in the file with MeshField data
844!OCL_SERIAL
845 subroutine file_base_meshfield_read_var2d( this, & ! (inout)
846 dim_typeid, varname, & ! (in)
847 field2d, & ! (inout)
848 step, allow_missing, comp_id ) ! (in)
849
850 use scale_file, only: &
851 file_read
852 use scale_file_common_meshfield, only: &
855
856 implicit none
857
858 class(file_base_meshfield), intent(inout) :: this
859 integer, intent(in) :: dim_typeid
860 character(*), intent(in) :: varname
861 class(meshfield2d), intent(inout) :: field2d
862 integer, intent(in), optional :: step
863 logical, intent(in), optional :: allow_missing
864 integer, intent(in), optional :: comp_id
865
866 real(rp), allocatable :: buf(:,:)
867 integer :: dims(2)
868 integer :: start(2) ! start offset of globale variable
869
870 type(filebasemeshfieldcomp), pointer :: comp_ptr
871 !-------------------------------------------------
872
873 if ( this%fid /= -1 ) then
874 call this%get_comp_ptr( comp_id, & ! (in)
875 comp_ptr ) ! (out)
876
877 start(:) = 1
878 dims(1) = comp_ptr%dimsinfo(mf2d_dimtype_x)%size
879 dims(2) = comp_ptr%dimsinfo(mf2d_dimtype_y)%size
880 allocate( buf(dims(1),dims(2)) )
881
882 call file_read( this%fid, varname, & ! (in)
883 buf(:,:), & ! (out)
884 step=step, allow_missing=allow_missing ) ! (in)
885
886 if ( associated( comp_ptr%meshCS2D) ) then
888 comp_ptr%meshCS2D, buf(:,:), &
889 field2d )
890 else if ( associated( comp_ptr%mesh2D) ) then
891 call file_common_meshfield_set_cartesbuf_field2d( comp_ptr%mesh2D, buf(:,:), &
892 field2d )
893 end if
894 end if
895
896 return
897 end subroutine file_base_meshfield_read_var2d
898
899 !> Read a 2D variable with local mesh in the file
900!OCL_SERIAL
901 subroutine file_base_meshfield_read_var2d_local( this, & ! (inout)
902 dim_typeid, varname, lcmesh, i0_s, j0_s, & ! (in)
903 val, & ! (out)
904 step, allow_missing, comp_id ) ! (in)
905
906 use scale_file, only: &
907 file_read
908 use scale_file_common_meshfield, only: &
910
911 implicit none
912
913 class(file_base_meshfield), intent(inout) :: this
914 integer, intent(in) :: dim_typeid
915 character(*), intent(in) :: varname
916 class(localmesh2d), intent(in) :: lcmesh
917 integer, intent(in) :: i0_s, j0_s
918 real(rp), intent(out) :: val(lcmesh%refelem2d%np,lcmesh%nea)
919 integer, intent(in), optional :: step
920 logical, intent(in), optional :: allow_missing
921 integer, intent(in), optional :: comp_id
922
923 real(rp), allocatable :: buf(:,:)
924 integer :: dims(2)
925 integer :: start(2) ! start offset of globale variable
926
927 type(filebasemeshfieldcomp), pointer :: comp_ptr
928 !-------------------------------------------------
929
930 if ( this%fid /= -1 ) then
931 call this%get_comp_ptr( comp_id, & ! (in)
932 comp_ptr ) ! (out)
933
934 start(:) = 1
935 dims(1) = comp_ptr%dimsinfo(mf2d_dimtype_x)%size
936 dims(2) = comp_ptr%dimsinfo(mf2d_dimtype_y)%size
937 allocate( buf(dims(1),dims(2)) )
938
939 call file_read( this%fid, varname, & ! (in)
940 buf(:,:), & ! (out)
941 step=step, allow_missing=allow_missing ) ! (in)
942
944 lcmesh, buf(:,:), i0_s, j0_s, &
945 val(:,:) )
946 end if
947
948 return
949 end subroutine file_base_meshfield_read_var2d_local
950
951 !> Read a 3D variable in the file with MeshField data
952!OCL_SERIAL
953 subroutine file_base_meshfield_read_var3d( this, & ! (inout)
954 dim_typeid, varname, & ! (in)
955 field3d, & ! (inout)
956 step, allow_missing, comp_id ) ! (in)
957
958 use scale_file, only: &
959 file_read
960 use scale_file_common_meshfield, only: &
963
964
965 implicit none
966
967 class(file_base_meshfield), intent(inout) :: this
968 integer, intent(in) :: dim_typeid
969 character(*), intent(in) :: varname
970 class(meshfield3d), intent(inout) :: field3d
971 integer, intent(in), optional :: step
972 logical, intent(in), optional :: allow_missing
973 integer, intent(in), optional :: comp_id
974
975 real(rp), allocatable :: buf(:,:,:)
976 integer :: dims(3)
977 integer :: start(3) ! start offset of globale variable
978
979 type(filebasemeshfieldcomp), pointer :: comp_ptr
980 !-------------------------------------------------
981
982 if ( this%fid /= -1 ) then
983 call this%get_comp_ptr( comp_id, & ! (in)
984 comp_ptr ) ! (out)
985
986 start(:) = 1
987 dims(1) = comp_ptr%dimsinfo(mf3d_dimtype_x)%size
988 dims(2) = comp_ptr%dimsinfo(mf3d_dimtype_y)%size
989 dims(3) = comp_ptr%dimsinfo(mf3d_dimtype_z)%size
990 allocate( buf(dims(1),dims(2),dims(3)) )
991
992 call file_read( this%fid, varname, & ! (in)
993 buf(:,:,:), & ! (out)
994 step=step, allow_missing=allow_missing ) ! (in)
995
996 if ( associated(comp_ptr%meshCS3D) ) then
998 comp_ptr%meshCS3D, buf(:,:,:), &
999 field3d )
1000 else if ( associated(comp_ptr%mesh3D) ) then
1001 call file_common_meshfield_set_cartesbuf_field3d( comp_ptr%mesh3D, buf(:,:,:), &
1002 field3d )
1003 end if
1004 end if
1005
1006 return
1007 end subroutine file_base_meshfield_read_var3d
1008
1009 !> Read a 3D variable with local mesh in the file
1010!OCL_SERIAL
1011 subroutine file_base_meshfield_read_var3d_local( this, & ! (inout)
1012 dim_typeid, varname, lcmesh, i0_s, j0_s, k0_s, & ! (in)
1013 val, & ! (out)
1014 step, allow_missing, comp_id ) ! (in)
1015
1016 use scale_file, only: &
1017 file_read
1018 use scale_file_common_meshfield, only: &
1020
1021 implicit none
1022
1023 class(file_base_meshfield), intent(inout) :: this
1024 integer, intent(in) :: dim_typeid
1025 character(*), intent(in) :: varname
1026 class(localmesh3d), intent(in) :: lcmesh
1027 integer, intent(in) :: i0_s, j0_s, k0_s
1028 real(rp), intent(out) :: val(lcmesh%refelem3d%np,lcmesh%nea)
1029 integer, intent(in), optional :: step
1030 logical, intent(in), optional :: allow_missing
1031 integer, intent(in), optional :: comp_id
1032
1033 real(rp), allocatable :: buf(:,:,:)
1034 integer :: dims(3)
1035 integer :: start(3) ! start offset of globale variable
1036
1037 type(filebasemeshfieldcomp), pointer :: comp_ptr
1038 !-------------------------------------------------
1039
1040 if ( this%fid /= -1 ) then
1041 call this%get_comp_ptr( comp_id, & ! (in)
1042 comp_ptr ) ! (out)
1043
1044 start(:) = 1
1045 dims(1) = comp_ptr%dimsinfo(mf3d_dimtype_x)%size
1046 dims(2) = comp_ptr%dimsinfo(mf3d_dimtype_y)%size
1047 dims(3) = comp_ptr%dimsinfo(mf3d_dimtype_z)%size
1048 allocate( buf(dims(1),dims(2),dims(3)) )
1049
1050 call file_read( this%fid, varname, & ! (in)
1051 buf(:,:,:), & ! (out)
1052 step=step, allow_missing=allow_missing ) ! (in)
1053
1055 lcmesh, buf(:,:,:), i0_s, j0_s, k0_s, &
1056 val(:,:) )
1057 end if
1058
1059 return
1060 end subroutine file_base_meshfield_read_var3d_local
1061
1062 !> Close the file with MeshField data
1063 subroutine file_base_meshfield_close( this ) ! (inout)
1064 use scale_file, only: file_close
1065
1066 implicit none
1067 class(file_base_meshfield), intent(inout) :: this
1068 !--------------------------------------------------
1069
1070 if ( this%fid /= -1 ) then
1071 call file_close( this%fid ) ! [IN]
1072 this%fid = -1
1073 end if
1074
1075 return
1076 end subroutine file_base_meshfield_close
1077
1078 !> Finalize an object to manage file output of meshfield data.
1079!OCL_SERIAL
1080 subroutine file_base_meshfield_final( this ) ! (inout)
1081 implicit none
1082 class(file_base_meshfield), intent(inout) :: this
1083
1084 integer :: i
1085 type(filebasemeshfieldcomp), pointer :: comp_ptr
1086 !--------------------------------------------------
1087
1088 do i=1, this%comp_num
1089 call this%get_comp_ptr( i, comp_ptr )
1090 if ( allocated(comp_ptr%vars_ncid) ) deallocate( comp_ptr%vars_ncid )
1091 if ( allocated(comp_ptr%dimsinfo) ) deallocate( comp_ptr%dimsinfo )
1092 nullify( comp_ptr%mesh1D, comp_ptr%mesh2D, comp_ptr%mesh3D )
1093 nullify( comp_ptr%meshCS2D, comp_ptr%meshCS3D )
1094 end do
1095
1096 return
1097 end subroutine file_base_meshfield_final
1098
1099 !> Put global attributes related to time in the file with MeshField data
1100 subroutine file_base_meshfield_put_global_attribute_time( &
1101 this, date, subsec )
1102
1103 use scale_file, only: &
1104 file_set_attribute, &
1105 file_get_cftunits
1106 use scale_calendar, only: &
1107 calendar_get_name
1108
1109 implicit none
1110
1111 class(file_base_meshfield), intent(inout) :: this
1112 integer, intent(in) :: date(6)
1113 real(dp), intent(in) :: subsec
1114
1115 character(34) :: tunits
1116 character(len=H_SHORT) :: calendar_name
1117 !------------------------------------
1118
1119 call file_set_attribute( this%fid, "global", "Conventions", "CF-1.6" ) ! [IN]
1120 call file_set_attribute( this%fid, "global", "grid_name", "hoge" ) ! [IN]
1121
1122 !- time
1123
1124 if ( date(1) > 0 ) then
1125 call file_get_cftunits( date(:), tunits )
1126 call calendar_get_name( calendar_name )
1127 else
1128 tunits = 'seconds'
1129 calendar_name = ''
1130 endif
1131
1132 if ( calendar_name /= "" ) &
1133 call file_set_attribute( this%fid, "global", "calendar", calendar_name )
1134 call file_set_attribute( this%fid, "global", "time_units", tunits )
1135 call file_set_attribute( this%fid, "global", "time_start", (/ subsec /) )
1136
1137 return
1138 end subroutine file_base_meshfield_put_global_attribute_time
1139
1140 !- private -----------------------------------------
1141
1142 subroutine def_axes( this, & ! (in)
1143 fid, dtype ) ! (in)
1144 use scale_const, only: &
1145 undef => const_undef
1146 use scale_file, only: &
1147 file_def_axis, &
1148 file_set_attribute, &
1149 file_def_associatedcoordinate, &
1150 file_add_associatedvariable
1151
1152 implicit none
1153
1154 class(filebasemeshfieldcomp), intent(in) :: this
1155 integer, intent(in) :: fid
1156
1157 character(*), intent(in) :: dtype
1158 integer :: d
1159 integer :: i_dtype
1160 integer :: ndim
1161 !------------
1162
1163 i_dtype = get_dtype( dtype )
1164
1165 select case ( this%mesh_type_id )
1166 case ( meshtype_1d )
1167 ndim = 1
1168 case ( meshtype_2d_rectdom, meshtype_2d_cubedsphere )
1169 ndim = 2
1170 case ( meshtype_3d_cubedom, meshtype_3d_cubedsphere )
1171 ndim = 3
1172 end select
1173
1174 !- Define axes
1175 do d=1, ndim
1176 call file_def_axis( fid, &
1177 this%dimsinfo(d)%name, this%dimsinfo(d)%desc, this%dimsinfo(d)%unit, &
1178 this%dimsinfo(d)%name, i_dtype, this%dimsinfo(d)%size )
1179 end do
1180 return
1181 end subroutine def_axes
1182
1183 subroutine write_axes( this, & ! (in)
1184 fid, start ) ! (in)
1185 use scale_const, only: &
1186 undef => const_undef
1187 use scale_file, only: &
1188 file_write_axis, &
1189 file_set_attribute
1190 use scale_file_common_meshfield, only: &
1192 implicit none
1193
1194 class(filebasemeshfieldcomp), intent(in) :: this
1195 integer, intent(in) :: fid
1196 integer, intent(in) :: start(3)
1197
1198 real(rp), allocatable :: x(:)
1199 real(rp), allocatable :: y(:)
1200 real(rp), allocatable :: z(:)
1201 !------------
1202
1203 select case ( this%mesh_type_id )
1204 case ( meshtype_1d ) ! 1D mesh
1205 allocate( x(this%dimsinfo(1)%size) )
1206 case ( meshtype_2d_rectdom, meshtype_2d_cubedsphere ) ! 2D mesh
1207 allocate( x(this%dimsinfo(1)%size), y(this%dimsinfo(2)%size) )
1208 case ( meshtype_3d_cubedom, meshtype_3d_cubedsphere ) ! 3D mesh
1209 allocate( x(this%dimsinfo(1)%size), y(this%dimsinfo(2)%size), z(this%dimsinfo(3)%size) )
1210 end select
1211
1212 !-
1213 select case ( this%mesh_type_id )
1214 case ( meshtype_1d ) ! 1D mesh
1215 call file_common_meshfield_get_axis( this%mesh1D, this%dimsinfo, x(:), this%force_uniform_grid )
1216 case ( meshtype_2d_rectdom ) ! 2D mesh
1217 call file_common_meshfield_get_axis( this%mesh2D, this%dimsinfo, x(:), y(:), this%force_uniform_grid )
1218 case ( meshtype_2d_cubedsphere ) ! 2D mesh
1219 call file_common_meshfield_get_axis( this%meshCS2D, this%dimsinfo, x(:), y(:) )
1220 case ( meshtype_3d_cubedom ) ! 3D mesh
1221 call file_common_meshfield_get_axis( this%mesh3D, this%dimsinfo, x(:), y(:), z(:), this%force_uniform_grid )
1222 case ( meshtype_3d_cubedsphere ) ! 3D mesh
1223 call file_common_meshfield_get_axis( this%meshCS3D, this%dimsinfo, x(:), y(:), z(:) )
1224 end select
1225
1226 !-
1227 select case ( this%mesh_type_id )
1228 case ( meshtype_1d ) ! 1D mesh
1229 call file_write_axis( fid, this%dimsinfo(1)%name, x(:), start(1:1) )
1230 case ( meshtype_2d_rectdom, meshtype_2d_cubedsphere ) ! 2D mesh
1231 call file_write_axis( fid, this%dimsinfo(1)%name, x(:), start(1:1) )
1232 call file_write_axis( fid, this%dimsinfo(2)%name, y(:), start(2:2) )
1233 case ( meshtype_3d_cubedom, meshtype_3d_cubedsphere ) ! 3D mesh
1234 call file_write_axis( fid, this%dimsinfo(1)%name, x(:), start(1:1) )
1235 call file_write_axis( fid, this%dimsinfo(2)%name, y(:), start(2:2) )
1236 call file_write_axis( fid, this%dimsinfo(3)%name, z(:), start(3:3) )
1237 if ( this%dimsinfo(3)%positive_down(1) ) &
1238 call file_set_attribute( fid, this%dimsinfo(3)%name, "positive", "down" )
1239 end select
1240
1241 return
1242 end subroutine write_axes
1243
1244!OCL SERIAL
1245 subroutine file_base_meshfield_get_comp( this, comp_id, & ! (in)
1246 comp_ptr ) ! (out)
1247 implicit none
1248 class(file_base_meshfield), intent(in), target :: this
1249 integer, intent(in), optional :: comp_id
1250 type(filebasemeshfieldcomp), intent(out), pointer :: comp_ptr
1251 !--------------------------------------------------------------
1252
1253 if ( present(comp_id) ) then
1254 if ( comp_id < 1 .or. comp_id > this%comp_num ) then
1255 log_error("FILE_base_meshfield_get_comp",*) 'Invalid component ID. Check!'
1256 call prc_abort
1257 end if
1258 comp_ptr => this%comp(comp_id)
1259 else
1260 comp_ptr => this%comp(this%main_comp_id)
1261 end if
1262 return
1263 end subroutine file_base_meshfield_get_comp
1264
module FElib / Element / Base
integer, parameter component_num_max
Maximum number of components to be registered.
subroutine, public file_common_meshfield_set_cartesbuf_field1d(mesh1d, buf, field1d)
subroutine, public file_common_meshfield_set_cartesbuf_field2d(mesh2d, buf, field2d)
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_set_cartesbuf_field3d(mesh3d, buf, field3d)
subroutine, public file_common_meshfield_put_field1d_cartesbuf(mesh1d, field1d, buf, force_uniform_grid)
subroutine, public file_common_meshfield_set_cartesbuf_field2d_local(lcmesh, buf, i0_s, j0_s, val)
subroutine, public file_common_meshfield_set_cartesbuf_field3d_local(lcmesh, buf, i0_s, j0_s, k0_s, val)
subroutine, public file_common_meshfield_put_field3d_cartesbuf(mesh3d, field3d, buf, force_uniform_grid)
subroutine, public file_common_meshfield_set_cartesbuf_field1d_local(lcmesh, buf, i0_s, val)
subroutine, public file_common_meshfield_set_cartesbuf_field3d_cubedsphere(mesh3d, buf, field3d)
subroutine, public file_common_meshfield_set_cartesbuf_field2d_cubedsphere(mesh2d, buf, field2d)
integer function, public file_common_meshfield_get_dtype(datatype)
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
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 to manage file output with MeshField data.
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)