I am struggling how to convert my NonlinearVariationalProblem that uses periodic boundary condtiions from my version 1.6 code to the latest 2017 version. The constructor for NonlinearVariationalProblem requires DirichletBC, but this was not needed in 1.6:
//version 1.6:
class PeriodicBC : public SubDomain ...
bool inside(const Array<double>& x, bool on_boundary) const
void map(const Array<double>& x, Array<double>& y) const
...
auto PBC1 = PeriodicBC();
jpcPhi::FunctionSpace V_Phi(mesh, PBC1);
jpcPhi::ResidualForm F1(V_Phi);
jpcPhi::JacobianForm J1(V_Phi,V_Phi);
Function phi(V_Phi);
// # Create Nonlinear Problem and Solver
auto ProblemPhi = NonlinearVariationalProblem(F1, phi, J1);
auto SolverPhi = NonlinearVariationalSolver(ProblemPhi);
It is now necessary to pass a DirichletBC for the constructor for NonlinearVariationalProblem:
//version 2017.1:
NonlinearVariationalProblem(std::shared_ptr<const Form> F,
std::shared_ptr<Function> u,
std::vector<std::shared_ptr<const DirichletBC>> bcs,
std::shared_ptr<const Form> J = nullptr)
It is not obvious to me, however, how to do this. I only have periodic BC on my 2D grid (a torus) and I did not need to use a DirichletBC class in v1.6 for this project. I have tried various DirichletBC(...) constructions to pass to NonlinearVariationalProblem, ... no success. I have used limited verisons of Fenics code thus far, so I am probably missing something obvious. Any help on how to properly construct the DirichletBC to pass to NonlinearVariationalProblem?
Thanks for any help!