aasdfasdf

This commit is contained in:
Jukka Aho
2015-06-26 19:40:36 +03:00
20 changed files with 399 additions and 1008 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
![JuliaFEMLogo](https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/geometry/JuliaFEMLogo_256x256.png)
# JuliaFEM
[![Join the chat at https://gitter.im/JuliaFEM/JuliaFEM](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/JuliaFEM/JuliaFEM?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -6,7 +7,7 @@ Build Status: [![Build Status](https://travis-ci.org/JuliaFEM/JuliaFEM.jl.svg?br
Code Coverage: [![Coverage Status](https://coveralls.io/repos/JuliaFEM/JuliaFEM.jl/badge.svg?branch=master)](https://coveralls.io/r/JuliaFEM/JuliaFEM.jl?branch=master)
http://juliafem.readthedocs.org/en/latest/
Documentation: [![Documentation Status](https://readthedocs.org/projects/juliafem/badge/?version=latest)](https://readthedocs.org/projects/juliafem/?badge=latest)
The JuliaFEM project develops open-source software for reliable, scalable, distributed Finite Element Method.
+1
View File
@@ -2,5 +2,6 @@ julia 0.4-
Logging
LightXML
Docile
Lexicon
FactCheck
HDF5
File diff suppressed because one or more lines are too long
+40 -2
View File
@@ -1,3 +1,41 @@
[FEATURES / TODO](https://github.com/ovainola/JuliaFEM/blob/master/docs/features.md)
# JuliaFEM
Use `git mv` to move files in repository to make file tracking work properly.
[![Join the chat at https://gitter.im/JuliaFEM/JuliaFEM](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/JuliaFEM/JuliaFEM?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Build Status: [![Build Status](https://travis-ci.org/JuliaFEM/JuliaFEM.jl.svg?branch=master)](https://travis-ci.org/JuliaFEM/JuliaFEM.jl)
Code Coverage: [![Coverage Status](https://coveralls.io/repos/JuliaFEM/JuliaFEM.jl/badge.svg?branch=master)](https://coveralls.io/r/JuliaFEM/JuliaFEM.jl?branch=master)
http://juliafem.readthedocs.org/en/latest/
The JuliaFEM project develops open-source software for reliable, scalable, distributed Finite Element Method.
The JuliaFEM software library is a framework that allows for the distributed processing of large Finite Element Models across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage. The basic design principle is: everything is nonlinear. All physics models are nonlinear from which the linearization are made as a special cases.
JuliaFEM current status: project planning
Initial road map for JuliaFEM:
version | number of degree of freedom | number of cores
----------|-----------------------------------------|----------------------
1.0 | 100 000 000 | 1 000
2.0 | 1 000 000 000 | 10 000
3.0 | 10 000 000 000 | 100 000
We strongly believe in the test driven development as well as building on top of previous work. Thus all the new code in this project should be 100% tested. Also other people have wisdom in style as well:
[The Zen of Python](https://www.python.org/dev/peps/pep-0020/)
```
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Errors should never pass silently.
```
Interested in participating? Please start by reading [CONTRIBUTING.md](https://github.com/JuliaFEM/JuliaFEM/blob/master/CONTRIBUTING.md).
Contributors: see [contributors](https://github.com/JuliaFEM/JuliaFEM/blob/master/contributors)
+154
View File
@@ -0,0 +1,154 @@
# 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:171](https://github.com/JuliaFEM/JuliaFEM.jl/tree/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L171)
---
<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:130](https://github.com/JuliaFEM/JuliaFEM.jl/tree/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L130)
---
<a id="method__calc_local_matrices.1" class="lexicon_definition"></a>
#### 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/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L68)
---
<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:218](https://github.com/JuliaFEM/JuliaFEM.jl/tree/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L218)
---
<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:257](https://github.com/JuliaFEM/JuliaFEM.jl/tree/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L257)
---
<a id="method__interpolate.1" class="lexicon_definition"></a>
#### 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/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L30)
---
<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:278](https://github.com/JuliaFEM/JuliaFEM.jl/tree/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/elasticity_solver.jl#L278)
+104
View File
@@ -0,0 +1,104 @@
# JuliaFEM
## Exported
---
<a id="method__add_elements.1" class="lexicon_definition"></a>
#### 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/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/JuliaFEM.jl#L102)
---
<a id="method__get_elements.1" class="lexicon_definition"></a>
#### 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/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/JuliaFEM.jl#L126)
---
<a id="method__get_field.1" class="lexicon_definition"></a>
#### 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/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/JuliaFEM.jl#L67)
---
<a id="method__new_model.1" class="lexicon_definition"></a>
#### 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/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/JuliaFEM.jl#L41)
---
<a id="type__model.1" class="lexicon_definition"></a>
#### JuliaFEM.Model [¶](#type__model.1)
Basic model
*source:*
[JuliaFEM/src/JuliaFEM.jl:19](https://github.com/JuliaFEM/JuliaFEM.jl/tree/92c5e6c15a1ffaea4c153cba2af3a62ba3b42ebe/src/JuliaFEM.jl#L19)
+2
View File
@@ -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.
+2
View File
@@ -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.
-1
View File
@@ -1 +0,0 @@
+43
View File
@@ -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
+7 -1
View File
@@ -3,6 +3,12 @@ using Docile, Lexicon, JuliaFEM
const api_directory = "api"
const modules = [JuliaFEM, JuliaFEM.elasticity_solver]
main_folder = dirname(dirname(@__FILE__))
this_folder = dirname(@__FILE__)
file_ = "README.md"
run(`cp $main_folder/$file_ $this_folder`)
cd(dirname(@__FILE__)) do
# Generate and save the contents of docstrings as markdown files.
index = Index()
@@ -12,7 +18,7 @@ cd(dirname(@__FILE__)) do
save(joinpath(api_directory, "index.md"), index; md_subheader = :category)
# Add a reminder not to edit the generated files.
open(joinpath(api_directory, "README_new.md"), "w") do f
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.
-15
View File
@@ -1,15 +0,0 @@
import os
import sys
import re
import juliadoc
extensions = ['sphinx.ext.mathjax',
'juliadoc.julia',
'juliadoc.jldoctest',
'juliadoc.jlhelp']
master_doc = 'index'
html_theme_path = [juliadoc.get_theme_dir()]
html_sidebars = juliadoc.default_sidebars()
-29
View File
@@ -1,29 +0,0 @@
===============
FEATURES / TODO
===============
- Parallel design
- Sparse matrices
- Discontinuous Galerkin?
- 100% Tested
- Automatic coverage (Travis CI)
- Doctest examples and tutorials
- Intuitive to use
- Marketing
- Engineering porn
- Field functions
- Multiphysics platform
- Elasticity
- Thermal implemented
- Transient and steady solvers
- Implicit dynamics
- Nonlinearities
- Geometrical
- Material
- Contact
- Mortar
- Modular design
- E.g. contact formulation can be altered by user
- Mesh and results format, Xdmf?
- No scalars but field variables, e.g. no constant 210GPa for steel, we interpolate variable from nodes.
- (Constant is a special case of field variable).
-1
View File
@@ -1 +0,0 @@
-e git+https://github.com/JuliaLang/JuliaDoc.git#egg=JuliaDoc
+14
View File
@@ -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'
+12 -10
View File
@@ -2,7 +2,9 @@
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
module JuliaFEM
VERSION < v"0.4-" && using Docile
using Lexicon
include("elasticity_solver.jl")
include("xdmf.jl")
@@ -11,9 +13,9 @@ 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
@@ -25,7 +27,7 @@ end
@doc """
"""
Initialize empty model.
Parameters
@@ -35,7 +37,7 @@ None
Returns
-------
New model struct
""" ->
"""
function new_model()
return Model(Dict(), Dict(), Dict(), Dict(), Dict())
end
@@ -45,7 +47,7 @@ end
@doc """Get field from model.
"""Get field from model.
Parameters
----------
@@ -61,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
@@ -77,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..]}
@@ -96,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)
@@ -110,7 +112,7 @@ end
@doc """Get subset of elements from model.
"""Get subset of elements from model.
Parameters
----------
element_ids : list of ints
@@ -120,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")
+2 -2
View File
@@ -12,9 +12,9 @@ eldims = Dict({"C3D10" => 10})
global handlers = Dict()
@doc """
"""
Register new handler for parser
""" ->
"""
function add_handler(section, function_name)
handlers[section] = function_name
end
+14 -14
View File
@@ -13,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.
@@ -26,7 +26,7 @@ basis :: Function
Basis functions
ip :: Array{Number, 1}
Point to interpolate
""" ->
"""
function interpolate{T<:Real}(field::Array{T,1}, basis::Function, ip)
result = dot(field, basis(ip))
return result
@@ -62,9 +62,9 @@ end
@doc """
"""
Calculate local tangent stiffness matrix and residual force vector R = T - F
""" ->
"""
function calc_local_matrices!(X, u, R, Kt, N, dNdchi, lambda_, mu_, ipoints, iweights)
dim, nnodes = size(X)
I = eye(dim)
@@ -112,7 +112,7 @@ function calc_local_matrices!(X, u, R, Kt, N, dNdchi, lambda_, mu_, ipoints, iwe
end
@doc """
"""
Assemble global stiffness matrix to I,J,V ready for sparse format
Parameters
@@ -126,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_))
@@ -153,7 +153,7 @@ function assemble!(ke, eldofs_, I, J, V)
end
@doc """
"""
Assemble global RHS to I,V ready for sparse format
Parameters
@@ -167,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_))
@@ -189,7 +189,7 @@ function assemble!(fe, eldofs_, I, V)
end
@doc """
"""
Eliminate Dirichlet boundary conditions from matrix
Parameters
@@ -214,7 +214,7 @@ Raises
Exception, if displacement boundary conditions given, i.e.
DX=2 for some node, for example.
""" ->
"""
function eliminate_boundary_conditions(dirichletbc, I, J, V)
if any(dirichletbc .> 0)
throw("displacement boundary condition not supported")
@@ -229,7 +229,7 @@ function eliminate_boundary_conditions(dirichletbc, I, J, V)
return findnz(A)
end
@doc """
"""
Eliminate Dirichlet boundary conditions from vector
Parameters
@@ -253,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")
@@ -272,9 +272,9 @@ end
@doc """
"""
Solve one increment of elasticity problem
""" ->
"""
function solve_elasticity_increment!(X, u, du, elmap, nodalloads,
dirichletbc, lambda, mu, N, dNdchi, ipoints,
iweights)
+2 -2
View File
@@ -11,14 +11,14 @@ 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
-10
View File
@@ -1,13 +1,3 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
function C2D4(xx)
theta = 1
chi = xx[1]
eta = xx[2]
return = [(1 - chi) * (1 - eta),
chi * (1 - eta),
chi * eta,
(1 - chi) * eta]
end