Beispiel #1
0
# INITIAL GUESS HERE!
if mpi_rank == 0: print 'Reading Restart File(s)'
filename = file_address + results_dir + 'vw_array{0}.npy'.format(mpi_rank)
vw = load(filename)
assert (vw.size == x.size)

pde.matvec(vw, 1)


import sensitivities as sens
T = ((mpi_size - 1) * (n_steps-1) + n_steps)*channel.dt

# gradient plots
if mpi_rank == (mpi_size-1):
    uxbar_avg = sens.velAvg(0,0,n_steps,T)
    uybar_avg = sens.velAvg(1,0,n_steps,T)
    uzbar_avg = sens.velAvg(2,0,n_steps,T)
    ux2bar_avg = sens.vel2Avg(0,0,n_steps,T)
    uy2bar_avg = sens.vel2Avg(1,0,n_steps,T)
    uz2bar_avg = sens.vel2Avg(2,0,n_steps,T)
else:
    uxbar_avg = sens.velAvg(0,0,n_steps-1,T)
    uybar_avg = sens.velAvg(1,0,n_steps-1,T)
    uzbar_avg = sens.velAvg(2,0,n_steps-1,T)
    ux2bar_avg = sens.vel2Avg(0,0,n_steps-1,T)
    uy2bar_avg = sens.vel2Avg(1,0,n_steps-1,T)
    uz2bar_avg = sens.vel2Avg(2,0,n_steps-1,T)

len = uz2bar_avg.shape[0]
for i in range(len):
Beispiel #2
0
vw, info = par_minres(oper, rhs, vw, par_dot, maxiter=MR_iter, tol=1E-6,
                      callback=callback)

pde.matvec(vw, 1)


# save vw array to file with mpi_rank in name...
filename = file_address + results_dir + 'vw_array{0}.npy'.format(mpi_rank)
save(filename,vw)

# gradient plots
import sensitivities as sens
dirc = 0

if mpi_rank == (mpi_size-1):
    uxbar_avg = sens.velAvg(dirc,0,n_steps,T)
else:
    uxbar_avg = sens.velAvg(dirc,0,n_steps-1,T)

len = uxbar_avg.shape[0]
for i in range(len):
    uxbar_avg[i] = mpi_comm.allreduce(uxbar_avg[i])

nb = chunk_bounds


grad = sens.uBarGrad(dirc,n_chunk,nb,T,uxbar_avg,pde.zeta)
for i in range(len):
    grad[i] = mpi_comm.allreduce(grad[i])

if mpi_rank == 0: