From cc0ba70f0c0ece3af19292be4cef84b96bb395ea Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Wed, 2 Aug 2017 19:51:55 +0300 Subject: [PATCH] Update README * add usage example --- README.md | 49 +++++++++++++++++- docs/src/figs/poisson_problem_discretized.png | Bin 0 -> 4596 bytes 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 docs/src/figs/poisson_problem_discretized.png diff --git a/README.md b/README.md index a33fda8..99f340d 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,51 @@ Testing package can be done using `Pkg.test`, i.e. julia> Pkg.test("Mortar2D") ``` -Probably the easiest way to test the functionality of package is to use [JuliaBox](https://juliabox.com/). +Probably the easiest way to test the functionality of package is to +use [JuliaBox](https://juliabox.com/). + +## Usage example + +Let us calculate projection matrices D and M for the following problem: + +![](docs/src/figs/poisson_problem_discretized.png) + +Problem setup: + +```julia +Xs = Dict(1 => [0.0, 1.0], 2 => [5/4, 1.0], 3 => [2.0, 1.0]) +Xm = Dict(4 => [0.0, 1.0], 5 => [1.0, 1.0], 6 => [2.0, 1.0]) +coords = merge(Xm , Xs) +Es = Dict(1 => [1, 2], 2 => [2, 3]) +Em = Dict(3 => [4, 5], 4 => [5, 6]) +elements = merge(Es, Em) +element_types = Dict(1 => :Seg2, 2 => :Seg2, 3 => :Seg2, 4 => :Seg2) +slave_element_ids = [1, 2] +master_element_ids = [3, 4] +``` + +Calculate projection matrices D and M + +```julia +s, m, D, M = calculate_mortar_assembly( + elements, element_types, coords, + slave_element_ids, master_element_ids) +``` + +According to theory, the interface should transfer constant without any +error. Let's test that: + +```julia +u_m = ones(3) +u_s = D[s,s] \ (M[s,m]*um) + +# output + +3-element Array{Float64,1}: + 1.0 + 1.0 + 1.0 +``` + +The rest of the story can be read from the [documentation](https://juliafem.github.io/Mortar2D.jl/latest/). +There's also brief review to the theory behind non-conforming finite element meshes. diff --git a/docs/src/figs/poisson_problem_discretized.png b/docs/src/figs/poisson_problem_discretized.png new file mode 100644 index 0000000000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