Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions ElasticMaterial2D.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ISAAR.MSolve.PreProcessor.Interfaces;
using ISAAR.MSolve.Matrices.Interfaces;
using ISAAR.MSolve.Matrices;

namespace ISAAR.MSolve.PreProcessor.Materials
{
public class ElasticMaterial2D : IFiniteElementMaterial2D
{
private readonly double[] strains = new double[3];
private readonly double[] stresses = new double[3];
private double[,] constitutiveMatrix = null;
public double YoungModulus { get; set; }
public double PoissonRatio { get; set; }
public double[] Coordinates { get; set; }

private double[,] GetConstitutiveMatrix()
{

//Panos Plane Stress
//
// [ 1 v 0 ]
// [D] = E/(1-v^2) [ v 1 0 ]
// [ 0 0 (1-v)/2 ]
//

double fE1 = YoungModulus / (1 - PoissonRatio*PoissonRatio);
double fE2 = (1 - PoissonRatio)/2;
double[,] afE = new double[3, 3];
afE[0, 0] = fE1;
afE[0, 1] = fE1 * PoissonRatio;
//afE[0, 2] = 0;
afE[1, 0] = fE1 * PoissonRatio;
afE[1, 1] = fE1;
//afE[1, 2] = 0;
//afE[2, 0] = 0;
//afE[2, 1] = 0;
afE[2, 2] = fE1*fE2;


Vector<double> s = (new Matrix2D<double>(afE)) * (new Vector<double>(strains));
s.Data.CopyTo(stresses, 0);

return afE;
}

#region IFiniteElementMaterial Members

public int ID
{
get { return 1; }
}

public bool Modified
{
get { return false; }
}

public void ResetModified()
{
}

#endregion

#region IFiniteElementMaterial3D Members

public double[] Stresses { get { return stresses; } }

public IMatrix2D<double> ConstitutiveMatrix
{
get
{
if (constitutiveMatrix == null) UpdateMaterial(new double[3]);
return new Matrix2D<double>(constitutiveMatrix);
}
}

public void UpdateMaterial(double[] strains)
{
//throw new NotImplementedException();

strains.CopyTo(this.strains, 0);
constitutiveMatrix = GetConstitutiveMatrix();
}

public void ClearState()
{
//throw new NotImplementedException();
}

public void SaveState()
{
//throw new NotImplementedException();
}

public void ClearStresses()
{
//throw new NotImplementedException();
}

#endregion

#region ICloneable Members

public object Clone()
{
return new ElasticMaterial2D() { YoungModulus = this.YoungModulus, PoissonRatio = this.PoissonRatio };
}

#endregion

}
}
167 changes: 167 additions & 0 deletions GaussQuadrature.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
namespace ISAAR.MSolve.PreProcessor.Elements.SupportiveClasses
{
#region

using System;

#endregion

public class GaussLegendrePoint1D
{
#region Properties

public double Coordinate { get; set; }

public double WeightFactor { get; set; }

#endregion
}

//Panos Input Start
public class GaussLegendrePoint2D
{
#region Constructors and Destructors
public GaussLegendrePoint2D(
double xi, double eta, double[,] deformationMatrix, double weightFactor)
{
this.Xi = xi;
this.Eta = eta;
this.DeformationMatrix = deformationMatrix;
this.WeightFactor = weightFactor;
}
#endregion
#region Properties
// Panos - I rearranged the appearce order - If you dont like it, change it...
public double Xi { get; private set; }
public double Eta { get; private set; }
public double WeightFactor { get; private set; }
public double[,] DeformationMatrix { get; private set; }
//
#endregion
}
//Panos Input End
public class GaussLegendrePoint3D
{
#region Constructors and Destructors

public GaussLegendrePoint3D(
double xi, double eta, double zeta, double[,] deformationMatrix, double weightFactor)
{
this.Xi = xi;
this.Eta = eta;
this.Zeta = zeta;
this.DeformationMatrix = deformationMatrix;
this.WeightFactor = weightFactor;
}

#endregion

#region Properties
// Panos - I rearranged the appearce order - If you dont like it, change it...
public double Xi { get; private set; }
public double Eta { get; private set; }
public double Zeta { get; private set; }
public double WeightFactor { get; private set; }
public double[,] DeformationMatrix { get; private set; }
//
#endregion
}

public class GaussQuadrature
{
/* For point coordinates, we encounter the following constants:
* 0.5773502691896 = 1 / Square Root 3
* 0.7745966692415 = (Square Root 15)/ 5
* 0.8611363115941 = Square Root( (3 + 2*sqrt(6/5))/7)
* 0.3399810435849 = Square Root( (3 - 2*sqrt(6/5))/7)
*
* For the weights, we encounter the followings constants:
* 0.5555555555556 = 5/9
* 0.8888888888889 = 8/9
* 0.3478548451375 = (18 - sqrt30)/36
* 0.6521451548625 = (18 + sqrt30)/36
*/
#region Constants and Fields

private static readonly GaussLegendrePoint1D GaussLegendrePoint1 = new GaussLegendrePoint1D
{
Coordinate = 0.0, WeightFactor = 2.0
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint2A = new GaussLegendrePoint1D
{
Coordinate = -0.5773502691896, WeightFactor = 1.0
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint2B = new GaussLegendrePoint1D
{
Coordinate = 0.5773502691896, WeightFactor = 1.0
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint3A = new GaussLegendrePoint1D
{
Coordinate = -0.7745966692415, WeightFactor = 0.5555555555556
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint3B = new GaussLegendrePoint1D
{
Coordinate = 0.0, WeightFactor = 0.8888888888889
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint3C = new GaussLegendrePoint1D
{
Coordinate = 0.7745966692415, WeightFactor = 0.5555555555556
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint4A = new GaussLegendrePoint1D
{
Coordinate = -0.86113631159416, WeightFactor = 0.3478548451375
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint4B = new GaussLegendrePoint1D
{
Coordinate = -0.3399810435849, WeightFactor = 0.6521451548625
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint4C = new GaussLegendrePoint1D
{
Coordinate = 0.3399810435849, WeightFactor = 0.6521451548625
};

private static readonly GaussLegendrePoint1D GaussLegendrePoint4D = new GaussLegendrePoint1D
{
Coordinate = 0.86113631159416, WeightFactor = 0.3478548451375
};

#endregion

#region Public Methods

public static GaussLegendrePoint1D[] GetGaussLegendrePoints(int integrationDegree)
{
if (integrationDegree < 1)
{
throw new InvalidOperationException("Integration Degree must be greater or equal to 1. ");
}

switch (integrationDegree)
{
case 1:
return new[] { GaussLegendrePoint1 };
case 2:
return new[] { GaussLegendrePoint2A, GaussLegendrePoint2B };
case 3:
return new[] { GaussLegendrePoint3A, GaussLegendrePoint3B, GaussLegendrePoint3C };
case 4:
return new[]
{
GaussLegendrePoint4A, GaussLegendrePoint4B, GaussLegendrePoint4C, GaussLegendrePoint4D
};
default:
throw new NotImplementedException("Integration Degree higher than 4 is not implemented yet. ");
}
}

#endregion
}
}
18 changes: 18 additions & 0 deletions IFiniteElementMaterial2D.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ISAAR.MSolve.Matrices.Interfaces;

namespace ISAAR.MSolve.PreProcessor.Interfaces
{
public interface IFiniteElementMaterial2D : IFiniteElementMaterial
{
double[] Stresses { get; }
IMatrix2D<double> ConstitutiveMatrix { get; }
void UpdateMaterial(double[] strains);
void ClearState();
void SaveState();
void ClearStresses();
}
}
Loading