$treeview $search $mathjax
|
Palabos
Version 1.1
$projectbrief
|
$projectbrief
|
$searchbox |
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 /* Main author: Orestis Malaspinas 00026 */ 00027 00028 #ifndef ADVECTION_DIFFUSION_UNITS_H 00029 #define ADVECTION_DIFFUSION_UNITS_H 00030 00031 #include "core/globalDefs.h" 00032 #include "core/globalDefs.h" 00033 #include <string> 00034 #include <fstream> 00035 00036 namespace plb { 00037 00039 template<typename T, template<typename NSU> class nsDescriptor, template<typename ADU> class adDescriptor> 00040 class RayleighBenardFlowParam { 00041 public: 00043 00054 RayleighBenardFlowParam(T Ra_, T Pr_, T uMax_, T coldTemperature_, 00055 T hotTemperature_, T resolution_, 00056 T lx_, T ly_, T lz_=T() ) 00057 : uMax(uMax_), Ra(Ra_), Pr(Pr_), coldTemperature(coldTemperature_), hotTemperature(hotTemperature_), 00058 resolution(resolution_), lx(lx_), ly(ly_), lz(lz_) 00059 { } 00061 T getRe() const { return sqrt(getRa()/getPr()); } 00063 T getRa() const { return Ra; } 00065 T getPr() const { return Pr; } 00067 T getColdTemperature() const { return coldTemperature; } 00069 T getHotTemperature() const { return hotTemperature; } 00071 T getDeltaTemperature() const { return (hotTemperature-coldTemperature); } 00073 T getAverageTemperature() const { return (hotTemperature+coldTemperature)/(T)2; } 00075 T getResolution() const { return resolution; } 00077 T getLx() const { return lx; } 00079 T getLy() const { return ly; } 00081 T getLz() const { return lz; } 00083 T getDeltaX() const { return (T)1/resolution; } 00085 T getDeltaT() const { return getLatticeU() / (T)resolution; } 00087 plint nCell(T l) const { return (plint)(l/getDeltaX()+(T)0.5); } 00089 plint nStep(T t) const { return (plint)(t/getDeltaT()+(T)0.5); } 00091 plint getNx() const { return nCell(lx)+1; } 00093 plint getNy() const { return nCell(ly)+1; } 00095 plint getNz() const { return nCell(lz)+1; } 00097 T getLatticeU() const { return uMax ; } 00099 T getLatticeNu() const { return getDeltaT()/(getDeltaX()*getDeltaX()*getRe()); } 00101 T getLatticeKappa() const { return getLatticeNu() / getPr() ; } 00103 T getLatticeGravity() const { return getDeltaT() * getDeltaT() / getDeltaX(); } 00105 T getSolventTau() const { return nsDescriptor<T>::invCs2*getLatticeNu()+(T)0.5; } 00107 T getSolventOmega() const { return (T)1 / getSolventTau(); } 00109 T getTemperatureTau() const { return adDescriptor<T>::invCs2*getLatticeKappa()+(T)0.5; } 00111 T getTemperatureOmega() const { return (T)1 / getTemperatureTau(); } 00112 private: 00113 T uMax, Ra, Pr, coldTemperature, hotTemperature, resolution, lx, ly, lz; 00114 }; 00115 00116 template<typename T, template<typename NSU> class nsDescriptor, template<typename ADU> class adDescriptor> 00117 void writeLogFile(RayleighBenardFlowParam<T,nsDescriptor,adDescriptor> const& parameters, 00118 std::string const& title) 00119 { 00120 std::string fullName = global::directories().getLogOutDir() + "olbLog.dat"; 00121 std::ofstream ofile(fullName.c_str()); 00122 ofile << title << "\n\n"; 00123 ofile << "Reynolds number: Re=" << parameters.getRe() << "\n"; 00124 ofile << "Raynleigh number: Ra=" << parameters.getRa() << "\n"; 00125 ofile << "Prandlt number: Pr=" << parameters.getPr() << "\n"; 00126 ofile << "Kinematic viscosity: Nu=" << parameters.getLatticeNu() << "\n"; 00127 ofile << "Thermal conductivity: Kappa=" << parameters.getLatticeKappa() << "\n"; 00128 ofile << "Lattice resolution: N=" << parameters.getResolution() << "\n"; 00129 ofile << "Extent of the system: lx=" << parameters.getLx() << "\n"; 00130 ofile << "Extent of the system: ly=" << parameters.getLy() << "\n"; 00131 ofile << "Extent of the system: lz=" << parameters.getLz() << "\n"; 00132 ofile << "Grid spacing deltaX: dx=" << parameters.getDeltaX() << "\n"; 00133 ofile << "Time step deltaT: dt=" << parameters.getDeltaT() << "\n"; 00134 ofile << "Solvent omega: omega_S=" << parameters.getSolventOmega() << "\n"; 00135 ofile << "Temperature omega: omega_T=" << parameters.getTemperatureOmega() << "\n"; 00136 ofile << "Caracteristic vel: uMax=" << parameters.getLatticeU() << "\n"; 00137 } 00138 00139 } // namespace plb 00140 00141 #endif
1.6.3
1.6.3