antioch-0.4.0
Functions
mixture_viscosity_vec_unit.C File Reference
#include "antioch_config.h"
#include <valarray>
#include "Eigen/Dense"
#include "metaphysicl/numberarray.h"
#include "vexcl/vexcl.hpp"
#include "antioch/eigen_utils_decl.h"
#include "antioch/metaphysicl_utils_decl.h"
#include "antioch/valarray_utils_decl.h"
#include "antioch/vexcl_utils_decl.h"
#include "antioch/default_filename.h"
#include "antioch/sutherland_viscosity.h"
#include "antioch/blottner_viscosity.h"
#include "antioch/mixture_viscosity.h"
#include "antioch/blottner_parsing.h"
#include "antioch/sutherland_parsing.h"
#include "antioch/eigen_utils.h"
#include "antioch/metaphysicl_utils.h"
#include "antioch/valarray_utils.h"
#include "antioch/vexcl_utils.h"
#include "antioch/stat_mech_thermo.h"
#include <cmath>
#include <iostream>

Go to the source code of this file.

Functions

template<typename PairScalars >
int vectester (const PairScalars &example, const std::string &testname)
 
int main ()
 

Function Documentation

int main ( )

Definition at line 158 of file mixture_viscosity_vec_unit.C.

References vectester().

159 {
160  int returnval = 0;
161 
162  returnval = returnval ||
163  vectester (std::valarray<float>(2*ANTIOCH_N_TUPLES), "valarray<float>");
164  returnval = returnval ||
165  vectester (std::valarray<double>(2*ANTIOCH_N_TUPLES), "valarray<double>");
166  returnval = returnval ||
167  vectester (std::valarray<long double>(2*ANTIOCH_N_TUPLES), "valarray<ld>");
168 #ifdef ANTIOCH_HAVE_EIGEN
169  returnval = returnval ||
170  vectester (Eigen::Array<float, 2*ANTIOCH_N_TUPLES, 1>(), "Eigen::ArrayXf");
171  returnval = returnval ||
172  vectester (Eigen::Array<double, 2*ANTIOCH_N_TUPLES, 1>(), "Eigen::ArrayXd");
173  returnval = returnval ||
174  vectester (Eigen::Array<long double, 2*ANTIOCH_N_TUPLES, 1>(), "Eigen::ArrayXld");
175 #endif
176 #ifdef ANTIOCH_HAVE_METAPHYSICL
177  returnval = returnval ||
178  vectester (MetaPhysicL::NumberArray<2*ANTIOCH_N_TUPLES, float> (0), "NumberArray<float>");
179  returnval = returnval ||
180  vectester (MetaPhysicL::NumberArray<2*ANTIOCH_N_TUPLES, double> (0), "NumberArray<double>");
181  returnval = returnval ||
182  vectester (MetaPhysicL::NumberArray<2*ANTIOCH_N_TUPLES, long double> (0), "NumberArray<ld>");
183 #endif
184 #ifdef ANTIOCH_HAVE_VEXCL
185  vex::Context ctx_f (vex::Filter::All);
186  if (!ctx_f.empty())
187  returnval = returnval ||
188  vectester (vex::vector<float> (ctx_f, 2*ANTIOCH_N_TUPLES), "vex::vector<float>");
189 
190  vex::Context ctx_d (vex::Filter::DoublePrecision);
191  if (!ctx_d.empty())
192  returnval = returnval ||
193  vectester (vex::vector<double> (ctx_d, 2*ANTIOCH_N_TUPLES), "vex::vector<double>");
194 #endif
195 
196 #ifdef ANTIOCH_HAVE_GRVY
197  gt.Finalize();
198  gt.Summarize();
199 #endif
200 
201  return returnval;
202 }
int vectester(const PairScalars &example, const std::string &testname)
template<typename PairScalars >
int vectester ( const PairScalars &  example,
const std::string &  testname 
)

Definition at line 81 of file mixture_viscosity_vec_unit.C.

References Antioch::DefaultSourceFilename::blottner_data(), and Antioch::DefaultSourceFilename::sutherland_data().

Referenced by main().

82 {
83  typedef typename Antioch::value_type<PairScalars>::type Scalar;
84 
85  std::vector<std::string> species_str_list;
86  const unsigned int n_species = 2;
87  species_str_list.reserve(n_species);
88  species_str_list.push_back( "N2" );
89  species_str_list.push_back( "Air" ); // Yes, I know this doesn't make sense, it's just a test.
90 
91  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );
92 
93  typedef Antioch::StatMechThermodynamics<Scalar> MicroThermo;
94  MicroThermo thermo_stat( chem_mixture );
95 
96  Antioch::TransportMixture<Scalar> tran_mixture( chem_mixture );
97 
99  s_mu_mixture(tran_mixture);
100 
102  b_mu_mixture(tran_mixture);
103 
104  Antioch::read_sutherland_data_ascii<Scalar>( s_mu_mixture, Antioch::DefaultFilename::sutherland_data() );
105  Antioch::read_blottner_data_ascii<Scalar>( b_mu_mixture, Antioch::DefaultFilename::blottner_data() );
106 
107  std::cout << s_mu_mixture << std::endl;
108  std::cout << b_mu_mixture << std::endl;
109 
110  PairScalars T = example;
111  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
112  {
113  T[2*tuple ] = 1500.1;
114  T[2*tuple+1] = 1600.1;
115  }
116 
117  PairScalars mu = example;
118 
119  std::cout << "Blottner:" << std::endl;
120  for( unsigned int s = 0; s < n_species; s++ )
121  {
122 #ifdef ANTIOCH_HAVE_GRVY
123  const std::string testblottner = testname + "-blottner";
124  gt.BeginTimer(testblottner);
125 #endif
126 
127  mu = b_mu_mixture(s,T);
128 
129 #ifdef ANTIOCH_HAVE_GRVY
130  gt.EndTimer(testblottner);
131 #endif
132 
133  std::cout << "mu(" << species_str_list[s] << ") = " << mu << std::endl;
134  }
135 
136  std::cout << "Sutherland:" << std::endl;
137  for( unsigned int s = 0; s < n_species; s++ )
138  {
139 #ifdef ANTIOCH_HAVE_GRVY
140  const std::string testsutherland = testname + "-sutherland";
141  gt.BeginTimer(testsutherland);
142 #endif
143 
144  mu = s_mu_mixture(s,T);
145 
146 #ifdef ANTIOCH_HAVE_GRVY
147  gt.EndTimer(testsutherland);
148 #endif
149 
150  std::cout << "mu(" << species_str_list[s] << ") = " << mu << std::endl;
151  }
152 
153  int return_flag = 0;
154 
155  return return_flag;
156 }
Container class for species viscosities.
Class storing chemical mixture properties.
Definition: ascii_parser.h:55
static const std::string & sutherland_data()
static const std::string & blottner_data()
Class storing chemical mixture properties.

Generated on Thu Jul 7 2016 11:09:47 for antioch-0.4.0 by  doxygen 1.8.8