getfem-users
[Top][All Lists]

## Affectation of magnets

 From: lahoussaine BOURRICHE Subject: Affectation of magnets Date: Thu, 9 Feb 2023 11:57:13 +0100

Hi,

I have a question about source term affectation.
I want to solve a magnetostatic problem with a lot of magnets. I tried two ways of affecting the source term of the magnets.
given a list of physical surfaces tags of the magnets, i tried these two option

Case 1 : Affectation per solid

for tag in magnet_physical_surfaces_tags :
M_data_x=np.zeros((1,mfm.nb_basic_dof()))
M_data_y=np.zeros((1,mfm.nb_basic_dof()))
vect=mfm.basic_dof_on_region(tag)
for j in range(len(vect)):
M_data_x[0, vect[j]]=Mx*1e3
M_data_y[0, vect[j]]=My*1e3

Case 2 : One Affectation for all the problem (to optimize computation time)

M_data_x=np.zeros((1,mfm.nb_basic_dof()))
M_data_y=np.zeros((1,mfm.nb_basic_dof()))
for tag in magnet_physical_surfaces_tags :
vect=mfm.basic_dof_on_region(tzg)
for j in range(len(vect)):
M_data_x[0, vect[j]]=Mx*1e3
M_data_y[0, vect[j]]=My*1e3

When I compare the results of both simulations I can't find the exact same result. I would like some help to understand why there is an error between both methods and if there is something I do wrong.

I hope my mail was clear.

Best regards,

LB

np  = numpy
md  = model
mfm = meshFem