Re: [sfepy-devel] Issue whith the variable coors
Hi Nicolas,
you need only to return your values in 'qp' mode (and make them floats). It runs ok with those:
def get_heat_Coeff(ts, coors, mode=None, **kwargs): if mode != 'qp': return
file=open('heat_Coeff.dat', 'r')
tab=[]
tab=file.readlines()
file.close()
length=len(tab)
for i in range(length):
tab[i] = float(tab[i].strip())
val=nm.asarray(tab)
val.shape = (coors.shape[0], 1, 1)
return {'h' : val}
def get_exchange(ts, coors, mode=None, **kwargs): if mode != 'qp': return
file=open('exchange.dat', 'r')
tab=[]
tab=file.readlines()
file.close()
length=len(tab)
for i in range(length):
tab[i] = float(tab[i].strip())
val=nm.asarray(tab)
val.shape = (coors.shape[0], 1, 1)
return {'g' : val}
BTW. make sure that the order of the values corresponds to the ordering of the quadrature point coordinates in coors argument.
r.
On 07/04/2016 03:27 PM, Nicolas DELAN wrote:
Hi,
I have some problem with my case:
I have followed your instructions and i was inspired by the get_pars function of the following example case : http://sfepy.org/doc-devel/examples/diffusion/poisson_functions.html
But with me it don't works, the coors type returned is 'none' so the coors.shape returned nothing. Stangely i have understand that the .py configuration file is readed several time by sfepy, the first time coors is recognised and i can print the coordinates. The second time, coors become a none type variable and i don't understand why.
Also could you take a look at my case ?
I have attached my files to this post.
Thanks a lot, it works !
Le lundi 4 juillet 2016 22:10:05 UTC+2, Robert Cimrman a écrit :
Hi Nicolas,
you need only to return your values in 'qp' mode (and make them floats). It runs ok with those:
def get_heat_Coeff(ts, coors, mode=None, **kwargs): if mode != 'qp': return
file=open('heat_Coeff.dat', 'r') tab=[] tab=file.readlines() file.close() length=len(tab) for i in range(length): tab[i] = float(tab[i].strip()) val=nm.asarray(tab) val.shape = (coors.shape[0], 1, 1) return {'h' : val}
def get_exchange(ts, coors, mode=None, **kwargs): if mode != 'qp': return
file=open('exchange.dat', 'r') tab=[] tab=file.readlines() file.close() length=len(tab) for i in range(length): tab[i] = float(tab[i].strip()) val=nm.asarray(tab) val.shape = (coors.shape[0], 1, 1) return {'g' : val}
BTW. make sure that the order of the values corresponds to the ordering of the quadrature point coordinates in coors argument.
r.
On 07/04/2016 03:27 PM, Nicolas DELAN wrote:
Hi,
I have some problem with my case:
I have followed your instructions and i was inspired by the get_pars function of the following example case : http://sfepy.org/doc-devel/examples/diffusion/poisson_functions.html
But with me it don't works, the coors type returned is 'none' so the coors.shape returned nothing. Stangely i have understand that the .py configuration file is readed several time by sfepy, the first time coors is recognised and i can print the coordinates. The second time, coors become a none type variable and i don't understand why.
Also could you take a look at my case ?
I have attached my files to this post.
participants (2)
-
Nicolas DELAN
-
Robert Cimrman