Hi,
thanks for the response Daniel! Playing around with this example, I
also noticed that solving the equation (over domain [0,1]):
(A) eq = PowerLawConvectionTerm([1]) - 1
subject to:
(B) vel.constrain(0, mesh.facesLeft)
(C) vel.faceGrad.constrain([-0], mesh.facesRight)
gives the correct answer (y=x, from 0 to 1), but requires the second
boundary condition to be specified otherwise gives the error message:
".../FiPy-3.0/fipy/solvers/pysparse/linearLUSolver.py", line 89, in _solve_
LU = superlu.factorize(L.matrix.to_csr())
RuntimeError: Factor is exactly singular"
On the other hand, solving what should be an equivalent equation (?):
(D) eq= -PowerLawConvectionTerm([1]) +1
subject to the same boundary conditions gives the solution y=x-1, i.e.
y going from -1 to 0, which seems incorrect (the solution should be
the same as before?). I.e. the equation is satisfied (slope =1) but
the LHS boundary condition is not enforced properly.
Any idea what is happening here? I am hoping to solve a system of two
(or more) coupled equations with one being a
convection-diffusion-reaction equation for solute transport in a tube
and the other a convection equation with a source term coupled to the
solute concentration (representing an osmotic source). So before I do
this I would like to verify the solvers for each part as much as
possible.
Thanks so much for your time!
Oliver.
On 28 September 2012 03:57, Daniel Wheeler <[email protected]> wrote:
> On Tue, Sep 25, 2012 at 9:47 PM, Oliver Maclaren
> <[email protected]> wrote:
>> Hi,
>> I'm new to FiPy and first just want to say thanks for all the time and
>> effort put into this, it looks like a great learning and research
>> tool!
>>
>> I also have a comment and question about the simple
>> convection-with-source example at:
>> http://www.ctcms.nist.gov/fipy/examples/convection/generated/examples.convection.source.html
>>
>> The (very minor!) comment is that the equation to be solved is stated
>> in the text of the example as:
>>
>> d(phi)/dx - alpha*phi = 0
>>
>> but the equation solved is:
>>
>> d(phi)/dx + alpha*phi = 0
>>
>> which gives the negative gradient of the solution (also in the code
>> the equation is specified by eq = PowerLawConvectionTerm((1,)) +
>> ImplicitSourceTerm(alpha)).
>
> Thanks for that. I'll change it around.
>
>> My question is about the part of the description reading "The boundary
>> condition at x = L will require the implementation of an outflow
>> boundary condition, which is not currently implemented in FiPy. An
>> ImplicitSourceTerm object will be used to represent this term."
>
> This isn't strictly true any more now that we are using constraints.
> As long as any constraint is applied to an exterior surface then the
> boundary conditions is an outflow condition. The reason for this
> requirement is backwards compatibility due to our bad choices int the
> past. The "phi.faceGrad.constrain([0], mesh.facesRight)" basically
> enables an outflow boundary condition otherwise the natural condition
> is applied which is zero velocity.
>
>> I'm not expert in well-posedness and requirements of numerical
>> formulations, but since there is a boundary condition given at x=0 and
>> the equation is first order, why is a boundary condition at x=L
>> required? I tried taking the condition at x=L out and the code still
>> works, but perhaps there is a default Neumann condition implemented
>> anyway?
>
> Obviously, it depends on the direction of the flow, but yes you are
> right. I'll try and modify the text in the example so it makes more
> sense.
>
> Thanks!
>
> --
> Daniel Wheeler
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
--
Oliver Maclaren BE(Hons)
PhD Candidate
Auckland Bioengineering Institute
The University of Auckland
New Zealand
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]