On 11/01/2012 04:19 PM, Bjarke Dalslet wrote:
Ah yes, the power source is the same one as in examples/diffusion/poisson_parametric_study.py. BTW, is there a mistake in that files header? I believe the strong form should be $c\nabla^2 t=f$ and not $c\nabla t=f$.
Yes, there is a typo, thanks for spotting that! It is fixed now.
I put it in the periodic boundary example anyway as it was a good way to visualize the periodic boundary condition. I have attached the files (.geo, .mesh and .py) and a patch.
Wow, I wish I mastered gmsh in such a way :)
IMHO this example should have the 'quasistatic' time solver option set to False. When it is True, an equilibrium is computed already for t = 0, so the next few time steps do nothing until you set the power off. With False, a nice time evolution is obtained, as can be seen when the color range is fixed by running:
./postproc.py cylinder_in_box.??.vtk -b --ranges=T,0,4.3
Then I have some few recommendations (do not get scared :)):
- Replace the periodic boundary condition definition by the short syntax version, so that all keywords use the same:
epbcs = { # In the y-direction 'periodic_y' : (['y+', 'y-'], {'T.0' : 'T.0'}, 'match_y_plane'), # and in the z-direction. Due to the symmetry of the problem, this periodic # boundary condition is actually not necessary, but we include it anyway. 'periodic_z' : (['z+', 'z-'], {'T.0' : 'T.0'}, 'match_z_plane'), }
Try to follow our coding style [1], which is basically what PEP-0008 says (lines max. 79 characters, spaces around '=' in assignment except keyword arguments, spaces behing commas...). The code should look like poisson_field_dependent_material.py does now. It really improves the readability for others. [2] might help here, with small tweaks mentioned below. It's not perfect, but gets most things right.
Instead of np.ones(len(coors[:,0]))*0, use np.zeros(), or np.zeros_like().
Also, in SfePy, we use nm for numpy abbreviation, as it started before np was declared standard by numpy guys. So, please, use nm for the moment. We may some day mass-replace all occurrences of nm. to np., but...
That's about it - I could have made the above changes myself, but by doing it yourself you might get it into your ways :) It's a nice example btw.
Cheers & thanks for contributing! r.
[1] http://docs.sfepy.org/doc-devel/developer_guide.html#coding-style [2] http://pypi.python.org/pypi/PythonTidy/
tweaks for [2]:
COL_LIMIT = 79 DICT_COLON = ' : ' ADD_BLANK_LINES_AROUND_COMMENTS = False MAX_SEPS_FUNC_DEF = 50 # 2007 May 24 PARENTHESIZE_TUPLE_DISPLAY = False # 2010 Mar 10
- Bjarke
On 31 October 2012 16:48, Robert Cimrman cimr...@ntc.zcu.cz wrote:
On 10/31/2012 04:07 PM, Bjarke Dalslet wrote:
It works very well now.
I did try with problem.evaluate at first, but missed the mode='qp', so I could not make it work. I guess this is the intended way anyway as it is also compatible with the history attribute being 1.
Lots of good stuff in your edit - it will go straight into my own work ;D
Hth!
I might want to try doing a few other poisson examples involving:
- Periodic boundary conditions using gmsh for meshing
That would be interesting, especially the meshing part, as the periodic regions must have matching nodes.
- How to implement a heat source
This is probably already covered by examples/diffusion/poisson_**functions.py and examples/diffusion/poisson_**parametric_study.py, no?
Are these relevant, or should I just save the effort?
- Bjarke