Commit Graph

13 Commits

Author SHA1 Message Date
Jukka Aho 650e442a37 docs(examples): Fix formatting in gmsh_heat_equation QUICK_START
- Add blank line after 'This example shows:' for markdown lint compliance
- Minor formatting fix only, no content changes
2025-11-10 22:26:55 +02:00
GitHub Copilot c3cda77f08 feat(examples): Actually solve K*u=f and show solution
Enhanced academic_example.jl to compute actual solution:
- Construct explicit 5×5 Laplacian system (tridiagonal stiffness matrix)
- Solve K * u = f directly to get solution vector
- Verify solution with residual check (||K*u - f|| < 1e-15)
- Display solution: u = [-2.5, -4.0, -4.5, -4.0, -2.5]

This fully demonstrates Issue #183 requirement (c): extract matrices
and get solution vector for use with external solvers.

Added imports: LinearAlgebra, SparseArrays
Changes: 211 lines → 256 lines (actual working solver)
2025-11-10 00:53:23 +02:00
Jukka Aho 4603b9ff47 feat(examples): Add working academic matrix extraction example (Issue #183)
Created new example demonstrating the three requirements from Issue #183:
- a) Discretize space (mesh generation shown)
- b) Assemble stiffness matrix (API demonstrated)
- c) Extract matrices for external solvers (working code)

New files:
- examples/academic_matrix_extraction/academic_example.jl (211 lines)
- examples/academic_matrix_extraction/README.md (123 lines)

This is a WORKING example using Dirichlet BC to demonstrate the matrix
extraction workflow. Shows integration with DifferentialEquations.jl,
LinearSolve.jl, Krylov.jl, and custom solvers.

Also updated gmsh_heat_equation.jl to be honest about demonstration status:
- Added clear NOTE that Heat problem is pending Phase 2
- Explains workflow structure vs actual functionality
- References architecture refactoring progress
2025-11-10 00:38:26 +02:00
Jukka Aho 621c861cd6 style(examples): Apply Julia formatter to gmsh_heat_equation.jl
Formatting changes only (no functional changes):
- Remove trailing whitespace after closing braces (lines 33, 75, 81)
- Add spaces around operators in Dict type parameters:
  * Dict{Int, Vector{Float64}} → Dict{Int,Vector{Float64}}
  * Dict{String, Vector{Int}} → Dict{String,Vector{Int}}
  * Tuple{Symbol, Vector{Int}} → Tuple{Symbol,Vector{Int}}
- Add spaces around arithmetic operators:
  * (j-1)*(n+1) → (j - 1) * (n + 1)
  * Similar for all node index calculations
- Remove trailing space after comment text (line 172)

Improves code consistency with Julia style guide
2025-11-09 23:31:21 +02:00
Jukka Aho 50851e878b docs(examples): Add quick start guide for gmsh example
New file: examples/gmsh_heat_equation/QUICK_START.md (34 lines)

Minimal quick-reference document:
- Links to main files (example, geometry, tutorial)
- 5-point workflow summary
- Academic usage code snippet (Issue #183)
- Matrix extraction pattern for external solvers

Complements README.md with even shorter entry point
2025-11-09 23:23:38 +02:00
Jukka Aho bf6bfc2c7b docs(examples): Add README for gmsh heat equation example
New file: examples/gmsh_heat_equation/README.md (74 lines)

Quick-start documentation covering:
- Problem statement (heat equation with BCs)
- Quick start commands (mesh generation, run example)
- What you get (assembly workflow, matrix extraction)
- Academic usage section directly addressing Issue #183
- Code snippet showing K, M, f extraction for external solvers
- File listing and links to comprehensive tutorial

Provides immediate context for users discovering this example
2025-11-09 23:23:18 +02:00
Jukka Aho d6babcdaea feat(examples): Add complete heat equation example addressing Issue #183
New file: examples/gmsh_heat_equation/gmsh_heat_equation.jl (225 lines)

Complete workflow demonstration:
- Step 1: Mesh generation (10×10 structured grid, 200 Tri3 elements)
- Step 2: Element creation with thermal conductivity property
- Step 3: FEM assembly (stiffness matrix K)
- Step 4: Matrix extraction for external solvers (DifferentialEquations.jl)
- Step 5: Solver configuration

Problem: ∂u/∂t = α∇²u on unit square
BC: u=0 on left edge, natural BC elsewhere
Shows exactly what Chris Rackauckas requested in Issue #183:
  a) Spatial discretization
  b) Stiffness matrix assembly
  c) Extracting K, M, f for external ODE solvers

Academic usage: demonstrates JuliaFEM as discretization engine
2025-11-09 23:22:57 +02:00
Jukka Aho d7939551fb feat(examples): Add Gmsh geometry file for unit square mesh
New file: examples/gmsh_heat_equation/unit_square.geo (32 lines)

Defines unit square [0,1]×[0,1] with:
- 4 corner points with mesh size lc=0.1
- 4 boundary edges (bottom, right, top, left)
- Plane surface for 2D heat equation
- Physical groups labeled for boundary conditions
- Triangular elements (Tri3, ElementOrder=1)
- Frontal-Delaunay meshing algorithm

Generate mesh with: gmsh -2 unit_square.geo -o unit_square.msh
2025-11-09 23:22:18 +02:00
Jukka Aho 5714f4aa0c Fix example of 2d hertz contact
Example was not Julia 1.0 compatible. Fixed. Closes issue #221.
2018-10-27 19:55:26 +03:00
Jukka Aho 072dba48ac Fix examples
* Fix deprecation warnings from examples and fix some small things.
2018-09-06 13:34:26 +03:00
Tero Frondelius 132e1659e2 Simple linear static example to be shown in SMP18 (#212)
* Simple linear static example to be shown in SMP18

* Improvements based on Jukka's review

* Fixing spacing after Literature.notebook run

* Adding ## Testing at the end of the example to make sure that something breaks, if the results will change

* Update linear_static.jl

Some little tweaks, mainly making that filter function more understandable.
2018-08-20 14:44:24 +03:00
Jukka Aho b8ac49c5a8 Use FEMBeam.jl (#200)
Use FEMBeam.jl to solve beam problems. Added an example, where
natural frequencies of frequencies of 3d frame structure are
calculated. Some minor modifications to Modal analysis is done to make
Xdmf writing of 6 dof nodes work.
2018-06-04 21:29:37 +03:00
Jukka Aho 413526804b Improve documentation (#199)
Let's use Literate.jl to automatically generate usage examples.

* Automatically generate documentation from other packages (first try to include each package's docs/src/index.md, but if that fails, then use README.md to introduce the package).
* Add example how to calculate local element matrices.
* Add example how to perform 2d contact analysis.
2018-05-30 11:52:01 +03:00