Skip to content

Instantly share code, notes, and snippets.

@prudhomm
Created September 15, 2014 20:12
Show Gist options
  • Save prudhomm/a1c9b402978850ad6942 to your computer and use it in GitHub Desktop.
Save prudhomm/a1c9b402978850ad6942 to your computer and use it in GitHub Desktop.
computation of proximal/distal resistances
#include <iostream>
#include <boost/units/quantity.hpp>
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/energy.hpp>
#include <boost/units/systems/si/pressure.hpp>
#include <boost/units/systems/si/force.hpp>
#include <boost/units/systems/si/length.hpp>
#include <boost/units/systems/si/mass.hpp>
#include <boost/units/systems/si/electric_potential.hpp>
#include <boost/units/systems/si/kinematic_viscosity.hpp>
#include <boost/units/systems/si/dynamic_viscosity.hpp>
#include <boost/units/systems/si/resistance.hpp>
#include <boost/units/systems/si/volume.hpp>
#include <boost/units/systems/si/temperature.hpp>
#include <boost/units/systems/si/resistance.hpp>
#include <boost/units/systems/si/io.hpp>
#include <boost/units/pow.hpp>
#include <boost/units/systems/cgs/force.hpp>
#include <boost/units/systems/cgs/length.hpp>
#include <boost/units/systems/cgs/time.hpp>
using namespace boost::units;
using namespace boost::units::si;
int main()
{
auto mmHg = 133.322 * newton / (meter*meter );
auto dyn = 1e-5 * newton;
auto mu1 = 3.5e-3*pascal*second;
std::cout << "mu=" << mu1 << std::endl;
auto mu = 2.9e-5*mmHg*second;
std::cout << "mu_mmHg_s=" << mu << std::endl;
auto cm = 1e-2*meter;
auto mm = 1e-3*meter;
auto gram = 1e-3*kilogram;
auto mm5 = pow<5>(mm);
auto cm5 = pow<5>(cm);
auto minutes = 60*seconds;
// start with proximal resistance
auto Rp = 0.13*mmHg*minutes/(cm*cm*cm);
std::cout << "Rp=" << Rp << std::endl;
std::cout << "R(N s mm^-5)=" << Rp*mm5/(newton*second) << std::endl;
std::cout << "R(dyn s cm^-5)=" << Rp*cm5/(dyn*second) << std::endl;
auto Rd = 5.*Rp;
std::cout << "Rd=" << Rd << std::endl;
auto r = 2.6*mm;
auto L = Rd*3.14*pow<4>(r)/(8.*mu);
std::cout << "L=" << L << std::endl;
auto RRd = 8.*mu*500.*mm/(3.14*pow<4>(r));
std::cout << "RRd=" << RRd*mm5/(newton*second) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment