That worked thanks! > On 21 Mar 2019, at 18:44, Daniel Wheeler <daniel.wheel...@gmail.com> wrote: > > On Thu, Mar 21, 2019 at 1:14 PM Meier Quintin <quintin.me...@mat.ethz.ch> > wrote: >> >> Dear Daniel, >> Thanks a lot for the help. I got it to work by adding a transientterm(). >> >> If I try to use your second trick though: >> >> eq = (DiffusionTerm(coeff=(1.0), var=phi) - numerix.sin(phi) + phi * >> numerix.cos(phi)-ImplicitSourceTerm(numerix.cos(phi)) == >> TransientTerm(var=phi)) > > I think this has the parentheses in the wrong place. Does the code > that I included in my last email work for you as is? > > This (without the line break) > ~~~~ > eq = TransientTerm() == DiffusionTerm() - numerix.sin(phi) + phi * > numerix.cos(phi) - ImplicitSourceTerm(numerix.cos(phi)) > ~~~~ > >> I get the error: >> >> ExplicitVariableError: Terms with explicit Variables cannot mix with Terms >> with implicit Variables. > > That's because of the parentheses I think. > >> Also, I dont fully understand the expression: I assume the implicit term is >> to neutralize the phi * numerix.cos(phi), so should it not be: >> phi*ImplicitSourceTerm(numerix.cos(phi))? > > ImplicitSourceTerm includes the extra variable multiplier > automatically. It put the source into the matrix diagonal to stabilize > the solution. Ok, so adding the ImplicitSourceTerm helps with stability but does not add anything relevant to the solution?
> >> Also: if I would want a second derivative in time in there to solve the >> time-dependent problem, would the best way to do that to define a second >> variable: >> >> dphidt=TransientTerm(var=phi) >> >> and solve the coupled equations or is there a different way? > > Yes, right, it can be split into two hyperbolic equations, but FiPy > doesn't do well with those types of equations. It doesn't have the > correct numerical schemes. I think CLAWPACK might be a better bet for > that. Ok, no problem, I was just interested, its not that important for me :) > > -- > Daniel Wheeler > _______________________________________________ > 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 ]