Page 1 of 2

velocity of nodes in the linear elasticity

Posted: 19 Oct 2009, 11:28
by studdrud
Hello elmer-team,

i'am using the strucure-tool of elmer: the linear easticity. I'am computing some examples in transient simulation. My question now is: how can i get the current velocity of nodes at a time step?
I've tried this one:
Solver 1
Equation = Linear elasticity
Procedure = "StressSolve" "StressSolver"
Variable = -dofs 3 Displacement
Exported Variable 1 = -dofs 3 Velocity
...
but it didn't work. In the result file, the velocity is zero:
velocity 1
Perm: use previous
0.0000000000000000
0.0000000000000000
0.0000000000000000
0.0000000000000000
0.0000000000000000
0.0000000000000000
0.0000000000000000
...

regards rn

Re: velocity of nodes in the linear elasticity

Posted: 20 Oct 2009, 13:34
by raback
Unfortunately velocity (and acceleration) are (to my knowledge) only internal fields. You might do it quite easily with a few lines of Fortran somewhere in StressSolve:

Code: Select all

  CALL VariableAdd( Solver % Mesh % Variables, Solver % Mesh, Solver, &
           'Displacement Velo', DIM, StressSol % PrevValues(:,1), StressSol % Perm)
This associates the existing vector i.e. the 1st PrevValues vector to a mesh and name, and makes it thereby ready for saving. For 2nd order PDEs the 2nd component is accelaration.

This functionality might be built in an a generic level. I hope it works, didn't test it...

-Peter

Re: velocity of nodes in the linear elasticity

Posted: 20 Oct 2009, 15:13
by studdrud
Thanks for the reply,
i've tried the solution you proposed and i get this, when i typed make in the terminal in /elmerfem/trunk/fem/src:
...
make[2]: Leaving directory `/home/rudolf/elmerfem/trunk/fem/src/binio'
make[1]: Leaving directory `/home/rudolf/elmerfem/trunk/fem/src/binio'
make[1]: Entering directory `/home/rudolf/elmerfem/trunk/fem/src'
gfortran -O -m64 -fPIC -fPIC -I. -Ibinio -c StressSolve.f90
StressSolve.f90:518.36:

'Displacement Velo', DIM, StressSol % PrevValues(:,1), StressSol % P
1
Fehler: Effektives Argument für »values« muss ein Zeiger bei (1) sein
make[1]: *** [StressSolve.o] Fehler 1
make[1]: Leaving directory `/home/rudolf/elmerfem/trunk/fem/src'
make: *** [all-recursive] Fehler 1

It means that it has to be a pointer at (1) for the argument "values"

regards rn

Re: velocity of nodes in the linear elasticity

Posted: 20 Oct 2009, 16:50
by raback
Ok, sorry for the bug. Maybe you can delcleare some pointers as in

Code: Select all

REAL(KIND=dp),  POINTER :: VeloValues(:)
VeloValues => StressSol % PrevValues(:,1)

Re: velocity of nodes in the linear elasticity

Posted: 20 Oct 2009, 18:03
by studdrud
Ok, i putted the terms in StressSolve.f90 it looks no wlike this:
...
REAL(KIND=dp), POINTER :: DispValues(:)
REAL(KIND=dp), POINTER :: VeloValues(:)
REAL(KIND=dp), ALLOCATABLE :: UpdateRef(:), Ref_rhs(:), NodalRefD(:)
...
Var => VariableGet( Solver % Mesh % Variables, 'VonMises' )
IF ( .NOT. ASSOCIATED( Var ) ) THEN
ALLOCATE( VonMises( n ) )
CALL VariableAdd(Solver % Mesh % Variables, Solver % Mesh, Solver, &
'VonMises', 1, VonMises, DisplPerm )
END IF
!-----------------------------------------------------------------------------------
! added 20.10
!-----------------------------------------------------------------------------------
VeloValues => StressSol % PrevValues(:,1)
CALL VariableAdd( Solver % Mesh % Variables, Solver % Mesh, Solver, &
'Displacement Velo', DIM, VeloValues, StressSol % Perm)
!-----------------------------------------------------------------------------------

IF(CalcPrincipalAll) THEN
Var => VariableGet( Solver % Mesh % Variables, 'Principal Stress' )
IF ( .NOT. ASSOCIATED( Var ) ) THEN
ALLOCATE( PrincipalStress( 3*n ) )
...
The compilation was successfull. But how can i write out the velocity? i tried this with:
Exported Variable 1 = -dofs 3 Displacement Velo
but it doesn't work. Then i tried it with:
Equation 1
Name = "Equation 1"
Calculate Stresses = True
Active Solvers(2) = 2 1
End
but it wrote only the stresses.
regards rn

Re: velocity of nodes in the linear elasticity

Posted: 20 Oct 2009, 20:57
by raback
It should write the values by default. Adding the 'Exported Variable' just allocates the same name the second time. Are you sure you run the modified version? Adding some print command may often be a good idea. Note that you need do the modifications to the .src file, and to say 'make install' in order to copy the modified solver in the correct destination. The .f90 is obtained from .src after the preprocessing.

-Peter

Re: velocity of nodes in the linear elasticity

Posted: 21 Oct 2009, 13:22
by studdrud
ok sorry, i've done make but i've forgotten to make install. i am new in linux and not so familar with this stuff.
the solver writes the new variable "displacement velo" out in the result-file automatically, if i turn the calculation of stress on.
it looks like this:
Degrees of freedom:
displacement 3 :fs
stress 6 :fs
displacement velo 3 :fs
displacement 1 1 :fs
displacement 2 1 :fs
displacement 3 1 :fs
stress 1 1 :fs
stress 2 1 :fs
stress 3 1 :fs
stress 4 1 :fs
stress 5 1 :fs
stress 6 1 :fs
vonmises 1 :fs
Total DOFs: 10
Number Of Nodes: 179
Time: 1 1 0.100300000000E+001
displacement 1
Perm: 179 179
...
the variable is listed but there are nowhere the results for this variable in the result-file. I've postprocessed this case and paraview showed the displacemnt and the stresses but didn't show the new variable
displacment velo.

regards rn

Re: velocity of nodes in the linear elasticity

Posted: 21 Oct 2009, 18:45
by raback
Ok, I forgot that the vector fields are available as themselves and their components. The latter ones are used in saving. Try the following:

Code: Select all

VeloValues => StressSol % PrevValues(:,1)
CALL VariableAdd( Solver % Mesh % Variables, Solver % Mesh, Solver, &
'Displacement Velo', DIM, VeloValues, StressSol % Perm)
DO i=1,DIM
  VeloValues => StressSol % PrevValues(i::DIM,1)
  CALL VariableAdd( Solver % Mesh % Variables, Solver % Mesh, Solver, &
  'Displacement Velo '//CHAR(i+ICHAR('0')), 1, VeloValues, StressSol % Perm)
END DO
-Peter

Re: velocity of nodes in the linear elasticity

Posted: 22 Oct 2009, 11:26
by studdrud
Thank you very much for the great help.
It works and the result looks good!

regards rn

Re: velocity of nodes in the linear elasticity

Posted: 01 Feb 2010, 22:36
by beautylife
I'm using windows xp. How one may do this upgrading in windows environment?