# DigiMat Pro

The examples of Model Workshop all start from a mathematical model in the form of a differential equation, which is transformed by a process of discretisation, where derivatives are replaced by difference quotients into a system of algebraic equations in a finite number of variables. In a next step the system is expressed in computer code including a solution process, typically some form of time-stepping, which when executed by a computer solves the system of equations and produces a solution to the differential equation.

The key steps are thus:

1. Formulate Model as a differential equation DE.
2. Transform DE by replacing derivatives by difference quotients on a mesh into a finite system of algebraic equations in a process of discretisation.
3. Express the system of equations in computer code including a solution process.
4. Let a computer execute the code and thereby produce an approximate solution to the DE = a simulation.

Model Workshop connects to FEniCS and FEniCS-HPC as a computer code or compiler, which translates any given differential equation directly into computer code. FEniCS thus takes us from 1. directly  to  4. by automating the discretisation in steps 2. and 3. See University Syllabus under Syllabus. Compare with Automation.

Test online CMU-OLI course.

Watch this key example: Simulation of the airflow around a jumbojet in landing from first principle Newtonian mechanics automatically translated to computer code by FEniCS:

FEniCS makes it possible to fill the mantra of DigiMat of model-simulate-explore-understand-control the World with true meaning.  FEniCS is the first software of automated mathematical modeling. The development of FEniCS is closely connected to that of DigiMat.

More precisely the input to FEniCS is a differential equation expressed in variational form according to the Finite Element Method FEM. See Basic Example and Basic FEM in 1d.

The main task is then reduced to create models of the World as differential equations in variational form as input to FEniCS, which delivers output as approximate solutions for given data in the model.

Model Workshop and Key PDE Models contains a list of models in the form of differential equations covering many areas of the Real World including

• Newtonian mechanics of mass-spring systems
• fluid and solid mechanics including coupled fluid-structure mechanics
• wave propagation in solids and fluids
• reaction-convection-diffusion
• atom physics
• cosmology
• biology and medicine
• economy

as well as areas of the Digital World including

• image and sound representation
• AI.

With a basis from the rich code-collection in Model Workshop, DigiMat Pro/FEniCS opens already for a pre-university student a wide world of simulation  based on Calculus, and then not simply as a black-box, since the essence of a model is already familiar from simple implementation. DigiMat Pro also invites to plunge into the technicalities of FEniCS for further development.

The concept of DigiMat School + FEniCS thus opens a new avenue for school mathematics.

#### Introductory Example of Variational Formulation

Recall Basic FEM in 1d.

Consider the differential equation/boundary value problem: Find a function $u(x)$ defined on the interval $I=[0,1]$ satisfying

• $-\frac{d^2u}{dx^2} = f(x)$ for $x\in I$,
• $u(0) = u(1) = 0$,

where $f(x)$ is a given function defined on I. A variational formulation is obtained by multiplying the differential equation $-\frac{d^2u}{dx^2} = f(x)$ by an arbitrary test function $v(x)$ and integrating over I to first get

• $-\int_0^1\frac{d^2u}{dx^2}v(x)\, dx =\int_0^1f(x)v(x)\,dx$

and then using that by integrations by parts assuming $v(1)=v(0)=0$

• $-\int_0^1\frac{d^2u}{dx^2}v(x)\, dx = \int_0^1 \frac{du}{dx}\frac{dv}{dx}\, dx$,

to finally get that for any test function $v(x)$ satisfying $v(0)=v(1)=0$

• $\int_0^1 \frac{du}{dx}\frac{dv}{dx}\, dx = \int_0^1 f(x)v(x)\,dx$ (1)

A variational formulation is then obtained by forming a set of functions V (satisfying the boundary conditions) of finite dimension, for example  continuous piecewise linear functions on a mesh, from which the solution $u(x)$ is sought as satisfying (1) for all test functions $v(x)$ in the set of functions V. The variational formulation thus reads:

• Find $u\in V$ such that (1) for all $v\in V$.

This corresponds to a linear set of equations with as many unknowns as equations as the result of discretisation by the finite element method, which is automatically translated to computer code by FEniCS to be executed by a computer to deliver the solution.

An introduction to discretisation by the finite element method is given in World of Finite Elements.

All the examples of Model Workshop invite to variational formulation as input to FEniCS into simulation tools for exploration/prediction/control of the World. Accept the invitation!

DigiMat Pro thus shows how to formulate models of the World as differential equations in variational form as input to FEniCS for automated computation.  The World is open to exploration!

If one is interested in the relations between fields which, according to customary academic divisions, belong to different departments, then he will not be welcomed as a builder of bridges, as he might have expected, but will rather be regarded by both sides as an outsider and troublesome intruder. (Rudolf Carnarp)