Hi,
I was wondering how to implement the electrostatic-elastic coupling in
SfePy. Basically, I think this coupling is described by the Maxwell
stress tensor [1] which gives the stress due to the electrostatic
field (setting the magnetic field to 0 in the quasistatic
approximation) on the surface of a conductor.
I think the coupling can be handled in a similar manner with the
piezoelectric coupling. For example, in input/piezo.py, the equations
are:
equations = {
'1' : """- %f * dw_mass_vector.i1.Y( inclusion.density, v, u )
+ dw_lin_elastic_iso.i1.Y( inclusion.lam, inclusion.mu, v, u )
- dw_piezo_coupling.i1.Y2( inclusion.coupling, v, phi )
= 0""" % omega_squared,
'2' : """dw_diffusion.i1.Y( inclusion.dielectric, psi, phi )
+ dw_piezo_coupling.i1.Y2( inclusion.coupling, u, psi )
= 0""",
}
I think there should be a similar set of equations for the
electrostatic-elastic coupling case, but the integration should be
done over the interface of the elastic material and the vacuum
regions. I think that can be handled by adding a 2D integral in the
problem definition. What I'm missing is how to define the coupling
term in SfePy. I think the form of the term is basically the same as
dw_surface_ltr in sfepy_manual.pdf. Also, it looks like the gradient
of the electric potential can be obtained from cachesBasic.
Is it possible to use the gradient of the electric potential
information to calculate the Maxwell stress tensor using appropriate
vector operations (divergence and dot product), along with the
dielectric tensor? Would this be doable through the dw_surface_ltr
term? Or is it better to implement a new coupling term (based off
dw_surface_ltr) to handle this (and how would one go about that :) )?
Hope everything is clear! Any advice is greatly appreciated!
Thanks,
Logan
[1] http://en.wikipedia.org/wiki/Maxwell_stress_tensor
Hi,
I finally got some time to update the sphinx documentation. The final
result is at [1] and the git repo can be cloned from [2]. Basically,
so far I've just pulled stuff from the google pages and converted into
sphinx format and did some polishing. I think it's a good start, but
definitely needs more work! For example, the tutorial right now is
more "theoretical", and may not be "practical" enough for a new user
to understand...probably this can be separated into a simpler tutorial
and then an advanced tutorial or reference section, especially the
problem description format.
Also, I haven't had time to look into genDocs.py yet...
Thanks!
Logan
[1] http://logansorenson.github.com/sfepy_doc2
[2] git://github.com/logansorenson/sfepy_doc2.git
Hi,
the Git version now contains a lot of interesting changes and new features compared to the latest released version (2009.3), see the would-be RELEASE_NOTES below. There are still some problems to be addressed, though, listed here:
Known problems:
---------------
- undocumented new features:
- 'functions' keyword and change to materials definition
- new application option 'use_equations' to select equations
- homogenization is completely undocumented
- chunk_size must be greater than the number of elements (-> 1 chunk only)
for the "materials in physical QPs" to work properly
- isfepy is broken for multiple view() calls!
- sfepy_gui.py not updated for new Viewer capabilities (animations etc.)
- is the installation within femhub ok?? (Viewer changed a lot...)
While I will try to fix the problems before releasing, I am not sure we shall wait till all of them are fixed, what do you think?
I would also appreciate some help, apart from the usual testing. While there is probably nobody familiar enough with the internals (or am I wrong?), the topic accessible to some of you is the documentation, namely the 'functions' keyword and change to materials definition - if you feel like fixing this at [1], go ahead, please.
I would also like to set-up a sphinx-based documentation site for sfepy, like [2] or [3], probably using github. Any volunteers out there? I have made some attempts to learn how to do it, but have currently no time to go on. And yes, new functions added to sfepy are documented and use the sphinx-compatible format, following the numpy's standards.
[1] http://code.google.com/p/sfepy/wiki/ProblemDescription
[2] http://docs.scipy.org/doc/
[3] http://docs.sympy.org/
Feel free to ask anything related to the features described below.
Yours truly,
r.
Would-be RELEASE_NOTES:
-----------------------
- major branches merged:
- 'ulf' branch: updated Lagrangian (UL) formulation
- 'functions' branch:
- unified passing extra arguments to boundary condition, material, and region
functions
- physical quadrature point generation
- unified/improved handling of material parameters in terms:
- all material parameters defined in physical quadrature points
- all terms updated, some terms were coalesced into one
- 'porous' branch: homogenized porous media
- input file keywords:
- new 'functions' keyword
- simplifications & unifications:
- results of all time steps of an evolutionary problem can be saved to a
single HDF5 file
- enable passing variables data to ProblemDefinition.solve()
- runTests.py: allow multiple test files as command line arguments
- Viewer.call_mlab() split and refactored
- short syntax for periodic boundary conditions
- simplified input file syntax of materials
- postprocessing and visualization:
- using FileSource class abstracts the particular format for storing results:
- VTK, HDF5 supported now
- support for file sequences (evolutionary simulations)
- time step selection for HDF5 (single) and VTK (sequence) files
- animations (using ffmpeg)
- minimalistic ViewerGUI
- show scalar bars
- watch results file (HDF5) and add time steps as they are saved
- listing data ranges works offscreen, summary for file sequence
- sfepy_gui.py: Mayavi2-based GUI to launch simulations
- changes aimed at interactive work:
- Domain, Region, Field creation refactoring
- data probing - postprocessing mode:
- read a previously probed data from the probe text file, re-plot them, and
integrate them along the probe
- graphical logging:
- dynamic adding of data groups (new axes) to Log and ProcessPlotter
- many bug fixes, namely:
- fix import_file() for multiple imports
- miscellaneous updates:
- quasistatic time stepping
- new zero-order elements: 3_4_P0, 3_8_Q0
- more elastic tensor construction functions:
- elastic tensor from Young's modulus and Poisson's ratio
- elastic tensors for use in mixed formulation
- setting of parameter variables by a user-defined function
- new terms:
- dw_volume_wdot_scalar_eth (exponential decay dot product convolution term)
- dw_biot_eth (exponential decay Biot convolution term)
- dw_lin_elastic_eth (exponential decay elastic convolution term)
- updated Lagrangian (UL) formulation terms:
- dw_ul_bulk_penalty, dw_ul_he_neohook, dw_ul_he_mooney_rivlin
Hi again,
I just ran ./runTests.py with the latest git and I noticed one test was
failing (tests/test_input_linear_elastic.py). However, when I ran
./runTests.py --debug tests/test_input_linear_elastic.py, the test is
passing. It also passes with just ./runTests.py
tests/test_input_linear_elastic.py. Here's the output:
logan@phoenix:~/projects/sfepy$
./runTests.py
<<< directory: tests, test files:
36
tests/test_lcbc_3d.py
/usr/lib/python2.5/site-packages/scipy/linsolve/__init__.py:4:
DeprecationWarning: scipy.linsolve has moved to scipy.sparse.linalg.dsolve
warn('scipy.linsolve has moved to scipy.sparse.linalg.dsolve',
DeprecationWarning)
/home/logan/projects/sfepy/sfepy/fem/extmods/geometry.py:174:
DeprecationWarning: PyArray_FromDims: use PyArray_SimpleNew.
return _geometry.VolumeGeometry_variable(self,
*args)
/home/logan/projects/sfepy/sfepy/fem/extmods/geometry.py:174:
DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
return _geometry.VolumeGeometry_variable(self,
*args)
+++ test_linear_rigid_body_bc:
ok
tests/test_functions.py
+++ test_ebc_functions:
ok
+++ test_material_functions:
ok
+++ test_region_functions:
ok
tests/test_assembling.py
+++ test_dq_de:
ok
+++ test_surface_evaluate:
ok
+++ test_vector_matrix:
ok
tests/test_input_kostka.py
+++ test_input:
ok
tests/test_periodic_bc_3d.py
+++ test_pbc:
ok
tests/test_input_stabilized_navier_stokes.py
+++ test_input:
ok
tests/test_msm_laplace.py
+++ test_msm_laplace:
ok
tests/test_input_acoustics.py
+++ test_input:
ok
tests/test_input_sinbc.py
+++ test_input:
ok
tests/test_elasticity_small_strain.py
+++ test_get_solution:
ok
+++ test_linear_terms:
ok
tests/test_periodic_bc_2d.py
+++ test_pbc:
ok
tests/test_meshio.py
nodes: 100%
|################################################################################################################################################################|
Time: 00:00:00
elements: 100%
|#############################################################################################################################################################|
Time: 00:00:01
+++ test_read_meshes:
ok
+++ test_compare_same_meshes:
ok
+++ test_read_dimension:
ok
tests/test_input_piezo.py
+++ test_ebc:
ok
+++ test_input:
ok
tests/test_input_le.py
+++ test_input:
ok
tests/test_quadratures.py
+++ test_problem_creation:
ok
tests/test_input_biot.py
+++ test_input:
ok
tests/test_parsing.py
+++ test_parse_equations:
ok
+++ test_parse_regions:
ok
tests/test_input_time_poisson.py
/usr/lib/python2.5/site-packages/scipy/sparse/linalg/dsolve/linsolve.py:147:
SparseEfficiencyWarning: splu requires CSC matrix
format
warn('splu requires CSC matrix format',
SparseEfficiencyWarning)
+++ test_input:
ok
tests/test_laplace_unit_square.py
+++ test_boundary_fluxes:
ok
+++ test_solution:
ok
tests/test_input_linear_elastic_dynamic.py
+++ test_input:
ok
tests/test_io.py
+++ test_recursive_dict_hdf5:
ok
/usr/lib/python2.5/site-packages/scipy/sparse/compressed.py:24:
DeprecationWarning: dims= is deprecated, use shape=
instead
warn("dims= is deprecated, use shape= instead",
DeprecationWarning)
+++ test_sparse_matrix_hdf5:
ok
tests/test_input_linear_elastic.py
--- test_input:
failed!
tests/test_linear_solvers.py
/usr/lib/python2.5/site-packages/numpy/lib/utils.py:108: DeprecationWarning:
scipy.linalg.cg is deprecated, use scipy.sparse.linalg.cg
warnings.warn(str1,
DeprecationWarning)
/usr/lib/python2.5/site-packages/numpy/lib/utils.py:108: DeprecationWarning:
scipy.linalg.bicgstab is deprecated, use
scipy.sparse.linalg.bicgstab
warnings.warn(str1,
DeprecationWarning)
/usr/lib/python2.5/site-packages/numpy/lib/utils.py:108: DeprecationWarning:
scipy.linalg.qmr is deprecated, use
scipy.sparse.linalg.qmr
warnings.warn(str1,
DeprecationWarning)
+++ test_solvers:
ok
tests/test_input_subdomains.py
+++ test_input:
ok
tests/test_input_octahedron.py
nodes: 100%
|################################################################################################################################################################|
Time: 00:00:00
elements: 100%
|#############################################################################################################################################################|
Time: 00:00:00
+++ test_input:
ok
tests/test_lcbc_2d.py
+++ test_linear_rigid_body_bc:
ok
tests/test_base.py
+++ test_struct_add:
ok
+++ test_struct_i_add:
ok
tests/test_volume.py
+++ test_volume:
ok
tests/test_input_biot_npbc.py
/home/logan/projects/sfepy/sfepy/fem/extmods/geometry.py:256:
DeprecationWarning: PyArray_FromDims: use
PyArray_SimpleNew.
return _geometry.SurfaceGeometry_variable(self,
*args)
/home/logan/projects/sfepy/sfepy/fem/extmods/geometry.py:256:
DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
return _geometry.SurfaceGeometry_variable(self,
*args)
+++ test_input:
ok
tests/test_msm_symbolic.py
/usr/lib/pymodules/python2.5/sympy/matrices/matrices.py:1443: UserWarning:
Deprecated: use zeros()
instead.
warnings.warn( 'Deprecated: use zeros() instead.'
)
+++ test_msm_symbolic_diffusion:
ok
+++ test_msm_symbolic_laplace:
ok
tests/test_input_navier_stokes.py
+++ test_input:
ok
tests/test_input_pfdpm_permeability.py
+++ test_input:
ok
tests/test_term_consistency.py
+++ test_consistency_d_dw:
ok
tests/test_laplace_unit_disk.py
+++ test_boundary_fluxes:
ok
tests/test_input_hyperelastic.py
+++ test_input:
ok
tests/test_input_poisson.py
+++ test_input:
ok
36 test file(s) executed in 77.16 s, 1 failure(s) of 49
test(s)
logan@phoenix:~/projects/sfepy$ ./runTests.py --debug
tests/test_input_linear_elastic.py
<<<
tests/test_input_linear_elastic.py
sfepy: left over: ['__builtins__', '_filename', '__file__', 'TestInput',
'input_name', '__name__', 'output_name', '__doc__']
sfepy: left over: ['_filename', '__builtins__', '__doc__', '__name__',
'__file__']
>>> test instance prepared (1
test(s))
... solving
../input/linear_elastic.py...
sfepy: reading mesh
(database/simple.vtk)...
sfepy: ...done in 0.05
s
sfepy: setting up domain
edges...
sfepy: ...done in 0.02
s
sfepy: setting up domain
faces...
sfepy: ...done in 0.01
s
sfepy: creating
regions...
sfepy:
Right
sfepy:
Omega
sfepy:
Left
sfepy: ...done in 0.04
s
sfepy: equation
"balance_of_forces":
sfepy: dw_lin_elastic_iso.i1.Omega( solid.lam, solid.mu, v, u ) =
0
sfepy: setting up dof
connectivities...
sfepy: ...done in 0.00
s
sfepy: describing geometries...
sfepy: ...done in 0.01 s
sfepy: using solvers:
nls: newton
ls: ls
sfepy: matrix shape: (900, 900)
sfepy: assembling matrix graph...
sfepy: ...done in 0.02 s
sfepy: matrix structural nonzeros: 31842 (3.93e-02% fill)
sfepy: updating materials...
sfepy: solid
sfepy: ...done in 0.00 s
sfepy: updating variables...
sfepy: ...done
/usr/lib/python2.5/site-packages/scipy/linsolve/__init__.py:4:
DeprecationWarning: scipy.linsolve has moved to scipy.sparse.linalg.dsolve
warn('scipy.linsolve has moved to scipy.sparse.linalg.dsolve',
DeprecationWarning)
sfepy: nls: iter: 0, residual: 8.696725e-03 (rel: 1.000000e+00)
sfepy: rezidual: 0.01 [s]
sfepy: solve: 0.04 [s]
sfepy: matrix: 0.01 [s]
sfepy: nls: iter: 1, residual: 5.531265e-18 (rel: 6.360170e-16)
... ../input/linear_elastic.py solved
+++ test_input: ok
>>> all passed in 1.58 s
1 test file executed in 1.58 s, 0 failure(s) of 1 test(s)
logan@phoenix:~/projects/sfepy$ ./runTests.py
tests/test_input_linear_elastic.py
tests/test_input_linear_elastic.py
/usr/lib/python2.5/site-packages/scipy/linsolve/__init__.py:4:
DeprecationWarning: scipy.linsolve has moved to scipy.sparse.linalg.dsolve
warn('scipy.linsolve has moved to scipy.sparse.linalg.dsolve',
DeprecationWarning)
+++ test_input: ok
1 test file executed in 1.55 s, 0 failure(s) of 1 test(s)
Hi,
First of all, sorry for disappearing for a month or so. Things got really
busy with moving and starting school again.
I cloned the latest git repository from [1] and issued a make in the root
sfepy directory. Then I ran ./runTests.py and everything passed.
So I tried to run the poisson_parametric_study example and got the following
parser exception.:
logan@phoenix:~/projects/sfepy$ ./simple.py
input/poisson_parametric_study.py
sfepy: left over: ['select_circ', 'vary_omega1_size', '__builtins__',
'__file__', 'output', '__name__', 'pause', 'nm', '_filename',
'default_diameter', 'debug', 'os', '__doc__']
sfepy: reading mesh
(database/square_circ.vtk)...
sfepy: ...done in 0.02
s
sfepy: setting up domain
edges...
sfepy: ...done in 0.01
s
sfepy: creating regions...
sfepy: leaf Omega region_Omega__2
parsing failed: Struct:Omega_1
name:
Omega_1
select:
nodes by select_circ( x, y, z, 0.250000 )
Traceback (most recent call last):
File "./simple.py", line 100, in <module>
main()
File "./simple.py", line 93, in main
app = SimpleApp( conf, options, output_prefix )
File "/home/logan/projects/sfepy/sfepy/applications/simple_app.py", line
48, in __init__
**kwargs )
File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 83, in
from_conf
obj.set_regions(conf.regions, conf.materials, obj.functions)
File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 124, in
set_regions
self.domain.create_regions(conf_regions, functions)
File "/home/logan/projects/sfepy/sfepy/fem/domain.py", line 589, in
create_regions
out = bnf.parseString( rdef.select )
File "/usr/lib/pymodules/python2.5/pyparsing.py", line 1076, in
parseString
raise exc
pyparsing.ParseException: Expected end of text (at char 20), (line:1,
col:21)
I fired up winpdb and was able to find the exception raised at line 589 in
sfepy/fem/domain.py. It looks it isn't parsing the region definition on line
45 of poisson_parametric_study.py:
'Omega_1' : ('nodes by select_circ( x, y, z, %f )' % default_diameter, {}),
The parser fails on the '(' character in the string 'nodes by select_circ(
x, y, z, %f )'. Since I'm not familiar yet with pyparsing, that's as far as
I can get for now. Does anyone else see this?
Thanks!
Logan
[1] : git://git.sympy.org/sfepy.git
Hi again Logan,
after the problem starts to work, try
./postproc.py output/r_omega1/square_circ_*.vtk -l
./postproc.py output/r_omega1/square_circ_*.vtk -b --ranges=t,0,2.9
to see the results. The first line prints the data ranges - that is how
I have found the value 2.9 that is in the second line.
The latest ETS (mayavi) 3.3.0 is required though...
r.