Merge branch 'fixf'
[wrf-fire-matlab.git] / femwind / fortran / coarsening_icl_test.f90
blob0a98e882e0257202fe7e236e88acfa0355709d51
1 program coarsening_icl_test
3 use module_coarsening
4 use module_utils ! to read and write matrices as text files from matlab
6 implicit none
8 real, pointer, dimension(:,:,:):: icl_z_m,dx_m,dy_m,dz_m,A_m,minaspect_m,maxaspect_m ! to read from files
9 real, dimension(1,1,1)::cr_x_m,cr_y_m
10 real:: A(3,3), dx,dy,minaspect,maxaspect ! to pass on
11 real, pointer::dz(:)
12 integer, pointer:: icl_z(:)
13 integer:: cr_x,cr_y
15 integer::n3
17 ! read and copy
18 call read_array(dx_m,'dx')
19 dx=dx_m(1,1,1)
20 call read_array(dy_m,'dy')
21 dy=dy_m(1,1,1)
22 call read_array(dz_m,'dz')
23 n3 = size(dz_m)
24 allocate(dz(n3))
25 dz=reshape(dz_m,(/n3/))
26 call read_array(A_m,'A')
27 A=reshape(A_m,(/3,3/))
28 call read_array(minaspect_m,'minaspect')
29 minaspect=minaspect_m(1,1,1)
30 call read_array(maxaspect_m,'maxaspect')
31 maxaspect=maxaspect_m(1,1,1)
33 call coarsening_icl(cr_x,cr_y,icl_z,dx,dy,dz,A,minaspect,maxaspect)
35 cr_x_m(1,1,1)=cr_x
36 call write_array(cr_x_m,'cr_x')
37 cr_y_m(1,1,1)=cr_y
38 call write_array(cr_y_m,'cr_y')
39 call write_array(reshape(real(icl_z),(/size(icl_z),1,1/)),'icl_z')
41 end program coarsening_icl_test