separated femwind_solve from femwind_main
[wrf-fire-matlab.git] / femwind / femwind_solve.m
blob918ae305b3fe03ed92392709a1f6cd811420d8a4
1 function [W,rate]=femwind_solve(A,X,U0,params)
2     % assemble sparse system matrix
3     nel=size(X{1})-1;
4     lambda = zeros(prod(nel+1),1); % placeholder solution
5     [K,F,~] = sparse_assembly(A,X,U0,lambda,params);
7     % dirichlet boundary conditions
8     [K,~]=apply_boundary_conditions(K,[],X);   % to K - once
9     [~,F]=apply_boundary_conditions([],F,X);   % to F - every time
11     % solve the equations
12     % [lambda,it] = sparse_solve(K,F,X,'s');
13     [lambda,it,rate,XC] = sparse_solve(K,F,X,params);
14     format long
15     rate
17     % assemble final wind
18     [~,~,W] = sparse_assembly(A,X,U0,lambda,params);
19 end