"Run Control" StressSolver Boundary Conditions?

General discussion about Elmer
Post Reply
Dirk
Posts: 3
Joined: 30 Jan 2024, 21:47
Antispam: Yes

"Run Control" StressSolver Boundary Conditions?

Post by Dirk »

Hello,

I am trying to use Elmer to simulate an piezoelectical element for optimization in an sensor application. Using StressSolver for mechanical displacement and StatElecSolver to calculate the generated charge.

In this forum I saw there is a feature ”Run Control”.

I'd tried to sqeeze in sequence a cube in direction of 3 axis (colums in picture) two times (rows).

Code: Select all

Check Keywords "Warn"
!echo on

Header
  Mesh DB "." "Wuerfel_1cm3"
  Results Directory "result_RunContr_3AchsF2zero_mult"
End

Run Control

Max Output Level = 10

! When we fetch the parameters we will automatically have variable a MATC vector "rpar"
! with the given number of parameters. You can refer to these as "$rpar(i)", i=0,1,2...

  Run Control Iterations = 6 !Integer 4 
  Parameter Count = Integer 11  ! columns in matrix
   
  
! Target Boundaries = 1   XZ- Ebene in VTK Viewer
! Target Boundaries = 2   YZ+ Ebene 
! Target Boundaries = 3   XZ+ Ebene
! Target Boundaries = 4   YZ- Ebene 
! Target Boundaries = 5   XY- Ebene  
! Target Boundaries = 6   XY+ Ebene  
  
!rpar columns reference                
!                            1 2 3 4 5 6                 Boundarie Condition to Boundarie
!                                          1   2   3     force in direction 
!                                                    x   forcedirection
!                                                      x Iterationcount
 
Parameter Array(6,11) = Real 1 3 2 4 5 6   0 -10   0 2 1 \
                             4 2 1 3 5 6 -10   0   0 1 1 \
                             5 6 1 2 3 4   0   0 -10 3 1 \
                             1 3 2 4 5 6   0 -10   0 2 2 \
                             4 2 1 3 5 6 -10   0   0 1 2 \
                             5 6 1 2 3 4   0   0 -10 3 2
							 
!  Parameter File = File "par.dat"
!  Parameter Row Offset = Integer 2 ! starts from line 3, doing lines 3-6

End


Constants
End

Simulation
  Coordinate System = Cartesian 3D
  Simulation Type = Steady State
  Steady State Max Iterations = 3
  Steady State Min Iterations = 1
End

Body 1
  Equation = 1
  Material = 1
  Body Force = 1
End

Body Force 1

End

Equation 1
  Active Solvers(2) = 1 2
End

Solver 1
  Equation = Stress Analysis
  Variable = Displacement
  Variable DOFs = 3
  Linear System Solver = Iterative
  Linear System Direct Method = UMFPack
  Linear System Iterative Method = BiCGStab
  Linear System Preconditioning = ILU1
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Newton After Iterations = 20
  Nonlinear System Max Iterations = 1
  Nonlinear System Convergence Tolerance = 1.0e-5
  Nonlinear System Relaxation Factor = 1.0
  Steady State Convergence Tolerance = 1.0e-4
End

Solver 2
Exec Solver = after all
Equation = "result output"
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = fix_in_$rpar(0)$_3AchsF2zero_on_$rpar(1)$_dir_$rpar(9)$_iter_$rpar(10)
Vtu Format = Logical True
Vector Field 1 = String Displacement
End


Material 1

   Density = 2648                   ! [kg/m3]
   Youngs Modulus = 89e9            ! [Pa = N/(m^2)]
   Poisson Ratio = 0.122894           
End 

! Target Boundaries = 1   XZ- Ebene in VTK Viewer
! Target Boundaries = 2   YZ+ Ebene 
! Target Boundaries = 3   XZ+ Ebene
! Target Boundaries = 4   YZ- Ebene 
! Target Boundaries = 5   XY- Ebene  
! Target Boundaries = 6   XY+ Ebene  

Boundary Condition $rpar(0)          
  Target Boundaries = $rpar(0)

  Displacement 1 = 0
  Displacement 2 = 0
  Displacement 3 = 0     
End

Boundary Condition $rpar(1)           
  Target Boundaries = $rpar(1)
   
  Force 1 = $rpar(6)
  Force 2 = $rpar(7)
  Force 3 = $rpar(8)
End

Boundary Condition $rpar(2)           
  Target Boundaries = $rpar(2)
  
End

Boundary Condition $rpar(3)          
  Target Boundaries = $rpar(3)
                         
End

Boundary Condition $rpar(4)
  Target Boundaries = $rpar(4)  
 
End

Boundary Condition $rpar(5)        
  Target Boundaries = $rpar(5)

End

RUN
Wuerfel_1cm3.grd
(786 Bytes) Downloaded 18 times
TestCubes3.png
TestCubes3.png (197.39 KiB) Viewed 453 times
The result is not as expected.
To me it seems that boundary conditions are not reseted at the begin off a new control loop iteration.

Is there a posibility to enforce this? And are other side effects to account?

Thank You for any input in advance.

Dirk

For reference.
Run Control: new outer loop do optimization, scanning etc.
Command-line parameters usable in sif file
Attachments
Displace_RunContr_3AchsF2zero_mult.sif
(3.59 KiB) Downloaded 15 times
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: "Run Control" StressSolver Boundary Conditions?

Post by raback »

Hi

The "target boundaries" is applied only once when the mesh is read in. This enables regrouping of bc elements for more compact sif file. So unfortunately you cannot reapply the "target boundaries". I trust that the permutation to the BCs can be done by other means too. You can, for example, use conditional dirichlet conditions.

-Peter
kevinarden
Posts: 2315
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: "Run Control" StressSolver Boundary Conditions?

Post by kevinarden »

Appears to be easier to write a script, to build different sif files, and run each case with different output names.
Dirk
Posts: 3
Joined: 30 Jan 2024, 21:47
Antispam: Yes

Re: "Run Control" StressSolver Boundary Conditions?

Post by Dirk »

Thank you for your comments.

I tried to use the conditional dirichlet syntax from the Elmer Solver Manual.

Pictures first row from left to right shows result for

First run fixed plane XY- opposite plane XY+ with applied force in X and Y direction.
Second run fixed plane XY- opposite plane XY+ with only force in X direction.
Third run I made the force in Y direction conditional boundary with state 'on' = 1 .
Fourth Y force switched 'off' = -1.
TestCondBCStressSolver1.png
TestCondBCStressSolver1.png (100.47 KiB) Viewed 396 times
Results shown in second row are for
First fixed plane XY- opposite plane XY+ with only force in X direction
Second fixed plane XY- and YZ+ with only force in X direction on plane XY+
Third fixed plane XY- with force in X direction on plane XY+ and conditionaly fixed YZ+ plane with state 'on' = 1
Fourth fixed plane XY- with force in X direction on plane XY+ and conditionaly fixed YZ+ plane with state 'off' = -1

The pictures shows that I am not switching BCs at all. Maybe I am got something wrong. But I mean that I read somewhere the conditional dirichlet BC may be not implemented in older solvers? No or ? - the BCs for older Models are implemented in the modelsolvers not in the "general part" so missing conditional BCs?

So I think I would go the scripting path.

Dirk
Displace_Cond_Dirichlet_Test.sif
(2.43 KiB) Downloaded 14 times
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: "Run Control" StressSolver Boundary Conditions?

Post by raback »

Hi

The syntax is the following:

Code: Select all

  Displacement 1 = Real 0.0
  Displacement 1 Condition = Real $condx

When $condx > 0, the condition is enforced, when $condx < 0, not.

-Peter
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: "Run Control" StressSolver Boundary Conditions?

Post by raback »

kevinarden wrote: 31 Jan 2024, 22:19 Appears to be easier to write a script, to build different sif files, and run each case with different output names.
Yes, often the external scripting keeps things simpler. However, I would argue that there are benefits to having things in the same simulation too.
  • No initialization phase need to be repeated. Can save some time.
  • The iterative solvers etc. may benefit that there is a good previous state to continue from.
  • Sometimes the next set of parameters is defined during simulation e.g. when using the internal optimization or control algos.
  • Sometimes the "run control" section is used to gather data and finally extract it. This happens in model lumping, for example.
The "Run Control" section was mainly created for the two last ones.

-Peter
Dirk
Posts: 3
Joined: 30 Jan 2024, 21:47
Antispam: Yes

Re: "Run Control" StressSolver Boundary Conditions?

Post by Dirk »

Thank you for your help.
On last try on this topic for now from my side.
With hopefully right syntax this time.

Displace_Cond_Dirichlet_Test_09.png
Displace_Cond_Dirichlet_Test_09.png (212.29 KiB) Viewed 209 times

The fist row shows the first iteration for three combinations off fixed displacement and normal force at the opposite side.
Towards the viewer oriented faces are those with an force boundary.
Second row shows the same combinations with displacement boundary bearing faces oriented too the viewer.

It now works for displacement but not for force boundary conditions. All force boundaries are simultaniously active.

Dirk
Attachments
Displace_Cond_Dirichlet_Test_09.sif
(4.55 KiB) Downloaded 14 times
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: "Run Control" StressSolver Boundary Conditions?

Post by raback »

Hi

The Dirichlet and Neumann conditions are different beasts.

For Neumann BC zero means "do nothing". Therefore you do not have to have a special flag to turn the condition on/off. You just can multiply with zero. It does not know anything about additional conditions.

For Dirichlet BC setting value zero is very different than "do nothing". Hence you need a flag to toggle between the two. This flag is the "condition". Even contact mechanics uses basically conditional Dirichlet conditions with the difference that the conditions are quite complicated and treated internally in the code.

-Peter
Post Reply