if dof_name == "m_Fe2": return m else: return [-mi for mi in m] H_direction = [0.0, 0.0, 1.0] # The direction of the applied field # The list of values taken by the norm of the applied field H_norms = [0.05, 0.1, [], 1.0, 1.1, [], 2.0, 2.2, [], 3.8, 3.82, [], 4.2, 4.25, [], 4.5, 4.6, [], 5.0] # Selected norms for the second part of the simulation H_norms = [0] selected_H_norms = [0.5, 1.0, 1.5, 2.0, 3.0, 3.2, [], 5.0] selected_H_norms = [0] H_scale = 1 H_norms = sets.float_set(H_norms, H_scale) selected_H_norms = sets.float_set(selected_H_norms, H_scale) H_unit = T/mu0 # The unit for these values is T (Tesla) # From the norms and the direction (which is constant) we derive # all the values that the applied field will take during the simulation Hs = sets.vector_set(direction=H_direction, norm_list=H_norms) # A small deviation to avoid points of unstable equilibrium H_dev = [0.0001, 0.0001, 0.0001] new_Hs = [] for H in Hs: new_Hs.append([Hi+H_devi for Hi, H_devi in zip(H, H_dev)]) new_Hs.append(H)
def m0_Dy(r): return directions['m_Dy'] def m0_Fe(r): return directions['m_Fe2'] #-------------------------------------------- B_direction = [0.0, 0.0, -1.0] # The direction of the applied field #The list of values taken by the norm of the applied field B_unit = Tesla # The unit for these values B_norms = \ sets.float_set([0.0, 0.1, [], 2.0, 2.25, [], 3.8, 3.82, [], 4.2, 4.25, [], 4.5, 4.6, [], 5.0, 5.5, [], 12.0]) selected_B_norms = \ sets.float_set([0.0, 0.5, [], 3.5, 3.8, 3.9, 4.0, 4.1, 4.5, 5.0, [], 12.0]) delta_B = [0.002, 0.002, 0.002] # Tilt vector in T #tilted_B_norms = [B_norm + delta_B for B_norm in B_norms] #selected_B_norms = [B_norm + delta_B for B_norm in selected_B_norms] # From the norms and the direction (which is constant) we derive # all the values that the applied field will take during the simulation Hs = [] delta_H = [dBi*B_unit/mu0 for dBi in delta_B] for H in sets.vector_set(direction=B_direction, norm_list=B_norms,
This file generates the meshes geometries (netgen) for the 2nd mumag standard problem. All distances here are measured in nanometers. """ import material from nmag import simulation_units as su from nmag import SI import nsim.sets as sets # This is the list of values for d/l_ex. # For each of these value a mesh geometry specification file .geo # will be generated. This file can be used with netgen to obtain # the meshes. Unfortunately it seems one has to do it manually # Then use 'make convert' to pass from neu to h5 mesh file format. d_list = sets.float_set([5, 10, "...", 30]) # values of d/lex def create_mesh(d, file_name, rod=None): L, d, t = material.bar_size(d) if rod == None: rod = t else: rod = min(rod, t) s = "algebraic3d\nsolid cube = plane (0, 0, 0; 0, 0, -1)\n" s += " and plane (0, 0, 0; 0, -1, 0)\n and plane (0, 0, 0; -1, 0, 0)\n" s += " and plane (%f, %f, %f; 0, 0, 1)\n" % (L, d, t) s += " and plane (%f, %f, %f; 0, 1, 0)\n" % (L, d, t) s += " and plane (%f, %f, %f; 1, 0, 0) -maxh = %f;\ntlo cube;\n" % (L, d, t, rod) f = open(file_name, "w") f.write(s) f.close()
if header and os.path.exists(file): return f = open(file, "a") f.write(line) f.close() out("# d/l_ex Hc/Ms Mr_x/Ms Mr_y/Ms\n", header=True) args = [] if len(sys.argv) > 1: # We take only arguments which do not contain '-' # (just to avoid considering '-ldebug' and other options) for arg in sys.argv[1:]: if not('-' in arg): args.append(arg) if len(args) != 0: d_list = sets.float_set(args) else: d_list = sets.float_set([5]) #, 6, "...", 10]) for d in d_list: mesh_file, mesh_unit = meshes.better_mesh(d) r = mumag2_simulation(mesh_file, mesh_unit*SI(1e-9, "m"), Hs, m0) #ocaml.sys_check_heap() out("# d=%f, mesh='%s', scaling=%f\n" % (d, mesh_file, mesh_unit)) out("%f %f %f %f\n" % (d, r["hc"], r["mrx"], r["mry"])) m_out = open("m_d%03.0f.dat" % d, "w") for h_par, m_par, (mx, my, mz), t in zip(r["h_pars"], r["m_pars"], r["ms"], r["ts"]): m_out.write("%g %g %g %g %g %g\n" % (h_par, m_par, mx, my, mz, t)) m_out.close()
return directions['m_Fe3O4'] def m0_CoFe2O4(r): return directions['m_CoFe2O4'] # The direction of the applied field B_direction = [0.0, 1.0, 0.0] #The list of values taken by the norm of the applied field B_norms = [-5.0, -4.9, [], 5.0] B_unit = Tesla # The unit for these values # From the norms and the direction (which is constant) we derive # all the values that the applied field will take during the simulation Hs = sets.vector_set(direction=B_direction, norm_list=sets.float_set(B_norms), units=B_unit/mu0) # remember that H = B/mu0 # A small deviation to avoid points of unstable equilibrium H_dev = [SI(0.005e6, "A/m")]*3 Hs = [[Hi+H_devi for Hi, H_devi in zip(H, H_dev)] for H in Hs] #-------------------------------------------- ## Here we set up the simulation # Create the simulation object sim = nmag.Simulation("run", do_demag=False, adjust_tolerances=False) # Set the coupling between the two magnetisations Fe3O4_CoFe2O4_lc = Fe3O4_CoFe2O4_sup_lc*mesh_unit*discretization
directions = {'m_Dy':[0,1,0], 'm_Fe2':[0,-1,0]} def m0_Dy(r): return directions['m_Dy'] def m0_Fe(r): return directions['m_Fe2'] B_direction = [0.0, 1.0, 0.0] # The direction of the applied field #The list of values taken by the norm of the applied field B_norms = [0.1, 0.2, [], 1.0, 1.1, [], 2.0, 2.2, [], 3.8, 3.82, [], 4.2, 4.25, [], 4.5, 4.6, [], 5.0, 5.5, [], 8.0] selected_B_norms = [3.6, 4.0, 4.2] B_norms = sets.float_set(B_norms, B_scale) selected_B_norms = sets.float_set(selected_B_norms, B_scale) layers = [(scale*left, scale*right) for (left, right) in layers] B_unit = Tesla # The unit for these values delta_B = 0.0*Tesla # From the norms and the direction (which is constant) we derive # all the values that the applied field will take during the simulation Hs = sets.vector_set(direction=B_direction, norm_list=B_norms, units=B_unit/mu0) # remember that H = B/mu0 # A small deviation to avoid points of unstable equilibrium H_dev = [SI(0.005e6, "A/m"), 0, SI(0.005e6, "A/m")]