Architecture

FEMTISE.jl is organized in two layers on top of Gridap.jl, which provides meshes, finite element spaces, quadrature and assembly.

 input file (.dat) + potential (.jl)        interactive console
                 \                             /
                  ▼                           ▼
     ┌──────────────────────────────────────────────────┐
     │ DRIVER   run_default_eigen_problem               │   fixed, validated configuration
     │          set_type_potential, input_data          │   (1D/2D, P2 elements, Dirichlet)
     └──────────────────────────────────────────────────┘
                              │
     ┌──────────────────────────────────────────────────┐
     │ LOW-LEVEL INTERFACE (wraps Gridap)               │   full control
     │  make_model ─► measures ─► fe_spaces             │
     │      ─► bilineal_forms ─► eigen_problem ─► solve │
     └──────────────────────────────────────────────────┘
                              │
     ┌──────────────────────────────────────────────────┐
     │ POST-PROCESSING  norms, densities, moments,      │
     │                  entropies, mutual information   │
     │ OUTPUT           write_bin / JLD2 → collect_result_data │
     └──────────────────────────────────────────────────┘

From mathematics to code

Each object of the Theory has one function that builds it:

Mathematical objectFunctionReturns
Mesh $\mathcal T_h$make_model or Gridap.CartesianDiscreteModeldiscrete model
Boundary data (Dirichlet tags/values)make_boundary_conditionsvalues, tags
Domain $\Omega$, boundary $\Gamma$ and quadrature measures $d\Omega$, $d\Gamma$measuresΩ, dΩ, Γ, dΓ
Test and trial spaces $V_h$, $U_h$fe_spacesV, U
Forms $a(u,v)$, $b(u,v)$bilineal_formstwo Julia functions
Matrices $\mathbb A$, $\mathbb B$ and solver settingseigen_problemEigenProblem
Eigenpairs $(\varepsilon_n, u_{n,h})$solveeigenvalues, Vector{CellField}
All of the above in one calleigen_values_and_eigen_vectorseigenvalues, eigenfunctions

The eigenfunctions are Gridap CellFields: they can be evaluated at any point (ϕ[1](Point(0.3))), differentiated (∇(ϕ[1])) and integrated (sum(∫(ϕ[1]' * ϕ[1]) * dΩ)).

Source files

File (src/functions/)Content
mesh_generator_function.jlmake_model: Gmsh 1D lines and 2D rectangles, native Cartesian 2D meshes
boundary_conditions_function.jlmake_boundary_conditions: Dirichlet tags and values per mesh type
miscellaneous_functions.jlmeasures, fe_spaces, bilineal_forms, space_coord
eigen_problem_definition_function.jlEigenOperator, EigenProblem, eigen_problem, solve
eigen_problem_solve_function.jleigen_values_and_eigen_vectors
useful_functions_for_FEM_objects.jlpost-processing (norms, densities, entropies, moments)
default_running_structures.jlParams1D, Params2D, AnalysisParam, InputData*
default_running_input_data.jlinput_data: parser of the input file
default_running_miscellaneous_functions.jldriver solvers, built-in potentials, console prompts
default_eigen_problem.jlrun_default_eigen_problem, set_type_potential, writing of outputs
binary_file_io.jlwrite_bin, read_bin
post_proccesing_data_structures.jl, post_proccesing_data_function.jlresult containers and collect_result_data

Configuration of the driver

The driver fixes the following choices. To change any of them, use the low-level interface.

SettingValue
ElementsLagrange, degree $\ell = 2$, complex-valued spaces (ComplexF64)
Boundary conditionhomogeneous Dirichlet on the whole boundary
1D meshGmsh segment with element size Δx on $(-L/2, L/2)$ or $(0, L)$
2D meshCartesian $n_x\times n_y$ quadrilaterals on a rectangle
Quadrature degree$k_q = 3$
ARPACKtolerance $10^{-8}$, at most 500 restarts (1500 for 1D sweeps), which = :LM, shift sigma from the input
Unitsatomic units, $p = 1/2$ (electron mass)

Design notes

  • Coefficient functions are plain Julia functions. They are compiled and inlined into the assembly loops, so a user-defined potential is as fast as a built-in one.
  • Potentials loaded by the driver are included inside the FEMTISE module. Functions of SpecialFunctions (e.g. erfc) are available there.
  • Parameter sweeps build the mesh once; for each value only the matrices and the factorization are recomputed.