$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: Daniel Lagrava 00026 **/ 00027 00031 #ifndef GRID_REFINEMENT_H 00032 #define GRID_REFINEMENT_H 00033 00034 #include "core/globalDefs.h" 00035 #include "core/cell.h" 00036 #include <vector> 00037 00038 namespace plb { 00039 00040 00042 template<typename T> 00043 T interpolateValue(std::vector<T> x, std::vector<T> y); 00044 00045 00047 template<typename T, template<typename U> class Descriptor> 00048 class RescaleEngine { 00049 public: 00050 virtual ~RescaleEngine() { } 00052 virtual void scaleCoarseFine( Cell<T,Descriptor> const& coarseCell, 00053 std::vector<T>& decomposedFineValues) const =0; 00055 virtual void scaleFineCoarse( Cell<T,Descriptor> const& fineCell, 00056 std::vector<T>& decomposedCoarseValues ) const =0; 00058 virtual void recompose( Cell<T,Descriptor>& cell, std::vector<T> const& decomposedValues ) const =0; 00060 virtual plint getDecompositionOrder() const =0; 00062 virtual RescaleEngine<T,Descriptor>* clone() const =0; 00063 }; 00064 00066 template<typename T, template<typename U> class Descriptor> 00067 class ConvectiveRescaleEngine: public RescaleEngine<T,Descriptor> { 00068 public: 00069 ConvectiveRescaleEngine(plint order_); 00071 virtual void scaleCoarseFine( Cell<T,Descriptor> const& coarseCell, 00072 std::vector<T>& decomposedFineValues ) const; 00074 virtual void scaleFineCoarse( Cell<T,Descriptor> const& fineCell, 00075 std::vector<T>& decomposedCoarseValues ) const; 00077 virtual void recompose( Cell<T,Descriptor>& cell, std::vector<T> const& decomposedValues ) const; 00079 virtual plint getDecompositionOrder() const; 00081 virtual ConvectiveRescaleEngine<T,Descriptor>* clone() const; 00082 private: 00083 plint order; //< Order of the decomposition wrt to the Chapman-Enskog expansion. 00084 static const T toFine_xDxInv; // 1/xDx for coarse->fine 00085 static const T toFine_xDt; // xDt for coarse->fine 00086 static const T toCoarse_xDxInv; // 1/xDx for fine->coarse 00087 static const T toCoarse_xDt; // xDt for fine->coarse 00088 }; 00089 00091 template<typename T, template<typename U> class Descriptor> 00092 class NoScalingEngine: public RescaleEngine<T,Descriptor> { 00093 public: 00094 NoScalingEngine(plint order_); 00096 virtual void scaleCoarseFine( Cell<T,Descriptor> const& coarseCell, 00097 std::vector<T>& decomposedFineValues ) const; 00099 virtual void scaleFineCoarse( Cell<T,Descriptor> const& fineCell, 00100 std::vector<T>& decomposedCoarseValues ) const; 00102 virtual void recompose( Cell<T,Descriptor>& cell, std::vector<T> const& decomposedValues ) const; 00104 virtual plint getDecompositionOrder() const; 00106 virtual NoScalingEngine<T,Descriptor>* clone() const; 00107 private: 00108 plint order; 00109 }; 00110 00111 template<typename T> 00112 void linearInterpolation(std::vector<T>& pop1, std::vector<T>& pop2, std::vector<T>& decomposedValues); 00113 00114 template<typename T> 00115 void cubicCenteredInterpolation(std::vector<T>& pop1, std::vector<T>& pop2, 00116 std::vector<T>& pop3, std::vector<T>& pop4, 00117 std::vector<T>& decomposedValues ); 00118 00119 template<typename T> 00120 void quadraticNonCenteredInterpolation(std::vector<T>& pop1, std::vector<T>& pop2, 00121 std::vector<T>& pop3, std::vector<T>& decomposedValues ); 00122 00123 00124 } // namespace plb 00125 00126 #endif // GRID_REFINEMENT_H
1.6.3
1.6.3