FeenoX is a cloud-first
Unix stand-alone
program (i.e. something your run,
not something you have to link existing code against) that reads an engineering-related problem in a plain-text
file containing definitions and instructions. That is to say, it
reads the problem to be solved at run time and does not require the user
(most of the time these will be industry
engineers and not hackers nor
PhDs) to compile and link custom code in order to solve a problem
because it is not a library. It does not require the users to
write a weak form of the PDE they want to solve, because most of them
will not even know what a weak form is (and they certainly do not need
to know that). The user chooses from a set of built-in PDEs using the PROBLEM
definition which internally resolves (at run time) a set of function
pointers to the appropriate locations which will build the elemental
objects which correspond the to chosen PDE. The list of available PDEs
can be peeked by executing the feenox
binary with the
--pdes
option:
$ feenox --pdes
laplace
mechanical
modal
neutron_diffusion
neutron_sn
thermal
$
During the compilation procedure (based on Autotools), the source
tree in src/pdes
is parsed. For each subdirectory, a new PDE is embedded into the
compiled binary. See below for further details about this extensibility
mechanism.
This program then solves the problem and, eventually, writes the outputs which the input file requests with explicit instructions (and nothing if nothing is asked for) and returns back to the Unix shell:
# NAFEMS Benchmark LE-10: thick plate pressure
PROBLEM mechanical DIMENSIONS 3
READ_MESH nafems-le10.msh # mesh in millimeters
# LOADING: uniform normal pressure on the upper surface
BC upper p=1 # 1 Mpa
# BOUNDARY CONDITIONS:
BC DCD'C' v=0 # Face DCD'C' zero y-displacement
BC ABA'B' u=0 # Face ABA'B' zero x-displacement
BC BCB'C' u=0 v=0 # Face BCB'C' x and y displ. fixed
BC midplane w=0 # z displacements fixed along mid-plane
# MATERIAL PROPERTIES: isotropic single-material properties
E = 210e3 # Young modulus in MPa
nu = 0.3 # Poisson's ratio
SOLVE_PROBLEM # solve!
# print the direct stress y at D (and nothing more)
PRINT "σ_y @ D = " sigmay(2000,0,300) "MPa"
It can be seen as a Unix filter (or as a transfer function)
+------------+
mesh (*.msh) } | | { terminal
data (*.dat) } input ----> | FeenoX |----> output { data files
input (*.fee) } | | { post (vtk/msh)
+------------+
which, when zoomed in, acts as a “glue layer” between a mesher (Gmsh) and a library for solving large sparse problems (PETSc) which for linear elastic looks as follows:
Further discussion can be found in the tensile test tutorial. Check out the section about invocation in the FeenoX manual.
The design responds to a Software Requirements Specification document that acts as a “request for quotations” of a computational engineering tool that should satisfy some fictitious (but plausible) requirements. The Software Design Specification document explains how FeenoX addresses each requirement of the SRS.
In principle, even though FeenoX can solve generic numerical problems and systems of ordinary differential/algebraic equations, its main objective is to solve partial differential equations using the finite element method—eventually in parallel using the MPI standard. The current version can solve
Heads up! The background of FeenoX’s main author is Nuclear Engineering. Hence,
- Two of the supported PDEs are related to neutron diffusion and transport.
- There is a PhD thesis (in Spanish only) that discusses the design and implementation of FeenoX in view of core-level neutronics.
As mentioned in the previous section, FeenoX provides a mechanism
to add new types of PDEs by adding a new subdirectory to the src/pdes
directory
of the source tree and then re-bootstrapping, re-configuring and
re-compiling the code.
Since in FeenoX’s input file everything is an expression, the code is especially suited for verification using the method of manufactured solutions.
FeenoX tries to achieve its goals by…
standing on both ethical (since it is free) and technical (since it is open source) ground while interacting with other free and open specimens such as
leveraging the Unix programming philosophy to come up with a cloud-first tool suitable to be automatically deployed and serve as the back end of web-based interfaces (fig. ).
providing a ready-to-run program that reads an input file at run time (and not a library that has to be linked for each particular problem to be solved) as deliberate decision discussed in the Software Design Specification.
designing and implementing an extensibility mechanism to allow
hackers and/or academics to add new PDE formulations by adding a new
subdirectory to src/pdes
in the repository
and then
autogen.sh
,configure
, andmake
In effect, FeenoX provides a general mathematical framework to solve PDEs with a bunch of entry points (as C functions) where new types of PDEs (e.g. electromagnetism, fluid mechanics, etc.) can be added to the set of what FeenoX can solve. This general framework provides means to
parse the input file, handle command-line arguments, read mesh files, assign variables, evaluate conditionals, write results, etc.
PROBLEM laplace 2D
READ_MESH square-$1.msh
[...]WRITE_RESULTS FORMAT vtk
handle material properties given as algebraic expressions involving pointwise-defined functions of space, temperature, time, etc.
MATERIAL steel E=210e3*(1-1e-3*(T(x,y,z)-20)) nu=0.3
MATERIAL aluminum E=69e3 nu=7/25
read problem-specific boundary conditions as algebraic expressions
= 5.670374419e-8 # W m^2 / K^4 as in wikipedia
sigma = 0.98 # non-dimensional
e T0 = 1000 # K
= 300 # K
Tinf
BC left T=T0
BC right q=sigma*e*(Tinf^4-T(x,y,z)^4)
access shape functions and its derivatives evaluated either at Gauss points or at arbitrary locations for computing elementary contributions to
For example, this snippet would build the elemental stiffness matrix for the Laplace problem:
int build_laplace_Ki(element_t *e, unsigned int q) {
double wdet = feenox_fem_compute_w_det_at_gauss(e, q);
*B = feenox_fem_compute_B_at_gauss(e, q);
gsl_matrix (feenox_blas_BtB_accum(B, wdet, feenox.fem.Ki));
feenox_callreturn FEENOX_OK;
}
The calls for computing the weights and the matrices with the shape
functions and/or their derivatives currently support first and
second-order iso-geometric elements, but other element types can be
added as well.
More complex cases involving non-uniform material properties, volumetric
sources, etc. can be found in the actual source.
solve the discretized equations using the appropriate PETSc/SLEPc objects, i.e.
The particular functions that implement each problem type are located
in subdirectories src/pdes
,
namely
Researchers with both knowledge of mathematical theory of finite
elements and programming skills might, with the aid of the community,
add support for other PDES. They might do that by using one of these
directories (say laplace
)
as a template and
laplace
in symbol names
with the name of the new PDEinit.c
and set
bulk.c
in the FEM formulation of the problem being addedbc.c
autogen.sh
, ./configure
and
make
to get a FeenoX executable with support for the new
PDE.As we mentioned in FeenoX for hackers, Alan Kay’s says: “simple things should be simple and complex things should be possible.” Of course, the addition of non-trivial PDEs is not straightforward, but possible (at that time we were discussing the first half of the quote, now we refer to the second part). The programming guide contains further details about how to contribute to the code base.
The world is already full of finite-element programs, and every day a grad student creates a new one from scratch. So why adding FeenoX to the already-crowded space of FEA tools? Because there are either
FeenoX sits in the middle. It is the only free and open-source tool that satisfies the Software Requirements Specification, including that…
$1
,
$2
, etc., which allow parametric
or optimization
loops driven by higher-level scripts.msh
file that defines the domain where the PDE is
solvedSee FeenoX for hackers for another explanation about why FeenoX is different from other computational tools.