# Frequently Asked Questions

1. **How can I debug in the Matlab environment ?**

One option is to type "keyboard" at the place in the code where you want to debug. To continue the debugging type "dbcont" and to quit type "dbquit".

2. **Some of my elements show very strange results. Any ideas of what is wrong ?**

Check the orientation of the elements

3. **I'm solving a heat conduction problem and on one of the boundaries we have convection. How can I handle this ?**

Solve the problems in Chapter 10.

4. **I'm solving a heat conduction problem and on one of the boundaries we have convection. I have solved the problems in chapter 10. The code is not working. Please help me !**

Check if the program works for insulated boundaries, i.e. set the convection coefficient to zero and prescribe the temperature at some parts of the boundary.

5. **The entries in the stiffness matrix seems to be unrealistically large. What is wrong ?**

Check that the elements are assembled once, i.e. Edof(elnr,:) should be the arguments to the assem function. Check the dimensions of the constitutive parameters.

6. **How can I plot the temperature field ?**

Use the extract command to get the nodal temperatures in each element, i.e ed = extract(edof,a). Then use the matlab command 'fill' for plotting, i.e. fill(ex',ey',ed'). Check page 201 in the CALFEM manual for more details.

7. **When solving Ka=f Matlab warns me for the stiffness matrix being close to singular. What is wrong ?**

Check your boundary conditions.

8. **When solving Ka=f Matlab warns me for the stiffness matrix being close to singular. I have checked my boundary conditions MANY times.**

Spy on the stiffness matrix i.e. type spy(K) at the Matlab prompt. Sometimes errors can be identified from this command. Is for example K symmetric ?

9. **When calculating the stresses in a thermo-elastic boundary value problem the stresses seems to be incorrect. Any ideas of what is wrong ?**

Remember that the stresses are related to the **elastic** strains via Hooke's law. When calculating the stresses it is therefore important that you subtract the thermal strains from the total strains when calculating the stresses.

10. **I want to know what happens in a CALFEM routine. How can I do that ?**

Open the m-file or enter "type filename" at the matlab prompt.

11. **When solving a heat conduction problem, I have prescribed temperatures in some nodes. The solve routine asks for the force vector. What should I enter in the force vectorat the positions where the temperature is know ?**

It doesn't matter. Since the temperature is known CALFEM will ignore the force value you enter in that node.

12. **I'm solving a thermo-elastic problem. How can I include the temperature into the mechanical problem ? **

Use the Hooke's law and interpret the temperature expansion as a load term.If you are using triangular elements you can use to CALFEM command plantf.m to to include the temperature load.

13.** I'm trying to do solve the transient temperature problem, how do I calculate the "C-matrix"?**Use the function plantml that is provided on the website.

14. **I get an unrealistic stress distribution in my structure. I use the CALFEM command plants for obtaining the stresses. What is wrong?**Check that plants is called using the following format: es = plants(ex(elnr,:),ey(elnr,:),ep,D,ed(elnr,:)). Here 'es' is the stress for element 'elnr'.

15. **My displacements seems to be OK, but my stresses are very strange.**

We strongly recommend that you use all element routines element-wise. CALFEM accepts a function call [es,et]=plants(Ex,Ey,ep,D,Ed) where Ex, Ey, etc contains all element coordinates. This syntax SHOULD be avoided and we strongly recommend that you use the syntax [es,et]=plants(ex,ey,ep,D,Ed) where ex, ey, etc. refers to one element only.

16. **My stress distribution looks strange, what is wrong ?**

A good idea is to start to plot the displacements using a large magnification factor. Sometimes this reveals what is wrong. The deformed mesh can be plotted using the CALFEM eldisp2 command.

17. **I have created a mesh in Matlab's pdetool. How do this fit with CALFEM?**

Export the mesh and you will have the variables p e t in the Matlab environment.The following lines will translate the mesh into the CALFEM format

nelm=length(t(1,:))

edof(:,1)=1:nelm

edof(:,2:4)=t(1:3,:)'

coord=p' ;

ndof=max(max(t(1:3,:)))

[Ex,Ey]=coordxtr(edof,coord,(1:ndof)',3);

eldraw2(Ex,Ey,[1,4,1])

18. **I have created a mesh in Matlab's pdetool. How can I find the boundaries ?**

The variable 'e' have all the information you need. One of the column in the variable e determines which boundary that segment is associated with.