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/sitepackages/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
Hi Dominique!
The term dw_volume_lvf expects its first argument to be a material. What you really want for int( v . q ) is dw_mass_vector (with density 1.0) or dw_volume_wdot (also with material set to 1.0).
The best term for this would be dw_volume_dot, but it's not available. There is only dw_volume_wdot, which does, in fact, the same thing as dw_mass_vector for vector arguments. So IMHO dw_mass_vector could be removed.
Also it should be an easy exercise to create dw_volume_dot by following dw_volume_wdot  just strip the material stuff. Would you like to try it? :)
r.
On 04/16/10 16:51, Dominique wrote:
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/sitepackages/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
On Apr 16, 4:07 pm, Robert Cimrman cimr...@ntc.zcu.cz wrote:
Hi Dominique!
The term dw_volume_lvf expects its first argument to be a material. What you really want for int( v . q ) is dw_mass_vector (with density 1.0) or dw_volume_wdot (also with material set to 1.0).
The best term for this would be dw_volume_dot, but it's not available. There is only dw_volume_wdot, which does, in fact, the same thing as dw_mass_vector for vector arguments. So IMHO dw_mass_vector could be removed.
Also it should be an easy exercise to create dw_volume_dot by following dw_volume_wdot  just strip the material stuff. Would you like to try it? :)
r.
Hi Robert,
I could make it work with dw_mass_vector. In the source code of dw_volume_wdot, there is:
if self.vdim > 1:
raise NotImplementedError
so SfePy won't process my equations with that term in them. What's best at this point? Move the code from dw_mass_vector to dw_volume_wdot? Yes, I'll have a go at dw_volume_dot ;).
Cheers, Dominique
On 04/16/10 18:49, Dominique wrote:
On Apr 16, 4:07 pm, Robert Cimrmancimr...@ntc.zcu.cz wrote:
Hi Dominique!
The term dw_volume_lvf expects its first argument to be a material. What you really want for int( v . q ) is dw_mass_vector (with density 1.0) or dw_volume_wdot (also with material set to 1.0).
The best term for this would be dw_volume_dot, but it's not available. There is only dw_volume_wdot, which does, in fact, the same thing as dw_mass_vector for vector arguments. So IMHO dw_mass_vector could be removed.
Also it should be an easy exercise to create dw_volume_dot by following dw_volume_wdot  just strip the material stuff. Would you like to try it? :)
r.
Hi Robert,
I could make it work with dw_mass_vector. In the source code of dw_volume_wdot, there is:
if self.vdim> 1: raise NotImplementedError
Ah ok, I missed that one.
so SfePy won't process my equations with that term in them. What's best at this point? Move the code from dw_mass_vector to dw_volume_wdot? Yes, I'll have a go at dw_volume_dot ;).
Great! Yes, you can try merging dw_volume_wdot with dw_mass_vector. I have to go now, good luck!
r.
On Apr 16, 5:58 pm, Robert Cimrman cimr...@ntc.zcu.cz wrote:
On 04/16/10 18:49, Dominique wrote:
On Apr 16, 4:07 pm, Robert Cimrmancimr...@ntc.zcu.cz wrote:
Hi Dominique!
The term dw_volume_lvf expects its first argument to be a material. What you really want for int( v . q ) is dw_mass_vector (with density 1.0) or dw_volume_wdot (also with material set to 1.0).
The best term for this would be dw_volume_dot, but it's not available. There is only dw_volume_wdot, which does, in fact, the same thing as dw_mass_vector for vector arguments. So IMHO dw_mass_vector could be removed.
Also it should be an easy exercise to create dw_volume_dot by following dw_volume_wdot  just strip the material stuff. Would you like to try it? :)
r.
Hi Robert,
I could make it work with dw_mass_vector. In the source code of dw_volume_wdot, there is:
if self.vdim> 1: raise NotImplementedError
Ah ok, I missed that one.
so SfePy won't process my equations with that term in them. What's best at this point? Move the code from dw_mass_vector to dw_volume_wdot? Yes, I'll have a go at dw_volume_dot ;).
Great! Yes, you can try merging dw_volume_wdot with dw_mass_vector. I have to go now, good luck!
I think I was able to create dw_volume_dot from dw_volume_wdot but I'm still trying to understand how dw_mass_vector works. Its mechanism seems to be quite different. What is the best way to propose contributed code? Should I just fork the git repo and send pull requests?
Thanks, Dominique
On 04/20/10 15:13, Dominique wrote:
On Apr 16, 5:58 pm, Robert Cimrmancimr...@ntc.zcu.cz wrote:
On 04/16/10 18:49, Dominique wrote:
On Apr 16, 4:07 pm, Robert Cimrmancimr...@ntc.zcu.cz wrote:
Hi Dominique!
The term dw_volume_lvf expects its first argument to be a material. What you really want for int( v . q ) is dw_mass_vector (with density 1.0) or dw_volume_wdot (also with material set to 1.0).
The best term for this would be dw_volume_dot, but it's not available. There is only dw_volume_wdot, which does, in fact, the same thing as dw_mass_vector for vector arguments. So IMHO dw_mass_vector could be removed.
Also it should be an easy exercise to create dw_volume_dot by following dw_volume_wdot  just strip the material stuff. Would you like to try it? :)
r.
Hi Robert,
I could make it work with dw_mass_vector. In the source code of dw_volume_wdot, there is:
if self.vdim> 1: raise NotImplementedError
Ah ok, I missed that one.
so SfePy won't process my equations with that term in them. What's best at this point? Move the code from dw_mass_vector to dw_volume_wdot? Yes, I'll have a go at dw_volume_dot ;).
Great! Yes, you can try merging dw_volume_wdot with dw_mass_vector. I have to go now, good luck!
I think I was able to create dw_volume_dot from dw_volume_wdot but I'm still trying to understand how dw_mass_vector works. Its mechanism seems to be quite different. What is the best way to propose contributed code? Should I just fork the git repo and send pull requests?
Cool!
Yes, there is a sort of disorder in the ways terms are defined, due to historical reasons. dw_mass_vector is much older then dw_volume_wdot, where I tried to avoid C completely. I guess you can choose whatever way works. Let me see what you have.
For contributed code, you can either setup a github repo as you say, or simply send a patch using 'git formatpatch' (or from GUI, if you have qgit: qgit4 > save patch) to this list. I can then apply such patches with 'git am'. It preserves the author and date. For me the latter way is easier, as I do not have to clone anything :)
cheers, r.
participants (2)

Dominique

Robert Cimrman