1 #ifndef BODY_FORCE_H 2 #define BODY_FORCE_H 3 4 #include <map> 5 #include <string> 6 #include "ATC_TypeDefs.h" 7 #include "Function.h" 8 9 namespace ATC { 10 11 /** 12 * @class BodyForce 13 * @brief Base class for models of body forces in the momentum eqn 14 */ 15 16 class BodyForce 17 { 18 public: BodyForce()19 BodyForce() {}; ~BodyForce()20 virtual ~BodyForce() {}; body_force(const FIELD_MATS &,DENS_MAT &)21 virtual bool body_force(const FIELD_MATS & /* fields */, 22 DENS_MAT & /* flux */) const { return false; }; 23 }; 24 25 /** 26 * @class BodyForceViscous 27 * @brief viscous body forces 28 */ 29 class BodyForceViscous : public BodyForce 30 { 31 public: 32 BodyForceViscous(std::fstream &matfile,std::map<std::string,double> & parameters); ~BodyForceViscous()33 virtual ~BodyForceViscous() {}; body_force(const FIELD_MATS & fields,DENS_MAT & flux)34 virtual bool body_force(const FIELD_MATS &fields, 35 DENS_MAT &flux) const 36 { 37 FIELD_MATS::const_iterator v_field = fields.find(VELOCITY); 38 const DENS_MAT & v = v_field->second; 39 flux = -gamma_*v; 40 return true; 41 } 42 protected: 43 double gamma_; 44 }; 45 /** 46 * @class BodyForceElectricField 47 * @brief electric field body forces 48 */ 49 class BodyForceElectricField : public BodyForce 50 { 51 public: BodyForceElectricField(std::fstream &,std::map<std::string,double> &)52 BodyForceElectricField(std::fstream & /* matfile */,std::map<std::string,double> & /* parameters */) 53 { throw ATC_Error("unimplemented due to issues with accessing electric field"); } ~BodyForceElectricField()54 virtual ~BodyForceElectricField() {}; body_force(const FIELD_MATS & fields,DENS_MAT & flux)55 virtual bool body_force(const FIELD_MATS &fields, 56 DENS_MAT &flux) const 57 { 58 FIELD_MATS::const_iterator v_field = fields.find(VELOCITY); 59 const DENS_MAT & v = v_field->second; 60 int nNodes = v.nRows(); 61 flux.reset(nNodes,1); 62 return true; 63 } 64 }; 65 } 66 #endif 67 68 69