Skip to content

Commit

Permalink
Refine the initial cylinder grid.
Browse files Browse the repository at this point in the history
The surface now needs more cells to discretize it since we are using a polynomial description.
  • Loading branch information
dougshidong committed Oct 6, 2019
1 parent 05532ec commit eed8d88
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
47 changes: 24 additions & 23 deletions src/testing/euler_cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ void half_cylinder(dealii::parallel::distributed::Triangulation<2> & tria,

tria.set_all_manifold_ids(0);
tria.set_manifold(0, dealii::SphericalManifold<2>(center));

// Assign BC
for (auto cell = tria.begin_active(); cell != tria.end(); ++cell) {
//if (!cell->is_locally_owned()) continue;
for (unsigned int face=0; face<dealii::GeometryInfo<2>::faces_per_cell; ++face) {
if (cell->face(face)->at_boundary()) {
unsigned int current_id = cell->face(face)->boundary_id();
if (current_id == 0) {
cell->face(face)->set_boundary_id (1004); // x_left, Farfield
} else if (current_id == 1) {
cell->face(face)->set_boundary_id (1001); // x_right, Symmetry/Wall
} else if (current_id == 2) {
cell->face(face)->set_boundary_id (1001); // y_bottom, Symmetry/Wall
} else if (current_id == 3) {
cell->face(face)->set_boundary_id (1001); // y_top, Wall
} else {
std::abort();
}
}
}
}
}


Expand Down Expand Up @@ -165,42 +186,22 @@ ::run_test () const
dealii::Triangulation<dim>::smoothing_on_coarsening));

const unsigned int n_cells_circle = n_1d_cells[0];
const unsigned int n_cells_radial = 3*n_cells_circle;
const unsigned int n_cells_radial = 2*n_cells_circle;
half_cylinder(grid, n_cells_circle, n_cells_radial);
// Assign BC
for (auto cell = grid.begin_active(); cell != grid.end(); ++cell) {
//if (!cell->is_locally_owned()) continue;
for (unsigned int face=0; face<dealii::GeometryInfo<dim>::faces_per_cell; ++face) {
if (cell->face(face)->at_boundary()) {
unsigned int current_id = cell->face(face)->boundary_id();
if (current_id == 0) {
cell->face(face)->set_boundary_id (1004); // x_left, Farfield
} else if (current_id == 1) {
cell->face(face)->set_boundary_id (1001); // x_right, Symmetry/Wall
} else if (current_id == 2) {
cell->face(face)->set_boundary_id (1001); // y_bottom, Symmetry/Wall
} else if (current_id == 3) {
cell->face(face)->set_boundary_id (1001); // y_top, Wall
} else {
std::abort();
}
}
}
}

// Create DG object
std::shared_ptr < DGBase<dim, double> > dg = DGFactory<dim,double>::create_discontinuous_galerkin(&param, poly_degree, &grid);


// Initialize coarse grid solution with free-stream
dg->allocate_system ();
// Initialize coarse grid solution with free-stream
dealii::VectorTools::interpolate(dg->dof_handler, initial_conditions, dg->solution);

// Create ODE solver and ramp up the solution from p0
std::shared_ptr<ODE::ODESolver<dim, double>> ode_solver = ODE::ODESolverFactory<dim, double>::create_ODESolver(dg);
ode_solver->initialize_steady_polynomial_ramping(poly_degree);

for (unsigned int igrid=0; igrid<n_grids; ++igrid) {

// Interpolate solution from previous grid
if (igrid>0) {
dealii::LinearAlgebra::distributed::Vector<double> old_solution(dg->solution);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ subsection manufactured solution convergence study
set degree_start = 1

# Initial grid of size (initial_grid_size)^dim
set initial_grid_size = 2
set initial_grid_size = 4

# Number of grids in grid study
set number_of_grids = 4
Expand Down

0 comments on commit eed8d88

Please sign in to comment.