mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-06 04:21:33 +00:00
data structures ready
This commit is contained in:
@@ -707,7 +707,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"call (generic function with 1275 methods)"
|
||||
"call (generic function with 1258 methods)"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
@@ -954,7 +954,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Basically summing the above values together we have just done numerical integration over element area. By using these two simple concepts we are able to construct very interesting results.\n",
|
||||
"Basically summing the above values together we have (almost) just done numerical integration over element area. By using these two simple concepts we are able to construct rest of the results.\n",
|
||||
"\n",
|
||||
"## Interpolation\n",
|
||||
"\n",
|
||||
@@ -1024,7 +1024,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"JuliaFEM.ElementBasis(basis,dbasis)"
|
||||
"JuliaFEM.Basis(basis,dbasis)"
|
||||
]
|
||||
},
|
||||
"execution_count": 32,
|
||||
@@ -1070,7 +1070,7 @@
|
||||
"source": [
|
||||
"### Interpolation in time domain\n",
|
||||
"\n",
|
||||
"To interpolate in time domain, call `DiscreteField` given time. Result is a `Increment` interpolated to that time. Here we interpolate the position of particle moving $x = \\frac{1}{2}t^2$ at time $t=1.0$."
|
||||
"To interpolate in time domain, call `DiscreteField` given time. Result is an `Increment` interpolated to that time. Here we interpolate the position of particle moving $y = \\frac{1}{2}t^2$ at time $t=1.0$."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1093,8 +1093,8 @@
|
||||
],
|
||||
"source": [
|
||||
"t = linspace(0, 2, 5)\n",
|
||||
"x = 1/2*t.^2\n",
|
||||
"t, x"
|
||||
"y = 1/2*t.^2\n",
|
||||
"t, y"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1118,8 +1118,8 @@
|
||||
],
|
||||
"source": [
|
||||
"timesteps = TimeStep[]\n",
|
||||
"for (ti, xi) in zip(t, x)\n",
|
||||
" increment = Increment(xi)\n",
|
||||
"for (ti, yi) in zip(t, y)\n",
|
||||
" increment = Increment(yi)\n",
|
||||
" push!(timesteps, TimeStep(ti, increment))\n",
|
||||
"end\n",
|
||||
"\n",
|
||||
@@ -1132,7 +1132,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"It's also possible to take time derivatives. To do so, call `Field` with `TemporalBasis`, time, and additional argument `Val{:derivative}`. Again, same example:"
|
||||
"It's also possible to take time derivatives. To do so, call `Field` with time and additional argument `Val{:derivative}`. Again, same example:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1169,9 +1169,23 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"To interpolate in spatial domain, call `Increment` with `SpatialBasis` and coordinate $\\boldsymbol\\xi$. Increments to interpolate are the latest ones in each time step. Result depends from the content of the field. If it is scalar field, result will be scalar, if it's vector the result will be vector and so on.\n",
|
||||
"To interpolate in spatial domain, call `Basis` with `Increment` and coordinate $\\boldsymbol\\xi$. Increments to interpolate are the latest ones in each time step. Result depends from the content of the field. If it is scalar field, result will be scalar, if it's vector the result will be vector and so on.\n",
|
||||
"\n",
|
||||
"Let's have a $\\left[0,1\\right]\\times\\left[0,1\\right] \\in \\mathbb{R}^2$ domain and $u_5 = 0.25$ displacement in upper right corner pointint to the $x_1$ direction. We seek for a center point of this at time $t=1.0$."
|
||||
"Let's have a $\\Omega = \\left[0,1\\right]\\times\\left[0,1\\right] \\in \\mathbb{R}^2$ domain with a displacement field\n",
|
||||
"\\begin{equation}\n",
|
||||
"\\mathbf{u}\\left(X_1, X_2\\right)=t\\begin{bmatrix}X_{1}\\left(X_{2}+1\\right)\\\\\n",
|
||||
"X_{1}\\left(4X_{2}-1\\right)\n",
|
||||
"\\end{bmatrix}.\n",
|
||||
"\\end{equation}\n",
|
||||
"\n",
|
||||
"Gradient is\n",
|
||||
"\\begin{equation}\n",
|
||||
"\\mbox{grad}\\left(\\mathbf{u}\\right)=t\\begin{bmatrix}X_{2}+1 & X_{1}\\\\\n",
|
||||
"4X_{2}-1 & 4X_{1}\n",
|
||||
"\\end{bmatrix}\n",
|
||||
"\\end{equation}\n",
|
||||
"\n",
|
||||
"We look for a displacement in center point of the domain at time $t=1.0$:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1182,12 +1196,10 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"geometry = Field(Vector{Float64}[[0.0,0.0], [1.0,0.0], [1.0,1.0], [0.0,1.0]])\n",
|
||||
"displacement = Field(\n",
|
||||
" (0.0, Vector[[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]),\n",
|
||||
" (1.0, Vector[[0.0, 0.0], [0.0, 0.0], [1/4, 0.0], [0.0, 0.0]]))\n",
|
||||
"X = Basis(basis, dbasis, geometry)\n",
|
||||
"u = Basis(basis, dbasis, displacement);"
|
||||
"X = Field(Vector{Float64}[[0.0,0.0], [1.0,0.0], [1.0,1.0], [0.0,1.0]])\n",
|
||||
"u = Field(\n",
|
||||
" (0.5, Vector{Float64}[[0.0, 0.0], [0.5, -0.5], [1.0, 1.5], [0.0, 0.0]]),\n",
|
||||
" (1.5, Vector{Float64}[[0.0, 0.0], [1.5, -1.5], [3.0, 4.5], [0.0, 0.0]]));"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1200,9 +1212,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2-element Array{Float64,1}:\n",
|
||||
" 0.5625\n",
|
||||
" 0.5 "
|
||||
"([[0.0,0.0],[1.0,0.0],[1.0,1.0],[0.0,1.0]],Any[[0.0,0.0],[1.0,-1.0],[2.0,3.0],[0.0,0.0]])"
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
@@ -1211,15 +1221,10 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"x2(xi, t) = X(xi, t) + u(xi, t)\n",
|
||||
"x2([0.0, 0.0], 1.0)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Calculating gradient of vector field, i.e, $u_{i,j}$:"
|
||||
"# evaluate fields in time t=1.0 -> Increments\n",
|
||||
"X_increment = X(1.0)\n",
|
||||
"u_increment = u(1.0)\n",
|
||||
"X_increment, u_increment"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1232,9 +1237,9 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2x2 Array{Float64,2}:\n",
|
||||
" 0.125 0.125\n",
|
||||
" 0.0 0.0 "
|
||||
"2-element Array{Float64,1}:\n",
|
||||
" 1.25\n",
|
||||
" 1.0 "
|
||||
]
|
||||
},
|
||||
"execution_count": 39,
|
||||
@@ -1243,11 +1248,72 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# this needs some redesign.\n",
|
||||
"N = FEM.Basis(basis, dbasis)\n",
|
||||
"dN = FEM.ElementGradientBasis(N, geometry)\n",
|
||||
"gradu = FEM.ElementFieldGradientBasis(dN, displacement)\n",
|
||||
"gradu([0.0, 0.0], 1.0)"
|
||||
"N(X_increment, [0.0, 0.0]) + N(u_increment, [0.0, 0.0])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Calculating gradient of vector field, i.e, $u_{i,j} = \\frac{\\partial u_i}{\\partial X_j}$:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2x2 Array{Float64,2}:\n",
|
||||
" 1.5 0.5\n",
|
||||
" 1.0 2.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 40,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"N = Basis(basis, dbasis)\n",
|
||||
"gradu = N(X_increment, u_increment, [0.0, 0.0], Val{:gradient})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Calculating time derivative of small strain tensor $\\epsilon$ is basically:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 41,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2x2 Array{Float64,2}:\n",
|
||||
" 1.5 0.75\n",
|
||||
" 0.75 2.0 "
|
||||
]
|
||||
},
|
||||
"execution_count": 41,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"du = u(1.0, Val{:derivative})\n",
|
||||
"grad_du = N(X_increment, du, [0.0, 0.0], Val{:gradient})\n",
|
||||
"strain_rate = 1/2*(grad_du + grad_du')"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user