Question on "diffusion/poisson_functions.py" example
Hello SfePy users,
I am solving a Poisson's equation with a free term $b(x)$: $\Delta u(x) = b(x), \quad x \in Omega$. I take "diffusion/poisson_functions.py" as the base script for my task. But something in this script is not clear for me.
In the script we have two definitions: $p$ is a given function and $f$ is a load parameter. What function does correspond to the free term $b(x)$?
The known function $f$ (in the code it is named as "load") is defined in materials, but the function $p$ is also known, but defined in the "variables" section. Usually in variable section we define functions to be find during solution. Why we define known function in the variable section?
For the evaluation of the function $f$ ("load") we have a python function "get_pars(ts, coors, mode=None, **kwargs)". In this python function we evaluate $f$ only if "mode == qp" condition is true.
For the evaluation of the function $p$ we also have a python function "get_load_variable(ts, coors, region=None)". But in this function we do not use "mode" condition.
Why those function $f$ and $p$ are evaluated in different ways?
Thanks, Alec
Hello Alec,
On 10/15/2012 07:15 PM, Alec Kalinin wrote:
Hello SfePy users,
I am solving a Poisson's equation with a free term $b(x)$: $\Delta u(x) = b(x), \quad x \in Omega$. I take "diffusion/poisson_functions.py" as the base script for my task. But something in this script is not clear for me.
this examples is not exactly what you need - use term dw_volume_integrate term with the optional material parameter equal to b(x).
- In the script we have two definitions: $p$ is a given function and $f$ is a load parameter. What function does correspond to the free term $b(x)$?
Both :) as b(x) = p(x) f(x).
- The known function $f$ (in the code it is named as "load") is defined in materials, but the function $p$ is also known, but defined in the "variables" section. Usually in variable section we define functions to be find during solution. Why we define known function in the variable section?
The example demonstrates two things: this function, 'p', is defined in a FE sense by its nodal values only.
- how to define a material parameter by an arbitrary function (get_pars - this is what you need).
- how to define a known function that belongs to a given FE space (field) -
- For the evaluation of the function $f$ ("load") we have a python function "get_pars(ts, coors, mode=None, **kwargs)". In this python function we evaluate $f$ only if "mode == qp" condition is true.
For the evaluation of the function $p$ we also have a python function "get_load_variable(ts, coors, region=None)". But in this function we do not use "mode" condition.
Why those function $f$ and $p$ are evaluated in different ways?
See above - those two functions are fundamentally different - one is s field function, approximated by FE (p), the other is a general function of coordinates evaluated in quadrature points (f)
Does it help?
Cheers, r.
Thank you, Robert. Now all things are almost clear for me.
Alec.
On Monday, October 15, 2012 10:17:04 PM UTC+4, Robert Cimrman wrote:
Hello Alec,
On 10/15/2012 07:15 PM, Alec Kalinin wrote:
Hello SfePy users,
I am solving a Poisson's equation with a free term $b(x)$: $\Delta u(x)
b(x), \quad x \in Omega$. I take "diffusion/poisson_functions.py" as the base script for my task. But something in this script is not clear for me.
this examples is not exactly what you need - use term dw_volume_integrate term with the optional material parameter equal to b(x).
- In the script we have two definitions: $p$ is a given function and $f$ is a load parameter. What function does correspond to the free term $b(x)$?
Both :) as b(x) = p(x) f(x).
- The known function $f$ (in the code it is named as "load") is defined in materials, but the function $p$ is also known, but defined in the "variables" section. Usually in variable section we define functions to be find during solution. Why we define known function in the variable section?
The example demonstrates two things: this
- how to define a material parameter by an arbitrary function (get_pars -
is what you need). 2. how to define a known function that belongs to a given FE space (field)
this function, 'p', is defined in a FE sense by its nodal values only.
- For the evaluation of the function $f$ ("load") we have a python function "get_pars(ts, coors, mode=None, **kwargs)". In this python function we evaluate $f$ only if "mode == qp" condition is true.
For the evaluation of the function $p$ we also have a python function "get_load_variable(ts, coors, region=None)". But in this function we do not use "mode" condition.
Why those function $f$ and $p$ are evaluated in different ways?
See above - those two functions are fundamentally different - one is s field function, approximated by FE (p), the other is a general function of coordinates evaluated in quadrature points (f)
Does it help?
Cheers, r.
On 10/16/2012 08:23 AM, Alec Kalinin wrote:
Thank you, Robert. Now all things are almost clear for me.
I have updated [1] with what I had written below. Feel free to ask more to clarify the 'almost' part...
Cheers, r.
[1] http://docs.sfepy.org/doc-devel/examples/diffusion/poisson_functions.html
On Monday, October 15, 2012 10:17:04 PM UTC+4, Robert Cimrman wrote:
Hello Alec,
On 10/15/2012 07:15 PM, Alec Kalinin wrote:
Hello SfePy users,
I am solving a Poisson's equation with a free term $b(x)$: $\Delta u(x)
b(x), \quad x \in Omega$. I take "diffusion/poisson_functions.py" as the base script for my task. But something in this script is not clear for me.
this examples is not exactly what you need - use term dw_volume_integrate term with the optional material parameter equal to b(x).
- In the script we have two definitions: $p$ is a given function and $f$ is a load parameter. What function does correspond to the free term $b(x)$?
Both :) as b(x) = p(x) f(x).
- The known function $f$ (in the code it is named as "load") is defined in materials, but the function $p$ is also known, but defined in the "variables" section. Usually in variable section we define functions to be find during solution. Why we define known function in the variable section?
The example demonstrates two things: this
- how to define a material parameter by an arbitrary function (get_pars -
is what you need). 2. how to define a known function that belongs to a given FE space (field)
this function, 'p', is defined in a FE sense by its nodal values only.
- For the evaluation of the function $f$ ("load") we have a python function "get_pars(ts, coors, mode=None, **kwargs)". In this python function we evaluate $f$ only if "mode == qp" condition is true.
For the evaluation of the function $p$ we also have a python function "get_load_variable(ts, coors, region=None)". But in this function we do not use "mode" condition.
Why those function $f$ and $p$ are evaluated in different ways?
See above - those two functions are fundamentally different - one is s field function, approximated by FE (p), the other is a general function of coordinates evaluated in quadrature points (f)
Does it help?
Cheers, r.
participants (2)
-
Alec Kalinin -
Robert Cimrman