I want to use FreeFEM to implement 99 lines of code in topology optimization design.
Code Reference： An 89-line code for geometrically nonlinear topology optimization written in FreeFEM | SpringerLink
When extracting the stiffness matrix, it prompts the following errors.
It seems that my vElasticity is not defined before. But I did define it. I don’t know why.
Here’s my code
Macros need to end with
// symbols, e.g.,
macro Epsilon(ux, uy) [dx(ux), dy(uy), (dy(ux)+dx(uy))/sqrt2] //
macro Divergence(ux, uy) (dx(ux) + dy(uy)) //
is the proper way to define the macros.
Thank you very much. That is right.
I have another question.I want to get [ux, uy] * [ux, uy] '.
So I entered the following code, but it didn’t seem to work.
sens = [ux,uy]*[ux,uy]';
Can you help me find out what the problem is？
Could you please share your code?
The correct way to calculate it is the following:
auxVec = k*ux;
real com = auxVec'*ux;
cout << "com=" << com << endl;
[ux,uy] is a vectorial finite element function, while
ux is a vector that contains all the values at the gridpoints of
[ux,uy]. Consult the documentation for more details.
I’m sorry to bother you again.
I have the following code. I print ux uy, they are the same. I think they both represent all the values at the gridpoints of [ux,uy].As you said above.
But if I modify the code as follows:
The printed ux and uy seem different.
What is the difference between the two?
What do you mean by printing?
If you write
uy is a vector containing all the function values at the grid points for a
[P1,P1]. If you do
uy is each a vector of values of a
P1 FE space.
Oh, I see,thank you very much.