Custom material Property Matrix

To build a custom material Property Matrix, just derive your own material class from the Material one and override the CalcMaterialPropertyMatrix() method to use your custom values.

public class MyMaterial : Material 
    { 
        public MyMaterial(Color diffuse, double young, double poisson, double yield, double density, double coeffOfThermExp) 
            : base(diffuse, young, poisson, yield, density, coeffOfThermExp) 
        { 
        } 

        public override void CalcMaterialPropertyMatrix(int numberOfDimensions, elementType elType) 
        { 

            double[,] dMat = null; 

            switch (numberOfDimensions) 
            { 
                case 2: 
                    switch (elType) 
                    { 
                        case elementType.PlaneStress: 

                            dMat = new double[3, 3]; 

                            dMat[0, 0] = 1; 
                            dMat[1, 1] = 1; 
                            dMat[0, 1] = 1; 
                            dMat[1, 0] = 1; 
                            dMat[2, 2] = 1; 

                            break; 

                        case elementType.PlaneStrain: 

                            dMat = new double[3, 3]; 

                            dMat[0, 0] = 1; 
                            dMat[1, 1] = 1; 
                            dMat[0, 1] = 1; 
                            dMat[1, 0] = 1; 
                            dMat[2, 2] = 1; 

                            break; 

                        case elementType.Axisymmetric: 

                            dMat = new double[4, 4]; 

                            dMat[0, 0] = 1; 
                            dMat[1, 0] = 1; 
                            dMat[2, 0] = 1; 
                            dMat[0, 1] = 1; 
                            dMat[1, 1] = 1; 
                            dMat[2, 1] = 1; 
                            dMat[0, 2] = 1; 
                            dMat[1, 2] = 1; 
                            dMat[2, 2] = 1; 
                            dMat[3, 3] = 1; 

                            break; 

                    } 

                    break; 

                case 3: 

                    dMat = new double[6, 6]; 

                    dMat[0, 0] = 1; 
                    dMat[1, 1] = 1; 
                    dMat[2, 2] = 1; 
                    dMat[3, 3] = 1; 
                    dMat[4, 4] = 1; 
                    dMat[5, 5] = 1; 
                    dMat[0, 1] = 1; 
                    dMat[1, 0] = 1; 
                    dMat[0, 2] = 1; 
                    dMat[2, 0] = 1; 
                    dMat[1, 2] = 1; 
                    dMat[2, 1] = 1; 

                    break; 
            } 

            D = dMat; 
        } 
    }
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.