added Robin BC, disabled cuthill_mckee_reordering for now
This commit is contained in:
parent
c321dbc271
commit
b78c3f9aff
5 changed files with 46 additions and 46 deletions
|
|
@ -616,57 +616,48 @@ void FEM_Matrix::ApplyDirichletBC(std::vector<double> const &u, std::vector<doub
|
|||
}
|
||||
|
||||
|
||||
void FEM_Matrix::ApplyRobinBC_mult(std::vector<double> const &u, std::vector<double> &f, const double u_out)
|
||||
void FEM_Matrix::ApplyRobinBC_mult(std::vector<double> &f, const double u_out)
|
||||
{
|
||||
auto const RobinEdges = _mesh.OuterEdges;
|
||||
auto const RobinEdgesSubdomains = _mesh.OuterEdgesSubdomains;
|
||||
|
||||
for (int i = 0; i < RobinEdges.size(); ++i)
|
||||
auto const BoundaryEdges = _mesh.BoundaryEdges();
|
||||
auto const BoundaryEdgeNodes = _mesh.BoundaryEdgeNodes();
|
||||
|
||||
assert (BoundaryEdgeNodes.size() == 2* BoundaryEdges.size());
|
||||
|
||||
vector<double> Coordinates = _mesh.GetCoords();
|
||||
|
||||
for (size_t i = 0; i < RobinEdges.size(); ++i)
|
||||
{
|
||||
cout << "Edge number " << RobinEdges[i] << ", subdomain: " << RobinEdgesSubdomains[i] << endl;
|
||||
//cout << "Edge number " << RobinEdges[i] << ", subdomain: " << RobinEdgesSubdomains[i] << " " << endl;
|
||||
double alpha = Heat_transfer_coefficient(RobinEdgesSubdomains[i]);
|
||||
|
||||
}
|
||||
|
||||
int const EdgeNode1 = BoundaryEdgeNodes[2*i];
|
||||
int const EdgeNode2 = BoundaryEdgeNodes[2*i + 1];
|
||||
|
||||
double x_1 = Coordinates[EdgeNode1];
|
||||
double y_1 = Coordinates[EdgeNode1 + 1];
|
||||
double x_2 = Coordinates[EdgeNode2];
|
||||
double y_2 = Coordinates[EdgeNode2 + 1];
|
||||
double EdgeLength = sqrt((x_2 - x_1)*(x_2 - x_1) + (y_2 - y_1)*(y_2 - y_1));
|
||||
|
||||
|
||||
|
||||
int ii = _id[EdgeNode1];
|
||||
int jj = _id[EdgeNode2];
|
||||
int ij = fetch(_ik[_id[EdgeNode1]], EdgeNode1);
|
||||
int ji = fetch(_ik[_id[EdgeNode2]], EdgeNode2);
|
||||
|
||||
_sk[ii] += EdgeLength*alpha/3;
|
||||
_sk[jj] += EdgeLength*alpha/3;
|
||||
_sk[ij] += EdgeLength*alpha/6;
|
||||
_sk[ji] += EdgeLength*alpha/6;
|
||||
|
||||
|
||||
f[ii] += EdgeLength*alpha*u_out/2;
|
||||
f[jj] += EdgeLength*alpha*u_out/2;
|
||||
|
||||
|
||||
// Jakob Todo
|
||||
auto const idx = _mesh.Index_DirichletNodes(); // ALL boundary nodes
|
||||
|
||||
const vector<int> sd_vec = _mesh.ElementSubdomains;
|
||||
|
||||
|
||||
for (int i = 0; i < idx.size(); ++i) {
|
||||
int const row = idx[i];
|
||||
int subdomain = sd_vec[row];
|
||||
// cout << "row: " << row;
|
||||
// cout << ", subdomain: " << subdomain << endl;
|
||||
double alpha = Heat_transfer_coefficient(subdomain);
|
||||
|
||||
|
||||
|
||||
f[row] += u_out*alpha/2;
|
||||
|
||||
|
||||
for (int ij = _id[row]; ij < _id[row + 1]; ++ij)
|
||||
{
|
||||
int const col = _ik[ij];
|
||||
if(col == row)
|
||||
{
|
||||
_sk[ij] += alpha/3;
|
||||
}
|
||||
else
|
||||
{
|
||||
int const id1 = fetch(col, row); // Find entry (col,row)
|
||||
assert(id1 >= 0);
|
||||
_sk[id1] += alpha/6;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -681,7 +672,7 @@ double FEM_Matrix::Heat_transfer_coefficient(const int subdomain)
|
|||
{
|
||||
// outside
|
||||
case 0:
|
||||
alpha = 1.0;
|
||||
alpha = 10.0;
|
||||
break;
|
||||
|
||||
// ceramic
|
||||
|
|
@ -691,12 +682,12 @@ double FEM_Matrix::Heat_transfer_coefficient(const int subdomain)
|
|||
|
||||
// water
|
||||
case 2:
|
||||
alpha = 1.0;
|
||||
alpha = 500.0;
|
||||
break;
|
||||
|
||||
// air
|
||||
case 3:
|
||||
alpha = 1.0;
|
||||
alpha = 10.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue