Commit Graph

345 Commits

Author SHA1 Message Date
Jukka Aho bafa3af4d0 test: Add Tutorial 4 - 1-element Quad4 validation (35 tests passing)
Educational validation test for Issue #265 use case (JuliaFEM as reference).

Covers:
- Element creation and connectivity
- Field assignment (geometry, material properties)
- Field retrieval with function call syntax
- Hand-calculated constitutive matrix for plane stress
- Geometry validation (dimensions, center, area)
- Material property validation (physical ranges)

Note: Defers stiffness matrix assembly to future work due to current
Quad4 assembly issues. Focus is on element setup validation that
other FEM developers can use as reference.

Tutorial series now: 107/107 tests passing
- Tutorial 1: Creating elements (5 tests)
- Tutorial 2: Gmsh mesh reading (72 tests)
- Tutorial 4: 1-element validation (35 tests - done before Tutorial 3)
2025-11-09 02:45:29 +02:00
Jukka Aho b91e81c125 test: Add Tutorial 2 - Gmsh mesh reading (72 tests passing)
Educational tutorial covering complete Gmsh.jl workflow:
- Mesh generation recipe (2×5 structured Quad4 grid)
- Reading nodes and extracting coordinates
- Reading elements and topology
- Physical group extraction for boundary conditions
- Creating JuliaFEM Element objects from Gmsh data
- Geometry field validation

Features:
- Co-located .msh file (10 elements, 18 nodes) for self-contained testing
- Recipe script shows exactly how mesh was generated (reproducible)
- Comprehensive tests (72 assertions) validating entire workflow
- Runtime: ~3 seconds
- Type-safe conversions (UInt64 → Int64 for connectivity)

Tutorial series now: 77/77 tests passing (Tutorial 1: 5, Tutorial 2: 72)
2025-11-09 02:24:06 +02:00
Jukka Aho 61218f8fd3 test: Phase 1 - Educational test infrastructure with Literate.jl
Implement testing philosophy (see docs/TESTING_PHILOSOPHY.md):

New test structure:
- test/tutorials/ - Educational tests (generate documentation)
- test/unit/ - Fast focused tests
- test/verification/ - Known analytical solutions
- test/runtests_new.jl - New test runner with env var control

First tutorial: Creating Elements and Fields
- Teaches node/element creation
- Explains field concept (geometry, materials, loads)
- 5 tests, all passing 

Test runner features:
- JULIAFEM_TEST_TUTORIALS=true/false (default: true)
- JULIAFEM_TEST_UNIT=true/false (default: false)
- JULIAFEM_TEST_OLD=true/false (default: false)
- Clear output with test categories
- Preserved old test suite as runtests.jl.old

Results: 5/5 tests passing in <2 seconds

Next: Write 2-3 more fundamental tutorials (mesh reading, 1D elasticity)
2025-11-09 01:51:17 +02:00
Jukka Aho 724ed52923 Add Manifest.toml 2025-11-08 08:50:59 +02:00
Jukka Aho 4ceb353314 Merge branch 'master' of github.com:JuliaFEM/JuliaFEM.jl 2019-11-26 15:30:42 +07:00
Jukka Aho d781b00da1 Merge branch 'master' into kc/local_buffer 2019-11-26 15:29:02 +07:00
Jukka Aho 9dc794101c Give meaningful error message when assembling continuum elasticity problem fails
Sometimes user may have the wrong kind of elements in element set when
assembling 3d continuum problem. This could happen for example in
situations, where mesher is giving also segment elements. They may have
some use in certain situations, but currently we don't support them.
When assembly is failing for this reasons, we give a meaningful error
message:

[ Info: It looks that you are trying to assemble elements of type Seg3
to 3d continuum problem. However, they are not supported yet. To filter
out elements from a element set, try `filter(element->!isa(element,
Element{Seg3}), elements)`
ERROR: LoadError: Tried to assemble unsupported elements of type Seg3 to
3d continuum problem.

This commit closes issue #211.
2019-10-27 12:50:11 +02:00
Jukka Aho 0d30a8f516 Create Project.toml file and remove REQUIRE files 2019-10-11 17:55:27 +03:00
Jukka Aho 824920c433 Fix broken test
The order of the calculated eigenvalues has been changed in the newest
Julia versions. Fixed by sorting the lists before comparison. Closes
issue #232.
2019-09-13 13:23:33 +03:00
Jukka Aho e462fa2862 Documentation deployment fix (#230)
Similar work done in FEMQuad.jl and FEMBase.jl
2019-04-08 21:35:13 +03:00
Kristoffer Carlsson 09c355b916 make backwards compatible 2018-11-29 17:40:55 -05:00
Kristoffer Carlsson ee7532a749 updates 2018-11-19 07:44:56 -05:00
Kristoffer Carlsson b503065d66 Merge branch 'kc/coloring' into kc/local_buffer 2018-11-15 08:18:28 -05:00
Kristoffer Carlsson a2adc68b3f implement matrix coloring 2018-11-08 14:28:20 -05:00
Kristoffer Carlsson 25866860ab wip 2018-11-08 14:27:44 -05:00
Kristoffer Carlsson cd22d1a571 use buffer and call assemble for one elements, also some tweaks for using sparsity pattern in FEMBase.jl 2018-10-19 17:35:30 -04:00
Jukka Aho ca7e2904cf Fix tests
* Fix deprecation warnings from tests
* Refactor tests so that ´@testset` is usually called in master file
  `runtests.jl`, not inside test file. Later on we can convert tests
  to examples.
* Syntax of tests now follow more closely syntax used currently in
  JuliaFEM. We have had earlier studies with different kind of syntaxes,
  now we have kind of explicit way to do things.
2018-09-06 13:34:26 +03:00
Jukka Aho 52be9e546b Create test/REQUIRE
* Add Documenter and Literate as test requirements
2018-09-06 13:34:26 +03:00
Jukka Aho 005a2440bb Update runtests.jl
* Explicitly call test files instead of for loop
* Call Documenter before and after unit tests
2018-09-06 13:34:26 +03:00
Jukka Aho c7ff354618 Remove badly designed test (#208)
Solution not known for tests. Let's create simpler tests with known solutions.
2018-07-25 14:10:05 +03:00
femtocleaner[bot] 33c8657f56 Fix deprecations (#206) 2018-07-05 11:21:10 +03:00
Jukka Aho eb600c940e Drop Logging.jl (#205)
Julia 0.7 is having improved logging capabilities, we can drop
Logging.jl.
2018-07-04 22:59:32 +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
Jukka Aho e68eec89f9 Move contact mechanics to separate package (#196)
Development of auto-differentiated mortar contact mechanics in 2D is moved to own separate package, MortarContact2DAD. Other changes are similar to what is done with MortarContact2D: elements are added to problems using `add_slave_elements!` and `add_master_elements!` instead of `add_elements!`, to make interface more explicit. Also, problem name is `Contact2DAD`, so the dimension is now explicitly stated in problem name. (Also have `Mortar2DAD`, compare to the `Mortar2D` and `Contact2D` of `MortarContact2D.jl`.)
2018-05-17 09:45:18 +03:00
Jukka Aho 9e28c6d604 Separate 2d contact code to own package (#195)
Moved plane contact related stuff to own separate package
`MortarContact2D.jl`, where the development continues.

The following changes to test files are done:

1) Problem name for plane mortar coupling is `Mortar2D` (was `Mortar`
before), and later on 3d coupling will be `Mortar`. So the dimension
of coupling operator is explicitly given in a problem name.

2) Before elements to coupling was defined using
```julia
update!(problem.elements, "master elements", master_elements)
add_elements!(problem, [slave_elements; master_elements])
```
Now, explicitly give master and slave elements as
```julia
add_slave_elements!(problem, slave_elements)
add_master_elements!(problem, master_elements)
```
Keep on mind that Lagrange multipliers are in slave side.
2018-05-07 15:14:42 +03:00
Jukka Aho 79170fcf23 Use package HeatTransfer.jl for heat problems (#194)
Heat transfer analysis is moved to its own package where the development continues. Two small modifications are needed for test files:

- Instead of `problem.properties.formulation`, we have two separate problems, `PlaneHeat` for two-dimensional problems and `Heat` for three-dimensional problems.
- Unnecessary prefixing of field names is changed. For example, now we simply have only "thermal conductivity" and not prefixed "temperature thermal conductivity".
2018-05-03 15:37:37 +03:00
Jukka Aho cfcd647cac Drop Dataframes (#193)
Looks that package is no more used in the code. Let's drop it.
2018-05-02 12:45:14 +03:00
Jukka Aho 23204ee15b Replace some rarely used functions (#188)
- `empty!(problem)` -> `empty!(problem.assembly)`
- `get_gdofs(element, ndim)` -> `get_gdofs(problem, element)`
2018-02-08 14:47:44 +07:00
Jukka Aho 5b93c48a3a Make JuliaFEM to use Analysis type from FEMBase
`Analysis` is basically doing same than `Solver` before, but has a
slighly simpler structure and is more general.
2018-01-29 23:13:41 +07:00
Jukka Aho 70dda739f9 use FEMBase v0.1.x (#185)
Lots of stuff moved from JuliaFEM.jl to FEMBase.jl.
2018-01-19 21:01:33 +07:00
Jukka Aho 35fea30dac New test for Tet10 mass matrix 2017-08-20 20:51:00 +03:00
Jukka Aho 4070b309c8 Fix test of zero eigenmodes
A better known example.
2017-08-20 20:51:00 +03:00
Jukka Aho ecaf8cb7fc Use global timer to measure performance
This makes syntax a little bit easier. Also, measure more accurately performance
of modal solver under investigation.
2017-08-19 13:30:01 +03:00
Jukka Aho 0fffdb52ba Test group_by_element_type 2017-08-19 00:01:47 +03:00
Jukka Aho a24a5945a1 Fix deprecation warnings when using Julia 0.6.0 2017-08-18 17:45:52 +03:00
Jukka Aho ef66a8f74b Assemble several elements at a time
Now assemble! takes a vector of elements as input. This makes it
possible to preallocate memory for common matrices making code super
fast.
2017-08-17 17:49:39 +03:00
Jukka Aho aabcda2e26 Implement new function create_nodal_elements
This function can be used to create elements from node set defined
in mesh. Resulting elements are of type Poi1, that is, they don't
have any volume but it's still possible to add boundary conditions
to them which are then enforced in discrete sense.
2017-08-17 15:53:20 +03:00
Jukka Aho 89af6faad5 Fix test
Now both JuliaFEM and JuliaFEM.Preprocess export add_elements! and
it must be spesifically pointed out which one is used in test.
2017-08-16 17:20:55 +03:00
Rapo 367c4711b3 Implement new function add_elements!
Add new elements to the problem.
2017-08-16 17:20:55 +03:00
Jukka Aho 1966b7f894 Remove functions used rarely
A new problem can be defined with 8(!) different styles. Let's remove
the ones not used often.
2017-08-16 16:57:56 +03:00
Jukka Aho a6b198b1ab Templating data type of Field
Use template in type Field to make type stabile code. This should fix
problems related to type stability.
2017-08-16 00:00:03 +03:00
Jukka Aho ab7a661712 New test 2017-08-15 15:49:50 +03:00
Jukka Aho b6b0bc3f55 Change coords field type from Point to Tuple
Change to Tuple, Array is allocating memory.
2017-08-14 17:10:02 +03:00
Jukka Aho 96714acc18 Add new method to set properties for problem
```
update!(body.properties, "a" => "b", "c" => "d")
```

Usage example is shown in
`test_elasticity_2d_linear_with_surface_load.jl`.
2017-08-05 14:42:13 +03:00
Jukka Aho 3d3e9bb441 Calculate shape functions using FEMBasis.jl
A lot of code is moved to FEMBasis.jl regarding
calculating basis / shape functions of finite elements.

* add FEMBasis to REQUIRE
* remove obsolete files
* remove obsolete test files
* make integration point iterable
* loosen type definitions
* get length of element rather from basis than connectivity
* calculate midpoint of reference element
* wrong input argument to eval_basis! fixed
2017-08-05 12:03:05 +03:00
Tony Kelman 4038c2f0ce Use @__DIR__ instead of Pkg.dir
this allows installing and loading the package from elsewhere
2017-08-05 12:02:00 +03:00
Jukka Aho b7880906ee separate optomechanical experiments to own package 2017-08-04 22:29:25 +03:00
Jukka Aho 648bbe2a40 use AsterReader.jl (#136)
Functions used to read Code Aster file format are now in separate package AsterReader.jl
2017-07-29 13:57:27 +03:00
Jukka Aho e46c0a1ad4 Use FEMQuad.jl to calculate quadrature rules for elements (#134) 2017-07-23 18:42:04 +03:00
Jukka Aho e13d6482ce Use PkgTestSuite for CI (#131)
This standardizes the CI process between JuliaFEM packages
2017-07-21 16:28:03 +03:00