It works - sfepy iterates and the result converges. I have prepared a simple example, as it was difficult (to me at least) to find out how to get the temperature information. It is attached both as a patch and as a python file.
One issue with this implementation is that the deque "equations.variables._objs.find('T')" in the second iteration contains None which causes "equations.variables._objs.find('T').evaluate_at(coors)" to fail - thus the try/except clauses. Maybe there is a better way?
- Bjarke
On Friday, October 26, 2012 12:08:00 PM UTC+2, Robert Cimrman wrote:
On 10/26/2012 11:51 AM, Bjarke Dalslet wrote:
Thanks a lot for the quick reply and good advice.
I will try the iterative approach then.
Let us know how it goes.
I only worry about speed as I am using sfepy to fit measured data. I am using 3 fitting parameters, and thus around 10K steady state simulations are necessary to get a good fit. This takes about a day with my current mesh, but honestly that is much faster than I expected when starting to look into FEM modelling.
So it's a brute-force approach to fitting? Anyway, a day is not so bad :). If that was using umfpack as a solver, you might get a significant improvement by using CG.
In all,I am very happy with the speed, accesibility and flexibility of sfepy.
Glad to hear that! r.
- Bjarke
On Friday, October 26, 2012 11:26:38 AM UTC+2, Robert Cimrman wrote:
Hello Bjarke!
On 10/26/2012 10:35 AM, Bjarke Dalslet wrote:
Hello sfepy users!
I am using sfepy to do thermal simulations of (BIG!) electric
Nothing fancy, but i would like to be able to use temperature dependent thermal conductivities as my system gets very hot.
At the moment I am employing the Laplace weak term: int(s * \nabla q *\nabla p) where s is the thermal conductivity, q is the test field parameter and
is
the temperature field
What i want is for s to depend on the temperature. I wonder which strategy to use: 1: To limit myself to a linear s, i.e. s(q)=s0+\alpha * q. In that case i guess i can do this: int(s(q) * \nabla q *\nabla p) = int(s0 * \nabla q *\nabla p) + int(\alpha * q * \nabla q *\nabla p) Unfortunately the second term is not implemented. Looking at the source, this would be some work to implement. 2: To iterate and after each iteration assign new values of s at each point. This would not be a big deal when doing time dependent simulations, but steady-state would be much slower to calculate I guess? An added plus would be that arbitrary c(q) could be used. 3: Ask for help here, and go "Ahhh! Of course!", when you state the obvious, easily implementable and fantastic solution.
I have only used sfepy for about a week, and this is the first time i am messing around with weak formulation FEM, so this question might be really silly, but I ask anyway: Is the strategy above completely crazy or am I on the right track?
I would try 2 first, as the Laplace equation can be very quickly solved by a conjugate gradients solver, so doing a few "time" iterations would not be that demanding. The linear system solution is fast even with the Python implementation from SciPy ('ls.scipy_iterative'), but if you have PETSc and petsc4py installed, it would be even faster ('ls.petsc') - see tests/test_linear_solvers.py file for example configurations of the
resistors. p linear
solvers.
As for the artificial time-stepping, look at [1], which is almost exactly what you need, only the equation is the linear elasticity.
Then, if the above approach does not work, we could try adding a new nonlinear term.
If you get stuck, do not hesitate to ask here.
Cheers & thanks for trying SfePy! r.
[1]
http://docs.sfepy.org/doc-devel/examples/linear_elasticity/material_nonlinea...
Kind regards Bjarke Dalslet