-
Notifications
You must be signed in to change notification settings - Fork 3
/
Problem.m
77 lines (52 loc) · 1.92 KB
/
Problem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
(* ::Package:: *)
BeginPackage["ProbabilisticBricks`Problem`"];
setProblemProperties::usage = "setProblemProperties[nelx,nely,b,h,P,\[Mu],contacts] set the properites of the current problem.";
generateContacts::usage = "generateContacts[] sets randomly the contact mechanism to every block.";
setBoundaryConditions::usage = "setBoundaryConditions[loads] sets the loads to be applied.";
solveProblem::usage = "solveProblem[] applies the loads, computes the solution.";
solveProblemAndDisplay::usage = "solveProblemAndDisplay[filter] applies the loads, computes the solution and displays the wall colored with the selected filter.";
displayWallWithFilter::usage = "displayWallWithFilter[filter] displays the wall colored with the selected filter.";
nelx;nely;b;h;P;\[Mu];contacts;
\[Sigma]v;\[Sigma]h;loads;eqCheck;
Begin["`Private`"];
Needs["ProbabilisticBricks`Wall`"];
initStressVectors[$nelx_, $nely_] := Module[{},
\[Sigma]v = Table[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {totalBlocks}];
\[Sigma]h = Table[{0, 0, 0, 0}, {totalBlocks + $nely}];
];
setProblemProperties[$nelx_, $nely_, $b_, $h_, $P_, $\[Mu]_] := Module[{},
nelx = $nelx;nely = $nely;
b = $b;h = $h;
P = $P;\[Mu] = $\[Mu];
(*compute number of total blocks*)
If[EvenQ[$nely],
totalBlocks = getBlockNum[{$nely, $nelx - 1}];,
totalBlocks = getBlockNum[{$nely, $nelx}];
];
];
generateContacts[] := Module[{},
contacts = RandomInteger[{1, 3}, totalBlocks]
];
setBoundaryConditions[$loads_] := Module[{},
loads = $loads;
];
applyLoads[] := Module[{j},
initStressVectors[nelx, nely];
For[j = 1, j <= nelx, j++,
\[Sigma]v[[j]] = Join[loads[[6(j - 1) + 1 ;; 6j]], {0, 0, 0, 0, 0, 0}];
];
];
solveProblem[] := Module[{},
applyLoads[];
eqCheck = solveWall[];
];
displayWallWithFilter[filter_] := Module[{},
displayWall[filter]
];
solveProblemAndDisplay[filter_] := Module[{},
applyLoads[];
eqCheck = solveWall[];
displayWall[filter]
];
End[];
EndPackage[];