<commit_before>from firedrake import *
from mpi4py import MPI
import numpy as np
import pandas as pd


def run_convergence_test(degree):

    name = "HelmholtzProblem"
    param_set = "scpc_hypre"
    params = {"snes_type": "ksponly",
              "mat_type": "matfree",
              # Wrap PC in GMRES to monitor convergence. This should
              # take only 1 GMRES iteration if the PC is working properly.
              "ksp_type": "gmres",
              "ksp_monitor": True,
              "pc_type": "python",
              "pc_python_type": "firedrake.CGStaticCondensationPC",
              "static_condensation": {"ksp_type": "cg",
                                      "ksp_rtol": 1e-10,
                                      "ksp_monitor": True,
                                      "pc_type": "hypre",
                                      "pc_hypre_type": "boomeramg",
                                      "pc_hypre_boomeramg_no_CF": True,
                                      "pc_hypre_boomeramg_coarsen_type": "HMIS",
                                      "pc_hypre_boomeramg_interp_type": "ext+i",
                                      "pc_hypre_boomeramg_P_max": 4,
                                      "pc_hypre_boomeramg_agg_nl": 1}}

    r_params = range(0, 6)
    l2_errors = []
    gmres_its = []
    sc_ksp_its = []
    num_dofs = []
    num_cells = []
    for r in r_params:
        mesh_size = 2 ** r
        mesh = UnitCubeMesh(mesh_size, mesh_size, mesh_size)
        V = FunctionSpace(mesh, "CG", degree)
        x, y, z = SpatialCoordinate(mesh)

        u = Function(V).assign(0.0)<commit_msg>Add verification flag for the Helmholtz test<commit_after>from firedrake import *
from mpi4py import MPI
from argparse import ArgumentParser
import numpy as np
import pandas as pd
import sys


parser = ArgumentParser(description=("""Convergence test for the 3D Helmholtz."""),
                        add_help=False)

parser.add_argument("--verify",
                    default=False,
                    type=bool,
                    action="store",
                    help=(
                        "Verify static condensation with GMRES "
                        "converges in one iteration."
                    ))

parser.add_argument("--help",
                    action="store_true",
                    help="Show help")

args, _ = parser.parse_known_args()

if args.help:
    help = parser.format_help()
    print("%s\n" % help)
    sys.exit(1)


def run_convergence_test(degree):

    name = "HelmholtzProblem"
    param_set = "scpc_hypre"
    params = {"snes_type": "ksponly",
              "mat_type": "matfree",
              "ksp_type": "preonly",
              "pc_type": "python",
              "pc_python_type": "firedrake.CGStaticCondensationPC",
              "static_condensation": {"ksp_type": "cg",
                                      # Solve as close to machine precision as possible
                                      "ksp_rtol": 1e-16,
                                      "ksp_monitor": True,
                                      "pc_type": "hypre",
                                      "pc_hypre_type": "boomeramg",
                                      "pc_hypre_boomeramg_no_CF": True,
                                      "pc_hypre_boomeramg_coarsen_type": "HMIS",
                                      "pc_hypre_boomeramg_interp_type": "ext+i",
                                      "pc_hypre_boomeramg_P_max": 4,
                                      "pc_hypre_boomeramg_agg_nl": 1}}

    if args.verify:
        # Wrap PC in GMRES to monitor convergence. This should
        # take only 1 GMRES iteration if the PC is working properly.
        params["ksp_type"] = "gmres"
        params["ksp_monitor"] = True

    r_params = range(0, 6)
    l2_errors = []
    gmres_its = []
    sc_ksp_its = []
    num_dofs = []
    num_cells = []
    for r in r_params:
        mesh_size = 2 ** r
        mesh = UnitCubeMesh(mesh_size, mesh_size, mesh_size)
        V = FunctionSpace(mesh, "CG", degree)
        x, y, z = SpatialCoordinate(mesh)

        u = Function(V).assign(0.0)
{'fraction_non_alphanumeric': 0.09703113685734975, 'fraction_numerical': 0.006758387641805455, 'mean_word_length': 1.4535227945529898, 'pattern_counts': {'":': 33, '<': 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': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '813648', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1198, 'n_words': 266}