<commit_before>from gusto import *
from firedrake import PeriodicIntervalMesh, ExtrudedMesh, Expression, \
    VectorFunctionSpace, File, as_tensor
import pytest


def setup_IPdiffusion(vector, DG):

    dt = 0.01
    L = 10.
    m = PeriodicIntervalMesh(50, L)
    mesh = ExtrudedMesh(m, layers=50, layer_height=0.2)

    fieldlist = ['u','D']
    timestepping = TimesteppingParameters(dt=dt)
    parameters = CompressibleParameters()

    # vertical coordinate and normal
    W_VectorCG1 = VectorFunctionSpace(mesh, "CG", 1)
    W_CG1 = FunctionSpace(mesh, "CG", 1)
    z = Function(W_CG1).interpolate(Expression("x[1]"))
    k = Function(W_VectorCG1).interpolate(Expression(("0.","1.")))

    state = CompressibleState(mesh, vertical_degree=1, horizontal_degree=1,
                              family="CG",
                              z=z, k=k,
                              timestepping=timestepping,
                              parameters=parameters,
                              fieldlist=fieldlist)

    if vector:
        if DG:
            Space = VectorFunctionSpace(mesh, "DG", 1)
        else:
            Space = state.V[0]
        f = Function(Space, name="f")
        fexpr = Expression(("exp(-pow(L/2.-x[1],2) - pow(L/2.-x[0],2))", "0.0"), L=L)
    else:
        if DG:
            Space = state.V[1]
        else:
            Space = state.V[2]
        f = Function(Space, name='f')
        fexpr = Expression("exp(-pow(L/2.-x[1],2) - pow(L/2.-x[0],2))", L=L)

    try:
        f.interpolate(fexpr)
    except NotImplementedError:
        f.project(fexpr)

    return state, f


def run(dirname, vector, DG):

    state, f = setup_IPdiffusion(vector, DG)

    if DG:<commit_msg>fix test - needs to pass output directory name to state<commit_after>from gusto import *
from firedrake import PeriodicIntervalMesh, ExtrudedMesh, Expression, \
    VectorFunctionSpace, File, as_tensor
import pytest


def setup_IPdiffusion(vector, DG):

    dt = 0.01
    L = 10.
    m = PeriodicIntervalMesh(50, L)
    mesh = ExtrudedMesh(m, layers=50, layer_height=0.2)

    fieldlist = ['u','D']
    timestepping = TimesteppingParameters(dt=dt)
    parameters = CompressibleParameters()
    output = OutputParameters(dirname="IPdiffusion")

    # vertical coordinate and normal
    W_VectorCG1 = VectorFunctionSpace(mesh, "CG", 1)
    W_CG1 = FunctionSpace(mesh, "CG", 1)
    z = Function(W_CG1).interpolate(Expression("x[1]"))
    k = Function(W_VectorCG1).interpolate(Expression(("0.","1.")))

    state = CompressibleState(mesh, vertical_degree=1, horizontal_degree=1,
                              family="CG",
                              z=z, k=k,
                              timestepping=timestepping,
                              parameters=parameters,
                              output=output,
                              fieldlist=fieldlist)

    if vector:
        if DG:
            Space = VectorFunctionSpace(mesh, "DG", 1)
        else:
            Space = state.V[0]
        f = Function(Space, name="f")
        fexpr = Expression(("exp(-pow(L/2.-x[1],2) - pow(L/2.-x[0],2))", "0.0"), L=L)
    else:
        if DG:
            Space = state.V[1]
        else:
            Space = state.V[2]
        f = Function(Space, name='f')
        fexpr = Expression("exp(-pow(L/2.-x[1],2) - pow(L/2.-x[0],2))", L=L)

    try:
        f.interpolate(fexpr)
    except NotImplementedError:
        f.project(fexpr)

    return state, f


def run(dirname, vector, DG):

    state, f = setup_IPdiffusion(vector, DG)

    if DG:
{'fraction_non_alphanumeric': 0.1318464144551101, 'fraction_numerical': 0.02258610954263128, 'mean_word_length': 2.124338624338624, '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': '3190670', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1138, 'n_words': 235}