op_laplace = ocaml.fem_operator_from_ddiffop_string( # "-<d/dxk rho[vol]|sigma|d/dxk phi[vol]>; rho[boundary=1/2,1/3]=phi[boundary=1/2,1/3],k:3", "-<d/dxk rho[vol] |sigma| d/dxk phi[vol]>\ -<d/dxk rho[boundary=1/-1] |sigma| d/dxk phi[vol]>\ -<d/dxk rho[vol] |sigma| d/dxk phi[boundary=1/-1]>\ -<d/dxk rho[boundary=1/-1] |sigma| d/dxk phi[boundary=1/-1]>\ ; rho[boundary=1/-2,1/-3]=phi[boundary=1/-2,1/-3],k:3", [field_sigma], mwe_rho, mwe_phi, ) laplace_solver = ocaml.fem_solver_from_operator(op_laplace) nfem.field_print_contents(field_phi_dbc) cofield_rho = ocaml.apply_fem_operator([cofield_rho], op_dirichlet_effective_rho0, field_phi_dbc) # nfem.field_print_contents(cofield_rho) # XXX The following two lines below do not work - bug in cofield_to_field?!? field_rho_eff = ocaml.cofield_to_field([], cofield_rho, True) nfem.field_print_contents(field_rho_eff) ocaml.apply_fem_solver(cofield_rho, laplace_solver, field_phi) ocaml.field_push(field_phi, field_phi_ddd) # "save" intermediate field ocaml.field_push(field_phi_dbc, field_phi) # add proper boundary values nfem.visual.fields2vtkfile([field_rho_eff, field_phi_ddd, field_phi], "/tmp/ddiffop4.vtk", mesh=mesh_obj)
# (L||R)=(*||phi[boundary=1/-2,1/-3]),k:3", # [field_sigma],mwe_rho,mwe_phi) op_laplace = ocaml.fem_operator_from_ddiffop_string(\ # "-<d/dxk rho[vol]|sigma|d/dxk phi[vol]>; rho[boundary=1/2,1/3]=phi[boundary=1/2,1/3],k:3", "-<d/dxk rho[vol] |sigma| d/dxk phi[vol]>\ -<d/dxk rho[boundary=1/-1] |sigma| d/dxk phi[vol]>\ -<d/dxk rho[vol] |sigma| d/dxk phi[boundary=1/-1]>\ -<d/dxk rho[boundary=1/-1] |sigma| d/dxk phi[boundary=1/-1]>\ ; rho[boundary=1/-2,1/-3]=phi[boundary=1/-2,1/-3],k:3" , [field_sigma],mwe_rho,mwe_phi) laplace_solver = ocaml.fem_solver_from_operator(op_laplace) nfem.field_print_contents(field_phi_dbc) cofield_rho = ocaml.apply_fem_operator([cofield_rho], op_dirichlet_effective_rho0, field_phi_dbc) #nfem.field_print_contents(cofield_rho) # XXX The following two lines below do not work - bug in cofield_to_field?!? field_rho_eff = ocaml.cofield_to_field([], cofield_rho, True) nfem.field_print_contents(field_rho_eff) ocaml.apply_fem_solver(cofield_rho, laplace_solver, field_phi) ocaml.field_push(field_phi, field_phi_ddd) # "save" intermediate field ocaml.field_push(field_phi_dbc, field_phi) # add proper boundary values
sim.set_magnetization(initial_magnetization) #dt = SI(5e-12, "s") dt = SI(5e-12, "s") #final = SI(0.3e-9,"s") target_time = sim.advance_time(intensive_param_by_name, 1e-6*dt) #sim.save_field('m','barmini_restartfield.nvf') sim.save_data_table() #sim.save_fields_vtk('barmini_vtk%04d.vtk' % 0) nfem.field_print_contents(sim.fields["m"]) calcstart = time.time() for i in range(1, 61): time_ = dt*i print "Time spent so far %g" % (time.time()-calcstart) target_time = sim.advance_time(intensive_param_by_name, time_) sim.save_fields(fieldnames=sim.fields.keys()) #sim.save_fields() #sim.save_field('m',filename='barmini_restartfield.nvf') #write SI data into default file