Coupling FEM physical model to complex circuits

Hi,

I have implemented a multi-physical thermoelectric model in fenics, and I need to couple the Fenics FEM model to circuits. Currently being able to couple the FEM model with a simple resistor by considering the resistor equation as the boundary condition.
Am still struggling to couple the current FEM model to more complex circuits involving diodes, capacitors, and inductors in general. Is there a way where I can couple my FEM model to the more complex circuits or couple the Fenics-based FEM model to the external circuit software like SPICE or LTSPICE?
I Would really appreciate it if any know has any idea in regard to the above problem. Looking for suggestions.

I do a similar type of coupling of 3D mechanics to resistance/compliance/inertance models (that represent 0D flow). These 0D models are written in Python using Simpy and assembled into Petsc vecs and mats, glued together in a monolithic system with dolfinx.
Feel free to check out my code (open source) at GitHub - marchirschvogel/ambit or contact me if you need further ideas on this.
Best,
Marc

Hi Marc,

Thank you so much for sharing the GitHub link. I went through your code but I am not able to understand it completely.

It will be really helpful if you share me a simple code where you connect simple mechanical model to a resistor in dolfinx.

It will also be appreciated if you have any other materials to share with me.

Regards,
Gunasheela

Hi Marc,

To be specific can you share a python script which implements 3D cantilever bar with resistor attached at other end. I wanted to know how the coupling of resistor is done with the 3 D mechanical FEM model.

It will be really helpful.

Regards,
Gunasheela

Hi Gunasheela,

So the (my) idea of a resistor (R) in the context of mechanics would be something that links / is proportional to a flux q over a boundary, returning a pressure p, according to p = R q (or, if you add an inductor L, p=R q + L dq/dt). In solid mechanics, q can be written as
q = J*ufl.dot(ufl.dot(ufl.inv(F).T, n0), v)*ds, with F the deformation gradient, J its determinant, v the velocity, and n0 the reference outward normal. In (Eulerian) fluid mechanics, you’d simply have q = ufl.dot(v, n)*ds.

I would have to look if I can dig up a script that has all in it, but I’m afraid that I don’t have one anymore… If you run the testcase “solid_flow0d_monolithicdirect_4elwindkesselLsZ_chamber.py” from my code (in folder testing/), you have a simple solid mechanics chamber that links to a 4-element Windkessel, which has besides R and L also a compliance (capacitance) element. The circuit model is implemented in the modules/flow0d/ folder.

The necessary forms are assembled in modules/coupling/solid_flow0d.py and the monolithic system is solved in modules/solver/solver_nonlin.py (class solver_nonlinear_constraint_monolithic). Here I assemble a monolithic matrix system [K_solid,solid K_solid,circuit \ K_circuit,solid K_circuit,circuit] that solves simultaneously for the solid and the circuit, but there are different ways to couple the problem, too. So maybe you can work yourself through the components that are needed you might find what you need.

Best,
Marc

1 Like

Hello,
Are you trying to model electromagnetic fields along with thermal effects? If you are only using a circuit model for the resistor, there is no need for complicated boundary conditions. Treat the circuit element as a heat source. If you want EM field solutions, it becomes a bit more complicated. Let me know how you are treating this problem and the I will see if I can help you.