added subdomain indexing for outer edges, for use in robin BC
This commit is contained in:
parent
db7bd92b2d
commit
99b46ad7ec
5 changed files with 143 additions and 33 deletions
|
|
@ -20,24 +20,24 @@ int main(int argc, char **argv )
|
|||
#undef MG
|
||||
#ifndef MG
|
||||
// Jacobi iteration
|
||||
int nrefine = 0;
|
||||
if (argc > 1) nrefine = atoi(argv[1]);
|
||||
//int nrefine = 0;
|
||||
//if (argc > 1) nrefine = atoi(argv[1]);
|
||||
|
||||
|
||||
// generating the mesh
|
||||
Mesh const mesh_c("../generate_mesh/coffee_cup.txt", "../generate_mesh/coffee_cup_sd.txt");
|
||||
//Mesh const mesh_c("square_tiny.txt");
|
||||
bool ba = mesh_c.checkObtuseAngles();
|
||||
if (ba) cout << "mesh corrected" << endl;
|
||||
//mesh_c.DebugEdgeBased();
|
||||
|
||||
gMesh_Hierarchy ggm(mesh_c, nrefine);
|
||||
const Mesh &mesh = ggm.finest();
|
||||
//gMesh_Hierarchy ggm(mesh_c, nrefine);
|
||||
//const Mesh &mesh = ggm.finest();
|
||||
//mesh.Debug();
|
||||
//mesh.DebugEdgeBased();
|
||||
|
||||
|
||||
// Initializing FEM matrix !pattern! (only zero entries now)
|
||||
FEM_Matrix SK(mesh); // CRS matrix
|
||||
FEM_Matrix SK(mesh_c); // CRS matrix
|
||||
//SK.writeBinary("sparseMatrix.bin");
|
||||
//SK.Debug();
|
||||
|
||||
|
|
@ -50,19 +50,20 @@ int main(int argc, char **argv )
|
|||
//SK.Debug();
|
||||
|
||||
// Calculate RHS
|
||||
SK.CalculateRHS(fv, [](double x, double y) { // rhs
|
||||
return std::sin(M_PI * 2.5 * y) * (M_PI * M_PI * 2.5 * 2.5 * x * x - 2); });
|
||||
// SK.CalculateRHS(fv, [](double x, double y) { // rhs
|
||||
// return std::sin(M_PI * 2.5 * y) * (M_PI * M_PI * 2.5 * 2.5 * x * x - 2); });
|
||||
SK.CalculateRHS(fv, [](double x, double y) {return 0;});
|
||||
//SK.CheckRowSum();
|
||||
SK.CheckMatrix();
|
||||
|
||||
// Initialize temperature
|
||||
vector<double> uv(SK.Nrows(), 0.0); // temperature
|
||||
mesh.Init_Solution_mult(uv, 0, [](double x, double y) -> double { return 18; }); // mug
|
||||
mesh.Init_Solution_mult(uv, 1, [](double x, double y) -> double { return 80; }); // fluid
|
||||
mesh.Init_Solution_mult(uv, 2, [](double x, double y) -> double { return 18; }); // air
|
||||
mesh_c.Init_Solution_mult(uv, 0, [](double x, double y) -> double { return 18; }); // mug
|
||||
mesh_c.Init_Solution_mult(uv, 1, [](double x, double y) -> double { return 80; }); // fluid
|
||||
mesh_c.Init_Solution_mult(uv, 2, [](double x, double y) -> double { return 18; }); // air
|
||||
|
||||
// Apply BC
|
||||
SK.ApplyDirichletBC(uv, fv);
|
||||
SK.ApplyRobinBC_mult(uv, fv, 18.0);
|
||||
|
||||
|
||||
// Solve
|
||||
|
|
@ -83,7 +84,7 @@ int main(int argc, char **argv )
|
|||
auto [val, idx] = findLargestAbsError(exact_sol, uv, 1e+6, 100);
|
||||
|
||||
//mesh.Visualize(getAbsError(exact_sol, uv));
|
||||
mesh.Visualize(uv);
|
||||
mesh_c.Visualize(uv);
|
||||
|
||||
#else
|
||||
// multigrid iteration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue