00001 #ifndef OPENTISSUE_DYNAMICS_SPH_MATERIALS_SPH_WATER_H 00002 #define OPENTISSUE_DYNAMICS_SPH_MATERIALS_SPH_WATER_H 00003 // 00004 // OpenTissue Template Library 00005 // - A generic toolbox for physics-based modeling and simulation. 00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. 00007 // 00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php 00009 // 00010 #include <OpenTissue/configuration.h> 00011 00012 #include <OpenTissue/dynamics/sph/sph_material.h> 00013 00014 namespace OpenTissue 00015 { 00016 namespace sph 00017 { 00018 00022 template< typename Types > 00023 class Water : public Material<Types> 00024 { 00025 public: 00026 typedef Material<Types> base_type; 00027 typedef typename Types::real_type real_type; 00028 00029 public: 00033 Water() : base_type() 00034 { 00035 base_type::m_name = "Water"; 00036 00037 base_type::m_density = 998.29; // [kg/m^3] 00038 base_type::m_particle_mass = 0.02; // [kg] 00039 base_type::m_pressure = 101325.0; // [Pa = N/m^2 = kg/m.s^2] 00040 00041 base_type::m_tension = 0.0728; // [N/m = kg/s^2] 00042 base_type::m_viscosity = 3.5; // [Pa.s = N.s/m^2 = kg/m.s] 00043 // base_type::m_gas_stiffness = 4.5; // [J = N.m = kg.m^2/s^2] // used for MCG03 symmetric pressure force 00044 base_type::m_gas_stiffness = 3.0; // [J = N.m = kg.m^2/s^2] // used for DC96 symmetric pressure force 00045 00046 // 0.01 -> 3.0 00047 // 0.001 -> 100.0 00048 00049 base_type::m_timestep = 0.01; // [s] 00050 base_type::m_kernel_particles = 20.0; 00051 // base_type::m_restitution = 1.0; 00052 base_type::m_restitution = 0.0; 00053 00054 base_type::m_red = 0.09;//0.0; 00055 base_type::m_green = 0.31;//0.2; 00056 base_type::m_blue = 0.98;//0.8; 00057 } 00058 00062 ~Water() 00063 { 00064 } 00065 00066 private: 00067 00068 00072 real_type dist() const 00073 { 00074 const real_type dV = base_type::m_volume/base_type::m_particles; 00075 //---- volume of sphere with radius r: (4 pi *r^3) /3 => r = 00076 const real_type dist = std::pow(((3.*dV)/(4.0*math::detail::pi<real_type>())), 1./3.); 00077 return dist; 00078 } 00079 00084 real_type molekyles(const real_type& pressure) 00085 { 00086 //--- Assuming atmossphere pressure 1 bar, How 00087 //--- many molekyles would there be? 00088 const real_type P = base_type::Pa(pressure); 00089 const real_type molekyles = base_type::molekyles(P,base_type::m_volume,base_type::m_tempature); 00090 return molekyles; 00091 } 00092 00093 }; // End class Water 00094 00095 } // namespace sph 00096 } // namespace OpenTissue 00097 00098 // OPENTISSUE_DYNAMICS_SPH_MATERIALS_SPH_WATER_H 00099 #endif