FEATool
v1.8 Finite Element Analysis Toolbox |

solve_hook.m File Reference

SOLVE_HOOK Custom solver hook calling function.

[ A, F, PROB, C_FCN ] = SOLVE_HOOK( A, F, PROB, SOLVE_STEP ) Special solver hook function. Allows for special functions to be called before and after the linear solver to modify the global matrix A and right hand side/load vector F with the information in the finite element problem struct PROB. SOLVE_STEP indicates if the function call is before the linear solver call (=1) or after (=2). The called solver hook function names are returned in the cell array C_FCN.

The solve hook function can be defined as a Neumann boundary condition string (fea.bdr.n entry) as

fea.bdr.n{i_dvar}{j_bdr} = <tt>solve_hook_fcn</tt>;

The function name is specified after the "solve_hook_" string prefix (here called "fcn), where the solve hook function call format is

fcn( A, f, fea, i_dvar, j_bdr, solve_step )

For example, the Navier-Stokes slip boundary conditions are implemented using the solve hook functionality by prescribing

fea.bdr.n{dvar_u}{j_bdr} = <tt>solve_hook_bdrslip</tt>;

for the Neumann BC component in the x-direction. This will cause the solve hook to trigger calling the "bdrslip" function before and after the linear solver.