← Back to team overview

dolfin team mailing list archive

Re: Change interface for boundary conditions: operator() --> eval(). [...]

 

Yes, we should fix this. To do that, we probably need to create the
same structure as we have for Functions:

    BoundaryCondition

           |
           |

GenericBoundaryCondition 

           |
          / \
         /   \

       A       B

where A = UserBoundaryCondition, B = MixedBoundaryCondition.

Maybe we also need FunctionPointerBoundaryCondition and some other
types.

The situation here is somewhat opposite to the mixed Functions that we
added earlier. The problem then was to pick sub functions of mixed
Functions obtained as solutions of mixed systems:

   u = w[0];
   p = w[1];

Now instead, we want to specify two (or more) boundary conditions for
the sub functions and then apply this to the mixed system.

I suggest something like this:

    // Declared as usual
    VelocityBC bc_u;
    PressureBC bc_p;

    // Create a mixed boundary condition
    BoundaryCondition bc(bc_u, bc_p);

Perhaps we need to support picking sub boundary conditions:

    bc_u = bc[0];
    bc_p = bc[1];

but I doubt it's necessary at this point.

Another question is if we should add a subclass MixedFunction that can
be used to declare mixed functions in the same way:

    Function w(u, p);

but that might also not be necessary at this point (since FFC can work
on the subfunctions as such without needing to bundle them).

So it seems like we need to support indexing for Functions (which we
already do) and add support for aggregating boundary conditions (the
opposite) into mixed boundary conditions.

Of course, we could put the functionality in the assembler and give it
a list of boundary conditions, but I would like to hide this from the
assembler so it does not need to know about mixed systems.

/Anders


On Wed, Dec 28, 2005 at 07:15:38PM +0100, Garth N. Wells wrote:

> Would it be possible to design BoundaryConditions in an analogous way to
> Function so that it knows something about "sub boundary
> conditions" (like subfunctions)? A BoundaryCondtion would contain "sub
> boundary conditions" for different terms in the pde. Rather then
> pressure in 3D NSE being component i = 3 when applying BC's, it could be
> set by another function.
> 
> Garth 
> 
> 
> On Wed, 2005-12-28 at 18:42 +0100, dolfin@xxxxxxxxxx wrote:
> > Commit from logg (2005-12-28 18:42 CET)
> > ----------------
> > 
> > Change interface for boundary conditions: operator() --> eval().
> > 
> > New interface is
> > 
> >   void eval(BoundaryValue& value, const Point& p, unsigned int i)
> > 
> > Motivation:
> > 
> > 1. Consistent with the new Function interface for user-defined functions.
> > 
> > 2. Shorter implementations:
> > 
> > Old version:
> > 
> >   class MyBC : public BoundaryCondition
> >   {
> >     const BoundaryValue operator() (const Point& p)
> >     {
> >       BoundaryValue value;
> >       if ( std::abs(p.x - 1.0) < DOLFIN_EPS )
> >         value = 0.0;
> >       return value;
> >     }
> >   };
> > 
> >   class MyBC : public BoundaryCondition
> >   {
> >     void eval(BoundaryValue& value, const Point& p, unsigned int i)
> >     {
> >       if ( std::abs(p.x - 1.0) < DOLFIN_EPS )
> >         value = 0.0;
> >     }
> >   };
> > 
> > All modules and demos updated to the new interface.
> > 
> >   dolfin  ChangeLog                                          1.273
> >   dolfin  Makefile.in                                        1.137
> >   dolfin  aclocal.m4                                         1.159
> >   dolfin  configure                                          1.242
> >   dolfin  src/Makefile.in                                    1.139
> >   dolfin  src/config/Makefile.in                             1.140
> >   dolfin  src/demo/Makefile.in                               1.146
> >   dolfin  src/demo/fem/Makefile.in                           1.43
> >   dolfin  src/demo/fem/convergence/main.cpp                  1.7
> >   dolfin  src/demo/nls/Makefile.in                           1.10
> >   dolfin  src/demo/nls/nonlinearpoisson/main.cpp             1.5
> >   dolfin  src/demo/nls/poisson/main.cpp                      1.4
> >   dolfin  src/demo/poisson/main.cpp                          1.13
> >   dolfin  src/demo/scripting/Makefile.in                     1.29
> >   dolfin  src/demo/solvers/Makefile.in                       1.139
> >   dolfin  src/demo/solvers/convdiff/main.cpp                 1.22
> >   dolfin  src/demo/solvers/elasticity/main.cpp               1.17
> >   dolfin  src/demo/solvers/elasticity-updated/main.cpp       1.44
> >   dolfin  src/demo/solvers/heat/main.cpp                     1.13
> >   dolfin  src/demo/solvers/navierstokes/Makefile.in          1.106
> >   dolfin  src/demo/solvers/navierstokes/benchmark/main.cpp   1.33
> >   dolfin  src/demo/solvers/ode/Makefile.in                   1.123
> >   dolfin  src/demo/solvers/ode/homotopy/Makefile.in          1.68
> >   dolfin  src/demo/solvers/ode/modeling/Makefile.in          1.95
> >   dolfin  src/demo/solvers/poisson/main.cpp                  1.40
> >   dolfin  src/demo/solvers/stokes/main.cpp                   1.6
> >   dolfin  src/greeting/Makefile.in                           1.120
> >   dolfin  src/kernel/Makefile.in                             1.137
> >   dolfin  src/kernel/common/Makefile.in                      1.141
> >   dolfin  src/kernel/common/dolfin/Makefile.in               1.135
> >   dolfin  src/kernel/fem/BoundaryCondition.cpp               1.7
> >   dolfin  src/kernel/fem/FEM.cpp                             1.51
> >   dolfin  src/kernel/fem/Makefile.in                         1.150
> >   dolfin  src/kernel/fem/dolfin/BoundaryCondition.h          1.14
> >   dolfin  src/kernel/fem/dolfin/Makefile.in                  1.149
> >   dolfin  src/kernel/form/Makefile.in                        1.119
> >   dolfin  src/kernel/form/dolfin/Makefile.in                 1.119
> >   dolfin  src/kernel/function/Makefile.in                    1.112
> >   dolfin  src/kernel/function/dolfin/Makefile.in             1.113
> >   dolfin  src/kernel/io/Makefile.in                          1.146
> >   dolfin  src/kernel/io/dolfin/Makefile.in                   1.140
> >   dolfin  src/kernel/la/Makefile.in                          1.149
> >   dolfin  src/kernel/la/dolfin/Makefile.in                   1.146
> >   dolfin  src/kernel/log/Makefile.in                         1.127
> >   dolfin  src/kernel/log/dolfin/Makefile.in                  1.127
> >   dolfin  src/kernel/main/Makefile.in                        1.137
> >   dolfin  src/kernel/main/dolfin/Makefile.in                 1.132
> >   dolfin  src/kernel/math/Makefile.in                        1.128
> >   dolfin  src/kernel/math/dolfin/Makefile.in                 1.127
> >   dolfin  src/kernel/mesh/Makefile.in                        1.114
> >   dolfin  src/kernel/mesh/dolfin/Makefile.in                 1.113
> >   dolfin  src/kernel/nls/Makefile.in                         1.24
> >   dolfin  src/kernel/nls/dolfin/Makefile.in                  1.24
> >   dolfin  src/kernel/ode/Makefile.in                         1.145
> >   dolfin  src/kernel/ode/dolfin/Makefile.in                  1.142
> >   dolfin  src/kernel/parameter/Makefile.in                   1.6
> >   dolfin  src/kernel/parameter/dolfin/Makefile.in            1.7
> >   dolfin  src/kernel/quadrature/Makefile.in                  1.130
> >   dolfin  src/kernel/quadrature/dolfin/Makefile.in           1.130
> >   dolfin  src/modules/Makefile.in                            1.146
> >   dolfin  src/modules/convdiff/Makefile.in                   1.139
> >   dolfin  src/modules/convdiff/dolfin/Makefile.in            1.66
> >   dolfin  src/modules/dolfin/Makefile.in                     1.66
> >   dolfin  src/modules/elasticity/Makefile.in                 1.102
> >   dolfin  src/modules/elasticity/dolfin/Makefile.in          1.56
> >   dolfin  src/modules/elasticity-updated/Makefile.in         1.92
> >   dolfin  src/modules/elasticity-updated/dolfin/Makefile.in  1.53
> >   dolfin  src/modules/heat/Makefile.in                       1.46
> >   dolfin  src/modules/heat/dolfin/Makefile.in                1.29
> >   dolfin  src/modules/navierstokes/Makefile.in               1.137
> >   dolfin  src/modules/navierstokes/NSESolver.cpp             1.44
> >   dolfin  src/modules/navierstokes/dolfin/Makefile.in        1.66
> >   dolfin  src/modules/poisson/Makefile.in                    1.138
> >   dolfin  src/modules/poisson/dolfin/Makefile.in             1.67
> >   dolfin  src/modules/stokes/Makefile.in                     1.30
> >   dolfin  src/modules/stokes/dolfin/Makefile.in              1.28
> >   dolfin  src/post/Makefile.in                               1.123
> >   dolfin  src/pre/Makefile.in                                1.131
> >   dolfin  src/test/main.cpp                                  1.18
> >   dolfin  src/utils/Makefile.in                              1.134
> >   dolfin  src/utils/inp2dx/Makefile.in                       1.134
> > 
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> 
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> 

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/



References