Merge branch 'fixf'
[wrf-fire-matlab.git] / femwind / w_assembly_fortran.m
bloba935ce6493f83104ab4c6eee3151bdf1b08f95c4
1 function err=w_assembly_fortran(A,X,u0,lambda,params) 
2 % call fortran version and compare results
4 lambda2 = lambda(:);
5 W_m=w_assembly(A,X,u0, lambda2,params);
6 U_m = W_m{1};
7 V_m = W_m{2};
8 W_m = W_m{3};
11 %Writing all arrays to text files for use by fortran tester
12 write_array(A,'A_test');
14 n = size(X{1});
15 lambda=reshape(lambda,n);
16 write_array(swap23(lambda), 'lambda_test');
18 write_array(swap23(X{1}),'X_test');
19 write_array(swap23(X{2}),'Y_test');
20 write_array(swap23(X{3}),'Z_test');
22 write_array(swap23(u0{1}),'u0_test');
23 write_array(swap23(u0{2}),'v0_test');
24 write_array(swap23(u0{3}),'w0_test');
26 system('./fortran/w_assembly_test.exe');
27 U = swap23(read_array('U_test'));
28 V = swap23(read_array('V_test'));
29 W = swap23(read_array('W_test'));
33 err_u = norm(U_m(:) - U(:),inf)
34 err_v = norm(V_m(:) - V(:),inf) 
35 err_w = norm(W_m(:) - W(:),inf) 
36 err   =  max([err_u, err_v, err_w]) 
38 end