Questions tagged [fenics]

FEniCS is an open-source platform for solving partial differential equations .

FEniCS enables users to translate scientific models into finite element code through high-level Python and C++ interfaces.

Resources:

64 questions
1
vote
0 answers

How to use FEniCS in Spyder with Python 3.8?

I am quite new to python and only did smaller projects so far. For a new project I would like to use FEniCS for solving PDEs. I am working with Windows 10 and already successfully installed Ubuntu (I still do not entirely understand what Ubunutu is…
Airwaves12
  • 11
  • 2
1
vote
1 answer

AttributeError: 'Function' object has no attribute 'block_variable'

I have written a subclass of torch_fenics. In this, the input is a vector from DG space. I use this input in the weak formulation and then calculate the solution. Further, I need the gradient of the solution with respect to the given input. I get…
1
vote
0 answers

Complex number in Fenics

I am currently trying to solve a complex-valued PDE with Fenics in a jupyter notebook but I am having trouble when I try to use a complex number in Fenics. Here is how I've defined the variational problem: u = TrialFunction(V) v = TestFunction(V) a…
tdvx
  • 11
  • 1
1
vote
0 answers

Calling Python from C++, how to link particular Anaconda enviroment?

I am trying to embed Python into C++ following this guide here: https://docs.python.org/3.7/extending/embedding.html This works very well for an older system-wide Python 2.7 installation. I am now trying to do the same using a particular Anaconda…
Peter Meisrimel
  • 392
  • 2
  • 10
1
vote
0 answers

Fenics - as_tensor Error: ufl.log.UFLException: Component and shape length don't match

I am trying to build a Finite Element Analysis simulation in python using Fenics, all of which I am fairly new to. I have some tensors setup as shown below: i = indices(3) G = as_tensor(T.dx(i), (i)) G0 = as_tensor(T0.dx(i), (i)) q =…
tjsmert44
  • 121
  • 1
  • 12
1
vote
1 answer

Colab cannot find an installed a package

I'm trying to install a package called fenics in Google Colab. I tried both: !pip install fenics >> fenics in /usr/local/lib/python3.6/dist-packages (2019.1.0) and !apt-get install fenics Then a simple import fenics raises ModuleNotFoundError.…
Tarifazo
  • 4,118
  • 1
  • 9
  • 22
1
vote
2 answers

How to work around the name 'nabla_div' is not defined error in Fenics Example ft06_elasticity.py?

I installed Fenics using Conda on Ubuntu 18.04, and receive the following error while running their ft06_elasticity.py example. I have tried to find a solution or workaround to this in the documentation, but I cannot even find a nabla_div() function…
avgJoe
  • 832
  • 7
  • 24
1
vote
2 answers

Running FEniCS with in Jupyter Notebook

I've installed FEniCS for Anaconda using conda-forge as explained on this page using the following command: conda create -n fenicsproject -c conda-forge fenics I then activate it: source activate fenicsproject If I then run python directly and…
Charles
  • 238
  • 3
  • 13
1
vote
3 answers

Create single mesh for multiple bodies in GMSH

I am currently trying to do a magnetostatic FEM simulation and I want to mesh my geometry using GMSH. The geometry is shown below: in I create the geometry using FreeCAD and import into GMSH as a .STEP File. In GMSH I define 3 physical groups,…
Mantabit
  • 269
  • 1
  • 4
  • 14
1
vote
0 answers

Can't view FEniCS figure at http://127.0.0.1:8000

I just started to use FEniCS with Python. I am using Docker and a FEniCS enabled terminal to run the programs. It works well to run programs in this way but I cannot access the figures. According to the terminal: "To view figure, visit…
Vierni
  • 11
  • 5
1
vote
1 answer

Fenics subdomain indicator in mesh file

In the Fenics documentation, it is mentionned that DirichletBC takes three arguments, the first one is our function space V, the next is the boundary condition value and the third is the subdomain indicator which is information stored in the…
usernumber
  • 1,958
  • 1
  • 21
  • 58
1
vote
0 answers

Parallel fenics: partitioned mesh and dof-vertex-map

I am writing a heat equation for a cube by fenics. The material will be changed during the time which is handled by a function(let say function_k) to update the property. The code is OK and now I want to parallel it. Everything is fine but the…
1
vote
1 answer

convert a dolfin::matrix in a eigen::matrix

I'm coding in c++ and i'm using FEniCS  fenics/2016.1.0. A part of my code is Matrix A; Vector f; std::vector> dirichlet_matrici({dirichlet}); assemble_system(A,f,a,L,dirichlet_matrici); solve(A, *(u.vector()),…
GregL
  • 11
  • 1
0
votes
1 answer

Spyder and IPython (Anaconda) not opening the correct environment in Ubuntu

I have Anaconda installed in Ubuntu (followed the instructions on the Anaconda site: https://docs.anaconda.com/free/anaconda/install/linux/) and I am trying to import the fenics module in Spyder. While I am able to import fenics from the terminal,…
user279043
  • 111
  • 1
0
votes
0 answers

Xming with WSL 2 ubuntu

I have installed Ubuntu-22.04 in wsl version 2. Later I have installed fenicsx and paraview. I have launched xming. If in the terminal I run paraview, I am capable of getting the user gui. But if I run the first tutorial of fenicsx…
Daniel
  • 27
  • 2
  • 7