← Back to team overview

dolfin team mailing list archive

Re: [Question #152914]: onedimensional derivatives

 

On 15 April 2011 13:15, Martin Sandve Alnæs
<question152914@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Question #152914 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/152914
>
> Martin Sandve Alnæs posted a new comment:
> Kristian, can you check if this seems right? Is det(f) == f for scalar f
> useful?

It looks right, I've never used det(f), but why not leave it in there
for completeness?

Kristian

> In [3]: V = FiniteElement("CG", interval, 1)
>
> In [4]: f = Coefficient(V)
>
> In [5]: grad(f)
> Out[5]: SpatialDerivative(Coefficient(FiniteElement('Lagrange',
> Cell('interval', 1, Space(1)), 1), 0), MultiIndex((FixedIndex(0),), {0: 1}))
>
> In [6]: grad(f) == f.dx(0)
> Out[6]: True
>
> In [7]: div(f) == f.dx(0)
> Out[7]: True
>
> In [10]: inner(f,f) == f*f
> Out[10]: True
>
> In [11]: dot(f,f) == f*f
> Out[11]: True
>
> In [13]: det(f) == f
> Out[13]: True
>
> Martin
>
>
> On 15 April 2011 12:30, Kristian Ølgaard <k.b.oelgaard@xxxxxxxxx> wrote:
>
>> On 15 April 2011 10:53, Martin Sandve Alnæs <martinal@xxxxxxxxx> wrote:
>> > Change grad(T) to T.dx(0), i.e. derivative in a single direction.
>> > Maybe we should make grad work like .dx(0) in 1D.
>>
>> I think that would be a good idea.
>> When testing stuff in 1D (which is intended for 2D and 3D) I find it
>> annoying to change back and forth between grad() and .dx(0).
>>
>> Kristian
>>
>> > Martin
>> >
>> > On 15 April 2011 10:46, Bento <question152914@xxxxxxxxxxxxxxxxxxxxx>
>> wrote:
>> >>
>> >> New question #152914 on DOLFIN:
>> >> https://answers.launchpad.net/dolfin/+question/152914
>> >>
>> >> Hi,
>> >>
>> >> I want to solve a PDE on a one-dimensional domain. The equation involves
>> a
>> >> first derivative. How do I express this in 1D? Here is (basically) my
>> >> equation:
>> >>
>> >> dT/dx + d^2T/dx^2 = 0
>> >>
>> >> and weak form
>> >>
>> >> a = (grad(T)*v - inner(grad(T), grad(v)))*dx
>> >>
>> >> with testfunction v and trialfunction T. When I use grad(T), I get a
>> >> "shape mismatch in sum" error. The mesh is Interval(100, 0, 10)
>> >>
>> >> --
>> >> You received this question notification because you are a member of
>> >> DOLFIN Team, which is an answer contact for DOLFIN.
>> >>
>> >> _______________________________________________
>> >> Mailing list: https://launchpad.net/~dolfin
>> >> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
>> >> Unsubscribe : https://launchpad.net/~dolfin
>> >> More help   : https://help.launchpad.net/ListHelp
>> >
>> >
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~dolfin
>> > Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
>> > Unsubscribe : https://launchpad.net/~dolfin
>> > More help   : https://help.launchpad.net/ListHelp
>> >
>> >
>>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp
>



References