Skip to content

Commit 95f2612

Browse files
committed
add test dem
1 parent 0615248 commit 95f2612

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

content/compas_dem_stack.ipynb

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 3,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# %%capture\n",
10+
"# %pip install jsonschema networkx numpy scipy pythreejs\n",
11+
"# %pip install compas>=2.8 --no-deps\n",
12+
"# %pip install compas_notebook>=0.8.2 --no-deps\n",
13+
"# %pip install compas_model --no-deps\n",
14+
"# %pip install compas_dem --no-deps"
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"# Discrete Element Models\n",
22+
"\n",
23+
"`compas_dem` is a COMPAS package for working with Discrete Element Models, for example for the design of \"modern masonry\" constructions, or for the assessment of historic masonry structures.\n",
24+
"\n",
25+
"The repository of `compas_dem` is available [here](https://github.com/BlockResearchGroup/compas_dem) and the documentation [here](https://blockresearchgroup.github.io/compas_model/).\n",
26+
"\n",
27+
"In this notebook, we provide a few simple examples that can be run directly in your browser, without the need for any installation. "
28+
]
29+
},
30+
{
31+
"cell_type": "markdown",
32+
"metadata": {},
33+
"source": [
34+
"## A Simple Stack"
35+
]
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"metadata": {},
40+
"source": [
41+
"To create a stack of blocks with `compas_dem`, we will create a simple box geometry, and then add multiple block elements based with this geometry to a block model."
42+
]
43+
},
44+
{
45+
"cell_type": "markdown",
46+
"metadata": {},
47+
"source": [
48+
"To make things a bit more interesting, we will create a leaning stack, by moving each block in the X direction."
49+
]
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": 4,
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"from compas.geometry import Box, Translation\n",
58+
"from compas_dem.elements import BlockElement\n",
59+
"from compas_dem.models import BlockModel\n",
60+
"\n",
61+
"box = Box(xsize=1, ysize=1, zsize=1)\n",
62+
"\n",
63+
"model = BlockModel()\n",
64+
"\n",
65+
"for i in range(10):\n",
66+
" T = Translation.from_vector([i * 0.01, 0, i * box.zsize])\n",
67+
"\n",
68+
" block = BlockElement.from_box(box, transformation=T)\n",
69+
" model.add_element(block)"
70+
]
71+
},
72+
{
73+
"cell_type": "markdown",
74+
"metadata": {},
75+
"source": [
76+
"Then we compute the contact interfaces between the blocks and identify the supports."
77+
]
78+
},
79+
{
80+
"cell_type": "code",
81+
"execution_count": 5,
82+
"metadata": {},
83+
"outputs": [],
84+
"source": [
85+
"model.compute_contacts()"
86+
]
87+
}
88+
],
89+
"metadata": {
90+
"kernelspec": {
91+
"display_name": "masonry",
92+
"language": "python",
93+
"name": "python3"
94+
},
95+
"language_info": {
96+
"codemirror_mode": {
97+
"name": "ipython",
98+
"version": 3
99+
},
100+
"file_extension": ".py",
101+
"mimetype": "text/x-python",
102+
"name": "python",
103+
"nbconvert_exporter": "python",
104+
"pygments_lexer": "ipython3",
105+
"version": "3.10.14"
106+
}
107+
},
108+
"nbformat": 4,
109+
"nbformat_minor": 2
110+
}

0 commit comments

Comments
 (0)