1 (edited by Mikael Öhman 23-04-2010 19:25:41)

Topic: Geometry dependent dirichlet boundary conditions

Short version:
See code

Long version:
I'm working with multi scale simulations, and the typical boundary conditions are specified as
http://www.forkosh.dreamhost.com/mathtex.cgi?u_i=\bar{\epsilon}_{ij}(x_j-\bar{x}_j)

where x-bar is the center of the representative volume, and epsilon-bar is the center of the domain.

I couldn't easily add such a boundary condition (one which changes with deforming boundary), and even for for a fixed boundary, quite tedious as you would need to add lots of boundary conditions.

So I implemented this sort of dirichlet b.c. but i came across some problems in MasterDof.
Namely this

        if ( bcptr->giveClassID() == BoundaryConditionClass ) {
            return ( BoundaryCondition * ) bcptr;
        }

where i would suggest to change the condition to bcptr->giveType() == DirichletBT.

        if ( bcptr->giveType() == DirichletBT ) {
            return ( BoundaryCondition * ) bcptr;
        }

Also, is BoundaryCondition really the appropriate type to return? I would have thought GeneralBoundaryCondition was more suitable. For now, I changed my b.c. to inherit from BoundaryCondition to avoid to much change, but things such as "prescribedvalue" are meaningless for my class (instead i have "prescribedtensor").



Edit: Something else I've found

int BoundaryCondition :: isImposed(TimeStep *tStep)
{
    // returs a value of isImposedTimeFunction, indicating whether b.c. is imposed or not
    // in given time (nonzero indicates imposed b.c.).

    if ( isImposedTimeFunction ) {
        int flag;
        flag = ( domain->giveLoadTimeFunction(isImposedTimeFunction)->evaluate(tStep, VM_Total) != 0. );
        return flag;
    } else {
        // zero value indicates default behaviour -> b.c. is imposed
        // anytime
        return 1;
    }
}

where there clearly must be a bug; isImposedTimeFunction is a boolean (although an int). only ever 0 or 1.
If anything, it should say "giveLoadTimeFunction(this->loadTimeFunction)", but i believe it should be simpler than that;

flag = this->giveLoadTimeFunction()->evaluate(tStep, VM_Total) != 0.;

Re: Geometry dependent dirichlet boundary conditions

There is another typical boundary condition, http://www.forkosh.dreamhost.com/mathtex.cgi?t_i=\bar{\sigma}_{ij}n_j, which proved to be a bit trickier to implement.

Didn't find any way to do this, except to put it into the elements directly (which would be bad), so I gave up on this (it's not a very important b.c, just for testing, and then the stress tensor is typically zero, which is trivially fulfilled).

3

Re: Geometry dependent dirichlet boundary conditions

Hi Mikael,

I agree with the proposed modification of BoundaryCondition *MasterDof :: giveBc(). But I would stay with return type to be BoundaryCondition class pointer, as one can consider BoundaryCondition class to be a base class for all Dirichlet-like boundary conditions.

Concerning int BoundaryCondition :: isImposed(TimeStep *tStep), I think there is no bug. The isImposedTimeFunction attribute is not a boolean: We need two time functions - one for time history of bc value and one time function that tells whether in given time the boundary condition is active (means applied)  or not. You can not achieve this with a single time function. So, if isImposedTimeFunction attribute is nonzero, then the boundary condition is active provided that the time function with number equal to isImposedTimeFunction value is nonzero. If the isImposedTimeFunction attribute is zero (one could not have a load time function with number equal to zero) then the boundary condition is active in all time steps.

Borek

Re: Geometry dependent dirichlet boundary conditions

You are absolutely correct. I misread the input manual regarding isImposedTimeFunction, rereading it more carefully made it all make much more sense.