<commit_before>import OpenPNM

def solve_linear(pn, ics):
    pseudo = OpenPNM.Fluids.GenericFluid(network=pn, name='none', loglevel=0)
    pseudo.set_throat_data(prop='electronic_conductance', data=1)

    alg = OpenPNM.Algorithms.OhmicConduction(network=pn, name='alg', loglevel=0)
    alg.set_pore_data(prop='BCval', data=ics)
    alg.set_pore_info(label='Dirichlet', locations=ics.nonzero())
    alg.run(active_fluid=pseudo)
    alg.update()

    return pseudo.get_pore_data(prop='voltage')

if __name__ == '__main__':
    pn = OpenPNM.Network.Cubic(name='net')
    pn.generate(add_boundaries=False)

    x,y,z = pn.get_pore_data(prop='coords').T
    left = x==x.min()
    right = x==x.max()
    ics = 2*left + 1*right

    sol = solve_linear(pn, ics)
    print sol.shape<commit_msg>Circumvented naming bug by generating random serials for linear solver.<commit_after>import string, random
import OpenPNM

def solve_linear(pn, ics):
    # circumvent bug with naming by creating random names
    name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6))
    pseudo = OpenPNM.Fluids.GenericFluid(network=pn, name=name, loglevel=0)
    pseudo.set_throat_data(prop='electronic_conductance', data=1)

    alg = OpenPNM.Algorithms.OhmicConduction(network=pn, name='alg', loglevel=0)
    alg.set_pore_data(prop='BCval', data=ics)
    alg.set_pore_info(label='Dirichlet', locations=ics.nonzero())
    alg.run(active_fluid=pseudo)
    alg.update()

    out = pseudo.get_pore_data(prop='voltage')
    return out
{'fraction_non_alphanumeric': 0.13420195439739413, 'fraction_numerical': 0.005863192182410423, 'mean_word_length': 4.862595419847328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7419810', 'n_tokens_mistral': 575, 'n_tokens_neox': 548, 'n_words': 93}