Mathematica code

H* CLEAR EVERYTHING *L
ClearAll@"Global`*"D;
Needs@"PlotLegends`"D;
H* ============================================== *L
H* GAUSS RULE INFO MODULE HTAKEN FROM QuadSOR.nbL *L
H* ============================================== *L
QuadGaussRuleInfo@8rule_, numer_<, point_D :=
Module@8Ξ, Η, p1, p2, i, j, w1, w2, m, info = 88Null, Null<, 0<<,
If@Length@ruleD Š 2, 8p1, p2< = rule, p1 = p2 = ruleD;
If@p1 < 0, Return@QuadNonProductGaussRuleInfo@8-p1, numer<, pointDDD;
If@Length@pointD Š 2, 8i, j< = point, m = point;
j = Floor@Hm - 1L  p1D + 1; i = m - p1 * Hj - 1LD;
8Ξ, w1< = LineGaussRuleInfo@8p1, numer<, iD;
8Η, w2< = LineGaussRuleInfo@8p2, numer<, jD;
info = 88Ξ, Η<, w1 * w2<;
If@numer, Return@N@infoDD, Return@Simplify@infoDDD;D;
LineGaussRuleInfo@8rule_, numer_<, point_D :=
Module@8g2 = 8-1, 1<  Sqrt@3D, w3 = 85  9, 8  9, 5  9<, g3 = 8-Sqrt@3  5D, 0, Sqrt@3  5D<, w4 =
8H1  2L - Sqrt@5  6D  6, H1  2L + Sqrt@5  6D  6, H1  2L + Sqrt@5  6D  6, H1  2L - Sqrt@5  6D  6<,
g4 = 8-Sqrt@H3 + 2 * Sqrt@6  5DL  7D, -Sqrt@H3 - 2 * Sqrt@6  5DL  7D,
Sqrt@H3 - 2 * Sqrt@6  5DL  7D, Sqrt@H3 + 2 * Sqrt@6  5DL  7D<, g5 = 8-Sqrt@5 + 2 * Sqrt@10  7DD,
-Sqrt@5 - 2 * Sqrt@10  7DD, 0, Sqrt@5 - 2 * Sqrt@10  7DD, Sqrt@5 + 2 * Sqrt@10  7DD<  3,
w5 = 8322 - 13 * Sqrt@70D, 322 + 13 * Sqrt@70D, 512, 322 + 13 * Sqrt@70D, 322 - 13 * Sqrt@70D<  900,
i = point, p = rule, info = 8Null, 0<<, If@p Š 1, info = 80, 2<D;
If@p Š 2, info = 8g2@@iDD, 1<D;
If@p Š 3, info = 8g3@@iDD, w3@@iDD<D;
If@p Š 4, info = 8g4@@iDD, w4@@iDD<D;
If@p Š 5, info = 8g5@@iDD, w5@@iDD<D;
If@numer, Return@N@infoDD, Return@Simplify@infoDDD;D;
H* SHAPE FUNCTION DERIVATIVES MODULE *L
Quad4HRRingShapeFunDer@ncoor_, qcoor_, Jcons_D := Module@
8 r1, r2, r3, r4, z1, z2, z3, z4, Ξ, Η, Nf, dNr, dNz, A0, A1, A2, Jdet<,
88r1, z1<, 8r2, z2<, 8r3, z3<, 8r4, z4<< = ncoor; 8Ξ, Η< = qcoor;
Nf = 8H1 - ΞL * H1 - ΗL, H1 + ΞL * H1 - ΗL, H1 + ΞL * H1 + ΗL, H1 - ΞL * H1 + ΗL<  4;
A0 = HHr3 - r1L * Hz4 - z2L - Hr4 - r2L * Hz3 - z1LL  2;
A1 = HHr3 - r4L * Hz1 - z2L - Hr1 - r2L * Hz3 - z4LL  2;
A2 = HHr2 - r3L * Hz1 - z4L - Hr1 - r4L * Hz2 - z3LL  2;
Jdet = HA0 + A1 * Ξ + A2 * ΗL  4; If @Jcons, Jdet = A0  4D;
dNr = 8z2 - z4 + Hz4 - z3L * Ξ + Hz3 - z2L * Η, z3 - z1 + Hz3 - z4L * Ξ + Hz1 - z4L * Η,
z4 - z2 + Hz1 - z2L * Ξ + Hz4 - z1L * Η, z1 - z3 + Hz2 - z1L * Ξ + Hz2 - z3L * Η<  H8 * JdetL;
dNz = 8r4 - r2 + Hr3 - r4L * Ξ + Hr2 - r3L * Η, r1 - r3 + Hr4 - r3L * Ξ + Hr4 - r1L * Η,
r2 - r4 + Hr2 - r1L * Ξ + Hr1 - r4L * Η, r3 - r1 + Hr1 - r2L * Ξ + Hr3 - r2L * Η<  H8 * JdetL;
Return@8Nf, dNr, dNz, Jdet<D
D;
Quad4IsoPRingShapeFunDer@ncoor_, qcoor_, Jcons_D :=
Module@8r1, r2, r3, r4, z1, z2, z3, z4, Ξ, Η, Nf, dNr, dNz, A0, A1, A2, Jdet<,
88r1, z1<, 8r2, z2<, 8r3, z3<, 8r4, z4<< = ncoor; 8Ξ, Η< = qcoor;
Nf = 8H1 - ΞL * H1 - ΗL, H1 + ΞL * H1 - ΗL, H1 + ΞL * H1 + ΗL, H1 - ΞL * H1 + ΗL<  4;
A0 = HHr3 - r1L * Hz4 - z2L - Hr4 - r2L * Hz3 - z1LL  2;
A1 = HHr3 - r4L * Hz1 - z2L - Hr1 - r2L * Hz3 - z4LL  2;
A2 = HHr2 - r3L * Hz1 - z4L - Hr1 - r4L * Hz2 - z3LL  2;
Jdet = HA0 + A1 * Ξ + A2 * ΗL  4; If@Jcons, Jdet = A0  4D;
dNr = 8z2 - z4 + Hz4 - z3L * Ξ + Hz3 - z2L * Η, z3 - z1 + Hz3 - z4L * Ξ + Hz1 - z4L * Η,
z4 - z2 + Hz1 - z2L * Ξ + Hz4 - z1L * Η, z1 - z3 + Hz2 - z1L * Ξ + Hz2 - z3L * Η<  H8 * JdetL;
dNz = 8r4 - r2 + Hr3 - r4L * Ξ + Hr2 - r3L * Η, r1 - r3 + Hr4 - r3L * Ξ + Hr4 - r1L * Η,
r2 - r4 + Hr2 - r1L * Ξ + Hr1 - r4L * Η, r3 - r1 + Hr1 - r2L * Ξ + Hr3 - r2L * Η<  H8 * JdetL;
Return@8Nf, dNr, dNz, Jdet<DD;
H* =========================================================Š= *L
H* ELEMENTAL STIFFNESS MATRIX MODULE HMODIFIED QuadSOR.nb CODE *L
2
quad4HR_v4.nb
H* ELEMENTAL STIFFNESS MATRIX MODULE HMODIFIED QuadSOR.nb CODE *L
H* =========================================================Š= *L
Quad4HRRingStiffness@ncoor_, Emat_, options_D := Module@
8p = 2, numer = False, Jcons = False, Kfac = 1, qcoor, k, rk, zk, w, c,
r1, r2, r3, r4, z1, z2, z3, z4, r0, z0, rBar, zBar, Nf, N1, N2, N3, N4,
A0, Jdet, Be, Cmat, dNr1, dNr2, dNr3, dNr4, dNz1, dNz2,
dNz3, dNz4, Ke, Ge, Fe, Finv, Ke0 = Table@0, 88<, 88<D,
modname = "Quad4HRRingStiffness: "<,
r0 = Mean@8r1, r2, r3, r4<D;
z0 = Mean@8z1, z2, z3, z4<D;
Cmat = Inverse@EmatD;
If @Length@optionsD == 1, 8numer< = optionsD;
If @Length@optionsD == 2, 8numer, p< = optionsD;
If @Length@optionsD == 3, 8numer, p, Jcons< = optionsD;
If @Length@optionsD == 4, 8numer, p, Jcons, Kfac< = optionsD;
If @p < 1 ÈÈ p > 5, Print@modname, "illegal p:", pD; Return@Ke0DD;
88r1, z1<, 8r2, z2<, 8r3, z3<, 8r4, z4<< = ncoor;
A0 = HHr3 - r1L * Hz4 - z2L - Hr4 - r2L * Hz3 - z1LL  2;
If @numer && HA0 <= 0L, Print@modname, "Neg or zero area"D;
Return@Ke0DD; Ke = Ke0;
S = Table@0, 84<, 87<D;
Ge = Table@0, 87<, 88<D;
Fe = Table@0, 87<, 87<D;
For @k = 1, k <= p * p, k ++,
8qcoor, w< = QuadGaussRuleInfo@8p, numer<, kD;
8Nf, 8dNr1, dNr2, dNr3, dNr4<, 8dNz1, dNz2, dNz3, dNz4<,
Jdet< = Quad4HRRingShapeFunDer@ncoor, qcoor, JconsD;
If @numer && HJdet <= 0L, Print@modname, "Neg or zero",
" Gauss point Jacobian at k=", kD; Return@Ke0DD;
8N1, N2, N3, N4< = Nf;
rk = r1 * N1 + r2 * N2 + r3 * N3 + r4 * N4;
zk = z1 * N1 + z2 * N2 + z3 * N3 + z4 * N4;
rBar = rk - r0;
zBar = zk - z0;
S = 881, 0, 0, rBar, zBar, 0, 0<,
80, 1, -zBar  rk, 0, 0, rBar, -Hrk + rBarL * zBar  rk<,
81, 0, 0, rk + rBar, zBar, 0, 0<,
80, 0, 1, 0, 0, 0, rBar<<;
Be = 88 dNr1, 0, dNr2, 0, dNr3, 0, dNr4, 0<,
8 0, dNz1, 0, dNz2, 0, dNz3, 0, dNz4<,
8N1  rk, 0, N2  rk, 0, N3  rk, 0, N4  rk, 0<,
8 dNz1, dNr1, dNz2, dNr2, dNz3, dNr3, dNz4, dNr4<<;
c = Kfac * w * rk * Jdet; If @numer, Be = N@BeD; c = N@cDD;
Ge += c * [email protected];
Fe += c * [email protected];
D;
Ke = [email protected]@FeD.GeL;
ClearAll@Ke0, BeD; Return@KeD D;
Quad4IsoPRingStiffness@ncoor_, Emat_, options_D :=
Module@8p = 2, numer = False, Jcons = False, Kfac = 1, qcoor, k, rk, w, c, r1, r2, r3, r4,
z1, z2, z3, z4, Nf, N1, N2, N3, N4, A0, Jdet, Be, dNr1, dNr2, dNr3, dNr4, dNz1, dNz2,
dNz3, dNz4, Ke,
,
<,
quad4HR_v4.nb
z1, z2, z3, z4, Nf, N1, N2, N3, N4, A0, Jdet, Be, dNr1, dNr2, dNr3, dNr4, dNz1, dNz2,
dNz3, dNz4, Ke, Ke0 = Table@0, 88<, 88<D, modname = "Quad4IsoPRingStiffness: "<,
If@Length@optionsD Š 1, 8numer< = optionsD;
If@Length@optionsD Š 2, 8numer, p< = optionsD;
If@Length@optionsD Š 3, 8numer, p, Jcons< = optionsD;
If@Length@optionsD Š 4, 8numer, p, Jcons, Kfac< = optionsD;
If@p < 1 ÈÈ p > 5, Print@modname, "illegal p:", pD; Return@Ke0DD;
88r1, z1<, 8r2, z2<, 8r3, z3<, 8r4, z4<< = ncoor;
A0 = HHr3 - r1L * Hz4 - z2L - Hr4 - r2L * Hz3 - z1LL  2;
If@numer && HA0 £ 0L, Print@modname, "Neg or zero area"D;
Return@Ke0DD; Ke = Ke0;
For@k = 1, k £ p * p, k ++, 8qcoor, w< = QuadGaussRuleInfo@8p, numer<, kD;
8Nf, 8dNr1, dNr2, dNr3, dNr4<, 8dNz1, dNz2, dNz3, dNz4<, Jdet< =
Quad4IsoPRingShapeFunDer@ncoor, qcoor, JconsD;
If@numer && HJdet £ 0L, Print@modname, "Neg or zero",
" Gauss point Jacobian at k=", kD; Return@Ke0DD;
8N1, N2, N3, N4< = Nf; rk = r1 * N1 + r2 * N2 + r3 * N3 + r4 * N4;
Be = 88dNr1, 0, dNr2, 0, dNr3, 0, dNr4, 0<, 80, dNz1, 0, dNz2, 0, dNz3, 0, dNz4<, 8N1  rk, 0,
N2  rk, 0, N3  rk, 0, N4  rk, 0<, 8dNz1, dNr1, dNz2, dNr2, dNz3, dNr3, dNz4, dNr4<<;
c = Kfac * w * rk * Jdet; If@numer, Be = N@BeD; c = N@cDD;
Ke += c * [email protected];D; ClearAll@Ke0, BeD; Return@KeDD;
Quad4IsoPSRIRingStiffness@ncoor_, Emat_, options_D :=
Module@8p = 2, pSRI = p - 1, numer = False, Jcons = False, Kfac = 1, qcoor, k, rk, w,
c, r1, r2, r3, r4, z1, z2, z3, z4, Nf, N1, N2, N3, N4, A0, Jdet, Be, dNr1, dNr2,
dNr3, dNr4, dNz1, dNz2, dNz3, dNz4, Ev, Ed, Ke, KeV, KeD, Ke0 = Table@0, 88<, 88<D,
modname = "Quad4IsoPRingStiffness: "<, If@Length@optionsD Š 1, 8numer< = optionsD;
If@Length@optionsD Š 2, 8numer, p< = optionsD;
If@Length@optionsD Š 3, 8numer, p, Jcons< = optionsD;
If@Length@optionsD Š 4, 8numer, p, Jcons, Kfac< = optionsD;
If@p < 1 ÈÈ p > 5, Print@modname, "illegal p:", pD; Return@Ke0DD;
88r1, z1<, 8r2, z2<, 8r3, z3<, 8r4, z4<< = ncoor;
A0 = HHr3 - r1L * Hz4 - z2L - Hr4 - r2L * Hz3 - z1LL  2;
If@numer && HA0 £ 0L, Print@modname, "Neg or zero area"D;
Return@Ke0DD; Ke = Ke0; KeV = Ke0; KeD = Ke0;
H* Volumetric part KeV *L
Ev = Emat@@1DD;
For@k = 1, k £ p * p, k ++, 8qcoor, w< = QuadGaussRuleInfo@8p, numer<, kD;
8Nf, 8dNr1, dNr2, dNr3, dNr4<, 8dNz1, dNz2, dNz3, dNz4<, Jdet< =
Quad4IsoPRingShapeFunDer@ncoor, qcoor, JconsD;
If@numer && HJdet £ 0L, Print@modname, "Neg or zero",
" Gauss point Jacobian at k=", kD; Return@Ke0DD;
8N1, N2, N3, N4< = Nf; rk = r1 * N1 + r2 * N2 + r3 * N3 + r4 * N4;
Be = 88dNr1, 0, dNr2, 0, dNr3, 0, dNr4, 0<, 80, dNz1, 0, dNz2, 0, dNz3, 0, dNz4<, 8N1  rk, 0,
N2  rk, 0, N3  rk, 0, N4  rk, 0<, 8dNz1, dNr1, dNz2, dNr2, dNz3, dNr3, dNz4, dNr4<<;
c = Kfac * w * rk * Jdet; If@numer, Be = N@BeD; c = N@cDD;
KeV += c * [email protected];D;
H* Deviatoric part KeD *L
Ed = Emat@@2DD;
For@k = 1, k £ pSRI * pSRI, k ++, 8qcoor, w< = QuadGaussRuleInfo@8pSRI, numer<, kD;
8Nf, 8dNr1, dNr2, dNr3, dNr4<, 8dNz1, dNz2, dNz3, dNz4<, Jdet< =
Quad4IsoPRingShapeFunDer@ncoor, qcoor, JconsD;
If@numer && HJdet £ 0L, Print@modname, "Neg or zero",
" Gauss point Jacobian at k=", kD; Return@Ke0DD;
8N1, N2, N3, N4< = Nf; rk = r1 * N1 + r2 * N2 + r3 * N3 + r4 * N4;
Be = 88dNr1, 0, dNr2, 0, dNr3, 0, dNr4, 0<, 80, dNz1, 0, dNz2, 0, dNz3, 0, dNz4<, 8N1  rk, 0,
N2  rk, 0, N3  rk, 0, N4  rk, 0<, 8dNz1, dNr1, dNz2, dNr2, dNz3, dNr3, dNz4, dNr4<<;
c = Kfac * w * rk * Jdet; If@numer, Be = N@BeD; c = N@cDD;
KeD += c * [email protected];D;
Ke = KeV + KeD;
ClearAll@Ke0, BeD; Return@KeDD;
3
4
quad4HR_v4.nb
H* =========================================================================Š *L
H* SOLVE THE AXISYMMETRIC RING ELEMENT PROBLEMS WITH DIFFERENT CONFIGURATIONS *L
H* =========================================================================Š *L
RingSolver@Emat_, p_, P_, a_, b_, d_, Ner_,
Nez_, etype_, nodeForces_, knownDispIndsInput_D := Module@8
nnod, nele, nnodr, nnodz, dr, dz, k, ncoorAll, rcoorAll,
zcoorAll, i, j, connect, q, ID, options,
numer, Jcons, nc1, nc2, nc3, nc4, ncoor, Ke, map, globNod,
Kg, rNum, cNum, knownDispInds, lenKnownDisp,
nodeForcesReduced, KgReduced, oneVec, dropInd, uReduced,
insInd, ur, uz, u, urPlotList, uzPlotList<,
H* total number of nodes and elements *L
nnod = HNer + 1L * HNez + 1L; nele = Ner * Nez;
nnodr = Ner + 1; nnodz = Nez + 1;
H* loop to define nodal coordinates *L
dr = Hb - aL  Ner;
dz = d  Nez;
k = 1;
ncoorAll = Table@0, 8nnod<, 81<D;
rcoorAll = Table@0, 8nnod<, 81<D;
zcoorAll = Table@80, 0<, 8nnod<, 81<D;
For@i = 1, i £ nnodr, i ++,
For@j = 1, j £ nnodz, j ++,
rcoorAll@@kDD = a + Hi - 1L * dr;
zcoorAll@@kDD = Hj - 1L * dz;
ncoorAll@@kDD = 8rcoorAll@@kDD, zcoorAll@@kDD<;
k ++;
D;
D;
H* define the connectivity and
an ID matrix to detrmine row and colummn location in Kg *L
connect = Table@80, 0, 0, 0<, 8nele<, 81<D;
q = 0;
For@k = 1, k £ nele, k ++,
connect@@kDD = 8q + k, q + k + Nez + 1, q + k + Nez + 2, q + k + 1<;
If@IntegerQ@k  NezD, q ++, ContinueD;
D;
ID = Table@80, 0<, 8nnod<, 81<D;
For@k = 1, k £ nnod, k ++,
ID@@kDD = 82 * k - 1, 2 * k<;
D;
H* options set to be used in calling elemental stiffness module *L
options = 8numer = True, p, Jcons = False, 1<;
H* compute the elemental stiffness matrix *L
Ke = Table@Table@0, 82 * 4<, 82 * 4<D, 8nele<, 81<D;
For@k = 1, k £ nele, k ++,
H* nodal coordinates *L
nc1 = ncoorAll@@connect@@kDD@@1DDDD;
nc2 = ncoorAll@@connect@@kDD@@2DDDD;
nc3 = ncoorAll@@connect@@kDD@@3DDDD;
nc4 = ncoorAll@@connect@@kDD@@4DDDD;
ncoor = 8nc1, nc2, nc3, nc4<;
H*Print@"Nodal coordinates for element ",k," = ",ncoorMatrixFormD;*L
H* compute the elemental stiffness matrix *L
If@etype == "HR", Ke@@kDD = Quad4HRRingStiffness@ncoor, Emat, optionsDD;
If@etype == "ISOP", Ke@@kDD = Quad4IsoPRingStiffness@ncoor, Emat, optionsDD;
If@etype == "ISOPSRI", Ke@@kDD = Quad4IsoPSRIRingStiffness@ncoor, Emat, optionsDD;
D;
quad4HR_v4.nb
If@etype == "ISOPSRI", Ke@@kDD = Quad4IsoPSRIRingStiffness@ncoor, Emat, optionsDD;
D;
H* determine where Ke entries fit into Kg *L
map = Table@0, 8nele<, 82 * 4<D;
For@i = 1, i £ nele, i ++,
For@j = 1, j £ 4, j ++,
globNod = connect@@i, jDD;
map@@i, 2 * j - 1DD = ID@@globNod, 1DD;
map@@i, 2 * jDD = ID@@globNod, 2DD;
D;
D;
H* assemble global stiffness matrix *L
Kg = Table@0, 82 * nnod<, 82 * nnod<D;
For@k = 1, k £ nele, k ++, H* loop over elements *L
For@i = 1, i £ 8, i ++,
For@j = 1, j £ 8, j ++,
H* row number *L
rNum = map@@k, iDD;
H* column number *L
cNum = map@@k, jDD;
H* assembly step *L
Kg@@rNum, cNumDD += Ke@@kDD@@i, jDD;
D;
D;
D;
H* ------------------------------------------------------------------- *L
H* REDUCE THE STIFFNESS MATRIX FOR THE BOUNDARY CONDITIONS GIVEN BELOW *L
H* ------------------------------------------------------------------- *L
H* now remove the appropriate rows and columns from Kg and nodeForces *L
KgReduced = Kg;
nodeForcesReduced = nodeForces;
knownDispInds = knownDispIndsInput;
lenKnownDisp = Dimensions@knownDispIndsD@@1DD;
oneVec = Table@1, 8lenKnownDisp<D;
For@k = 1, k £ lenKnownDisp, k ++,
dropInd = knownDispInds@@kDD;
KgReduced = Drop@KgReduced, 8dropInd, dropInd<, 8dropInd, dropInd<D;
nodeForcesReduced = Drop@nodeForcesReduced, 8dropInd, dropInd<D;
knownDispInds = knownDispInds - oneVec;
D;
H* SOLVE THE SYSTEM OF EQUATIONS *L
uReduced = LinearSolve@KgReduced, nodeForcesReducedD;
H* Print@"Reduced Displacement Vector = ",uReducedMatrixFormD; *L
H* Insert zeroed displacements back into displacement vector for plotting *L
u = uReduced;
For@k = lenKnownDisp, k ³ 1, k --,
knownDispInds = knownDispInds + oneVec;
insInd = knownDispInds@@kDD;
u = Insert@u, 0, insIndD;
D;
H* Print@"Displacements Including BC data = ",uMatrixFormD; *L
H* separate u into ur and uz *L
ur = Table@0, 8nnod<D;
uz = Table@0, 8nnod<D;
For@k = 1, k £ nnod, k ++,
ur@@kDD = u@@2 * k - 1DD;
;
5
6
quad4HR_v4.nb
ur@@kDD = u@@2 * k - 1DD;
uz@@kDD = u@@2 * kDD;
D;
H* PLOT RESULTS ALONG THE
MIDPLANE: ***** Nez MUST BE AN EVEN NUMBER FOR THIS TO WORK! ***** *L
H* must define plot lists contining midpoint
displacement values and nodal coordinates Honly vs r is necessaryL *L
urPlotList = Table@0, 8nnodr<, 82<D;
uzPlotList = Table@0, 8nnodr<, 82<D;
q = 1;
For@k = HNez  2 + 1L, k £ nnod, k += nnodz,
urPlotList@@q, 1DD = rcoorAll@@kDD;
urPlotList@@q, 2DD = ur@@kDD;
uzPlotList@@q, 1DD = rcoorAll@@kDD;
uzPlotList@@q, 2DD = uz@@kDD;
q ++;
D;
H* return some values for plotting and further analysis *L
returnValues = Table@0, 85<D;
returnValues = 8rcoorAll, ur, uz, urPlotList, uzPlotList<;
Return@returnValuesD;
D;
H* =============== *L
H* PLOTTING MODULE *L
H* =============== *L
multiPlot@w_, uzPlotListHR_, uzPlotListSRI_, uzPlotListISOP_D :=
Module@8step, wList, rList, wPlotList, compPlot<,
step = 0.1;
wList = Table@N@wD, 8r, a, b, step<D;
rList = Table@r, 8r, a, b, step<D;
wPlotList = Table@0, 82<, 81  step<D;
wPlotList@@1DD = rList;
wPlotList@@2DD = wList;
wPlotList = Transpose@wPlotListD;
compPlot = ListLinePlot@8wPlotList, uzPlotListHR, uzPlotListSRI, uzPlotListISOP<,
PlotStyle ® [email protected],
PlotLegend -> 8"Analytical", "HR", "Iso-P with SRI", "Standard Iso-P"<,
LegendShadow ® None,
LegendSize ® 81, .5<,
LegendPosition ® 80.7, -.25<,
PlotLabel ® "Element Comparison: Midplane z displacement",
AxesLabel ® 8"r", "wHrL"<
D;
Return@compPlotD;
D
H* ================================================= *L
H* SIMPLY SUPPRTED PLATE SUBJECTED TO BENDING MOMENT *L
H* ================================================= *L
H* define material properties *L
Ym = 70 * 10 ^ 9; H* Young's modulus for Aluminum *L
nu = 0.35;
H* Poisson's ration for Aluminum *L
H*Ym=1000;
nu=H13L;*L
H* define the material matrix for plane stress *L
Emat = HYm  HH1 + nuL * H1 - 2 * nuLLL *
;
quad4HR_v4.nb
Emat = HYm  HH1 + nuL * H1 - 2 * nuLLL *
881 - nu, nu, nu, 0<, 8nu, 1 - nu, nu, 0<, 8nu, nu, 1 - nu, 0<, 80, 0, 0, 0.5 * H1 - 2 * nuL<<;
H* number of Gauss points *L
p = 2;
H* plate inner radius a, outer radius b, and thickness d *L
a = 0; b = 5; d = 1;
H* number of elements in the r and z direction *L
Ner = 2; Nez = 2;
H* total number of nodes and elements *L
nnod = HNer + 1L * HNez + 1L; nele = Ner * Nez;
nnodr = Ner + 1; nnodz = Nez + 1;
H* Force *L
P = 10 000 000;
H* force vector *L
nodeForces = Table@0, 82 * nnod<D;
nodeForces@@2 * nnod - 1DD = P;
nodeForces@@2 * nnod - 2 * nnodz + 1DD = -P;
H* displacement vector will be of the form 88u1x<,8u1y<,8u2x<,8u2y<,.....< *L
H* The center nodes will have displacements constrained in the r direction. The
outer node in the midplane will have displacement constrained in the z direction
for the simply supported case Hthis requires an even number of elementsL. These
boundary conditions allow us to cross out rows and columns in the stiffness
matrix to reduce the size of the linear equation system. ID numbers of the
nodal quantities that are zeroed must be recorded for plotting purposes later,
and to track which nodes the values in the returned displacement vector correspond to. *L
H* indeces of displacements to be zeroed: *L
knownDispInds = Table@0, 8nnodz + 2<D;
H* center nodes *L
q = 1;
For@k = 1, k £ H2 * nnodzL, k = k + 2,
knownDispInds@@qDD = k;
q ++;
D;
H* outer center node *L
knownDispInds@@qDD = 2 * nnod - nnodz; q ++;
knownDispInds@@qDD = knownDispInds@@q - 1DD + 1;
H* RESULT USING HR WITH 7 STRESS PARAMETERS *L
8rcoorAllHR, urHR, uzHR, urPlotListHR, uzPlotListHR< =
RingSolver@Emat, p, P, a, b, d, Ner, Nez, "HR", nodeForces, knownDispIndsD;
H* SRI ISO-P RESULT *L
H* need to define volumetric and deviatoric material matrices *L
Ed = Ym * nu  HH1 + nuL * H1 - 2 * nuLL * 881, 1, 1, 0<, 81, 1, 1, 0<, 81, 1, 1, 0<, 80, 0, 0, 0<<;
Ev = Ym  H2 * H1 + nuLL * 882, 0, 0, 0<, 80, 2, 0, 0<, 80, 0, 2, 0<, 80, 0, 0, 1<<;
EmatSRI = 8Ed, Ev<;
8rcoorAllSRI, urSRI, uzSRI, urPlotListSRI, uzPlotListSRI< =
RingSolver@EmatSRI, p, P, a, b, d, Ner, Nez, "ISOPSRI", nodeForces, knownDispIndsD;
H* STANDARD ISO-P RESULT *L
8rcoorAllISOP, urISOP, uzISOP, urPlotListISOP, uzPlotListISOP< =
RingSolver@Emat, p, P, a, b, d, Ner, Nez, "ISOP", nodeForces, knownDispIndsD;
H* ANALYTICAL SOLUTION: Plate with no hole in center *L
Dc = HYm * d ^ 3L  H12 * H1 - nu ^ 2LL;
M = P * d  b;
row = r  b;
7
8
quad4HR_v4.nb
row = r  b;
C1 = 1 - row ^ 2;
w = HM * b ^ 2L  H2 * Dc * H1 + nuLL * C1;
compPlot = multiPlot@w, uzPlotListHR, uzPlotListSRI, uzPlotListISOPD;
Print@"===== Simply Supported Plate With Edge Moment ====="D;
Show@compPlotD
===== Simply Supported Plate With Edge Moment =====
Element Comparison: Midplane z displacement
wHrL
0.0025
Analytical
0.0020
HR
0.0015
Iso-P with SRI
0.0010
Standard Iso-P
0.0005
1
2
3
4
5
r
quad4HR_v4.nb
H* ====================================Š= *L
H* SIMPLY SUPPORTED PLATE WITH POINT LOAD *L
H* ====================================Š= *L
H* NOTE: Many definitions are carried over from
previous case Hgeometry, number of gauss points, Emat, etcL.
If different definitions are desired they must be stated below. *L
H* Force *L
Ppl = P  H2 * PiL; H* for point load case divide by 2*pi *L
H* force vector *L
nodeForces = Table@0, 82 * nnod<D;
nodeForces@@2 * nnodzDD = Ppl;
H* RESULT USING HR, SRI, AND ISO-P *L
8rcoorAllHR, urHR, uzHR, urPlotListHR, uzPlotListHR< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "HR", nodeForces, knownDispIndsD;
8rcoorAllSRI, urSRI, uzSRI, urPlotListSRI, uzPlotListSRI< =
RingSolver@EmatSRI, p, Ppl, a, b, d, Ner, Nez, "ISOPSRI", nodeForces, knownDispIndsD;
8rcoorAllISOP, urISOP, uzISOP, urPlotListISOP, uzPlotListISOP< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "ISOP", nodeForces, knownDispIndsD;
H* ANALYTICAL SOLUTION *L
Dc = HYm * d ^ 3L  H12 * H1 - nu ^ 2LL;
row = r  b;
C2 = Hrow ^ 2L * Log@rowD;
w = P * Hb ^ 2L  H16 * Pi * DcL * HH3 + nuL  H1 + nuL * C1 + 2 * C2L;
compPlot = multiPlot@w, uzPlotListHR, uzPlotListSRI, uzPlotListISOPD;
Print@"===== Simply Supported Plate With Point Load ====="D;
Show@compPlotD
===== Simply Supported Plate With Point Load =====
Element Comparison: Midplane z displacement
wHrL
0.0015
Analytical
HR
0.0010
Iso-P with SRI
Standard Iso-P
0.0005
1
2
3
4
5
r
9
10
quad4HR_v4.nb
H* ====================================Š======= *L
H* SIMPLY SUPPORTED PLATE WITH DISTRIBUTED LOAD *L
H* ====================================Š======= *L
H* NOTE: Many definitions are carried over from
previous case Hgeometry, number of gauss points, Emat, etcL.
If different definitions are desired they must be stated below. *L
H* NODAL FORCES:
The load P is a force per unit area distributed evenly over the surface of the disk.
rWidth = b  H2 * NerL;
Arat = Table@0, 8nnodr<D;
Arat@@1DD = Pi * HrWidth^ 2L  H2 * PiL;
r1 = rWidth;
r2 = r1 + 2 * rWidth;
For@k = 2, k £ Hnnodr - 1L, k ++,
Arat@@kDD = Pi * Hr2 ^ 2 - r1 ^ 2L  H2 * PiL;
r1 += 2 * rWidth;
r2 += 2 * rWidth;
D;
r2 = r1 + rWidth;
Arat@@nnodrDD = Pi * Hr2 ^ 2 - r1 ^ 2L  H2 * PiL;
nodeForces = Table@0, 82 * nnod<D;
For@k = 1, k £ nnodr, k ++,
nodeForces@@2 * nnodz * kDD = P * Arat@@kDD;
D;
H* RESULT USING HR, SRI, AND ISO-P *L
8rcoorAllHR, urHR, uzHR, urPlotListHR, uzPlotListHR< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "HR", nodeForces, knownDispIndsD;
8rcoorAllSRI, urSRI, uzSRI, urPlotListSRI, uzPlotListSRI< =
RingSolver@EmatSRI, p, Ppl, a, b, d, Ner, Nez, "ISOPSRI", nodeForces, knownDispIndsD;
8rcoorAllISOP, urISOP, uzISOP, urPlotListISOP, uzPlotListISOP< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "ISOP", nodeForces, knownDispIndsD;
H* ANALYTICAL SOLUTION *L
Dc = HYm * d ^ 3L  H12 * H1 - nu ^ 2LL;
row = r  b;
C0 = 1 - row ^ 4;
w = P * Hb ^ 4L  H64 * Dc * H1 + nuLL * H2 * H3 + nuL * C1 - H1 + nuL * C0L;
compPlot = multiPlot@w, uzPlotListHR, uzPlotListSRI, uzPlotListISOPD;
Print@"===== Simply Supported Plate With Distributed Load ====="D;
Show@compPlotD
===== Simply Supported Plate With Distributed Load =====
Element Comparison: Midplane z displacement
wHrL
0.05
Analytical
0.04
HR
0.03
Iso-P with SRI
Standard Iso-P
0.02
0.01
1
2
3
4
5
r
*L
quad4HR_v4.nb
H* ===========================Š= *L
H* CLAMPED PLATE WITH POINT LOAD *L
H* ===========================Š= *L
H* NOTE: Many definitions are carried over from
previous case Hgeometry, number of gauss points, Emat, etcL.
If different definitions are desired they must be stated below. *L
H* Force *L
Ppl = P  H2 * PiL; H* for point load case divide by 2*pi *L
H* force vector *L
nodeForces = Table@0, 82 * nnod<D;
nodeForces@@2 * nnodzDD = Ppl;
H* indeces of node & direction with zero displacment boundary conditions *L
knownDispInds = Table@0, 83 * nnodz<D;
For@k = 1, k £ 2 * nnodz, k ++,
If@Element@k  2, IntegersD, Continue, knownDispInds@@Hk + 1L  2DD = kD;
knownDispInds@@k + nnodzDD = k + 2 * Hnnod - nnodzL;
D;
H* RESULT USING HR, SRI, AND ISO-P *L
8rcoorAllHR, urHR, uzHR, urPlotListHR, uzPlotListHR< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "HR", nodeForces, knownDispIndsD;
8rcoorAllSRI, urSRI, uzSRI, urPlotListSRI, uzPlotListSRI< =
RingSolver@EmatSRI, p, Ppl, a, b, d, Ner, Nez, "ISOPSRI", nodeForces, knownDispIndsD;
8rcoorAllISOP, urISOP, uzISOP, urPlotListISOP, uzPlotListISOP< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "ISOP", nodeForces, knownDispIndsD;
H* ANALYTICAL SOLUTION *L
w = P * Hb ^ 2L  H16 * Pi * DcL * H1 - row ^ 2 + 2 * Hrow ^ 2L * Log@rowDL;
compPlot = multiPlot@w, uzPlotListHR, uzPlotListSRI, uzPlotListISOPD;
Print@"===== Clamped Plate With Point Load ====="D;
Show@compPlotD
===== Clamped Plate With Point Load =====
Element Comparison: Midplane z displacement
wHrL
0.0007
0.0006
Analytical
0.0005
HR
0.0004
Iso-P with SRI
0.0003
Standard Iso-P
0.0002
0.0001
1
2
3
4
5
r
11
12
quad4HR_v4.nb
H* =================================== *L
H* CLAMPED PLATE WITH DISTRIBUTED LOAD *L
H* ===========================Š======= *L
H* NOTE: Many definitions are carried over from
previous case Hgeometry, number of gauss points, Emat, etcL.
If different definitions are desired they must be stated below. *L
H* NODAL FORCES:
The load P is a force per unit area distributed evenly over the surface of the disk.
rWidth = b  H2 * NerL;
Arat = Table@0, 8nnodr<D;
Arat@@1DD = Pi * HrWidth^ 2L  H2 * PiL;
r1 = rWidth;
r2 = r1 + 2 * rWidth;
For@k = 2, k £ Hnnodr - 1L, k ++,
Arat@@kDD = Pi * Hr2 ^ 2 - r1 ^ 2L  H2 * PiL;
r1 += 2 * rWidth;
r2 += 2 * rWidth;
D;
r2 = r1 + rWidth;
Arat@@nnodrDD = Pi * Hr2 ^ 2 - r1 ^ 2L  H2 * PiL;
nodeForces = Table@0, 82 * nnod<D;
For@k = 1, k £ nnodr, k ++,
nodeForces@@2 * nnodz * kDD = P * Arat@@kDD;
D;
H* RESULT USING HR, SRI, AND ISO-P *L
8rcoorAllHR, urHR, uzHR, urPlotListHR, uzPlotListHR< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "HR", nodeForces, knownDispIndsD;
8rcoorAllSRI, urSRI, uzSRI, urPlotListSRI, uzPlotListSRI< =
RingSolver@EmatSRI, p, Ppl, a, b, d, Ner, Nez, "ISOPSRI", nodeForces, knownDispIndsD;
8rcoorAllISOP, urISOP, uzISOP, urPlotListISOP, uzPlotListISOP< =
RingSolver@Emat, p, Ppl, a, b, d, Ner, Nez, "ISOP", nodeForces, knownDispIndsD;
H* ANALYTICAL SOLUTION *L
H*p0=PHPi*b^2L;*L
w = P * Hb ^ 4L  H64 * DcL * H1 - row ^ 2L ^ 2;
compPlot = multiPlot@w, uzPlotListHR, uzPlotListSRI, uzPlotListISOPD;
Print@"===== Clamped Plate With Distributed Load ====="D;
Show@compPlotD
===== Clamped Plate With Distributed Load =====
Element Comparison: Midplane z displacement
wHrL
0.014
0.012
Analytical
0.010
HR
0.008
Iso-P with SRI
0.006
Standard Iso-P
0.004
0.002
1
2
3
4
5
r
*L