Skip to content
Snippets Groups Projects
Commit e41ad67e authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Allow to start from a non-homogeneous configuration again

Jendrik and Robert proposed to start from a particular stripe pattern.
This pattern is implemented here in C++.  Having it in Python would be
nicer, but has to wait for later.
parent 7098e5e4
Branches
No related tags found
No related merge requests found
...@@ -224,7 +224,34 @@ int main (int argc, char *argv[]) try ...@@ -224,7 +224,34 @@ int main (int argc, char *argv[]) try
if (parameterSet.hasKey("initialIteratePython")) if (parameterSet.hasKey("initialIteratePython"))
{ {
DUNE_THROW(NotImplemented, "initialIteratePython is not implemented"); #if 1
auto initialDisplacement = [&x0, F0](const FieldVector<double,2>& x) {
auto l1 = 1.0 / sqrt(x0);
int numStripes = 6;
std::array<int,2> p = {std::round(x[0] * numStripes),
std::round(x[1] * numStripes)};
double delta = 0.5;
double l = ((p[0]+p[1])%2) ? delta : -delta;
return l*F0;
};
Dune::Functions::interpolate(feBasis, x, initialDisplacement);
#else
// The python class that implements the Dirichlet values
Python::Module initialIterateModule = Python::import(parameterSet.get<std::string>("initialIteratePython"));
// Method of that python class
auto pythonInitialIterate = Python::makeFunction<FieldMatrix<double,dim,dim>(const FieldVector<double,dim>&)>(initialIterateModule.get("f"));
Functions::interpolate(feBasis, x, pythonInitialIterate);
#warning Set the correct Dirichlet values!
#endif
auto zeroMatrix = [](const FieldVector<double,2>& x) { return FieldMatrix<double,2,2> {0}; };
// Write the correct Dirichlet boundary values
Dune::Functions::interpolate(feBasis, x, zeroMatrix, dirichletDofs);
} }
if (parameterSet.hasKey("initialIterateFile")) if (parameterSet.hasKey("initialIterateFile"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment