Mass Matrix Output

<< Click to Display Table of Contents >>

Navigation:  Flexcom > Examples > J - Specialised Examples > J04 - User Solver Variables >

Mass Matrix Output

Previous pageNext page

Overview

Although not part of a formal example, this section provides some sample source code which enables you to write the global mass matrix to the output file. If you would like to try it out...

Create a new project workspace in your developer studio environment. If you are using a recognised IDE (integrated development environment), look for a DLL project template which you can begin working from. This will typically appear under New->Project->Templates->Library or something similar.

Create a new free form file (with .f90 file extension) and add it to the project workspace.

Copy the standard template for the user_solver_variables subroutine and insert it into the file.

Copy the sample source code below and insert it into the subroutine at the appropriate location.

Compile the DLL and link it to your Flexcom simulation via the *USER SOLVER VARIABLES keyword. Ensure that the bitness of your DLL matches that of your Flexcom installation - i.e. if you have a 64-bit version of Flexcom, you should compile a 64-bit DLL.

Source Code

! -------------------------------------------

! Sample code for writing out global matrices

! -------------------------------------------

 

! Declare local variables.

integer :: iout, ielem, user_elem_no, irow, icol

 

! Initialise local variables

 iout = 31

 

! Write out header block

write(iout,fmt="(18x,a,/,a,18x,a)")&

  "*** GLOBAL MASS MATRIX ***", &

  "--------------------------"

   

! Write out current time and current iteration

write(iout,fmt="(/,2x,a,f9.3,a,/,2x,a,i0,/)")"Time: ",time,"s", "Iteration No: ",iter

 

! Loop over elements

 element_loop: do ielem = 1,nelmn

   

  ! Write out element number    

   user_elem_no = ietoue(ielem)

  write(iout,fmt="(/,2x,a,i0,/)")"Element No: ",user_elem_no

   

  ! Loop over the rows

   row_loop: do irow = 1,14

    write(iout,fmt="(14(2x,e11.4))")(mass(irow,icol,ielem),icol=1,14)

  end do row_loop

end do element_loop