diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 222f8b3..0647489 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,7 +28,7 @@ We support Julia versions 0.4+. [See issue #26](https://github.com/JuliaFEM/Juli
Only pull requests to src folder
--------------------------------
-See [issue #29](https://github.com/JuliaFEM/JuliaFEM.jl/issues/29). This ensures peer review check for contributors and hopefully will decrease the number of merge conflicts.
+See [issue #29](https://github.com/JuliaFEM/JuliaFEM.jl/issues/29). This ensures peer review check for contributors and hopefully will decrease the number of merge conflicts. Before making the pull request runn all test: either type `julia> Pkg.test("JuliaFEM")` at REPL or `julia test/runtests.jl` at command line.
New technology should be introduced through notebooks
-----------------------------------------------------
diff --git a/REQUIRE b/REQUIRE
index c09da18..15e0e0d 100644
--- a/REQUIRE
+++ b/REQUIRE
@@ -2,5 +2,6 @@ julia 0.4-
Logging
LightXML
Docile
+Lexicon
FactCheck
HDF5
diff --git a/docs/api/JuliaFEM.elasticity_solver.md b/docs/api/JuliaFEM.elasticity_solver.md
new file mode 100644
index 0000000..99a6ede
--- /dev/null
+++ b/docs/api/JuliaFEM.elasticity_solver.md
@@ -0,0 +1,154 @@
+# JuliaFEM.elasticity_solver
+
+## Internal
+
+---
+
+
+#### 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:171](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L171)
+
+---
+
+
+#### 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:130](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L130)
+
+---
+
+
+#### calc_local_matrices!(X, u, R, Kt, N, dNdchi, lambda_, mu_, ipoints, iweights) [¶](#method__calc_local_matrices.1)
+Calculate local tangent stiffness matrix and residual force vector R = T - F
+
+
+*source:*
+[JuliaFEM/src/elasticity_solver.jl:68](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L68)
+
+---
+
+
+#### 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:218](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L218)
+
+---
+
+
+#### 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:257](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L257)
+
+---
+
+
+#### interpolate{T<:Real}(field::Array{T<:Real, 1}, basis::Function, ip) [¶](#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/elasticity_solver.jl:30](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L30)
+
+---
+
+
+#### 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:278](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/elasticity_solver.jl#L278)
+
diff --git a/docs/api/JuliaFEM.md b/docs/api/JuliaFEM.md
new file mode 100644
index 0000000..10bacef
--- /dev/null
+++ b/docs/api/JuliaFEM.md
@@ -0,0 +1,104 @@
+# JuliaFEM
+
+## Exported
+
+---
+
+
+#### add_elements(model, elements) [¶](#method__add_elements.1)
+Add new elements to model.
+Parameters
+----------
+list of dicts, dict = {element_type => elcode, elids => [node ids..]}
+
+Examples
+--------
+Create two tet4 element and add them:
+
+>>> m = new_model()
+>>> const TET4 = 0x6
+>>> el1 = Dict("element_type" => TET4, "node_ids" => [1, 2, 3, 4])
+>>> el2 = Dict("element_type" => TET4, "node_ids" => [4, 3, 2, 1])
+
+In dict key means element id
+
+>>> elements = Dict(1 => el1, 2 => el2)
+>>> add_elements(m, elements)
+
+
+
+*source:*
+[JuliaFEM/src/JuliaFEM.jl:102](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/JuliaFEM.jl#L102)
+
+---
+
+
+#### get_elements(model, element_ids) [¶](#method__get_elements.1)
+Get subset of elements from model.
+Parameters
+----------
+element_ids : list of ints
+ Element id numbers
+
+Returns
+-------
+Dict
+{element_type = XXX, node_ids = [a, b, c, d, e, ..., n]}
+
+
+*source:*
+[JuliaFEM/src/JuliaFEM.jl:126](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/JuliaFEM.jl#L126)
+
+---
+
+
+#### get_field(field_type, field_name) [¶](#method__get_field.1)
+Get field from model.
+
+Parameters
+----------
+field_type : Dict()
+ Target topology (model.model, model.nodes, model.elements,
+ model.element_nodes, model.element_gauss
+field_name : str
+ Field name
+
+create_if_doesnt_exist : bool, optional
+ If field doesn't exists, create one and return empty field
+
+Raises
+------
+Error, if field not found and create_if_doesnt_exist == false
+
+
+*source:*
+[JuliaFEM/src/JuliaFEM.jl:67](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/JuliaFEM.jl#L67)
+
+---
+
+
+#### new_model() [¶](#method__new_model.1)
+Initialize empty model.
+
+Parameters
+----------
+None
+
+Returns
+-------
+New model struct
+
+
+*source:*
+[JuliaFEM/src/JuliaFEM.jl:41](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/JuliaFEM.jl#L41)
+
+---
+
+
+#### JuliaFEM.Model [¶](#type__model.1)
+Basic model
+
+
+*source:*
+[JuliaFEM/src/JuliaFEM.jl:19](https://github.com/JuliaFEM/JuliaFEM.jl/tree/1e1704126d7c25595a71838fd8a59ba5d2212219/src/JuliaFEM.jl#L19)
+
diff --git a/docs/api/README.md b/docs/api/README.md
new file mode 100644
index 0000000..f11064e
--- /dev/null
+++ b/docs/api/README.md
@@ -0,0 +1,2 @@
+Files in this directory are generated using the `build.jl` script. Make
+all changes to the originating docstrings/files rather than these ones.
diff --git a/docs/api/README_new.md b/docs/api/README_new.md
new file mode 100644
index 0000000..f11064e
--- /dev/null
+++ b/docs/api/README_new.md
@@ -0,0 +1,2 @@
+Files in this directory are generated using the `build.jl` script. Make
+all changes to the originating docstrings/files rather than these ones.
diff --git a/docs/api/index.md b/docs/api/index.md
new file mode 100644
index 0000000..bcc500b
--- /dev/null
+++ b/docs/api/index.md
@@ -0,0 +1,43 @@
+# API-INDEX
+
+
+## MODULE: JuliaFEM
+
+---
+
+## Methods [Exported]
+
+[add_elements(model, elements)](JuliaFEM.md#method__add_elements.1) Add new elements to model.
+
+[get_elements(model, element_ids)](JuliaFEM.md#method__get_elements.1) Get subset of elements from model.
+
+[get_field(field_type, field_name)](JuliaFEM.md#method__get_field.1) Get field from model.
+
+[new_model()](JuliaFEM.md#method__new_model.1) Initialize empty model.
+
+---
+
+## Types [Exported]
+
+[JuliaFEM.Model](JuliaFEM.md#type__model.1) Basic model
+
+## MODULE: JuliaFEM.elasticity_solver
+
+---
+
+## Methods [Internal]
+
+[assemble!(fe, eldofs_, I, V)](JuliaFEM.elasticity_solver.md#method__assemble.1) Assemble global RHS to I,V ready for sparse format
+
+[assemble!(ke, eldofs_, I, J, V)](JuliaFEM.elasticity_solver.md#method__assemble.2) Assemble global stiffness matrix to I,J,V ready for sparse format
+
+[calc_local_matrices!(X, u, R, Kt, N, dNdchi, lambda_, mu_, ipoints, iweights)](JuliaFEM.elasticity_solver.md#method__calc_local_matrices.1) Calculate local tangent stiffness matrix and residual force vector R = T - F
+
+[eliminate_boundary_conditions(dirichletbc, I, J, V)](JuliaFEM.elasticity_solver.md#method__eliminate_boundary_conditions.1) Eliminate Dirichlet boundary conditions from matrix
+
+[eliminate_boundary_conditions(dirichletbc, I, V)](JuliaFEM.elasticity_solver.md#method__eliminate_boundary_conditions.2) Eliminate Dirichlet boundary conditions from vector
+
+[interpolate{T<:Real}(field::Array{T<:Real, 1}, basis::Function, ip)](JuliaFEM.elasticity_solver.md#method__interpolate.1) Interpolate field variable using basis functions f for point ip.
+
+[solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc, lambda, mu, N, dNdchi, ipoints, iweights)](JuliaFEM.elasticity_solver.md#method__solve_elasticity_increment.1) Solve one increment of elasticity problem
+
diff --git a/docs/build.jl b/docs/build.jl
new file mode 100644
index 0000000..bbe11c9
--- /dev/null
+++ b/docs/build.jl
@@ -0,0 +1,51 @@
+using Docile, Lexicon, JuliaFEM
+
+const api_directory = "api"
+const modules = [JuliaFEM, JuliaFEM.elasticity_solver]
+
+cd(dirname(@__FILE__)) do
+ # Generate and save the contents of docstrings as markdown files.
+ index = Index()
+ for mod in modules
+ Lexicon.update!(index, save(joinpath(api_directory, "$(mod).md"), mod))
+ end
+ save(joinpath(api_directory, "index.md"), index; md_subheader = :category)
+
+ # Add a reminder not to edit the generated files.
+ open(joinpath(api_directory, "README.md"), "w") do f
+ print(f, """
+ Files in this directory are generated using the `build.jl` script. Make
+ all changes to the originating docstrings/files rather than these ones.
+ """)
+ end
+
+ info("Adding all documentation changes in $(api_directory) to this commit.")
+ success(`git add $(api_directory)`) || exit(1)
+
+end
+
+
+cd(dirname(dirname(@__FILE__))) do
+ yaml = """
+ # This is automatically generated by docs/build.jl. Edit that file if you
+ # wish to make any permenant changes.
+ site_name: JuliaFEM.jl
+ site_description: JuliaFEM.jl, open-source software for reliable, scalable, distributed Finite Element Method.
+ repo_name: GitHub
+ docs_dir: 'docs'
+ site_dir: 'site'
+ repo_url: https://github.com/JuliaFEM/JuliaFEM.jl
+ pages:
+ - Home: 'README.md'
+ - Overview: 'api/index.md'
+ - API Docs:
+ - JuliaFEM: 'api/JuliaFEM.md'
+ - JuliaFEM.elasticity_solver: 'api/JuliaFEM.elasticity_solver.md'
+ """
+
+ # TODO: add the solutions if I figure out how to get them to render properly
+
+ open("mkdocs.yml", "w") do f
+ write(f, yaml)
+ end
+end
diff --git a/docs/links.md b/docs/links.md
index c8f0ceb..c9f7ec9 100644
--- a/docs/links.md
+++ b/docs/links.md
@@ -1,5 +1,22 @@
-Delaynay triangulation
+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
diff --git a/geometry/3d_beam/palkki.inp b/geometry/3d_beam/palkki.inp
new file mode 100644
index 0000000..6746166
--- /dev/null
+++ b/geometry/3d_beam/palkki.inp
@@ -0,0 +1,566 @@
+**NSET COUNT = 298
+*NODE,NSET=NALL
+1, 20.00000, 5.00000, 5.00000
+2, 25.00000, 5.00000, 5.00000
+3, 40.00000, 5.00000, 5.00000
+4, 42.50000, 5.00000, 2.50000
+5, 47.50000, 7.50000, 5.00000
+6, 42.50000, 7.50000, 5.00000
+7, 85.00000, 5.00000, 5.00000
+8, 90.00000, 5.00000, 5.00000
+9, 80.00000, 5.00000, 5.00000
+10, 77.50000, 5.00000, 2.50000
+11, 92.50000, 2.50000, 5.00000
+12, 97.50000, 2.50000, 5.00000
+13, 95.00000, 7.50000, 7.50000
+14, 97.50000, 5.00000, 2.50000
+15, 92.50000, 5.00000, 2.50000
+16, 97.50000, 7.50000, 5.00000
+17, 2.50000, 2.50000, 5.00000
+18, 5.00000, 2.50000, 2.50000
+19, 35.00000, 5.00000, 5.00000
+20, 10.00000, 5.00000, 5.00000
+21, 15.00000, 5.00000, 5.00000
+22, 55.00000, 2.50000, 7.50000
+23, 77.50000, 5.00000, 7.50000
+24, 75.00000, 7.50000, 7.50000
+25, 75.00000, 2.50000, 7.50000
+26, 75.00000, 5.00000, 5.00000
+27, 75.00000, 2.50000, 2.50000
+28, 75.00000, 7.50000, 2.50000
+29, 2.50000, 7.50000, 5.00000
+30, 7.50000, 7.50000, 5.00000
+31, 5.00000, 5.00000, 5.00000
+32, 7.50000, 2.50000, 5.00000
+33, 5.00000, 2.50000, 7.50000
+34, 30.00000, 5.00000, 5.00000
+35, 50.36999, 4.74900, 5.47225
+36, 50.18499, 2.37450, 7.73613
+37, 47.68499, 4.87450, 7.73613
+38, 52.68499, 4.87450, 7.73613
+39, 45.00000, 2.50000, 7.50000
+40, 47.68499, 2.37450, 5.23613
+41, 52.68499, 2.37450, 5.23613
+42, 55.00000, 7.50000, 7.50000
+43, 55.00000, 5.00000, 5.00000
+44, 52.68499, 7.37450, 5.23613
+45, 50.18499, 7.37450, 7.73613
+46, 50.18499, 7.37450, 2.73613
+47, 47.50000, 5.00000, 2.50000
+48, 50.18499, 2.37450, 2.73613
+49, 52.68499, 4.87450, 2.73613
+50, 55.00000, 2.50000, 2.50000
+51, 55.00000, 7.50000, 2.50000
+52, 65.13577, 4.94114, 4.99547
+53, 62.56788, 2.47057, 7.49773
+54, 62.56788, 2.47057, 2.49773
+55, 60.06788, 2.47057, 4.99773
+56, 60.06788, 7.47057, 4.99773
+57, 57.50000, 5.00000, 2.50000
+58, 57.50000, 5.00000, 7.50000
+59, 62.56788, 7.47057, 7.49773
+60, 67.56788, 7.47057, 7.49773
+61, 67.56788, 2.47057, 7.49773
+62, 67.56788, 2.47057, 2.49773
+63, 70.06788, 2.47057, 4.99773
+64, 70.06788, 7.47057, 4.99773
+65, 72.50000, 5.00000, 7.50000
+66, 70.06788, 4.97057, 2.49773
+67, 67.56788, 7.47057, 2.49773
+68, 62.56788, 7.47057, 2.49773
+69, 50.00000, 10.00000, 0.00000
+70, 50.00000, 10.00000, 10.00000
+71, 55.00000, 10.00000, 5.00000
+72, 50.00000, 10.00000, 5.00000
+73, 52.50000, 10.00000, 7.50000
+74, 52.50000, 10.00000, 2.50000
+75, 60.00000, 10.00000, 10.00000
+76, 55.00000, 10.00000, 10.00000
+77, 57.50000, 10.00000, 7.50000
+78, 60.00000, 10.00000, 0.00000
+79, 55.00000, 10.00000, 0.00000
+80, 57.50000, 10.00000, 2.50000
+81, 60.00000, 10.00000, 5.00000
+82, 100.00000, 10.00000, 0.00000
+83, 95.00000, 10.00000, 5.00000
+84, 100.00000, 10.00000, 10.00000
+85, 97.50000, 10.00000, 2.50000
+86, 97.50000, 10.00000, 7.50000
+87, 100.00000, 10.00000, 5.00000
+88, 90.00000, 10.00000, 10.00000
+89, 92.50000, 10.00000, 7.50000
+90, 95.00000, 10.00000, 10.00000
+91, 90.00000, 10.00000, 0.00000
+92, 95.00000, 10.00000, 0.00000
+93, 92.50000, 10.00000, 2.50000
+94, 90.00000, 10.00000, 5.00000
+95, 70.00000, 10.00000, 10.00000
+96, 80.00000, 10.00000, 10.00000
+97, 75.00000, 10.00000, 5.00000
+98, 75.00000, 10.00000, 10.00000
+99, 77.50000, 10.00000, 7.50000
+100, 72.50000, 10.00000, 7.50000
+101, 80.00000, 10.00000, 0.00000
+102, 80.00000, 10.00000, 5.00000
+103, 77.50000, 10.00000, 2.50000
+104, 70.00000, 10.00000, 0.00000
+105, 72.50000, 10.00000, 2.50000
+106, 70.00000, 10.00000, 5.00000
+107, 75.00000, 10.00000, 0.00000
+108, 0.00000, 10.00000, 0.00000
+109, 0.00000, 10.00000, 10.00000
+110, 10.00000, 10.00000, 0.00000
+111, 0.00000, 10.00000, 5.00000
+112, 5.00000, 10.00000, 5.00000
+113, 5.00000, 10.00000, 0.00000
+114, 10.00000, 10.00000, 10.00000
+115, 10.00000, 10.00000, 5.00000
+116, 5.00000, 10.00000, 10.00000
+117, 20.00000, 10.00000, 0.00000
+118, 20.00000, 10.00000, 10.00000
+119, 30.00000, 10.00000, 0.00000
+120, 20.00000, 10.00000, 5.00000
+121, 25.00000, 10.00000, 5.00000
+122, 25.00000, 10.00000, 0.00000
+123, 30.00000, 10.00000, 10.00000
+124, 30.00000, 10.00000, 5.00000
+125, 25.00000, 10.00000, 10.00000
+126, 65.00000, 10.00000, 0.00000
+127, 65.00000, 10.00000, 5.00000
+128, 65.00000, 10.00000, 10.00000
+129, 40.00000, 10.00000, 10.00000
+130, 40.00000, 10.00000, 0.00000
+131, 45.00000, 10.00000, 10.00000
+132, 45.00000, 10.00000, 5.00000
+133, 40.00000, 10.00000, 5.00000
+134, 45.00000, 10.00000, 0.00000
+135, 15.00000, 10.00000, 5.00000
+136, 15.00000, 10.00000, 0.00000
+137, 35.00000, 10.00000, 0.00000
+138, 35.00000, 10.00000, 5.00000
+139, 85.00000, 10.00000, 5.00000
+140, 85.00000, 10.00000, 0.00000
+141, 85.00000, 10.00000, 10.00000
+142, 35.00000, 10.00000, 10.00000
+143, 15.00000, 10.00000, 10.00000
+144, 55.00000, 5.00000, 0.00000
+145, 50.00000, 0.00000, 0.00000
+146, 52.50000, 7.50000, 0.00000
+147, 52.50000, 2.50000, 0.00000
+148, 50.00000, 5.00000, 0.00000
+149, 60.00000, 0.00000, 0.00000
+150, 57.50000, 2.50000, 0.00000
+151, 55.00000, 0.00000, 0.00000
+152, 57.50000, 7.50000, 0.00000
+153, 60.00000, 5.00000, 0.00000
+154, 10.00000, 0.00000, 0.00000
+155, 0.00000, 0.00000, 0.00000
+156, 5.00000, 5.00000, 0.00000
+157, 5.00000, 0.00000, 0.00000
+158, 2.50000, 2.50000, 0.00000
+159, 7.50000, 2.50000, 0.00000
+160, 7.50000, 7.50000, 0.00000
+161, 10.00000, 5.00000, 0.00000
+162, 0.00000, 5.00000, 0.00000
+163, 2.50000, 7.50000, 0.00000
+164, 80.00000, 0.00000, 0.00000
+165, 70.00000, 0.00000, 0.00000
+166, 75.00000, 5.00000, 0.00000
+167, 75.00000, 0.00000, 0.00000
+168, 72.50000, 2.50000, 0.00000
+169, 77.50000, 2.50000, 0.00000
+170, 77.50000, 7.50000, 0.00000
+171, 80.00000, 5.00000, 0.00000
+172, 70.00000, 5.00000, 0.00000
+173, 72.50000, 7.50000, 0.00000
+174, 45.00000, 5.00000, 0.00000
+175, 40.00000, 0.00000, 0.00000
+176, 40.00000, 5.00000, 0.00000
+177, 45.00000, 0.00000, 0.00000
+178, 90.00000, 0.00000, 0.00000
+179, 100.00000, 0.00000, 0.00000
+180, 90.00000, 5.00000, 0.00000
+181, 95.00000, 5.00000, 0.00000
+182, 95.00000, 0.00000, 0.00000
+183, 85.00000, 0.00000, 0.00000
+184, 85.00000, 5.00000, 0.00000
+185, 65.00000, 5.00000, 0.00000
+186, 65.00000, 0.00000, 0.00000
+187, 30.00000, 0.00000, 0.00000
+188, 30.00000, 5.00000, 0.00000
+189, 35.00000, 5.00000, 0.00000
+190, 35.00000, 0.00000, 0.00000
+191, 20.00000, 0.00000, 0.00000
+192, 25.00000, 0.00000, 0.00000
+193, 25.00000, 5.00000, 0.00000
+194, 15.00000, 0.00000, 0.00000
+195, 15.00000, 5.00000, 0.00000
+196, 20.00000, 5.00000, 0.00000
+197, 100.00000, 5.00000, 0.00000
+198, 55.00000, 0.00000, 5.00000
+199, 45.00000, 0.00000, 5.00000
+200, 52.50000, 0.00000, 2.50000
+201, 50.00000, 0.00000, 5.00000
+202, 47.50000, 0.00000, 2.50000
+203, 50.00000, 0.00000, 10.00000
+204, 40.00000, 0.00000, 10.00000
+205, 47.50000, 0.00000, 7.50000
+206, 45.00000, 0.00000, 10.00000
+207, 42.50000, 0.00000, 7.50000
+208, 42.50000, 0.00000, 2.50000
+209, 40.00000, 0.00000, 5.00000
+210, 52.50000, 0.00000, 7.50000
+211, 60.00000, 0.00000, 10.00000
+212, 57.50000, 0.00000, 7.50000
+213, 55.00000, 0.00000, 10.00000
+214, 57.50000, 0.00000, 2.50000
+215, 60.00000, 0.00000, 5.00000
+216, 0.00000, 0.00000, 10.00000
+217, 5.00000, 0.00000, 5.00000
+218, 10.00000, 0.00000, 10.00000
+219, 2.50000, 0.00000, 7.50000
+220, 7.50000, 0.00000, 7.50000
+221, 5.00000, 0.00000, 10.00000
+222, 7.50000, 0.00000, 2.50000
+223, 10.00000, 0.00000, 5.00000
+224, 2.50000, 0.00000, 2.50000
+225, 0.00000, 0.00000, 5.00000
+226, 75.00000, 0.00000, 5.00000
+227, 77.50000, 0.00000, 2.50000
+228, 72.50000, 0.00000, 2.50000
+229, 70.00000, 0.00000, 10.00000
+230, 72.50000, 0.00000, 7.50000
+231, 70.00000, 0.00000, 5.00000
+232, 80.00000, 0.00000, 10.00000
+233, 80.00000, 0.00000, 5.00000
+234, 77.50000, 0.00000, 7.50000
+235, 75.00000, 0.00000, 10.00000
+236, 90.00000, 0.00000, 10.00000
+237, 90.00000, 0.00000, 5.00000
+238, 85.00000, 0.00000, 5.00000
+239, 85.00000, 0.00000, 10.00000
+240, 30.00000, 0.00000, 10.00000
+241, 30.00000, 0.00000, 5.00000
+242, 25.00000, 0.00000, 5.00000
+243, 20.00000, 0.00000, 10.00000
+244, 20.00000, 0.00000, 5.00000
+245, 25.00000, 0.00000, 10.00000
+246, 100.00000, 0.00000, 10.00000
+247, 95.00000, 0.00000, 5.00000
+248, 95.00000, 0.00000, 10.00000
+249, 100.00000, 0.00000, 5.00000
+250, 65.00000, 0.00000, 5.00000
+251, 35.00000, 0.00000, 5.00000
+252, 15.00000, 0.00000, 5.00000
+253, 15.00000, 0.00000, 10.00000
+254, 35.00000, 0.00000, 10.00000
+255, 65.00000, 0.00000, 10.00000
+256, 100.00000, 5.00000, 5.00000
+257, 100.00000, 5.00000, 10.00000
+258, 55.00000, 5.00000, 10.00000
+259, 45.00000, 5.00000, 10.00000
+260, 52.50000, 2.50000, 10.00000
+261, 50.00000, 5.00000, 10.00000
+262, 47.50000, 2.50000, 10.00000
+263, 42.50000, 2.50000, 10.00000
+264, 42.50000, 7.50000, 10.00000
+265, 47.50000, 7.50000, 10.00000
+266, 40.00000, 5.00000, 10.00000
+267, 75.00000, 5.00000, 10.00000
+268, 77.50000, 7.50000, 10.00000
+269, 77.50000, 2.50000, 10.00000
+270, 80.00000, 5.00000, 10.00000
+271, 72.50000, 2.50000, 10.00000
+272, 72.50000, 7.50000, 10.00000
+273, 70.00000, 5.00000, 10.00000
+274, 52.50000, 7.50000, 10.00000
+275, 57.50000, 7.50000, 10.00000
+276, 57.50000, 2.50000, 10.00000
+277, 60.00000, 5.00000, 10.00000
+278, 5.00000, 5.00000, 10.00000
+279, 2.50000, 7.50000, 10.00000
+280, 7.50000, 7.50000, 10.00000
+281, 0.00000, 5.00000, 10.00000
+282, 2.50000, 2.50000, 10.00000
+283, 7.50000, 2.50000, 10.00000
+284, 10.00000, 5.00000, 10.00000
+285, 95.00000, 5.00000, 10.00000
+286, 97.50000, 2.50000, 10.00000
+287, 92.50000, 2.50000, 10.00000
+288, 97.50000, 7.50000, 10.00000
+289, 92.50000, 7.50000, 10.00000
+290, 90.00000, 5.00000, 10.00000
+291, 85.00000, 5.00000, 10.00000
+292, 65.00000, 5.00000, 10.00000
+293, 15.00000, 5.00000, 10.00000
+294, 25.00000, 5.00000, 10.00000
+295, 20.00000, 5.00000, 10.00000
+296, 35.00000, 5.00000, 10.00000
+297, 30.00000, 5.00000, 10.00000
+298, 0.00000, 5.00000, 5.00000
+**
+**ELSET COUNT = 120
+**HWCOLOR COMP 36 1
+*ELEMENT, TYPE=C3D10, ELSET=Body1
+ 1, 243, 240, 191, 117, 245, 242, 244,
+ 1, 2, 196
+ 2, 204, 199, 175, 130, 207, 208, 209,
+ 3, 4, 176
+ 3, 259, 70, 69, 130, 265, 72, 5,
+ 6, 132, 134
+ 4, 145, 175, 199, 130, 177, 208, 202,
+ 174, 176, 4
+ 5, 96, 88, 236, 178, 141, 290, 291,
+ 7, 8, 237
+ 6, 96, 101, 164, 97, 102, 171, 9,
+ 99, 103, 10
+ 7, 236, 88, 285, 178, 290, 289, 287,
+ 237, 8, 11
+ 8, 285, 179, 178, 83, 12, 182, 11,
+ 13, 14, 15
+ 9, 84, 246, 285, 82, 257, 286, 288,
+ 87, 256, 16
+ 10, 155, 216, 278, 109, 225, 282, 17,
+ 298, 281, 279
+ 11, 155, 217, 154, 156, 224, 222, 157,
+ 158, 18, 159
+ 12, 204, 175, 240, 130, 209, 251, 254,
+ 3, 176, 19
+ 13, 114, 218, 154, 117, 284, 223, 20,
+ 135, 21, 195
+ 14, 203, 258, 211, 198, 260, 276, 213,
+ 210, 22, 212
+ 15, 96, 164, 101, 91, 9, 171, 102,
+ 139, 184, 140
+ 16, 232, 96, 164, 226, 270, 9, 233,
+ 234, 23, 227
+ 17, 97, 267, 226, 96, 24, 25, 26,
+ 99, 268, 23
+ 18, 164, 166, 226, 97, 169, 27, 227,
+ 10, 28, 26
+ 19, 179, 82, 91, 83, 197, 92, 181,
+ 14, 85, 93
+ 20, 236, 285, 246, 178, 287, 286, 248,
+ 237, 11, 247
+ 21, 88, 178, 91, 83, 8, 180, 94,
+ 89, 15, 93
+ 22, 267, 232, 229, 226, 269, 235, 271,
+ 25, 234, 230
+ 23, 108, 109, 156, 110, 111, 29, 163,
+ 113, 112, 160
+ 24, 114, 154, 110, 117, 20, 161, 115,
+ 135, 195, 136
+ 25, 156, 114, 278, 154, 30, 280, 31,
+ 159, 20, 32
+ 26, 278, 154, 217, 156, 32, 222, 33,
+ 31, 159, 18
+ 27, 108, 109, 155, 156, 111, 298, 162,
+ 163, 29, 158
+ 28, 114, 154, 156, 110, 20, 159, 30,
+ 115, 161, 160
+ 29, 109, 114, 278, 156, 116, 280, 279,
+ 29, 30, 31
+ 30, 278, 155, 156, 217, 17, 158, 31,
+ 33, 224, 18
+ 31, 109, 155, 156, 278, 298, 158, 29,
+ 279, 17, 31
+ 32, 164, 101, 166, 97, 171, 170, 169,
+ 10, 103, 28
+ 33, 109, 114, 156, 110, 116, 30, 29,
+ 112, 115, 160
+ 34, 165, 226, 164, 166, 228, 227, 167,
+ 168, 27, 169
+ 35, 285, 82, 83, 84, 16, 85, 13,
+ 288, 87, 86
+ 36, 204, 240, 129, 130, 254, 296, 266,
+ 3, 19, 133
+ 37, 259, 129, 70, 130, 264, 131, 265,
+ 6, 133, 132
+ 38, 240, 118, 123, 119, 294, 125, 297,
+ 34, 121, 124
+ 39, 240, 175, 187, 119, 251, 190, 241,
+ 34, 189, 188
+ 40, 240, 119, 191, 117, 34, 193, 242,
+ 2, 122, 196
+ 41, 240, 118, 119, 117, 294, 121, 34,
+ 2, 120, 122
+ 42, 243, 191, 154, 117, 244, 194, 252,
+ 1, 196, 195
+ 43, 114, 118, 243, 117, 143, 295, 293,
+ 135, 120, 1
+ 44, 218, 243, 154, 117, 253, 252, 223,
+ 21, 1, 195
+ 45, 129, 240, 123, 119, 296, 297, 142,
+ 138, 34, 124
+ 46, 240, 187, 191, 119, 241, 192, 242,
+ 34, 188, 193
+ 47, 114, 243, 218, 117, 293, 253, 284,
+ 135, 1, 21
+ 48, 203, 259, 258, 35, 262, 261, 260,
+ 36, 37, 38
+ 49, 203, 199, 259, 35, 205, 39, 262,
+ 36, 40, 37
+ 50, 203, 198, 199, 35, 210, 201, 205,
+ 36, 41, 40
+ 51, 203, 258, 198, 35, 260, 22, 210,
+ 36, 38, 41
+ 52, 258, 71, 198, 35, 42, 43, 22,
+ 38, 44, 41
+ 53, 258, 70, 71, 35, 274, 73, 42,
+ 38, 45, 44
+ 54, 70, 69, 71, 35, 72, 74, 73,
+ 45, 46, 44
+ 55, 259, 69, 70, 35, 5, 72, 265,
+ 37, 46, 45
+ 56, 258, 259, 70, 35, 261, 265, 274,
+ 38, 37, 45
+ 57, 259, 69, 199, 130, 5, 47, 39,
+ 6, 134, 4
+ 58, 35, 259, 69, 199, 37, 5, 46,
+ 40, 39, 47
+ 59, 179, 82, 83, 285, 197, 85, 14,
+ 12, 16, 13
+ 60, 145, 69, 199, 35, 148, 47, 202,
+ 48, 46, 40
+ 61, 145, 144, 69, 35, 147, 146, 148,
+ 48, 49, 46
+ 62, 145, 198, 144, 35, 200, 50, 147,
+ 48, 41, 49
+ 63, 145, 199, 198, 35, 202, 201, 200,
+ 48, 40, 41
+ 64, 198, 71, 144, 35, 43, 51, 50,
+ 41, 44, 49
+ 65, 69, 144, 71, 35, 146, 51, 74,
+ 46, 49, 44
+ 66, 211, 149, 198, 52, 215, 214, 212,
+ 53, 54, 55
+ 67, 198, 71, 52, 149, 43, 56, 55,
+ 214, 57, 54
+ 68, 71, 144, 149, 198, 51, 150, 57,
+ 43, 50, 214
+ 69, 198, 258, 75, 71, 22, 275, 58,
+ 43, 42, 77
+ 70, 211, 258, 75, 198, 276, 275, 277,
+ 212, 22, 58
+ 71, 75, 198, 52, 211, 58, 55, 59,
+ 277, 212, 53
+ 72, 95, 211, 75, 52, 292, 277, 128,
+ 60, 53, 59
+ 73, 229, 211, 95, 52, 255, 292, 273,
+ 61, 53, 60
+ 74, 229, 165, 211, 52, 231, 250, 255,
+ 61, 62, 53
+ 75, 229, 226, 165, 52, 230, 228, 231,
+ 61, 63, 62
+ 76, 226, 97, 52, 229, 26, 64, 63,
+ 230, 65, 61
+ 77, 97, 267, 229, 226, 24, 271, 65,
+ 26, 25, 230
+ 78, 226, 97, 166, 52, 26, 28, 27,
+ 63, 64, 66
+ 79, 165, 226, 166, 52, 228, 27, 168,
+ 62, 63, 66
+ 80, 165, 166, 104, 52, 168, 173, 172,
+ 62, 66, 67
+ 81, 165, 104, 78, 52, 172, 126, 185,
+ 62, 67, 68
+ 82, 149, 165, 78, 52, 186, 185, 153,
+ 54, 62, 68
+ 83, 211, 165, 149, 52, 250, 186, 215,
+ 53, 62, 54
+ 84, 149, 71, 52, 78, 57, 56, 54,
+ 153, 80, 68
+ 85, 78, 144, 149, 71, 152, 150, 153,
+ 80, 51, 57
+ 86, 75, 71, 78, 52, 77, 80, 81,
+ 59, 56, 68
+ 87, 71, 198, 52, 75, 43, 55, 56,
+ 77, 58, 59
+ 88, 95, 75, 78, 52, 128, 81, 127,
+ 60, 59, 68
+ 89, 95, 78, 104, 52, 127, 126, 106,
+ 60, 68, 67
+ 90, 95, 104, 97, 52, 106, 105, 100,
+ 60, 67, 64
+ 91, 166, 97, 104, 52, 28, 105, 173,
+ 66, 64, 67
+ 92, 95, 267, 229, 97, 272, 271, 273,
+ 100, 24, 65
+ 93, 229, 97, 52, 95, 65, 64, 61,
+ 273, 100, 60
+ 94, 259, 204, 129, 130, 263, 266, 264,
+ 6, 3, 133
+ 95, 240, 130, 175, 119, 19, 176, 251,
+ 34, 137, 189
+ 96, 129, 130, 240, 119, 133, 19, 296,
+ 138, 137, 34
+ 97, 285, 178, 88, 83, 11, 8, 289,
+ 13, 15, 89
+ 98, 218, 154, 217, 278, 223, 222, 220,
+ 283, 32, 33
+ 99, 226, 96, 164, 97, 23, 9, 227,
+ 26, 99, 10
+ 100, 96, 88, 178, 91, 141, 8, 7,
+ 139, 94, 180
+ 101, 145, 199, 69, 130, 202, 47, 148,
+ 174, 4, 134
+ 102, 96, 236, 164, 178, 291, 238, 9,
+ 7, 237, 183
+ 103, 96, 178, 164, 91, 7, 183, 9,
+ 139, 180, 184
+ 104, 246, 285, 179, 178, 286, 12, 249,
+ 247, 11, 182
+ 105, 166, 101, 104, 97, 170, 107, 173,
+ 28, 103, 105
+ 106, 285, 88, 84, 83, 289, 90, 288,
+ 13, 89, 86
+ 107, 145, 198, 149, 144, 200, 214, 151,
+ 147, 50, 150
+ 108, 82, 246, 285, 179, 256, 286, 16,
+ 197, 249, 12
+ 109, 258, 70, 75, 71, 274, 76, 275,
+ 42, 73, 77
+ 110, 96, 267, 226, 232, 268, 25, 23,
+ 270, 269, 234
+ 111, 243, 118, 240, 117, 295, 294, 245,
+ 1, 120, 2
+ 112, 96, 236, 232, 164, 291, 239, 270,
+ 9, 238, 233
+ 113, 216, 278, 218, 217, 282, 283, 221,
+ 219, 33, 220
+ 114, 217, 216, 278, 155, 219, 282, 33,
+ 224, 225, 17
+ 115, 69, 144, 78, 71, 146, 152, 79,
+ 74, 51, 80
+ 116, 154, 114, 278, 218, 20, 280, 32,
+ 223, 284, 283
+ 117, 179, 91, 178, 83, 181, 180, 182,
+ 14, 93, 15
+ 118, 203, 204, 259, 199, 206, 263, 262,
+ 205, 207, 39
+ 119, 96, 267, 95, 97, 268, 272, 98,
+ 99, 24, 100
+ 120, 259, 199, 204, 130, 39, 207, 263,
+ 6, 4, 3
+**
+**NSET COUNT = 9
+*NSET, NSET=SUPPORT
+ 108, 109, 111, 155, 162, 216, 225, 281,
+ 298,
+**NSET COUNT = 9
+*NSET, NSET=LOAD
+ 82, 84, 87, 179, 197, 246, 249, 256,
+ 257,
+**NSET COUNT = 83
+*NSET, NSET=TOP
+ 70, 75, 76, 84, 88, 90, 95, 96,
+ 98, 109, 114, 116, 118, 123, 125, 128,
+ 129, 131, 141, 142, 143, 203, 204, 206,
+ 211, 213, 216, 218, 221, 229, 232, 235,
+ 236, 239, 240, 243, 245, 246, 248, 253,
+ 254, 255, 257, 258, 259, 260, 261, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270,
+ 271, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282, 283, 284, 285, 286,
+ 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297,
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 0000000..3ad4b15
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,14 @@
+# This is automatically generated by docs/build.jl. Edit that file if you
+# wish to make any permenant changes.
+site_name: JuliaFEM.jl
+site_description: JuliaFEM.jl, open-source software for reliable, scalable, distributed Finite Element Method.
+repo_name: GitHub
+docs_dir: 'docs'
+site_dir: 'site'
+repo_url: https://github.com/JuliaFEM/JuliaFEM.jl
+pages:
+- Home: 'README.md'
+- Overview: 'api/index.md'
+- API Docs:
+ - JuliaFEM: 'api/JuliaFEM.md'
+ - JuliaFEM.elasticity_solver: 'api/JuliaFEM.elasticity_solver.md'
diff --git a/notebooks/2015-06-25-elasticity-solver-example.ipynb b/notebooks/2015-06-25-elasticity-solver-example.ipynb
index 27c8b93..9c43834 100644
--- a/notebooks/2015-06-25-elasticity-solver-example.ipynb
+++ b/notebooks/2015-06-25-elasticity-solver-example.ipynb
@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Elasticity solver example\n",
+ "# Elasticity solver examples\n",
"\n",
"Author(s): Jukka Aho "
]
@@ -13,18 +13,48 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {
- "collapsed": true
+ "collapsed": false
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "WARNING: deprecated syntax \"{a=>b, ...}\" at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:29.\n",
+ "Use \"Dict{Any,Any}(a=>b, ...)\" instead.\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "Logger(root,DEBUG,Pipe(open, 0 bytes waiting),root)"
+ ]
+ },
+ "execution_count": 1,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"# These are internal module functions and not intended to use like this.\n",
- "using JuliaFEM.elasticity_solver: solve_elasticity_increment!\n",
- "using JuliaFEM.xdmf: xdmf_new_model, xdmf_new_grid, xdmf_new_temporal_collection, xdmf_new_mesh, xdmf_new_field"
+ "using JuliaFEM.elasticity_solver\n",
+ "using JuliaFEM.xdmf\n",
+ "using JuliaFEM.abaqus_reader\n",
+ "using Logging\n",
+ "Logging.configure(level=DEBUG)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## 2d beam with linear elements"
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 2,
"metadata": {
"collapsed": false
},
@@ -44,7 +74,7 @@
" 0.0 -2.17799 -2.22224 0.0"
]
},
- "execution_count": 3,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -90,7 +120,7 @@
" la, mu, N, dNdξ, ipoints, iweights) = one_elem_fixture()\n",
" \n",
"for i=1:10\n",
- " solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc,\n",
+ " JuliaFEM.elasticity_solver.solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc,\n",
" la, mu, N, dNdξ, ipoints, iweights)\n",
" u += du\n",
" if norm(du) < 1.0e-9\n",
@@ -104,36 +134,20 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 3,
"metadata": {
"collapsed": false
},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "5x1 Array{Int64,2}:\n",
- " 5\n",
- " 1\n",
- " 2\n",
- " 3\n",
- " 4"
- ]
- },
- "execution_count": 20,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"u3d = [u; 0 0 0 0] # extend to 3d vector field\n",
"X3d = [X; 0 0 0 0]\n",
- "elmap2 = [0x5; elmap]''"
+ "elmap2 = [0x5; elmap]'';"
]
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 4,
"metadata": {
"collapsed": false
},
@@ -165,38 +179,48 @@
"\n",
"\n"
]
- }
- ],
- "source": [
- "xdoc, model = xdmf_new_model()\n",
- "temporal_collection = xdmf_new_temporal_collection(model)\n",
- "grid = xdmf_new_grid(temporal_collection; time=0)\n",
- "xdmf_new_mesh(grid, X3d, elmap2)\n",
- "xdmf_new_field(grid, \"Displacement\", \"nodes\", u3d)\n",
- "print(xdoc)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 22,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "WARNING: int(x) is deprecated, use Int(x) instead.\n"
+ ]
+ },
{
"data": {
"text/plain": [
"1015"
]
},
- "execution_count": 22,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ " in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
+ " in int at deprecated.jl:49\n",
+ " in save_file at /Users/jukka/.julia/v0.4/LightXML/src/document.jl:108\n",
+ " in xdmf_save_model at /Users/jukka/.julia/v0.4/JuliaFEM/src/xdmf.jl:106\n",
+ " in include_string at loading.jl:99\n",
+ " in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
+ " in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
+ " in anonymous at task.jl:365\n",
+ "while loading In[4], in expression starting on line 7\n"
+ ]
}
],
"source": [
- "using LightXML\n",
- "save_file(xdoc, \"/tmp/foo.xmf\")"
+ "xdoc, model = JuliaFEM.xdmf.xdmf_new_model()\n",
+ "temporal_collection = JuliaFEM.xdmf.xdmf_new_temporal_collection(model)\n",
+ "grid = JuliaFEM.xdmf.xdmf_new_grid(temporal_collection; time=0)\n",
+ "JuliaFEM.xdmf.xdmf_new_mesh(grid, X3d, elmap2)\n",
+ "JuliaFEM.xdmf.xdmf_new_field(grid, \"Displacement\", \"nodes\", u3d)\n",
+ "print(xdoc)\n",
+ "JuliaFEM.xdmf.xdmf_save_model(xdoc, \"/tmp/foo.xmf\")"
]
},
{
@@ -227,13 +251,395 @@
]
},
{
- "cell_type": "code",
- "execution_count": null,
+ "cell_type": "markdown",
"metadata": {
"collapsed": true
},
- "outputs": [],
- "source": []
+ "source": [
+ "## 3d beam with quadratic elements"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "25-Jun 20:00:29:INFO:root:Registered handlers: Any[\"ELEMENT\",\"NODE\",\"NSET\"]\n",
+ "WARNING: beginswith is deprecated, use startswith instead.\n",
+ " in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
+ " in beginswith at deprecated.jl:30\n",
+ " in parse_abaqus at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:110\n",
+ " in include_string at loading.jl:99\n",
+ " in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
+ " in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
+ " in anonymous at task.jl:365\n",
+ "while loading In[5], in expression starting on line 2\n",
+ "WARNING: beginswith is deprecated, use startswith instead.\n",
+ " in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
+ " in beginswith at deprecated.jl:30\n",
+ " in parse_abaqus at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:110\n",
+ " in include_string at loading.jl:99\n",
+ " in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
+ " in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
+ " in anonymous at task.jl:365\n",
+ "while loading In[5], in expression starting on line 2\n",
+ "25-Jun 20:00:30:DEBUG:root:Found NODE section\n",
+ "25-Jun 20:00:30:DEBUG:root:Found ELEMENT section\n",
+ "WARNING: integer(s::AbstractString) is deprecated, use parse(Int,s) instead.\n",
+ " in depwarn at /Applications/Julia-0.4.0-dev-539c818c4e.app/Contents/Resources/julia/lib/julia/sys.dylib\n",
+ " in integer at deprecated.jl:49\n",
+ " in map at abstractarray.jl:1251\n",
+ " in parse_element_section at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:56\n",
+ " in process_section at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:105\n",
+ " in parse_abaqus at /Users/jukka/.julia/v0.4/JuliaFEM/src/abaqus_reader.jl:114\n",
+ " in include_string at loading.jl:99\n",
+ " in execute_request_0x535c5df2 at /Users/jukka/.julia/v0.4/IJulia/src/execute_request.jl:157\n",
+ " in eventloop at /Users/jukka/.julia/v0.4/IJulia/src/IJulia.jl:123\n",
+ " in anonymous at task.jl:365\n",
+ "while loading In[5], in expression starting on line 2\n",
+ "25-Jun 20:00:31:DEBUG:root:120 elements found\n",
+ "25-Jun 20:00:31:INFO:root:Creating ELSET Body1\n",
+ "25-Jun 20:00:31:DEBUG:root:Found NSET section\n",
+ "25-Jun 20:00:31:DEBUG:root:Creating node set SUPPORT\n",
+ "25-Jun 20:00:31:DEBUG:root:Found NSET section\n",
+ "25-Jun 20:00:31:DEBUG:root:Creating node set LOAD\n",
+ "25-Jun 20:00:31:DEBUG:root:Found NSET section\n",
+ "25-Jun 20:00:31:DEBUG:root:Creating node set TOP\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "Dict{Any,Any} with 4 entries:\n",
+ " \"nodes\" => Dict{Any,Any}(288=>[97.5,7.5,10.0],11=>[92.5,2.5,5.0],134=>[45.…\n",
+ " \"elements\" => Dict{Any,Any}(68=>[71,144,149,198,51,150,57,43,50,214],2=>[204,…\n",
+ " \"elsets\" => Dict{Any,Any}(\"Body1\"=>[1,2,3,4,5,6,7,8,9,10 … 111,112,113,11…\n",
+ " \"nsets\" => Dict{Any,Any}(\"LOAD\"=>[82,84,87,179,197,246,249,256,257],\"SUPPO…"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "fid = open(\"../geometry/3d_beam/palkki.inp\")\n",
+ "model = JuliaFEM.abaqus_reader.parse_abaqus(fid)\n",
+ "close(fid)\n",
+ "model"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "10x120 Array{Int64,2}:\n",
+ " 47 56 91 87 72 72 176 290 … 260 165 101 18 271 72 24\n",
+ " 173 236 176 45 97 253 173 22 236 181 261 201 211 146 166\n",
+ " 76 97 139 49 253 158 76 252 202 87 19 71 18 289 196\n",
+ " 202 111 242 290 289 289 47 49 254 290 254 255 277 29 133\n",
+ " 156 10 120 53 74 169 144 127 114 95 75 2 100 67 135\n",
+ " 88 214 266 291 270 118 88 70 … 14 185 104 235 257 180 198\n",
+ " 16 89 179 40 169 209 44 17 103 68 215 12 212 200 65\n",
+ " 134 278 199 4 200 200 34 177 147 163 145 121 170 167 92\n",
+ " 32 187 221 243 210 37 156 240 195 7 117 80 9 48 52\n",
+ " 132 15 265 177 37 233 16 268 79 4 263 168 208 57 150"
+ ]
+ },
+ "execution_count": 30,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "nnodes = length(model[\"nodes\"])\n",
+ "nelements = length(model[\"elements\"])\n",
+ "dim = 3\n",
+ "E = 90\n",
+ "nu = 0.25\n",
+ "mu = E/(2*(1+nu))\n",
+ "la = E*nu/((1+nu)*(1-2*nu))\n",
+ "\n",
+ "X = zeros(dim, nnodes)\n",
+ "u = zeros(dim, nnodes)\n",
+ "du = zeros(dim, nnodes)\n",
+ "elmap = zeros(Int, 10, nelements)\n",
+ "nodalloads = zeros(3, nnodes)\n",
+ "dirichletbc = NaN*ones(3, nnodes)\n",
+ "la = la*ones(1, nnodes)\n",
+ "mu = mu*ones(1, nnodes)\n",
+ "\n",
+ "# calculate permutation which maps node ids to matrix indices\n",
+ "perm = Dict()\n",
+ "for (j, k) in enumerate(keys(model[\"nodes\"]))\n",
+ " perm[k] = j\n",
+ "end\n",
+ "\n",
+ "for j=1:nnodes\n",
+ " X[:,j] = model[\"nodes\"][perm[j]]\n",
+ "end\n",
+ "\n",
+ "for (j, k) in enumerate(keys(model[\"elements\"]))\n",
+ " node_ids = model[\"elements\"][k]\n",
+ " for l=1:10\n",
+ " elmap[l, j] = perm[node_ids[l]]\n",
+ " end\n",
+ "end\n",
+ "\n",
+ "elmap"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "3x298 Array{Float64,2}:\n",
+ " NaN NaN NaN NaN NaN NaN NaN NaN … NaN NaN NaN NaN NaN NaN NaN\n",
+ " NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN\n",
+ " NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Handle dirichlet boundaries on SUPPORT\n",
+ "for j in model[\"nsets\"][\"SUPPORT\"]\n",
+ " dirichletbc[perm[j]] = 0.0\n",
+ "end\n",
+ "dirichletbc"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Shape functions and integration points"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "dNtet (generic function with 1 method)"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "Ntet(xi) = [ -xi[1] - xi[2] - xi[3] + 1\n",
+ " xi[1]\n",
+ " xi[2]\n",
+ " xi[3]\n",
+ " 4*xi[1]*(-xi[1] - xi[2] - xi[3] + 1)\n",
+ " 4*xi[1]*xi[2]\n",
+ " 4*xi[2]*(-xi[1] - xi[2] - xi[3] + 1)\n",
+ " 4*xi[3]*(-xi[1] - xi[2] - xi[3] + 1)\n",
+ " 4*xi[1]*xi[3]\n",
+ " 4*xi[2]*xi[3]]\n",
+ "\n",
+ "dNtet(xi) = [\n",
+ " -1 -1 -1\n",
+ " 1 0 0\n",
+ " 0 1 0\n",
+ " 0 0 1\n",
+ "-8*xi[1] - 4*xi[2] - 4*xi[3] + 4 -4*xi[1] -4*xi[1]\n",
+ " 4*xi[2] 4*xi[1] 0\n",
+ " -4*xi[2] -4*xi[1] - 8*xi[2] - 4*xi[3] + 4 -4*xi[2]\n",
+ " -4*xi[3] -4*xi[3] -4*xi[1] - 4*xi[2] - 8*xi[3] + 4\n",
+ " 4*xi[3] 0 4*xi[1]\n",
+ " 0 4*xi[3] 4*xi[2]]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "10x3 Array{Int64,2}:\n",
+ " -1 -1 -1\n",
+ " 1 0 0\n",
+ " 0 1 0\n",
+ " 0 0 1\n",
+ " -4 0 0\n",
+ " 4 0 0\n",
+ " -4 -8 -4\n",
+ " -4 -4 -8\n",
+ " 4 0 0\n",
+ " 0 4 4"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "dNtet([0, 1, 1])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1x4 Array{Float64,2}:\n",
+ " 0.0416667 0.0416667 0.0416667 0.0416667"
+ ]
+ },
+ "execution_count": 25,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# from code aster documentation\n",
+ "a = 1/20*(5-sqrt(5))\n",
+ "b = 1/20*(5+3*sqrt(5))\n",
+ "ipoints = [a a a; a a b; a b a; b a a]\n",
+ "iweights = 1/24*[1 1 1 1]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Add point force to LOAD nodeset"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "9-element Array{Int64,1}:\n",
+ " 82\n",
+ " 84\n",
+ " 87\n",
+ " 179\n",
+ " 197\n",
+ " 246\n",
+ " 249\n",
+ " 256\n",
+ " 257"
+ ]
+ },
+ "execution_count": 33,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "model[\"nsets\"][\"LOAD\"]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[95.0,10.0,5.0]\n"
+ ]
+ }
+ ],
+ "source": [
+ "nodalloads[3, perm[82]] = -0.0001\n",
+ "println(model[\"nodes\"][83])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "3x298 Array{Float64,2}:\n",
+ " -76167.8 -73.0493 … 5.19615e7 -43075.8 \n",
+ " -7.72988e5 6.45188e5 8.51808e7 559158.0 \n",
+ " 1.26765e6 -74404.1 -2.43735e7 6.01587e5"
+ ]
+ },
+ "execution_count": 39,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "u = zeros(dim, nnodes)\n",
+ "du = zeros(dim, nnodes)\n",
+ "\n",
+ "for i=1:10\n",
+ " JuliaFEM.elasticity_solver.solve_elasticity_increment!(X, u, du, elmap, nodalloads, dirichletbc,\n",
+ " la, mu, Ntet, dNtet, ipoints, iweights)\n",
+ " u += du\n",
+ " if norm(du) < 1.0e-9\n",
+ " println(\"Converged\")\n",
+ " break\n",
+ " end\n",
+ "end\n",
+ "u"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Not converging."
+ ]
}
],
"metadata": {
diff --git a/notebooks/2015-06-25-shape-functions.ipynb b/notebooks/2015-06-25-shape-functions.ipynb
new file mode 100644
index 0000000..6b87a27
--- /dev/null
+++ b/notebooks/2015-06-25-shape-functions.ipynb
@@ -0,0 +1,136 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "from sympy import *"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "xi = DeferredVector(\"xi\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Matrix([\n",
+ "[ -xi[1] - xi[2] - xi[3] + 1],\n",
+ "[ xi[1]],\n",
+ "[ xi[2]],\n",
+ "[ xi[3]],\n",
+ "[4*xi[1]*(-xi[1] - xi[2] - xi[3] + 1)],\n",
+ "[ 4*xi[1]*xi[2]],\n",
+ "[4*xi[2]*(-xi[1] - xi[2] - xi[3] + 1)],\n",
+ "[4*xi[3]*(-xi[1] - xi[2] - xi[3] + 1)],\n",
+ "[ 4*xi[1]*xi[3]],\n",
+ "[ 4*xi[2]*xi[3]]])"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "def c3d10():\n",
+ " N1 = 1 - xi[1] - xi[2] - xi[3]\n",
+ " N2 = xi[1]\n",
+ " N3 = xi[2]\n",
+ " N4 = xi[3]\n",
+ " N5 = 4*xi[1]*(1-xi[1]-xi[2]-xi[3])\n",
+ " N6 = 4*xi[1]*xi[2]\n",
+ " N7 = 4*xi[2]*(1-xi[1]-xi[2]-xi[3])\n",
+ " N8 = 4*xi[3]*(1-xi[1]-xi[2]-xi[3])\n",
+ " N9 = 4*xi[1]*xi[3]\n",
+ " N10 = 4*xi[2]*xi[3]\n",
+ " N = Matrix([N1, N2, N3, N4, N5, N6, N7, N8, N9, N10])\n",
+ " dN = Matrix([N.diff(xi[1]).T, N.diff(xi[2]).T, N.diff(xi[3]).T]).T\n",
+ " return N, dN\n",
+ "\n",
+ "N, dN = c3d10()\n",
+ "N"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Matrix([\n",
+ "[ -1, -1, -1],\n",
+ "[ 1, 0, 0],\n",
+ "[ 0, 1, 0],\n",
+ "[ 0, 0, 1],\n",
+ "[-8*xi[1] - 4*xi[2] - 4*xi[3] + 4, -4*xi[1], -4*xi[1]],\n",
+ "[ 4*xi[2], 4*xi[1], 0],\n",
+ "[ -4*xi[2], -4*xi[1] - 8*xi[2] - 4*xi[3] + 4, -4*xi[2]],\n",
+ "[ -4*xi[3], -4*xi[3], -4*xi[1] - 4*xi[2] - 8*xi[3] + 4],\n",
+ "[ 4*xi[3], 0, 4*xi[1]],\n",
+ "[ 0, 4*xi[3], 4*xi[2]]])"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "dN"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/src/JuliaFEM.jl b/src/JuliaFEM.jl
index ae541f8..9d3123a 100644
--- a/src/JuliaFEM.jl
+++ b/src/JuliaFEM.jl
@@ -1,20 +1,21 @@
-# This file is a part of JuliaFEM.
+# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
module JuliaFEM
-VERSION < v"0.4-" && using Docile
-# import solvers
+VERSION < v"0.4-" && using Docile
+using Lexicon
+
include("elasticity_solver.jl")
include("xdmf.jl")
-#using elasticity_solver
+include("abaqus_reader.jl")
export Model, new_model, new_field, get_field, add_nodes, get_nodes, add_elements, get_elements
-@doc """
+"""
Basic model
-""" ->
+"""
type Model
model # For global variables
nodes # For nodes
@@ -26,7 +27,7 @@ end
-@doc """
+"""
Initialize empty model.
Parameters
@@ -36,7 +37,7 @@ None
Returns
-------
New model struct
-""" ->
+"""
function new_model()
return Model(Dict(), Dict(), Dict(), Dict(), Dict())
end
@@ -46,7 +47,7 @@ end
-@doc """Get field from model.
+"""Get field from model.
Parameters
----------
@@ -62,7 +63,7 @@ create_if_doesnt_exist : bool, optional
Raises
------
Error, if field not found and create_if_doesnt_exist == false
-""" ->
+"""
function get_field(field_type, field_name; create_if_doesnt_exist=false)
if !(field_name in keys(field_type))
if create_if_doesnt_exist
@@ -78,7 +79,7 @@ end
-@doc """Add new elements to model.
+"""Add new elements to model.
Parameters
----------
list of dicts, dict = {element_type => elcode, elids => [node ids..]}
@@ -97,7 +98,7 @@ In dict key means element id
>>> elements = Dict(1 => el1, 2 => el2)
>>> add_elements(m, elements)
-""" ->
+"""
function add_elements(model, elements)
elfield = get_field(model.elements, "connectivity"; create_if_doesnt_exist=true)
eltyfield = get_field(model.elements, "element_type"; create_if_doesnt_exist=true)
@@ -111,7 +112,7 @@ end
-@doc """Get subset of elements from model.
+"""Get subset of elements from model.
Parameters
----------
element_ids : list of ints
@@ -121,7 +122,7 @@ Returns
-------
Dict
{element_type = XXX, node_ids = [a, b, c, d, e, ..., n]}
-""" ->
+"""
function get_elements(model, element_ids)
eltyfield = get_field(model.elements, "element_type")
elfield = get_field(model.elements, "connectivity")
diff --git a/src/abaqus_reader.jl b/src/abaqus_reader.jl
new file mode 100644
index 0000000..4791762
--- /dev/null
+++ b/src/abaqus_reader.jl
@@ -0,0 +1,135 @@
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
+module abaqus_reader
+
+using Logging
+@Logging.configure(level=DEBUG)
+
+VERSION < v"0.4-" && using Docile
+
+eldims = Dict({"C3D10" => 10})
+global handlers = Dict()
+
+
+"""
+Register new handler for parser
+"""
+function add_handler(section, function_name)
+ handlers[section] = function_name
+end
+
+function create_or_get(model, key)
+ if !(key in keys(model))
+ model[key] = Dict()
+ end
+ return model[key]
+end
+
+function parse_header(header_line)
+ args = map(s -> strip(s), split(header_line, ","))
+ args[1] = strip(args[1], '*')
+ d = Dict({"section" => args[1]})
+ options = Dict()
+ for k in args[2:end]
+ args2 = split(k, "=")
+ options[args2[1]] = args2[2]
+ end
+ d["options"] = options
+ return d
+end
+
+function parse_node_section(model, header, data)
+ nodes = create_or_get(model, "nodes")
+ for line in split(data, "\n")
+ m = matchall(r"[-0-9.]+", line)
+ id = parse(Int, m[1])
+ coords = float(m[2:end])
+ nodes[id] = coords
+ end
+end
+
+function parse_element_section(model, header, data)
+ eltype = header["options"]["TYPE"]
+ if !(eltype in keys(eldims))
+ throw("Element $eltype dimension information missing")
+ end
+ eldim = eldims[eltype]
+ m = matchall(r"[0-9]+", data)
+ m = map(integer, m)
+ elements = create_or_get(model, "elements")
+ m = reshape(m, eldim+1, round(Int, length(m)/(eldim+1)))
+ nel = size(m)[2]
+ Logging.debug("$nel elements found")
+ for i=1:nel
+ elements[m[1,i]] = m[2:end,i]
+ end
+ if "ELSET" in keys(header["options"])
+ elsets = create_or_get(model, "elsets")
+ elset_name = header["options"]["ELSET"]
+ Logging.info("Creating ELSET $elset_name")
+ elsets[elset_name] = Int64[]
+ for i=1:nel
+ push!(elsets[elset_name], m[1,i])
+ end
+ end
+end
+
+
+function parse_nodeset_section(model, header, data)
+ nset_name = header["options"]["NSET"]
+ Logging.debug("Creating node set $nset_name")
+ m = matchall(r"[0-9]+", data)
+ node_ids = map(integer, m)
+ nsets = create_or_get(model, "nsets")
+ nsets[nset_name] = Int64[]
+ for j in node_ids
+ push!(nsets[nset_name], j)
+ end
+end
+
+
+function parse_abaqus(fid)
+ model = Dict()
+ section = None
+ header = None
+ data = ""
+ Logging.info("Registered handlers: $(keys(handlers))")
+
+ function process_section(section)
+ if section == None
+ return
+ end
+ if !(section in keys(handlers))
+ Logging.info("Don't know what to do with data in section $section")
+ Logging.info("Skipping $(length(data)) bytes of unknown data")
+ return
+ end
+ handlers[section](model, header, strip(data))
+ data = ""
+ end
+
+ for line in eachline(fid)
+ if beginswith(line, "**")
+ continue
+ end
+ if beginswith(line, "*")
+ process_section(section)
+ header = parse_header(line)
+ Logging.debug("Found ", header["section"], " section")
+ section = header["section"]
+ continue
+ end
+ data *= line
+ end
+ process_section(section)
+ return model
+end
+
+# add handlers
+add_handler("NODE", parse_node_section)
+add_handler("ELEMENT", parse_element_section)
+add_handler("NSET", parse_nodeset_section)
+
+end
+
diff --git a/src/elasticity_solver.jl b/src/elasticity_solver.jl
index f9a429b..47245f0 100644
--- a/src/elasticity_solver.jl
+++ b/src/elasticity_solver.jl
@@ -1,4 +1,6 @@
-# This file is a part of JuliaFEM. License is MIT: https://github.com/ovainola/JuliaFEM/blob/master/README.md
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
module elasticity_solver
using Logging
@@ -11,7 +13,7 @@ VERSION < v"0.4-" && using Docile
# solver.
-@doc """
+"""
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.
@@ -24,12 +26,12 @@ basis :: Function
Basis functions
ip :: Array{Number, 1}
Point to interpolate
-""" ->
-function interpolate(field::Array{Float64,1}, basis::Function, ip)
+"""
+function interpolate{T<:Real}(field::Array{T,1}, basis::Function, ip)
result = dot(field, basis(ip))
return result
end
-function interpolate(field::Array{Float64,2}, basis::Function, ip)
+function interpolate{T<:Real}(field::Array{T,2}, basis::Function, ip)
m, n = size(field)
bip = basis(ip)
tmp = size(bip)
@@ -60,10 +62,10 @@ end
-@doc """
+"""
Calculate local tangent stiffness matrix and residual force vector R = T - F
-""" ->
-function calc_local_matrices!(X, u, R, Kt, N, dNdξ, λ_, μ_, ipoints, iweights)
+"""
+function calc_local_matrices!(X, u, R, Kt, N, dNdchi, lambda_, mu_, ipoints, iweights)
dim, nnodes = size(X)
I = eye(dim)
R[:,:] = 0.0
@@ -73,34 +75,34 @@ function calc_local_matrices!(X, u, R, Kt, N, dNdξ, λ_, μ_, ipoints, iweights
for m = 1:length(iweights)
w = iweights[m]
- ξ = ipoints[m, :]
+ chi = ipoints[m, :]
# interpolate material parameters from element node fields
- #λ = (λ_*N(ξ))[1]
- #μ = (μ_*N(ξ))[1]
- # Jᵀ = X*dNdξ(ξ)
- #@debug("Jt:\n",Jᵀ)
- λ = interpolate(λ_, N, ξ)
- μ = interpolate(μ_, N, ξ)
- Jᵀ = interpolate(X, dNdξ, ξ)
- detJ = det(Jᵀ)
- ∇N = inv(Jᵀ)*dNdξ(ξ)'
- ∇u = u*∇N'
- F = I + ∇u # Deformation gradient
- E = 1/2*(∇u' + ∇u + ∇u'*∇u) # Green-Lagrange strain tensor
- S = λ*trace(E)*I + 2*μ*E # PK2 stress tensor
+ #lambda = (lambda_*N(chi))[1]
+ #mu = (mu_*N(chi))[1]
+ # Jt = X*dNdchi(chi)
+ #@debug("Jt:\n",Jt)
+ lambda = interpolate(lambda_, N, chi)
+ mu = interpolate(mu_, N, chi)
+ Jt = interpolate(X, dNdchi, chi)
+ detJ = det(Jt)
+ deltaN = inv(Jt)*dNdchi(chi)'
+ delta_u = u*deltaN'
+ F = I + delta_u # Deformation gradient
+ E = 1/2*(delta_u' + delta_u + delta_u'*delta_u) # Green-Lagrange strain tensor
+ S = lambda*trace(E)*I + 2*mu*E # PK2 stress tensor
P = F*S # PK1 stress tensor
- R[:,:] += w*P*∇N*detJ
+ R[:,:] += w*P*deltaN*detJ
for p = 1:nnodes
for i = 1:dim
dF[:,:] = 0.0
- dF[i,:] = ∇N[:,p]
+ dF[i,:] = deltaN[:,p]
dE = 1/2*(F'*dF + dF'*F)
- dS = λ*trace(dE)*I + 2*μ*dE
+ dS = lambda*trace(dE)*I + 2*mu*dE
dP = dF*S + F*dS
for q = 1:nnodes
for j = 1:dim
- Kt[dim*(p-1)+i,dim*(q-1)+j] += w*(dP[j,:]*∇N[:,q])[1]*detJ
+ Kt[dim*(p-1)+i,dim*(q-1)+j] += w*(dP[j,:]*deltaN[:,q])[1]*detJ
end
end
end
@@ -110,7 +112,7 @@ function calc_local_matrices!(X, u, R, Kt, N, dNdξ, λ_, μ_, ipoints, iweights
end
-@doc """
+"""
Assemble global stiffness matrix to I,J,V ready for sparse format
Parameters
@@ -124,7 +126,7 @@ Notes
-----
eldofs can also be node ids for convenience. In that case dimension
is calculated and eldofs are "extended" to problem dimension.
-""" ->
+"""
function assemble!(ke, eldofs_, I, J, V)
n, m = size(ke)
dim = round(Int, n/length(eldofs_))
@@ -151,7 +153,7 @@ function assemble!(ke, eldofs_, I, J, V)
end
-@doc """
+"""
Assemble global RHS to I,V ready for sparse format
Parameters
@@ -165,7 +167,7 @@ Notes
-----
eldofs can also be node ids for convenience. In that case dimension
is calculated and eldofs are "extended" to problem dimension.
-""" ->
+"""
function assemble!(fe, eldofs_, I, V)
n = length(fe)
dim = round(Int, n/length(eldofs_))
@@ -187,7 +189,7 @@ function assemble!(fe, eldofs_, I, V)
end
-@doc """
+"""
Eliminate Dirichlet boundary conditions from matrix
Parameters
@@ -227,7 +229,7 @@ function eliminate_boundary_conditions(dirichletbc, I, J, V)
return findnz(A)
end
-@doc """
+"""
Eliminate Dirichlet boundary conditions from vector
Parameters
@@ -251,7 +253,7 @@ Raises
------
Exception, if displacement boundary conditions given, i.e.
DX=2 for some node, for example.
-""" ->
+"""
function eliminate_boundary_conditions(dirichletbc, I, V)
if any(dirichletbc .> 0)
throw("displacement boundary condition not supported")
@@ -270,11 +272,11 @@ end
-@doc """
+"""
Solve one increment of elasticity problem
-""" ->
+"""
function solve_elasticity_increment!(X, u, du, elmap, nodalloads,
- dirichletbc, λ, μ, N, dNdξ, ipoints,
+ dirichletbc, lambda, mu, N, dNdchi, ipoints,
iweights)
if length(size(elmap)) == 1
# quick hack for just one element
@@ -297,8 +299,8 @@ function solve_elasticity_increment!(X, u, du, elmap, nodalloads,
# this can be parallelized
for i in 1:nelements
eldofs = elmap[:,i]
- calc_local_matrices!(X[:, eldofs], u[:, eldofs], R, Kt, N, dNdξ,
- λ[eldofs], μ[eldofs], ipoints, iweights)
+ calc_local_matrices!(X[:, eldofs], u[:, eldofs], R, Kt, N, dNdchi,
+ lambda[eldofs], mu[eldofs], ipoints, iweights)
assemble!(Kt, eldofs, Imat, Jmat, Vmat)
assemble!(R, eldofs, Ivec, Vvec)
end
diff --git a/src/interfaces.jl b/src/interfaces.jl
index 860ae35..d5dd11c 100644
--- a/src/interfaces.jl
+++ b/src/interfaces.jl
@@ -1,4 +1,6 @@
-# This file is a part of JuliaFEM. License is MIT: https://github.com/ovainola/JuliaFEM/blob/master/README.md
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
module interfaces
using Logging
@@ -9,16 +11,16 @@ VERSION < v"0.4-" && using Docile
#using JuliaFEM.elasticity_solver
export solve_elasticity_interface!
-@doc """
+"""
This is generic interface that reads data from data model, solves elasticity
problem and updates model.
Parameters
----------
model : to be defined
-""" ->
+"""
function solve_elasticity_interface!()
return 0
end
-end
\ No newline at end of file
+end
diff --git a/src/shape_functions.jl b/src/shape_functions.jl
index f28250e..e49c6c3 100644
--- a/src/shape_functions.jl
+++ b/src/shape_functions.jl
@@ -1,15 +1,3 @@
-function test(a)
- return a*2
-end
-
-
-function C2D4(xx)
- θ = 1
- chi = xx[1]
- eta = xx[2]
- return = [(1 - chi) * (1 - eta),
- chi * (1 - eta),
- chi * eta,
- (1 - chi) * eta]
-end
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
diff --git a/src/xdmf.jl b/src/xdmf.jl
index 9126b2e..2b2eef8 100644
--- a/src/xdmf.jl
+++ b/src/xdmf.jl
@@ -1,4 +1,6 @@
-# This file is a part of JuliaFEM. License is MIT: https://github.com/ovainola/JuliaFEM/blob/master/README.md
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
module xdmf
using Logging
@@ -9,7 +11,39 @@ using LightXML
VERSION < v"0.4-" && using Docile
# i add docstrings later
+
# element codes: http://www.paraview.org/pipermail/paraview/2013-July/028859.html
+# > from ./VTK/ThirdParty/xdmf2/vtkxdmf2/libsrc/XdmfTopology.h
+# >
+# > // Topologies
+# > #define XDMF_NOTOPOLOGY 0x0
+# > #define XDMF_POLYVERTEX 0x1
+# > #define XDMF_POLYLINE 0x2
+# > #define XDMF_POLYGON 0x3
+# > #define XDMF_TRI 0x4
+# > #define XDMF_QUAD 0x5
+# > #define XDMF_TET 0x6
+# > #define XDMF_PYRAMID 0x7
+# > #define XDMF_WEDGE 0x8
+# > #define XDMF_HEX 0x9
+# > #define XDMF_EDGE_3 0x0022
+# > #define XDMF_TRI_6 0x0024
+# > #define XDMF_QUAD_8 0x0025
+# > #define XDMF_QUAD_9 0x0023
+# > #define XDMF_TET_10 0x0026
+# > #define XDMF_PYRAMID_13 0x0027
+# > #define XDMF_WEDGE_15 0x0028
+# > #define XDMF_WEDGE_18 0x0029
+# > #define XDMF_HEX_20 0x0030
+# > #define XDMF_HEX_24 0x0031
+# > #define XDMF_HEX_27 0x0032
+# > #define XDMF_MIXED 0x0070
+# > #define XDMF_2DSMESH 0x0100
+# > #define XDMF_2DRECTMESH 0x0101
+# > #define XDMF_2DCORECTMESH 0x0102
+# > #define XDMF_3DSMESH 0x1100
+# > #define XDMF_3DRECTMESH 0x1101
+# > #define XDMF_3DCORECTMESH 0x1102
function xdmf_new_model(xdmf_version="2.1")
xdoc = XMLDocument()
@@ -102,5 +136,8 @@ function xdmf_new_field(grid, name, source, data)
add_text(dataitem, join(data, " "))
end
+function xdmf_save_model(xdoc, filename)
+ save_file(xdoc, filename)
+end
-end
\ No newline at end of file
+end
diff --git a/test/test_abaqus_reader.jl b/test/test_abaqus_reader.jl
new file mode 100644
index 0000000..4274e13
--- /dev/null
+++ b/test/test_abaqus_reader.jl
@@ -0,0 +1,20 @@
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
+using FactCheck
+using Logging
+@Logging.configure(level=INFO)
+
+using JuliaFEM.abaqus_reader: parse_abaqus
+
+facts("test import abaqus model") do
+ fid = open("../geometry/3d_beam/palkki.inp")
+ model = parse_abaqus(fid)
+ close(fid)
+ @fact length(model["nodes"]) => 298
+ @fact length(model["elements"]) => 120
+ @fact length(model["elsets"]["Body1"]) => 120
+ @fact length(model["nsets"]["SUPPORT"]) => 9
+ @fact length(model["nsets"]["LOAD"]) => 9
+ @fact length(model["nsets"]["TOP"]) => 83
+end
diff --git a/test/test_elasticity_solver.jl b/test/test_elasticity_solver.jl
index cc29d23..74ff918 100644
--- a/test/test_elasticity_solver.jl
+++ b/test/test_elasticity_solver.jl
@@ -1,3 +1,6 @@
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
using FactCheck
using Logging
@Logging.configure(level=INFO)
@@ -154,6 +157,7 @@ facts("test interpolation of different field variables") do
F3 = F2'
F4 = [0.0 0.0; 10.0 0.0; 10.0 1.0; 0.0 1.0]'
F5 = F4'
+ F6 = [36, 36, 36, 36]
@fact interpolate(F1, N, [0.0, 0.0]) => 36.0
@fact interpolate(F2, N, [0.0, 0.0]) => 36.0
@@ -161,6 +165,7 @@ facts("test interpolation of different field variables") do
@fact interpolate(F4, N, [0.0, 0.0]) => [5.0; 0.5]
@fact interpolate(F5, N, [0.0, 0.0]) => [5.0; 0.5]
@fact interpolate(F5, dNdξ, [0.0, 0.0]) => [5.0 0.0; 0.0 0.5]
+ @fact interpolate(F6, N, [0.0, 0.0]) => 36
end
diff --git a/test/test_model.jl b/test/test_model.jl
index a8f3acc..4052fc9 100644
--- a/test/test_model.jl
+++ b/test/test_model.jl
@@ -1,3 +1,6 @@
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
using FactCheck
#using JuliaFEM
using Logging
diff --git a/test/test_xdmf.jl b/test/test_xdmf.jl
index 148d3ec..fd0284f 100644
--- a/test/test_xdmf.jl
+++ b/test/test_xdmf.jl
@@ -1,3 +1,6 @@
+# This file is a part of JuliaFEM.
+# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
+
using FactCheck
using Logging
@Logging.configure(level=INFO)