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
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.;