Problems with Region.from_vertices
![](https://secure.gravatar.com/avatar/55ed926cf05100416cc712d72716db70.jpg?s=120&d=mm&r=g)
I am trying to use the option Region.from_vertices in order to create a region to apply boundary conditions. I want to use this function because I can easily identify the vertices on which I need to apply boundary conditions. However I get an error when I try to use the created surface, see below. I notice by comparing with other regions that work, that the region created has missing information but don't know how to fix it.
Your help is appreciated,
Adolfo
Traceback (most recent call last):
File "PoroElasticity_paper_ext_3.py", line 520, in <module>
main()
File "PoroElasticity_paper_ext_3.py", line 454, in main
vec = pb.solve()
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/problem.py", line 1020, in solve
vec = nls(vec0, status=self.nls_status)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/solvers/nls.py", line 251, in __call__
vec_r = fun(vec_x)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/evaluate.py", line 52, in eval_residual
vec_r = self.problem.equations.eval_residuals(vec)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 677, in eval_residuals
self.evaluate(mode='weak', dw_mode='vector', asm_obj=out)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 613, in evaluate
term_mode=term_mode, asm_obj=asm_obj)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 830, in evaluate
ret_status=True)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py", line 1240, in evaluate
n_elr, n_qpr, dim, n_enr, n_cr = self.get_data_shape(varr)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py", line 1053, in get_data_shape
out = variable.get_data_shape(self.integral, integration, region.name)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/variables.py", line 1526, in get_data_shape
region_name=region_name)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/fem/fields_base.py", line 364, in get_data_shape
region = self.domain.regions[region_name]
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/base/base.py", line 678, in __getitem__
raise IndexError, ii
IndexError: Fracture0
![](https://secure.gravatar.com/avatar/27f6b03a726ccff3f7a5007b1df6bf8c.jpg?s=120&d=mm&r=g)
Hi Adolfo,
On 03/31/2016 03:57 AM, Adolfo Rodriguez wrote:
I am trying to use the option Region.from_vertices in order to create a region to apply boundary conditions. I want to use this function because I can easily identify the vertices on which I need to apply boundary conditions. However I get an error when I try to use the created surface, see below. I notice by comparing with other regions that work, that the region created has missing information but don't know how to fix it.
How did you create the region? Using Domain.create_region() or in some other way?
An example script would be handy.
r.
Your help is appreciated,
Adolfo
Traceback (most recent call last):
File "PoroElasticity_paper_ext_3.py", line 520, in <module>
main()
File "PoroElasticity_paper_ext_3.py", line 454, in main
vec = pb.solve()
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/problem.py", line 1020, in solve
vec = nls(vec0, status=self.nls_status)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/solvers/nls.py", line 251, in __call__
vec_r = fun(vec_x)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/evaluate.py", line 52, in eval_residual
vec_r = self.problem.equations.eval_residuals(vec)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 677, in eval_residuals
self.evaluate(mode='weak', dw_mode='vector', asm_obj=out)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 613, in evaluate
term_mode=term_mode, asm_obj=asm_obj)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 830, in evaluate
ret_status=True)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py", line 1240, in evaluate
n_elr, n_qpr, dim, n_enr, n_cr = self.get_data_shape(varr)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py", line 1053, in get_data_shape
out = variable.get_data_shape(self.integral, integration, region.name)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/variables.py", line 1526, in get_data_shape
region_name=region_name)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/fem/fields_base.py", line 364, in get_data_shape
region = self.domain.regions[region_name]
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/base/base.py", line 678, in __getitem__
raise IndexError, ii
IndexError: Fracture0
![](https://secure.gravatar.com/avatar/55ed926cf05100416cc712d72716db70.jpg?s=120&d=mm&r=g)
How did you create the region? Using Domain.create_region() or in some other way?
An example script would be handy.
r.
Robert,
I am using
frac0_region = Region.from_vertices(frac0_vertices,domain,'Fracture0', 'facet')
where frac0_vertices is an array containing the nodes I want to include in the region.
Thanks,
Adolfo
![](https://secure.gravatar.com/avatar/27f6b03a726ccff3f7a5007b1df6bf8c.jpg?s=120&d=mm&r=g)
On 03/31/2016 02:49 PM, Adolfo Rodriguez wrote:
How did you create the region? Using Domain.create_region() or in some other way?
An example script would be handy.
r.
Robert,
I am using
frac0_region = Region.from_vertices(frac0_vertices,domain,'Fracture0', 'facet')
where frac0_vertices is an array containing the nodes I want to include in the region.
Then you need to tell the Domain instance about that region - try appending it to the domain.regions list. Basically, you need to manually do all the things Domain.create_region() does after the visit_stack() call.
So, in the end, it might be easier to just call Domain.create_region() :) Maybe with the 'vertices by function' selector, where the function would just return the vertices.
But I see that some shortcut for creating a fully initialized region might be handy - maybe Region.finalize() could be changed to do just that.
r.
participants (2)
-
Adolfo Rodriguez
-
Robert Cimrman