Dear SfePy users,
I am new to the SfePy and first of all I want to say thank you to the developers of this FEM engine. Now I am trying to use SfePy for my tasks and I got several questions.
Consider problem in the example ``examples/diffusion/poisson.py'' (I will use LaTeX notations further for the math). We need to find unknown function $t(x)$ such that $$ c \Delta t = 0, x \in \Omega, $$ $$ t(x) = T1, x \in \Gamma{D1}, $$ $$ t(x) = T2, x \in \Gamma{D2}, $$ $$ \frac{\partial t(x)}{\partial n} = 0, x \in \Gamma_{N}, $$ where $T_1$ and $T2$ is known functions, $\Gamma{D1} = {x \mid x < 0.00001}$, $\Gamma{D2} = {x \mid x > 0.099999}$, $\Gamma{N} = \partial \Omega \setminus (\Gamma{D1} \cup \Gamma{D2})$. This is the mixed boundary value problem with both Dirichlet and Neumann boundary conditions.
Could you, please, answer me on following questions:
Is it possible to get a flux on the $\Gamma{D1}$ and $\Gamma{D2}$ surfaces after the problem has been solved?
Suppose we solve pure Dirichlet problem (no Neumann conditions). We need to specify essential boundary conditions on the all surface nodes? What is the best way to select all surface nodes?
Suppose the Neumann boundary conditions is not zero. In this case we need to add surface integral with the flux. Do we need to add new term for the flux in the problem description? And this term will be the surface integral but in the problem description we have only tetrahedral domain 3D mesh. What is the best way to select only surface part of the mesh for the surface integration?
Thanks, Alec Kalinin
Hi Alec,
On 08/21/2012 10:50 AM, Alec Kalinin wrote:
Dear SfePy users,
I am new to the SfePy and first of all I want to say thank you to the developers of this FEM engine. Now I am trying to use SfePy for my tasks and I got several questions.
Consider problem in the example ``examples/diffusion/poisson.py'' (I will use LaTeX notations further for the math). We need to find unknown function $t(x)$ such that $$ c \Delta t = 0, x \in \Omega, $$ $$ t(x) = T1, x \in \Gamma{D1}, $$ $$ t(x) = T2, x \in \Gamma{D2}, $$ $$ \frac{\partial t(x)}{\partial n} = 0, x \in \Gamma_{N}, $$ where $T_1$ and $T2$ is known functions, $\Gamma{D1} = {x \mid x < 0.00001}$, $\Gamma{D2} = {x \mid x > 0.099999}$, $\Gamma{N} = \partial \Omega \setminus (\Gamma{D1} \cup \Gamma{D2})$. This is the mixed boundary value problem with both Dirichlet and Neumann boundary conditions.
Could you, please, answer me on following questions:
Not yet - we actually never saved a solution on a surface. I will try to fix this issue now. Then, something like the following code should work (see [1] for definition of d_surface_flux term, K is a permeability matrix):
def post_process(out, pb, state, extend=False): """ Calculate fluxes. """ from sfepy.base.base import Struct from sfepy.fem import extend_cell_data
ev = pb.evaluate
flux = ev('d_surface_flux.2.Gamma(m.K, t)', mode='el_avg')
flux = extend_cell_data(flux, pb.domain, 'Gamma') # Extend to whole domain
data=flux, dofs=None)
return outoptions = { 'post_process_hook' : 'post_process', }
You can use the following region definition:
regions = { 'Gamma' : ('nodes of surface', {}), }
to select all the surface nodes.
Yes, you need to add the flux term "dw_surface_ndot.2.Gamma(m.c, s)" to the equation, where m.c. is the given flux (a material), and s is the test function, again check [1], c is the flux vector. As for the surface selection - see above.
See also example [2] - linear elasticity with surface tractions.
Cheers, r.
[1] http://sfepy.org/doc-devel/terms_overview.html... [2] http://sfepy.org/doc-devel/examples/linear_elasticity/linear_elastic_tractio...
Hi again,
This is the modified poisson.py showing how to do the post-processing and how to add flux term to the equations. You need the latest git version for it to run, though... Let us know whether it works - it's completely untested, so any bug-report is welcome!
r.
On 08/21/2012 12:23 PM, Robert Cimrman wrote:
Hi Alec,
On 08/21/2012 10:50 AM, Alec Kalinin wrote:
Dear SfePy users,
I am new to the SfePy and first of all I want to say thank you to the developers of this FEM engine. Now I am trying to use SfePy for my tasks and I got several questions.
Consider problem in the example ``examples/diffusion/poisson.py'' (I will use LaTeX notations further for the math). We need to find unknown function $t(x)$ such that $$ c \Delta t = 0, x \in \Omega, $$ $$ t(x) = T1, x \in \Gamma{D1}, $$ $$ t(x) = T2, x \in \Gamma{D2}, $$ $$ \frac{\partial t(x)}{\partial n} = 0, x \in \Gamma_{N}, $$ where $T_1$ and $T2$ is known functions, $\Gamma{D1} = {x \mid x < 0.00001}$, $\Gamma{D2} = {x \mid x > 0.099999}$, $\Gamma{N} = \partial \Omega \setminus (\Gamma{D1} \cup \Gamma{D2})$. This is the mixed boundary value problem with both Dirichlet and Neumann boundary conditions.
Could you, please, answer me on following questions:
Not yet - we actually never saved a solution on a surface. I will try to fix this issue now. Then, something like the following code should work (see [1] for definition of d_surface_flux term, K is a permeability matrix):
def post_process(out, pb, state, extend=False): """ Calculate fluxes. """ from sfepy.base.base import Struct from sfepy.fem import extend_cell_data
ev = pb.evaluate
flux = ev('d_surface_flux.2.Gamma(m.K, t)', mode='el_avg')
flux = extend_cell_data(flux, pb.domain, 'Gamma') # Extend to whole domain
data=flux, dofs=None)
return outoptions = { 'post_process_hook' : 'post_process', }
You can use the following region definition:
regions = { 'Gamma' : ('nodes of surface', {}), }
to select all the surface nodes.
Yes, you need to add the flux term "dw_surface_ndot.2.Gamma(m.c, s)" to the equation, where m.c. is the given flux (a material), and s is the test function, again check [1], c is the flux vector. As for the surface selection - see above.
See also example [2] - linear elasticity with surface tractions.
Cheers, r.
[1] http://sfepy.org/doc-devel/terms_overview.html... [2] http://sfepy.org/doc-devel/examples/linear_elasticity/linear_elastic_tractio...
Thank you very much, Robert! With the latest git version the given example works and I got the flux.
Alec
On Tuesday, August 21, 2012 2:50:30 PM UTC+4, Robert Cimrman wrote: >
Hi again,
This is the modified poisson.py showing how to do the post-processing and how to add flux term to the equations. You need the latest git version for it to run, though... Let us know whether it works - it's completely untested, so any bug-report is welcome!
r.
On 08/21/2012 12:23 PM, Robert Cimrman wrote:
Hi Alec,
On 08/21/2012 10:50 AM, Alec Kalinin wrote:
Dear SfePy users,
I am new to the SfePy and first of all I want to say thank you to the developers of this FEM engine. Now I am trying to use SfePy for my tasks and I got several questions.
Consider problem in the example ``examples/diffusion/poisson.py'' (I will use LaTeX notations further for the math). We need to find unknown function $t(x)$ such that $$ c \Delta t = 0, x \in \Omega, $$ $$ t(x) = T1, x \in \Gamma{D1}, $$ $$ t(x) = T2, x \in \Gamma{D2}, $$ $$ \frac{\partial t(x)}{\partial n} = 0, x \in \Gamma_{N}, $$ where $T_1$ and $T2$ is known functions, $\Gamma{D1} = {x \mid x < 0.00001}$, $\Gamma{D2} = {x \mid x > 0.099999}$, $\Gamma{N} = \partial \Omega \setminus (\Gamma{D1} \cup \Gamma{D2})$. This is the mixed boundary value problem with both Dirichlet and Neumann boundary conditions.
Could you, please, answer me on following questions:
Not yet - we actually never saved a solution on a surface. I will try to fix this issue now. Then, something like the following code should work (see [1] for definition of d_surface_flux term, K is a permeability matrix):
def post_process(out, pb, state, extend=False): """ Calculate fluxes. """ from sfepy.base.base import Struct from sfepy.fem import extend_cell_data
ev = pb.evaluate
flux = ev('d_surface_flux.2.Gamma(m.K, t)', mode='el_avg')
flux = extend_cell_data(flux, pb.domain, 'Gamma') # Extend to whole
domain
data=flux, dofs=None)
return out options = { 'post_process_hook' : 'post_process', }
You can use the following region definition:
regions = { 'Gamma' : ('nodes of surface', {}), }
to select all the surface nodes.
Yes, you need to add the flux term "dw_surface_ndot.2.Gamma(m.c, s)" to the equation, where m.c. is the given flux (a material), and s is the test function, again check [1], c is the flux vector. As for the surface selection - see above.
See also example [2] - linear elasticity with surface tractions.
Cheers, r.
[1] http://sfepy.org/doc-devel/terms_overview.html... [2]
http://sfepy.org/doc-devel/examples/linear_elasticity/linear_elastic_tractio...
On 08/21/2012 05:23 PM, Alec Kalinin wrote:
Thank you very much, Robert! With the latest git version the given example works and I got the flux.
Good, hth! r.
Alec
On Tuesday, August 21, 2012 2:50:30 PM UTC+4, Robert Cimrman wrote: >
Hi again,
This is the modified poisson.py showing how to do the post-processing and how to add flux term to the equations. You need the latest git version for it to run, though... Let us know whether it works - it's completely untested, so any bug-report is welcome!
r.
On 08/21/2012 12:23 PM, Robert Cimrman wrote:
Hi Alec,
On 08/21/2012 10:50 AM, Alec Kalinin wrote:
Dear SfePy users,
I am new to the SfePy and first of all I want to say thank you to the developers of this FEM engine. Now I am trying to use SfePy for my tasks and I got several questions.
Consider problem in the example ``examples/diffusion/poisson.py'' (I will use LaTeX notations further for the math). We need to find unknown function $t(x)$ such that $$ c \Delta t = 0, x \in \Omega, $$ $$ t(x) = T1, x \in \Gamma{D1}, $$ $$ t(x) = T2, x \in \Gamma{D2}, $$ $$ \frac{\partial t(x)}{\partial n} = 0, x \in \Gamma_{N}, $$ where $T_1$ and $T2$ is known functions, $\Gamma{D1} = {x \mid x < 0.00001}$, $\Gamma{D2} = {x \mid x > 0.099999}$, $\Gamma{N} = \partial \Omega \setminus (\Gamma{D1} \cup \Gamma{D2})$. This is the mixed boundary value problem with both Dirichlet and Neumann boundary conditions.
Could you, please, answer me on following questions:
Not yet - we actually never saved a solution on a surface. I will try to fix this issue now. Then, something like the following code should work (see [1] for definition of d_surface_flux term, K is a permeability matrix):
def post_process(out, pb, state, extend=False): """ Calculate fluxes. """ from sfepy.base.base import Struct from sfepy.fem import extend_cell_data
ev = pb.evaluate
flux = ev('d_surface_flux.2.Gamma(m.K, t)', mode='el_avg')
flux = extend_cell_data(flux, pb.domain, 'Gamma') # Extend to whole
domain
out['flux'] = Struct(name='output_data',
mode='cell',
data=flux, dofs=None)
return out
options = { 'post_process_hook' : 'post_process', }
You can use the following region definition:
regions = { 'Gamma' : ('nodes of surface', {}), }
to select all the surface nodes.
Yes, you need to add the flux term "dw_surface_ndot.2.Gamma(m.c, s)" to the equation, where m.c. is the given flux (a material), and s is the test function, again check [1], c is the flux vector. As for the surface selection - see above.
See also example [2] - linear elasticity with surface tractions.
Cheers, r.
[1] http://sfepy.org/doc-devel/terms_overview.html... [2]
http://sfepy.org/doc-devel/examples/linear_elasticity/linear_elastic_tractio...