Use Gmsh to import external grid calculation elasticity problem

154 views
Skip to first unread message

Nick Wang

unread,
Nov 3, 2020, 9:33:56 PM11/3/20
to deal.II User Group
Hello all, 

After I studied and understood the tutorials of step-8 and step-49.  I tried to use  step-49 to import external grids to to calculate the force condition and stress analysis,
So I modified the statement of step8 grid generation,
while failed...
Did I make a mistake or  are there other ways to finish the force analysis from external grids?
Attach my code...

Thanks!
step-8.cc

Wolfgang Bangerth

unread,
Nov 3, 2020, 10:09:17 PM11/3/20
to dea...@googlegroups.com
Help us understand what the error message is that you get. You already have it
on your screen, but we would need to download your program, put it somewhere,
compile it, maybe run it. It would take someone a couple of minutes to do that
-- time we wouldn't have for answering someone else's problems.

Best
WB

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

Nick Wang

unread,
Nov 4, 2020, 9:40:57 PM11/4/20
to deal.II User Group
Okay, I re-run the program I wrote
vs told me that ,what that mean?

2>step-8.obj: error LNK2019: Unresolved external symbol "public: void __cdecl Step8::ElasticProblem<2>::run(void)" (?run@?$ElasticProblem@$01@Step8@@QEAAXXZ)  , The symbol is quoted in the function main 2>D:\dealii-9.2.0\dealii-9.2.0\examples\step-8a\Debug\step-8.exe: fatal error LNK1120: 1 unresolved external command

Bruno Turcksin

unread,
Nov 5, 2020, 5:14:01 PM11/5/20
to deal.II User Group
Hi,

The function print_mesh_info() ends at line 269. It should end at line 107.

Best,

Bruno

Nick Wang

unread,
Nov 6, 2020, 3:04:03 AM11/6/20
to deal.II User Group
Thanks, Bruno
I try to end the fuction  print_mesh_info() at line 107 and re-run the step again, while it still errors that i can't understand.

2>step-8.obj: error LNK2019: Unresolved external symbol "private: void __cdecl Step8::ElasticProblem<2>::print_mesh_info(void)" (?print_mesh_info@?$ElasticProblem@$01@Step8@@AEAAXXZ)  , The symbol is referenced in the function "public: void __cdecl Step8::ElasticProblem<2>::run(void)" (?run@?$ElasticProblem@$01@Step8@@QEAAXXZ) 2>D:\dealii-9.2.  0\dealii-9.2.0\examples\step-8d\Debug\step-8.exe: fatal error LNK1120: 1 unresolved external command

Nick 

Bruno Turcksin

unread,
Nov 6, 2020, 9:44:25 AM11/6/20
to dea...@googlegroups.com
Nick,

You didn't declare print_mesh_info and you need to replace

template <int dim>
void print_mesh_info(const Triangulation<dim>& triangulation, const
std::string& filename) {...}

by
template <int dim>
void ElasticProblem<dim>::print_mesh_info(const Triangulation<dim>&
triangulation, const std::string& filename) {...}

You have the same two problems with grid_1(). These are C++ problems
not deal.II, so I would advise you to read a few tutorials/books on
C++. I cannot debug your entire code for you.

Best,

Bruno
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/iVyeXuUkCXk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/cb8bba7f-190f-45a5-8522-066638740ab6n%40googlegroups.com.

Nick Wang

unread,
Nov 7, 2020, 4:58:26 AM11/7/20
to deal.II User Group
Thanks, Bruno, I solve this problem with your help!
I think I need to learn some more C++ ,

Best wishes,

Nick

Nick Wang

unread,
Nov 7, 2020, 6:16:46 AM11/7/20
to deal.II User Group
I have another question to ask, whether point load can be applied in deal.ii, according to the steps I have learned, I can only apply range load temporarily

Best,

Nick

Wolfgang Bangerth

unread,
Nov 8, 2020, 8:27:35 PM11/8/20
to dea...@googlegroups.com
On 11/7/20 4:16 AM, Nick Wang wrote:
> I have another question to ask, whether point load can be applied in deal.ii,
> according to the steps I have learned, I can only apply range load temporarily

You can use the function VectorTools::create_point_source_vector()
https://www.dealii.org/7.3.0/doxygen/deal.II/namespaceVectorTools.html#ad03b858b1a3b59003a76f6224e67efc7
You might also want to look into the implementation of the function if you
need to implement a slightly different situation.

Best
W.

Nick Wang

unread,
Nov 9, 2020, 3:12:07 AM11/9/20
to deal.II User Group
Thanks, Wolfgang, I would like to try it later.

If I want to modify the constitutive equation based on step-8, but I can't understand the expression you described in step8, like this.



Which aspect of knowledge should I learn if I want to modify the constitutive equation.
Or can I export the .inp file in Abaqus modeling and directly calculate it in Deal.ii? Does Deal.ii support such operations?

Thanks,

Best wishes,

Nick

Nick Wang

unread,
Nov 9, 2020, 3:15:31 AM11/9/20
to deal.II User Group
Snipaste_1.png

Wolfgang Bangerth

unread,
Nov 9, 2020, 7:32:16 PM11/9/20
to dea...@googlegroups.com

Nick,

> If I want to modify the constitutive equation based on step-8, but I can't
> understand the expression you described in step8, like this.
>
> [...]
>
> Which aspect of knowledge should I learn if I want to modify the constitutive
> equation.

This is a question that goes beyond what we can provide here. You are in
essence saying that you don't know how to read a partial differential
equation. I would suggest you take a course on PDEs (or read a book on the
theory of partial differential equations) or at least a course on mechanics
that covers how these equations are derived and what they mean.

If your goal is modeling of materials, there are many books on solid mechanics.


> Or can I export the .inp file in Abaqus modeling and directly calculate it in
> Deal.ii? Does Deal.ii support such operations?

It's not that easy, but it's also not going to be useful to you: If you don't
understand how constitutive equations are posed and what the different pieces
mean, how do you expect to find out whether something is correct or not *even
if you could magically import them into deal.II*? Doing "something" with a
code (whether that is ABAQUS or deal.II) doesn't mean that what you get is
correct or useful -- being able to tell whether something is correct or useful
requires understanding, which requires sufficient theoretical background.

Nick Wang

unread,
Nov 9, 2020, 10:11:09 PM11/9/20
to deal.II User Group
Thanks, Wolfgang, I think reading some PDE knowledge materials would help me to solve the constitutive equation problems.

I try to read the create_point_source_vector()  class in deal.ii 

But I am still confused as to how I should add some load? Attach my code.

template <int dim>
void create_point_source_vector(const std::vector<Point<dim>>& points,
std::vector<Tensor<1, dim>>& values)
{
Point<dim> point_1;
point_1(0) = 0.5;
point_1(1) = 0.3;

values[point_1][1] = -10.0;

}

It seems to be useless...

Wolfgang Bangerth

unread,
Nov 9, 2020, 11:49:46 PM11/9/20
to dea...@googlegroups.com
On 11/9/20 8:11 PM, Nick Wang wrote:
>
> But I am still confused as to how I should add some load? Attach my code.
>
> template <int dim>
> void create_point_source_vector(const std::vector<Point<dim>>& points,
> std::vector<Tensor<1, dim>>& values)
> {
> Point<dim> point_1;
> point_1(0) = 0.5;
> point_1(1) = 0.3;
>
> values[point_1][1] = -10.0;
>
> }


Nick -- it's not clear to me what precisely you want to do here. You set the
coordinates of one point, and then you try to set an element of a vector
(though you will get a compiler error because the point_1 can't be the index
into values[...]). Can you write out in mathematical or otherwise concise
terms what you are trying to do?

Nick Wang

unread,
Nov 10, 2020, 2:11:29 AM11/10/20
to deal.II User Group
Uh, what I want to do is to use deal.ii to simulate our own model, 
Before using deal.ii , I used some numerical simulation software like abaqus.
However, it will be very difficult to use abaqus to simulate seepage flow and multiphase coupling.
I tried to use deal to build a simple model to deepen my understanding of this software.
So on the basis of step-8, I imported an external mesh model,
On this basic elastic equation, I tried to add some loads to analyze the deformation characteristics of this model like abaqus
Then further modify the constitutive equation, like an elastoplastic problem...
So I am trying to add a point load(parallel load) anywhere on the model first but I don't know how to achieve it.

Thanks,

Nick

Wolfgang Bangerth

unread,
Nov 10, 2020, 2:22:56 PM11/10/20
to dea...@googlegroups.com
On 11/10/20 12:11 AM, Nick Wang wrote:
> Uh, what I want to do is to use deal.ii to simulate our own model,
> Before using deal.ii , I used some numerical simulation software like abaqus.
> However, it will be very difficult to use abaqus to simulate seepage flow
> and multiphase coupling.
> I tried to use deal to build a simple model to deepen my understanding of this
> software.
> So on the basis of step-8, I imported an external mesh model,
> On this basic elastic equation, I tried to add some loads to analyze the
> deformation characteristics of this model like abaqus
> Then further modify the constitutive equation, like an elastoplastic problem...
> So I am trying to add a point load(parallel load) anywhere on the model first
> but I don't know how to achieve it.

Nick,
so let's say you want to add a point load at a point x0 in direction d. That
corresponds to a vector force
\vec f(x) = \vec d * delta(x-x0)
What you then need to compute the right hand side vector for your finite
element scheme is to compute
F_i = \int_\Omega \vec phi_i(x) \cdot \vec f(x)
= \vec d \cdot \vec \phi_i(x)

You'd implement something like this in the same way as the
VectorTools::compute_point_source_vector() does for the scalar case. The
implementation of that case can be found here:

https://github.com/dealii/dealii/blob/master/include/deal.II/numerics/vector_tools_point_value.templates.h#L276-L309

Nick Wang

unread,
Nov 10, 2020, 10:53:31 PM11/10/20
to deal.II User Group
I probably understand that I need to add a vector force to change my right hand matrix
But I am not very good at modifying this part of the content through code of Deal.ii 
How can mathematical knowledge be transformed into deal.ii code?
So do I need to replace the original right-hand matrix on the basis of step8?
Or is it enough to directly define a new point load vector?
 Can you give me an example on the basis of step8 for a better understanding?

Thanks, 

Best wishes!

Nick

Wolfgang Bangerth

unread,
Nov 11, 2020, 11:47:55 AM11/11/20
to dea...@googlegroups.com
On 11/10/20 8:53 PM, Nick Wang wrote:
> I probably understand that I need to add a vector force to change my right
> hand matrix
> But I am not very good at modifying this part of the content through code of
> Deal.ii
> How can mathematical knowledge be transformed into deal.ii code?
> So do I need to replace the original right-hand matrix on the basis of step8?

Correct. If you want a point load, you need to replace the right hand side
used there by code similar to the one I pointed out.

Best
WB

Nick Wang

unread,
Nov 13, 2020, 4:03:12 AM11/13/20
to deal.II User Group
Thanks, Wolfgang,
 I replaced the previous right-hand matrix with a point vector
But when I Debug my file,  It reminds me that

1>D:\dealii-9.2.0\dealii-9.2.0\examples\step-8p1\step-8.cc(188,4): error C2672: “create_point_source_vector”: no matching overloaded function found

 So do I have to modify the code of this part of the assembly system?  How to modify this part?

Attach part of the code.

for (const auto &cell : dof_handler.active_cell_iterators())
{
cell_matrix = 0;
cell_rhs = 0;
fe_values.reinit(cell);
lambda.value_list(fe_values.get_quadrature_points(), lambda_values);
mu.value_list(fe_values.get_quadrature_points(), mu_values);
create_point_source_vector(fe_values.get_quadrature_points(), rhs_values);

Best,

Nick

Wolfgang Bangerth

unread,
Nov 13, 2020, 11:16:04 AM11/13/20
to dea...@googlegroups.com
On 11/13/20 2:03 AM, Nick Wang wrote:
>  I replaced the previous right-hand matrix with a point vector
> But when I Debug my file,  It reminds me that
>
> *1>D:\dealii-9.2.0\dealii-9.2.0\examples\step-8p1\step-8.cc(188,4): error
> C2672: “create_point_source_vector”: no matching overloaded function found*
> *
> *
>  So do I have to modify the code of this part of the assembly system?  How to
> modify this part?

Nick:
I think all of us here would like to help you more, but you seem to have too
little background in both PDEs and programming. What the compiler is telling
you is actually quite self-descriptive: You try to call a function with a
given argument list, but no such function exists.

You will find yourself endlessly frustrated if you have to ask on a mailing
list every time you encounter an error like this. You need to build up a
better background in programming (and in the concepts that underlie the finite
element method) if you want to be productive with deal.II.

Jean-Paul Pelteret

unread,
Nov 13, 2020, 3:15:51 PM11/13/20
to dea...@googlegroups.com, Wolfgang Bangerth
Hi Nick,

Here's where the documentation for create_source_vector() is
https://dealii.org/current/doxygen/deal.II/namespaceVectorTools.html#ac4e531baa71a5183079fd2083aa7d723
<https://dealii.org/current/doxygen/deal.II/namespaceVectorTools.html#ac4e531baa71a5183079fd2083aa7d723>
. What this function does, and what arguments it takes are described in
quite a lot of detail.

Adding to what Wolfgang already said, remember that there's extensive
documentation for most functions, so that should always be the first
place that you turn to when you run into troubles like this. With both
the online and offline documentation there is a basic search utility, as
well as a categorisations that should help navigate the documentation.
It might be a little bit overwhelming at first (because there is so much
of it), but its worth the effort to learn how to find functions,
classes, etc. in the documentation. You might also benefit from watching
some of the many lectures on programming, PDEs, and related topics that
Wolfgang has shared with us all. You can find those here:
https://www.math.colostate.edu/~bangerth/videos.html
<https://www.math.colostate.edu/~bangerth/videos.html>

Best,
Jean-Paul
Reply all
Reply to author
Forward
0 new messages