|
| 1 | +2D single-species advection-reaction-diffusion |
| 2 | +============================================== |
| 3 | + |
| 4 | +This problem focuses on the following 2D PDE: |
| 5 | + |
| 6 | +.. math:: |
| 7 | +
|
| 8 | + \frac{\partial \phi}{\partial t} + u \frac{\partial \phi}{\partial x} + v \frac{\partial \phi}{\partial y} = D \left(\frac{\partial^2 \phi}{\partial x^2} + \frac{\partial^2 \phi}{\partial y^2} \right) - \sigma \phi + f(x, y, t) |
| 9 | +
|
| 10 | +
|
| 11 | +* Initial conditions: :math:`\phi(x, y, 0) = 0` |
| 12 | + |
| 13 | +* Default settings: |
| 14 | + |
| 15 | + - :math:`u = 0.5 \cos(\pi/3), v = 0.5 \sin(\pi/3)` |
| 16 | + |
| 17 | + - :math:`D = 0.001`, :math:`\sigma = 1` |
| 18 | + |
| 19 | + - :math:`f(x, y, t) = 1` |
| 20 | + |
| 21 | +* Domain is unit square :math:`[0,1]^2` with homogeneous Dirichlet BC |
| 22 | + |
| 23 | +* :math:`u, v, D, \sigma` can be customized via the problem constructor (more below) |
| 24 | + |
| 25 | +Mesh |
| 26 | +---- |
| 27 | + |
| 28 | +.. code-block:: shell |
| 29 | +
|
| 30 | + python3 pressio-demoapps/meshing_scripts/create_full_mesh_for.py \ |
| 31 | + --problem advdiffreac2d_s<stencilSize> -n Nx Ny --outDir <destination-path> |
| 32 | +
|
| 33 | +where |
| 34 | + |
| 35 | +- ``Nx, Ny`` is the number of cells you want along :math:`x` and :math:`y` respectively |
| 36 | + |
| 37 | +- ``<stencilSize> = 3 or 5 or 7``: defines the neighboring connectivity of each cell |
| 38 | + |
| 39 | +- ``<destination-path>`` is where you want the mesh files to be generated |
| 40 | + |
| 41 | + |
| 42 | +C++ synopsis |
| 43 | +------------ |
| 44 | + |
| 45 | +.. code-block:: c++ |
| 46 | + |
| 47 | + #include "pressiodemoapps/advection_diffusion_reaction2d.hpp" |
| 48 | + |
| 49 | + int main(){ |
| 50 | + namespace pda = pressiodemoapps; |
| 51 | + |
| 52 | + const auto meshObj = pda::load_cellcentered_uniform_mesh_eigen("path-to-mesh"); |
| 53 | + |
| 54 | + const auto inviscidScheme = pda::InviscidFluxReconstruction::FirstOder; //or Weno3, Weno5 |
| 55 | + |
| 56 | + // A. constructor for problem using default values |
| 57 | + { |
| 58 | + const auto probId = pda::AdvectionDiffusionReaction2d::ProblemA; |
| 59 | + auto problem = pda::create_problem_eigen(meshObj, probId, inviscidScheme); |
| 60 | + } |
| 61 | + |
| 62 | + // B. setting custom coefficients |
| 63 | + { |
| 64 | + using scalar_type = typename decltype(meshObj)::scalar_t; |
| 65 | + const scalar_type ux = 0.2; |
| 66 | + const scalar_type uy = 0.8; |
| 67 | + const scalar_type diff = 0.01; |
| 68 | + const scalar_type sigma = 1.5; |
| 69 | + auto problem = pda::create_advdiffreac_2d_problem_A_eigen(meshObj, inviscidScheme, |
| 70 | + ux, uy, diff, sigma); |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + |
| 75 | +Python synopsis |
| 76 | +--------------- |
| 77 | + |
| 78 | +.. code-block:: py |
| 79 | +
|
| 80 | + import pressiodemoapps as pda |
| 81 | +
|
| 82 | + meshObj = pda.load_cellcentered_uniform_mesh("path-to-mesh") |
| 83 | +
|
| 84 | + scheme = pda.InviscidFluxReconstruction.FirstOrder # or Weno3, Weno5 |
| 85 | +
|
| 86 | + # A. constructor for problem using default values |
| 87 | + probId = pda.AdvectionDiffusionReaction2d.ProblemA |
| 88 | + problem = pda.create_problem(meshObj, probId, scheme) |
| 89 | +
|
| 90 | + # B. setting custom coefficients |
| 91 | + ux, uy, myD, sigma = 0.1, 0.5, 0.001, 1.5 |
| 92 | + problem = pda.create_adv_diff_reac_2d_problem_A(meshObj, scheme, ux, uy, myD, sigma) |
| 93 | +
|
| 94 | +Notes: |
| 95 | +------ |
| 96 | + |
| 97 | +.. important:: |
| 98 | + |
| 99 | + Currently, for this problem the viscous schemes is fixed |
| 100 | + such that it yields a second-order viscuous scheme. |
| 101 | + |
| 102 | + |
| 103 | +Sample Solution |
| 104 | +--------------- |
| 105 | + |
| 106 | +Representative plot at :math:`t=0` (left) and :math:`t=3`, |
| 107 | +using a ``50x50`` mesh with Weno5 and RK4 time integration with :math:`dt = 0.01`, |
| 108 | +and default values for the physical coefficients: |
| 109 | + |
| 110 | +.. image:: ../../figures/wiki_2d_advdiffreac_probA_solution0.png |
| 111 | + :width: 44 % |
| 112 | + |
| 113 | +.. image:: ../../figures/wiki_2d_advdiffreac_probA_solution1.png |
| 114 | + :width: 44 % |
0 commit comments