Is there a way to apply several boundary condition on the same mesh with new dolfin version ?

Asked by Abdallah Ben Othman

Dear all,

I use FEniCS with c++ interface to solve multiscale FEM. I only succeed with version 1.0 because
I need to define two or more periodic boundary conditions on the same mesh. It seems to be impossible
with the new version.

Is there a way to apply more than one boundary condition on the same mesh in version 1.2 ?

For example in the version 1.0 I define two sub-domains for a UnitSquare mesh :

/**
 * Sub-domain to define the periodicity for height.
 *
 */
bool MicroScale::PeriodicSubdomainHeight::inside(const Array<double>& x, bool on_boundary) const {

 return fabs(x[1]) < 0.00005;
}

void MicroScale::PeriodicSubdomainHeight::map(const Array<double>& x, Array<double>& y) const {

 y[0] = x[0];
 y[1] = x[1] - 1;
}

/**
 * Sub-domain to define the periodicity for width.
 *
 */
bool MicroScale::PeriodicSubdomainWidth::inside(const Array<double>& x, bool on_boundary) const {

 return fabs(x[0]) < 0.00005;
}

void MicroScale::PeriodicSubdomainWidth::map(const Array<double>& x, Array<double>& y) const {

 y[0] = x[0] - 1;
 y[1] = x[1];
}

\\And then, later in the code I declare the two periodic boundary conditions :

// Set up boundary condition for height
PeriodicSubdomainHeight psh;
PeriodicBC pbch(V, psh);

// Set up Boundary condition for width
PeriodicSubdomainWidth psw;
PeriodicBC pbcw(V, psw);

// Collect boundary conditions
std::vector<const BoundaryCondition*> bcs;
bcs.push_back(&pbcw);
bcs.push_back(&pbch);

// Define variational problem
//[...] I skip the definition part cause it is not really interesting, I think.
LinearVariationalProblem problem(a, L, u, bcs);

It works perfectly well with this version, but when I try to do it in version 1.1,
an error occurs. I can only use one boundary condition. (I haven't try yet with the version 1.2).

And I have an other problem: is there a way to replace the second part of equation u(X) - u(X') = 0 in the new version ?
I need to replace the 0 by another member.

For the second question, I can modify the periodic boundary myself, if there is no other solution,
but the first question is a real problem for me. I can't update my version.

thank you for your help and your attention,
Abdallah.

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

FEniCS no longer uses Launchpad for Questions & Answers. Please consult the documentation on the FEniCS web page for where and how to (re)post your question: http://fenicsproject.org/support/

Can you help with this problem?

Provide an answer of your own, or ask Abdallah Ben Othman for more information if necessary.

To post a message you must log in.