Hi Peter,

the assembling works basically just like you wrote. It starts either by Equations.eval_residuals() or Equations.eval_tangent_matrices() and has the following structure:

for equation in equations:
   for term in equation:
       out = evaluate element residuals or matrices
       assemble out into the residual vector or tangent matrix

This is the same for both linear and nonlinear problems.

The matrix graph assembling serves only to preallocate the sparse matrix structure as governed by the element connectivity.

As for different load cases, your problem is static and linear, right? So the easiest way is to use an artficial time stepping and to change the load in each time step. If you set the 'problem' attribute of the nonlinear solver to 'linear', the matrix will be assembled and factorized before the time steps. Look at the time-dependent examples sfepy/diffusion/time_poisson.py or examples/linear_elasticity/linear_elastic/dynamic.py.

Another possibility is to write the loading loop yourself using sfepy as a library. This is much more powerful as it allows you to do anything you need (if it is implemented), but you need to know what you are doing...

Does this help? I see I should write an article about sfepy "architecture".

r.

----- Reply message -----
From: "Peter M. Clausen" <petermic...@googlemail.com>
To: <sfep...@googlegroups.com>
Subject: Sensitivity calculation with sfepy
Date: Sat, Mar 12, 2011 14:35


Hi

My objective is to survey different methods of sensitivity calculation
w.r.t. geometry changes (shape and topology optimization) and after
looking into many open source FE-codes I believe that Sfepy might be
the right choice for me - I love Python, but I am not sure I really
grasp the whole structure of Sfepy. I am a structural mechanics guy so
I'm starting out with the easiest for me - a simple beam with a
traction load.

I am going to ask a lot of questions in the near future. I hope the
questions are not too stupid...

1. Structure of Sfepy

1.1. Debugging in Eclipse
I found it very helpfull to debug in eclipse. I found it pretty easy
to set up (on Ubuntu 10.04 at least).

1.2. Setting up the system matrix
I am used to classic structural FE-codes where the typical setup
(simplified) is:
forall elements:
...
setup element matrix
insert in system matrix
...

Now, in sfepy I cant really figure out where this element loop is,
probably not really there. Of course I assume the 'assembling matrix
graph...' is pretty much what I am looking for, but I dont really get
it. Any explanation or reference would help me.


2. More loadcases (different tractions)

I want to use adjoint sensitivity calculation where I need to solve
the system once more with a different load (or even a couple of
times). What is the easiest way to add loads? In first implementation
performance is not really important, but the beautiful solution is of
course to keep the inverted system matrix and simply solve for a new
right hand side.

Thanks

Best regards

Peter

--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...@googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.