Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add balance of energy #13

Merged
merged 8 commits into from
Nov 12, 2024
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(TARDIGRADE_BALANCE_EQUATIONS_USE_LIBXSMM OFF CACHE BOOL "Flag for whether to

# Set the internal support libraries
set(INTERNAL_SUPPORT_LIBRARIES )
set(ADDITIONAL_HEADER_ONLY_LIBRARIES "tardigrade_balance_of_mass" "tardigrade_balance_of_linear_momentum" "tardigrade_finite_element_utilities")
set(ADDITIONAL_HEADER_ONLY_LIBRARIES "tardigrade_balance_of_mass" "tardigrade_balance_of_linear_momentum" "tardigrade_balance_of_energy" "tardigrade_finite_element_utilities")
set(PROJECT_SOURCE_FILES ${PROJECT_NAME}.cpp ${PROJECT_NAME}.h)
set(PROJECT_PRIVATE_HEADERS "")
foreach(package ${INTERNAL_SUPPORT_LIBRARIES})
Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ New Features
- Added the calculation of the non-divergence part of the balance of linear momentum (:pull:`11`). By `Nathan Miller`_.
- Added the calculation of the divergence part of the balance of linear momentum (:pull:`11`). By `Nathan Miller`_.
- Added the multiphase balance of linear momentum (:pull:`12`). By `Nathan Miller`_.
- Added the calculation of the balance of energy for single and multiphase reacting continuum (:pull:`13`). By `Nathan Miller`_.

******************
0.1.0 (11-07-2024)
Expand Down
544 changes: 544 additions & 0 deletions src/cpp/tardigrade_balance_of_energy.cpp

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions src/cpp/tardigrade_balance_of_energy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/**
******************************************************************************
* \file tardigrade_balance_of_energy.h
******************************************************************************
* The header file for the equations associated with the balance of energy
******************************************************************************
*/

#ifndef TARDIGRADE_BALANCE_OF_ENERGY_H
#define TARDIGRADE_BALANCE_OF_ENERGY_H

#include<array>

#include "tardigrade_error_tools.h"

namespace tardigradeBalanceEquations{

namespace balanceOfEnergy{

constexpr unsigned int dim = 3; //!< Set the dimension as 3D by default

constexpr unsigned int sot_dim = dim * dim; //!< Set the dimensions of a standard second order tensor

typedef double floatType; //!< Define the float type as a double

typedef std::array< floatType, dim > floatVector; //!< Define a standard vector

typedef std::array< floatType, sot_dim > secondOrderTensor; //!< Define a standard second-order tensor

template<class floatVector_iter, class secondOrderTensor_iter>
void computeBalanceOfEnergyNonDivergence( const floatType &density, const floatType &density_dot,
const floatVector_iter &density_gradient_begin, const floatVector_iter &density_gradient_end,
const floatType &internal_energy, const floatType &internal_energy_dot,
const floatVector_iter &internal_energy_gradient_begin, const floatVector_iter &internal_energy_gradient_end,
const floatVector_iter &velocity_begin, const floatVector_iter &velocity_end,
const secondOrderTensor_iter &velocity_gradient_begin, const secondOrderTensor_iter &velocity_gradient_end,
const secondOrderTensor_iter &cauchy_stress_begin, const secondOrderTensor_iter &cauchy_stress_end,
const floatType &volume_fraction,
const floatType &internal_heat_generation,
const floatVector_iter &net_interphase_force_begin, const floatVector_iter &net_interphase_force_end,
floatType &result );

template<class floatVector_iter, class secondOrderTensor_iter, class floatVector_iter_out, class secondOrderTensor_iter_out>
void computeBalanceOfEnergyNonDivergence( const floatType &density, const floatType &density_dot,
const floatVector_iter &density_gradient_begin, const floatVector_iter &density_gradient_end,
const floatType &internal_energy, const floatType &internal_energy_dot,
const floatVector_iter &internal_energy_gradient_begin, const floatVector_iter &internal_energy_gradient_end,
const floatVector_iter &velocity_begin, const floatVector_iter &velocity_end,
const secondOrderTensor_iter &velocity_gradient_begin, const secondOrderTensor_iter &velocity_gradient_end,
const secondOrderTensor_iter &cauchy_stress_begin, const secondOrderTensor_iter &cauchy_stress_end,
const floatType &volume_fraction,
const floatType &internal_heat_generation,
const floatVector_iter &net_interphase_force_begin, const floatVector_iter &net_interphase_force_end,
floatType &result,
floatType &dRdRho, floatType &dRdRhoDot, floatVector_iter_out dRdGradRho_begin, floatVector_iter_out dRdGradRho_end,
floatType &dRdE, floatType &dRdEDot, floatVector_iter_out dRdGradE_begin, floatVector_iter_out dRdGradE_end,
floatVector_iter_out dRdV_begin, floatVector_iter_out dRdV_end,
secondOrderTensor_iter_out dRdGradV_begin, secondOrderTensor_iter_out dRdGradV_end,
secondOrderTensor_iter_out dRdCauchy_begin, secondOrderTensor_iter_out dRdCauchy_end,
floatType &dRdPhi, floatType &dRdr,
floatVector_iter_out dRdpi_begin, floatVector_iter_out dRdpi_end );

template<class scalarArray_iter, class floatVector_iter, class secondOrderTensor_iter, class scalarArray_iter_out>
void computeBalanceOfEnergyNonDivergence( const scalarArray_iter &density_begin, const scalarArray_iter &density_end,
const scalarArray_iter &density_dot_begin, const scalarArray_iter &density_dot_end,
const floatVector_iter &density_gradient_begin, const floatVector_iter &density_gradient_end,
const scalarArray_iter &internal_energy_begin, const scalarArray_iter &internal_energy_end,
const scalarArray_iter &internal_energy_dot_begin, const scalarArray_iter &internal_energy_dot_end,
const floatVector_iter &internal_energy_gradient_begin, const floatVector_iter &internal_energy_gradient_end,
const floatVector_iter &velocity_begin, const floatVector_iter &velocity_end,
const secondOrderTensor_iter &velocity_gradient_begin, const secondOrderTensor_iter &velocity_gradient_end,
const secondOrderTensor_iter &cauchy_stress_begin, const secondOrderTensor_iter &cauchy_stress_end,
const scalarArray_iter &volume_fraction_begin, const scalarArray_iter &volume_fraction_end,
const scalarArray_iter &internal_heat_generation_begin, const scalarArray_iter &internal_heat_generation_end,
const floatVector_iter &net_interphase_force_begin, const floatVector_iter &net_interphase_force_end,
scalarArray_iter_out result_begin, scalarArray_iter_out result_end );

template<class scalarArray_iter, class floatVector_iter, class secondOrderTensor_iter, class scalarArray_iter_out, class floatVector_iter_out, class secondOrderTensor_iter_out>
void computeBalanceOfEnergyNonDivergence( const scalarArray_iter &density_begin, const scalarArray_iter &density_end,
const scalarArray_iter &density_dot_begin, const scalarArray_iter &density_dot_end,
const floatVector_iter &density_gradient_begin, const floatVector_iter &density_gradient_end,
const scalarArray_iter &internal_energy_begin, const scalarArray_iter &internal_energy_end,
const scalarArray_iter &internal_energy_dot_begin, const scalarArray_iter &internal_energy_dot_end,
const floatVector_iter &internal_energy_gradient_begin, const floatVector_iter &internal_energy_gradient_end,
const floatVector_iter &velocity_begin, const floatVector_iter &velocity_end,
const secondOrderTensor_iter &velocity_gradient_begin, const secondOrderTensor_iter &velocity_gradient_end,
const secondOrderTensor_iter &cauchy_stress_begin, const secondOrderTensor_iter &cauchy_stress_end,
const scalarArray_iter &volume_fraction_begin, const scalarArray_iter &volume_fraction_end,
const scalarArray_iter &internal_heat_generation_begin, const scalarArray_iter &internal_heat_generation_end,
const floatVector_iter &net_interphase_force_begin, const floatVector_iter &net_interphase_force_end,
scalarArray_iter_out result_begin, scalarArray_iter_out result_end,
scalarArray_iter_out dRdRho_begin, scalarArray_iter_out dRdRho_end,
scalarArray_iter_out dRdRhoDot_begin, scalarArray_iter_out dRdRhoDot_end,
floatVector_iter_out dRdGradRho_begin, floatVector_iter_out dRdGradRho_end,
scalarArray_iter_out dRdE_begin, scalarArray_iter_out dRdE_end,
scalarArray_iter_out dRdEDot_begin, scalarArray_iter_out dRdEDot_end,
floatVector_iter_out dRdGradE_begin, floatVector_iter_out dRdGradE_end,
floatVector_iter_out dRdV_begin, floatVector_iter_out dRdV_end,
secondOrderTensor_iter_out dRdGradV_begin, secondOrderTensor_iter_out dRdGradV_end,
secondOrderTensor_iter_out dRdCauchy_begin, secondOrderTensor_iter_out dRdCauchy_end,
scalarArray_iter_out dRdPhi_begin, scalarArray_iter_out dRdPhi_end,
scalarArray_iter_out dRdr_begin, scalarArray_iter_out dRdr_end,
floatVector_iter_out dRdpi_begin, floatVector_iter_out dRdpi_end );

template<class floatVector_iter>
void computeBalanceOfEnergyDivergence( const floatVector_iter &test_function_gradient_begin, const floatVector_iter &test_function_gradient_end,
const floatVector_iter &heat_flux_begin, const floatVector_iter &heat_flux_end,
floatType &result );

template<class floatVector_iter, class floatVector_iter_out>
void computeBalanceOfEnergyDivergence( const floatVector_iter &test_function_gradient_begin, const floatVector_iter &test_function_gradient_end,
const floatVector_iter &heat_flux_begin, const floatVector_iter &heat_flux_end,
floatType &result,
floatVector_iter_out dRdGradPsi_begin, floatVector_iter_out dRdGradPsi_end,
floatVector_iter_out dRdq_begin, floatVector_iter_out dRdq_end );

template<class floatVector_iter, class scalarArray_iter_out>
void computeBalanceOfEnergyDivergence( const floatVector_iter &test_function_gradient_begin, const floatVector_iter &test_function_gradient_end,
const floatVector_iter &heat_flux_begin, const floatVector_iter &heat_flux_end,
scalarArray_iter_out result_begin, scalarArray_iter_out result_end );

template<class floatVector_iter, class scalarArray_iter_out, class floatVector_iter_out>
void computeBalanceOfEnergyDivergence( const floatVector_iter &test_function_gradient_begin, const floatVector_iter &test_function_gradient_end,
const floatVector_iter &heat_flux_begin, const floatVector_iter &heat_flux_end,
scalarArray_iter_out result_begin, scalarArray_iter_out result_end,
floatVector_iter_out dRdGradPsi_begin, floatVector_iter_out dRdGradPsi_end,
floatVector_iter_out dRdq_begin, floatVector_iter_out dRdq_end );

}

}

#include "tardigrade_balance_of_energy.cpp"

#endif
Loading
Loading