kinnala / scikit-fem

Simple finite element assemblers
https://scikit-fem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
470 stars 76 forks source link

Adding advection-diffusion as another usage example #1137

Closed RadostW closed 2 weeks ago

RadostW commented 2 weeks ago

We've managed to solve an advection-diffusion problem

$$0 = \Delta \phi - \mathrm{Pe} (u \cdot \nabla \phi) $$

in cylindrical coordinates with $U$ coming from Stokes flow around a sphere using scikit-fem package -- code here

I'd like to contribute it as an use example -- is there some clever way this code should be structured to work with listofexamples.rst?

sample_image

kinnala commented 2 weeks ago

This looks great. You can add it as ex50.py, implement a test for it under tests/test_examples.py, and use the following as a template for listofexamples.rst (under fluid mechanics category, perhaps?):

Example 36: Nearly incompressible hyperelasticity
-------------------------------------------------

This example demonstrates the implementation of a two field mixed formulation
for nearly incompressible Neo-Hookean solids.

.. figure:: https://user-images.githubusercontent.com/22624037/91212007-4055aa80-e6d5-11ea-8572-f27986887331.png

   The displacement contour of Example 36.
   The figure was created using `ParaView <https://www.paraview.org/>`__.

See the source code of :exlink:`36` for more information.

Simply copy the image url from this issue and replace it in the template.

kinnala commented 2 weeks ago

I suggest that you save the mesh to file through mesh.save(”docs/examples/meshes/cylinder.msh”), include the mesh in the commit and avoid using pygmsh by loading the mesh in the beginning of the example, via MeshTri.load(…). I think pygmsh is not included in our CI.

kinnala commented 2 weeks ago

Finally, we accept nowadays only examples that have a matching license (BSD-3-clause) so hopefully you are able to use such a license instead of GPL.