You are on page 1of 3

Dr. S.

Rajan CEE432/532 Developing Software for Engineering Applications Name:


Quiz 2 – Version A (Open e-notes only)

Please read the entire quiz before proceeding.

You need to develop a complete computer program that computes three failure criteria given the three-dimensional
state of stress at a point. The source code that you will develop will be in three files –
FirstNameLastNamemain.cpp (this is the client code containing the main function), two server code files -
failurecriteria.h and FirstNameLastNamefailurecriteria.cpp. You will need to use the CVector
template function and RootsCubicPolynomial function that is a part of the library supplied to you. The source
code should be properly formatted (name, date etc. on top of the file, indented code, proper variable names etc.)
and should have adequate comments to explain your algorithm. After you write the program, you will compile, link,
execute and test the program. Finally you will upload the specified files to the BlackBoard web site. You can only
use the class electronic notes and lecture slides. You CANNOT use your personal lecture notes, my sample
programs, your sample programs, etc. You cannot use the internet except at the end to upload the files. Note
FNLN stands for first name last name.

Question (Two files to upload: FNLNmain.cpp, FNLNfailurecriteria.cpp)


A three-dimensional state of stress at a point can be expressed pictorially as shown in Fig. 1.

Fig. 1 3D state of stress

Given the 3D state of stress, various failure criteria can be computed if the limit values are given. You will develop a
function FailureCriteria to compute three failure criteria as mentioned below.

von Mises Criterion: The yielding of an isotropic material takes place when
1
  x   y    y   z    z   x   6  xy2   yz2   zx2  
2
2 2 2
 oct  
2
(1)
3 3

where  oct is known as the octahedral shear stress and  is some limiting value usually taken as the yield stress from a
uniaxial test.

Maximum Principal Stress Criterion Tensile fracture surfaces will form in an isotropic material when the largest
principal tensile stress exceeds some limiting value
1   (2)

1|Page
 is usually taken as the yield stress from a uniaxial test. Note that the principal stresses are typically ordered as
 1   2   3  . This failure criterion is typically applied to brittle material.
Mohr’s Criterion The failure of an isotropic material through fracture or yielding takes place when
1 
 3 1 (3)
( t ) ( c )

where ( t ) and ( c ) are the magnitudes of the stress at failure in uniaxial tensile and compressive tests respectively. The
criterion is usually applied to brittle materials that are much stronger in compression than tension. Note that tension is
assumed to be positive and compression negative.

The three principal stresses,  p , can be computed by computing the (real) roots of the cubic polynomial

 3p  I1 p2  I 2 p  I 3  0 (4)

where

I1   x   y   z (4a)

I 2   x y   x z   y z   xy2   yz2   xz2 (4b)

 x  xy  xz
 y  yz  xy  xz  xy  xz
I 3   xy  y  yz   x   xy   xz (4c)
 yz  z  yz  z  y  yz
 xz  yz  z

where I3 is the determinant of the 3x3 matrix and one way of computing the determinant is shown on the right side of the
equation.

The source code to the RootsCubicPolynomial function is in the file failurecriteria.cpp. The prototype of
the FailureCriteria function is as follows.
bool FailureCriteria (FC FCType, 
                      const CVector<double>& dVStress, const CVector<double>& dVAS, 
                      CVector<double>& dVOutput); 

Note that
enum FC {MISES, PSTRESS, MOHR};

The inputs to the function are


(1) the failure criterion type that is being checked,
(2) the vector of stress values representing the state of stress at the point in question,
(3) the limiting or allowable values used in the Eqns. (1)-(3),

The output from the function is contained in the last argument and is
(4) the vector containing computed values as follows – principal stress 1, principal stress 2,
principal stress 3, octahedral shear stress and Mohr’s criterion.

The return value is true if the specified failure criterion is met, otherwise it is false.
2|Page
The failurecriteria header file is as follows (you cannot edit this file):

#ifndef _FAILURECRITERIA_H__ 
#define _FAILURECRITERIA_H__ 
 
#include "vectortemplate.h" 
#include "matrixtemplate.h" 
 
enum FC {MISES, PSTRESS, MOHR}; 
bool FailureCriteria (FC FCType, 
                      const CVector<double>& dVStress, const CVector<double>& dVAS, 
                      CVector<double>& dVOutput); 
int RootsCubicPolynomial (CVector<double>& dVCoef,  
                          CVector<double>& dVRoots); 
 
#endif

Develop the client code (e.g., in FNLNmain.cpp) to test the FailureCriteria function. A sample client code is
shown below. Note it is an incomplete code. You may want to test your program using multiple test cases.
….
#include "failurecriteria.h" 
#include "vectortemplate.h"

….
int main () 

    const int NUMCOMPONENTS = 6; 
    CVector<double> dVStress(NUMCOMPONENTS), dVSA(2), dVOutput(5); 

    FC FCType = PSTRESS; 
    bool bHasFailed = FailureCriteria (FCType, dVStress, dVSA, dVOutput); 

// show the output on the screen

return 0;
}

A sample screen output is shown below.

3|Page

You might also like