# Questions tagged [fenics]

Questions about the finite element method software FEniCS and its subpackages (Dolfin, UFL, FFC).

96 questions
Filter by
Sorted by
Tagged with
656 views

### Basic Finite Element Method (FEM) question: assembly and re-assembly

I'm reading up on the Finite Element Method (Zienkiewicz's Book), so I understand better what I'm doing in FEniCS and COMSOL. Currently, I'm wondering about this: Using FEM to solve fluid flow ...
519 views

### PETSc Krylov Subspace and nullspace

How is the nullspace correction implemented in the PETSc conjugate gradient solver? I searched the source code and documentation, but could not find references on the actual implementation. For ...
1k views

1k views

### defining subdomains in FEniCS (Python) using obtained (solved) variable [closed]

I'd very much appreciate if you could help me out with this as I think I'm missing something simple out or should be using alternate syntax: I am running the following Python code in FEniCS, where I ...
1k views

### Subdomain Integrals in Fenics

I'd like to compute $u(y) = \int f(x,y) dx$, but don't see a really efficient way to do this in FEniCS. My first thought was to just assemble(f*v*dx) for two different meshes. (try1, below), but it ...
109 views

### Quantification of non-stationarity of PDE solution

Suppose I have a time-dependent PDE discretized by the Rothe method and FEM, like $$\int_{\Omega} k^{n+1/2}(u^{n+1}-u^{n}) v \;\mathrm{d}x = F^{n+1/2}(u^{n+1},u^n)[v] \quad \forall v\in V_h^n.$$ ...
543 views

### Implementation of a contraction force in Fenics

Is there any way to implement an element wise contraction force (i.e., a force which causes the FEs themselves to contract onto themselves)? For example this would happen when something dehydrates. ...
2k views

### FEniCS: importing mesh along with material and boundary data

Which is the preferred way to import into a FEniCS (python) program a mesh which was generated in an external generator which provides sub-domain and boundary markers? I was using MeshData->...
2k views

### FEniCS CFD work-flow for complex geometries

I have COMSOL and the CFD package therein available, which provides me with an all-in-one solution for solving CFD problems. I have modeled and solved the geometry shown in the pictures below, which ...
141 views

### Assembling FE tensors using different quadrature degrees

Assume we have few terms contributing to element tensor and each requires different quadrature degree to be integrated exactly. Does it generally worth using different quadrature degrees for each term ...
975 views

### Flux across a non-boundary line segment in FEniCS

I am solving an elliptic boundary value problem on a subset of the rectangle [-1,1]x[-1,1]. The domain contains the line segment x=0, however this does not need to be a part of the boundary, so it is ...
2k views

### FeniCS: Visualizing high order elements

I've just started messing around with FEniCS. I am solving Poisson with 3rd order elements and would like to visualize the results. However, when I use plot(u), the visualization is just a linear ...
387 views

### Mixed FEM vector indices of pressure and velocity in FEniCS

Looking at the stokes-iterative demo of FEniCS, after solving the linear system using U = Function(W) solver.solve(U.vector(), bb) the solution ...
663 views

### Stochastic Galerkin projection approach for using generalized polynomial chaos expansion (GPCE) in solving PDE

I want to know if there is any way to define the test and trial function in the way that I want instead of using the default functions. So if I want define the polynomial and basis and coefficient, ...
165 views

### Speed up DG FunctionSpace evalutation [closed]

today I tried some evaluation on a DG function space (Fenics 1.2.0). In my calculations I need to use meshes with a large number of cells (~10mio). At the moment it takes a very long time to create a ...
1k views

### How can I build a mesh with holes for use in FEniCS?

This is my first time using FEniCS. I am trying to solve an elliptic PDE, fairly similar to the Laplace equation, on a rectangle with two holes in it. The holes are level sets of an energy function, ...
3k views

7k views

### Fenics: msh to xml conversion

I generated a mesh file in gambit and wanted to convert it to xml format. I tried the code below, but there is no output. ...
438 views

### 2d-mini element-can't use sub(0),but bubble element is ok

My program (in Python, using FEniCS): ...
515 views

### Fenics: time-independent Sine-Gordon equation

Is there a code for the equation $$\frac{\partial^2u}{\partial x^2}+\frac{\partial^2u}{\partial y^2} = \sin(u)$$ or for the sine gordon equation in two dimensions because I want to change some ...
4k views

### Fenics: Meshfunction usage

I am confused most of the time with the application of boundary conditions in Fenics. Suppose I have an xml mesh for a rectangular beam and want to apply Dirichlet BC ($u =0$) on the left side of the ...
740 views

### How to apply periodic boundary conditions to a Raviart-Thomas finite element space in Fenics? [closed]

I'm trying to use periodic boundary conditions within a Raviart-Thomas finite element space in Fenics (dolfin 1.2.0) in a Ubuntu 12.04 (amd64) machine (with python 2.7). If other FE space is used, ...
661 views

### Fenics : boundary condition

`I am working on a problem found here " http://www.caesarsystems.co.uk/NAFEMS_benchmarks/le10.html" ..I am really confused about the boundary conditions and tried my level best to compute it but ...
859 views

### Fenics : Elementwise stress computation

In a elastodynamics problem, I define the stress as def sigma(v): return 2.0*mu*sym(grad(v)) + lmbda*tr(sym(grad(v)))*Identity(v.cell().d) I have computed ...
483 views

### Fenics : looking forward to compute displacements at nodes

I just went through the Fenics book to get the nodal displacements and tried this code .... ...
331 views

### Fenics: problem with the mesh generation

while executing my script i get this error Traceback (most recent call last): File "/media/oss/Fenics/demo/box_3delasticity.py", line 33, in mesh = Box (0, 0, 0, 1, 1, 1, 1, 1, 1) File "/usr/...
5k views

### Tutorial for flow around a cylinder in FEniCS

I am continuing my dive into computational fluid dynamics. I would like to build a simple test case for modelling the flow around a cylinder in FEniCS and then continue to model turbulence in order to ...
1k views

For the numerical integration of reaction terms in my PDE on a 2D triangular mesh, I would like to use the scheme $$\int_T \Phi(x) \approx \frac{|T|}{3} (\Phi(x_0) + \Phi(x_1) + \Phi(x_2))$$ where ...
481 views

### Poiseuille flow

I have probably a very stupid problem. I can't solve a simple Poiseuille flow in a straight 2-D channel driven by a pressure drop. Results are complete nonsense. (Setting zero pressure on the outflow ...
418 views

### Simple turbulence model appropriate for buoyancy-driven cavity like problem

Which turbulence model is suitable for resolving incompressible buoyancy-driven flow of a fluid within an cylindrical ampoule? I prefer turbulence model which is sufficiently simple so that fully ...
3k views

### Poisson equation: Impose full gradient as boundary condition via Lagrange multipliers

I have a physical problem governed by the Poisson equation in two dimensions $$-\nabla^2 u = f(x,y), \; in \; \Omega$$ I have measurements of the two gradient components $\partial{u}/\partial{x}$ ...
2k views

### Fenics, initialize vector of degrees of freedom for function

With the move away from launchpad I hope this is the right place for this question. Is there a way to initialize the DOFs for a function? generated by u = Function(V) When I run a code which I ...
951 views

### Compute lengths of the longest edge of each cell

Having mesh = UnitSquareMesh(2, 2) Q = FunctionSpace(mesh, 'DG', 0) this works as expected ...