summaryrefslogtreecommitdiff
path: root/src/dynamics/entropicDynamics.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-24 14:43:36 +0200
committerAdrian Kummerlaender2019-06-24 14:43:36 +0200
commit94d3e79a8617f88dc0219cfdeedfa3147833719d (patch)
treec1a6894679563e271f5c6ea7a17fa3462f7212a3 /src/dynamics/entropicDynamics.h
downloadgrid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.gz
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.bz2
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.lz
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.xz
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.zst
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.zip
Initialize at openlb-1-3
Diffstat (limited to 'src/dynamics/entropicDynamics.h')
-rw-r--r--src/dynamics/entropicDynamics.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/src/dynamics/entropicDynamics.h b/src/dynamics/entropicDynamics.h
new file mode 100644
index 0000000..ba67ea1
--- /dev/null
+++ b/src/dynamics/entropicDynamics.h
@@ -0,0 +1,143 @@
+/* This file is part of the OpenLB library
+ *
+ * Copyright (C) 2006, 2007, 2017 Orestis Malaspinas, Jonas Latt, Mathias J. Krause
+ * E-mail contact: info@openlb.net
+ * The most recent release of OpenLB can be downloaded at
+ * <http://www.openlb.net/>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+/** \file
+ * A collection of entropic dynamics classes (e.g. EntropicEq,
+ * ForcedEntropicEq, Entropic, ForcedEntropic) with which a Cell object
+ * can be instantiated -- header file.
+ *
+ * Entropic Modell:
+ * Ansumali, Santosh, Iliya V. Karlin, and Hans Christian Öttinger
+ * Minimal entropic kinetic models for hydrodynamics
+ * EPL (Europhysics Letters) 63.6 (2003): 798
+ */
+
+#ifndef ENTROPIC_LB_DYNAMICS_H
+#define ENTROPIC_LB_DYNAMICS_H
+
+#include "dynamics/dynamics.h"
+
+namespace olb {
+
+template<typename T, typename DESCRIPTOR> class Cell;
+
+
+/// Implementation of the entropic collision step
+template<typename T, typename DESCRIPTOR>
+class EntropicEqDynamics : public BasicDynamics<T,DESCRIPTOR> {
+public:
+ /// Constructor
+ EntropicEqDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
+ /// Compute equilibrium distribution function
+ T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
+ /// Collision step
+ void collide(Cell<T,DESCRIPTOR>& cell,
+ LatticeStatistics<T>& statistics_) override;
+ /// Get local relaxation parameter of the dynamics
+ T getOmega() const override;
+ /// Set local relaxation parameter of the dynamics
+ void setOmega(T omega_) override;
+private:
+ T omega; ///< relaxation parameter
+};
+
+/// Implementation of the forced entropic collision step
+template<typename T, typename DESCRIPTOR>
+class ForcedEntropicEqDynamics : public BasicDynamics<T,DESCRIPTOR> {
+public:
+ /// Constructor
+ ForcedEntropicEqDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
+ /// Compute equilibrium distribution function
+ virtual T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const;
+ /// Collision step
+ virtual void collide(Cell<T,DESCRIPTOR>& cell,
+ LatticeStatistics<T>& statistics_);
+ /// Get local relaxation parameter of the dynamics
+ virtual T getOmega() const;
+ /// Set local relaxation parameter of the dynamics
+ virtual void setOmega(T omega_);
+private:
+ T omega; ///< relaxation parameter
+};
+
+/// Implementation of the entropic collision step
+
+template<typename T, typename DESCRIPTOR>
+class EntropicDynamics : public BasicDynamics<T,DESCRIPTOR> {
+public:
+ /// Constructor
+ EntropicDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
+ /// Compute equilibrium distribution function
+ T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
+ /// Collision step
+ void collide(Cell<T,DESCRIPTOR>& cell,
+ LatticeStatistics<T>& statistics_) override;
+ /// Get local relaxation parameter of the dynamics
+ T getOmega() const override;
+ /// Set local relaxation parameter of the dynamics
+ void setOmega(T omega_) override;
+private:
+ /// computes the entropy function H(f)=sum_i f_i*ln(f_i/t_i)
+ T computeEntropy(const T f[]);
+ /// computes the entropy growth H(f)-H(f-alpha*fNeq)
+ T computeEntropyGrowth(const T f[], const T fNeq[], const T &alpha);
+ /// computes the entropy growth derivative
+ /// dH/dalpha=-sum_i fNeq_i*ln((f_i-alpha*fNeq_i)/t_i)
+ T computeEntropyGrowthDerivative(const T f[], const T fNeq[], const T &alpha);
+ /// Get the alpha parameter
+ bool getAlpha(T &alpha, const T f[], const T fNeq[]);
+
+ T omega; ///< relaxation parameter
+};
+
+/// Implementation of the forced entropic collision step
+template<typename T, typename DESCRIPTOR>
+class ForcedEntropicDynamics : public BasicDynamics<T,DESCRIPTOR> {
+public:
+ /// Constructor
+ ForcedEntropicDynamics(T omega_, Momenta<T,DESCRIPTOR>& momenta_);
+ /// Compute equilibrium distribution function
+ virtual T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const;
+ /// Collision step
+ virtual void collide(Cell<T,DESCRIPTOR>& cell,
+ LatticeStatistics<T>& statistics_);
+ /// Get local relaxation parameter of the dynamics
+ virtual T getOmega() const;
+ /// Set local relaxation parameter of the dynamics
+ virtual void setOmega(T omega_);
+private:
+ /// computes the entropy function H(f)=sum_i f_i*ln(f_i/t_i)
+ T computeEntropy(const T f[]);
+ /// computes the entropy growth H(f)-H(f-alpha*fNeq)
+ T computeEntropyGrowth(const T f[], const T fNeq[], const T &alpha);
+ /// computes the entropy growth derivative
+ /// dH/dalpha=-sum_i fNeq_i*ln((f_i-alpha*fNeq_i)/t_i)
+ T computeEntropyGrowthDerivative(const T f[], const T fNeq[], const T &alpha);
+ /// Get the alpha parameter
+ bool getAlpha(T &alpha, const T f[], const T fNeq[]);
+
+ T omega; ///< relaxation parameter
+};
+}
+
+#endif