Using a parameter field variable
I am trying to use a "parameter" field variable in interactive mode. What I am trying to do is very similar to the thermo-elaticity example, but for some reason I cannot make it work in interactive mode.
In the thermo-elasticity example the parameter field variable is defined as follows
def get_temperature_load(ts, coors, region=None):
""" Temperature load depends on the x
coordinate. """
x = coors[:, 0]
return (x - x.min())**2 - T0
fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega( solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q, press=press)
But this does not work.
Any thoughts?
Thanks
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode. What I am trying to do is very similar to the thermo-elaticity example, but for some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined as follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega( solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q, press=press)
But this does not work.
Could you send the code that does not work, that could be run and tried? There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode. What I am trying to do is very similar to the thermo-elaticity example, but for some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined as follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega( solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and tried? There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
I cannot run the script without the mesh .geo file, but anyway, a few remarks:
the press_load Function instance is not used anywhere, do something like:
functions = Functions([press_load]) ... pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)
- then the function will be available for equations etc. (Problem.time_update() also can take 'functions' argument.)
line 338: use get_mat instead of get_mat1
Could you send also the geometry file, so that I could run it?
r.
On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote:
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode. What I am trying to do is very similar to the thermo-elaticity example, but for some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined as follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega( solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and tried? There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
I am attaching the *.geo file.
On Thursday, March 31, 2016 at 8:43:02 AM UTC-5, Robert Cimrman wrote:
I cannot run the script without the mesh .geo file, but anyway, a few remarks:
the press_load Function instance is not used anywhere, do something like:
functions = Functions([press_load]) ... pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)
- then the function will be available for equations etc. (Problem.time_update() also can take 'functions' argument.)
line 338: use get_mat instead of get_mat1
Could you send also the geometry file, so that I could run it?
r.
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode. What I am trying to do is very similar to the thermo-elaticity example, but
for
some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined as follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega( solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and
On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote: tried?
There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
Robert,
You will need two additional files to run the problem. Find them attached.
Adolfo
On Thursday, March 31, 2016 at 9:13:00 AM UTC-5, Adolfo Rodriguez wrote:
I am attaching the *.geo file.
On Thursday, March 31, 2016 at 8:43:02 AM UTC-5, Robert Cimrman wrote:
I cannot run the script without the mesh .geo file, but anyway, a few remarks:
the press_load Function instance is not used anywhere, do something like:
functions = Functions([press_load]) ... pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)
- then the function will be available for equations etc. (Problem.time_update() also can take 'functions' argument.)
line 338: use get_mat instead of get_mat1
Could you send also the geometry file, so that I could run it?
r.
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode. What I am trying to do is very similar to the thermo-elaticity example, but
for
some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined as follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega( solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and
On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote: tried?
There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
I am still getting an error related to the press_load function. Probably is related to the way the corresponding field variable is defined, I have the following lines:
field = Field.from_args('fu', nm.float64, 'vector', omega, approx_order=1)
press_load = Function('press_load',get_pressure_load)
functions = Functions([press_load])
press = FieldVariable('pressure','parameter',field,special={'setter': 'press_load'}, primary_var_name='(set-to-None)')
t4 = Term.new('dw_biot(matalpha.alpha, v, p)', integral, omega, matalpha=matalpha, v=v, p=press)
eq_elastic = Equation('Elastic',t1-t3-t3_hmax-t3_hmin-t4)
I get an error at this line:
Traceback (most recent call last):
File "fractures_shadow.py", line 414, in <module>
main()
File "fractures_shadow.py", line 312, in main
eqs = Equations([eq_elastic])
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 82, in __init__
self.collect_conn_info()
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 187, in collect_conn_info
eq.collect_conn_info(self.conn_info)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 801, in collect_conn_info
conn_info[key] = term.get_conn_info()
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py", line 728, in get_conn_info
is_trace = self.arg_traces[pvar.name]
KeyError: 'press'
I am pretty sure it is related to the way I am defining the Field Variable but I don't know how to fix it. Any suggestion?
Regards,
Adolfo
On Thu, Mar 31, 2016 at 8:43 AM, Robert Cimrman cimr...@ntc.zcu.cz wrote:
I cannot run the script without the mesh .geo file, but anyway, a few remarks:
the press_load Function instance is not used anywhere, do something like:
functions = Functions([press_load]) ... pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)
- then the function will be available for equations etc. (Problem.time_update() also can take 'functions' argument.)
line 338: use get_mat instead of get_mat1
Could you send also the geometry file, so that I could run it?
r.
On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote:
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode.
What I
am trying to do is very similar to the thermo-elaticity example, but for some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined
as
follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega(
solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and tried? There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
-- You received this message because you are subscribed to a topic in the Google Groups "sfepy-devel" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sfepy-devel/vlwtFrdnWgw/unsubscribe. To unsubscribe from this group and all its topics, send an email to sfepy-devel...@googlegroups.com. To post to this group, send email to sfepy...@googlegroups.com. Visit this group at https://groups.google.com/group/sfepy-devel.
See the attached diff w.r.t. the original version of fractures_shadow.py you sent.
The variable names in the equations/terms have to be the same as given to the FieldVariable instances.
After the proposed changes, get_pressure_load() gets called. However, it returs a scalar instead of values in the provided coordinates, so the setting of values fails - you need to fix that.
Does it help?
r.
On 03/31/2016 05:42 PM, Adolfo Rodriguez wrote:
I am still getting an error related to the press_load function. Probably is related to the way the corresponding field variable is defined, I have the following lines:
field = Field.from_args('fu', nm.float64, 'vector', omega, approx_order=1)
press_load = Function('press_load',get_pressure_load)
functions = Functions([press_load])
press = FieldVariable('pressure','parameter',field,special={'setter': 'press_load'}, primary_var_name='(set-to-None)')
t4 = Term.new('dw_biot(matalpha.alpha, v, p)', integral, omega, matalpha=matalpha, v=v, p=press)
eq_elastic = Equation('Elastic',t1-t3-t3_hmax-t3_hmin-t4)
I get an error at this line:
Traceback (most recent call last):
File "fractures_shadow.py", line 414, in <module>
main()
File "fractures_shadow.py", line 312, in main
eqs = Equations([eq_elastic])
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 82, in __init__
self.collect_conn_info()
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 187, in collect_conn_info
eq.collect_conn_info(self.conn_info)
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py", line 801, in collect_conn_info
conn_info[key] = term.get_conn_info()
File "/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py", line 728, in get_conn_info
is_trace = self.arg_traces[pvar.name]
KeyError: 'press'
I am pretty sure it is related to the way I am defining the Field Variable but I don't know how to fix it. Any suggestion?
Regards,
Adolfo
On Thu, Mar 31, 2016 at 8:43 AM, Robert Cimrman cimr...@ntc.zcu.cz wrote:
I cannot run the script without the mesh .geo file, but anyway, a few remarks:
the press_load Function instance is not used anywhere, do something like:
functions = Functions([press_load]) ... pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)
- then the function will be available for equations etc. (Problem.time_update() also can take 'functions' argument.)
line 338: use get_mat instead of get_mat1
Could you send also the geometry file, so that I could run it?
r.
On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote:
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode.
What I
am trying to do is very similar to the thermo-elaticity example, but for some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined
as
follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega(
solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press = FieldVariable('pressure','parameter',field_p,special={'setter' :press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and tried? There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
-- You received this message because you are subscribed to a topic in the Google Groups "sfepy-devel" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sfepy-devel/vlwtFrdnWgw/unsubscribe. To unsubscribe from this group and all its topics, send an email to sfepy-devel...@googlegroups.com. To post to this group, send email to sfepy...@googlegroups.com. Visit this group at https://groups.google.com/group/sfepy-devel.
Yes!!, It worked. Thanks a lot.
On Thursday, March 31, 2016 at 11:15:07 AM UTC-5, Robert Cimrman wrote:
See the attached diff w.r.t. the original version of fractures_shadow.py you sent.
The variable names in the equations/terms have to be the same as given to the FieldVariable instances.
After the proposed changes, get_pressure_load() gets called. However, it returs a scalar instead of values in the provided coordinates, so the setting of values fails - you need to fix that.
Does it help?
r.
I am still getting an error related to the press_load function. Probably is related to the way the corresponding field variable is defined, I have
On 03/31/2016 05:42 PM, Adolfo Rodriguez wrote: the
following lines:
field = Field.from_args('fu', nm.float64, 'vector', omega, approx_order=1)
press_load = Function('press_load',get_pressure_load)
functions = Functions([press_load])
press = FieldVariable('pressure','parameter',field,special={'setter': 'press_load'}, primary_var_name='(set-to-None)')
t4 = Term.new('dw_biot(matalpha.alpha, v, p)', integral, omega, matalpha=matalpha, v=v, p=press)
eq_elastic = Equation('Elastic',t1-t3-t3_hmax-t3_hmin-t4)
I get an error at this line:
Traceback (most recent call last):
File "fractures_shadow.py", line 414, in <module>
main()
File "fractures_shadow.py", line 312, in main
eqs = Equations([eq_elastic])
File
"/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py",
line 82, in __init__
self.collect_conn_info()
File
"/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py",
line 187, in collect_conn_info
eq.collect_conn_info(self.conn_info)
File
"/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/discrete/equations.py",
line 801, in collect_conn_info
conn_info[key] = term.get_conn_info()
File
"/Users/adantra/anaconda/envs/default/lib/python2.7/site-packages/sfepy/terms/terms.py",
line 728, in get_conn_info
is_trace = self.arg_traces[pvar.name]
KeyError: 'press'
I am pretty sure it is related to the way I am defining the Field Variable but I don't know how to fix it. Any suggestion?
Regards,
Adolfo
On Thu, Mar 31, 2016 at 8:43 AM, Robert Cimrman
javascript:> wrote: I cannot run the script without the mesh .geo file, but anyway, a few remarks:
the press_load Function instance is not used anywhere, do something like:
functions = Functions([press_load]) ... pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)
- then the function will be available for equations etc. (Problem.time_update() also can take 'functions' argument.)
line 338: use get_mat instead of get_mat1
Could you send also the geometry file, so that I could run it?
r.
On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote:
Robert,
My script goes attached. The function is specified in line 262, defined in line 41 and used in term t4 in line 302.
Thanks!
On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
Hi Adolfo,
On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
I am trying to use a "parameter" field variable in interactive mode.
What I
am trying to do is very similar to the thermo-elaticity example, but
some reason I cannot make it work in interactive mode.
Note that you can set data of a variable directly in the interactive mode, using Variable.set_data().
In the thermo-elasticity example the parameter field variable is defined
as
follows
def get_temperature_load(ts, coors, region=None): """ Temperature load depends on the
x
coordinate. """ x = coors[:, 0] return (x - x.min())**2 - T0fields = { 'displacement': ('real', 3, 'Omega', 1), 'temperature': ('real', 1, 'Omega', 1),}
variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'T' : ('parameter field', 'temperature', {'setter' : 'get_temperature_load'}),}
equations = { 'balance_of_forces' : """dw_lin_elastic.2.Omega( solid.D, v, u ) - dw_biot.2.Omega(
solid.alpha, v, T ) = 0""",}
In interactive mode this is what I am doing the following:
field_p = Field.from_args('fp', nm.float64, 1, omega,
approx_order=order_p)
press_load = Function('press_load',get_pressure_load)
press =
FieldVariable('pressure','parameter',field_p,special={'setter'
:press_load},
primary_var_name='(set-to-None)')
And the corresponding term:
t20 = Term.new('dw_laplace(matalpha.k, q, press)',
integral, omega, matalpha=matalpha, q=q,
press=press)
But this does not work.
Could you send the code that does not work, that could be run and
for tried?
There might be a bug because I have never used a setter function in the interactive mode - I use set_data() directly instead - see also FieldVariable.time_update().
r.
-- You received this message because you are subscribed to a topic in the Google Groups "sfepy-devel" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sfepy-devel/vlwtFrdnWgw/unsubscribe. To unsubscribe from this group and all its topics, send an email to sfepy-d...@googlegroups.com javascript:. To post to this group, send email to sfep...@googlegroups.com javascript:. Visit this group at https://groups.google.com/group/sfepy-devel.
participants (2)
-
Adolfo Rodriguez
-
Robert Cimrman