# Fenics error when using space derivative (coupled physics)

4 messages
Open this post in threaded view
|

## Fenics error when using space derivative (coupled physics)

 Hi everyone, I want to use FEATool to simulate Joule heating (resistive heating) of 3D structures. The procedure similar to the tutorial (https://www.featool.com/doc/Multiphysics_01_resistive_heating1) works quite well. Here we introduce a heat term corresponding to the gradient of the electric field (step 29 of the tutorial). However, when I try to solve this using the Fenics solver it returns an error: NameError: name 'Vx' is not defined. Did you mean: 'dx'? How can I change the syntax to tell the Fenics solver to use the actual derivative of the electric field? Do I also have to solve this iteratively (first electric field, then heat)? PS.: when changing the script in the Fenics GUI and deleting the Vx, Vy, and Vz the solver converges and gives a solution (not the correct one obviously). Thank you very much in advance. I would be very grateful for all the help concerning the Fenics solver as well as combining multiple physics in FEATool.
Open this post in threaded view
|

## Re: Fenics error when using space derivative (coupled physics)

 Administrator Hi Alex, AlexBauer wrote NameError: name 'Vx' is not defined. Did you mean: 'dx'? How can I change the syntax to tell the Fenics solver to use the actual derivative of the electric field? Do I also have to solve this iteratively (first electric field, then heat)? In this case it seems to be an error converting FEATool to FEniCS syntax for the source term, if you replace the line in the FEniCS Python script:  q_ht_0 = 1.0/52.8e-9*(Vx**2.0+Vy**2.0+Vz**2.0) with  q_ht_0 = 1.0/52.8e-9*(dv_V.dx(0)**2.0+dv_V.dx(1)**2.0+dv_V.dx(2)**2.0) it should probably work. ("V" is prefixed"dv_V" for 'dependent variable V' so as not to collide with the internal FEniCS name for the function space V, and space derivative is postfixed with ".dx(i)" instead of "x_i" as in the FEATool syntax). AlexBauer wrote PS.: when changing the script in the Fenics GUI and deleting the Vx, Vy, and Vz the solver converges and gives a solution (not the correct one obviously). Yes, if all "Vx_i" are removed from the source term, it will be zero, not contribute anything, and hence null result.