|
15 | 15 |
|
16 | 16 | module AbcModule |
17 | 17 | use ConstantsModule, only: LINELENGTH, LENMEMPATH, DZERO, LENVARNAME, & |
18 | | - LENPACKAGENAME, TABLEFT, TABCENTER |
| 18 | + LENPACKAGENAME, TABLEFT, TABCENTER, LENMEMTYPE |
19 | 19 | use KindModule, only: I4B, DP |
20 | 20 | use MemoryManagerModule, only: mem_setptr |
21 | 21 | use MemoryHelperModule, only: create_mem_path |
@@ -441,14 +441,15 @@ end subroutine abc_allocate_scalars |
441 | 441 | subroutine abc_allocate_arrays(this) |
442 | 442 | ! -- modules |
443 | 443 | !! use MemoryManagerModule, only: mem_allocate |
444 | | - use MemoryManagerModule, only: mem_setptr, mem_checkin, mem_allocate |
| 444 | + use MemoryManagerModule, only: mem_setptr, mem_checkin, mem_allocate, & |
| 445 | + get_mem_type |
445 | 446 | ! -- dummy |
446 | 447 | class(AbcType), intent(inout) :: this |
447 | | - ! integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist |
| 448 | + ! integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist |
448 | 449 | !real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar |
449 | 450 | ! -- local |
450 | 451 | integer(I4B) :: n |
451 | | - ! |
| 452 | + character(len=LENMEMTYPE) :: var_type !< memory type |
452 | 453 | ! |
453 | 454 | ! -- allocate character array for status |
454 | 455 | allocate (this%status(this%ncv)) |
@@ -487,8 +488,20 @@ subroutine abc_allocate_arrays(this) |
487 | 488 | call this%swr%ar() |
488 | 489 | end if |
489 | 490 | if (this%inlhf /= 0) then |
490 | | - call mem_allocate(this%wspd, this%ncv, 'WSPD', this%memoryPath) |
491 | | - call mem_allocate(this%tatm, this%ncv, 'TATM', this%memoryPath) |
| 491 | + call get_mem_type('WSPD', this%memoryPath, var_type) |
| 492 | + if (var_type == 'UNKNOWN') then |
| 493 | + call mem_allocate(this%wspd, this%ncv, 'WSPD', this%memoryPath) |
| 494 | + do n = 1, this%ncv |
| 495 | + this%wspd(n) = DZERO |
| 496 | + end do |
| 497 | + end if |
| 498 | + call get_mem_type('TATM', this%memoryPath, var_type) |
| 499 | + if (var_type == 'UNKNOWN') then |
| 500 | + call mem_allocate(this%tatm, this%ncv, 'TATM', this%memoryPath) |
| 501 | + do n = 1, this%ncv |
| 502 | + this%tatm(n) = DZERO |
| 503 | + end do |
| 504 | + end if |
492 | 505 | call mem_allocate(this%rh, this%ncv, 'RH', this%memoryPath) |
493 | 506 | ! |
494 | 507 | ! -- initialize |
|
0 commit comments