Skip to content

Commit

Permalink
Decaying homogeneous isotropic turbulence (#194)
Browse files Browse the repository at this point in the history
* ESFR Split forms. Contains all unsteady unit and integration tests. Makes use of operators in DG strong. Provides weight-adjusted curvilinear Mass matrices. Includes free-stream preserving metric terms.

* Removed the accidentally pushed mesh file. Will rebase last 4 commits into 1.

* Cleaning up the accidental added line at end of some files and removed #if 0 #endif commented blocks.

* And this file deleted last line.

* Finished removing #if 0 #endif blocks, added some comments and included new numerical fluxes in the numerical_flux_conservation test.

* Apply suggestions from code review

dg.cpp minor edits

* Implemented sum factorization in operators class. All operations can be written as a combination of matrix-vector products and inner products. A unit test verifies by testing the cputime for A*u and also M*u where M is a mass matrix--uses both matrix-vector product and inner product forms. All that is left is to clean up the unit test a bit to fail at wrong orders.

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

* Update src/parameters/all_parameters.cpp

* Update with all changes requested from pull request. Only missing merge conflict with ode solver base then pull request changes complete.

* Small cleanup changes before I merge upstream master in my branch.

* Made corrections to explicit ode solver with Butcher tableau c values. Updated unsteady tests. Continued to clean up and removed deprecated Burgers Rewienski lines.

* Cleaned up last few comments on pull request wrt Flux reconstruction operators and flags.

* Removed old references to Runge-Kutta order.

* Cleaned up re-used code in operators, and other comments from PR.

* Removed collection tuple from dg. Removed finite element and quadrature collections from DG. Made consistent throughout the code to call operators finite element and quadrature collections from the operators collection tuple.

* Fixed typos in error messages.

* Created initial condition base class with interpolate and projection capabilities for different initial condition functions. This generalizes the initial condition class.

* Turned axuiliary mass matrix into a single rather than array of dim because we use the same mass matrix for each dim direction. This reduces memory consumption.

* Templated initial condition base by nstate and the functions therein.

* Added a strong form Navier-Stokes integration test.

* Made mapping support points arrays instead of vectors. Added flag in dg allocate system for the implicit matrix/vectors to allocate to reduce memory costs.

* Fix minor changes from Pranshul.

* Small update. Switching branch for other work.

* Auxiliary variable correctly computed for NAvier-Stokes equation now. Verified through viscous TGV test strong.

* Fixed small compiling error.

* Fix TGV viscous strong control file

* Strong viscous TGV energy check test confirmed pass.

* Added definitions for projection.

* Changed initial condition base to just initial condition since nothing is derived from it.

* Current status of new operators backup

* Made entropy conserving flux work for all physics types. Will return to my other branch with restructuring operators class for efficiency now.

* Recent version, new operators quarter done.

* For energy tests, only initializes ode solver on first iteration now.

* For Julien to debug his flow solver case. I will revert these changes after so that the test case is mroe reasonable when using ctests.

* Fixed the Burgers' energy inviscid initial condition.

* Fixed stash error

* Apply suggestions from code review

* cleaning up InitialCondition; changed to SetInitialCondition

* removing commented lines from previous commit

* fixing bug that would run two tgv energy check quick tests

* cleaning up src/parameter/ files; fixing comments marked as fixed that were not actually fixed

* minor editorial changes

* correcting all_parameters.cpp from last commit; indentation and doxygen fixes

* indentation clean up in unit tests and euler split tgv

* cleaning up src/testing/ files

* removing unused CurvManifold class declaration in advection_explicit_periodic.h

* changing tabs to spaces in burgers_stability.cpp

* cleaning up ConvectionDiffusionPeriodic class files in src/testing/

* reducing code repetition in CMakeList for flow_variable_tests

* reviewing src/dg, src/numerical_flux, and src/ode_solver/ files; moving all convective num fluxes to convective_numerical_flux.<cpp/hpp>; converting tabs to spaces in convective_numerical_flux.cpp; general clean up in numerical flux directory; indentation fixes

* New operators class completed with passing unit tests. Only unit tests to change atm are sum factorization, metric splitting and weight adjusted inverse. Next step is to deprecate the previous operators class and make respective changes throughout dg, tests etc.

* reviewing src/mesh/grids files

* making repeated constants class members in NonsymmetricCurvedGridManifold

* correcting "set test_type = flow_solver" to "set run_type = flow_simulation" in prm files

* The sum factorization test.

* Changed mapping shape functions class so metric operators less variables pass to construct.

* fixing time refinement study parameter file

* New operators class complete with top-nothc efficiency :)

* adding print statements for operators allocation status

* adding forgotten print statements

* comment fix

* resolving a PR comment

* Implemented new operators class throughout DG/DG strong. All that is left is having it pass the tests. It currently compiles.

* I have DG strong conservative working, now need to tweak split forms and pass all tests.

* Conservative DG works 2D curvilinear. Now need cuvilinear split form to work properly, then will do auxtesting/tgv and finito.

* Got curvilinear stability and weight-adjusted curvilinear working perfectly. Now only needs to pass auxiliary/conv_diff explicit and it's all done!

* 3D TGV works. Now just auxiliary.

* bug fix for writing pvtu files in subdirectory

* setting default value for WALE model constant to that recommended by literature

* Auxiliary and conv diffusion passes.

* Inverse mass on the fly and mass evaluated on the fly in application per cell done. Only doesnt work for curvilinear at the moment. Has flag to use. For curvilinear, do not use inverse on the fly yet. Works perfectly for linear grids.

* 2pt flux Hadamard sum after the Hadamard product now O n^d+1. All is finished.

* Made mass matrix computation more efficient. FINALLY PASSES NACA 0012 OPTIMIZATION I'm so happy!

* compiles. Have not yet tested since the merge.

* Fixed TGV Euler split form test that got stuff deleted during the merge. Also, in mass matrix DG, changed condition of factoring out det of Jac by Cartesian element rather than linear. This is because unstructured linear meshes do NOT have a constant metric Jacobian determinant, only Cartesian meshes do. Will run ctest and clean up documentation now.

* Moved the entropy consevring, entropy stable split, and central numerical fluxes into convective numerical flux.

* Changed tabs to spaces in burgers epxlicit test.

* Added documentation equations to DG strong.

* Modified TGV split test to use initial condition TGV function.

* Fixed Polynomial degree ramping issue.

* Run curvilinear mesh on Narval. Also, made 3D periodic nonsymm curv grid.

* Added energy file declaration from control file. Also increased warping of grid.

* small clean up

* fixing pde_type flag in strong dg

* correcting initial condition setting in split tgv

* Finished with curv TGV work for conference

* 1D_BURGERS_STABILITY_ORDERS_OF_ACCURACY_LONG passing

* 1D_TIME_REFINEMENT_STUDY_ADVECTION_EXPLICIT now passes and behaves as supposed to.

* 1D periodic now CONFIRMED to work with dealii matched faces. Thus, the hardcoded 1D periodic was removed. All tests that are affected by this pass.

* Viscous TGV energy check quick STRONG passing.

* Smoothed out auxiliary test to reach asymptotic convergence in L infinity norm in a reasonable time/grid level.

* Unit test verifying DG Strong Auxiliary equations' right-hand-side for d\in[1,3], for Navier-Stokes equations.

* Fixed CMake files and cleaned up the include header files in unit test.

* Resolved conflicts from merge that caused the tests to fail. Tests are passing now.

* Removed use_strong_form flag in dg.cpp. Instead uses polymorphism to build operators needed for strong or fevalues needed for weak and assembles the residual functions therein. Also, corrected parameter files for advection unsteady weight adjusted curvilinear tests.

* Made a few small minor changes to operators.

* Small bug fix I saw.

* fixing Gaussian bump flow case merge commit; related tests now passing

* adding physics_model to use_aux_equation flag

* Refactoring NumericalFluxConvective

* introducing has_nonzero_diffusion bool in physics

* assigning has_nonzero_diffusion to use_auxiliary_eqn

* bug fix

* Added viscous pseudotime to converge the diffusion with explicit steady state (both weak and strong needed this). Added the max_dt_cell for strong form calculation. Verified the boundary integrals in strong form. Fully verified viscous strong form, with energy tests recovering the exact provable stability bound to machine precision. Added a central viscous flux to achieve the exact provable stability condition.

* Fixed 3D periodic nonsymmetric grid. Setup TGV for curvilinear grid. Fixed bug in weight-adjusted on-the-fly for curvilinear and now passes both 2D and 3D tests. Added condition for sum-factorization tests for cpu orders of convergence.

* improving MPI_VISCOUS_TAYLOR_GREEN_VORTEX_RESTART_FROM_PARAMETER_FILE_CHECK

* Update. Switching branches.

* Added check for convergence in Hadamard product sum-factorized test. The test is still the same but it checks if the computed error was off because it didn't consider enough polynomial points.

* This always passes.

* Speed up TGV run.

* Fixed bug with diffusion implicit convergence times.

* Cleaned up TGV test for curvilinear grid.

* Fix nonsymmetric grid for 2D advection, the 1/5 was too much warping, changed back to 1/10.

* Adding Ismail-Roe split form convective numerical flux; introducing parameter 'two_point_num_flux_type'.

* FlowSolver using set_initial_condition; can be used for curvilinear grids now

* adding safeguard for parameter: number_of_grid_elements_per_dimension

* Fixed projection IC for multi-state.

* The test parameter file for multi-state curvilinear projection.

* renaming "entropy_conserving_flux" to "two_point_flux"

* using pcout in ODE factory

* adding set_initial_condition_method parameter

* progress on reading the file

* adding read_values_from_file_and_project to SetInitialCondition class; code compiles -- ready to be tested for reading in serial

* dhit test files

* successfully reading DHIT flow setup file and projecting values to initialize solution; need to clean up this commit

* reading files in parallel; MPI test passing

* cleaning up set_initial_condition constructor, adding parameters for reading files and DHIT flow case, cleaning up test file, adding gdown script to get files

* adding output_velocity_field()

* bug fixes

* setter/getter for time_step in FlowSolverCaseBase, outputting velocity field at hard-coded times for DHIT case

* Outputting velocity field at a general set of times via input parameters

* fixing seg fault

* successfully preparing velocity field output files

* adding output_high_order_grid parameter

* interpolating velocity field to equidistant nodes for output

* introducing parameter output_velocity_at_equidistant_nodes

* adding constant_time_step parameter for TGV DNS verification

* minor merge fix

* bug fix in parameters for constant_time_step

* updating ode_solver_type in missed prm files from explicit to runge_kutta; all tests expected to pass are passing

* allowing for negative grid bounds; needed for verifying viscous TGV

* Fixing bug which adds dissipation to Euler

* Test to confirm conservation of entropy

* PR comments re: entropy check test

* Changing physics per PR comments; using isothermal TGV initialization

* Adding comment re: MPI behaviour of dot product.

* Move entropy calculation into physics

* Fixing an accidental change

* Addressing final PR comments

* fixing ctest command for TGV restart tests when MPIMAX is not a power of 2

* setting output_high_order_grid to false by default

* removing commented code in tgv shell script

* Bug fixed for auxiliary rhs test to work with general processors.

* Small fix from last commit.

* Modify vtk output to write higher-order on straight grids

* Add time data in unsteady flow solver

* PeriodicTurbulence Adaptive Time Step MPI Bug Fix (#3)

* flipping sign on viscous flux

* reverting sign flip on viscous flux

* renaming mean_specific_energy and trying equivalent pressure gradient method

* unused var fix

* removing misleading compute_dimensional_temperature

* const member initialization for sutherlands law temperatures

* bug fix for adaptive time step; using MPI max

* making temperature_inf an input parameter that must be consistent with the Prandtl number

* removing commented code in header

* doxygen fix

* renaming parameter set_initial_condition_method to apply_initial_condition_method

* adding strain rate based dissipation rate to the integrated quantities

* writing vorticity field

* updating job_compile_PHiLiP for faster queue times

* adding script for getting flow initialization files on cluster

* adding documentation for getting the flow initialization files

* fixing initialization of adaptive time step

* error fix in last commit

* adding data table for storing the exact output times for the velocity field files

* adding output_flow_field_files_directory_name parameter

* adding option to use constant viscosity

* Printing message when negative pressure, density, or entropy is encountered

* bug fix for outputting at equidistant nodes

* adding option to output the solution files (.vtu) at the velocity field output times

* changing int to unsigned int for file indexing in flow solver

* setting proper index of current desired time for output velocity field when restarting the computation

* adding timer to flow solver unsteady component

* correcting LES filter width

* closing issue 72

* additional merge fix

* minor edit

* fixing DHIT prm files; all tests passing that should be

* adding timer start/stop message

* addressing comment on src/dg/artificial_dissipation.h

* adding check_positive functions in euler.cpp

* merge fix

* correcting comment header

* removing mpi comment for table handler

* addressing PR comments

* adding DHIT test case files input files to gitignore

* Correction to `output_flow_field` (#7)

* Initial progress towards fixing the way soln_grad was computed at equidistant nodes

* cleaning up code, removing output_velocity_field_at_equidistant_nodes parameter since always will be true

* writing vorticity for mpi test as well

---------

Co-authored-by: Alexander <alexander@localhost.localdomain>
Co-authored-by: AlexanderCicchino <alexander.cicchino@mail.mcgill.ca>
Co-authored-by: A. Cicchino <39313421+AlexanderCicchino@users.noreply.github.com>
Co-authored-by: Carolyn <c.pethrick@gmail.com>
  • Loading branch information
5 people committed Feb 24, 2023
1 parent 5e0ad01 commit 1e45900
Show file tree
Hide file tree
Showing 68 changed files with 1,555 additions and 247 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ build*/
.vscode/settings.json
src/.vscode/settings.json
src/dummy/*
tests/integration_tests_control_files/decaying_homogeneous_isotropic_turbulence/setup_files/1proc/*.dat
tests/integration_tests_control_files/decaying_homogeneous_isotropic_turbulence/setup_files/4proc/*.dat
7 changes: 6 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ If you are running the code **on a local machine** (i.e. not on the cluster), yo
4. Then run the following bash script inside the `PHiLiP` directory:
`chmod +x get_NACA0012_mesh_files_local.sh`
`./get_NACA0012_mesh_files_local.sh`
5. Download flow initialization files by running the following bash script inside the `PHiLiP` directory:
`chmod +x get_flow_initialization_files_local.sh`
`./get_flow_initialization_files_local.sh`

## deal.II

Expand Down Expand Up @@ -92,10 +95,12 @@ The deal.II library has been setup with the following options:

This section is aimed at McGill's group who use the Compute Canada (CC) clusters.

If you have just cloned the code onto the cluster, **you must copy the large NACA0012 mesh files** that cannot be stored on GitHub, this can be done by explicitly running the following:
If you have just cloned the code onto the cluster, **you must copy the large NACA0012 mesh files and flow initialization files** that cannot be stored on GitHub, this can be done by explicitly running the following:
~~~~
chmod +x get_NACA0012_mesh_files_cluster.sh
./get_NACA0012_mesh_files_cluster.sh
chmod +x get_flow_initialization_files_cluster.sh
./get_flow_initialization_files_cluster.sh
~~~~
If you are a **new user on a CC cluster**, **you must configure git modules** by explicitly running the following on the cluster before proceeding:
~~~~
Expand Down
5 changes: 5 additions & 0 deletions doc/install_ubuntu2004_VM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ mkdir -p Codes
chmod +x get_NACA0012_mesh_files_local.sh
sh get_NACA0012_mesh_files_local.sh ;\

# Get flow initialization files. Note: Run get_flow_initialization_files_cluster.sh to get files on the cluster.
# If not already installed, gdown can be installed as explained in INSTALL.md.
chmod +x get_flow_initialization_files_local.sh
sh get_flow_initialization_files_local.sh ;\

# Release build with all the optimization flags
mkdir -p build_release && cd build_release ;\
# MPI_MAX is the number of cores to use by default for tests with MPI
Expand Down
8 changes: 8 additions & 0 deletions get_flow_initialization_files_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This must be ran at once whenever a clone of PHiLiP is made onto the cluster
# DESCRIPTION: Copies the large flow initialization files that cannot be stored on GitHub
# NOTE: This is currently setup only for the Narval cluster
PATH_TO_FILES=~/projects/def-nadaraja/Libraries/flow_initialization_files

TARGET_DIR=tests/integration_tests_control_files/decaying_homogeneous_isotropic_turbulence/setup_files/
cp ${PATH_TO_FILES}/1proc/* ${TARGET_DIR}/1proc/
cp ${PATH_TO_FILES}/4proc/* ${TARGET_DIR}/4proc/
15 changes: 15 additions & 0 deletions get_flow_initialization_files_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TARGET_DIR_BASE=tests/integration_tests_control_files/decaying_homogeneous_isotropic_turbulence/setup_files/
TARGET_DIR=${TARGET_DIR_BASE}1proc/
gdown 1YSvCzz2P3tsIQ1E6G9ZGTvJFSn4cjZaQ # setup_philip-00000.dat
mv setup_philip-00000.dat ${TARGET_DIR}

TARGET_DIR=tests/integration_tests_control_files/decaying_homogeneous_isotropic_turbulence/setup_files/4proc/
TARGET_DIR=${TARGET_DIR_BASE}4proc/
gdown 1daHBpZMyClJ5DXRuZGw-iPmID20TLmjp # setup_philip-00000.dat
gdown 1CPsUS8QGXxAHlutgi2pBuOHU7AfuZvDz # setup_philip-00001.dat
gdown 1-q_znN9N4VsPfeUe7CIdFuG2Gt-GO3gN # setup_philip-00002.dat
gdown 1oJhZeopd66IbBHepbqlJZWEMNZKECage # setup_philip-00003.dat
mv setup_philip-00000.dat ${TARGET_DIR}
mv setup_philip-00001.dat ${TARGET_DIR}
mv setup_philip-00002.dat ${TARGET_DIR}
mv setup_philip-00003.dat ${TARGET_DIR}
120 changes: 110 additions & 10 deletions src/dg/artificial_dissipation.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,61 @@ class PhysicalArtificialDissipation: public ArtificialDissipationBase <dim, nsta
public:
/// Constructor of PhysicalArtificialDissipation.
PhysicalArtificialDissipation(const Parameters::AllParameters *const parameters_input): //input_parameters(parameters_input) {}
navier_stokes_double(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_FadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_RadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_FadFadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_RadFadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0)
navier_stokes_double(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_FadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_RadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_FadFadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_RadFadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf)
{}

/// Destructor of PhysicalArtificialDissipation
Expand Down Expand Up @@ -217,11 +267,61 @@ class EnthalpyConservingArtificialDissipation: public ArtificialDissipationBase
public:
/// Constructor of EnthalpyConservingArtificialDissipation
EnthalpyConservingArtificialDissipation(const Parameters::AllParameters *const parameters_input): //input_parameters(parameters_input) {}
navier_stokes_double(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_FadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_RadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_FadFadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0),
navier_stokes_RadFadType(parameters_input->euler_param.ref_length,parameters_input->euler_param.gamma_gas,parameters_input->euler_param.mach_inf,parameters_input->euler_param.angle_of_attack, parameters_input->euler_param.side_slip_angle,0.75,1.0)
navier_stokes_double(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_FadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_RadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_FadFadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf),
navier_stokes_RadFadType(
parameters_input->euler_param.ref_length,
parameters_input->euler_param.gamma_gas,
parameters_input->euler_param.mach_inf,
parameters_input->euler_param.angle_of_attack,
parameters_input->euler_param.side_slip_angle,
0.75,
1.0,
parameters_input->navier_stokes_param.use_constant_viscosity,
parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
parameters_input->navier_stokes_param.temperature_inf)
{}

/// Destructor of EnthalpyConservingArtificialDissipation
Expand Down
37 changes: 25 additions & 12 deletions src/flow_solver/flow_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "reduced_order/pod_basis_offline.h"
#include "physics/initial_conditions/set_initial_condition.h"
#include "mesh/mesh_adaptation.h"
#include <deal.II/base/timer.h>

namespace PHiLiP {

Expand Down Expand Up @@ -76,12 +77,12 @@ FlowSolver<dim, nstate>::FlowSolver(
dg->solution = solution_no_ghost; //< assignment
#endif
} else {
// Initialize solution from initial_condition_function
pcout << "Initializing solution with initial condition function... " << std::flush;
// Initialize solution
SetInitialCondition<dim,nstate,double>::set_initial_condition(flow_solver_case->initial_condition_function, dg, &all_param);
}
dg->solution.update_ghost_values();
pcout << "done." << std::endl;

// Allocate ODE solver after initializing DG
ode_solver->allocate_ode_system();

// output a copy of the input parameters file
Expand Down Expand Up @@ -113,11 +114,11 @@ std::vector<std::string> FlowSolver<dim,nstate>::get_data_table_column_names(con
}

template <int dim, int nstate>
std::string FlowSolver<dim,nstate>::get_restart_filename_without_extension(const int restart_index_input) const {
std::string FlowSolver<dim,nstate>::get_restart_filename_without_extension(const unsigned int restart_index_input) const {
// returns the restart file index as a string with appropriate padding
std::string restart_index_string = std::to_string(restart_index_input);
const unsigned int length_of_index_with_padding = 5;
const int number_of_zeros = length_of_index_with_padding - restart_index_string.length();
const unsigned int number_of_zeros = length_of_index_with_padding - restart_index_string.length();
restart_index_string.insert(0, number_of_zeros, '0');

const std::string prefix = "restart-";
Expand Down Expand Up @@ -188,7 +189,7 @@ std::string FlowSolver<dim,nstate>::double_to_string(const double value_input) c

template <int dim, int nstate>
void FlowSolver<dim,nstate>::write_restart_parameter_file(
const int restart_index_input,
const unsigned int restart_index_input,
const double time_step_input) const {
// write the restart parameter file
if(mpi_rank==0) {
Expand Down Expand Up @@ -311,7 +312,7 @@ void FlowSolver<dim,nstate>::write_restart_parameter_file(
#if PHILIP_DIM>1
template <int dim, int nstate>
void FlowSolver<dim,nstate>::output_restart_files(
const int current_restart_index,
const unsigned int current_restart_index,
const double time_step_input,
const std::shared_ptr <dealii::TableHandler> unsteady_data_table) const
{
Expand Down Expand Up @@ -401,14 +402,15 @@ int FlowSolver<dim,nstate>::run() const
time_step = flow_solver_case->get_constant_time_step(dg);
} else {
pcout << "Setting initial adaptive time step... " << std::flush;
time_step = flow_solver_case->get_adaptive_time_step(dg);
time_step = flow_solver_case->get_adaptive_time_step_initial(dg);
}
}
flow_solver_case->set_time_step(time_step);
pcout << "done." << std::endl;
//----------------------------------------------------
// dealii::TableHandler and data at initial time
//----------------------------------------------------
std::shared_ptr<dealii::TableHandler> unsteady_data_table = std::make_shared<dealii::TableHandler>();//(mpi_communicator) ?;
std::shared_ptr<dealii::TableHandler> unsteady_data_table = std::make_shared<dealii::TableHandler>();
if(flow_solver_param.restart_computation_from_file == true) {
pcout << "Initializing data table from corresponding restart file... " << std::flush;
const std::string restart_filename_without_extension = get_restart_filename_without_extension(flow_solver_param.restart_file_index);
Expand All @@ -425,10 +427,16 @@ int FlowSolver<dim,nstate>::run() const
// Time advancement loop with on-the-fly post-processing
//----------------------------------------------------
pcout << "Advancing solution in time... " << std::endl;
pcout << "Timer starting. " << std::endl;
dealii::Timer timer(this->mpi_communicator,false);
timer.start();
while((ode_solver->current_time) < (final_time - 1E-13)) //comparing to 1E-13 to avoid taking an extra timestep
{
// update adaptive time step
if(flow_solver_param.adaptive_time_step == true) time_step = flow_solver_case->get_adaptive_time_step(dg);
if(flow_solver_param.adaptive_time_step == true) {
time_step = flow_solver_case->get_adaptive_time_step(dg);
flow_solver_case->set_time_step(time_step);
}

// advance solution
ode_solver->step_in_time(time_step,false); // pseudotime==false
Expand All @@ -443,14 +451,14 @@ int FlowSolver<dim,nstate>::run() const
const bool is_output_time = ((ode_solver->current_time <= current_desired_time_for_output_restart_files_every_dt_time_intervals) &&
((ode_solver->current_time + time_step) > current_desired_time_for_output_restart_files_every_dt_time_intervals));
if (is_output_time) {
const int file_number = current_desired_time_for_output_restart_files_every_dt_time_intervals / flow_solver_param.output_restart_files_every_dt_time_intervals;
const unsigned int file_number = current_desired_time_for_output_restart_files_every_dt_time_intervals / flow_solver_param.output_restart_files_every_dt_time_intervals;
output_restart_files(file_number, time_step, unsteady_data_table);
current_desired_time_for_output_restart_files_every_dt_time_intervals += flow_solver_param.output_restart_files_every_dt_time_intervals;
}
} else /*if (flow_solver_param.output_restart_files_every_x_steps > 0)*/ {
const bool is_output_iteration = (ode_solver->current_iteration % flow_solver_param.output_restart_files_every_x_steps == 0);
if (is_output_iteration) {
const int file_number = ode_solver->current_iteration / flow_solver_param.output_restart_files_every_x_steps;
const unsigned int file_number = ode_solver->current_iteration / flow_solver_param.output_restart_files_every_x_steps;
output_restart_files(file_number, time_step, unsteady_data_table);
}
}
Expand All @@ -476,6 +484,11 @@ int FlowSolver<dim,nstate>::run() const
}
}
} // close while
timer.stop();
pcout << "Timer stopped. " << std::endl;
const double max_wall_time = dealii::Utilities::MPI::max(timer.wall_time(), this->mpi_communicator);
pcout << "Elapsed wall time (mpi max): " << max_wall_time << " seconds." << std::endl;
pcout << "Elapsed CPU time: " << timer.cpu_time() << " seconds." << std::endl;
} else {
//----------------------------------------------------
// Steady-state solution
Expand Down
Loading

0 comments on commit 1e45900

Please sign in to comment.