Fenics error when using space derivative (coupled physics)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fenics error when using space derivative (coupled physics)

AlexBauer
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.
Reply | Threaded
Open this post in threaded view
|

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

Precise Simulation
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.
Reply | Threaded
Open this post in threaded view
|

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

AlexBauer
Thank you very much for your help.

I have one more question though:
Does Fenics solve the electric field and heat equation in parallel or does it apply the same trick as described in the tutorial on Joule heating, where we solve the electric field first and then use this solution for the heat equation as an initial solution?

Thank you very much.
Reply | Threaded
Open this post in threaded view
|

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

Precise Simulation
Administrator
AlexBauer wrote
Does Fenics solve the electric field and heat equation in parallel or does it apply the same trick as described in the tutorial on Joule heating, where we solve the electric field first and then use this solution for the heat equation as an initial solution?
The FEniCS script resulting from conversion from FEATool is currently set up to solve everything fully coupled, and not sequentially as in the tutorial. FEniCS can of course also be set up to solve things sequentially as in the tutorial example, but as it is now you would have to manually change the script to support this.