$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

carreauUnits.h

Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #ifndef CARREAU_UNITS_H
00026 #define CARREAU_UNITS_H
00027 
00028 #include "core/globalDefs.h"
00029 #include "io/parallelIO.h"
00030 #include <string>
00031 #include <fstream>
00032 
00033 /* Main author: Orestis Malaspinas
00034  */
00035 
00036 namespace plb {
00037 
00039 template<typename T>
00040 class CarreauFlowParam {
00041 public:
00043 
00050     CarreauFlowParam(T latticeU_, T Re_, T Cu_, T nuInf_, T n_,
00051                           plint resolution_, T lx_, T ly_, T lz_=T() )
00052         : latticeU(latticeU_), Re(Re_), Cu(Cu_), nuInf(nuInf_), n(n_),
00053           resolution(resolution_), lx(lx_), ly(ly_), lz(lz_)
00054     { }
00056     T getLatticeU() const { return latticeU; }
00058     T getRe() const      { return Re; }
00060     T getCu() const      { return Cu; }
00062     T getExponent() const      { return n; }
00064     plint getResolution() const { return resolution; }
00066     T getLx() const      { return lx; }
00068     T getLy() const      { return ly; }
00070     T getLz() const      { return lz; }
00072     T getDeltaX() const  { return (T)1/(T)getResolution(); }
00074     T getDeltaT() const  { return getDeltaX()*getLatticeU(); }
00076     plint nCell(T l) const { return (int)(l/getDeltaX()+(T)0.5); }
00078     plint nStep(T t) const { return (int)(t/getDeltaT()+(T)0.5); }
00080     plint getNx(bool offLattice=false) const { return nCell(lx)+1+(int)offLattice; }
00082     plint getNy(bool offLattice=false) const { return nCell(ly)+1+(int)offLattice; }
00084     plint getNz(bool offLattice=false) const { return nCell(lz)+1+(int)offLattice; }
00086     T getLatticeNu0() const { return getLatticeU()*getResolution()/getRe(); }
00088         T getLatticeNuInf() const { return nuInf; }
00090     T getLatticeLambda() const { return getResolution()/getLatticeU()*getCu(); }
00092     T getTau0() const       { return (T)3*getLatticeNu0()+(T)0.5; }
00094     T getOmega0() const     { return (T)1 / getTau0(); }
00096     T getTauInf() const       { return (T)3*getLatticeNuInf()+(T)0.5; }
00098     T getOmegaInf() const     { return (T)1 / getTauInf(); }
00099 private:
00100     T latticeU, Re, Cu, nuInf, n;
00101     plint resolution;
00102     T lx, ly, lz;
00103 };
00104 
00105 template<typename T>
00106 void writeLogFile(CarreauFlowParam<T> const& parameters,
00107                   std::string const& title)
00108 {
00109     std::string fullName = global::directories().getLogOutDir() + "plbLog.dat";
00110     plb_ofstream ofile(fullName.c_str());
00111     ofile << title << "\n\n";
00112     ofile << "Velocity in lattice units: u=" << parameters.getLatticeU() << "\n";
00113     ofile << "Reynolds number:           Re=" << parameters.getRe() << "\n";
00114     ofile << "Carreau number:            Cu=" << parameters.getCu() << "\n";
00115     ofile << "Lattice resolution:        N=" << parameters.getResolution() << "\n";
00116     ofile << "Extent of the system:      lx=" << parameters.getLx() << "\n";
00117     ofile << "Extent of the system:      ly=" << parameters.getLy() << "\n";
00118     ofile << "Extent of the system:      lz=" << parameters.getLz() << "\n";
00119     ofile << "Grid spacing deltaX:       dx=" << parameters.getDeltaX() << "\n";
00120     ofile << "Time step deltaT:          dt=" << parameters.getDeltaT() << "\n";
00121     ofile << "Exponent:                  n=" << parameters.getExponent() << "\n";
00122     ofile << "Zero viscosity:            nu0=" << parameters.getLatticeNu0() << "\n";
00123         ofile << "Inf viscosity:             nuInf=" << parameters.getLatticeNuInf() << "\n";
00124     ofile << "Zero Omega:                omega0=" << parameters.getOmega0() << "\n";
00125     ofile << "Inf  Omega:                omegaInf=" << parameters.getOmegaInf() << "\n";
00126     ofile << "Lambda:                    lambda=" << parameters.getLatticeLambda() << "\n";
00127 }
00128 
00129 }  // namespace plb
00130 
00131 #endif