Hello there! First of all let me just say that SfePy is such an amazing software and is helping the visualization and solving equations for my research immensely without having to pay the exorbitant amount of money for a comparable software. After familiarizing myself with creating meshes, and running different simulations (in my case mostly NavierStokes) I was attempting how to create a way to simulate the Brusselator equations and attempted to create two new terms that would model these equations. After following the very nice tutorial in the Developer's Guide, I mimicked all of the other term files and placed a file "terms_brussels.py" into the terms folder just as the other terms files are and I kept getting errors that there were no such terms as the ones I had made. I also attempted to (rather roguishly) append my new terms into a preexisting term file. This could just be stupidity or naivety on my part, but how would one go about implimenting a new term that they had made. I have tried looking for more information in the documentation so I apologize if this question is covered there.
Cheers, Gregory
Hi Gregory,
On 06/29/2018 07:56 PM, underwatergary@gmail.com wrote:
Hello there! First of all let me just say that SfePy is such an amazing software and is helping the visualization and solving equations for my research immensely without having to pay the exorbitant amount of money for a comparable software.
Thanks!
After familiarizing myself with creating meshes, and running different simulations (in my case mostly NavierStokes) I was attempting how to create a way to simulate the Brusselator equations and attempted to create two new terms that would model these equations. After following the very nice tutorial in the Developer's Guide, I mimicked all of the other term files and placed a file "terms_brussels.py" into the terms folder just as the other terms files are and I kept getting errors that there were no such terms as the ones I had made. I also attempted to (rather roguishly) append my new terms into a preexisting term file. This could just be stupidity or naivety on my part, but how would one go about implimenting a new term that they had made. I have tried looking for more information in the documentation so I apologize if this question is covered there.
Maybe there is some bug in the new terms code that prevents the file being imported  try ignore_errors=False setting in sfepy/terms/__init__.py.
Could you send your new terms, and a (small size) example that uses them, so that I could try running it?
Cheers, r.
Robert,
Thank you very much for your help. Sadly makign ignore_erros=False did not seem to do the trick. Here is a link to download the term file as well as the example that I am trying to create.
https://wabash.box.com/s/9tod7p5x14r6bi5929hkr2g36s4mxupe
I'm sure there are more problems in the code that should be easier to fix once I get past this problem. Thanks again!
Hi,
On 07/16/2018 08:46 PM, underwatergary@gmail.com wrote:
Robert,
Thank you very much for your help. Sadly makign ignore_erros=False did not seem to do the trick. Here is a link to download the term file as well as the example that I am trying to create.
https://wabash.box.com/s/9tod7p5x14r6bi5929hkr2g36s4mxupe
I'm sure there are more problems in the code that should be easier to fix once I get past this problem. Thanks again!
So it is the diffusionBrusellator equation, as in, for example, [1]?
You have correctly set up two unknown variables and corresponding two virtual variables. To get the weak formulation, each of the two diffusionBrusellator equations should be multiplied by one of the virtual (= test) variables and integrated over the whole domain. So correct Brusellator terms are nonlinear  each should have a virtual (=test) variable, and two unknown (=state) variables
 this is not so your test implementation.
Another problem is the nonlinearity. You have two options: the derivatives with respect to each of the state variables, that is, the
 Use the state from the previous time step  then the terms just provide the correct residuals.
 Use the current state (implicit solution)  then the terms must also provide
tangent matrices.
The example term in the developer guide is unfortunately too simple to illustrate the above issues. There are terms in sfepy, that are similar in that they depend on two state variables: dw_convect_v_grad_s, dw_jump, dw_tl_bulk_pressure, so try looking at those, but those might not be easy to comprehend. Maybe check also, for example, dw_elastic_wave, which is pure Python, and has a state variable argument. So if you need more help, ask please.
r.
Again thank you so much for your help. I believe that I cleared up the problems you pointed out with the Brusselator terms. However, I still am struggling to actually implement new terms. In an attempt to see if it wasn't my term that was the problem, I attempted to just rename an already existing term and place it in its own new "term_test.py" file. and edited the equation portion of a Problem Description File. After running that file it returned the same error that the new term was not in the terms list. This leads me to believe that I am missing a step where I would need to register these terms or something along those lines. As well, I found on the developer guide (http://sfepy.org/docdevel/developer_guide.html#howtoimplementanewterm) that for creating a new term "new terms are subclasses of sfepy.terms.terms_new.NewTerm" however I cannot find any such class. I assume this doesn't have anything to do with my specific problem but I am just making sure. Thanks again for all the help!
On 07/18/2018 07:36 PM, underwatergary@gmail.com wrote:
Again thank you so much for your help. I believe that I cleared up the problems you pointed out with the Brusselator terms. However, I still am struggling to actually implement new terms. In an attempt to see if it wasn't my term that was the problem, I attempted to just rename an already existing term and place it in its own new "term_test.py" file. and edited the equation portion of a Problem Description File. After running that file it returned the same error that the new term was not in the terms list. This leads me to believe that I am missing a step where I would need to register these terms or something along those lines.
How do you use sfepy? Do you have it installed, or use it locally? It seems to me that the sfepy that gets imported is not the one where you edit files. I suggest you to remove any systemwide or user installation, if any, of the sfepy package, and work only "inplace" in the sfepy directory.
Then renaming an existing file with working terms should not affect their availability.
As well, I found on the developer guide (http://sfepy.org/docdevel/developer_guide.html#howtoimplementanewterm) that for creating a new term "new terms are subclasses of sfepy.terms.terms_new.NewTerm" however I cannot find any such class. I assume this doesn't have anything to do with my specific problem but I am just making sure. Thanks again for all the help!
Thanks for spotting this  NewTerm was an experimental implementation that got removed already long time ago, and apparently I have not removed all mentions in the docs.
r.
On 07/20/2018 01:38 PM, Robert Cimrman wrote:
Thanks for spotting this  NewTerm was an experimental implementation that got removed already long time ago, and apparently I have not removed all mentions in the docs.
FYI: I have updated the docs, and added a (shortish) desciption of a more complex term.
r.
Robert,
By uninstalling and reinstalling Sfepy I managed to correctly add in terms to the terms list. It seems that I had unknowingly installed 2 separate versions. After going through some changes in my code, I keep getting the error "ValueError: incompatible shapes! ((1348, 1, 3, 4), out: (1348, 1, 4, 4), arr: (1348, 1, 4, 1))" I believe this has something to do with the way that the state variables are transposed and how the arrays are being dealt with in the integrate function. My question is what creates the shapes of the arrays and how would I edit it so that they are compatible?
Thanks again, Greogory
Oops never mind! I forgot to use my updated Problem Description File that included using the previous time step.
On 07/26/2018 04:27 PM, underwatergary@gmail.com wrote:
Robert,
By uninstalling and reinstalling Sfepy I managed to correctly add in terms to the terms list. It seems that I had unknowingly installed 2 separate versions. After going through some changes in my code, I keep getting the error "ValueError: incompatible shapes! ((1348, 1, 3, 4), out: (1348, 1, 4, 4), arr: (1348, 1, 4, 1))" I believe this has something to do with the way that the state variables are transposed and how the arrays are being dealt with in the integrate function. My question is what creates the shapes of the arrays and how would I edit it so that they are compatible?
I cannot say more without seeing the actual code, but the four axes in those arrays are (w.r.t. the term region): (number of cells, number of quadrature points or 1 for integrated data, number of rows, number of columns).
r.
Thanks again, Greogory
SfePy mailing list  sfepy@python.org To unsubscribe send an email to sfepyleave@python.org https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
participants (2)

Robert Cimrman

underwatergary＠gmail.com