← Back to team overview

ffc team mailing list archive

[DOLFIN-dev] Higher-order problems?

 

First I have to say that I'm not sure that this should work...

1- Probably I'm missing/ignoring something (mathematically speaking)
2- I didn't find yet, in the literature, a simple example
    (but I've started this week :) )
    If anyone knows such an example,
    I would by happy to make a demo with it.
3- all the cases I've seen are related with plate bending and requires
    hermite elements or some other "non-standard elements"
4-Concerning the code: I'm not sure on the Boundary conditions syntax.

I was thinking in a simple "4th order like poisson "
for instance:

-lap lap u(x,y)=-sin(x)  in the [0,2pi]x[0,2pi]
lap u= -sin(x)  and  grad(u).n=(cos(x),0).n  in the Boundary

with solution u(x,y)=sin(x)

LapLap.ufl
------------------------------------------------------------------------
element = FiniteElement("Lagrange", triangle, 2)
v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)
g = Function(element)
n = VectorConstant("triangle")
a = -div(grad(v))*div(grad(u))*dx
L = v*f*dx-f*inner(grad(v),n)*ds+div(grad(g*n[0]))*v*ds
----------------------------------------------------------------------
the main.cpp is modified from the poisson demo  and follows in attachment.
(I'm using  0.9.2  dolfin version)
It really fails.

> This should work, but I don't know of a demo testing it.
>
> See if you could create a very simple test case that fails.

-- 
Nuno David Lopes

e-mail:ndl@xxxxxxxxxxxxxx        (FCUL/CMAF)
           nlopes@xxxxxxxxxxxxxxx    (ISEL)
http://ptmat.ptmat.fc.ul.pt/%7Endl/

Thu Jun 25 22:19:44 WEST 2009

// Copyright (C) 2006-2009 Anders Logg.
// Licensed under the GNU LGPL Version 2.1.
//
// Modified by Nuno Lopes
//
// First added:  2009-06-25
// Last changed: 
//
// This demo program solves the 4th order equation
//
//     - lap lap u(x, y) = f(x,y)
//
// on the square [0,2pi]^2 with source f given by
//
//     f(x, y) = - sin(x)
//
// and boundary conditions given, in all boundary, by
//
//     lap u(x, y) = -sin(x), (grad u).n= (cos(x),0).n

#include <dolfin.h>
#include "LapLap.h"

using namespace dolfin;

// Source term
class F : public Function
{
  void eval(double* values, const double* x) const
  {
    values[0] = -sin(x[0]);
  }
};

class G : public Function
{
  void eval(double* values, const double* x) const
  {
    values[0] = cos(x[0]);
  }
};


int main()
{
  dolfin_set("linear algebra backend","uBLAS");
  
  // Create mesh and function space
  Rectangle mesh(0,0,2*DOLFIN_PI,2*DOLFIN_PI,35,35,Rectangle::left);
  LapLapFunctionSpace V(mesh);

 
  // Define variational problem
  LapLapBilinearForm a(V, V);
  LapLapLinearForm L(V);
  F f;
  G g;
  FacetNormal n;

  L.f = f;
  L.g = g;
  L.n=n;

  // Compute solution
  VariationalProblem problem(a, L);
  Function u;
  problem.solve(u);

  // Plot solution
  plot(u);

  // Save solution in VTK format
  File file("poisson.pvd");
  file << u;

  return 0;
}
element = FiniteElement("Lagrange", triangle, 2)

v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)
g = Function(element)

n = VectorConstant("triangle")

a = -div(grad(v))*div(grad(u))*dx
L = v*f*dx-f*inner(grad(v),n)*ds+div(grad(g*n[0]))*v*ds

Attachment: signature.asc
Description: PGP signature


Follow ups