Cleanup of obsolete files

A lot of old files from old documentation systems etc. is in package.
These are now removed or moved. Old notebooks are in docs/tutorials.
This PR closes issue #124.
This commit is contained in:
Jukka Aho
2017-08-05 11:44:31 +03:00
parent fffb0071a0
commit 5731d590ab
48 changed files with 0 additions and 1409 deletions
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="81" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#e05d44" d="M37 0h44v20H37z"/><path fill="url(#b)" d="M0 0h81v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="58" y="15" fill="#010101" fill-opacity=".3">failing</text><text x="58" y="14">failing</text></g></svg>

Before

Width:  |  Height:  |  Size: 735 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="90" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#4c1" d="M37 0h53v20H37z"/><path fill="url(#b)" d="M0 0h90v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="62.5" y="15" fill="#010101" fill-opacity=".3">passing</text><text x="62.5" y="14">passing</text></g></svg>

Before

Width:  |  Height:  |  Size: 736 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="98" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="98" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#9f9f9f" d="M37 0h61v20H37z"/><path fill="url(#b)" d="M0 0h98v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="66.5" y="15" fill="#010101" fill-opacity=".3">unknown</text><text x="66.5" y="14">unknown</text></g></svg>

Before

Width:  |  Height:  |  Size: 739 B

-14
View File
@@ -1,14 +0,0 @@
# JuliaFEM.abaqus_reader
## Internal
---
<a id="method__add_handler.1" class="lexicon_definition"></a>
#### add_handler(section, function_name) [¶](#method__add_handler.1)
Register new handler for parser
*source:*
[JuliaFEM/src/abaqus_reader.jl:18](https://github.com/JuliaFEM/JuliaFEM.jl/tree/b8194d0c137963b44aab6b223a22491f9b0f7774/src/abaqus_reader.jl#L18)
-190
View File
@@ -1,190 +0,0 @@
# JuliaFEM.elasticity_solver
## Internal
---
<a id="method__assemble.1" class="lexicon_definition"></a>
#### assemble!(fe, eldofs_, I, V) [¶](#method__assemble.1)
Assemble global RHS to I,V ready for sparse format
Parameters
----------
fe : local vector
eldofs_ : Array
degrees of freedom
I,V : Arrays for sparse matrix
Notes
-----
eldofs can also be node ids for convenience. In that case dimension
is calculated and eldofs are "extended" to problem dimension.
*source:*
[JuliaFEM/src/elasticity_solver.jl:174](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L174)
---
<a id="method__assemble.2" class="lexicon_definition"></a>
#### assemble!(ke, eldofs_, I, J, V) [¶](#method__assemble.2)
Assemble global stiffness matrix to I,J,V ready for sparse format
Parameters
----------
ke : local matrix
eldofs_ : Array
degrees of freedom
I,J,V : Arrays for sparse matrix
Notes
-----
eldofs can also be node ids for convenience. In that case dimension
is calculated and eldofs are "extended" to problem dimension.
*source:*
[JuliaFEM/src/elasticity_solver.jl:133](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L133)
---
<a id="method__calc_local_matrices.1" class="lexicon_definition"></a>
#### calc_local_matrices!(X, u, R, K, basis, dbasis, lambda_, mu_, ipoints, iweights) [¶](#method__calc_local_matrices.1)
Calculate local tangent stiffness matrix and residual force vector
R = T - F for elasticity problem.
Parameters
----------
X : Element coordinates
u : Displacement field
R : Residual force vector
K : Tangent stiffness matrix
basis : Basis functions
dbasis : Derivative of basis functions
lambda : Material parameter
mu : Material parameter
ipoints : integration points
iweights : integration weights
Returns
-------
None
Notes
-----
If material parameters are given in list, they are interpolated to gauss
points using shape functions.
*source:*
[JuliaFEM/src/elasticity_solver.jl:76](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L76)
---
<a id="method__dummy.1" class="lexicon_definition"></a>
#### dummy(a) [¶](#method__dummy.1)
This is dummy function. Testing doctests and documentation.
Parameters
----------
x : Array{Float64, 1}
Returns
-------
Array{float64, 1}
x + 1
Notes
-----
This is dummy function
Raises
------
Exception
if things are not going right
Examples
--------
>>> a = [1.0, 2.0, 3.0]
>>> dummy(a)
[2.0, 3.0, 4.0]
*source:*
[JuliaFEM/src/elasticity_solver.jl:44](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L44)
---
<a id="method__eliminate_boundary_conditions.1" class="lexicon_definition"></a>
#### eliminate_boundary_conditions(dirichletbc, I, J, V) [¶](#method__eliminate_boundary_conditions.1)
Eliminate Dirichlet boundary conditions from matrix
Parameters
----------
dirichletbc : array [dim x nnodes]
I, J, V : sparse matrix arrays
Returns
-------
I, J, V : boundary conditions removed
Notes
-----
pros:
- matrix assembly remains positive definite
cons:
- maybe inefficient because of extra sparse matrix operations. (It's hard to remove stuff from sparse matrix.)
- if u != 0 in dirichlet boundary requires extra care
Raises
------
Exception, if displacement boundary conditions given, i.e.
DX=2 for some node, for example.
*source:*
[JuliaFEM/src/elasticity_solver.jl:221](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L221)
---
<a id="method__eliminate_boundary_conditions.2" class="lexicon_definition"></a>
#### eliminate_boundary_conditions(dirichletbc, I, V) [¶](#method__eliminate_boundary_conditions.2)
Eliminate Dirichlet boundary conditions from vector
Parameters
----------
dirichletbc : array [dim x nnodes]
I, V : sparse vector arrays
Returns
-------
I, V : boundary conditions removed
Notes
-----
pros:
- matrix assembly remains positive definite
cons:
- maybe inefficient because of extra sparse matrix operations. (It's hard to remove stuff from sparse matrix.)
- if u != 0 in dirichlet boundary requires extra care
Raises
------
Exception, if displacement boundary conditions given, i.e.
DX=2 for some node, for example.
*source:*
[JuliaFEM/src/elasticity_solver.jl:260](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L260)
---
<a id="method__solve_elasticity_increment.1" class="lexicon_definition"></a>
#### solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc, lambda, mu, N, dNdchi, ipoints, iweights) [¶](#method__solve_elasticity_increment.1)
Solve one increment of elasticity problem
*source:*
[JuliaFEM/src/elasticity_solver.jl:281](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elasticity_solver.jl#L281)
-103
View File
@@ -1,103 +0,0 @@
JuliaFEM.elasticity_solver
==========================
Internal
--------
.. function:: assemble!(fe, eldofs_, I, V)
Assemble global RHS to I,V ready for sparse format
:param fe : local vector
:param eldofs_ : Array
:param I,V : Arrays for sparse matrix
:notes: eldofs can also be node ids for convenience. In that case dimension
is calculated and eldofs are "extended" to problem dimension.
**source**
[JuliaFEM/src/elasticity_solver.jl:174]
.. function:: assemble!(ke, eldofs_, I, J, V)
Assemble global stiffness matrix to I,J,V ready for sparse format
:param ke : local matrix
:param eldofs_ : Array
:param I,J,V : Arrays for sparse matrix
:notes: eldofs can also be node ids for convenience. In that case dimension
is calculated and eldofs are "extended" to problem dimension.
**source**
[JuliaFEM/src/elasticity_solver.jl:133]
.. function:: calc_local_matrices!(X, u, R, K, basis, dbasis, lambda_, mu_, ipoints, iweights)
Calculate local tangent stiffness matrix and residual force vector
R = T - F for elasticity problem.
:param X : Element coordinates
:param u : Displacement field
:param R : Residual force vector
:param K : Tangent stiffness matrix
:param basis : Basis functions
:param dbasis : Derivative of basis functions
:param lambda : Material parameter
:param mu : Material parameter
:param ipoints : integration points
:param iweights : integration weights
:returns: None
:notes: If material parameters are given in list, they are interpolated to gauss
points using shape functions.
**source**
[JuliaFEM/src/elasticity_solver.jl:76]
.. function:: dummy(a)
This is dummy function. Testing doctests and documentation.
:param x : Array{Float64, 1}
:returns: Array{float64, 1}
x + 1
:notes: This is dummy function
:raises: Exception
if things are not going right
**source**
[JuliaFEM/src/elasticity_solver.jl:44]
.. function:: eliminate_boundary_conditions(dirichletbc, I, J, V)
Eliminate Dirichlet boundary conditions from matrix
:param dirichletbc : array [dim x nnodes]
:param I, J, V : sparse matrix arrays
:returns: I, J, V : boundary conditions removed
:notes: pros:
- matrix assembly remains positive definite
cons:
- maybe inefficient because of extra sparse matrix operations. (It's hard to remove stuff from sparse matrix.)
- if u != 0 in dirichlet boundary requires extra care
:raises: Exception, if displacement boundary conditions given, i.e.
DX=2 for some node, for example.
**source**
[JuliaFEM/src/elasticity_solver.jl:221]
.. function:: eliminate_boundary_conditions(dirichletbc, I, V)
Eliminate Dirichlet boundary conditions from vector
:param dirichletbc : array [dim x nnodes]
:param I, V : sparse vector arrays
:returns: I, V : boundary conditions removed
:notes: pros:
- matrix assembly remains positive definite
cons:
- maybe inefficient because of extra sparse matrix operations. (It's hard to remove stuff from sparse matrix.)
- if u != 0 in dirichlet boundary requires extra care
:raises: Exception, if displacement boundary conditions given, i.e.
DX=2 for some node, for example.
**source**
[JuliaFEM/src/elasticity_solver.jl:260]
.. function:: solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc, lambda, mu, N, dNdchi, ipoints, iweights)
**source**
[JuliaFEM/src/elasticity_solver.jl:281]
-19
View File
@@ -1,19 +0,0 @@
# JuliaFEM.interfaces
## Exported
---
<a id="method__solve_elasticity_interface.1" class="lexicon_definition"></a>
#### solve_elasticity_interface!() [¶](#method__solve_elasticity_interface.1)
This is generic interface that reads data from data model, solves elasticity
problem and updates model.
Parameters
----------
model : to be defined
*source:*
[JuliaFEM/src/interfaces.jl:22](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/interfaces.jl#L22)
-15
View File
@@ -1,15 +0,0 @@
JuliaFEM.interfaces
===================
Exported
--------
.. function:: solve_elasticity_interface!()
This is generic interface that reads data from data model, solves elasticity
problem and updates model.
:param model : to be defined
**source**
[JuliaFEM/src/interfaces.jl:22]
-260
View File
@@ -1,260 +0,0 @@
# JuliaFEM
## Exported
---
<a id="method__get_coordinates.1" class="lexicon_definition"></a>
#### get_coordinates(el::JuliaFEM.Element) [¶](#method__get_coordinates.1)
Return coordinates of element in array of size dim x nnodes
*source:*
[JuliaFEM/src/elements.jl:29](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L29)
---
<a id="method__integrate.2" class="lexicon_definition"></a>
#### integrate(f::Function) [¶](#method__integrate.2)
This version returns a function which must be operated with element e
*source:*
[JuliaFEM/src/math.jl:163](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L163)
---
<a id="method__integrate.3" class="lexicon_definition"></a>
#### integrate(f::Function, el::JuliaFEM.Element) [¶](#method__integrate.3)
Integrate f over element using Gaussian quadrature rules.
Parameters
----------
el::Element
well defined element
f::Function
Function to integrate
*source:*
[JuliaFEM/src/math.jl:143](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L143)
---
<a id="method__interpolate.1" class="lexicon_definition"></a>
#### interpolate(field::Float64, basis::Function, ip::Array{Float64, 1}) [¶](#method__interpolate.1)
Interpolate field variable using basis functions f for point ip.
This function tries to be as general as possible and allows interpolating
lot of different fields.
Parameters
----------
field :: Array{Number, dim}
Field variable
basis :: Function
Basis functions
ip :: Array{Number, 1}
Point to interpolate
*source:*
[JuliaFEM/src/math.jl:26](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L26)
---
<a id="method__linearize.2" class="lexicon_definition"></a>
#### linearize(f::Function, el::JuliaFEM.Element, field::ASCIIString) [¶](#method__linearize.2)
Linearize function f w.r.t some given field, i.e. calculate dR/du
Parameters
----------
f::Function
(possibly) nonlinear function to linearize
field::ASCIIString
field variable
Returns
-------
Array{Float64, 2}
jacobian / "tangent stiffness matrix"
*source:*
[JuliaFEM/src/math.jl:85](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L85)
---
<a id="method__linearize.3" class="lexicon_definition"></a>
#### linearize(f::Function, field::ASCIIString) [¶](#method__linearize.3)
This version returns another function which can be then evaluated against field
*source:*
[JuliaFEM/src/math.jl:100](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L100)
---
<a id="method__set_coordinates.1" class="lexicon_definition"></a>
#### set_coordinates(el::JuliaFEM.Element, coordinates) [¶](#method__set_coordinates.1)
Set coordinates for element
*source:*
[JuliaFEM/src/elements.jl:36](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L36)
## Internal
---
<a id="method__add_handler.1" class="lexicon_definition"></a>
#### add_handler(section, function_name) [¶](#method__add_handler.1)
Register new handler for parser
*source:*
[JuliaFEM/src/abaqus_reader.jl:13](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/abaqus_reader.jl#L13)
---
<a id="method__create_lagrange_element.1" class="lexicon_definition"></a>
#### create_lagrange_element(element_name, X, P, dP) [¶](#method__create_lagrange_element.1)
Create new Lagrange element
FIXME: this is not working
LoadError: error compiling anonymous: type definition not allowed inside a local scope
It's the for loop which is causing problems. See
https://github.com/JuliaLang/julia/issues/10555
*source:*
[JuliaFEM/src/elements.jl:64](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L64)
---
<a id="method__get_dbasisdx.1" class="lexicon_definition"></a>
#### get_dbasisdX(el::JuliaFEM.Element, xi) [¶](#method__get_dbasisdx.1)
Evaluate partial derivatives of basis function w.r.t
material description X, i.e. dbasis/dX
*source:*
[JuliaFEM/src/elements.jl:20](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L20)
---
<a id="method__get_element_id.1" class="lexicon_definition"></a>
#### get_element_id(el::JuliaFEM.Element) [¶](#method__get_element_id.1)
Get element id
*source:*
[JuliaFEM/src/elements.jl:43](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L43)
---
<a id="method__get_jacobian.1" class="lexicon_definition"></a>
#### get_jacobian(el::JuliaFEM.Element, xi) [¶](#method__get_jacobian.1)
Get jacobian of element evaluated at point xi
*source:*
[JuliaFEM/src/elements.jl:9](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L9)
---
<a id="method__integrate.1" class="lexicon_definition"></a>
#### integrate!(f::Function, el::JuliaFEM.Element, target) [¶](#method__integrate.1)
This version saves results inplace to target, garbage collection free
*source:*
[JuliaFEM/src/math.jl:178](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L178)
---
<a id="method__linearize.1" class="lexicon_definition"></a>
#### linearize!(f::Function, el::JuliaFEM.Element, field::ASCIIString, target::ASCIIString) [¶](#method__linearize.1)
In-place version, no additional garbage collection.
*source:*
[JuliaFEM/src/math.jl:118](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/math.jl#L118)
---
<a id="method__xdmf_new_model.1" class="lexicon_definition"></a>
#### xdmf_new_model() [¶](#method__xdmf_new_model.1)
Build a new model for outout
Parameters
----------
Example
-------
>>> xdmf_new_model()
*source:*
[JuliaFEM/src/xdmf.jl:48](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/xdmf.jl#L48)
---
<a id="method__xdmf_new_model.2" class="lexicon_definition"></a>
#### xdmf_new_model(xdmf_version) [¶](#method__xdmf_new_model.2)
Build a new model for outout
Parameters
----------
Example
-------
>>> xdmf_new_model()
*source:*
[JuliaFEM/src/xdmf.jl:48](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/xdmf.jl#L48)
---
<a id="type__point1.1" class="lexicon_definition"></a>
#### JuliaFEM.Point1 [¶](#type__point1.1)
1 node point element
*source:*
[JuliaFEM/src/elements.jl:112](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L112)
---
<a id="type__quad4.1" class="lexicon_definition"></a>
#### JuliaFEM.Quad4 [¶](#type__quad4.1)
4 node bilinear quadrangle element
*source:*
[JuliaFEM/src/elements.jl:155](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L155)
---
<a id="type__seg2.1" class="lexicon_definition"></a>
#### JuliaFEM.Seg2 [¶](#type__seg2.1)
3 node quadratic line element
*source:*
[JuliaFEM/src/elements.jl:139](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L139)
---
<a id="type__tet10.1" class="lexicon_definition"></a>
#### JuliaFEM.Tet10 [¶](#type__tet10.1)
10 node quadratic tethahedron
*source:*
[JuliaFEM/src/elements.jl:195](https://github.com/JuliaFEM/JuliaFEM.jl/tree/33a7fe664e9808c57564b507f0b8d5dcb451365a/src/elements.jl#L195)
-130
View File
@@ -1,130 +0,0 @@
JuliaFEM
========
Exported
--------
.. function:: get_coordinates(el::JuliaFEM.Element)
**source**
[JuliaFEM/src/elements.jl:29]
.. function:: integrate(f::Function)
**source**
[JuliaFEM/src/math.jl:163]
.. function:: integrate(f::Function, el::JuliaFEM.Element)
Integrate f over element using Gaussian quadrature rules.
:param el: Element
:param f: Function
**source**
[JuliaFEM/src/math.jl:143]
.. function:: interpolate(field::Float64, basis::Function, ip::Array{Float64, 1})
Interpolate field variable using basis functions f for point ip.
This function tries to be as general as possible and allows interpolating
lot of different fields.
:param field : Array{Number, dim}
:param basis : Function
:param ip : Array{Number, 1}
**source**
[JuliaFEM/src/math.jl:26]
.. function:: linearize(f::Function, el::JuliaFEM.Element, field::ASCIIString)
Linearize function f w.r.t some given field, i.e. calculate dR/du
:param f: Function
:param field: ASCIIString
:returns: Array{Float64, 2}
jacobian / "tangent stiffness matrix"
**source**
[JuliaFEM/src/math.jl:85]
.. function:: linearize(f::Function, field::ASCIIString)
**source**
[JuliaFEM/src/math.jl:100]
.. function:: set_coordinates(el::JuliaFEM.Element, coordinates)
**source**
[JuliaFEM/src/elements.jl:36]
Internal
--------
.. function:: add_handler(section, function_name)
**source**
[JuliaFEM/src/abaqus_reader.jl:13]
.. function:: create_lagrange_element(element_name, X, P, dP)
**source**
[JuliaFEM/src/elements.jl:64]
.. function:: get_dbasisdX(el::JuliaFEM.Element, xi)
**source**
[JuliaFEM/src/elements.jl:20]
.. function:: get_element_id(el::JuliaFEM.Element)
**source**
[JuliaFEM/src/elements.jl:43]
.. function:: get_jacobian(el::JuliaFEM.Element, xi)
**source**
[JuliaFEM/src/elements.jl:9]
.. function:: integrate!(f::Function, el::JuliaFEM.Element, target)
**source**
[JuliaFEM/src/math.jl:178]
.. function:: linearize!(f::Function, el::JuliaFEM.Element, field::ASCIIString, target::ASCIIString)
**source**
[JuliaFEM/src/math.jl:118]
.. function:: xdmf_new_model()
Build a new model for outout
**source**
[JuliaFEM/src/xdmf.jl:48]
.. function:: xdmf_new_model(xdmf_version)
Build a new model for outout
**source**
[JuliaFEM/src/xdmf.jl:48]
.. function:: JuliaFEM.Point1
**source**
[JuliaFEM/src/elements.jl:112]
.. function:: JuliaFEM.Quad4
**source**
[JuliaFEM/src/elements.jl:155]
.. function:: JuliaFEM.Seg2
**source**
[JuliaFEM/src/elements.jl:139]
.. function:: JuliaFEM.Tet10
**source**
[JuliaFEM/src/elements.jl:195]
-2
View File
@@ -1,2 +0,0 @@
# JuliaFEM.xdmf
-3
View File
@@ -1,3 +0,0 @@
JuliaFEM.xdmf
=============
-14
View File
@@ -1,14 +0,0 @@
API Documentation
=================
Automatically generated api documentation
Contents:
.. toctree::
:maxdepth: 3
JuliaFEM
JuliaFEM.elasticity_solver
JuliaFEM.interfaces
-315
View File
@@ -1,315 +0,0 @@
# -*- coding: utf-8 -*-
#
# JuliaFEM documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 3 22:25:04 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import juliadoc
import shlex
import sphinx_rtd_theme
import datetime
html_last_updated_fmt = "%Y-%m-%d %H:%M:%S"
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'juliadoc.julia',
'juliadoc.jlhelp',
'numpydoc']
html_theme_path = [
juliadoc.get_theme_dir(),
sphinx_rtd_theme.get_html_theme_path()]
html_sidebars = juliadoc.default_sidebars()
primary_domain = 'jl'
highlight_language = 'julia'
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
#extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = ['.rst', '.md']
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'JuliaFEM'
copyright = u'2015, Jukka Aho, Olli Väinölä, Tero Frondelius'
author = u'Jukka Aho, Olli Väinölä, Tero Frondelius'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.0.1'
# The full version, including alpha/beta/rc tags.
release = '0.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
html_show_copyright = False
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "JuliaFEM - A Finite Element Method Solver"
# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = "JuliaFEM"
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = 'logo/JuliaFEMLogo_96x96.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_favicon = 'logo/JuliaFEMLogo_32x32.png'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static', 'badges']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'JuliaFEMdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'JuliaFEM.tex', u'JuliaFEM Documentation',
u'Jukka Aho, Olli Väinölä, Tero Frondelius', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'juliafem', u'JuliaFEM Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'JuliaFEM', u'JuliaFEM Documentation',
author, 'JuliaFEM', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
-10
View File
@@ -1,10 +0,0 @@
.. include:: ../README.rst
.. toctree::
:hidden:
self
tutorials/index
api/index
quality/index
../CONTRIBUTING.rst
-6
View File
@@ -1,6 +0,0 @@
============
Introduction
============
This is JuliaFEM.
-1
View File
@@ -1 +0,0 @@
Documentation last updated (UTC): UNKNOWN
-22
View File
@@ -1,22 +0,0 @@
Discretization
==============
http://code.activestate.com/recipes/579021-delaunay-triangulation/
Interpolation
=============
- http://www.cs.rpi.edu/~flaherje/pdf/fea4.pdf
- http://www.sd.ruhr-uni-bochum.de/downloads/Shape_funct.pdf
- http://what-when-how.com/the-finite-element-method/fem-for-3d-solids-finite-element-method-part-1/
- http://www.uni-tuebingen.de/zag/teaching/environmental_modeling/S4B_FiniteElements.pdf
- http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch10.d/AFEM.Ch10.pdf
- http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch10.d/AFEM.Ch10.Slides.d/AFEM.Ch10.Slides.pdf
- http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.AppI.d/AFEM.AppI.pdf
- http://www.code-aster.org/V2/doc/default/en/man_r/r3/r3.01.01.pdf
- http://www.researchgate.net/publication/267082822_Unified_isoparametric_3D_Lagrange_finite_elements
Integration
===========
- http://arxiv.org/pdf/1411.1341.pdf
-2
View File
@@ -1,2 +0,0 @@
This is placeholder file doc doctest results. If you see this file then doctests has not been run.
-18
View File
@@ -1,18 +0,0 @@
Code quality
============
Lint report
-----------
.. include:: lint_report.rst
Doctest report
--------------
.. include:: doctests_report.rst
Unittest report
---------------
.. include:: unittests_report.rst
-24
View File
@@ -1,24 +0,0 @@
| JuliaFEM/src/abaqus_reader.jl:7 [ ] ERROR Use of undeclared symbol level
| JuliaFEM/src/abaqus_reader.jl:34 [parse_header ] ERROR Use of undeclared symbol end
| JuliaFEM/src/abaqus_reader.jl:47 [parse_node_section] ERROR Use of undeclared symbol end
| JuliaFEM/src/abaqus_reader.jl:65 [parse_element_section] ERROR Use of undeclared symbol end
| JuliaFEM/src/abaqus_reader.jl:42 [parse_node_section] INFO Argument declared but not used: header
| JuliaFEM/src/abaqus_reader.jl:99 [process_section] INFO Argument declared but not used: section
| JuliaFEM/src/elasticity_solver.jl:7 [ ] ERROR Use of undeclared symbol level
| JuliaFEM/src/elasticity_solver.jl:71 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:72 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:78 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:94 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:98 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:99 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:105 [calc_local_matrices!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:301 [solve_elasticity_increment!] ERROR Use of undeclared symbol :
| JuliaFEM/src/elasticity_solver.jl:302 [solve_elasticity_increment!] ERROR Use of undeclared symbol :
| JuliaFEM/src/interfaces.jl:7 [ ] ERROR Use of undeclared symbol level
| JuliaFEM/src/xdmf.jl:7 [ ] ERROR Use of undeclared symbol level
| JuliaFEM/src/xdmf.jl:97 [xdmf_new_mesh ] ERROR Use of undeclared symbol :
| JuliaFEM/src/xdmf.jl:97 [xdmf_new_mesh ] ERROR Use of undeclared symbol end
| JuliaFEM/src/xdmf.jl:102 [xdmf_new_field ] INFO There is only 1 key type && 1 value type. Use explicit Dict{K,V}() for better performances.
| JuliaFEM/src/xdmf.jl:127 [xdmf_new_field ] INFO attribute is also a global, from
Please check.
-2
View File
@@ -1,2 +0,0 @@
This is placeholder for unittests. This should be replaced with real report when testing.
-1
View File
@@ -1 +0,0 @@
-e git+https://github.com/JuliaLang/JuliaDoc.git#egg=Julia
-6
View File
@@ -1,6 +0,0 @@
src
===
.. toctree::
:maxdepth: 4

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File
@@ -0,0 +1,699 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Solving elasticity problems using JuliaFEM\n",
"\n",
"Author(s): Jukka Aho\n",
"\n",
"**Abstract**: Solving elasticity equations using JuliaFEM.\n",
"\n",
"### Weak form\n",
"\n",
"Given function spaces\n",
"\\begin{align}\n",
"\\boldsymbol{\\mathcal{U}} & =\\left\\{ \\boldsymbol{u}\\in H^{1}\\left(\\Omega\\right)|\\boldsymbol{u}\\left(\\boldsymbol{X},t\\right)=\\hat{\\boldsymbol{u}}\\left(\\boldsymbol{X},t\\right)\\text{ on }\\Gamma_{\\mathrm{u}}\\right\\} ,\\\\\n",
"\\boldsymbol{\\mathcal{V}} & =\\left\\{ \\delta\\boldsymbol{u}\\in H^{1}\\left(\\Omega\\right)|\\delta\\boldsymbol{u}\\left(\\boldsymbol{X}\\right)=0\\text{ on }\\Gamma_{\\mathrm{u}}\\right\\} ,\n",
"\\end{align}\n",
"find $\\boldsymbol{u}\\in\\boldsymbol{\\mathcal{U}}$ such that\n",
"\\begin{equation}\n",
"\\delta\\mathcal{W}:=\\int_{\\Omega_{0}}\\rho_{0}\\ddot{\\boldsymbol{u}}\\cdot\\delta\\boldsymbol{u}\\,\\mathrm{d}V_{0}+\\int_{\\Omega_{0}}\\boldsymbol{S}:\\delta\\boldsymbol{E}\\,\\mathrm{d}V_{0}-\\int_{\\Omega_{0}}\\hat{\\boldsymbol{b}}_{0}\\cdot\\delta\\boldsymbol{u}\\,\\mathrm{d}V_{0}-\\int_{\\Gamma_{\\sigma}}\\hat{\\boldsymbol{t}}_{0}\\cdot\\delta\\boldsymbol{u}\\,\\mathrm{d}A_{0} =0 \\qquad\\forall\\delta\\boldsymbol{u}\\in\\boldsymbol{\\mathcal{V}}\n",
"\\end{equation}\n",
"\n",
"### Some formulas\n",
"\\begin{align}\n",
"J & =\\det\\left(F\\right)\\\\\n",
"I_{c} & =\\mbox{tr}\\left(C\\right)\\\\\n",
"\\mathbf{C} & =\\mathbf{F}^{\\mathrm{T}}\\mathbf{F}\\\\\n",
"\\mathbf{F} & =\\mathbf{I}+\\nabla\\mathbf{u}\\\\\n",
"\\mathbf{E} & =\\frac{1}{2}\\left(\\mathbf{F}^{\\mathrm{T}}\\mathbf{F}-\\mathbf{I}\\right)\n",
"\\end{align}\n",
"\n",
"### Potential energy\n",
"\n",
"\\begin{equation}\n",
"\\underset{u\\in\\boldsymbol{\\mathcal{U}}}{\\min}\\Pi\\left(\\mathbf{u}\\right)\n",
"\\end{equation}\n",
"\\begin{equation}\n",
"\\Pi\\left(\\mathbf{u}\\right)=\\int_{\\Omega}\\psi\\left(\\mathbf{u}\\right)-\\int_{\\Omega}\\hat{\\mathbf{b}}_{0}\\cdot\\mathbf{u}-\\int_{\\Gamma_{\\sigma}}\\hat{\\mathbf{t}}_{0}\\cdot\\mathbf{u}\\,\\mathrm{d}A_{0}\n",
"\\end{equation}\n",
"\n",
"### Material models\n",
"\n",
"https://en.wikipedia.org/wiki/Strain_energy_density_function\n",
"\n",
"Saint-Venant-Kirchhoff model https://en.wikipedia.org/wiki/Hyperelastic_material\n",
"\\begin{equation}\n",
"\\psi\\left(\\mathbf{E}\\right)=\\frac{\\lambda}{2}\\left[\\mbox{tr}\\left(\\mathbf{E}\\right)\\right]^{2}+\\mu\\mbox{tr}\\left(\\mathbf{E}^2\\right)\n",
"\\end{equation}\n",
"\n",
"neo-Hookean material https://en.wikipedia.org/wiki/Neo-Hookean_solid\n",
"\\begin{equation}\n",
"\\psi=\\frac{\\mu}{2}\\left(I_{c}-3\\right)-\\mu\\ln\\left(J\\right)+\\frac{\\lambda}{2}\\ln\\left(J\\right)^{2}\n",
"\\end{equation}"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"using JuliaFEM.API: Model, Material, add_material!, LoadCase, add_element_set!, ForceBC, DisplacementBC\n",
"using JuliaFEM.API: add_boundary_condition!, add_load_case!, add_solver!\n",
"using JuliaFEM.Interfaces: solve!\n",
"using JuliaFEM.Preprocess: parse_abaqus"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Parsing nodes\n",
"INFO: Parsing elements. Type: Tet10\n",
"INFO: Parsing elements. Type: Tri6\n",
"INFO: Creating elset BC1\n",
"INFO: Creating elset BC2\n",
"INFO: model loaded.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" 4.209444 seconds (19.12 M allocations: 565.872 MB, 11.55% gc time)\n"
]
}
],
"source": [
"@time begin\n",
" # Linear models\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_8789_P1.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_16436_P1.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_27343_P1.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_45510_P1.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_75470_P1.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/wrench/wrench_128903_P1.inp\")\n",
"\n",
" # Quadratic models\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_19611_P2.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_55950_P2.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"/Temp/piston_107168_P2.inp\")\n",
" #model = open(JuliaFEM.Core.parse_abaqus, \"../geometry/piston/piston_345757_P2.inp\")\n",
"\n",
" mesh = open(parse_abaqus, \"/Temp/piston_107168_P2.inp\")\n",
" model = Model(\"piston model\", mesh)\n",
" info(\"model loaded.\")\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"JuliaFEM.API.Material(\"steel\",Dict(\"poissons ratio\"=>0.3,\"youngs modulus\"=>210000.0))"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mat = Material(\"steel\")\n",
"mat[\"youngs modulus\"] = 210.0e3\n",
"mat[\"poissons ratio\"] = 0.3\n",
"add_material!(model, \"PISTON\", mat)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1-element Array{ASCIIString,1}:\n",
" \"PISTON\""
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"simulation = LoadCase(:ElasticityProblem)\n",
"\n",
"# simulation = Simulation(:ElasticityProblem, \"elasticity equations\")\n",
"# add_element_set!(simulation, \"PISTON\")\n",
"# add_boundary_condition!(simulation, bc1, bc2)\n",
"# add_simulation!(model, simulation)\n",
"# add_solver!(simulation, :DirectSolver)\n",
"# solve!(model, \"elasticity equations\", 0.0)\n",
"# solve!(model, \"heat equations\", 0.0)\n",
"# solve!(model, \"solve equations 3\", 0.0)\n",
"\n",
"add_element_set!(simulation, \"PISTON\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1-element Array{JuliaFEM.API.DirichletBC,1}:\n",
" JuliaFEM.API.DirichletBC(\"BC2\",\"displacement\"=>0.0)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"traction = Vector{Float64}[[0.0, 0.0, -10.0] for i in 1:6]\n",
"bc1 = ForceBC(\"BC1\", \"displacement traction force\" => traction)\n",
"bc2 = DisplacementBC(\"BC2\", \"displacement\" => 0.0)\n",
"\n",
"# JuliaFEM.API.add_boundary_condition!(prob, bc1, bc2)\n",
"add_boundary_condition!(simulation, bc1)\n",
"add_boundary_condition!(simulation, bc2)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"JuliaFEM.API.LoadCase(:ElasticityProblem,[JuliaFEM.API.NeumannBC(\"BC1\",\"displacement traction force\"=>[[0.0,0.0,-10.0],[0.0,0.0,-10.0],[0.0,0.0,-10.0],[0.0,0.0,-10.0],[0.0,0.0,-10.0],[0.0,0.0,-10.0]])],[JuliaFEM.API.DirichletBC(\"BC2\",\"displacement\"=>0.0)],:DirectSolver,ASCIIString[\"PISTON\"])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"add_solver!(simulation, :DirectSolver)\n",
"add_load_case!(model, \"elasticity equations\", simulation)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"solver = JuliaFEM.Interfaces.get_solver(model, \"elasticity equations\", 0.0);"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"JuliaFEM.Core.Element{JuliaFEM.Core.Tet10}([1,2,3,4,5,6,7,8,9,10],Dict{ASCIIString,JuliaFEM.Core.Field{A<:Union{JuliaFEM.Core.Continuous,JuliaFEM.Core.Discrete},B<:Union{JuliaFEM.Core.Constant,JuliaFEM.Core.Variable},C<:Union{JuliaFEM.Core.TimeInvariant,JuliaFEM.Core.TimeVariant}}}(\"poissons ratio\"=>JuliaFEM.Core.Field{JuliaFEM.Core.Discrete,JuliaFEM.Core.Constant,JuliaFEM.Core.TimeInvariant}(0.3),\"geometry\"=>JuliaFEM.Core.Field{JuliaFEM.Core.Discrete,JuliaFEM.Core.Variable,JuliaFEM.Core.TimeInvariant}([[13.96894,1.54855,-2.99382],[15.71724,2.88794,-2.79243],[14.76115,1.1419,-1.23125],[15.93754,1.0623,-2.82067],[14.84309,2.21825,-2.89313],[15.2392,2.01492,-2.01184],[14.36505,1.34523,-2.11254],[14.95324,1.30543,-2.90725],[15.82739,1.97512,-2.80655],[15.34935,1.1021,-2.02596]]),\"youngs modulus\"=>JuliaFEM.Core.Field{JuliaFEM.Core.Discrete,JuliaFEM.Core.Constant,JuliaFEM.Core.TimeInvariant}(210000.0)))"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"celements = solver.field_problems[1].elements;\n",
"celements[1]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: 0 surface elements\n"
]
}
],
"source": [
"surface_elements = filter((e) -> isa(e, JuliaFEM.Core.Element{JuliaFEM.Core.Tri6}), celements)\n",
"info(\"$(length(surface_elements)) surface elements\")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"62454"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"length(celements)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: # of field problems: 1\n",
"INFO: # of boundary problems: 1\n",
"INFO: Starting iteration 1\n",
"INFO: Assembling field problems...\n",
"INFO: Assembling body 1...\n",
"INFO: Assembly: 10.0 % done. \n",
"INFO: Assembly: 20.0 % done. \n",
"INFO: Assembly: 30.0 % done. \n",
"INFO: Assembly: 40.0 % done. \n",
"INFO: Assembly: 50.0 % done. \n",
"INFO: Assembly: 60.0 % done. \n",
"INFO: Assembly: 70.0 % done. \n",
"INFO: Assembly: 80.0 % done. \n",
"INFO: Assembly: 90.0 % done. \n",
"INFO: Assembly: 100.0 % done. \n",
"INFO: Assembling boundary problems...\n",
"INFO: Assembling boundary 1...\n",
"INFO: Assembly: 10.0 % done. \n",
"INFO: Assembly: 20.0 % done. \n",
"INFO: Assembly: 30.0 % done. \n",
"INFO: Assembly: 40.0 % done. \n",
"INFO: Assembly: 50.0 % done. \n",
"INFO: Assembly: 60.0 % done. \n",
"INFO: Assembly: 70.0 % done. \n",
"INFO: Assembly: 80.0 % done. \n",
"INFO: Assembly: 90.0 % done. \n",
"INFO: Assembly: 100.0 % done. \n",
"INFO: Solving system\n",
"INFO: all dofs = 321504\n",
"INFO: interior dofs = 312936\n",
"INFO: boundary dofs = 8568\n",
"INFO: preparation in 3.385999917984009 seconds\n",
"INFO: displacement on boundary solved.\n",
"INFO: norm[u_boundary_dofs] = 0.0\n",
"INFO: homogeneous dirichlet boundary\n",
"INFO: solve boundary = 0.42100000381469727\n",
"INFO: factorizations done in 14.133000135421753 seconds\n",
"INFO: solved interior in 0.2969999313354492 seconds. norm = 0.0\n",
"INFO: timing info for non-linear iteration:\n"
]
},
{
"data": {
"text/plain": [
"(1,true)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: boundary assembly : 2.1679999828338623\n",
"INFO: field assembly : 279.9069998264313\n",
"INFO: dump matrices to disk : 0.0\n",
"INFO: solve problem : 19.37600016593933\n",
"INFO: update element data : 1.6999998092651367\n",
"INFO: non-linear iteration : 303.1509997844696\n",
"INFO: solver finished in 304.5089998245239 seconds.\n"
]
}
],
"source": [
"solve!(model, \"elasticity equations\", 0.0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Saving results to file"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<Grid Name=\"Grid\">\n",
" <Time Value=\"0\"/>\n",
"</Grid>\n"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"xdoc, xmodel = JuliaFEM.Postprocess.xdmf_new_model()\n",
"temporal_collection = JuliaFEM.Postprocess.xdmf_new_temporal_collection(xmodel)\n",
"grid = JuliaFEM.Postprocess.xdmf_new_grid(temporal_collection; time=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Save geometry to xdmf file"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: number of nodes in model: 8789\n",
"INFO: Number of elements in model: 31437\n"
]
}
],
"source": [
"nnodes = length(model[\"nodes\"])\n",
"info(\"number of nodes in model: $nnodes\")\n",
"\n",
"X = zeros(3, nnodes)\n",
"for nid in keys(model[\"nodes\"])\n",
" X[:, perm[nid]] = model[\"nodes\"][nid]\n",
"end\n",
"\n",
"nelements = length(model[\"elsets\"][\"PISTON\"])\n",
"info(\"Number of elements in model: $nelements\")\n",
"elmap = zeros(Int64, 5, nelements)\n",
"#elmap[1,:] = 0x0026\n",
"elmap[1,:] = 0x6\n",
"for (i, elid) in enumerate(model[\"elsets\"][\"PISTON\"])\n",
" elmap[2:end,i] = Int64[perm[nid] for nid in model[\"elements\"][elid]]\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"JuliaFEM.Postprocess.xdmf_new_mesh(grid, X, elmap)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Save nodal data to model"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(3,8789)"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using JuliaFEM.Core: get_connectivity\n",
"\n",
"u = zeros(3, nnodes)\n",
"\n",
"for element in values(elements)\n",
" isa(element, Element{Tet4}) || continue\n",
" connectivity = get_connectivity(element)\n",
" field = element[\"displacement\"](0.0)\n",
" for (i, nid) in enumerate(connectivity)\n",
" u[:, nid] = field[i]\n",
" end\n",
"end\n",
"size(u)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"JuliaFEM.Postprocess.xdmf_new_field(grid, \"Displacement\", \"nodes\", u)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1525505"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"JuliaFEM.Postprocess.xdmf_save_model(xdoc, \"/tmp/piston_8789_P1.xmf\")"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3x10 Array{Float64,2}:\n",
" 0.0582911 0.339694 0.431768 … 0.124351 0.346492 0.000617283\n",
" 0.0900323 0.22174 0.433814 0.140503 0.275036 0.0044649 \n",
" 0.0838928 -0.148224 0.00262483 -0.11171 0.0843743 -0.0175412 "
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"u[:, 1:10]"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1x3 Array{Float64,2}:\n",
" -0.0471355 -0.468786 -0.222571"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"minimum(u, 2)'"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1x3 Array{Float64,2}:\n",
" 0.511168 0.563004 0.66328"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"maximum(u, 2)'"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"38.52232721814439"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"piston_8789_P1_solution_norm = 38.52232721814439"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"@assert isapprox(norm(vec(u)), piston_8789_P1_solution_norm)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.4.1",
"language": "julia",
"name": "julia-0.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.4.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
@@ -0,0 +1,293 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Some simple examples for calling Fortran from Julia"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Author(s): Tero Frondelius"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Abstract:** Some simple examples for calling Fortran from Julia"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"f = open(\"hello.f90\",\"w\")\n",
"write(f,\"subroutine hello(x,z,y)\\n\")\n",
"write(f,\" real*8 x,y\\n\")\n",
"write(f,\"\"\" print *, \"Hello World! \", x,y, \" testing Jupyter\"\\n\"\"\")\n",
"write(f,\"end subroutine hello\\n\")\n",
"close(f)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"f = open(\"array.f90\",\"w\")\n",
"write(f, \"\"\"\n",
" subroutine array(arr,siz)\n",
" integer*8 siz\n",
" real*8, dimension(siz) :: arr\n",
" do i=1,siz\n",
" print *, \"Arr \", arr(i)\n",
" end do\n",
" end subroutine array\n",
" \"\"\")\n",
"close(f)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"f = open(\"matrix.f90\",\"w\")\n",
"write(f, \"\"\"\n",
"subroutine matrix(arr,siz)\n",
" integer*8 siz\n",
"real*8, dimension(siz,siz) :: arr\n",
" do i=1,siz\n",
" do j=1,siz\n",
" print *, \"Arr(\",i,\",\",j,\") = \", arr(i,j)\n",
" end do\n",
" end do\n",
"end subroutine matrix\n",
" \"\"\")\n",
"close(f)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"run(`gfortran -shared -fPIC -o libhello.so hello.f90 array.f90 matrix.f90`)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"tt = 23.; uu = 12.;"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Hello World! 23.000000000000000 12.000000000000000 testing Jupyter\n"
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t = ccall( (:hello_, \"./libhello\"), Int64, (Ptr{Float64},Ptr{Void},Ptr{Float64}),&tt,{},&uu)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"6"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test = [6. 5. 4. 3. 2. 1.]\n",
"ltest = length(test)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Arr 6.0000000000000000 \n",
" Arr 5.0000000000000000 \n",
" Arr 4.0000000000000000 \n",
" Arr 3.0000000000000000 \n",
" Arr 2.0000000000000000 \n",
" Arr 1.0000000000000000 \n"
]
},
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"out = ccall( (:array_, \"./libhello\"), Int64, (Ptr{Float64},Ptr{Int64}),test,&ltest)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2x2 Array{Float64,2}:\n",
" 1.0 2.0\n",
" 3.0 4.0"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mat_test = [1. 2.; 3. 4.]"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l_mat = size(mat_test)[1]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Arr( 1 , 1 ) = 1.0000000000000000 \n",
" Arr( 1 , 2 ) = 2.0000000000000000 \n",
" Arr( 2 , 1 ) = 3.0000000000000000 \n",
" Arr( 2 , 2 ) = 4.0000000000000000 \n"
]
},
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"out = ccall( (:matrix_, \"./libhello\"), Int64, (Ptr{Float64},Ptr{Int64}),mat_test,&l_mat)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.3.8",
"language": "julia",
"name": "julia-0.3"
},
"language_info": {
"name": "julia",
"version": "0.3.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
@@ -0,0 +1,603 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Abaqus umat interface"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Author(s): Tero Frondelius"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Abstract:** making the initial version to call Abaqus umat"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"--2015-07-25 22:07:34-- http://www.eng.ox.ac.uk/NP/ICP/plasticity_imp/code_imp.f\n",
"Resolving www.eng.ox.ac.uk (www.eng.ox.ac.uk)... 163.1.223.199\n",
"Connecting to www.eng.ox.ac.uk (www.eng.ox.ac.uk)|163.1.223.199|:80... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 7458 (7,3K) [text/plain]\n",
"Saving to: code_imp.f.1\n",
"\n",
" 0K ....... 100% 282M=0s\n",
"\n",
"2015-07-25 22:07:34 (282 MB/s) - code_imp.f.1 saved [7458/7458]\n",
"\n"
]
}
],
"source": [
"run(`wget http://www.eng.ox.ac.uk/NP/ICP/plasticity_imp/code_imp.f`)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"***********************************************************************************\n",
"** UMAT, FOR ABAQUS/STANDARD INCORPORATING ELASTIC-PLASTIC LINEAR **\n",
"** ISOTROPIC HARDENING. LARGE DEFORMATION FORMULATION FOR PLANE STRAIN **\n",
"** AND AXI-SYMMETRIC ELEMENTS. IMPLICIT INTEGRATION WITH CONSISTENT JACOBIAN **\n",
"***********************************************************************************\n",
"***********************************************************************************\n",
"**\n",
"**\n",
"**\n",
"*USER SUBROUTINE\n",
" SUBROUTINE UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,\n",
" 1 RPL,DDSDDT,DRPLDE,DRPLDT,\n",
" 2 STRAN,DSTRAN,TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,CMNAME,\n",
" 3 NDI,NSHR,NTENS,NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,\n",
" 4 CELENT,DFGRD0,DFGRD1,NOEL,NPT,LAYER,KSPT,KSTEP,KINC)\n",
"C\n",
" INCLUDE 'ABA_PARAM.INC'\n",
"C\n",
" CHARACTER*80 CMNAME\n",
"C\n",
"C\n",
" DIMENSION STRESS(NTENS),STATEV(NSTATV),\n",
" 1 DDSDDE(NTENS,NTENS),DDSDDT(NTENS),DRPLDE(NTENS),\n",
" 2 STRAN(NTENS),DSTRAN(NTENS),TIME(2),PREDEF(1),DPRED(1),\n",
" 3 PROPS(NPROPS),COORDS(3),DROT(3,3),DFGRD0(3,3),DFGRD1(3,3)\n",
"C\n",
"C\n",
" PARAMETER (M=3,N=3,ID=3,ZERO=0.D0,ONE=1.D0,TWO=2.D0,THREE=3.D0,\n",
" + SIX=6.D0, NINE=9.D0, TOLER=1.D-5)\n",
"C\n"
]
}
],
"source": [
"run(`head -30 code_imp.f`)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## some implicit type castings"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"f = open(\"ABA_PARAM.INC\",\"w\")\n",
"write(f,\" implicit real*8(a-h,o-z)\\n\")\n",
"write(f,\" parameter (nprecd=2)\\n\")\n",
"close(f)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Let's compile the shared library"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"run(`gfortran -shared -fPIC -o libumat.so code_imp.f`)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Some Abaqus umat interface definitions\n",
"\n",
"|variable | explanation |\n",
"|--------------------|------------------------------------------|\n",
"|DDSDDE(NTENS,NTENS) | Jacobian matrix of the constitutive model|\n",
"|STRESS(NTENS) | the stress tensor (in vector format) |\n",
"|STATEV(NSTATV) | An array containing the solution-dependent state variables. |\n",
"|SSE | Specific elastic strain energy |\n",
"|SPD | plastic dissipation |\n",
"|SCD | “creep” dissipation |\n",
"|RPL | Volumetric heat generation per unit time |\n",
"|DDSDDT(NTENS) | Variation of the stress increments with respect to the temperature. |\n",
"|DRPLDE(NTENS) | Variation of RPL with respect to the strain increments.|\n",
"|DRPLDT | Variation of RPL with respect to the temperature. |\n",
"|RPL | RPL is used to indicate whether or not a cohesive element is open to the tangential flow of pore fluid.|\n",
"|PNEWDT | Ratio of suggested new time increment to the time increment being used |\n",
"|STRAN(NTENS) | An array containing the total strains at the beginning of the increment. |\n",
"|DSTRAN(NTENS) | Array of strain increments. |\n",
"|TIME(1) | Value of step time at the beginning of the current increment. |\n",
"|TIME(2) | Value of total time at the beginning of the current increment. |\n",
"|DTIME | Time increment.|\n",
"|TEMP | Temperature at the start of the increment. |\n",
"|DTEMP | Increment of temperature. |\n",
"|PREDEF | Array of interpolated values of predefined field variables at this point at the start of the increment, based on the values read in at the nodes.|\n",
"|DPRED | Array of increments of predefined field variables. |\n",
"|CMNAME | User-defined material name, left justified. |\n",
"|NDI | Number of direct stress components at this point. |\n",
"|NSHR | Number of engineering shear stress components at this point. |\n",
"|NTENS | Size of the stress or strain component array (NDI + NSHR). |\n",
"|NSTATV | Number of solution-dependent state variables that are associated with this material type |\n",
"|PROPS(NPROPS) | User-specified array of material constants associated with this user material. |\n",
"|NPROPS | User-defined number of material constants associated with this user material. |\n",
"|COORDS | An array containing the coordinates of this point. |\n",
"|DROT(3,3) | Rotation increment matrix. |\n",
"|CELENT | Characteristic element length |\n",
"|DFGRD0(3,3) | Array containing the deformation gradient at the beginning of the increment. |\n",
"|DFGRD1(3,3) | Array containing the deformation gradient at the end of the increment. |\n",
"|NOEL | Element number. |\n",
"|NPT | Integration point number. |\n",
"|LAYER | Layer number (for composite shells and layered solids). |\n",
"|KSPT | Section point number within the current layer. |\n",
"|KSTEP | Step number. |\n",
"|KINC | Increment number. |"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0-element Array{Any,1}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"STRESS = [0. 0. 0. 0.]\n",
"p = 0. # EFFECTIVE PLASTIC STRAIN\n",
"r = 0. # ISOTROPIC HARDENING VARIABLE\n",
"STATEV = [p r]\n",
"NTENS = 4 \n",
"DDSDDE = zeros(NTENS,NTENS)\n",
"SSE = {} # Not used in this example\n",
"SPD = {} # Not used in this example\n",
"SCD = {} # Not used in this example\n",
"RPL = {} # Not used in this example\n",
"DDSDDT = {} # Not used in this example\n",
"DRPLDE = {} # Not used in this example\n",
"DRPLDT = {} # Not used in this example\n",
"STRAN = [0. 0. 0. 0.]\n",
"DSTRAN = [0. 0. 0. 0.]\n",
"TIME = [0. 0.1] # CHECK TIME(2)\n",
"DTIME = {} # Not used in this example\n",
"TEMP = {} # Not used in this example\n",
"DTEMP = {} # Not used in this example\n",
"PREDEF = {} # Not used in this example\n",
"DPRED = {} # Not used in this example\n",
"CMNAME = {} # Not used in this example CHARACTER*80 CMNAME\n",
"NDI = {} # Not used in this example\n",
"NSHR = {} # Not used in this example\n",
"#NTENS correct place\n",
"NSTATV = length(STATEV)\n",
"PROPS = {} # Not used in this example\n",
"NPROPS = {} # Not used in this example\n",
"COORDS = {} # Not used in this example\n",
"DROT = {} # Not used in this example\n",
"PNEWDT = {} # Not used in this example EXPLANATION MISSING\n",
"CELENT = {} # Not used in this example\n",
"DFGRD0 = {} # Not used in this example\n",
"DFGRD1 = {} # Not used in this example\n",
"NOEL = {} # Not used in this example\n",
"NPT = {} # Not used in this example\n",
"LAYER = {} # Not used in this example\n",
"KSPT = {} # Not used in this example\n",
"KSTEP = {} # Not used in this example\n",
"KINC = {} # Not used in this example"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Finally the ccall of the umat"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ccall((:umat_, \"./libumat\"), Int64, \n",
" (Ptr{Float64},Ptr{Float64},Ptr{Float64},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},\n",
" Ptr{Float64},Ptr{Float64},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},\n",
" Ptr{Int64},Ptr{Int64},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},\n",
" Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void}),\n",
" STRESS,STATEV,DDSDDE,SSE,SPD,SCD,RPL,DDSDDT,DRPLDE,DRPLDT,\n",
" STRAN,DSTRAN,TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,CMNAME,NDI,NSHR,\n",
" &NTENS,&NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,DFGRD0,DFGRD1,\n",
" NOEL,NPT,LAYER,KSPT,KSTEP,KINC)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Something happened"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"4x4 Array{Float64,2}:\n",
" 282692.0 121154.0 121154.0 0.0\n",
" 121154.0 282692.0 121154.0 0.0\n",
" 121154.0 121154.0 282692.0 0.0\n",
" 0.0 0.0 0.0 80769.2"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"DDSDDE"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1x2 Array{Float64,2}:\n",
" 0.0 0.0"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"STATEV"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Let's wrap this to simplified Julia function for testing"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"isotropichardening! (generic function with 2 methods)"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function isotropichardening!(stress,p,r,jacobian,strain,DSTRAN)\n",
" local STRESS = stress\n",
" local STATEV = [p r]\n",
" local DDSDDE = jacobian\n",
" local STRAN = strain\n",
" o = ccall((:umat_, \"./libumat\"), Int64, \n",
" (Ptr{Float64},Ptr{Float64},Ptr{Float64},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},\n",
" Ptr{Float64},Ptr{Float64},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},\n",
" Ptr{Void},Ptr{Int64},Ptr{Int64},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},\n",
" Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void},Ptr{Void}),\n",
" STRESS,STATEV,DDSDDE,SSE,SPD,SCD,RPL,DDSDDT,DRPLDE,DRPLDT,\n",
" STRAN,DSTRAN,TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,CMNAME,NDI,\n",
" NSHR,&NTENS,&NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,DFGRD0,DFGRD1,\n",
" NOEL,NPT,LAYER,KSPT,KSTEP,KINC)\n",
" stress = STRESS\n",
" p = STATEV[1]\n",
" r = STATEV[2]\n",
" jacobian = DDSDDE\n",
" strain = STRAN + DSTRAN\n",
" if o != 0 \n",
" throw(\"UMAT failed. Return code is $o\")\n",
" end\n",
" return o\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Now somebody should know how to use this function (help needed)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0[0.0 0.0 0.0 0.0]0.00.0[0.0 0.0 0.0 0.0]\n",
"0[28.269231713558856 12.11538570784259 12.11538570784259 0.0]0.00.0[0.0001 0.0 0.0 0.0]\n",
"0[84.80769514067657 36.34615712352777 36.34615712352777 0.0]0.00.0[0.0002 0.0 0.0 0.0]\n",
"0[169.61539028135314 72.69231424705553 72.69231424705553 0.0]0.00.0[0.00030000000000000003 0.0 0.0 0.0]\n",
"0[282.69231713558855 121.15385707842589 121.15385707842589 0.0]0.00.0[0.0004 0.0 0.0 0.0]\n"
]
},
{
"ename": "LoadError",
"evalue": "\"UMAT failed. Return code is 62421072\"\nwhile loading In[30], in expression starting on line 5",
"output_type": "error",
"traceback": [
"\"UMAT failed. Return code is 62421072\"\nwhile loading In[30], in expression starting on line 5",
"",
" in isotropichardening! at In[29]:21",
" in anonymous at no file:7"
]
}
],
"source": [
"p = 0.0\n",
"r = 0.0\n",
"S = [0. 0. 0. 0.]\n",
"strain = [0. 0. 0. 0.]\n",
"for i in range(0,0.0001,11)\n",
" DSTRAN = [i 0. 0. 0.]\n",
" out = isotropichardening!(S,p,r,DDSDDE,strain,DSTRAN)\n",
" println(out,S,p,r, DSTRAN)\n",
" #println(i)\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Let's find out how many different funtions & subroutines are called"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"fil = open(\"code_imp.f\")\n",
"sub_list = Set{ASCIIString}()\n",
"for line in readlines(fil)\n",
" # Fortran comment = something non whitespce at the firts character\n",
" if ismatch(r\"^[^\\s]\",line)\n",
" #println(line)\n",
" continue\n",
" end\n",
" if ismatch(r\"call\",lowercase(line))\n",
" call = split(lowercase(line))[2] #divede by white space\n",
" sub = split(call,\"(\")[1] #divide by \"(\"\n",
" #println(sub)\n",
" push!(sub_list,sub)\n",
" end\n",
"end\n",
"close(fil)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"Set{ASCIIString}({\"keffp\",\"kdevia\",\"kmlt1\"})"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sub_list"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Next let's find out how many functions and subroutines are defined"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"fil = open(\"code_imp.f\")\n",
"fun_list = Set{ASCIIString}()\n",
"for line in readlines(fil)\n",
" if ismatch(r\"^[^\\s]\",line)\n",
" #println(line)\n",
" continue\n",
" end\n",
" comp = lowercase(line)\n",
" if ismatch(r\"subroutine\",comp) || ismatch(r\"funtion\",comp) || ismatch(r\"external\",comp)\n",
" #println(line)\n",
" call = split(lowercase(line),\"(\")[1] #divede by white space\n",
" sub = split(call)[end] #divide by \"(\"\n",
" #if length(sub) > 1\n",
" # sub = sub[2]\n",
" #end\n",
" #println(sub)\n",
" push!(fun_list,sub)\n",
" end\n",
"end\n",
"close(fil)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"Set{ASCIIString}({\"keffp\",\"dyadicprod\",\"umat\",\"kdevia\",\"dotprod\",\"kmlt1\"})"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fun_list"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## And Finally are all called subroutines defined"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"Set{ASCIIString}({})"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"setdiff(sub_list,fun_list)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.3.8",
"language": "julia",
"name": "julia-0.3"
},
"language_info": {
"name": "julia",
"version": "0.3.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,207 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: module JuliaFEM should explicitly import setindex! from Base\n"
]
}
],
"source": [
"using JuliaFEM: Material, set_material!, get_element_set, ElasticityProblem,\n",
"DirichletProblem, LoadCase, DisplacementBC, ForceBC, DirichletProblem,\n",
"add_boundary_condition!, add_loadcase!"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Parsing nodes\n",
"INFO: Parsing elements. Type: JuliaFEM.Tet4\n",
"INFO: Parsing elements. Type: JuliaFEM.Seg3\n",
"INFO: Creating elset BC1\n",
"INFO: Creating elset BC2\n"
]
},
{
"data": {
"text/plain": [
"JuliaFEM.Material{ASCIIString,Float64}(\"steel\",Dict(\"poissons ratio\"=>0.3,\"youngs modulus\"=>210000.0,\"other values\"=>100000.0))"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Creating elset BC3\n"
]
}
],
"source": [
"\n",
"# Reading nodes, elements and sets from input file\n",
"model = open(JuliaFEM.parse_abaqus, \"/home/olli/.julia/v0.4/JuliaFEM/geometry/piston/piston_8789_P1.inp\")\n",
"\n",
"# Creating material\n",
"# It is possible to create material data with one function\n",
"steel = Material(\"steel\",\n",
" (\"youngs modulus\" => 210.0e3,\n",
" \"poissons ratio\" => 0.3,\n",
" \"other values\" => 100e3),\n",
")\n",
"\n",
"# Or by adding row by row\n",
"steel2 = Material(\"Steel2\")\n",
"steel2[\"youngs modulus\"] = 210.0e3\n",
"steel2[\"poissons ratio\"] = 10.0\n",
"\n",
"# Setting material to element set\n",
"set_material!(model, steel, \"PISTON\")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"JuliaFEM.NeumannBC{ASCIIString}(\"displacement traction force\",1000,\"BC1\")"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Fetchig set from model\n",
"piston = get_element_set(model, \"PISTON\")\n",
"\n",
"# Creating problems:\n",
"# Elasticity \n",
"elasticity_problem = ElasticityProblem()\n",
"\n",
"# Boundary conditions\n",
"BC1 = DisplacementBC(\"displacement u1\", 0.0, \"BC2\")\n",
"F1 = ForceBC(\"displacement traction force\", 1000, \"BC1\")\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2-element Array{Array{Union{JuliaFEM.DirichletBC{S<:AbstractString},JuliaFEM.NeumannBC{S<:AbstractString}},1},1}:\n",
" Union{JuliaFEM.DirichletBC{S<:AbstractString},JuliaFEM.NeumannBC{S<:AbstractString}}[JuliaFEM.NeumannBC{ASCIIString}(\"displacement traction force\",1000,\"BC1\"),JuliaFEM.DirichletBC{ASCIIString}(\"displacement u1\",0.0,\"BC2\"),JuliaFEM.NeumannBC{ASCIIString}(\"displacement traction force\",1000,\"BC1\"),JuliaFEM.DirichletBC{ASCIIString}(\"displacement u1\",0.0,\"BC2\")]\n",
" Union{JuliaFEM.DirichletBC{S<:AbstractString},JuliaFEM.NeumannBC{S<:AbstractString}}[JuliaFEM.NeumannBC{ASCIIString}(\"displacement traction force\",1000,\"BC1\"),JuliaFEM.DirichletBC{ASCIIString}(\"displacement u1\",0.0,\"BC2\"),JuliaFEM.NeumannBC{ASCIIString}(\"displacement traction force\",1000,\"BC1\"),JuliaFEM.DirichletBC{ASCIIString}(\"displacement u1\",0.0,\"BC2\")]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"# Possible ways to create a loadcase, whihc holds all data for calculation\n",
"load4 = LoadCase(elasticity_problem)\n",
"load = LoadCase(elasticity_problem, [BC1])\n",
"load2 = LoadCase(elasticity_problem, [BC1, F1])\n",
"load3 = LoadCase(elasticity_problem, BC1)\n",
"\n",
"# Couple of ways to add boundary conditions to loadcase\n",
"add_boundary_condition!(load, BC1)\n",
"add_boundary_condition!(load2, F1)\n",
"add_boundary_condition!(load3, BC1)\n",
"add_boundary_condition!(load4, [F1, BC1])\n",
"add_boundary_condition!(load, [F1, BC1])\n",
"add_boundary_condition!(load4, [F1, BC1])\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"# Adding load case to model, various ways...\n",
"add_loadcase!(model, load)\n",
"add_loadcase!(model, [load, load2, load3])\n",
"0"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Select solver\n",
"solver = DirectSolver()\n",
"\n",
"solve!(model, solver)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.4.1-pre",
"language": "julia",
"name": "julia-0.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.4.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,297 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"300"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using JuliaFEM\n",
"\n",
"using JuliaFEM.Core: Node, Element, Seg2, Tri3, Quad4, Hex8\n",
"using JuliaFEM.Core: Problem, FieldProblem, BoundaryProblem, Dirichlet, Elasticity, Mortar\n",
"using JuliaFEM.Core: Solver, SparseMatrixCOO\n",
"using JuliaFEM.Core: get_elements, update!, calculate_normal_tangential_coordinates!,\n",
"get_connectivity, get_field_assembly, get_boundary_problems, handle_overconstraint_error!\n",
"using JuliaFEM.Preprocess: parse_aster_med_file, aster_create_elements\n",
"import JuliaFEM.Core: solve_linear_system\n",
"\n",
"using PyPlot\n",
"\n",
"ENV[\"COLUMNS\"] = 300"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Found 6 element sets: TOP, DIE, GROUND, SLAB, DIE_TO_SLAB, SLAB_TO_DIE\n",
"INFO: normal tangential for first slave element\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Array(Float64,(3,3)) 3x3 Array{Float64,2}"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: # of master elements: 120\n",
"INFO: # of slave elements: 80\n"
]
}
],
"source": [
"function create_ironing_problem(meshfile=\"/geometry/3d_ironing/MESH_SPARSE.med\")\n",
"\n",
" mesh = parse_aster_med_file(Pkg.dir(\"JuliaFEM\")*meshfile)\n",
" \n",
" body1 = Problem(Elasticity, \"SLAB\", 3)\n",
" body1_elements = aster_create_elements(mesh, :SLAB, :HE8)\n",
" update!(body1_elements, \"youngs modulus\", 288.0)\n",
" update!(body1_elements, \"poissons ratio\", 1/3)\n",
" push!(body1, body1_elements...)\n",
"\n",
" body2 = Problem(Elasticity, \"DIE\", 3)\n",
" body2_elements = aster_create_elements(mesh, :DIE, :HE8)\n",
" update!(body2_elements, \"youngs modulus\", 288000.0)\n",
" update!(body2_elements, \"poissons ratio\", 1/3)\n",
" push!(body2, body2_elements...)\n",
"\n",
" # boundary conditions\n",
" bc1 = Problem(Dirichlet, \"bottom surface of slab\", 3, \"displacement\")\n",
" bc1_elements = aster_create_elements(mesh, :GROUND, :QU4)\n",
" update!(bc1_elements, \"displacement 1\", 0.0)\n",
" update!(bc1_elements, \"displacement 2\", 0.0)\n",
" update!(bc1_elements, \"displacement 3\", 0.0)\n",
" push!(bc1, bc1_elements...)\n",
"\n",
" bc2 = Problem(Dirichlet, \"top surface of die\", 3, \"displacement\")\n",
" bc2_elements = aster_create_elements(mesh, :TOP, :QU4)\n",
" #d = [0.0, 0.0, -1.0]\n",
" #update!(bc2_elements, \"displacement\", Vector{Float64}[d, d, d, d])\n",
" update!(bc2_elements, \"displacement 1\", 0.0)\n",
" update!(bc2_elements, \"displacement 2\", 0.0)\n",
" update!(bc2_elements, \"displacement 3\", -1.0)\n",
" push!(bc2, bc2_elements...)\n",
"\n",
" # contact\n",
" bc3 = Problem(Mortar, \"contact between slab and die\", 3, \"displacement\")\n",
" bc3_slave_elements = aster_create_elements(mesh, :SLAB_TO_DIE, :QU4)\n",
" bc3_master_elements = aster_create_elements(mesh, :DIE_TO_SLAB, :QU4)\n",
" update!(bc3_slave_elements, \"master elements\", bc3_master_elements)\n",
" info(\"normal tangential for first slave element\")\n",
" calculate_normal_tangential_coordinates!(bc3_slave_elements, 0.0)\n",
" Q = bc3_slave_elements[1](\"normal-tangential coordinates\", [0.0, 0.0], 0.0)\n",
" dump(Q)\n",
" push!(bc3, bc3_slave_elements...)\n",
" push!(bc3, bc3_master_elements...)\n",
" info(\"# of master elements: $(length(bc3_master_elements))\")\n",
" info(\"# of slave elements: $(length(bc3_slave_elements))\")\n",
"\n",
" return body1, body2, bc1, bc2, bc3\n",
"\n",
"end\n",
"\n",
"body1, body2, bc1, bc2, bc3 = create_ironing_problem();"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
":\n",
" 0.0 1.0 0.0\n",
" 0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n",
"Array(Float64,(3,3)) 3x3 Array{Float64,2}:\n",
" 0.0 1.0 0.0\n",
" 0.0 0.0 1.0\n",
" 1.0 0.0 0.0\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Found 6 element sets: TOP, DIE, GROUND, SLAB, DIE_TO_SLAB, SLAB_TO_DIE\n",
"INFO: normal tangential for first slave element\n",
"INFO: # of master elements: 120\n",
"INFO: # of slave elements: 80\n",
"INFO: solving linear system of 5 problems.\n",
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
"INFO: PDASS: contact nodes: [304,307,308,309,310,318,322,323,324,325,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: PDASS: active nodes: Int64[]\n",
"INFO: PDASS: inactive nodes: [304,307,308,309,310,318,322,323,324,325,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: UMFPACK: solved in 0.6064090728759766 seconds. norm = 17.32050807568924\n",
"INFO: solving linear system of 5 problems.\n",
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
"INFO: PDASS: contact nodes: [304,307,308,309,310,318,322,323,324,325,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: PDASS: active nodes: [348,349,350,351,352,353,354,355,356,357,386,387,388,389,390,391,392,393,394,395,550,551,552,553,554,555,556,557,558,559,569,570,571,572,573,574,575,576,577,578,588,589,590,591,592,593,594,595,596,597]\n",
"INFO: PDASS: inactive nodes: [304,307,308,309,310,318,322,323,324,325,358,359,360,361,362,363,364,365,366,396,397,398,399,400,401,402,403,404,560,561,562,563,564,565,566,567,568,579,580,581,582,583,584,585,586,587,598,599,600,601,602,603,604,605,606]\n",
"INFO: UMFPACK: solved in 0.24304413795471191 seconds. norm = 18.1021717204183\n",
"INFO: solving linear system of 5 problems.\n",
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
"INFO: PDASS: contact nodes: [304,307,308,309,310,318,322,323,324,325,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: PDASS: active nodes: [349,350,351,352,353,354,355,356,387,388,389,390,391,392,393,394,551,552,553,554,555,556,557,558,570,571,572,573,574,575,576,577,589,590,591,592,593,594,595,596]\n",
"INFO: PDASS: inactive nodes: [304,307,308,309,310,318,322,323,324,325,348,357,358,359,360,361,362,363,364,365,366,386,395,396,397,398,399,400,401,402,403,404,550,559,560,561,562,563,564,565,566,567,568,569,578,579,580,581,582,583,584,585,586,587,588,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: UMFPACK: solved in 0.12660002708435059 seconds. norm = 18.174500081971626\n",
"INFO: solving linear system of 5 problems.\n",
"INFO: PDASS: Starting primal-dual active set strategy to determine active constraints\n",
"INFO: PDASS: contact nodes: [304,307,308,309,310,318,322,323,324,325,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: PDASS: active nodes: [349,350,351,352,353,354,355,356,387,388,389,390,391,392,393,394,551,552,553,554,555,556,557,558,570,571,572,573,574,575,576,577,589,590,591,592,593,594,595,596]\n",
"INFO: PDASS: inactive nodes: [304,307,308,309,310,318,322,323,324,325,348,357,358,359,360,361,362,363,364,365,366,386,395,396,397,398,399,400,401,402,403,404,550,559,560,561,562,563,564,565,566,567,568,569,578,579,580,581,582,583,584,585,586,587,588,597,598,599,600,601,602,603,604,605,606]\n",
"INFO: UMFPACK: solved in 0.14113306999206543 seconds. norm = 18.174500081971626\n",
"INFO: Converged in 4 iterations.\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"body1, body2, bc1, bc2, bc3 = create_ironing_problem()\n",
"bc3.properties.inequality_constraints = true\n",
"#bc3.properties.normal_condition = :Contact\n",
"#bc3.properties.tangential_condition = :Slip\n",
"#bc3.properties.minimum_distance = 1\n",
"solver = Solver(\"solve ironing problem.\")\n",
"push!(solver, body1, body2, bc1, bc2, bc3)\n",
"call(solver)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: 360 elements.\n",
"INFO: XDFM: ndim = 2160\n",
"INFO: model dumped to /tmp/ironing.xmf\n"
]
}
],
"source": [
"using JuliaFEM.Postprocess: xdmf_new_model, xdmf_new_temporal_collection, xdmf_new_grid,\n",
" xdmf_new_mesh!, xdmf_new_nodal_field!, xdmf_save_model\n",
"using JuliaFEM.Core: Element\n",
"\n",
"function xdmf_dump(all_elements, filename=\"/tmp/xdmf_result.xmf\")\n",
" info(\"$(length(all_elements)) elements.\")\n",
" xdoc, xmodel = xdmf_new_model()\n",
" coll = xdmf_new_temporal_collection(xmodel)\n",
" grid = xdmf_new_grid(coll; time=0.0)\n",
"\n",
" Xg = Dict{Int64, Vector{Float64}}()\n",
" ug = Dict{Int64, Vector{Float64}}()\n",
" nids = Dict{Int64, Int64}()\n",
" for element in all_elements\n",
" conn = get_connectivity(element)\n",
" for (i, c) in enumerate(conn)\n",
" nids[c] = c\n",
" end\n",
" X = element(\"geometry\", 0.0)\n",
" for (i, c) in enumerate(conn)\n",
" Xg[c] = X[i]\n",
" end\n",
" haskey(element, \"displacement\") || continue\n",
" u = element(\"displacement\", 0.0)\n",
" for (i, c) in enumerate(conn)\n",
" ug[c] = u[i]\n",
" end\n",
" end\n",
" perm = sort(collect(keys(Xg)))\n",
" nodes = Vector{Float64}[Xg[i] for i in perm]\n",
" disp = Vector{Float64}[ug[i] for i in perm]\n",
" nids = Int[nids[i] for i in perm]\n",
" inids = Dict{Int64, Int64}()\n",
" for (i, nid) in enumerate(nids)\n",
" inids[nid] = i\n",
" end\n",
" elements = []\n",
" for element in all_elements\n",
" isa(element, Element{Hex8}) || continue\n",
" conn = get_connectivity(element)\n",
" nconn = [inids[i] for i in conn]\n",
" push!(elements, (:Hex8, nconn))\n",
" end\n",
"\n",
" xdmf_new_mesh!(grid, nodes, elements)\n",
" xdmf_new_nodal_field!(grid, \"displacement\", disp)\n",
" xdmf_save_model(xdoc, filename)\n",
" info(\"model dumped to $filename\")\n",
"end\n",
"\n",
"xdmf_dump([body1.elements; body2.elements], \"/tmp/ironing.xmf\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.4.3",
"language": "julia",
"name": "julia-0.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+12
View File
@@ -0,0 +1,12 @@
This is the area for JuliaFEM.jl notebook development
-----------------------------------------------------
We use notebooks heavily to test our ideas and develop new code. Code in these
notebooks most likely will not up to date code: *DO NOT COPYPASTE* code
from here unless you really do know what you are doing. These notebooks are not
tested automatically.
Our "official" notebooks are in verification and in tutorials:
https://github.com/JuliaFEM/JuliaFEM.jl/tree/master/verification
https://github.com/JuliaFEM/JuliaFEM.jl/tree/master/docs/tutorials