<commit_before>#include "navier_stokes.h"
#include <deal.II/lac/trilinos_precondition.h>

using namespace dealii;

/* ------------------------ PARAMETERS ------------------------ */

template <int dim>
void
NavierStokes<dim>::
declare_parameters (ParameterHandler &prm)
{
  add_parameter(  prm,
                  &end_time,
                  "End time",
                  "1e8",
                  Patterns::Double (0));

  add_parameter(  prm,
                  &initial_global_refinement,
                  "Initial global refinement",
                  "1",
                  Patterns::Integer (0));

  add_parameter(  prm,
                  &initial_adaptive_refinement,
                  "Initial adaptive refinement",
                  "2",
                  Patterns::Integer (0));

  add_parameter(  prm,
                  &adaptive_refinement_interval,
                  "Time steps between mesh refinement",
                  "10",
                  Patterns::Integer (1));

  add_parameter(  prm,
                  &generate_graphical_output,
                  "Generate graphical output",
                  "false",
                  Patterns::Bool ());

  add_parameter(  prm,
                  &graphical_output_interval,
                  "Time steps between graphical output",
                  "50",
                  Patterns::Integer (1));

  add_parameter(  prm,
                  &stokes_velocity_degree,
                  "Stokes velocity polynomial degree",
                  "2",
                  Patterns::Integer (1));

  add_parameter(  prm,
                  &use_locally_conservative_discretization,
                  "Use locally conservative discretization",
                  "true",
                  Patterns::Bool ());
}

/* ------------------------ CONSTRUCTORS ------------------------ */

template <int dim>
NavierStokes<dim>::NavierStokes (const RefinementMode refinement_mode)
  :
  pcout (std::cout,
         (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)
          == 0)),

  mapping (4),

  time_step (0),
  old_time_step (0),
  timestep_number (0),
  rebuild_navier_stokes_matrix (true),
  rebuild_navier_stokes_preconditioner (true),

  computing_timer (MPI_COMM_WORLD,
                   pcout,
                   TimerOutput::summary,
                   TimerOutput::wall_times),

  refinement_mode (refinement_mode),

  eh("ErrorHandler<1>", "u, u, p","L2, Linfty, H1; AddUp; L2"),

  pgg("Cube"),

  fe_builder(           "FE_Q",
                        "FESystem[FE_Q(2)^dim-FE_Q(1)]"),

  boundary_conditions(  "Dirichlet boundary conditions",
                        "k*pi*cos(k*pi*x)*cos(k*pi*y); k*pi*sin(k*pi*x)*sin(k*pi*y); 0",
                        "k=1"),

  right_hand_side(      "Right-hand side force",
                        "2*k^3*pi^3*cos(k*pi*x)*cos(k*pi*y); 2*k^3*pi^3*sin(k*pi*x)*sin(k*pi*y); 0",
                        "k=1" )

{}


/*
  template <int dim>
  NavierStokes<dim>::~NavierStokes ()
  {
    // navier_stokes_dof_handler->clear ();
    smart_delete(navier_stokes_dof_handler);
    smart_delete(navier_stokes_fe);
    smart_delete(triangulation);
  }
  */

/* ------------------------ DEGREE OF FREEDOM ------------------------ */

template <int dim>
void NavierStokes<dim>::setup_dofs ()
{<commit_msg>use the new fe parsing<commit_after>#include "navier_stokes.h"
#include <deal.II/lac/trilinos_precondition.h>

using namespace dealii;

/* ------------------------ PARAMETERS ------------------------ */

template <int dim>
void
NavierStokes<dim>::
declare_parameters (ParameterHandler &prm)
{
  add_parameter(  prm,
                  &end_time,
                  "End time",
                  "1e8",
                  Patterns::Double (0));

  add_parameter(  prm,
                  &initial_global_refinement,
                  "Initial global refinement",
                  "1",
                  Patterns::Integer (0));

  add_parameter(  prm,
                  &initial_adaptive_refinement,
                  "Initial adaptive refinement",
                  "2",
                  Patterns::Integer (0));

  add_parameter(  prm,
                  &adaptive_refinement_interval,
                  "Time steps between mesh refinement",
                  "10",
                  Patterns::Integer (1));

  add_parameter(  prm,
                  &generate_graphical_output,
                  "Generate graphical output",
                  "false",
                  Patterns::Bool ());

  add_parameter(  prm,
                  &graphical_output_interval,
                  "Time steps between graphical output",
                  "50",
                  Patterns::Integer (1));

  add_parameter(  prm,
                  &stokes_velocity_degree,
                  "Stokes velocity polynomial degree",
                  "2",
                  Patterns::Integer (1));

  add_parameter(  prm,
                  &use_locally_conservative_discretization,
                  "Use locally conservative discretization",
                  "true",
                  Patterns::Bool ());
}

/* ------------------------ CONSTRUCTORS ------------------------ */

template <int dim>
NavierStokes<dim>::NavierStokes (const RefinementMode refinement_mode)
  :
  pcout (std::cout,
         (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)
          == 0)),

  mapping (4),

  time_step (0),
  old_time_step (0),
  timestep_number (0),
  rebuild_navier_stokes_matrix (true),
  rebuild_navier_stokes_preconditioner (true),

  computing_timer (MPI_COMM_WORLD,
                   pcout,
                   TimerOutput::summary,
                   TimerOutput::wall_times),

  refinement_mode (refinement_mode),

  eh("ErrorHandler<1>", "u, u, p","L2, Linfty, H1; AddUp; L2"),

  pgg("Cube"),

  fe_builder(           "FE_Q",
                        "FESystem[FE_Q(2)^dim-FE_Q(1)]",
                        "u,u,p"),

  boundary_conditions(  "Dirichlet boundary conditions",
                        "k*pi*cos(k*pi*x)*cos(k*pi*y); k*pi*sin(k*pi*x)*sin(k*pi*y); 0",
                        "k=1"),

  right_hand_side(      "Right-hand side force",
                        "2*k^3*pi^3*cos(k*pi*x)*cos(k*pi*y); 2*k^3*pi^3*sin(k*pi*x)*sin(k*pi*y); 0",
                        "k=1" )

{}


/*
  template <int dim>
  NavierStokes<dim>::~NavierStokes ()
  {
    // navier_stokes_dof_handler->clear ();
    smart_delete(navier_stokes_dof_handler);
    smart_delete(navier_stokes_fe);
    smart_delete(triangulation);
  }
  */

/* ------------------------ DEGREE OF FREEDOM ------------------------ */

template <int dim>
void NavierStokes<dim>::setup_dofs ()
{
{'fraction_non_alphanumeric': 0.15976420798065297, 'fraction_numerical': 0.010882708585247884, 'mean_word_length': 1.6154150197628458, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '7451727', 'n_tokens_mistral': 2112, 'n_tokens_neox': 1949, 'n_words': 337}