Skip to content

Commit

Permalink
Add time average temperature and time average heat flux to simulation…
Browse files Browse the repository at this point in the history
… output (#1395)

Description
Time averaged temperature can now be attached to the vtus using a new parameter in the post-processing subsection.

A new object AverageScalarInTime has been created. It can be used to calculate the time average temperature from a certain point in time. This object is greatly inspired by the AverageVelocity object in postprocessing_velocity.h.

The average heat transfer is then computed using the computed average temperature and the HeatFluxPostProcessor object.

Testing
Two new tests have been added.

heat_transfer_average_temperature -> Launch an application test to verify no problem using the object. Segfaults, parameter name, etc.
average_scalar_01.release -> to verify the computed average actually corresponds to the average of a scalar.
Documentation
Post processing subsection has been modified ta take into account the new parameter. The two new parameters are
calculate average temperature and average heat flux = true
initial time for average temperature and average heat flux = 0.0
  • Loading branch information
mivaia authored Dec 16, 2024
1 parent 1e4794a commit 02ef782
Show file tree
Hide file tree
Showing 51 changed files with 1,149 additions and 120 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

### Added

- MINOR A new post-processing code is now available for the rotating drum example. This code output the average velocity profile of particles perpendicular to the free surface.
- MINOR A new post-processing code is now available for the rotating drum example. This code output the average velocity profile of particles perpendicular to the free surface. [#1394](https://github.com/chaos-polymtl/lethe/pull/1394)

- MINOR Time averaged temperature can now be attached to the vtus using a new parameter in the post-processing subsection. A new object AverageScalar has been created. It can be used to calculate the time average temperature from a certain point in time. [#1395](https://github.com/chaos-polymtl/lethe/pull/1395)

## [Master] - 2024-12-03

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ end
#---------------------------------------------------

subsection post-processing
set verbosity = verbose
set calculate kinetic energy = true
set calculate enstrophy = true
set calculate average velocities = false
set initial time = 0.
set verbosity = verbose
set calculate kinetic energy = true
set calculate enstrophy = true
set calculate average velocities = false
set initial time for average velocity = 0.
end

#---------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ subsection post-processing
# Enstrophy calculation
set calculate enstrophy = true

set calculate average velocities = false
set initial time = 0.
set calculate average velocities = false
set initial time for average velocity = 0.
end

#---------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions applications_tests/lethe-fluid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ file(COPY heat_transfer_vof_lpbf_benchmark_box_ref_restart_files/restart.triangu
file(COPY heat_transfer_vof_lpbf_benchmark_box_ref_restart_files/mass_conservation_information.checkpoint DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_vof_lpbf_benchmark_box_ref.${_build_type}/mpirun=1/")
file(COPY heat_transfer_vof_lpbf_benchmark_box_ref_restart_files/temperature_statistics.checkpoint DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_vof_lpbf_benchmark_box_ref.${_build_type}/mpirun=1/")

file(COPY heat_transfer_average_temperature_restart_files/L2Error_FD.checkpoint DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/L2Error_HT.checkpoint DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/restart.averagescalar DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/restart.pvdhandler DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/restart.simulationcontrol DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/restart.triangulation DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/restart.triangulation_fixed.data DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")
file(COPY heat_transfer_average_temperature_restart_files/restart.triangulation.info DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/heat_transfer_average_temperature.${_build_type}/mpirun=1/")

deal_ii_pickup_tests()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ end
#---------------------------------------------------

subsection post-processing
set verbosity = verbose
set calculate temperature statistics = true
set calculate average velocities = true
set initial time = 0.1
set calculate mass conservation = false
set verbosity = verbose
set calculate temperature statistics = true
set calculate average velocities = true
set initial time for average velocity = 0.1
set calculate mass conservation = false
end

#---------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ end
#---------------------------------------------------

subsection post-processing
set calculate average velocities = true
set initial time = 1.5
set calculate average velocities = true
set initial time for average velocity = 1.5
end

#---------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Running on 1 MPI rank(s)...
Number of active cells: 1
Number of degrees of freedom: 12
Volume of triangulation: 0.001
Number of thermal degrees of freedom: 4
************************
---> Simulation Restart
************************
Number of active cells: 1408
Number of degrees of freedom: 4623
Volume of triangulation: 0.001
Number of thermal degrees of freedom: 1541
Reading heat transfer checkpoint

*******************************************************************************
Transient iteration: 3 Time: 0.03 Time step: 0.01 CFL: 0
*******************************************************************************
L2 error velocity: 0
L2 error temperature : 1.00274e-06

*******************************************************************************
Transient iteration: 4 Time: 0.04 Time step: 0.01 CFL: 0
*******************************************************************************
Number of active cells: 1792
Number of degrees of freedom: 5979
Volume of triangulation: 0.001
Number of thermal degrees of freedom: 1993
L2 error velocity: 0
L2 error temperature : 2.32585e-08

*******************************************************************************
Transient iteration: 5 Time: 0.05 Time step: 0.01 CFL: 0
*******************************************************************************
L2 error velocity: 0
L2 error temperature : 5.39828e-10
time error_velocity
0.0100 0.000000e+00
0.0200 0.000000e+00
0.0300 0.000000e+00
0.0400 0.000000e+00
0.0500 0.000000e+00
cells error_temperature
1024 1.964712e-03
1408 4.344287e-05
1408 1.002740e-06
1792 2.325845e-08
1792 5.398281e-10
221 changes: 221 additions & 0 deletions applications_tests/lethe-fluid/heat_transfer_average_temperature.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 The Lethe Authors
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later

# Verify if the time average temperature calculation leads to a segfault. It contains some . The validity of the temperature average is tested in tests/solvers. This is the heat_transfer_conduction in solid test. The subsections post-processing, mesh refinement have and restart have been added.

# Listing of Parameters
#----------------------

set dimension = 2

#---------------------------------------------------
# Simulation Control
#---------------------------------------------------

subsection simulation control
set method = bdf1
set time end = 0.05
set time step = 0.01
set number mesh adapt = 0
set output name = conduction
set output frequency = 0
end

#---------------------------------------------------
# Multiphysics
#---------------------------------------------------

subsection multiphysics
set heat transfer = true
end

#---------------------------------------------------
# Initial condition
#---------------------------------------------------

subsection initial conditions
set type = nodal
subsection uvwp
set Function expression = 0; 0; 0
end
subsection temperature
set Function expression = 30
end
end

#---------------------------------------------------
# Physical Properties
#---------------------------------------------------

subsection physical properties
set number of fluids = 1
subsection fluid 0
set thermal conductivity model = constant
set thermal conductivity = 60
set specific heat model = constant
set specific heat = 20
set density = 2000
set kinematic viscosity = 0.01
end
end

#---------------------------------------------------
# Mesh
#---------------------------------------------------

subsection mesh
set type = dealii
set grid type = subdivided_hyper_rectangle
set grid arguments = 1, 1: 0, 0 : 0.01, 0.1 : true
set initial refinement = 5
end

#---------------------------------------------------
# Mesh adaptation
#---------------------------------------------------

subsection mesh adaptation
set type = kelly
set variable = temperature
set frequency = 2
end

#---------------------------------------------------
# Boundary Conditions
#---------------------------------------------------

subsection boundary conditions
set number = 4
subsection bc 0
set id = 0
set type = noslip
end
subsection bc 1
set id = 1
set type = noslip
end
subsection bc 2
set id = 2
set type = noslip
end
subsection bc 3
set id = 3
set type = noslip
end
end

subsection boundary conditions heat transfer
set number = 4
subsection bc 0
set id = 0
set type = temperature
subsection value
set Function expression = 50
end
end
subsection bc 1
set id = 1
set type = temperature
subsection value
set Function expression = 10
end
end
subsection bc 2
set id = 2
set type = noflux
end
subsection bc 3
set id = 3
set type = noflux
end
end

#---------------------------------------------------
# Analytical Solution
#---------------------------------------------------

subsection analytical solution
set enable = true
set verbosity = verbose
subsection uvwp
set Function expression = 0 ; 0 ; 0
end
subsection temperature
set Function expression = 50 - (40/0.01) * x
end
set filename = L2Error #heat_transfer_average_temperature_restart_files/L2Error
end

#---------------------------------------------------
# Subsection post-processing
#---------------------------------------------------

subsection post-processing
set calculate average temperature and heat flux = true
end

#---------------------------------------------------
# Subsection restart
#---------------------------------------------------

subsection restart
set checkpoint = false
set frequency = 1
set filename = restart #heat_transfer_average_temperature_restart_files/restart
set restart = true
end

#---------------------------------------------------
# FEM
#---------------------------------------------------

subsection FEM
set velocity order = 1
set pressure order = 1
end

#---------------------------------------------------
# Non-Linear Solver Control
#---------------------------------------------------

subsection non-linear solver
subsection heat transfer
set tolerance = 1e-8
set max iterations = 100
set verbosity = quiet
end
subsection fluid dynamics
set tolerance = 1e-8
set max iterations = 100
set verbosity = quiet
end
end

#---------------------------------------------------
# Linear Solver Control
#---------------------------------------------------

subsection linear solver
subsection fluid dynamics
set verbosity = quiet
set method = gmres
set relative residual = 1e-3
set minimum residual = 1e-8
set preconditioner = ilu
set ilu preconditioner fill = 0
set ilu preconditioner absolute tolerance = 1e-12
set ilu preconditioner relative tolerance = 1.00
set max krylov vectors = 200
end
subsection heat transfer
set verbosity = quiet
set method = gmres
set relative residual = 1e-3
set minimum residual = 1e-8
set preconditioner = ilu
set ilu preconditioner fill = 0
set ilu preconditioner absolute tolerance = 1e-12
set ilu preconditioner relative tolerance = 1.00
set max krylov vectors = 200
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 0 0 0 2 0 4 time 14 error_velocity 0 0 2 0 0 0 14 error_velocity 0 0 0 0 2 0 0 0 100 0.00000000000000000e+00 100 0.00000000000000000e+00 14 error_velocity 1 c 4 0 0 6 4 time 2 0 100 1.00000000000000002e-02 100 2.00000000000000004e-02 4 time 1 c 4 0 0 6 0 0 0 0 0 0 0 0 0 0 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 0 0 0 2 0 5 cells 17 error_temperature 0 0 2 0 0 0 5 cells 0 0 0 0 2 0 0 0 117 1024 117 1408 5 cells 1 c 4 0 0 4 17 error_temperature 2 0 100 1.96471158322590730e-03 100 4.34428660130723653e-05 17 error_temperature 1 c 4 0 0 6 0 0 0 0 0 0 0 0 0 0 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Average scalar
dt_0 0.01
Average_calculation_boolean 1
Real_initial_time 0.01
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3
Time File
0 conduction.00000.pvtu
0.01 conduction.00001.pvtu
0.02 conduction.00002.pvtu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Simulation control
dt_0 0.01
dt_1 0.01
dt_2 0.01
dt_3 0.01
CFL 0
Time 0.02
Iter 2
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version nproc n_attached_fixed_size_objs n_attached_variable_size_objs n_coarse_cells
5 1 2 0 1
Binary file not shown.
4 changes: 2 additions & 2 deletions applications_tests/lethe-fluid/poiseuille_restart.prm
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ end
#---------------------------------------------------

subsection post-processing
set calculate average velocities = true
set initial time = 1.5
set calculate average velocities = true
set initial time for average velocity = 1.5
end

#---------------------------------------------------
Expand Down
Loading

0 comments on commit 02ef782

Please sign in to comment.