##### Personal tools
You are here: Home / Wiki / cm-cmgui

# cm-cmgui

Andre's notes while testing out using CMGUI libraries in a computational problem.

• 1 Outline
• 2 Goals
• 3 Methods
• 4 Notes, problems, and got-ya's
• 5 Outcomes
• 6 Code
 1 Project Outline Develop a test application which solves a static Laplace (e.g., steady state heat distribution) model over a two-dimensional domain with bilinear element interpolation using the CMGUI finite element data structures to store field information. The application will be written in C using the C API to CMGUI.
 2 Project Goals Test the computational performance of using the CMGUI data structures/API versus the direct access arrays currently used in cm. Identify any deficiencies in the current CMGUI API when using the finite element data structures in this application.
 3 Methods Found my old afem project code (written in C) and got that working again for static 2D Laplace. Using CMISS examples 314(1,2,3,4) this code was able to obtain identical solutions as current cm. This code formed the basis of the test application. The first step was to replace the Node and Element structures defined in my afem code with accessing field information from the CMGUI data structures. Access is primarily through the function_finite_element interface. The only field of interest in this example application is the coordinates field, or more specifically the spatial derivatives with respect to local xi at the Gaussian quadrature points. Using the derivatives from the coordinate field at Gauss points (ds/dxi) you can invert to get dxi/ds and assemble the element stiffness matrix. The element stiffness matrix can then be added into the global stiffness matrix where we are still using node numbers/ids as indexes into the global matrix. Once we have the global stiffness matrix, we read in and apply some boundary conditions (using the dodgy file format from my afem project) and then solve the system. This results in a vector u containing the value solution at each node and a vector fluxes containing the weighted nodal flux solutions. The solutions are then put into new fields defined at the nodes (u and fluxes) and interpolated over the elements (u only) and the full mesh written out with all fields.