How ryujimiya/ivyfem works
Based on our analysis of the file tree and README, IvyFEM is a .NET CAE (Computer-Aided Engineering) library that implements Finite Element Method (FEM) simulations for a wide variety of physics domains (structural mechanics, fluid dynamics, electromagnetics, etc.). It is intended to be used within a .NET WPF application (as shown by the references in the README and sample app links) and is delivered as a compiled DLL (with releases available in the “publish” folder) while all of its source code is under the “src/IvyFEM” folder.
Project Type and Purpose
• Recognize that IvyFEM is not a full “end-to-end” application but rather a comprehensive simulation library. It is structured as a tool that provides mesh generation, CAD-utilities, finite element assembly, solver routines (using LAPACKE, Lis, and custom solvers), and various physics-specific simulation modules.
• The library is modular and supports many different types of FEM analyses (2D/3D structural analysis, fluid flow, electromagnetic wave propagation, and more) with multiple classes dedicated to different methods and element types.
Major Components to Identify
• Core FEM Engine:
– FEWorld and FE classes that manage simulation domains.
– Mesh Generation: Classes like Mesher2D, Mesher3D (and associated Drawers for 2D/3D drawings), MeshPoint, MeshTri2D/3D, MeshTet, etc.
– CAD / Geometry Handling: Cad2D, Cad3D, and utilities (CadUtils2D/3D, CadEdge2DPolyline, etc.) that facilitate creation and manipulation of geometries.
• Physics Simulation Modules:
– Elasticity Modules: Numerous classes for different elasticity formulations (e.g., Elastic2DFEM, Elastic3DFEM, variants for eigen analysis and time domain, plus various material models like BeamMaterial, CorotationalFrameMaterial, MooneyRivlin, Ogden, etc.).
– Fluid Dynamics Modules: Classes for different formulations (e.g., Fluid2DFEM, Fluid3DFEM, variants with SUPG stabilization, Standard, Stokes, FIC formulations, etc.).
– Electromagnetic Analysis: FEM classes for electromagnetic waveguide problems, Helmholtz equations, photonic crystal simulations, etc.
– Other Problem Types: Additional modules for Poisson, Diffusion, Advection-Diffusion equations, and eddy current analysis.
• Solver Subsystem:
– Linear algebra solvers (files in “Linear” such as Linear.DoubleSparseMatrix, EquationSolver implementations, and LAPACK wrappers).
– Interfaces to third-party libraries.
• Utility and Infrastructure Components:
– Supporting classes for integration (IntegrationPoints.cs), file serialization (Serializer.cs), and general drawing (IDrawer, IFieldDrawer, etc.).
– External dependency note: OpenTK.GLControl is required for parts of visualization and rendering.
Relationships and Interactions
• The client application (WPF) will call into the IvyFEM DLL.
• Within the library, the FEWorld component acts as the orchestrator: it pulls together CAD data, passes it to the meshing components, then triggers the FE assembly via FEM-related classes.
• The assembled matrices and system equations are solved by the Solver Subsystem, which makes use of Linear algebra components (custom solvers or LAPACKE/Lis-based ones).
• Post-solution, result data are passed to result/visualization components (ColorMap, ColorLegend, various Drawer classes) that are likely rendered by the UI.
• Each physics module (elastic, fluid, electromagnetic) uses common core components (mesh, solver, CAD) and then applies its own specific formulation.
Architectural Patterns/Design Principles
• Modular and layered design – the project is organized by clear separation of concerns (geometry vs. meshing vs. assembly vs. solving vs. visualization).
• Object-oriented design with many specialized classes that implement various FEM formulations.
• Extensible interfaces (such as IColorMap, IDrawer, IEquationSolver) encourage the introduction of new simulation types or solver methods with minimal disruption.
Elements
• Clear component labels: For example, “CAD & Geometry Handling (Cad2D/Cad3D, CadUtils)”, “Mesh Generation (Mesher2D/Mesher3D, MeshPoint, …)”, “FEM Assembly (FE, FEWorld)”, “Solver Subsystem (Linear, LAPACK wrappers, Lis solvers)”, “Simulation Modules – Elasticity / Fluid / EM”, and “Visualization Helpers (Drawer classes, ColorMap).”
• Notation for external dependencies: Show the dependency to OpenTK.GLControl for rendering and the use of third-party libraries for solver support.