Skip to content

Commit

Permalink
Fix pressure interpolation at face bug and other bugs (chaos-polymtl#…
Browse files Browse the repository at this point in the history
…1234)

Description
The new deal.II changes (more asserts) identified a nasty bug we had. The wong fe_values was being used to gather the pressure at the faces. Instead of the fe_face_values it was the fe_values. Consequently, I am really not sure what was happening there. This is now fixed.

Furthermore, there were also instances where the quadrature of the fluid dynamics in the VOF solver was not initialized with the right number of points. This has been fixed also.

Testing
Tests that were breaking in debug should work just fine now in debug.

Former-commit-id: 60c5f97
  • Loading branch information
blaisb authored Aug 8, 2024
1 parent 36cee32 commit 4ed8a76
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Transient iteration: 1 Time: 0.1 Time step: 0.1 CFL: 0
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
1.0000e-01 6.5778e-01 7.8933e-01 -1.0215e-02 2.4595e-02 3.4222e-01 3.4222e+02 9.4223e+00 -2.0719e+01 5.0000e-01
1.0000e-01 6.5778e-01 7.8933e-01 -1.0988e-02 2.4923e-02 3.4222e-01 3.4222e+02 9.1865e+00 -2.0992e+01 5.0000e-01

*******************************************************************************
Transient iteration: 2 Time: 0.2 Time step: 0.1 CFL: 1.64181
Expand All @@ -28,4 +28,4 @@ Transient iteration: 2 Time: 0.2 Time step: 0.1 CFL: 1.64181
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
2.0000e-01 6.5792e-01 7.8951e-01 -2.0654e-02 4.7001e-02 3.4208e-01 3.4208e+02 1.9095e+01 -3.9492e+01 5.0000e-01
2.0000e-01 6.5792e-01 7.8951e-01 -2.2300e-02 4.7655e-02 3.4208e-01 3.4208e+02 1.8631e+01 -4.0037e+01 5.0000e-01
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Transient iteration: 1 Time: 0.1 Time step: 0.1 CFL: 0
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
1.0000e-01 6.5778e-01 7.8933e-01 -9.3991e-03 2.3003e-02 3.4222e-01 1.7111e+01 4.2727e-01 -9.6513e-01 5.0000e-01
1.0000e-01 6.5778e-01 7.8933e-01 -1.0032e-02 2.3321e-02 3.4222e-01 1.7111e+01 4.1367e-01 -9.7834e-01 5.0000e-01

*******************************************************************************
Transient iteration: 2 Time: 0.2 Time step: 0.1 CFL: 1.53178
Expand All @@ -28,4 +28,4 @@ Transient iteration: 2 Time: 0.2 Time step: 0.1 CFL: 1.53178
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
2.0000e-01 6.5797e-01 7.8956e-01 -1.8808e-02 4.3901e-02 3.4203e-01 1.7102e+01 8.6376e-01 -1.8392e+00 5.0000e-01
2.0000e-01 6.5797e-01 7.8956e-01 -2.0043e-02 4.4484e-02 3.4203e-01 1.7102e+01 8.3614e-01 -1.8635e+00 5.0000e-01
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Running on 1 MPI rank(s)...
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
0.0000e+00 1.8246e-02 1.8246e+00 0.0000e+00 -4.1029e-02 9.8175e-01 2.9453e+02 0.0000e+00 -2.0237e-01 5.0000e-01
0.0000e+00 1.8246e-02 1.8246e+00 0.0000e+00 -3.2922e-01 9.8175e-01 2.9453e+02 0.0000e+00 -1.3561e+00 5.0000e-01

*******************************************************************************
Transient iteration: 1 Time: 0.05 Time step: 0.05 CFL: 2.23662
Expand All @@ -18,7 +18,7 @@ Transient iteration: 1 Time: 0.05 Time step: 0.05 CFL: 2.23662
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
5.0000e-02 2.0234e-02 2.0234e+00 -3.9189e-03 -2.0181e+00 9.7977e-01 2.9393e+02 6.3156e-03 -2.9388e+02 5.0000e-01
5.0000e-02 2.0234e-02 2.0234e+00 -2.9169e-03 -2.0225e+00 9.7977e-01 2.9393e+02 3.2856e-03 -2.9387e+02 5.0000e-01

*******************************************************************************
Transient iteration: 2 Time: 0.1 Time step: 0.05 CFL: 2.93874
Expand All @@ -28,7 +28,7 @@ Transient iteration: 2 Time: 0.1 Time step: 0.05 CFL: 2.93874
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
1.0000e-01 3.9912e-02 3.9912e+00 -3.8978e-03 -3.9939e+00 9.6009e-01 2.8803e+02 4.5148e-03 -2.8802e+02 5.0000e-01
1.0000e-01 3.9912e-02 3.9912e+00 -3.5140e-03 -3.9936e+00 9.6009e-01 2.8803e+02 3.3156e-03 -2.8802e+02 5.0000e-01

*******************************************************************************
Transient iteration: 3 Time: 0.15 Time step: 0.05 CFL: 2.87622
Expand All @@ -38,7 +38,7 @@ Transient iteration: 3 Time: 0.15 Time step: 0.05 CFL: 2.87622
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
1.5000e-01 6.3630e-02 6.3630e+00 -3.9225e-03 -6.3663e+00 9.3637e-01 2.8091e+02 4.0982e-03 -2.8090e+02 5.0000e-01
1.5000e-01 6.3630e-02 6.3630e+00 -3.6771e-03 -6.3660e+00 9.3637e-01 2.8091e+02 3.2889e-03 -2.8090e+02 5.0000e-01

*******************************************************************************
Transient iteration: 4 Time: 0.2 Time step: 0.05 CFL: 2.86088
Expand All @@ -48,7 +48,7 @@ Transient iteration: 4 Time: 0.2 Time step: 0.05 CFL: 2.86088
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
2.0000e-01 8.8567e-02 8.8567e+00 -3.9013e-03 -8.8603e+00 9.1143e-01 2.7343e+02 3.3158e-03 -2.7342e+02 5.0000e-01
2.0000e-01 8.8567e-02 8.8567e+00 -3.7164e-03 -8.8601e+00 9.1143e-01 2.7343e+02 2.6607e-03 -2.7342e+02 5.0000e-01

*******************************************************************************
Transient iteration: 5 Time: 0.25 Time step: 0.05 CFL: 2.85364
Expand All @@ -58,4 +58,4 @@ Transient iteration: 5 Time: 0.25 Time step: 0.05 CFL: 2.85364
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
2.5000e-01 1.1384e-01 1.1384e+01 -3.8623e-03 -1.1388e+01 8.8616e-01 2.6585e+02 2.2532e-03 -2.6584e+02 5.0000e-01
2.5000e-01 1.1384e-01 1.1384e+01 -3.7123e-03 -1.1388e+01 8.8616e-01 2.6585e+02 1.6725e-03 -2.6584e+02 5.0000e-01
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Running on 1 MPI rank(s)...
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
0.0000e+00 8.7500e-01 8.7500e-02 7.1333e-04 0.0000e+00 1.2500e-01 1.2500e+01 4.6083e-02 0.0000e+00 5.0000e-01
0.0000e+00 8.7500e-01 8.7500e-02 5.2083e-03 0.0000e+00 1.2500e-01 1.2500e+01 2.6042e-01 0.0000e+00 5.0000e-01

---------------
VOF Barycenter
Expand All @@ -24,7 +24,7 @@ Transient iteration: 1 Time: 0.5 Time step: 0.5 CFL: 2.79578
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
5.0000e-01 8.7890e-01 8.7890e-02 5.7680e-03 1.2469e-03 1.2110e-01 1.2110e+01 1.3232e+00 1.7497e-01 5.0000e-01
5.0000e-01 8.7890e-01 8.7890e-02 1.0016e-02 1.2804e-03 1.2110e-01 1.2110e+01 1.7848e+00 1.4146e-01 5.0000e-01

---------------
VOF Barycenter
Expand All @@ -40,7 +40,7 @@ Transient iteration: 2 Time: 1 Time step: 0.5 CFL: 3.72386
VOF Mass Conservation
----------------------
time surface_fluid_0 mass_per_length_fluid_0 momentum-x_fluid_0 momentum-y_fluid_0 surface_fluid_1 mass_per_length_fluid_1 momentum-x_fluid_1 momentum-y_fluid_1 sharpening_threshold
1.0000e+00 8.2664e-01 8.2664e-02 5.7127e-03 -6.0725e-05 1.7336e-01 1.7336e+01 6.0198e+00 -3.8167e-01 5.0000e-01
1.0000e+00 8.2664e-01 8.2664e-02 8.6509e-03 -2.0948e-04 1.7336e-01 1.7336e+01 7.7909e+00 -2.3292e-01 5.0000e-01

---------------
VOF Barycenter
Expand Down
4 changes: 2 additions & 2 deletions include/solvers/navier_stokes_scratch_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ class NavierStokesScratchData
current_solution, this->face_velocity_laplacians[face]);

// Gather pressure (values, gradient)
this->fe_values[pressure].get_function_values(
this->fe_face_values[pressure].get_function_values(
current_solution, this->face_pressure_values[face]);
this->fe_values[pressure].get_function_gradients(
this->fe_face_values[pressure].get_function_gradients(
current_solution, this->face_pressure_gradients[face]);

for (unsigned int q = 0; q < n_faces_q_points; ++q)
Expand Down
4 changes: 2 additions & 2 deletions source/solvers/vof.cc
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,9 @@ VolumeOfFluid<dim>::calculate_volume_and_mass(
*this->cell_quadrature,
update_values | update_JxW_values);

QGauss<dim> quadrature_formula(this->cell_quadrature->size());
const DoFHandler<dim> *dof_handler_fd =
multiphysics->get_dof_handler(PhysicsID::fluid_dynamics);
QGauss<dim> quadrature_formula(dof_handler_fd->get_fe().degree + 1);

FEValues<dim> fe_values_fd(*this->mapping,
dof_handler_fd->get_fe(),
Expand Down Expand Up @@ -620,10 +620,10 @@ VolumeOfFluid<dim>::calculate_momentum(
*this->cell_quadrature,
update_values | update_JxW_values);

QGauss<dim> quadrature_formula(this->cell_quadrature->size());
const DoFHandler<dim> *dof_handler_fd =
multiphysics->get_dof_handler(PhysicsID::fluid_dynamics);

QGauss<dim> quadrature_formula(dof_handler_fd->get_fe().degree + 1);
FEValues<dim> fe_values_fd(*this->mapping,
dof_handler_fd->get_fe(),
quadrature_formula,
Expand Down
3 changes: 1 addition & 2 deletions tests/core/solid_base_33_moving_triangulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ test()
DataOut<3> data_out;
data_out.attach_dof_handler(solid_dh);

const bool mapping_all = true;
const MappingQ<3> mapping(1, mapping_all);
const MappingQ<3> mapping(1);
data_out.build_patches(mapping, 1, DataOut<3>::curved_inner_cells);

PVDHandler pvdhandler;
Expand Down

0 comments on commit 4ed8a76

Please sign in to comment.