Exemplo n.º 1
0
        (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])

    print "j0 in A/m^2:", j0 * su.conversion_factor_of(SI("A/m^2"))
    print "j1 in A/m^2:", j1 * su.conversion_factor_of(SI("A/m^2"))

    T0 = ocaml.probe_field(sundialsbuffer_final, "T", [0.0, 0.0, 0.0])[0][1]
    T1 = ocaml.probe_field(sundialsbuffer_final, "T", [-499.0, 0.0, 0.0])[0][1]
    T2 = ocaml.probe_field(sundialsbuffer_final, "T",
                           [-25.0, 10.0, 10.0])[0][1]
    T3 = ocaml.probe_field(sundialsbuffer_final, "T",
                           [+499.0, 10.0, 10.0])[0][1]

    xs, data = sample(sundialsbuffer_final, "T")
    cut.append(data)
    if cutxs == None:
        cutxs = xs

    print "i: %3d t=%g T: %s (su), T: %s " % (
Exemplo n.º 2
0
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])

    print "j0 in A/m^2:",j0*su.conversion_factor_of(SI("A/m^2"))
    print "j1 in A/m^2:",j1*su.conversion_factor_of(SI("A/m^2"))

    T0 = ocaml.probe_field(sundialsbuffer_final,"T",[0.0, 0.0, 0.0])[0][1]
    T1 = ocaml.probe_field(sundialsbuffer_final,"T",[-499.0, 0.0, 0.0])[0][1]
    T2 = ocaml.probe_field(sundialsbuffer_final,"T",[-25.0, 10.0, 10.0])[0][1]
    print "i: %3d t=%g T: %s (su), T: %s " % (i,i*time_step,repr(T0),su.conversion_factor_of(SI(1,"K"))*T0)
    f.write("%g\t%g\t%g\t%g\n" % (i*time_step*su.conversion_factor_of(SI(1,'s')).value,su.conversion_factor_of(SI(1,"K")).value*T0,su.conversion_factor_of(SI(1,"K")).value*T1,su.conversion_factor_of(SI(1,"K")).value*T2))

# Turn off electric heating:
ocaml.linalg_machine_set_iparam(lam,"Phi_ext",0.0)

print "Done With Heating!"

print "Known fieldnames are",master_mwes_and_fields_by_name.keys()
fields = map( lambda a: a[0],master_mwes_and_fields_by_name.values())
Exemplo n.º 3
0
for i in range(int(heating_time//time_step)):
    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,'block-%02d.vtk' % i,my_mesh,format='binary')
    
    last_i = i
    
    j = numpy.array(ocaml.probe_field(master_mwes_and_fields_by_name['j'][1],'j',[0.,0.,0.])[0][1])

    print "j in A/m^2:",j*su.conversion_factor_of(SI("A/m^2"))

    T0 = ocaml.probe_field(sundialsbuffer_final,"T",[0.0, 0.0, 0.0])[0][1]
    print "i: %3d T: %s (su), T: %s " % (i,repr(T0),su.conversion_factor_of(SI(1,"K"))*T0)
    f.write("%g\t%g\n" % (i*time_step*su.conversion_factor_of(SI(1,'s')).value,su.conversion_factor_of(SI(1,"K")).value*T0))


sys.exit(0)

# Turn off electric heating:
ocaml.linalg_machine_set_iparam(lam,"Phi_ext",0.0)

print "Done With Heating!"

timeStep=SI(0.1e-9,'s')
time_step=su.of(timeStep)
Exemplo n.º 4
0
for i in range(int(heating_time // time_step)):
    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, "block-%02d.vtk" % i, my_mesh, format="binary")

    last_i = i

    j = numpy.array(ocaml.probe_field(master_mwes_and_fields_by_name["j"][1], "j", [0.0, 0.0, 0.0])[0][1])

    print "j in A/m^2:", j * su.conversion_factor_of(SI("A/m^2"))

    T0 = ocaml.probe_field(sundialsbuffer_final, "T", [0.0, 0.0, 0.0])[0][1]
    print "i: %3d T: %s (su), T: %s " % (i, repr(T0), su.conversion_factor_of(SI(1, "K")) * T0)
    f.write(
        "%g\t%g\n"
        % (i * time_step * su.conversion_factor_of(SI(1, "s")).value, su.conversion_factor_of(SI(1, "K")).value * T0)
    )


sys.exit(0)

# Turn off electric heating:
ocaml.linalg_machine_set_iparam(lam, "Phi_ext", 0.0)

print "Done With Heating!"
Exemplo n.º 5
0
ocaml.linalg_machine_set_iparam(lam,"Phi_ext",su.of(voltage))

for i in range(int(heating_time//time_step)):
    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,'block-%02d.vtk' % i,my_mesh,format='binary')
    
    last_i = i
    
    j = numpy.array(ocaml.probe_field(master_mwes_and_fields_by_name['j'][1],'j',[0.,0.,0.])[0][1])

    print "j in A/m^2:",j*su.conversion_factor_of(SI("A/m^2"))

    T0 = ocaml.probe_field(sundialsbuffer_final,"T",[0.0, 0.0, 0.0])[0][1]
    print "i: %3d T: %s (su), T: %s " % (i,repr(T0),su.conversion_factor_of(SI(1,"K"))*T0)
    f.write("%g\t%g\n" % (i*time_step*su.conversion_factor_of(SI(1,'s')).value,su.conversion_factor_of(SI(1,"K")).value*T0))


print "Have written temperature at origin into t_T_origin"

print "Analytical derivative is ",dTdt

f.close()