ABLATE Source Documentation  0.12.33
twoPhaseTransport.hpp
1 #ifndef ABLATELIBRARY_TWOPHASETRANSPORT_HPP
2 #define ABLATELIBRARY_TWOPHASETRANSPORT_HPP
3 
4 #include "transportModel.hpp"
5 
6 namespace ablate::eos::transport {
7 
9  private:
13  const std::shared_ptr<eos::transport::TransportModel> alphaTransportModel;
17  const std::shared_ptr<eos::transport::TransportModel> otherTransportModel;
18 
22  struct FunctionContext {
23  // The function for the alpha property
24  PetscErrorCode (*alphaFunction)(const PetscReal conserved[], PetscReal* property, void* ctx);
25  void* alphaContext;
26 
27  // The function for the other property
28  PetscErrorCode (*otherFunction)(const PetscReal conserved[], PetscReal* property, void* ctx);
29  void* otherContext;
30 
31  // offset location for volume fraction in the solution field
32  PetscInt vfOffset;
33  };
34 
38  struct TemperatureFunctionContext {
39  // The function for the alpha property
40  PetscErrorCode (*alphaFunction)(const PetscReal conserved[], PetscReal T, PetscReal* property, void* ctx);
41  void* alphaContext;
42 
43  // The function for the other property
44  PetscErrorCode (*otherFunction)(const PetscReal conserved[], PetscReal T, PetscReal* property, void* ctx);
45  void* otherContext;
46 
47  // offset location for volume fraction in the solution field
48  PetscInt vfOffset;
49  };
50 
54  mutable std::vector<ThermodynamicFunction> thermodynamicFunctionReference;
55 
59  mutable std::vector<ThermodynamicTemperatureFunction> thermodynamicTemperatureFunctionReference;
60 
70  static PetscErrorCode TwoPhaseFunction(const PetscReal conserved[], PetscReal* property, void* ctx);
71  static PetscErrorCode TwoPhaseTemperatureFunction(const PetscReal conserved[], PetscReal temperature, PetscReal* property, void* ctx);
74  public:
75  explicit TwoPhaseTransport(std::shared_ptr<TransportModel> transportModelAlpha, std::shared_ptr<TransportModel> transportModelOther);
76 
83  [[nodiscard]] ThermodynamicFunction GetTransportFunction(TransportProperty property, const std::vector<domain::Field>& fields) const override;
84 
91  [[nodiscard]] ThermodynamicTemperatureFunction GetTransportTemperatureFunction(TransportProperty property, const std::vector<domain::Field>& fields) const override;
92 };
93 
94 } // namespace ablate::eos::transport
95 
96 #endif // ABLATELIBRARY_TWOPHASETRANSPORT_HPP
Definition: transportModel.hpp:10
Definition: twoPhaseTransport.hpp:8
ThermodynamicFunction GetTransportFunction(TransportProperty property, const std::vector< domain::Field > &fields) const override
Definition: twoPhaseTransport.cpp:42
ThermodynamicTemperatureFunction GetTransportTemperatureFunction(TransportProperty property, const std::vector< domain::Field > &fields) const override
Definition: twoPhaseTransport.cpp:71