MoCSI API Reference
Loading...
Searching...
No Matches
BCConstantHeatFlux.h
Go to the documentation of this file.
1#ifndef BOUNDARY_CONDITION_CONSTANT_HEAT_FLUX_H
2#define BOUNDARY_CONDITION_CONSTANT_HEAT_FLUX_H
3
4#include <cmath>
5#include <memory>
6#include <numbers>
7#include <string>
8#include <valarray>
9#include <vector>
10
12#include "IniParser.h"
13#include "SimulationClassBase.h"
14
18template <typename T>
20{
21 private:
22 T m_heat_flux{};
23 T m_area{};
24
25 public:
26 void writeBoundaryCondition() override;
27
29 std::vector<std::vector<int>> connected_points, int facet_nr, T area,
30 std::string face_prefix);
31 ~BCConstantHeatFlux() override = default;
32};
33
45template <typename T>
47 std::vector<int> boundary_points,
48 std::vector<std::vector<int>> connected_points,
49 int facet_nr, T area, std::string face_prefix)
51 m_area{area}
52{
53 // Only const heat flux case right now
54 try
55 {
56 m_heat_flux = this->m_sim->m_simulation_config.getDoubleParameters(
57 this->m_face_indicator_prefix + "boundary_heat_flux");
58 }
59 catch (const BadInput& e)
60 {
61 throw std::runtime_error(
62 "[BCConstantHeatFlux] Couldn't find heat flux value in simulation config under: "
63 + this->m_face_indicator_prefix + "boundary_heat_flux.");
64 }
65}
66
70template <typename T>
72{
73 for (int i{0}; i < this->m_boundary_points.size(); i++)
74 {
75 this->m_forcing_vector_elements[i] += m_heat_flux * m_area;
76 }
77}
78
79#endif
Concrete implementation of a constant heat flux boundary condition in 1D.
Definition BCConstantHeatFlux.h:20
void writeBoundaryCondition() override
Actual implementation of the boundary condition.
Definition BCConstantHeatFlux.h:71
BCConstantHeatFlux(SimulationClassBase< T > *sim, std::vector< int > boundary_points, std::vector< std::vector< int > > connected_points, int facet_nr, T area, std::string face_prefix)
Constructor for a BCConstantHeatFlux object.
Definition BCConstantHeatFlux.h:46
~BCConstantHeatFlux() override=default
This error class inherits from std::exception and marks faulty parameter or CL inputs....
Definition IniParser.h:71
Concrete implementation of a matrix class representing a Compressed Sparse Rows (CSR) matrix....
Definition CsrMatrix.h:35
CsrSparseMatrix()
Constructor for an empty CsrSparseMatrix object. Leaves all storage arrays empty but sets the flag to...
Definition CsrMatrix.h:92
Boundary condition abstract base class for the finite element method. All boundary condition implemen...
Definition GenericBoundaryCondition.h:18
std::pair< int, int > size() const
Function that returns the size of the matrix as a pair in (rows, columns) format.
Definition GenericMatrix.h:118