Component mask

85 views
Skip to first unread message

Mohammad Amir Kiani Fordoei

unread,
Jul 4, 2023, 11:28:41 AM7/4/23
to deal.II User Group
Dear deal.ii developers,
I want to model time-dependent small elastic deformations (step-18).
Inputs (like triangulation, B.C., etc.) are handled by ParameterHandler and prm file.
In applying multiple Dirichlet B.C. by looping over "VectorTools::interpolate_boundary_values" for a 3D problem, I will apply a displacement vector <dim> with two scenarios:
1) displacement {1,0,2} applies on direction 1 to  3 for boundary id=10;
2)displacement {1,0,2} applies only on direction 1 and 3 for boundary id=20;
As mentioned in documentation, I tried to make component mask for each scenario by hand.
So, I defined two extra vector <bool> which indicate presence or absence (being free dof) of displacement vector as below 
a) [true,true,true]
b) [true, false,true]
But, I couldn't use them as input in interpolate_boundary_values (error: no matching function for call to ‘interpolate_boundary_values
Also, I couldn't find a matching function FEValuesExtractors::Vector for these cases.
Thanks in advance
Amir

Wolfgang Bangerth

unread,
Jul 5, 2023, 11:53:27 AM7/5/23
to dea...@googlegroups.com
On 7/4/23 09:28, Mohammad Amir Kiani Fordoei wrote:
> So, I defined two extra vector <bool> which indicate presence or absence
> (being free dof) of displacement vector as below
> a) [true,true,true]
> b) [true, false,true]
> But, I couldn't use them as input in interpolate_boundary_values (error: no
> matching function for call to ‘interpolate_boundary_values)
> Also, I couldn't find a matching function FEValuesExtractors::Vector for these
> cases.

Amir,
can you show us the code and what the complete error message is?

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Mohammad Amir Kiani Fordoei

unread,
Jul 6, 2023, 6:45:38 AM7/6/23
to deal.II User Group
Dear Wolfgang

The error is:

/home/amir/eclipse-workspace/mech1/mech.cc:894:45: error: no matching function for call to ‘interpolate_boundary_values(dealii::DoFHandler<3, 3>&, unsigned int&, Step18::IncrementalBoundaryValues<3>, dealii::ComponentMask)’

894 | VectorTools::interpolate_boundary_values(

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

895 | dof_handler

| ~~~~~~~~~~~

896 | , boundary_id_tag

| ~~~~~~~~~~~~~~~~~

897 | , IncrementalBoundaryValues <dim>(present_time, present_timestep,Vector_of_BC_Value)

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

898 | , fe.component_mask(Vector_of_BC_status) );


That part of code:


prm.enter_subsection("Geometry_info");

unsigned int Number_of_BC=prm.get_integer("Number_of_boundary_id");

prm.leave_subsection();


prm.enter_subsection("Boundary_condition_info");


std::string temp_BC_value_info =prm.get("Assign_boundary_value_info");//getting BC value

std::vector<std::string> vetor_of_BC_value_info= Utilities::split_string_list (temp_BC_value_info, ' ');//splitting BC values to vector


std::string temp_BC_status_info =prm.get("Assign_status_of_component_info");//getting status of BC value

std::vector<std::string> BC_comp_status_info= Utilities::split_string_list (temp_BC_status_info, ' ');//splitting status of BC value


unsigned int Number_of_dof_for_each_BC_value_components =prm.get_integer("Number_of_boundary_dof");

unsigned int Length_of_BC_value_and_component=Number_of_dof_for_each_BC_value_components+1;// length of information for BC (value or component status)

prm.leave_subsection();


for (unsigned int i=0;i<Number_of_BC;i++)//loop over all boundary ids

{

unsigned int boundary_id_tag = std::stoi(vetor_of_BC_value_info [Length_of_BC_value_and_component*i]);//getting tag of BC

std::vector<double> Vector_of_BC_Value;

std::vector<bool> Vector_of_BC_status;


for (unsigned int j=1;j<Length_of_BC_value_and_component;j++)//loop over dof of BC

{

double boundary_id_value= std::stod(vetor_of_BC_value_info [Length_of_BC_value_and_component*i+j]);

Vector_of_BC_Value.push_back(boundary_id_value);//assigning value of each component

bool boundary_id_comp_status=false;

if (BC_comp_status_info [Length_of_BC_value_and_component*i+j]=="true")

{

boundary_id_comp_status=true;

}

else

{

boundary_id_comp_status=false;

}

Vector_of_BC_status.push_back(boundary_id_comp_status);

}


VectorTools::interpolate_boundary_values(

dof_handler

, boundary_id_tag

, IncrementalBoundaryValues <dim>(present_time, present_timestep,Vector_of_BC_Value)

, fe.component_mask(Vector_of_BC_status) );

//, Vector_of_BC_status );


temp_BC_status_info.clear();

temp_BC_value_info.clear();

Vector_of_BC_status.clear();

Vector_of_BC_Value.clear();

}


I also added my doe and its prm

I really appreciate your kindness.
mech.cc
step-18.prm

Mohammad Amir Kiani Fordoei

unread,
Jul 6, 2023, 7:57:33 AM7/6/23
to deal.II User Group
I think I find the problem. I didn't specify map of boundary_values.
I still worried about correctness of my method.

Wolfgang Bangerth

unread,
Jul 6, 2023, 5:35:25 PM7/6/23
to dea...@googlegroups.com
On 7/6/23 05:57, Mohammad Amir Kiani Fordoei wrote:
> I think I find the problem. I didn't specify map of boundary_values.

Then you have already found what the problem is. The compiler tells you in the
error message that you are trying to call the function with the following
argument list:

interpolate_boundary_values(dealii::DoFHandler<3, 3>&,
unsigned int&,
Step18::IncrementalBoundaryValues<3>,
dealii::ComponentMask)’

That is because no such function exists. The function I suspect you *want* to
call is

interpolate_boundary_values(
const DoFHandler<dim, spacedim> & dof,
const types::boundary_id boundary_indicator,
const Function<spacedim, number> & boundary_function,
std::map<types::global_dof_index, number> &boundary_values,
const ComponentMask &component_mask = ComponentMask());

which has the 'boundary_values' argument in position 4.

As a general rule for how you could have spotted the mistake: You are calling
a non-member-function with only *input* arguments. Since it's not a member
function, it cannot modify the object it is a part of (it is not part of any
object). Because it only has input arguments, that would mean that it isn't
actually computing anything -- because none of its arguments is an output
argument to put anything in. So something is conceptually not right with the call.


> I still worried about correctness of my method.

Well, have you tried what happens?

Mohammad Amir Kiani Fordoei

unread,
Jul 8, 2023, 1:47:48 AM7/8/23
to deal.II User Group
Dear Wolfgang
Thanks for your answer
Finally, I succeed in replicating step-18 example.
Everything looks fine.
I really appreciate you and your colleagues on providing such rich and accurate FEM library.
I will continue my study by adding boundary traction force, plasticity, etc, to reach a fully coupled THM model.
Maybe one day I will be honored to be a useful member of deal.II community.

Best regards
Amir

Reply all
Reply to author
Forward
0 new messages