getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about the Python interface


From: Konstantinos Poulios
Subject: Re: Questions about the Python interface
Date: Fri, 22 Oct 2021 10:43:44 +0200

Dear Lorenzo,

Thanks for your interest. Below some answers to your questions

BR
Kostas

On Thu, Oct 21, 2021 at 12:47 AM Lorenzo Ferro <lorenzo.iron@gmail.com> wrote:
Dear All,

I've started testing the GeFEM library and I've some questions, with particular reference to the Python interface (the only one I can use so far):

1) the "add_lumped_mass_for_first_order_brick" method is not available even though it is mentioned in the Python-Model guide for GetFEM 5.4. I've installed the precompiled 5.4 version for Windows with getfem5.4win-amd64-py3.7.exe. How can I get the Lumped_Mass feature for the Python interface? 
The scripting language interface for this function has been added after the last release:
https://git.savannah.nongnu.org/cgit/getfem.git/commit/interface/src/gf_model_set.cc?id=0241496a72624aca5f7f6a4f3725accee863d46e
so you will have to wait for the next release or compile GetFEM yourself.
 
2) The documentation of bricks like "Generic Elliptic Brick", "Fourier_Robin Brick" and "Source Term Brick" states that the coefficients could be arbitrary GWFL expressions. What happens if I'd input non-linear coefficients? How the software manages the assembly in this case? Or, it would be better to use the Model method "add_non_linear_term"?
Just use the add_linear_term or add_nonlinear_term for this. E.g. The add_fourier_robin_brick is just a convenience function calling add_(non)linear_term for you
image.png
Such bricks made sense before the introduction of GWFL, nowadays you should just use add_linear_term or add_nonlinear_term for everything.

3) If I'd like to implement a radiation non-linear boundary condition, what would be the more advisable way? Is in this case the "add_non_linear_term" method the correct way?
Yes. If you have a specific equation you want to implement, we can help with writing it in GWFL.
 
4) I've not understood what is the difference between "add_source_term" and "add_source_term_brick". Can you advise when I should use one or the other (with a practical example).
If I see correctly, providing an _expression_ "expr" and a variable name "var" to the second one is equivalent to providing "expr*Test_var" in the first one. In general you should not use these bricks because they add a contribution to the rhs that is not accounted for in the stiffness matrix computation. Rarely do you need something like this. You can just use "add_linear_term" and "add_nonlinear_term" for everything.
 
5) Is there a way to visualize mesh regions for doublecheck purposes? Maybe, is there a way to export such regions by means of the Python interface?
Good question. There are different ways, maybe the most simple is something like
mf.export_to_vtk("meshregions.vtk", mf, md.interpolation("1",mf,1), 'region1', mf, md.interpolation("1",mf,2), 'region2', mf, md.interpolation("1",mf,4), 'region4')
where mf is a (preferably discontinuous)  mesh_fem and md is just a model (it can be an empty one).
 
Thank you in advance for your kind support.
Regards,
Lorenzo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]