Skip to content

Commit

Permalink
Cleaned up the function handling
Browse files Browse the repository at this point in the history
  • Loading branch information
larsson4 committed Mar 1, 2024
1 parent 5571bbe commit 60684e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
33 changes: 4 additions & 29 deletions src/linelast_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,8 @@ void LinElastSolver::SetupRHSBCOperators()
}
else if (bdr_type[type_idx[b]] == LinElastProblem::BoundaryType::NEUMANN)
{
//bs[m]->AddBdrFaceIntegrator(new VectorBoundaryLFIntegrator(*bdr_coeffs[b]));//, *bdr_markers[b]);
bs[m]->AddBdrFaceIntegrator(new VectorBoundaryLFIntegrator(*bdr_coeffs[b]), *bdr_markers[b]);

f = new VectorArrayCoefficient(dim);
for (int i = 0; i < dim-1; i++)
{
f->Set(i, new ConstantCoefficient(0.0));
}

Vector pull_force(global_bdr_attributes.Size());
pull_force = 0.0;
pull_force(1) = -1.0e-2;
f->Set(dim-1, new PWConstCoefficient(pull_force));
bs[m]->AddBdrFaceIntegrator(new VectorBoundaryLFIntegrator(*f));
}
}
}
Expand Down Expand Up @@ -428,8 +417,6 @@ void LinElastSolver::AddBCFunction(std::function<void(const Vector &, Vector &)>
mfem_warning(msg.c_str());
return;
}
cout<<"battr is: "<<battr<<endl;
cout<<"idx is: "<<idx<<endl;
bdr_coeffs[idx] = new VectorFunctionCoefficient(dim, F);
}
else
Expand Down Expand Up @@ -497,22 +484,10 @@ void LinElastSolver::SetParameterizedProblem(ParameterizedProblem *problem)
int ti = global_bdr_attributes.Find(problem->battr[b]);
type_idx[ti] = b;

if(problem->bdr_type[b] == LinElastProblem::BoundaryType::DIRICHLET )
{
cout<<"hej"<<endl;
cout<<"problem->battr[b] is: "<<problem->battr[b]<<endl;
assert(problem->vector_bdr_ptr[b]);
if(problem->bdr_type[b] == LinElastProblem::BoundaryType::DIRICHLET || problem->bdr_type[b] == LinElastProblem::BoundaryType::NEUMANN)
{ assert(problem->vector_bdr_ptr[b]);
AddBCFunction(*(problem->vector_bdr_ptr[b]), problem->battr[b]);
}
else if (problem->bdr_type[b] == LinElastProblem::BoundaryType::NEUMANN)
{
cout<<"hej2"<<endl;
cout<<"problem->battr[b] is: "<<problem->battr[b]<<endl;
assert(problem->vector_bdr_ptr[b]);
AddBCFunction(*(problem->vector_bdr_ptr[b]), problem->battr[b]);
}


}
}

// Set RHS
Expand Down
3 changes: 1 addition & 2 deletions src/parameterized_problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ double rforce_f;
void tip_force(const Vector &x, Vector &f)
{
f = 0.0;
//f(f.Size()-1) = -1.0e-2;// * rforce_f;
f(f.Size()-2) = 1.0e-2;// * rforce_f;
f(f.Size()-1) = -1.0e-2* rforce_f;
}

} // namespace linelast_force
Expand Down

0 comments on commit 60684e0

Please sign in to comment.