Initial basic read support for MED file format (salome platform and pythonocc)
by Logan Sorenson

Hi All,
Please find attached a patch to sfepy/fem/meshio.py for basic read
support for MED format meshes. I'm attaching the patch here since
github seems to be down in the US. MED is the native mesh format for
the very powerful open-source meshing tools salome [1] and pythonocc
[2].
Actually, it is very incomplete, but seems to work with the provided
example mesh (Mesh_1.med). I only tried loading the mesh with
postproc.py, so I haven't run any calculations on it yet (I assume
that should work ok). So far, it only supports 3D 8-node hexahedral
elements, so I suppose it is more of an example of reading the format
than an actual final production code. :) I hope it can be generalized
to work with more MED meshes.
I found some French documentation on MED in the source packages at
[1]; I used google docs to translate it to English, so if someone
wants a copy of that, let me know. I'm looking for a better English
version of these docs.
Best regards,
Logan
[1] http://www.salome-platform.org
[2] http://www.pythonocc.org
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 11 months

docstring standard + a bit of git
by Robert Cimrman

Hi All,
The developer guide [1] now contains info on our doctring standard + info on
how to introduce yourself properly to git:
Introduce yourself to git and make (optionally) some handy aliases either in
.gitconfig in your home directory (global setting for all your git projects),
or directly in .git/config in the repository:
[user]
email = ma...(a)mail.org
name = Name Surname
[color]
ui = auto
interactive = true
[alias]
ci = commit
di = diff --color-words
st = status
co = checkout
r.
[1] http://docs.sfepy.org/doc-devel/developer_guide.html
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 11 months

new debug()
by Robert Cimrman

FYI: the debug() function [1] was significantly improved - it uses IPython/ipdb
if those are available, so you get colors, tab completion and all that fancy
stuff while debugging.
r.
[1] http://docs.sfepy.org/doc-devel/src/sfepy/base/base.html
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 11 months

newby
by D-rod

Dear sfepy-devel group,
I have read with interest the home website of the sfepy project. I
would like to give it a try, however I have a question about mesh
generation. I am downloading Mayavi2 at the moment. As far as I know
it is the best front end to generate and visualise VTK files. However,
I would like to know if you have a better suggestion for a 'free' mesh
generator software.
regards,
David
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 12 months

Extract Jacobian of a specific equation
by Dominique

Hi Robert,
>From a given configuration file, I think I am able to extract the
Jacobian (called the "tangent matrix" in the code) and the right-hand
side as follows:
def get_problem(fName=__file__):
"""
Read the configuration specified in the file specified in argument
(the present file by default) and return an initialized problem
constructed from it along with an initial state vector.
"""
from sfepy.base.conf import ProblemConf, get_standard_keywords
from sfepy.fem import eval_term_op, ProblemDefinition
required, other = get_standard_keywords()
# Use this file as the input file to gather configuration.
conf = ProblemConf.from_file(fName, required, other)
# Create a ProblemDefinition instance from current configuration.
problem = ProblemDefinition.from_conf(conf,
init_variables=True,
init_equations=True)
state = problem.create_state_vector()
problem.init_variables(state)
problem.time_update(None)
return (problem, state)
def get_jacobian(problem, state=None):
"""
Return the Jacobian matrix of the system in SciPy CSR format.
Input arguments are as returned by `get_problem()`.
"""
# Instantiate a problem evaluator.
evaluator = problem.get_evaluator(mtx=problem.mtx_a)
if state is None:
state = problem.create_state_vector()
jac = evaluator.eval_tangent_matrix(state)
return jac
Am I missing anything here (e.g., I'm not sure the BCs and ICs are
taken into account)?
Now I'd like to extract the contribution of a particular equation to
this Jacobian. How can I do that? This is what I've tried but it seems
to return the whole Jacobian:
def get_equation_jacobian(problem, equation, state=None):
"""
Return the Jacobian matrix of a specific equation in SciPy CSR
format.
"""
from sfepy.fem.evaluate import assemble_matrix
evaluator = problem.get_evaluator(mtx=problem.mtx_a)
if state is None:
state = problem.create_state_vector()
problem.variables.data_from_state(state)
jac = problem.mtx_a
jac = assemble_matrix(jac, equation,
problem.variables, problem.materials,
**evaluator.data)
return jac
In fact, this function returns None, but problem.mtx_a contains the
entire Jacobian. I suppose I should specify a different matrix when I
instantiate the evaluator, but where can I discover its size?
Thanks!
Dominique
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 12 months

sfepy-issues mailing list
by Robert Cimrman

Just a little reminder: there is also the sfepy-issues mailing list, which
reports automatically any changes of the issues (new issues, updates, comments
etc.). Often the comments can help you solve some problem, so you may want to
join that list too, if you read this one - it complements the information given
here.
r.
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 12 months

Material not found
by Dominique

Hi there,
I'm experimenting with a mixed finite element formulation of the
Poisson equation to become more familiar with the terms in SfePy. The
equations are
int( v . grad(p) ) + int ( f p ) = 0,
int( c u div(q) ) = int( v . q ),
where u is a scalar unknown, v is a vector unknown, p is a scalar test
function and q is a vector test function.
I'm getting the error message:
IndexError: material(s) "v" not found!
My code is as follows:
material_1 = {
'name' : 'coef',
'region' : 'Omega',
'values' : {'val' : 1.0},
}
material_2 = {
'name' : 'source_term',
'region' : 'Omega',
'mode' : 'function',
'function' : 'source_term_func',
}
field_1 = {
'name' : 'temperature',
'dim' : (1,1), # First component = # degrees of
freedom per node
'flags' : (),
'domain' : 'Omega',
'bases' : {'Omega' : '2_3_P1'}
}
field_2 = {
'name' : 'grad_temperature',
'dim' : (2,1),
'flags' : (),
'domain' : 'Omega',
'bases' : {'Omega' : '2_3_P2'}
}
variable_1 = {
'name' : 'u',
'kind' : 'unknown field',
'field' : 'temperature',
'order' : 0, # Appears first in the global vector of unknowns.
}
variable_2 = {
'name' : 'p',
'kind' : 'test field',
'field' : 'temperature',
'dual' : 'u', # This is a test function corresponding to u.
}
variable_3 = {
'name' : 'v',
'kind' : 'unknown field',
'field' : 'grad_temperature',
'order' : 1,
}
variable_4 = {
'name' : 'q',
'kind' : 'test field',
'field' : 'grad_temperature',
'dual' : 'v', # This is a test function corresponding to v.
}
integral_1 = {
'name' : 'i1',
'kind' : 'v',
'quadrature' : 'gauss_o2_d2',
}
equations = {
'Temperature1' : """dw_stokes.i1.Omega( v, p ) =
dw_volume_lvf.i1.Omega( source_term.val, p )""",
'Temperature2' : """dw_stokes.i1.Omega( q, u ) =
dw_volume_lvf.i1.Omega( v, q )""",
}
The whole log is:
sfepy: left over: ['source_term_func', 'data_dir', 'nm', '_filename',
'__package__', '__doc__', '__builtins__', 'ebc_sin', '__file__',
'__name__', 'ebc_sin2', 'amplitude']
sfepy: reading mesh (/Users/dpo/local/src/sfepy/meshes/2d/
square_unit_tri.mesh)...
sfepy: ...done in 0.00 s
/Users/dpo/local/lib/python2.6/site-packages/numpy/lib/utils.py:140:
DeprecationWarning: `unique1d` is deprecated!
warnings.warn(depdoc, DeprecationWarning)
sfepy: setting up domain edges...
sfepy: ...done in 0.00 s
sfepy: creating regions...
sfepy: Omega
sfepy: Gamma_Top
sfepy: Gamma_Bottom
sfepy: ...done in 0.01 s
sfepy: equation "Temperature2":
sfepy: dw_stokes.i1.Omega( q, u ) = dw_volume_lvf.i1.Omega( v, q )
sfepy: equation "Temperature1":
sfepy: dw_stokes.i1.Omega( p, v ) =
dw_volume_lvf.i1.Omega( source_term.val, p )
Traceback (most recent call last):
File "/Users/dpo/local/src/sfepy/simple.py", line 106, in <module>
main()
File "/Users/dpo/local/src/sfepy/simple.py", line 99, in main
app = SimpleApp( conf, options, output_prefix )
File "/Users/dpo/local/src/sfepy/sfepy/applications/simple_app.py",
line 50, in __init__
**kwargs )
File "/Users/dpo/local/src/sfepy/sfepy/fem/problemDef.py", line 88,
in from_conf
obj.set_equations( conf.equations )
File "/Users/dpo/local/src/sfepy/sfepy/fem/problemDef.py", line 168,
in set_equations
self.materials, user )
File "/Users/dpo/local/src/sfepy/sfepy/fem/equations.py", line 142,
in setup_terms
eq.setup_terms(regions, variables, materials, self.caches, user)
File "/Users/dpo/local/src/sfepy/sfepy/fem/equations.py", line 310,
in setup_terms
self.check_term_args( variables, materials, user )
File "/Users/dpo/local/src/sfepy/sfepy/fem/equations.py", line 260,
in check_term_args
term.check_args(variables, materials, user)
File "/Users/dpo/local/src/sfepy/sfepy/terms/terms.py", line 330, in
check_args
'material(s) "%s" not found!')
File "/Users/dpo/local/src/sfepy/sfepy/base/base.py", line 780, in
check_names
raise IndexError(msg % missing)
IndexError: material(s) "v" not found!
What am I doing wrong?
Thanks!
Dominique
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.
8 years, 12 months