Re: Thermal Diffusion with Source
Hi Jonathan, The temperature change predicted is simply too high. This simulates sliding of a granular material under modest stress at 10 µm/s. I did find the issue though. For what it’s worth the representation should be: eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) + (mask * ((mu*sigma_n*v/w) / (rho*cp))) eqI = TransientTerm() == DiffusionTerm(coeff=D) + (mask * ((mu*sigma_n*v/w) / (rho*cp))) eqCN= eqI + eqX I was just worried I didn’t grasp the way I needed to interact with FiPy. An example along this vein could be a useful addition in the docs possibly? Cheers, John > On Apr 19, 2016, at 10:27 AM, Guyer, Jonathan E. Dr. (Fed) > wrote: > > I don't see anything obviously wrong with the way you've posed the source. > Why do you think you have a problem? > >> On Apr 18, 2016, at 4:44 PM, John Leeman wrote: >> >> Hi all, >> >> I’m working on implementing a rather simple thermal diffusion model with >> FiPy, but haven’t been able to find any examples or things in the docs to >> get me over the last challenge. >> >> The model represents a stack of several materials. One of them is a granular >> substance that is sheared and generates some heat. The shear heating >> generation is just the product of the shear stress and velocity. The >> velocity will vary with time in the model (in the end). Basically I’m >> solving equations 2,3 from >> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.211.384&rep=rep1&type=pdf >> >> I was able to build the model and solve a simple diffusion problem, but I’m >> having trouble figuring out how to get the heat generation term into FiPy. >> You can see the simple notebook and a notebook in which I tried to add the >> heating terms on this gist: >> https://gist.github.com/jrleeman/8bcafffd512feaa77ec2946dc92460ae >> I’m probably missing something, but after looking through the source term >> docs I was unclear how to proceed. >> >> Many Thanks, >> John >> ___ >> fipy mailing list >> fipy@nist.gov >> http://www.ctcms.nist.gov/fipy >> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > ___ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: fipy diffusion setup
Hi Daniel Thank you for following up- I did try your suggestion, ( C is my concentration dependent Cell variable) Dx=Dpe_x*(a_x+((1.-a_x)/(b_x*C+g_x))) Dz=Dpe_z*(a_z+((1.-a_z)/(b_z*C+g_z))) diff = Dx.dot([[1,0],[0,0]])+Dz.dot([[0,0],[0,1]]) and program runs and "looks correct" so good to go!! But before your suggestion I was trying to create the suggested rank 2 diffusion coefficient a different way and I did not get far before hitting a road block- If you have time to answer this specific question it may help with understanding the structure of variables in this program I created a 2x2 Cell Variable on a 2x2 2Dim mesh. I can show that code if necessary, but the result for the initialized CellVariable is shown below print(D.value) [[[ 0. 2. 4. 6.] [ 1. 1. 1. 1.]] [[ 1. 1. 1. 1.] [ 1. 1. 1. 1.]]] Now the part that I am having trouble with. How can I change the 6 to a 0.? The closet I can come is changing all the values at that mesh position to 0. that is using D.setValue(0,where=[[0,0,0,1]]) print(D.value) [[[ 0. 2. 4. 0.] [ 1. 1. 1. 0.]] [[ 1. 1. 1. 0.] [ 1. 1. 1. 0.]]] again what I was angling for was an output that looked like [[[ 0. 2. 4. 0.] [ 1. 1. 1. 1.]] [[ 1. 1. 1. 1.] [ 1. 1. 1. 1.]]] thanks for your help Phil On 4/19/2016 6:51 AM, Daniel Wheeler wrote: Phil, just to follow up and complete the answer. I neglected to explain how to create a rank 2 CellVariable from two rank 0 CellVariables to preserve the dependency. The dot operator helps with that. Given two rank 0 CellVariables, v00 and v11, then to get the rank 2 CellVariable use, vv = v00.dot([[1, 0], [0, 0]]) + v11.dot([[0, 0], [0, 1]]) On Mon, Apr 18, 2016 at 3:33 PM, Daniel Wheeler wrote: On Mon, Apr 18, 2016 at 12:33 PM, Phil Battle wrote: Ok, below works as I would expect ( note Dx and Dz are constants) Thanks for that. I can confirm that it's broken in Python 2.7 as well when the diffusion coefficient is [[Dx, Dy]]. -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
squared partial derivatives
Hello, I am trying to solve a compressible flow problem (Navier Stokes equations for a gas). Can a term like: (\partial(f(x,y))/\partial y) * (\partial(f(x,y))/\partial y) be represented in FiPy ? Thanks a lot, -- Dr. Francisco Vega Reyes Departamento de Física, Universidad de Extremadura Avda. Elvas s/n, 06071 Badajoz, España email: fv...@unex.es web: http://www.unex.es/eweb/fisteor/fran tel: +34 924 289300, Ext. 86109 fax: +34 924 289651 ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: Thermal Diffusion with Source
I don't see anything obviously wrong with the way you've posed the source. Why do you think you have a problem? > On Apr 18, 2016, at 4:44 PM, John Leeman wrote: > > Hi all, > > I’m working on implementing a rather simple thermal diffusion model with > FiPy, but haven’t been able to find any examples or things in the docs to get > me over the last challenge. > > The model represents a stack of several materials. One of them is a granular > substance that is sheared and generates some heat. The shear heating > generation is just the product of the shear stress and velocity. The velocity > will vary with time in the model (in the end). Basically I’m solving > equations 2,3 from > http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.211.384&rep=rep1&type=pdf > > I was able to build the model and solve a simple diffusion problem, but I’m > having trouble figuring out how to get the heat generation term into FiPy. > You can see the simple notebook and a notebook in which I tried to add the > heating terms on this gist: > https://gist.github.com/jrleeman/8bcafffd512feaa77ec2946dc92460ae > I’m probably missing something, but after looking through the source term > docs I was unclear how to proceed. > > Many Thanks, > John > ___ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: fipy diffusion setup
Phil, just to follow up and complete the answer. I neglected to explain how to create a rank 2 CellVariable from two rank 0 CellVariables to preserve the dependency. The dot operator helps with that. Given two rank 0 CellVariables, v00 and v11, then to get the rank 2 CellVariable use, vv = v00.dot([[1, 0], [0, 0]]) + v11.dot([[0, 0], [0, 1]]) On Mon, Apr 18, 2016 at 3:33 PM, Daniel Wheeler wrote: > On Mon, Apr 18, 2016 at 12:33 PM, Phil Battle wrote: >> Ok, below works as I would expect ( note Dx and Dz are constants) > > Thanks for that. I can confirm that it's broken in Python 2.7 as well > when the diffusion coefficient is [[Dx, Dy]]. > > > -- > Daniel Wheeler -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]