started adding of wind profile
[wrf-fire-matlab.git] / femwind / ndt_boundary_conditions_fortran.m
blobdfe072dd98bf4a5ee506ad006f1d32385f614c28
1 function Kb=ndt_boundary_conditions_fortran(K,params); 
2 % Kb=ndt_boundary_conditions_fortran(K,params); 
3 % call fortran version and compare results
4 % in:
5 %     K global stiffness matrix ndt14 format
7 m=size(K,4);
8 if m~=14, 
9     error('K must be in ndt 14 storage scheme')
10 end
12 %Writing to file for use by fortran tester
13 write_array_nd(swap23(K),'K');
15 system('./fortran/ndt_boundary_conditions_test.exe');
17 Kb = swap23(read_array_nd('Kb'));
19 % the same in matlab
20 Ks = ndt_convert(K,'sparse');
21 [Ksb,~]=apply_boundary_conditions(Ks,[],{K(:,:,:,1)});
23 % convert to sparse and compare
24 Kbs = ndt_convert(Kb,'sparse');
25 err = big(Ksb - Kbs)
26 if err > eps(single(1.0))*big(Ksb)*10
27     error('error too large')
28 end
29 end