Contents
How are subdomains used to solve PDEs in FEniCS?
Solving PDEs in domains made up of different materials is a frequently encountered task. In FEniCS, these kinds of problems are handled by defining subdomains inside the domain. A simple example with two materials (subdomains) in 2D will demonstrate the idea.
Can a nonlinear problem be solved in FEniCS?
We will see that nonlinear problems can be solved just as easily as linear problems in FEniCS, by simply defining a nonlinear variational problem and calling the solve function. When doing so, we will encounter a subtle difference in how the variational problem is defined.
Which is the best method to define a function in FEniCS?
The eval method gives great flexibility in defining functions, but a downside is that FEniCS will call eval in Python for each node x , which is a slow process. An alternative method is to use a C++ string expression as we have seen before, which is much more efficient in FEniCS.
How to solve the PDE problem in Python?
PDE problem. As a model problem for the solution of nonlinear PDEs, we take the following nonlinear Poisson equation: − ∇ ⋅ (q(u)∇u) = f, in Ω , with u = u D on the boundary ∂Ω . The coefficient q = q(u) makes the equation nonlinear (unless q(u) is constant in u ).
How to define finite element subdomains in Python?
I am running the following Python code in FEniCS, where I solve for a variable – the solution looking as I expect it to, so no problems there, now I wish to solve a next equation and I need to define the subdomains according to the obtained solution, but the resultant plot of subdomains for the new problem (in the same code) is erroneous.
How are boundary conditions related to subdomains in FEniCS?
This boundary definition is actually a shortcut to the more general FEniCS concept SubDomain. A SubDomain is a class which defines a region in space (a subdomain) in terms of a member function inside which returns True for points that belong to the subdomain and False for points that don’t belong to the subdomain.
Can a solution variable be used in a subdomain?
It looks as if it cannot take the solution variable as a legitimate parameter appearing in the subdomain definitions; perhaps I need to change/avoid the inside method?