# dynamically changing parameter with space and time

4 messages
Open this post in threaded view
|

## dynamically changing parameter with space and time

 Hi FEATool team, it is a nice function in FEATool to set up a dynamically changing parameter with space and time. For example, in a 2D domain, I can change a parameter value with space by: 1*(x>=0.9)*(x<1.0)*(y>=0.0)*(y<0.1)+ 0*(x>=0.9)*(x<1.0)*(y>0.1)*(y<0.2)+ 1*(x>=0.9)*(x<1.0)*(y>0.2)*(y<0.3)+ 0*(x>=0.9)*(x<1.0)*(y>0.3)*(y<0.4)+ 1*(x>=0.9)*(x<1.0)*(y>0.4)*(y<0.5)+ 0*(x>=0.8)*(x<0.9)*(y>=0.0)*(y<0.1)+ ..... The problem is that  it is easy to set up a parameter value in 50 different areas by this method. But it will be hard to set up for 5000 positions (e.g. 70% of the value will be 1 and 30% of the value will be 0.2 under uniform distribution). Is there any methods to do it efficiently in FEATool? Thanks!
Open this post in threaded view
|

## Re: dynamically changing parameter with space and time

 Administrator Hmm, maybe you can use an expression of the form  (mod(x,0.2)>0.1)&(mod(y,0.2)<0.1) or, alternatively you probably have to define a custom Matlab function that is called to define your domain.
Open this post in threaded view
|

## Re: dynamically changing parameter with space and time

 Thank you for your response. I tried to use in-built matlab function "randsrc(1,1,[0,1;0.10,0.90])" to set up a changing parameter with space in the constant setup panel (10% probability of the parameter at a value of 0 and 90% probability of the value at 1). However, if I checked this parameter distribution over the test domain by the Featool plot function, I found there is a distribution of the value from 0.33 to 1. Does Featool support randsrc function? How can I get the parameter value either at 0 or 1 with a predefined probability over the test domain? Thanks
Open this post in threaded view
|

## Re: dynamically changing parameter with space and time

 Administrator Yes, technically it works. The issue I think you are seeing is that evaluations are performed for quadrature points and averaged over cells. This means that evaluation for values shared between cells could be performed many times (despite how it may seem this is more efficient in Matlab as it can be vectorized). So for example if a grid node is shared between 3 cells, then your function is called three times of which the average it taken (maybe like 0+1+0/3). In order for you to get unique values for each node your would have to create a function that takes (x,y(,z)) as inputs and returns unique values depending on the positions.