heating_time = su.of(heatingTime) cooling_time = su.of(coolingTime) time_step = su.of(timeStep) # Set the electrical contact potential to +/- Phi_ext at left and # right contact: print "Setting external potential" #ocaml.linalg_machine_set_iparam(lam,"Phi_ext",5.0*100*1e12) voltage = SI(0.2186, "V") #Need factor three for new geometry voltage = SI(0.218353, "V") #Need factor three for new geometry print "Setting voltage to", voltage ocaml.linalg_machine_set_iparam(lam, "Phi_ext", su.of(voltage)) for i in range(int(heating_time // time_step) + 1): ocaml.raw_cvode_advance(cvode, sundialsbuffer_final, float(i * time_step), max_it) for name in master_mwes_and_fields_by_name.keys(): (mwe, field) = master_mwes_and_fields_by_name[name] ocaml.linalg_machine_get_field(lam, field, "v_%s" % name) fields = map(lambda a: a[1], master_mwes_and_fields_by_name.values()) #nfem.visual.fields2vtkfile(fields,'H-%02d.vtk' % i,my_mesh,format='binary') last_i = i j0 = numpy.array(
heating_time=su.of(heatingTime) cooling_time = su.of(coolingTime) time_step=su.of(timeStep) # Set the electrical contact potential to +/- Phi_ext at left and # right contact: print "Setting external potential" #ocaml.linalg_machine_set_iparam(lam,"Phi_ext",5.0*100*1e12) voltage = SI(0.2186,"V") #Need factor three for new geometry voltage = SI(0.218353,"V") #Need factor three for new geometry print "Setting voltage to",voltage ocaml.linalg_machine_set_iparam(lam,"Phi_ext",su.of(voltage)) for i in range(int(heating_time//time_step)+1): ocaml.raw_cvode_advance(cvode,sundialsbuffer_final,float(i*time_step),max_it) for name in master_mwes_and_fields_by_name.keys(): (mwe,field)=master_mwes_and_fields_by_name[name] ocaml.linalg_machine_get_field(lam,field,"v_%s" % name) fields = map( lambda a: a[1],master_mwes_and_fields_by_name.values()) nfem.visual.fields2vtkfile(fields,'H-%02d.vtk' % i,my_mesh,format='binary') last_i = i j0 = numpy.array(ocaml.probe_field(master_mwes_and_fields_by_name['j'][1],'j',[0.,0.,0.])[0][1]) j1 = numpy.array(ocaml.probe_field(master_mwes_and_fields_by_name['j'][1],'j',[-499.,0.,0.])[0][1])
(cvode,fun_timings)=ocaml.raw_make_linalg_machine_cvode(\ lam, sundialsbuffer_starting, "jacobian","execute_jplan", "rhs", jacobi_same_nonzero_pattern, max_order, krylov_max, ) heating_time = 0.5 time_step = 100 # Set the electrical contact potential to +/- Phi_ext at left and # right contact: ocaml.linalg_machine_set_iparam(lam, "Phi_ext", 5.0) ocaml.raw_cvode_advance(cvode, sundialsbuffer_final, heating_time, max_it) # Turn off electric heating: ocaml.linalg_machine_set_iparam(lam, "Phi_ext", 0.0) print "Known fieldnames are", master_mwes_and_fields_by_name.keys() fields = map(lambda a: a[0], master_mwes_and_fields_by_name.values()) for field in fields: print "known fields are", ocaml.sys_ocamlpill_type(field) #Thomas, we only have one filed in master_mwes and fields -- is that right?x for i in range(500): ocaml.raw_cvode_advance(cvode, sundialsbuffer_final, heating_time + i * time_step, max_it) (mwe, field) = master_mwes_and_fields_by_name['T']
(cvode,fun_timings)=ocaml.raw_make_linalg_machine_cvode(\ lam, sundialsbuffer_starting, "jacobian","execute_jplan", "rhs", jacobi_same_nonzero_pattern, max_order, krylov_max, ) heating_time=0.5 time_step=100 # Set the electrical contact potential to +/- Phi_ext at left and # right contact: ocaml.linalg_machine_set_iparam(lam,"Phi_ext",5.0) ocaml.raw_cvode_advance(cvode,sundialsbuffer_final,heating_time,max_it) # Turn off electric heating: ocaml.linalg_machine_set_iparam(lam,"Phi_ext",0.0) print "Known fieldnames are",master_mwes_and_fields_by_name.keys() fields = map( lambda a: a[0],master_mwes_and_fields_by_name.values()) for field in fields: print "known fields are",ocaml.sys_ocamlpill_type(field) #Thomas, we only have one filed in master_mwes and fields -- is that right?x for i in range(500): ocaml.raw_cvode_advance(cvode,sundialsbuffer_final,heating_time+i*time_step,max_it) (mwe,field)=master_mwes_and_fields_by_name['T'] ocaml.linalg_machine_get_field(lam,field,"v_T")