aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-01-15 12:05:50 +0100
committerAdrian Kummerlaender2019-01-15 12:05:50 +0100
commitb89b56b6b93d6b8df61954235c2ce6bd04bfd714 (patch)
treed6394cd232bcc28cce9c32907bd716b92c591808 /code
parent3b90a476f0a8d978a13b862f43bfdaf05d281429 (diff)
downloadgrid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.tar
grid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.tar.gz
grid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.tar.bz2
grid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.tar.lz
grid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.tar.xz
grid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.tar.zst
grid_refinement_bsc_thesis-b89b56b6b93d6b8df61954235c2ce6bd04bfd714.zip
Conclude refinement method implementation section
Diffstat (limited to 'code')
-rw-r--r--code/computeRestrictedFneq.cpp23
-rw-r--r--code/coupler2d.cpp2
-rw-r--r--code/fineCoupler2d.cpp4
-rw-r--r--code/fineCoupler2d_couple_extract.cpp18
4 files changed, 44 insertions, 3 deletions
diff --git a/code/computeRestrictedFneq.cpp b/code/computeRestrictedFneq.cpp
new file mode 100644
index 0000000..cf796b1
--- /dev/null
+++ b/code/computeRestrictedFneq.cpp
@@ -0,0 +1,23 @@
+template <typename T, template<typename> class DESCRIPTOR>
+void computeRestrictedFneq(const SuperLattice2D<T,DESCRIPTOR>& lattice,
+ Vector<int,3> latticeR,
+ T restrictedFneq[DESCRIPTOR<T>::q])
+{
+ for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
+ const auto neighbor = latticeR
+ + {0, DESCRIPTOR<T>::c[iPop][0], DESCRIPTOR<T>::c[iPop][1]};
+ Cell<T,DESCRIPTOR> cell;
+ lattice.get(neighbor, cell);
+
+ T fNeq[DESCRIPTOR<T>::q] {};
+ lbHelpers<T,DESCRIPTOR>::computeFneq(cell, fNeq);
+
+ for (int jPop=0; jPop < DESCRIPTOR<T>::q; ++jPop) {
+ restrictedFneq[jPop] += fNeq[jPop];
+ }
+ }
+
+ for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
+ restrictedFneq[iPop] /= DESCRIPTOR<T>::q;
+ }
+}
diff --git a/code/coupler2d.cpp b/code/coupler2d.cpp
index 9752de8..b34ec80 100644
--- a/code/coupler2d.cpp
+++ b/code/coupler2d.cpp
@@ -13,7 +13,7 @@ protected:
const Vector<int,3>& getFineLatticeR(int y) const;
const Vector<int,3>& getCoarseLatticeR(int y) const;
- T getScalingFactor() const;
+ T getScalingFactor() const; // Skalierungsfaktor $(\ref{eq:scaleFneq})$ der Nicht-Equilibriumsverteilung
T getInvScalingFactor() const;
private:
diff --git a/code/fineCoupler2d.cpp b/code/fineCoupler2d.cpp
index 4cde254..7da499a 100644
--- a/code/fineCoupler2d.cpp
+++ b/code/fineCoupler2d.cpp
@@ -1,8 +1,8 @@
template <typename T, template<typename> class DESCRIPTOR>
class FineCoupler2D : public Coupler2D<T,DESCRIPTOR> {
private:
- std::vector<T> _c2f_rho;
- std::vector<Vector<T,2>> _c2f_u;
+ std::vector<Vector<T,1>> _c2f_rho;
+ std::vector<Vector<T,DESCRIPTOR<T>::d>> _c2f_u;
std::vector<Vector<T,DESCRIPTOR<T>::q>> _c2f_fneq;
public:
diff --git a/code/fineCoupler2d_couple_extract.cpp b/code/fineCoupler2d_couple_extract.cpp
new file mode 100644
index 0000000..089ed02
--- /dev/null
+++ b/code/fineCoupler2d_couple_extract.cpp
@@ -0,0 +1,18 @@
+for (int y=1; y < this->_coarseSize-2; ++y) {
+ const auto rho = order4interpolation(_c2f_rho, y); // Siehe Listing $\ref{lst:ipol4ord}$
+ const auto u = order4interpolation(_c2f_u, y);
+ const auto fneq = order4interpolation(_c2f_fneq, y);
+
+ const T uSqr = u*u;
+
+ const auto finePos = this->getFineLatticeR(1+2*y);
+ Cell<T,DESCRIPTOR> fineCell;
+ fineLattice.get(finePos, fineCell);
+
+ for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
+ fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr)
+ + this->getScalingFactor() * fneq[iPop];
+ }
+
+ fineLattice.set(finePos, fineCell);
+}