[Finite Element 6] Transient heat transfer (diffusion) in FEniCS: weak formulation & implementation

Ғылым және технология

After preparing the mesh to be imported into FEniCS in the previous video ( • [Finite Element 5] Ins... ), we want to go for the actual simulation in this one. As we discussed before, FEniCS is a very powerful open-source finite element framework, similar to FreeFEM. In this video, we derive the weak formulation of the time-dependent heat/diffusion partial differential equation (PDE) and solve it on our helical shape mesh to obtain the temperature profile over time.
Codes, models, and resources:
In order to follow the videos and reproduce the output, you may want to use the ready codes and models instead of creating them from scratch using the instructions from previous videos. You can find all the relevant stuff, grouped for different episodes at tuxriders.com/videos/finite-el... and github.com/TuxRiders/finite-e...
You can see the rest of the episodes of the finite element series here: • Introduction to finite...
Applied numerical computing series, in which the underlying theories of these videos are discussed: • Introduction to applie...
Topics covered:
🎯 Importing an external mesh into FEniCS
🎯 Deriving the weak form of the transient heat diffusion
🎯 Implementing the weak form in FEniCS models
🎯 Using GMSH to read the label of boundaries
🎯 Running FEniCS simulations in command-line
🎯 Visualizing the results in ParaView
Lecturer: Mojtaba Barzegari mbarzegary.github.io/
To learn more about the goals of the TuxRiders project, please visit our website at tuxriders.com.
Chapters in this video!
################
00:00 - Intro
00:46 - Deriving the weak form of transient heat diffusion
04:19 - Writing the FEniCS code
16:11 - Checking mesh labels using GMSH
17:15 - Running the simulation and viewing the results

Пікірлер: 21

  • @osmanfb1
    @osmanfb12 жыл бұрын

    Very nice. Now that I have installed FEniCSx, I'll try it. I also wanted to point out to another FE program which has a mathematical interface: Gridap.jl. It is written in Julia language. Similar to FEniCS but grad function is actually the nabla symbol, dot products are "." etc. So the input file looks more like what you see in the books/papers. I have Elmer, Gridap, FEniCS, Code-Aster, CalculiX, freeFEM++ installed. All have their place in your toolbox of PDE solvers.

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    thank you for your thorough comment. should check out Gridap.jl since I've been told by other people too. Elmer and Code-Aster will be used in upcoming videos to solve the problem you saw here to have a sort of comparison.

  • @MohammedBEffat
    @MohammedBEffat2 жыл бұрын

    It is not clear to me the meaning of "size_t". Regarding the "helix_facet_region" and the other file, I realized that they are generated after labeling with gmsh. So, seems that labeling/grouping of boundaries in other software (e.g., Salome, FreeCad, etc) is not necessary as long as I use FEniCS cause I need to get the mesh from GMSH. Right? Also, saw many recommendations to use meshio and xdmf extention rather than dolfin-convert and xml extension. Does doing this will also generate two xdmf files, one for facet (boundary) and another for interior (physical)? Thanks in advance.

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    good questions :) the "size_t" comes from the underlying dolfin engine and C++ world, referring to std::size_t, which defines the type of the MeshFunction. size_t means unsigned integer (other acceptable types are 'double, 'int', and 'bool'). you may search for std::size_t to know more about it. as long as you work using the python interface, you don't need to worry about this. regarding the redundant steps in SALOME, you are absolutely right, and I talked about the reasons in the 5th episode. we needed to do those steps for the FreeFEM model, and since FEniCS needs physical groups, we should do everything again in GMSH, meaning that the SALOME steps were not needed. moreover, meshio and xdmf can be your preferred approach for importing a mesh. meshio is a great tool with cool features, and you may use it as an alternative solution. I use meshio for some cases of mesh conversion, but the main issue with meshio is lack of proper documentation and not enough examples to follow, making it difficult in some scenarios to go on with it.

  • @MohammedBEffat
    @MohammedBEffat2 жыл бұрын

    Which is better in your opinion, FreeFEM or Fenics; in terms of its power, and also ease of learning?

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    a good question. I will talk about this in the next video, which will be posted next week :)

  • @paodequeijo7231
    @paodequeijo72312 жыл бұрын

    Very interesting video! Do you happen to know if a steel beam could be simulated given an amount of load on it via this method?

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    yes, of course you can. for doing that, you need to solve the elasticity equation, something similar to what is explained here: fenicsproject.org/pub/tutorial/html/._ftut1008.html

  • @albertojorgebaezacampuzano7563

    @albertojorgebaezacampuzano7563

    2 жыл бұрын

    @@TuxRiders Thanks for your videos, and i am applying such example (The beam), however, i have two question. First how to apply the boundary conditions, i already tried several ways and sometimes throws and error when applying the boundary conditions saying that an scalar is needed, (scalar instead of vector in a clamped beam?), but we need xyz right. and when i apply the scalar not even an error throws because the only things that says is "Transposed is only defined for rank 2 tensors. " as far as i can see that is because we change from vector to scalar in the BC (which is not right). The second thing, is: can we apply a deformation on the beam and extract the forces obtained?

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    @@albertojorgebaezacampuzano7563 sorry for my late reply. I thought I have answered this but apparently I'm getting old, forgetting things very fast :) have you had a look at FEniCS elasticity tutorials? I think you can find your answer by following the steps, like in these 2 documents: jorgensd.github.io/dolfinx-tutorial/chapter2/linearelasticity.html and fenics-solid-tutorial.readthedocs.io/en/latest/2DPlaneStrain/2D_Elasticity.html

  • @ghufranullahkhan7479
    @ghufranullahkhan74792 жыл бұрын

    Do we need to learn all of these things by self or their is any related book for leaning this. Kindly answer it please.

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    the core theories of finite element are discussed in 3 videos on TuxRiders (only the first one is uploaded at this moment: kzread.info/dash/bejne/foKZppuvddS0j7Q.html). in the beginning of the first video, a great book is introduced that can be very helpful in this regard. the videos are actually based on materials from this book.

  • @maryamjalili533
    @maryamjalili5332 жыл бұрын

    Hi Mojtaba, thanks, this video help me a lot. How could I do this if there are several materials with different transfer coefficients? For example, There is a 2D plate, but there are some circles with different materials in there? Obviously, heat should transfer inside them with different speed. it would be great if you could make a video and describe that. Thanks in advance

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    hi, you can do that using a function for diffusion coefficient instead of a static scalar value. so, for example, instead of k=300 shown in this video, you may put an expression like k=Expression('(x[2]>100)*300 + (x[2]

  • @maryamjalili533
    @maryamjalili5332 жыл бұрын

    I also have another request :) , could you please make a video and describe how a chemical reaction can be simulated with Fenics. For example, when fluid A and fluid B meet each other, fluid C will create. I'm looking forward to seeing it. I need it badly for my master thesis.

  • @TuxRiders

    @TuxRiders

    2 жыл бұрын

    great suggestion! sure, I will. this example on the FEniCS tutorials is very similar to what you want to do: fenicsproject.org/pub/tutorial/html/._ftut1010.html.

  • @RafiqulIslam-fl1ve
    @RafiqulIslam-fl1ve Жыл бұрын

    if K is K(X) then how can I find out weak form. Please help me you have chosen K is constant. I want to use value of K in the code as K=a+by

  • @TuxRiders

    @TuxRiders

    Жыл бұрын

    it's a good question. surprisingly, it doesn't have any effect on the weak form. you need to write it down yourself for both cases to see this in action. you may also have a look in this wikiversity pages, in which the weak form is derived where coefficient K is K(x): en.wikiversity.org/wiki/Nonlinear_finite_elements/Linear_heat_equation, and en.wikiversity.org/wiki/Nonlinear_finite_elements/Weak_form_of_heat_equation

  • @RafiqulIslam-fl1ve

    @RafiqulIslam-fl1ve

    Жыл бұрын

    @@TuxRiders Thank you so much. I have to solve heat transient problem in fenics, i need to apply heat flux. I am a complete beginner. Could you please give me some resources that can help me. I am searching but cannot proceed.

  • @TuxRiders

    @TuxRiders

    Жыл бұрын

    @@RafiqulIslam-fl1ve the heat flux can be modeled as a Neumann BC, which can be inserted directly in the weak form. this is an example of how it can be done in FEniCS: fenicsproject.org/olddocs/dolfin/2016.2.0/python/demo/documented/neumann-poisson/python/documentation.html

  • @RafiqulIslam-fl1ve

    @RafiqulIslam-fl1ve

    Жыл бұрын

    @@TuxRiders Okay. Thank you so much for your kind cooperation.

Келесі