On Fri, Oct 16, 2015 at 12:46 PM, Xikai Jiang <jx...@msn.com> wrote: > Dear libMesh developers and users, > > I want to use matrix-free method and am looking into ShellMatrix in > libMesh. To get started, I've looked at the ShellMatrix example in example > 4 under Miscellaneous folder, and got several questions: > > 1. In the example of ShellMatrix, why building the system stiffness > matrix? If we use ShellMatrix, is there a need to explicitly build the > system stiffness matrix? My understanding is, the system stiffness matrix > in this example is used to demonstrate the SumShellMatrix, is it correct? > > If you are referring to miscellanous example 4, that example solves the equation- \Delta u + \int u = 1, and the total stiffness matrix is the sum of the rank-1 matrix induced by the \int u term and the sparse matrix induced by the \Delta u operator.
> 2. If I use only TensorShellMatrix, without SumShellMatrix, I still need > to build RHS in the assemble function and attach it to the EquationSystem, > is it correct? > > 3. In order to build any user-defined mac-vec multiplication, I think we > can create our own userShellMatrix.h and userShellMatrix.C, and define > user-specific vector_mult(), vector_mult_add(), get_diagonal(), m() and > n(), just as TensorShellMatrix and SumShellMatrix did. After this, we > recompile libmesh, then we can start using userShellMatrix, and we don't > need to worry about implementing solving the linear system using > MatShell in PETSc since it's already coded up in libMesh solver, is it > correct? > > 4. The general procedure to use ShellMatrix in my mind is the following: > (take userShellMatrix for example) > > system.attach_assemble_function (assemble); // to build RHS > userShellMatrix<Number> shellMatrix(...); // define mat-vec > multiplication > system.attach_shell_matrix(&shellMatrix); > system.solve(); > system.detach_shell_matrix(); > > Is it correct? > > > Regards, and thanks in advance for any answers. > > Xikai Jiang > Postdoctoral Researcher > Materials Science Division, Argonne National Laboratory > > ------------------------------------------------------------------------------ > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libmesh-users > -- Vikram Garg Postdoctoral Associate Predictive Engineering and Computational Science (PECOS) The University of Texas at Austin http://web.mit.edu/vikramvg/www/ http://vikramvgarg.wordpress.com/ http://www.runforindia.org/runners/vikramg ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users