Exemplo n.º 1
0
'''
Plot diffusion coefficient and right hand side
'''

plt.figure("Coefficient")
drawCoefficient_origin(NFine, aFine_ref)

plt.figure("Perturbed coefficient")
drawCoefficient_origin(NFine, aFine_pert)

plt.figure('transformed')
drawCoefficient_origin(NFine, aFine_trans)

plt.figure('Right hand side')
draw_f(NFine+1, f_ref)


plt.show()

'''
Check whether domain mapping method works sufficiently good
'''

uFineFull_pert, AFine_pert, _ = femsolver.solveFine(world, aFine_pert, f_pert, None, boundaryConditions)
uFineFull_trans, AFine_trans, _ = femsolver.solveFine(world, aFine_trans, f_trans, None, boundaryConditions)

u_FineFull_trans_pert = bending_perturbation.evaluateSolution(uFineFull_trans)

energy_norm = np.sqrt(np.dot(uFineFull_pert, AFine_pert * uFineFull_pert))
energy_error = np.sqrt(np.dot((u_FineFull_trans_pert - uFineFull_pert),
f_trans = f_trans_reshaped.reshape(NpFine)
'''
keep the same A
'''

aFine_pert = aFine_ref
aFine_trans = aFine_ref
'''
Plot diffusion coefficient and right hand side
'''

plt.figure("Coefficient")
drawCoefficient_origin(NFine, aFine_ref)

plt.figure('Right hand side')
draw_f(NFine + 1, f_ref)

plt.figure('Right hand side perturbed')
draw_f(NFine + 1, f_trans)

plt.show()
'''
Reference solution
'''

uFineFull_trans, AFine_trans, _ = femsolver.solveFine(world, aFine_trans,
                                                      f_trans, None,
                                                      boundaryConditions)
'''
Set the coefficient that we want to approximate and the tolerance
'''