Solved:
I have several numpy directories on my computer (I downloaded a release but normally run svn). But none of those are on my PYTHONPATH. So, I hard coded this change:
#NUMPYPREFIX := $(shell script/config.py numpy_prefix)
PYTHON_INCL := -I/usr/include/python$(PYVER) -I/usr/$(ARCHLIB)/python$(PYVER)/site-packages/numpy/core/include
and everything compiles fine and all tests pass.
I thing trying to do the auto-configuration is a great idea. For me, the right path could be found in ipython using import numpy reload(numpy)
I don't know how to do that in a script though. Searching sys.path doesn't seem revealing.
Ryan
On Tue, Jul 8, 2008 at 9:21 AM, Ryan Krauss ryan...@gmail.com wrote:
Having some trouble with the Makefile of the most recent hg version. I am strating to dig into it, but here is the output of my first run:
ryan@am2:~/svn/sfepy$ make ls: sfepy/fem/extmods/*_wrap.c: No such file or directory ls: sfepy/terms/extmods/*_wrap.c: No such file or directory echo 00.46.02-3aebc32f697a > 'VERSION' sed "s|^\(#define VERSION\) \".*\"|\1 \"00.46.02-3aebc32f697a\"|;" sfepy/fem/extmods/version.h.in > sfepy/fem/extmods/version.h gcc -g -O2 -fPIC -DPIC -D__SDIR__='"tests"' -Ieldesc -Iexamples -Iinput -Isfepy -Isfepy/base -Isfepy/fem -Isfepy/fem/extmods -Isfepy/homogenization -Isfepy/solvers -Isfepy/terms -Isfepy/terms/extmods -Isfepy/physics -Isfepy/physics/extmods -Itests -I/usr/include/python2.5 -I/home/share/software/usr/lib/python2.5/site-packages/numpy/core/include -Wall -c -DISRELEASE sfepy/fem/extmods/geomtrans.c -o sfepy/fem/extmods/geomtrans.o gcc -g -O2 -fPIC -DPIC -D__SDIR__='"tests"' -Ieldesc -Iexamples -Iinput -Isfepy -Isfepy/base -Isfepy/fem -Isfepy/fem/extmods -Isfepy/homogenization -Isfepy/solvers -Isfepy/terms -Isfepy/terms/extmods -Isfepy/physics -Isfepy/physics/extmods -Itests -I/usr/include/python2.5 -I/home/share/software/usr/lib/python2.5/site-packages/numpy/core/include -Wall -c -DISRELEASE sfepy/fem/extmods/meshutils.c -o sfepy/fem/extmods/meshutils.o swig -python -Ieldesc -Iexamples -Iinput -Isfepy -Isfepy/base -Isfepy/fem -Isfepy/fem/extmods -Isfepy/homogenization -Isfepy/solvers -Isfepy/terms -Isfepy/terms/extmods -Isfepy/physics -Isfepy/physics/extmods -Itests -I/usr/include/python2.5 -I/home/share/software/usr/lib/python2.5/site-packages/numpy/core/include -DISRELEASE -o sfepy/fem/extmods/meshutils_wrap.c sfepy/fem/extmods/meshutils.i gcc -g -O2 -fPIC -DPIC -D__SDIR__='"tests"' -Ieldesc -Iexamples -Iinput -Isfepy -Isfepy/base -Isfepy/fem -Isfepy/fem/extmods -Isfepy/homogenization -Isfepy/solvers -Isfepy/terms -Isfepy/terms/extmods -Isfepy/physics -Isfepy/physics/extmods -Itests -I/usr/include/python2.5 -I/home/share/software/usr/lib/python2.5/site-packages/numpy/core/include -Wall -c -DISRELEASE sfepy/fem/extmods/meshutils_wrap.c -o sfepy/fem/extmods/meshutils_wrap.o sfepy/fem/extmods/meshutils_wrap.c:2776:31: error: numpy/arrayobject.h: No such file or directory sfepy/fem/extmods/meshutils_wrap.c:2788: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token sfepy/fem/extmods/meshutils_wrap.c:2815: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_sortRows': sfepy/fem/extmods/meshutils_wrap.c:3143: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3143: error: (Each undeclared identifier is reported only once sfepy/fem/extmods/meshutils_wrap.c:3143: error: for each function it appears in.) sfepy/fem/extmods/meshutils_wrap.c:3143: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3145: warning: implicit declaration of function 'helper_getCArrayObject' sfepy/fem/extmods/meshutils_wrap.c:3145: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3148: warning: implicit declaration of function 'PyArray_DATA' sfepy/fem/extmods/meshutils_wrap.c:3149: warning: implicit declaration of function 'PyArray_DIM' sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_createList': sfepy/fem/extmods/meshutils_wrap.c:3217: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3217: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3219: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_neighbourListPtr': sfepy/fem/extmods/meshutils_wrap.c:3304: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3304: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3306: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_neighbourList': sfepy/fem/extmods/meshutils_wrap.c:3418: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3418: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3420: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_orientEdges': sfepy/fem/extmods/meshutils_wrap.c:3560: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3560: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3562: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_assignEdgeNodes': sfepy/fem/extmods/meshutils_wrap.c:3653: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3653: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3655: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_interpVertexData': sfepy/fem/extmods/meshutils_wrap.c:3788: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3788: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3790: error: 'PyArray_FLOAT64' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3801: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_orientElements': sfepy/fem/extmods/meshutils_wrap.c:3892: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3892: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3894: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:3915: error: 'PyArray_FLOAT64' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function '_wrap_graphComponents': sfepy/fem/extmods/meshutils_wrap.c:4002: error: 'PyArrayObject' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:4002: error: 'obj' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c:4004: error: 'PyArray_INT32' undeclared (first use in this function) sfepy/fem/extmods/meshutils_wrap.c: In function 'init_meshutils': sfepy/fem/extmods/meshutils_wrap.c:4668: warning: implicit declaration of function 'import_array' make: *** [sfepy/fem/extmods/meshutils_wrap.o] Error 1
On Tue, Jul 8, 2008 at 5:28 AM, Robert Cimrman cimr...@ntc.zcu.cz wrote:
Ryan Krauss wrote:
So, I am taking my first steps in using SfePy. I have two questions, one about mesh generation and one about the results I am getting.
First, about mesh generation. I am trying to understand the workflow. What is actually necessary? What is the easiest way to create a mesh for a really simple part, like a cube or cylinder? I have tinkered with TetGen and have generated a mesh that way. I was reading through convert.py and trying to understand what it wants as an input. In the end, I didn't use convert.py and simply set
fileName_mesh = 'input/first_mesh.1.node'
in my input file. Is this correct? Is it best? Does it actually read all the other files about by TetGen (.face and .ele), or is it only using the .node file?
If you just need a mesh of a block, or cube, se below. Otherwise we have no free alternative to tetgen, as Ondrej wrote.
First_mesh.poly is my input to TetGen and the others are the output. I think it worked.
For realy simple - block - meshes you can use also:
$ ./script/blockgen.py --help usage: blockgen.py [options]
Block mesh generator.
options: --version show program's version number and exit -h, --help show this help message and exit -o fileName output file name [default: out.vtk] -d dims, --dims=dims dimension of the block [default: [1.0, 1.0, 1.0]] -s shape, --shape=shape shape (counts of nodes in x, y, z) of the block [default: [11, 11, 11]] -c centre, --centre=centre centre of the block [default: [0.0, 0.0, 0.0]]
For my second question, I used the attached mesh files along with the input script from_Robert.py (something he sent me a while back) and simply.py and got the following output:
In [1]: run simple.py input/from_Robert.py sfe: warning: other missing: ['functions', 'modules', 'epbc_[0-9]+|epbcs', 'lcbc_[0-9]+|lcbcs', 'nbc_[0-9]+|nbcs', 'options'] sfe: warning: left over: ['tractionLoad'] sfe: reading mesh... nodes: 100% |############################################| Time: 00:00:00 elements: 100% |#########################################| Time: 00:00:00 sfe: ...done in 0.04 s sfe: setting up domain edges... sfe: ...done in 0.00 s sfe: setting up domain faces... sfe: ...done in 0.01 s sfe: creating regions... sfe: leaf Top region_2 sfe: leaf Omega region_1000 sfe: leaf Bottom region_1 sfe: ...done in 0.04 s sfe: equation "balance_of_forces": sfe: dw_lin_elastic_iso.i1.Omega( solid.lame, v, u ) = dw_surface_ltr.isurf.Top( traction.val, v ) sfe: describing geometries... sfe: ...done in 0.01 s sfe: setting up dof connectivities... sfe: ...done in 0.00 s sfe: using solvers: nls: newton ls: ls sfe: matrix shape: (156, 156) sfe: assembling matrix graph... sfe: ...done in 0.00 s sfe: matrix structural nonzeros: 4248 (1.75e-01% fill) sfe: updating materials... sfe: solid sfe: traction TimeStepper nDigit: 1 t0: 0.0 t1: 1.0 step: 0 time: 0.0 dt: 1.0 times: [ 0.] nt: 0.0 nStep: 1 input/from_Robert.py, 69: tractionLoad(), 76 sfe: ...done in 0.00 s sfe: nls: iter: 0, residual: 0.000000e+00 (rel: 0.000000e+00)
and the attached vtk file. The vtk file seems to say that the force at each node is 0. That doesn't seem right.
Am I doing something wrong? Are these results actually valid? How should I proceed?
You are missing the time stepping solver, see input/time_poisson.py the user had not specified it.
- that is why you solve only the time step 0, where the loading force is zero... The TimeStepper you see is the default one, that is created when
I am sending you an updated input file that should work. Also try a finer mesh, as the one you test with is really coarse (generate it via blockgen).
Changes I have made:
- added 'solver_2' (time stepping info)
- added 'options' saying which solvers to use. This is obligatory - 'solver_2' would be ignored without it.
- fixed tractionLoad() to return not only zeros.
I have also fixed the time stepping solver for missing variableHistory option (see again input/time_poisson.py) as you solve a quasi-static problem for the moment -> you should pull the fresh version from our repository (see http://code.google.com/p/sfepy/wiki/MercurialHowTo)
I was thinking that in terms of material modeling, I would start with a static compressive load applied to the foam specimen, then a load that ramps up and watch the displacement and stress in each case. Start with small stresses and strains and then talk about how to handle large strains. Does that make sense?
Sure. The static test you describe is in fact just the file I am sending now. You only need to implement (or tell us) the constitutive relation of the foam material - the example uses just a linear elastic solid.
Thanks for your help.
Some inspiration: http://xkcd.com/323/ :-)