# Magnetic field produced by linear current in COMSOL

• Caleydos
In summary, the conversation discusses the discrepancy between theoretical and simulated values for magnetic flux density in a 3D model. The user has used an edge current of 10 A through a 0.45 cm wire inside an air sphere, according to Ampere's law, the magnetic field produced at 1 mm distance should be 0.002 T. However, the simulation shows a much higher value of 0.3 T. The user has also tried a 2D model in COMSOL 3.5, which matches the theoretical values. Possible reasons for the discrepancy are discussed, including boundary conditions and wire length. The user also notes an unexpected shape in the magnetic flux.

#### Caleydos

TL;DR Summary
Issue with COMSOL 5.5 when trying to calculate the magnetic field produced by linear current in 3D
Hello,

I have used an edge current of 10 A through a 0,45 cm (lenght) wire inside an air sphere. The thing is that, according with Ampere law, the magnetic field (B) produced at a 1 mm of distance from the wire shall be 0,002 T, and I am obtaining much higher values in this simulation (around 0,3 T at his point).

I have done it in 2D and result is OK, according with theoretical values, but I do not know why in 3D it changes. Any idea please?

#### Attachments

• Esfera 1 m de radio zoom.png
56.5 KB · Views: 96
Can you post a picture of the geometry in 2D and in 3D?

Sure! I attach them here. Thanks a lot!

First one is the 3D model (lateral view), showing the value of the magnetic flux density in COMSOL 5.5 (this value do not matches with theoretical)

The second one is 2D in COMSOL 3.5, this value really matches with theoretical

#### Attachments

• Flujo campo en modelo 3D (esfera 20 cm). 0,1 T a 2 cm del centro del conductor.png
42.5 KB · Views: 81
• Magnetic Flux density at 1mm (2mT).png
41.1 KB · Views: 108
There is something strange going on, for instance:

Check the boundary conditions.

This is one of the things that I supossed in the beggining, but I made the boundary sphere wider and the result is the same (see attached). It seems the magnetic flux shown in the boundary layer is debt to the sphere is very small. Any other idea?

#### Attachments

• Magnetic flux density long wire 10 amps (0.5 T at 1mm).png
18.7 KB · Views: 78
I have tried modifying the length of the wire, magnetic flux should remain the same, but it isn´t. It seems the longer wire produces more flux at 1mm (it makes no sense).

On the other hand, I do not understan why this shape in the magnetic flux, it should be purely circular.

#### Attachments

• Magnetic flux density long wire 10 amps (0.5 T at 1mm).png
18.7 KB · Views: 68
• Magnetic flux density very long wire 10 amps (0.8 T at 1mm).png
62.8 KB · Views: 66

## 1. What is a magnetic field?

A magnetic field is a region in space where a magnetic force is exerted. It is created by moving electric charges, such as those found in current-carrying wires.

## 2. How is a magnetic field produced by linear current?

A linear current is a flow of electric charges in a straight line. When a current flows through a wire, it creates a magnetic field around the wire, with the direction of the field determined by the direction of the current.

## 3. What is COMSOL and how does it relate to magnetic fields?

COMSOL is a software program that allows for the simulation and analysis of physical phenomena, including magnetic fields. It uses mathematical models to predict the behavior of magnetic fields and can be used to design and optimize devices that use magnetic fields.

## 4. What factors affect the strength of a magnetic field produced by linear current?

The strength of a magnetic field produced by linear current depends on the magnitude of the current, the distance from the wire, and the permeability of the material surrounding the wire.

## 5. How can I use COMSOL to study the magnetic field produced by linear current?

To study the magnetic field produced by linear current in COMSOL, you can create a model of the current-carrying wire and use the software to solve for the magnetic field. You can also change parameters, such as the current magnitude and distance from the wire, to see how they affect the magnetic field.