I needed to perform a numerical integral of a function I knew very little about. I tried to get decent resolution by having small slices in my integration.

Python was pretty slow to perform the integration, so I thought I'd have a look at writing it in c++. I haven't used c++ for ages, but eventually I got it working.

I then needed to plot the result of my integration against measured data, so I wanted access to my c++ functions in python, where I do my plotting.

Finally got my c++ functions imported into python using PyBind11 and I must say, it works amazingly well, I think it's well documented and the examples were great. Vectorising my functions so that I can run them for a whole numpy array of values was genuinely super-easy. I'm very impressed! Thanks to all the devs =]

My latest post is about using boundary conditions to assume symmetry in a finite element electrostatics problem.

To demonstrate Neumann boundaries I solve the Laplace equation for a coaxial geometry using 1/4 of the cross section. I then find the fields of a differential pair transmission line using half the cross section and a Dirichlet boundary.

This is all done with FEniCS, the open source finite element solver. #physics #python #opensource #ham #radioβ #fenics

https://comphysblog.wordpress.com/2019/07/15/assuming-symmetry-with-boundary-conditions/ββ

Here's the electric potential and field overlaid for a uniform cylindrical charge distribution created using FEniCS, an opensource finite element solver. Although this is a simple analytical problem, this technique can be used for much more complicated geometries.

Next up: linear dielectrics, I've tested in both 2D and 3D and I'm ready to write it up =] surprisingly easy!

After a couple of months without a new post I've started writing about simulating charge distributions, rather than just boundary value problems. I'll explain how #FEniCS can calculate the electrostatic fields of arbitrarily shaped charge densities, which are specified with mesh subdomains. These will have hard edges for now but I want to look into having more general charge distributions.

I've also run 3D simulations for calculating capacitances between arbitrarily shaped conductors and 2D linear dielectrics. I need to do some more testing & comparison with other FEA tools/ analytical methods before I publish any posts. Seems to be going well though!

I was reading the help files of a well-known commercial microwave FEA package and it suggested calculating characteristic impedance from the power and voltage rather than finding the current directly.

This way doesn't require surface normals or line integrals which my previous methods did, so it's probably better (easier to do anyway). I've added this into my TEM mode post - https://comphysblog.wordpress.com/2018/09/06/tem-mode-analysis-with-fenics/

@aparrish always happy to try and help with maths :)

Small update to the TEM mode analysis with #FEniCS example.

I've added in a calculation for the mutual capacitance and self-inductance per unit length of the transmission line.

https://comphysblog.wordpress.com/2018/09/06/tem-mode-analysis-with-fenics/

I've just finished my new post: TEM mode analysis with #FEniCS an #opensource finite element differential equation solver. https://comphysblog.wordpress.com/2018/09/06/tem-mode-analysis-with-fenics/

In this post I calculate the electric and magnetic fields on a coaxial cable, characteristic impedance of the line, the Poynting vector, the conductor and dielectric loss, an estimated loss coefficient, Q-factor and s-parameter for a given length of cable.

Coax has been a useful example for comparisons with analytical results but the methods are very general. TEM modes of systems with different geometries can also be analysed with the exact same techniques!

Very happy to hear any comments, corrections or suggestions.

This blog is dedicated to physics and computing, with a current focus on solving electromagnetic problems using open source tools.

I work in particle beam diagnostics and am a PhD student studying the interaction of particle beams with their surroundings as well as the associated dynamics.

I'm Interested in anything related to particle accelerators, beam dynamics, detectors, electromagnetism and computing for science. I also enjoy tennis, fountain pens, fantasy & sci-fi books and board games.

Joined Aug 2018