def test_thermal_conduction():
    # Generate Network and clean up boundaries (delete z-face pores)
    divs = [10, 50]
    Lc = 0.1  # cm
    pn = OpenPNM.Network.Cubic(shape=divs, spacing=Lc)
    pn.add_boundaries()
    pn.trim(pores=pn.pores(['top_boundary', 'bottom_boundary']))
    # Generate Geometry objects for internal and boundary pores
    Ps = pn.pores('internal')
    Ts = pn.throats()
    geom = OpenPNM.Geometry.GenericGeometry(network=pn,
                                            pores=Ps,
                                            throats=Ts)
    geom['pore.area'] = Lc**2
    geom['pore.diameter'] = Lc
    geom['throat.length'] = 1e-25
    geom['throat.area'] = Lc**2
    Ps = pn.pores('boundary')
    boun = OpenPNM.Geometry.GenericGeometry(network=pn, pores=Ps)
    boun['pore.area'] = Lc**2
    boun['pore.diameter'] = 1e-25
    # Create Phase object and associate with a Physics object
    Cu = OpenPNM.Phases.GenericPhase(network=pn)
    Cu['pore.thermal_conductivity'] = 1.0  # W/m.K
    phys = OpenPNM.Physics.GenericPhysics(network=pn,
                                          phase=Cu,
                                          pores=pn.pores(),
                                          throats=pn.throats())
    mod = OpenPNM.Physics.models.thermal_conductance.series_resistors
    phys.add_model(propname='throat.thermal_conductance', model=mod)
    phys.regenerate()  # Update the conductance values
    # Setup Algorithm object
    Fourier_alg = OpenPNM.Algorithms.FourierConduction(network=pn, phase=Cu)
    inlets = pn.pores('back_boundary')
    outlets = pn.pores(['front_boundary', 'left_boundary', 'right_boundary'])
    T_in = 30*sp.sin(sp.pi*pn['pore.coords'][inlets, 1]/5)+50
    Fourier_alg.set_boundary_conditions(bctype='Dirichlet',
                                        bcvalue=T_in,
                                        pores=inlets)
    Fourier_alg.set_boundary_conditions(bctype='Dirichlet',
                                        bcvalue=50,
                                        pores=outlets)
    Fourier_alg.run()
    Fourier_alg.return_results()
    # Calculate analytical solution over the same domain spacing
    Cu['pore.analytical_temp'] = 30*sp.sinh(sp.pi*pn['pore.coords'][:, 0]/5)/sp.sinh(sp.pi/5)*sp.sin(sp.pi*pn['pore.coords'][:, 1]/5) + 50
    b = Cu['pore.analytical_temp'][pn.pores(geom.name)]
    a = Cu['pore.temperature'][pn.pores(geom.name)]
    a = sp.reshape(a, (divs[0], divs[1]))
    b = sp.reshape(b, (divs[0], divs[1]))
    diff = a - b
    assert sp.amax(np.absolute(diff)) < 0.015
dataset/ETHPy150Open PMEAL/OpenPNM/test/integration/script_test.py/test_thermal_conduction/original