getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [EXT] Re: Computing the linear elastic strain energy


From: Lesage,Anne Cecile J
Subject: RE: [EXT] Re: Computing the linear elastic strain energy
Date: Thu, 27 Jan 2022 22:00:33 +0000

Dear Konsta

 

I wrote the following lines

 

print('mfpf dofs',mfpb.nbdof(),'mfoutb dofs',mfoutb.nbdof())

mass_mat = gf.asm_mass_matrix(mimp3b, mfpb)

 

 

for step in range(steps):

   nit, conv = md.solve('noisy', 'max_iter', 25, 'max_res', 1e-10, 'lsolver', 'mumps',

                        'lsearch', 'simplest', 'alpha max ratio', 100, 'alpha min', 0.2, 'alpha mult', 0.6,

                        'alpha threshold res', 1e9)

   time_elapsed(timer)

   it = step+1

   SNRJ = gf.asm_generic(mimp3b, 1, "(Gb*Grad(ub):Grad(ub)+Gb/(1-2*nub)*Div(ub)*Div(ub))*Test_t", -1, md,

                                     "t", True, mfpb, np.zeros(mfpb.nbdof()))

   SNRJ = np.transpose(gf.linsolve_mumps(mass_mat, SNRJ))

 

But I get a size error as follows on the transpose line

 

 

<pre>mfpf dofs 54026 mfoutb dofs 54026

Time elapsed: 9.0 minutes and 40.03 seconds

Traceback (most recent call last):

  File &quot;/work/testr25pebrainbsftslhomnrj.py&quot;, line 271, in &lt;module&gt;

    SNRJ = np.transpose(gf.linsolve_mumps(mass_mat, SNRJ))

  File &quot;/venv/lib/python3.8/site-packages/getfem/getfem.py&quot;, line 6447, in linsolve_mumps

    return getfem(&apos;linsolve&apos;, &apos;mumps&apos;, M, b)

RuntimeError: (Getfem::InterfaceError) -- Argument 3 has wrong dimensions: expected 54026, found 1339902</pre>

 

Thank you

AC

 

From: Konstantinos Poulios <logari81@googlemail.com>
Sent: Wednesday, January 26, 2022 2:24 AM
To: Lesage,Anne Cecile J <AJLesage@mdanderson.org>
Cc: getfem-users@nongnu.org
Subject: Re: [EXT] Re: Computing the linear elastic strain energy

 

WARNING: This email originated from outside of MD Anderson. Please validate the sender's email address before clicking on links or attachments as they may not be safe.

 

Dear Anne-Cecile,

 

Ok, I see. I would not do node-averaging, like most commercial (and not only) software do, for exporting smooth scalar fields (von Mises, strain energy, etc.). Instead, my favorite approach is the one that you can find in

for exporting the plastic strain field GAMMA.

 

What you need for this method is:

 

1) Before starting your simulation you calculate and store a mass matrix for the scalar mesh_fem that you want to get the nodal values for

mass_mat = gf.asm_mass_matrix(mim, mfout)

mfout has to be a scalar fem (1 dof per node).

 

2) After (each step of) your simulation, you assemble the quantity that you want to export, in this case strain energy with something like

      STRAIN_ENERGY = gf.asm_generic(mim, 1, "(Gb*Grad(ub):Grad(ub)+Gb/(1-2*nub)*Div(ub)*Div(ub))*Test_t", -1, md,
                                     "t", True, mfout, np.zeros(mfout.nbdof()))

(check the correctness of the strain energy _expression_ that I took from some code you sent earlier)

 

3) Recover nodal values with

      STRAIN_ENERGY = np.transpose(gf.linsolve_mumps(mass_mat, STRAIN_ENERGY))

Then the vector STRAIN_ENERGY has the nodal values of the strain energy on all dofs of mfout. If you calculate this vector for several simulations or simulation steps, you can copy the result into different columns of a big matrix as in the paper you are referring to.

 

Hope it helps.

 

BR

Kostas

 

On Tue, Jan 25, 2022 at 8:50 PM Lesage,Anne Cecile J <AJLesage@mdanderson.org> wrote:

Dear Konstantinos

 

The problem with patient specific surgery modeling is that we ignore a lot of the surgery scenario

One way to model it with FEM is to precompute an atlas of organ deformation with a variety of surgery scenario parameter (here direction of gravity, loss of brain buoyancy by csf drainage, shrinkage due to drug,

swelling due to edema, tumor resection, etc …) That is about 1000 simulations

 

Then the idea is to match intraoperative data, the surgeons measure a ground truth displacement on a few brain surface points

The idea is to minimize function equation 7 in attached pdf:

the first term is the least square between the ground truth displacement and the simulated one see equation

the second term use the elastic strain energy on fem points pondered by the distance to the ground truth measurement points

Finally we want to get the optimal alpha pondering vector to match the surgery measurement

 

Ideally I would like my python script to output after poroelastic simulation converge

The simulated displacements on the few measurement points (15)

The pondered energy term

So that I can assemble the function to minimize for the whole atlas

 

Thank you

Regards

Anne-Cecile

 

 

From: Konstantinos Poulios <logari81@googlemail.com>
Sent: Tuesday, January 25, 2022 2:40 AM
To: Lesage,Anne Cecile J <AJLesage@mdanderson.org>
Cc: getfem-users@nongnu.org
Subject: [EXT] Re: Computing the linear elastic strain energy

 

WARNING: This email originated from outside of MD Anderson. Please validate the sender's email address before clicking on links or attachments as they may not be safe.

 

Dear Anne-Cecile

 

The elastic strain energy density (is a scalar) at each node is easy to calculate. However, I have to ask you what you need this quantity for. Your reference suggests calculating this quantity on nodes which is probably not the best solution. If you calculate the strain energy density at a node between different elements, you get different results depending on which element you are evaluating the common node from. Then some averaging is required to get a value somewhere between all neighboring elements. Normally we evaluate strain energy densities at integration points. If you tell us what you need this result for I can maybe help with a better solution.

 

Best regards

K.

 

On Mon, Jan 24, 2022 at 9:09 PM Lesage,Anne Cecile J <AJLesage@mdanderson.org> wrote:

Dear all

 

I need to output tat the end of my poroelastic simulation the linear elastic strain energy matrix at each node of my mesh

See attached formula

What is an optimal way to compute it from the displacement u?

Epsilon i = 0.5 (grad u + grad ut) right?

And S here is the stress-strain law for isotropic materials?

 

Thank you

Anne-Cecile

The information contained in this e-mail message may be privileged, confidential, and/or protected from disclosure. This e-mail message may contain protected health information (PHI); dissemination of PHI should comply with applicable federal and state laws. If you are not the intended recipient, or an authorized representative of the intended recipient, any further review, disclosure, use, dissemination, distribution, or copying of this message or any attachment (or the information contained therein) is strictly prohibited. If you think that you have received this e-mail message in error, please notify the sender by return e-mail and delete all references to it and its contents from your systems.

The information contained in this e-mail message may be privileged, confidential, and/or protected from disclosure. This e-mail message may contain protected health information (PHI); dissemination of PHI should comply with applicable federal and state laws. If you are not the intended recipient, or an authorized representative of the intended recipient, any further review, disclosure, use, dissemination, distribution, or copying of this message or any attachment (or the information contained therein) is strictly prohibited. If you think that you have received this e-mail message in error, please notify the sender by return e-mail and delete all references to it and its contents from your systems.

The information contained in this e-mail message may be privileged, confidential, and/or protected from disclosure. This e-mail message may contain protected health information (PHI); dissemination of PHI should comply with applicable federal and state laws. If you are not the intended recipient, or an authorized representative of the intended recipient, any further review, disclosure, use, dissemination, distribution, or copying of this message or any attachment (or the information contained therein) is strictly prohibited. If you think that you have received this e-mail message in error, please notify the sender by return e-mail and delete all references to it and its contents from your systems.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]