Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Constrained simulation

Please login with a confirmed email address before reporting spam

Hi everybody !
for educational purpose I’m trying to build a comsol simulation of a simple 3D rectangular conductor (of conductivity sigma) in which a current flows BUT solving for the MAGNETIC FIELD.

More clearly I’m trying to solve the following equation (you can obtain it very easily using the Maxwell equations using the fact that epsilon0 is small in front of 1 ):

(1/mu0)*(d2/dx^2+d2/dy^2+d2/dz^2)B=sigma*dB/dt

with B={Bx,By,Bz}

together with :

div B=0

Then to go back to J via : curl(B)=mu0*J.

(mu0 is the vacuum permeability and epsilon0 the vacuum permittivity).

The way I do this is solving a « heat equation » (from the « General Form PDE » physics) with a source term equal to 0. To add the second constraint (i.e. divB=0) I use a « Global constraint » where I input this : Bxx+Byy+Bzz=0.

For the boundary conditions I use on two surfaces « dirichelet boundary condition » setting :

B={Jin*mu0*z,0,0}

(with Jin the input current density)

And on the other surfaces :

n.{Bzy-Byz,Bxz-Bzx,Byx,Bxy}=0

which corresponds to :

n.J=0

For me, everything seems well defined but it turns out that the simulation works very badly. First, it takes a lot of time to simulate this very simple problem and second the divB=0 constraint is not respected.

Do you see any problem in this approach ? Or better do you have any solution ?

Thanks in advance
Alex

ps. in attached you can find the comsol file.


2 Replies Last Post Mar 5, 2015, 4:05 a.m. EST
Sven Friedel COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Mar 2, 2015, 6:31 a.m. EST
Hi Alexandre,

a global constraint does not mean that a certain expression is constrained in the whole domain ("globally"),
but a global (not space dependent) expression is constrained (e.g. an integral over a domain). You may want to try a weak constraint on the subdomain level.

That said - I understand that for educational purposes it might be illustrative to occasionally re-invent
the wheel, however - there will be certainly a technological advantage using dedicated interfaces of
COMSOL for magentic fields. They would not solve for B directly but for the vector potential A and neither
use standard Lagrange discretization but special curl curl formulations with vector elements.

Best regards,

Sven
Hi Alexandre, a global constraint does not mean that a certain expression is constrained in the whole domain ("globally"), but a global (not space dependent) expression is constrained (e.g. an integral over a domain). You may want to try a weak constraint on the subdomain level. That said - I understand that for educational purposes it might be illustrative to occasionally re-invent the wheel, however - there will be certainly a technological advantage using dedicated interfaces of COMSOL for magentic fields. They would not solve for B directly but for the vector potential A and neither use standard Lagrange discretization but special curl curl formulations with vector elements. Best regards, Sven

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Mar 5, 2015, 4:05 a.m. EST
Hi Sven
thanks for the quick answer. I don't have the interfaces of COMSOL for magnetic fields this would indeed be the simplest solution.
Concerning my model, I tried to use a weak constraint on the whole domain, setting the absolute value of the divergence of B to 0 (abs(div(B))) so that even using an integral form div B must be 0 locally. Unfortunately I get an error.
Could you have a quick look on my file ?
Thanks in advance !
Alex
Hi Sven thanks for the quick answer. I don't have the interfaces of COMSOL for magnetic fields this would indeed be the simplest solution. Concerning my model, I tried to use a weak constraint on the whole domain, setting the absolute value of the divergence of B to 0 (abs(div(B))) so that even using an integral form div B must be 0 locally. Unfortunately I get an error. Could you have a quick look on my file ? Thanks in advance ! Alex

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.