Commit Graph

997 Commits

Author SHA1 Message Date
Jukka Aho c317e3440f feat: Create IO submodule for mesh readers and result writers
New structure:
- src/io/io.jl: IO submodule definition and exports
- src/io/aster_reader.jl: Code Aster .med reader (ready for HDF5 extension)

Benefits:
- Clean separation of I/O code
- ABAQUS reader works with stdlib only
- Ready for package extensions (HDF5, LightXML)
- Easy to add new formats (VTK, Gmsh, etc.)

The IO submodule exports abaqus_read_mesh() to main JuliaFEM namespace.
2025-11-08 14:32:27 +02:00
Jukka Aho c40d0b91c9 feat: Add built-in polynomial differentiation (from SymDiff.jl)
Integrated minimal symbolic differentiation from SymDiff.jl by Jukka Aho:
- differentiate(): Symbolic derivatives for polynomials (+, -, *, /, ^)
- simplify(): Expression simplification with numeric evaluation
- Zero external dependencies for basis function generation!

Changes:
- src/basis/create_basis.jl: Added differentiate() and simplify()
- src/basis/subs.jl: Added local simplify with numeric evaluation
- src/basis/abstract.jl: Removed Calculus import

This replaces the Calculus.jl dependency with ~100 lines of pure Julia
code specifically designed for polynomial basis functions.
2025-11-08 14:32:06 +02:00
Jukka Aho 2cee2222e1 feat: Consolidate HeatTransfer.jl (partial - API needs update)
- Added 118 lines of heat transfer code to src/problems_heat.jl
- Problem types: Heat (3D), PlaneHeat (2D)
- Fields: thermal conductivity, heat source, heat flux, convection
- Fixed Element type signatures (Element{M,B})
- NOTE: Tests currently failing due to element_info! API mismatch
- Will fix after more consolidations (old FEMBase 0.x API)

Result: 9 vendor packages consolidated (~6620 lines total)
Tests: 5 passing baseline maintained (heat tests need API fix)
2025-11-08 12:11:37 +02:00
Jukka Aho a76146cdaf feat: Consolidate GraphOrdering.jl (RCM bandwidth minimization)
- Added 96 lines of graph algorithm code to src/graph/
- Reverse Cuthill-McKee (RCM) ordering for sparse matrix bandwidth minimization
- Critical for efficient FEM assembly and solving
- Functions: symrcm, bandwidth, reorder
- Renamed Result → GraphOrderingResult for clarity

Result: 8 vendor packages consolidated (~6500 lines total)
Tests: 5 passing (baseline maintained)
2025-11-08 11:29:19 +02:00
Jukka Aho ef9cddff13 feat: Consolidate AbaqusReader and AsterReader (mesh I/O)
- Added 1111 lines of mesh reading code to src/readers/
- ABAQUS .inp format support (6 files: parse_mesh, parse_model, keywords, etc.)
- Code Aster .med format support (3 files: read_aster_mesh, read_aster_results)
- Modernized Julia 0.x → 1.x syntax:
  * Nullable{T} → Union{T, Nothing}
  * get(nullable) → direct field access
- Added Logging stdlib to Project.toml dependencies
- Functions verified: abaqus_read_mesh, aster_read_mesh

Result: 7 vendor packages consolidated (~6400 lines total)
        FEMBasis, FEMBase, FEMQuad, FEMSparse, AbaqusReader, AsterReader
Tests: 5 passing (baseline maintained)
2025-11-08 11:25:13 +02:00
Jukka Aho f6f3b97c16 feat: Consolidate FEMSparse.jl into JuliaFEM
Consolidated FEMSparse package into src/sparse/:
- sparsematrixcsc.jl: AssemblerSparsityPattern for efficient assembly
- sparsevectordok.jl: Skipped (old Julia syntax, not used)

Changes:
- Removed 'import FEMSparse' from JuliaFEM.jl
- Updated problems_elasticity.jl: FEMSparse.AssemblerSparsityPattern → AssemblerSparsityPattern
- Fixed include paths in sparse/sparse.jl (relative, not absolute)

Modernization:
- Fixed sparsevectordok.jl type keyword → mutable struct
- Fixed AbstractSparseArray type parameter syntax
- Chose to skip sparsevectordok for now (old {T,V} syntax, unused)

Result:
- ✅ JuliaFEM loads successfully
- ✅ 5 tests still passing (no regression)
- ✅ Three vendor packages now consolidated: FEMBase, FEMBasis, FEMQuad, FEMSparse

Remaining vendor packages: AbaqusReader, AsterReader, HeatTransfer, FEMBeam, Mortar packages
2025-11-08 11:08:10 +02:00
Jukka Aho 1f9c723017 style: Format spacing in quadrature.jl (w*f → w * f) 2025-11-08 10:52:47 +02:00
Jukka Aho 315c319963 feat: Consolidate FEMQuad.jl into JuliaFEM (quadrature rules)
Consolidated entire FEMQuad.jl package (436 lines) into src/quadrature/:
- quaddata.jl: Quadrature data definitions
- glquad.jl: 2D quadrilateral Gauss-Legendre rules
- gltri.jl: 2D triangle Gauss-Legendre rules (131 lines)
- gltet.jl: 3D tetrahedron Gauss-Legendre rules
- glwed.jl: 3D wedge Gauss-Legendre rules
- glpyr.jl: 3D pyramid Gauss-Legendre rules

Changes:
- Created src/quadrature.jl as main include file
- Removed 'import FEMQuad' from JuliaFEM.jl
- Updated integrate.jl: FEMQuad.get_quadrature_points → get_quadrature_points
- Added export add_element! (was missing)

Result:
- ✅ JuliaFEM loads successfully
- ✅ Integration points work correctly
- ✅ 5 tests still passing (no regression)
- ✅ One less vendor package dependency

Next: Continue consolidating vendor packages
2025-11-08 10:49:28 +02:00
Jukka Aho a8d4f7e504 fix: Move Base imports before includes to fix method extension
CRITICAL FIX: Base function imports must come BEFORE any includes that define methods.

Problem:
- Had 'import Base: getindex, setindex!, ...' AFTER including files
- This caused "import conflicts with existing identifier" warnings
- Our getindex/setindex! methods were NOT extending Base, they were standalone
- Result: Dict{Int, Vector} getindex failed completely

Solution:
- Moved all Base imports to module top, right after 'module JuliaFEM'
- Now all our methods properly extend Base functions
- Removed duplicate imports later in file

Result:
- ✅ 5 TESTS PASSING! (back to baseline)
- ✅ Core API works: Element creation, Problem creation, field updates
- ✅ test_mortar_3d_polygon_clip.jl passes all 5 tests
- ⚠️  43 tests still error (but core functionality proven)

This was the root cause of test regression
2025-11-08 10:38:00 +02:00
Jukka Aho 84c07e1c34 refactor: Remove vendor package dependencies (HeatTransfer, FEMBeam, Mortar*)
Removed all vendor package imports to make JuliaFEM standalone:
- Commented out: HeatTransfer, FEMBeam, MortarContact2D, MortarContact2DAD
- Commented out: AbaqusReader, AsterReader
- These will be consolidated later or remain as vendor archives

Philosophy shift: Focus solely on making JuliaFEM.jl work standalone
- No need for backward compatibility with abandoned vendor packages
- Vendor packages are archaeological artifacts, not dependencies

Result:
- ✅ JuliaFEM still loads successfully
- ✅ Exports reduced to 122 symbols (down from 134)
- Tests status unchanged (still investigating core issues)

Next: Fix actual code issues, not vendor compatibility
2025-11-08 10:32:29 +02:00
Jukka Aho 615de1a7c2 style: Format whitespace in deprecated_fembase.jl 2025-11-08 10:24:07 +02:00
Jukka Aho 650872cf2d fix: Add deprecated FEMBase methods for backward compatibility
Added deprecated_fembase.jl with legacy methods that tests and user code depend on:
- length(element): Returns number of nodes in element
- size(element): Returns (dim, nnodes)
- getproperty override: Maps element.fields → element.dfields

Bug fix:
- Changed sym == :fields to sym === :fields in getproperty
- Reason: fields.jl overrides == operator, breaking normal Symbol comparisons
- This is a known issue (Code Smell documented in Phase 4 plan)

Result:
- ✅ Element length() works correctly
- ✅ Basic element operations functional
- ⚠️  Test suite still has 44 errors (investigating other API mismatches)

Next: Investigate remaining test failures, likely more API incompatibilities
2025-11-08 09:52:49 +02:00
Jukka Aho 73ec910589 feat: Consolidate FEMBase.jl into JuliaFEM (Phase 1 complete)
MAJOR MILESTONE: FEMBase + FEMBasis fully consolidated, JuliaFEM loads!

Consolidated files:
- src/elements/ (3 files): elements.jl, elements_lagrange.jl, integrate.jl
- src/fields/ (1 file): fields.jl (DCTI, DVTI, DCTV, DVTV, etc.)
- src/sparse/ (1 file): sparse.jl (SparseMatrixCOO, SparseVectorCOO)
- src/assembly/ (2 files): problems.jl, assembly.jl
- src/solvers/ (1 file): solvers_base.jl
- src/analysis.jl, src/core_types.jl (Node, IP, IntegrationPoint)

Changes to JuliaFEM.jl:
- Added dependencies: Tensors, Calculus
- Removed @reexport using FEMBase (now consolidated)
- Added 20+ include statements for consolidated files
- Include order: fields → core_types → fembase_compat → sparse → elements

Compatibility layer:
- Created fembase_compat.jl: Minimal FEMBase submodule for vendor packages
- Temporarily disabled vendor-specific Mortar2D functions in solvers_modal.jl

Bug fixes:
- Changed i == 1 → isequal(i, 1) in integrate.jl (== operator overridden by fields)
- Resolved all FEMBasis. namespace references throughout codebase

Result:
- ✅ JuliaFEM loads successfully on Julia 1.12.1
- ✅ 134 exported symbols (was 171 with separate FEMBase)
- ✅ Core types accessible: Seg2, Quad4, Problem, AbstractProblem, etc.
- ⚠️  Vendor packages show FEMBase cache warnings (expected, harmless)

TODO:
- Re-enable Mortar2D functions after vendor consolidation
- Field system == operator override needs redesign (Phase 4)
- Continue Phase 2: Consolidate remaining vendor packages
2025-11-08 09:39:16 +02:00
Jukka Aho d3fc55f13e feat: Integrate FEMBasis into JuliaFEM module (partial)
- Add Tensors and Calculus to Project.toml dependencies
- Add basis includes to src/JuliaFEM.jl (Phase 1 integration)
- Fix FEMBasis. namespace references → use JuliaFEM namespace
- Update create_basis.jl: AbstractBasis (not FEMBasis.AbstractBasis)

Status: Basis files load, but conflict with FEMBase expectations
Next: Need to consolidate FEMBase or work around AbstractElement type constraints

This is expected during consolidation - we're bridging two systems.
2025-11-08 09:09:54 +02:00
Jukka Aho 7b6fcfdaf5 feat: Copy FEMBasis.jl files to src/basis/ (Phase 1 start)
- Create src/basis/ directory structure
- Copy all FEMBasis.jl source files verbatim:
  - abstract.jl: AbstractBasis type definition and interface
  - create_basis.jl: Metaprogramming for basis generation
  - lagrange_*.jl: All Lagrange element bases (Seg, Quad, Tri, Tet, Hex, Wedge, Pyr)
  - nurbs*.jl: NURBS basis functions
  - math.jl: jacobian, grad, interpolate functions
  - subs.jl, vandermonde.jl: Symbolic/mathematical utilities

Strategy: Copy first, integrate later (safest approach)
Next: Integrate into src/JuliaFEM.jl module
2025-11-08 09:02:40 +02:00
Jukka Aho 724ed52923 Add Manifest.toml 2025-11-08 08:50:59 +02:00
Jukka Aho bc65dab2fc fix: Resolve merge conflicts and remove incomplete parallel assembly
- Remove incomplete parallel assembly code from 2019 (Issue #250)
- Parallel assembly referenced non-existent problem.assemble_parallel field
- Resolve merge conflict markers from master branch
- Code formatting: standardize spacing around operators and type annotations
- Simplify to serial assembly with comment noting parallel needs refactor

Package still loads and core tests pass.
2025-11-08 08:44:30 +02:00
Jukka Aho 74ac108a56 chore: Update Project.toml dependencies
- Update FEMSparse UUID to match vendor package
- Add InterfaceMechanics dependency
- Reformat author/version lines
2025-11-08 07:57:15 +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 e821e07723 Remove imports not available anymore in Base
Closes issue #234.
2019-10-13 12:36:51 +03:00
Matt Campbell b62ddac26a change in old function name ucfirst to uppercasefirst, which was preventing the beam examples from running 2019-09-25 10:15:05 -07:00
Jukka Aho 3be87e02bf Merge pull request #226 from JuliaFEM/kc/coloring
Implement matrix coloring.
2019-04-08 18:56:11 +03:00
Jukka Aho 6903041db7 Merge pull request #225 from JuliaFEM/KristofferC-patch-2
Improve performance in elasticity by moving out the computation of X from the integration point loop.

Before:
```
 12.576967 seconds (37.65 M allocations: 1.852 GiB, 11.65% gc time)
```

After:
```
 11.251927 seconds (35.27 M allocations: 1.692 GiB, 11.27% gc time)
```

2 million allocations less.
2019-04-08 18:44:59 +03:00
Kristoffer Carlsson 2aca9f0d0c alloc improvements 2018-12-03 15:20:06 -05: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 3c67c9c2c9 single threaded 2018-11-15 12:26:17 -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 58f9fb05be improve performance in elasticity by moving out computation of X from intergration point loop 2018-11-02 13:47:57 -04:00
Kristoffer Carlsson 64c6ff8ad5 improve performance in elasticity 2018-11-02 13:38:15 -04:00
Kristoffer Carlsson 32ac97f4b1 keep working on csc assembly 2018-10-28 20:40:55 -04: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
Kristoffer Carlsson 2394725a61 Elasticity: add a local buffer struct to preallocate things needed in the assembly loop 2018-10-02 16:00:02 -04:00
Jukka Aho 4b471ac9ba Store Xdmf results in Mixed format
Store element connectivity as "Mixed" format to Xdmf file. It's a long
list where first number is element code and then there is connectivity
data (starting from 0). Xdmf format does not support several
Topology-elements in Xml file format, so before it was not possible to
store e.g. both Tri3 and Quad4 elements in same problem. After this
commit this should now be possible. Paraview Xdmf3 reader is needed to
use.
2018-09-20 19:59:45 +03:00
Jukka Aho a5a2c43dd8 Fix deprecation warnings
* Add docstrings
* Refactor code
* Module level docstring giving an example
2018-09-06 13:34:26 +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 8bfda8c6e0 fix bug of setting sigma in Modal analysis (#204) 2018-07-04 21:51:09 +03:00
Jukka Aho 7e1b5d2a0c Call Nonlinear analysis using run! (#201)
`analysis(time)` and `solve!(analysis, time)` are going to be deprecated later on.
2018-06-06 15:36:46 +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 d0f68682ea Fix bug in writing two-dimensional problems (#198) 2018-05-25 17:54:36 +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 4941a4f005 Fix bug with sigma value (#197)
Sigma redefined.
2018-05-12 11:55:25 +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