### Craig Bampton Method

In a previous post, the Craig-Bampton (CB) substructuring method was used in Ansys to simplify a part for reuse. To learn more about what Ansys does in the background, I did some reading up. Here are some good resources:

Resources
Tom Irvine's tutorial papers and Matlab scripts link

Octave/Matlab Scripts
Inspired by Tom's Matlab script, I coded a script to condense two 'random' bodies, keep only 10 modes of each body with 3 nodal interface points between them. The 'random' bodies are positive definite matrix that is generated randomly for each run to represent two mass and stiffness matrices. Running the script again would generate a different system and different plots.

Here are the links to the two Octave/Matlab scripts used to create the plots below:
Main Script: Random2PartsCB.m  link  (run this one)

A run of the script may yield something like Figure 1 below. As only 10  modes were kept of body #1 and 10 additional modes were kept for body #2 as master nodes, the error exceeding 5% occurs right around the 20th mode. This is worth keeping in mind when selecting the master (M) degree of freedom.
Figure 1 - Natural Frequency Error

Three transfer functions are then computed at the 3 connection points comparing the CB System to the original Full System. The results compares well enough.

Figure 2 - Transfer Function comparison

I'm sure there are quite a few bugs in the script but I'm satisfied with the results for now. Two key caveats: damping was ignored and Load Transformation Matrix (LTM) was not used.

All posts on Superelement
Reuse CMS Superelement in Ansys Workbench with Expansion Link
Component Mode Synthesis (CMS) with Results Expansion in Ansys Workbench Link
Component Mode Synthesis(CMS) Substructure in ANSYS Workbench Link

It was pointed out to me that Hurty (1965) first proposed this ideas before Craig (1968).
Hurty, W. C. (1965). Dynamic analysis of structural systems using component modes. AIAA Journal,3(4), 678–685

1. Great web site dear Sze Kwan;
plz can you guide me to achieve my task wich is about extract mass and stiffness matricess from ansys to matlab and performing craig-bamptom method of different dynamic mode. I modeled a wing strcuture and i extracted the both matrices from ansys. Now, i'm discontinued in craig-bamptom method. I have consulted all the links that you have already applied for on this site but I cannot project my idea. plz guide me i'm a PhD in mechanical engineering and i want to do something about flexible body so i chose performing lumped parametr method and finite element method for my wing structure, for LPM i did it well but currently i'm discontinued with the second method and excatly in craig-bamptom method.
Plz help me

1. "can you guide me to achieve my task wich is about extract mass and stiffness matricess from ansys to matlab and performing craig-bamptom method of different dynamic mode"

Hi Atef,

on exporting mass and stiffness matrix to Matlab.

The post here has example scripts needed for an implementation of Craig-Bampton given the mass and stiffness extracted. Tom Irvine's tutorial is an especially useful reference.

2. Dear Sze Kwan;
Just a quick questions:
1---- I extracted mass and stiffness matrices using commands below (obtained from tutorial video of ansys youtube channel)but i obtained the both of matrices (.matrix) file with capacity of 10 Gega Byte!!! that makes sense?????

! below commands create dense matrix

! Stiffness
*DMAT,MatKD,D,IMPORT,FULL,file.full,STIFF
*PRINT,MatKD,Kdense.matrix

! Mass
*DMAT,MatMD,D,IMPORT,FULL,file.full,MASS
*PRINT,MatMD,Mdense.matrix

! below commands create sparse matrix
*SMAT,MatKS,D,IMPORT,FULL,file.full,STIFF
*PRINT,MatKS,Ksparse.matrix

For Mass
*SMAT,MatMS,D,IMPORT,FULL,file.full,MASS
*PRINT,MatMS,Msparse.matrix

2----- For Tom Irvine's tutorial, i used his code matlab wich is about Craig-bamptom putting my matrices but i did not get valid simulation and results!!!

3---- What means please, this description :
'C-B - 3D EB beam model, 3 interface frames, 100 elements, 18 static modes, 10 dynamic modes'
'C-B - 3D EB beam model, 3 interface frames, 100 elements, 30 static modes, 20 dynamic modes'

thank you very much sir :)

1. 1a. You may try *SMAT instead of *DMAT to make it a sparse matrix.
1b. Use *EXPORT instead of *PRINT to take advantage of Matrix Market Format.
1c. Perhaps try first with a very small simple model with few nodes.

2. It worked for me years ago. Sorry I can't trouble shoot from afar.

3. Sorry, I don't know what that means either.

3. hello pls i need the matlab code

### ANSYS User Defined Results

There is an abundant of options in ANSYS classic when one wishes to post process results. ANSYS workbench default pull down menu post processing options are more limited but they can still be accessed via the User Defined Results. One way not commonly used but can come in handy is as follows: Zeroth: Under Analysis Settings, there is "Output Controls" where you can toggle to "Yes" what you would like to save before the solution starts. This is like OUTRES in APDL. Output Controls First: After solving the model, click on Solution in the tree to highlight it. Solution Second: Click on Worksheet in the toolbar. Worksheet Third: In the worksheet, you will see list of results that are saved. Right click on it to create the User Defined Results. Create User Defined Results So here we have it. You could of look up the different expressions in the help document but I find this method of accessing the results convenient.  Example: Aspec

### Export Stiffness Matrix from Ansys

It is sometimes useful to extract the mass and stiffness matrix from Ansys.     *SMAT, MatK, D, IMPORT, FULL, file.full, STIFF       *PRINT, matk, matk, txt Exporting mass matrix would be similar:       *SMAT, MatM, D, import, full, file.full, MASS The above script uses APDL Math to get the job done. (Please see previous post for another example). The ordering of the matrix is unfortunately not concurrently exported. To verify the sequencing is as expected, we will work to replicate a truss example in the  Finite Element Trusses course notes by Bob Greenlee. Figure 1: Truss Problem Setup Model Creation Script to create model: /prep7 !! Creates Model to reflect course notes ! Properties et ,1,1  mp , ex, 1, 29.5e6 r , 1, 1 ! Geometry n ,1 $n ,2, 40$  n ,3, 40, 30 $n ,4, 0, 30 e ,1,2$  e ,2,3 $e ,1,3$  e ,3,4 ! Boundary Conditions d ,1,ux,0 $d ,1,uy,0 d ,2,uy,0 d ,4,ux,0$  d ,4,uy,0 f ,2,fx,20e3 f ,3,fy,-25e3 ! solves /solu eqslv , sparse