Re: material dependent on calculated field
On 04/19/2018 06:02 PM, Jan Martinek wrote:
Hello,
thank you for your advice, I tested your proposed way and the material is constructed correctly over all the Omega region. Then, I have problems with the evaluation of flux, because the get_pars() is called again with the region "top" and the set of quadrature points is now different. In an attempt to evaluate the field on the surface points corresponding to "top" region I get an error message
ValueError: region top has not true cells! (has kind: facet)
Well, that's probably right.
For surface regions you would need the dw_surface_integrate term.
Anyway, before getting too deep into it, I tried another way using
T.evaluate_at(coors)
but as you have already written, evaluating at arbitrary points is an overkill, right?
This is fine and should be reasonably fast  it does not do the projection...
In this case, increasing the options_order to 2 gives exact results on very coarse mesh very quicky, but it is an easy example. Nevertheless, I often fall into performance issues so I should stick to recommended methods.
IMHO T.evaluate_at(coors) is by far the easiest way how to do what you need, so try replacing it only after you find it is a bottleneck. Using the dw_*_integrate integrate terms should be faster (can you measure it on a largish mesh?), but there you need to distinguish between surface and volume regions.
I attach my script and your comments are welcome  are there any pitfalls with such approach?
I do not know, we will see :)
r.
Jan
On 04/18/2018 02:47 PM, Robert Cimrman wrote:
Hi Jan,
On 04/18/2018 12:34 PM, Jan Martinek wrote:
Hi again,
I would like to calculate the electrical current flow through a material, whose electrical conductivity depends on temperature. I assume the current is very small and all the heating comes only from external bath.
The procedure is composed of these steps:
 the temperature field is calculated (it works)
 the electrical conductivity of a material should be now assigned using a get_pars function. It should take into account the temperature field. (but how?)
 the potential field is calculated (works)
 calculate the flux (works, you helped me before)
The temperature is calculated in nodes, but the material properties are assigned to cells. I will probably have to use make_l2_projection, but after many trials and errors I ask for help, again. I attach my testing script.
The easiest way of obtaining a field in quadrature points is to use the ev_volume_integrate term (for volume regions):
t_qp = problem.evaluate('ev_volume_integrate.i.Omega(T)', integrals=Integrals([integral]), mode='qp', verbose=False) t_qp.shape = (1, 1, 1)
Just make sure, that the same integral is used above and in get_pars(). The reshaping is needed for get_pars().
Note that make_l2_projection() would work too, but it is meant for evaluating fields in arbitrary points  here it is an overkill.
r.
Thank you Jan
SfePy mailing list sfepy@python.org https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
SfePy mailing list sfepy@python.org https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
participants (1)

Robert Cimrman