geometry.add_edge(0.204, 0.002, 0.194, -0.002, boundaries = {"current" : "Ground", "elasticity" : "Free", "heat" : "Convection"})
geometry.add_edge(0.194, -0.002, 0.194, -0.008, boundaries = {"current" : "Ground", "elasticity" : "Free", "heat" : "Convection"})
geometry.add_edge(0.194, -0.002, 0, 0, boundaries = {})
geometry.add_edge(0.13, 0.014, 0.086, 0.002, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Zero flux"})
geometry.add_edge(0.13, 0.014, 0.12, 0.004, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Zero flux"})
geometry.add_edge(0.086, 0.002, 0.12, 0.004, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Zero flux"})
geometry.add_edge(0.084, -0.014, 0.104, -0.004, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Convection"})
geometry.add_edge(0.104, -0.004, 0.128, -0.004, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Convection"})
geometry.add_edge(0.128, -0.004, 0.13, -0.026, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Convection"})
geometry.add_edge(0.13, -0.026, 0.194, -0.008, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Convection"})
geometry.add_edge(0.084, -0.014, 0, -0.01, boundaries = {"current" : "Neumann", "elasticity" : "Free", "heat" : "Convection"})

# labels
geometry.add_label(0.173639, 0.0106815, materials = {"current" : "Mild steel", "elasticity" : "Mild steel", "heat" : "Mild steel"})
geometry.add_label(0.160202, -0.00535067, materials = {"current" : "Aluminium", "elasticity" : "Aluminium", "heat" : "Aluminium"})
geometry.add_label(0.116793, 0.00774503, materials = {"current" : "none", "elasticity" : "none", "heat" : "none"})

agros2d.view.zoom_best_fit()

# solve problem
problem.solve()

# point value
local_values_current = current.local_values(0.155787, 0.00713725)
testV = agros2d.test("Current - Scalar potential", local_values_current["V"], 0.001555)
local_values_heat = heat.local_values(0.155787, 0.00713725)
testT = agros2d.test("Heat transfer - Temperature", local_values_heat["T"], 40.649361)
local_values_elasticity = elasticity.local_values(0.155787, 0.00713725)
testD = agros2d.test("Thermoelasticity - Displacement", local_values_elasticity["d"], 1.592721e-4)

print("Test: Coupling 1 - planar, all weak ({0}): " + str(testV and testT and testD))
geometry.add_edge(0.1, -0.4, 0.15, -0.25, boundaries = {"current" : "0 V", "heat" : "Flux"})
geometry.add_edge(0.15, -0.25, 0.25, -0.25, boundaries = {"heat" : "Flux"})
geometry.add_edge(0.1, -0.4, 0.1, 0.28, boundaries = {"current" : "Neumann"})
geometry.add_edge(0.19, 0.25, 0.15, -0.25, boundaries = {"current" : "Neumann"})
geometry.add_edge(0.25, 0.2, 0.45, 0.25, boundaries = {"elasticity" : "Fixed", "heat" : "Flux"})
geometry.add_edge(0.45, 0.25, 0.3, -0.25, boundaries = {"elasticity" : "Fixed free", "heat" : "300 K"})
geometry.add_edge(0.3, -0.25, 0.25, -0.25, boundaries = {"elasticity" : "Free", "heat" : "Flux"})

# labels
geometry.add_label(0.103556, -0.00186029, materials = {"current" : "Material", "elasticity" : "none", "heat" : "Material"})
geometry.add_label(0.0497159, 0.00460215, materials = {"current" : "none", "elasticity" : "none", "heat" : "Material"})
geometry.add_label(0.204343, 0.00622128, materials = {"current" : "none", "elasticity" : "none", "heat" : "Material"})
geometry.add_label(0.276729, -0.0804181, materials = {"current" : "none", "elasticity" : "Material", "heat" : "Material"})

agros2d.view.zoom_best_fit()

# solve problem
problem.solve()

# point value
local_values_current = current.local_values(0.140872, -0.015538)
testV = agros2d.test("Current - Scalar potential", local_values_current["V"], 5.712807)
local_values_heat = heat.local_values(0.277308, -0.216051)
testT = agros2d.test("Heat transfer - Temperature", local_values_heat["T"], 395.728987)
testL1 = agros2d.test("Heat transfer - Heat conductivity", local_values_heat["lambda"], 479.949868)
local_values_heat = heat.local_values(0.063718, -0.022513)
testL2 = agros2d.test("Heat transfer - Heat conductivity", local_values_heat["lambda"], 299.195502)
local_values_elasticity = elasticity.local_values(0.277308,-0.216051)
testD = agros2d.test("Thermoelasticity - Displacement", local_values_elasticity["d"], 0.001958)

print("Test: Coupling 3 - axisymetric, current lin, heat realy nonlin transient, elasticity lin, weak: " + str(testV and testT and testD and testL1 and testL2))
geometry.add_edge(0, 0, 0.32, 0, boundaries = {"heat" : "Convection"})
geometry.add_edge(0.3, 0.6, 0.3, 0.1, boundaries = {})
geometry.add_edge(0, 0.1, 0.3, 0.1, boundaries = {})
geometry.add_edge(0, 0.6, 0, 0.1, boundaries = {"heat" : "Symmetry", "magnetic" : "A = 0"})
geometry.add_edge(0, 0.1, 0, 0, boundaries = {"heat" : "Symmetry", "magnetic" : "A = 0"})
geometry.add_edge(0.33, 0.7, 0.4, 0.7, boundaries = {})
geometry.add_edge(0.4, 0.7, 0.4, 0.046, boundaries = {})
geometry.add_edge(0.4, 0.046, 0.33, 0.046, boundaries = {})
geometry.add_edge(0.33, 0.046, 0.33, 0.7, boundaries = {})
geometry.add_edge(0.3, 0.6, 0.32, 0.6, boundaries = {"heat" : "Convection"})
geometry.add_edge(0.32, 0, 0.32, 0.6, boundaries = {"heat" : "Convection"})
geometry.add_edge(0, 1.2, 0, 0.6, boundaries = {"magnetic" : "A = 0"})

# labels
geometry.add_label(0.627519, 0.954318, materials = {"heat" : "none", "magnetic" : "Air"}, area = 0.005)
geometry.add_label(0.087409, 0.293345, materials = {"heat" : "Steel", "magnetic" : "Steel"}, area = 0.0005)
geometry.add_label(0.132733, 0.0478408, materials = {"heat" : "Insulation", "magnetic" : "Insulation"})
geometry.add_label(0.378237, 0.221582, materials = {"heat" : "none", "magnetic" : "Copper"})

agros2d.view.zoom_best_fit()

# solve problem
problem.solve()

# point value
local_values_magnetic = magnetic.local_values(0.2956, 0.2190)
testA = agros2d.test("Magnetic - Vector potential", local_values_magnetic["A"], 0.009137)
local_values_heat = heat.local_values(0.2956, 0.2190)
testT = agros2d.test("Heat transfer - Temperature", local_values_heat["T"], 975.749917)

print("Test: Coupling 2 - axisymmetric, mag harm + heat steady, both nonlin, hard: " + str(testA and testT))
geometry.add_edge(-0.15, 0.5, 0.25, 0.5, boundaries = {"heat" : "Convection"})
geometry.add_edge(-0.15, 0.15, -0.1, 0.2, boundaries = {}, angle = 90)
geometry.add_edge(-0.1, 0.2, -0.15, 0.25, boundaries = {}, angle = 90)
geometry.add_edge(-0.15, 0.25, -0.15, 0.15, boundaries = {})
geometry.add_edge(0, 0.35, 0.1, 0.35, boundaries = {})
geometry.add_edge(0.1, 0.35, 0.05, 0.4, boundaries = {})
geometry.add_edge(0.05, 0.4, 0, 0.35, boundaries = {})

# labels
geometry.add_label(0.1, 0.15, materials = {"current" : "Cu", "heat" : "Cu"})
geometry.add_label(0.2, 0.05, materials = {"current" : "none", "heat" : "Fe"})
geometry.add_label(-0.15, 0.4, materials = {"current" : "none", "heat" : "Fe"})
geometry.add_label(-0.123246, 0.198947, materials = {"current" : "none", "heat" : "Fe (source)"})
geometry.add_label(0.05, 0.378655, materials = {"current" : "none", "heat" : "Fe (source)"})

agros2d.view.zoom_best_fit()

problem.solve()

# point value
local_values_current = current.local_values(0.1, 0.15)
testV = agros2d.test("Current - Scalar potential", local_values_current["V"], 0.049999)
testJ = agros2d.test("Current - Current density", local_values_current["Jrc"], 9.901206e6)
local_values_heat = heat.local_values(0.05, 0.05)
testT1 = agros2d.test("Heat - Temperature 1", local_values_heat["T"], 71.88167)
local_values_heat = heat.local_values(-0.05, 0.15)
testT2 = agros2d.test("Heat - Temperature 2", local_values_heat["T"], 25.002605)
volume_integral_heat = heat.volume_integrals([0, 1, 2, 3, 4])
testTvol = agros2d.test("Heat - Temperature volume", volume_integral_heat["T"], 8.498177)

print("Test: Coupling 4 - transient - planar, newton, weak: " + str(testV and testJ and testT1 and testT2 and testTvol)) #testf
acoustic.add_material("Air", {"acoustic_density" : 1.25, "acoustic_speed" : 343})

# geometry
geometry = agros2d.geometry
geometry.add_edge(-0.4, 0.05, 0.1, 0.2, boundaries = {"acoustic" : "Matched bundary"})
geometry.add_edge(0.1, -0.2, -0.4, -0.05, boundaries = {"acoustic" : "Matched bundary"})
geometry.add_edge(-0.4, 0.05, -0.4, -0.05, boundaries = {"acoustic" : "Soft wall"})
geometry.add_edge(-0.18, -0.06, -0.17, -0.05, angle = 90, boundaries = {"acoustic" : "Source"})
geometry.add_edge(-0.17, -0.05, -0.18, -0.04, angle = 90, boundaries = {"acoustic" : "Source"})
geometry.add_edge(-0.18, -0.04, -0.19, -0.05, angle = 90, boundaries = {"acoustic" : "Source"})
geometry.add_edge(-0.19, -0.05, -0.18, -0.06, angle = 90, boundaries = {"acoustic" : "Source"})
geometry.add_edge(0.1, -0.2, 0.1, 0.2, angle = 90, boundaries = {"acoustic" : "Matched bundary"})
geometry.add_edge(0.03, 0.1, -0.04, -0.05, angle = 90, boundaries = {"acoustic" : "Hard wall"})
geometry.add_edge(-0.04, -0.05, 0.08, -0.04, boundaries = {"acoustic" : "Hard wall"})
geometry.add_edge(0.08, -0.04, 0.03, 0.1, boundaries = {"acoustic" : "Hard wall"})

geometry.add_label(-0.0814934, 0.0707097, area = 10e-05, materials = {"acoustic" : "Air"})
geometry.add_label(-0.181474, -0.0504768, materials = {"acoustic" : "none"})
geometry.add_label(0.0314514, 0.0411749, materials = {"acoustic" : "none"})

agros2d.view.zoom_best_fit()

# solve problem
problem.solve()

# point 
point = acoustic.local_values(0.042132, -0.072959)
testp = agros2d.test("Acoustic pressure", point["pr"], 0.200436)
# testSPL = agros2d.test("Acoustic sound level", point["SPL"], 77.055706)

print("Test: Acoustic - transient - planar: " + str(testp))
geometry.add_edge(0.03,
                  0.1,
                  -0.04,
                  -0.05,
                  angle=90,
                  boundaries={"acoustic": "Hard wall"})
geometry.add_edge(-0.04,
                  -0.05,
                  0.08,
                  -0.04,
                  boundaries={"acoustic": "Hard wall"})
geometry.add_edge(0.08, -0.04, 0.03, 0.1, boundaries={"acoustic": "Hard wall"})

geometry.add_label(-0.0814934,
                   0.0707097,
                   area=10e-05,
                   materials={"acoustic": "Air"})
geometry.add_label(-0.181474, -0.0504768, materials={"acoustic": "none"})
geometry.add_label(0.0314514, 0.0411749, materials={"acoustic": "none"})

agros2d.view.zoom_best_fit()

# solve problem
problem.solve()

# point
point = acoustic.local_values(0.042132, -0.072959)
testp = agros2d.test("Acoustic pressure", point["pr"], 0.200436)
# testSPL = agros2d.test("Acoustic sound level", point["SPL"], 77.055706)

print("Test: Acoustic - transient - planar: " + str(testp))