| 1 |
/* |
| 2 |
* Advanced Simulation Library <http://asl.org.il> |
| 3 |
* |
| 4 |
* Copyright 2015 Avtech Scientific <http://avtechscientific.com> |
| 5 |
* |
| 6 |
* |
| 7 |
* This file is part of Advanced Simulation Library (ASL). |
| 8 |
* |
| 9 |
* ASL is free software: you can redistribute it and/or modify it |
| 10 |
* under the terms of the GNU Affero General Public License as |
| 11 |
* published by the Free Software Foundation, version 3 of the License. |
| 12 |
* |
| 13 |
* ASL is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Affero General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Affero General Public License |
| 19 |
* along with ASL. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
|
| 24 |
#ifndef ASLFDMULTIPHASE_H |
| 25 |
#define ASLFDMULTIPHASE_H |
| 26 |
|
| 27 |
#include "aslSingleKernelNM.h" |
| 28 |
#include "acl/aclMath/aclVectorOfElementsDef.h" |
| 29 |
|
| 30 |
namespace acl |
| 31 |
{ |
| 32 |
class VectorOfElementsData; |
| 33 |
class VectorOfElements; |
| 34 |
} |
| 35 |
|
| 36 |
namespace asl |
| 37 |
{ |
| 38 |
class VectorTemplate; |
| 39 |
template <typename V> class DataWithGhostNodes; |
| 40 |
typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData; |
| 41 |
typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData; |
| 42 |
class AbstractDataWithGhostNodes; |
| 43 |
typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes; |
| 44 |
|
| 45 |
/// Numerical method which computes multiphase transport processes |
| 46 |
/** |
| 47 |
\ingroup TransportProcesses |
| 48 |
\ingroup NumMethods |
| 49 |
|
| 50 |
\f[ \partial_t c_i= D \Delta c_i - \nabla (\vec v c_i) |
| 51 |
-\nabla\left( a c_i \sum_{j\neq i}\nabla c_j \right)\f] |
| 52 |
where |
| 53 |
\param cData corresponds to \f$c_i\f$ |
| 54 |
\param diffusionCoefficient corresponds to \f$D\f$ |
| 55 |
\param repulsionconstant is repulsion constant \f$a\f$ |
| 56 |
\param velocity corresponds to \f$\vec v\f$ |
| 57 |
*/ |
| 58 |
class FDMultiPhase: public SingleKernelNM |
| 59 |
{ |
| 60 |
public: |
| 61 |
typedef SPDataWithGhostNodesACLData Data; |
| 62 |
typedef SPAbstractDataWithGhostNodes Field; |
| 63 |
|
| 64 |
private: |
| 65 |
std::vector<Data> cData; |
| 66 |
std::vector<Data> cInternalData; |
| 67 |
|
| 68 |
Field velocity; |
| 69 |
bool compressibilityCorrectionFlag; |
| 70 |
|
| 71 |
const VectorTemplate* vectorTemplate; |
| 72 |
|
| 73 |
int t; |
| 74 |
acl::VectorOfElements diffusionCoefficient; |
| 75 |
acl::VectorOfElements repulsionConstant; |
| 76 |
|
| 77 |
virtual void init0(); |
| 78 |
virtual void postProcessing(); |
| 79 |
public: |
| 80 |
FDMultiPhase(); |
| 81 |
FDMultiPhase(Data c, |
| 82 |
const acl::VectorOfElements & dC, |
| 83 |
const acl::VectorOfElements & rC, |
| 84 |
const VectorTemplate* vT); |
| 85 |
void setDiffusionCoefficient(acl::VectorOfElements d); |
| 86 |
inline const acl::VectorOfElements & getDiffusionCoefficient() const; |
| 87 |
void setRepulsionConstant(acl::VectorOfElements d); |
| 88 |
inline const acl::VectorOfElements & getRepulsionConstant() const; |
| 89 |
void setVectorTemplate(VectorTemplate* vT); |
| 90 |
inline const VectorTemplate* getVectorTemplate() const; |
| 91 |
void setVelocity(Field v, bool compressibilityCorrection=false); |
| 92 |
inline Field getVelocity(); |
| 93 |
inline std::vector<Data> & getData(); |
| 94 |
void addComponent(Data c); |
| 95 |
}; |
| 96 |
|
| 97 |
typedef std::shared_ptr<FDMultiPhase> SPFDMultiPhase; |
| 98 |
|
| 99 |
/** |
| 100 |
\ingroup TransportProcesses |
| 101 |
\ingroup NumMethods |
| 102 |
|
| 103 |
\f[ \partial_t c_i= D \Delta c_i - \nabla (\vec v c_i) - |
| 104 |
\nabla\left( a c_i \sum_{j\neq i}\nabla c_j\f] |
| 105 |
where |
| 106 |
\param cData corresponds to \f$c_i\f$ |
| 107 |
\param diffusionCoefficient corresponds to \f$D_i\f$ |
| 108 |
\param velocity corresponds to \f$\vec v\f$ |
| 109 |
*/ |
| 110 |
SPFDMultiPhase generateFDMultiPhase(SPDataWithGhostNodesACLData c, |
| 111 |
SPAbstractDataWithGhostNodes v, |
| 112 |
const VectorTemplate* vt, |
| 113 |
bool compressibilityCorrection = false); |
| 114 |
|
| 115 |
/** |
| 116 |
\ingroup TransportProcesses |
| 117 |
\ingroup NumMethods |
| 118 |
|
| 119 |
\f[ \partial_t c_i= D_i \Delta c_i \f] |
| 120 |
where |
| 121 |
\param cData corresponds to \f$ c_i \f$ |
| 122 |
|
| 123 |
\f$ D_i is diffusionCoefficient \f$, \f$a\f$ is repulsion constant |
| 124 |
*/ |
| 125 |
SPFDMultiPhase generateFDAdvectionDiffusion(SPDataWithGhostNodesACLData c, |
| 126 |
double diffustionCoeff, |
| 127 |
const VectorTemplate* vt); |
| 128 |
|
| 129 |
// ------------------------- Implementation ------------------------ |
| 130 |
|
| 131 |
inline FDMultiPhase::Field FDMultiPhase::getVelocity() |
| 132 |
{ |
| 133 |
return velocity; |
| 134 |
} |
| 135 |
|
| 136 |
inline std::vector<FDMultiPhase::Data> & FDMultiPhase::getData() |
| 137 |
{ |
| 138 |
return cData; |
| 139 |
} |
| 140 |
|
| 141 |
inline const VectorTemplate* FDMultiPhase::getVectorTemplate() const |
| 142 |
{ |
| 143 |
return vectorTemplate; |
| 144 |
} |
| 145 |
|
| 146 |
inline const acl::VectorOfElements & |
| 147 |
FDMultiPhase::getDiffusionCoefficient() const |
| 148 |
{ |
| 149 |
return diffusionCoefficient; |
| 150 |
} |
| 151 |
|
| 152 |
} // asl |
| 153 |
#endif // ASLFDMULTIPHASE_H |