Hello!
It's a great tool you built there! I'd like to use it for some kind of
topology optimisation.
Is there an "idiomatic" way to set the material parameters of individual
nodes?
Thank you very much!
JonnyB
Forwarding to the list...
-------- Forwarded Message --------
Subject: Aw: [sfepy] Re: Store material parameters of composite
Date: Fri, 5 Jul 2019 14:53:55 +0200
From: Jochen Dreyer <J3R(a)gmx.net>
To: Robert Cimrman <cimrman3(a)ntc.zcu.cz>
Hi Robert,
Attached the minimal working example and corresponding mesh. The temperature
dependent thermal conductivity of air is used for the pores and a constant one
for the solids. The values are then used to calculate the local …
[View More]heat flux in
the porous structure.
Regarding your suggestions:
You were right, Omega was the whole domain and idx_pore = Po worked.
I had separate regions for Solid and Pore before but couldn't figure out how to
access their conductivity in the post_process function. Anyway, everything is
working now and I actually like it better now than with the two regions I used
before.
BTW, I wanted to post the above in the forum but didn't see how to upload files
in the mailman 3 web interface...
Thanks a lot and kind regards,
Jochen
*Gesendet:* Mittwoch, 03. Juli 2019 um 18:32 Uhr
*Von:* "Robert Cimrman" <cimrman3(a)ntc.zcu.cz>
*An:* sfepy(a)python.org
*Betreff:* [sfepy] Re: Store material parameters of composite
Dear Jochen,
On 7/3/19 11:23 AM, jd766(a)cam.ac.uk wrote:
> Dear Robert,
>
> Thanks a lot for the hint. I got it working now. The example you pointed
out did work for me in the sense that I was able to access both region
conductivities in the post_process function. However, I couldn’t get a material
function for a temperature dependent conductivity working.
If you want, send a minimal working example - we can have a look.
> But your comment regarding the coordinates outside the Pore cells pointed
me in the right direction. This is how I solved it now (I’m not a programmer
and am sure there are more elegant ways to do it):
>
> def return_indices_of_a(a, b):
> b_set = set(b)
> return [i for i, v in enumerate(a) if v in b_set]
>
> def material_func(ts, coors, problem, equations=None, mode=None, **kwargs):
> """
> Returns the thermal conductivity of the porous material.
> """
> ev = problem.evaluate
> if mode == 'qp':
> Om = problem.domain.regions['Omega'].get_cells()
> Po = problem.domain.regions['Pore'].get_cells()
> Fi = problem.domain.regions['Fill'].get_cells()
>
> T_omega = np.array(ev('ev_volume_integrate.2.Omega(T)', mode='qp',
verbose=False))
>
> val = np.zeros(T_omega.shape)
>
> idx_pore = return_indices_of_a(Om,Po)
> idx_fill = return_indices_of_a(Om,Fi)
IMO you could just use
idx_pore = np.searchsorted(Om, Po)
or, if Omega is the whole domain
idx_pore = Po
(Not tested!)
> val[idx_pore,:,0,0]= (-7.61404 + 0.14152*T_omega[idx_pore,:,0,0] -
1.09156e-4*T_omega[idx_pore,:,0,0]**2 + 4.16029e-8*T_omega[idx_pore,:,0,0]**3)/1000
> val[idx_fill,:,0,0]=1
>
> output('conductivity: min:', val.min(), 'max:', val.max())
>
> val.shape = (val.shape[0] * val.shape[1], 1, 1)
> return {'val' : val}
>
> materials = {
> 'Omega' : 'material_func',
> }
>
> Now I have a temperature dependent conductivity for the pores and can
access both, the pore and solid conductivities using:
> problem. evaluate('ev_integrate_mat.2.Omega(Omega.val, T)', mode='el_avg')
Another way would be to split the integral to two: one over 'Pore' region, and
other over 'Fill' region.
Best regards,
r.
> Thanks a lot for the help and kind regards,
> Jochen
[View Less]
Hi,
I'm new to SfePy and have a (probably) quite trivial question. I have a porous material and want to store/use the materials' thermal conductivities in a post_process function. This should be fairly easy but I somehow can't get it working.
Say I have two materials called "Fill" and "Pore":
materials = {
'Pore' : 'pore_material_func',
'Fill' : 'fill_material_func',
}
Their conductivities are defined in *_material_func. In the post_process function I can access the conductivity of …
[View More]Pore with (analog for Fill):
mu = pb.evaluate('ev_volume_integrate_mat.2.Omega(Pore.val, T)',
mode='el_avg', copy_materials=False, verbose=False)
However, this gives me a non-zero value in all of Omega, not just in the Pore cells. Is there an easy way to set the conductivity to 0 outside Pore (then I can just add the Pore and Fill conductivities) or directly get the real conductivities in all of Omega?
Thanks a lot and kind regards,
Jochen
[View Less]
I am pleased to announce release 2019.2 of SfePy.
Description
-----------
SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by the finite element method or by the
isogeometric analysis (limited support). It is distributed under the new BSD
license.
Home page: http://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy…
[View More]Highlights of this release
--------------------------
- improved support for time-dependent homogenization problems,
- Python 3.7 compatibility
For full release notes see [1].
Cheers,
Robert Cimrman
[1] http://docs.sfepy.org/doc/release_notes.html#id1
---
Contributors to this release in alphabetical order:
Robert Cimrman
Jan Heczko
Lubos Kejzlar
Vladimir Lukes
[View Less]