getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

               md.add_initialized_fem_data('aimant_x'+str(tag), mfm, M_data_x)    
               md.add_initialized_fem_data('aimant_y' +str(tag)  , mfm, M_data_y)
               md.add_source_term(mim,'[aimant_x' +str(tag)  +',aimant_y' +str(tag)  +'].B(Test_u)',tag)

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

       md.add_initialized_fem_data('aimant_x', mfm, M_data_x)    
       md.add_initialized_fem_data('aimant_y', mfm, M_data_y)
       md.add_source_term(mim,'[aimant_x'+',aimant_y'+'].B(Test_u)',-1)

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.

Thank you in advance,

I hope my mail was clear.

Best regards,

LB


np  = numpy
md  = model
mfm = meshFem

reply via email to

[Prev in Thread] Current Thread [Next in Thread]