OpenEMS: https://www.opensourceimaging.org/project/open-ems-a-free-and-open-electromagnetic-field-solver/
Github pcbmodelgen - convert Kicad to OpenEMS: https://github.com/jcyrax/pcbmodelgen
So in theory it should be possible to take a Kicad model and then convert it into OpenEMS to run an electrical field model.
Has anyone tried this - DC or specific frequency analysis?
It looks like you can set the start and end frequencies but I'm not sure if it will follow the line of least impedance but then start moving to direct path for DC.
Github pcbmodelgen - convert Kicad to OpenEMS: https://github.com/jcyrax/pcbmodelgen
So in theory it should be possible to take a Kicad model and then convert it into OpenEMS to run an electrical field model.
Has anyone tried this - DC or specific frequency analysis?
Code:
% Setup FDTD parameter & excitation function
% frequency range of interest
f_start = 1e9;
f_stop = 4e9;
f0 = 0.5 * (f_start + f_stop);
fc = f_stop - f0;
It looks like you can set the start and end frequencies but I'm not sure if it will follow the line of least impedance but then start moving to direct path for DC.
Last edited:
Let's see how this comes out... I can see the test PCB (a microstrip) so now.. the wait for the sim to complete after which I assume it will give me a render..
This is very impressive - good job!
How easy is this to get specific information out relevant to a design problem? What are the outputs it gives you?
How easy is this to get specific information out relevant to a design problem? What are the outputs it gives you?
As this is VTK etc then ParaView is an option. I've used paraview for FOAM (modelling of my pond thermal water flow). However there's only the mesh and it seems that the simulation hasn't been setup to be a parameter that paraview can show over time. Although openems can output this so I suspect this is simply a configuration parameter.
This is very impressive - good job!
How easy is this to get specific information out relevant to a design problem? What are the outputs it gives you?
That needs some more research. In theory OpenEMS is very much like many other tools that use VTK etc (ie FOAM) but I need more time to figure out what actually it can do.
That's RF, so the next step is getting that working with a simple PCB - using ports to output (mimic) output from the components through the PCB traces etc.
Ok I have current densities that animate. There's a range of properties, basically you can add boxes into the simulation script that then export the field data. Load paraview and the data 'group' (set) can be added over the top of the the PCB. here you can see I've got arrows showing large current: These can be scaled and filtered etc. There's probably a contour filter that shows this better as a heat map.
This is better - this is what I'm starting to get something closer to what I want:
You can see the strip in the centre and the field effect on the ground plane, the current and the return. I think the other flux is caused by the reflection.
You can see the strip in the centre and the field effect on the ground plane, the current and the return. I think the other flux is caused by the reflection.
This is very impressive - good job!
How easy is this to get specific information out relevant to a design problem? What are the outputs it gives you?
This is from the legacy wiki, I suspect there's more but it's a hunt to find.
- DumpType:
- 0: for E-field time-domain dump (default)
- 1: for H-field time-domain dump
- 2: for electric current time-domain dump
- 3: for total current density (rot(H)) time-domain dump
- 10: for E-field frequency-domain dump
- 11: for H-field frequency-domain dump
- 12: for electric current frequency-domain dump
- 13: for total current density (rot(H)) frequency-domain dump
- 20: local SAR frequency-domain dump
- 21: 1g averaging SAR frequency-domain dump
- 22: 10g averaging SAR frequency-domain dump
- 29: raw data needed for SAR calculations (electric field FD, cell volume, conductivity and density)
Then in theory, if I calculate the current through each “port” ie i/o pin then use that with a frequency spread akin to a squarewave at 24Mhz then it should provide an e-field that could highlight issues on the board.
I think it sees ports in/out as voltage difference causing dI/dt but i think it would be good enough to show the RF noise and possibly deviation from the expected current or reflections.
Last edited:
I had a quick look at the kicad APIs. In c++ each of the kicad systems are accessible. So it should be possible to use tie the PCB locations to to the footprints. That way it should be possible to (a) define input and output power pins, (b) input/output signal pins and (c) either selected specific/group/all components to model.
The way this would work is - each footprint will have a physical touch point on the PCB (tracks or not). Each pin of the footprint has the drop down telling it what type of pin it is (input power, output signal for example). A port for each pin can then be created depending in if the port direction. If it's output then an excitation can be added with output impedance, if it's input an impedance can be configured.
That way you'd end up with set of ports across the PCB which would then simulate. Next would be if the mesh system can cope with the intricate ground pours - it seems it copes with vias which is good. I'm not sure if it understands THT components.
I think the best way to simulate is to take the frequency-domain E-field, electric current as slices across the PCB (reduces storage) and then make a colour map on the surface of the box. This would show outbound and return current fields nicely.
For multi-layer PCBs the dump boxes can be created for each layer of the PCB in the precise way the stackup is designed. The only issue I can see is the complexity will increase (from a ports and excitation perspective).
The way this would work is - each footprint will have a physical touch point on the PCB (tracks or not). Each pin of the footprint has the drop down telling it what type of pin it is (input power, output signal for example). A port for each pin can then be created depending in if the port direction. If it's output then an excitation can be added with output impedance, if it's input an impedance can be configured.
That way you'd end up with set of ports across the PCB which would then simulate. Next would be if the mesh system can cope with the intricate ground pours - it seems it copes with vias which is good. I'm not sure if it understands THT components.
I think the best way to simulate is to take the frequency-domain E-field, electric current as slices across the PCB (reduces storage) and then make a colour map on the surface of the box. This would show outbound and return current fields nicely.
For multi-layer PCBs the dump boxes can be created for each layer of the PCB in the precise way the stackup is designed. The only issue I can see is the complexity will increase (from a ports and excitation perspective).
Yes that would be great to be able to plot current flow like that in a ground plane/tracks.This is what it should be capable of doing (note this is 3D thermodynamic modelling with FOAM):
View attachment 1150224
So I'm hoping the same style of output can be used to show RF EMI etc on a circuit board.
Oh there is more! I wrote the last message before reading even thing. I’m going to be following this closely. I’d really like to be able to do simulation like this.
How long does it take to run?
How long does it take to run?
The simple test PCB only takes a few minutes (in a 16GB 4 CPU VM), the host is a 32GB i7 2018 Mac mini (6core+HT).
I will try with my clock board (more complex) and see if I can get a example running with just a single port.
I had a look at the kicad pub file - it has all the footprint pads within it, so in theory that should be easy to make a port. I just need to see if the pcb-to-ems converter can cope with the complexity of that board.
I will try with my clock board (more complex) and see if I can get a example running with just a single port.
I had a look at the kicad pub file - it has all the footprint pads within it, so in theory that should be easy to make a port. I just need to see if the pcb-to-ems converter can cope with the complexity of that board.
30 minutes and it hadn't even done one step. So I've cut the pub down to just the lower clock shunt+oscilator+buffer board. That seems to be faster.
So this was the output of the initial test (well second after I removed some of the PCBs (A4 with a set of 3080 regulator and clock).
I need to sort out the ports. Currently the ports are simply not in the right place. Also I don't think there's a copper pour (this is buggy in kicad it appears).
I need to sort out the ports. Currently the ports are simply not in the right place. Also I don't think there's a copper pour (this is buggy in kicad it appears).
I have a 2012 rMBP. But for this sort of thing I’ve used Linode instances in the past. They just give you a shell in the cloud - I’ve had them running some optical simulation stuff before FDTD and ray tracing.The simple test PCB only takes a few minutes (in a 16GB 4 CPU VM), the host is a 32GB i7 2018 Mac mini (6core+HT).
I will try with my clock board (more complex) and see if I can get a example running with just a single port.
I had a look at the kicad pub file - it has all the footprint pads within it, so in theory that should be easy to make a port. I just need to see if the pcb-to-ems converter can cope with the complexity of that board.
Ok, so I've added a 1x1x1 excitation port (end of the red arrow) on the same pin out as the signal out of the oscillator. It's 50R source impedance. I've also changed the excitation signal to 24.576MHz (although this will need to have a spread for harmonics at a later date).
Next up is to let the sim run...
Next up is to let the sim run...
- Home
- Design & Build
- Software Tools
- Kicad -> pcbmodelgen -> OpenEMS - electromagnetic field modelling