[SOLVED] AcousticsSolver: Need Help to Set Up a Model

Numerical methods and mathematical models of Elmer
Post Reply
CrocoDuck
Posts: 81
Joined: 12 May 2016, 13:15
Antispam: Yes

[SOLVED] AcousticsSolver: Need Help to Set Up a Model

Post by CrocoDuck »

Hi guys!

So, I am trying to set up a simple model using the AcousticsSolver. As a first step, since I never used the solver, I am trying to use the simplest possible parameters. However, I can only get trivially 0 solutions. Maybe you can help me understand what I am doing wrong.

The model is just a sort of 3D pipeline. I would like all the walls to be rigid, a part for one termination of the pipeline that I would like to have constant velocity along the axis of the pipeline (z axis). The model was created with FreeCAD and the I prepared an unv mesh with Salome, which I converted to Elmer format with:

Code: Select all

ElmerGrid 8 2 FineGeometryMesh.unv
Next, I set up this sif file, based on the sif file of a simulation I did on the same geometry by using HelmholzSolver:

Code: Select all

! Steady State Linearized Navier-Stokes solver

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "FineGeometryMesh"
  Include Path ""
  Results Directory ""
  $ f = 110 5 20 27.5 55 60 100 105 110 140 180 205 220 220 260 300 305 340 380 405 420 440 460 500 505 540 580 605 620 660 700 705 740 780 805 820 860 880 900 905 940 980 1005 1105 1205 1305 1405 1505 1605 1705 1760 1805 1905 2005 2105 2205 2305 2405 2505 2605 2705 2805 2905 3005 3105 3205 3305 3405 3505 3520 3605 3705 3805 3905 4005 4105 4205 4305 4405 4505 4605 4705 4805 4905 7040
  $ v = 1
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Scanning
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Timestep intervals = 1 !84
  Solver Input File = case.sif
  Post File = case.ep
  Coordinate Scaling = 0.001
  Frequency = Variable time; Real MATC "f(tx - 1)"
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.67e-08
  Permittivity of Vacuum = 8.8542e-12
  Boltzmann Constant = 1.3807e-23
  Unit Charge = 1.602e-19
End

Body 1
  Target Bodies(1) = 1
  Name = "Body 1"
  Equation = 1
  Material = 1
End

Solver 2

  Equation = Linearized Navier–Stokes
  Procedure = "Acoustics" "AcousticsSolver"
  Variable = Flow
  Variable Dofs = 10
  !Element = p:1 b:5
  Bubbles in Global System = False
  Utilize Previous Solution = False

  Block Preconditioning = False
  Max Outer Iterations = 500
  !Max Inner GCR Iterations = 10
  Ratio of Convergence Tolerances = 0.001
  !Residual Reduction Ratio = 0.01
  Linear System Convergence Tolerance = 1.0e-10
  !Velocity Convergence Tolerance =
  !Schur Complement Convergence Tolerance =
  Linear System Max Iterations = 500
  !Velocity Assembly = True
  ILU Order for Schur Complement = 1
  !ILU Order for Velocities =

  !!Linear System Solver = Iterative
  !!Linear System Iterative Method = BiCGStab
  !!BiCGstabl polynomial degree = 2
  !!Linear System Preconditioning = ILUT
  !!Linear System ILUT Tolerance = 1.0e-3
  !!Linear System Abort Not Converged = False
  !!Linear System Residual Output = 1
  !!Linear System Precondition Recompute = 1

  !!Nonlinear System Convergence Tolerance = 1.0e-7
  !!Nonlinear System Max Iterations = 500
  !!Nonlinear System Newton After Iterations = 3
  !!Nonlinear System Newton After Tolerance = 1.0e-3
  !!Nonlinear System Relaxation Factor = 1

  Exec Solver = Always
  !!Stabilize = True
  !!Lumped Mass Matrix = False
  !!Optimize Bandwidth = True
  !!Steady State Convergence Tolerance = 1.0e-5

End

Solver 1
  Equation = Result Output
  Output File Name = case
  Save Geometry Ids = False
  Output Format = Vtu
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Exec Solver = After Timestep
End

Equation 1
  Name = "airModel"
  Active Solvers(1) = 2
End

Equation 2
  Name = "paraviewExport"
  Active Solvers(1) = 1
End

Material 1

  Name = "Air (room temperature)"
  Relative Permeability = 1.00000037
  Heat Conductivity = 0.0257
  !Turbulent Prandtl Number = 0.713
  Heat Capacity = 1005.0
  Relative Permittivity = 1.00059
  Relative Permeability = 1.00000037
  Viscosity = 1.983e-5
  Viscosity = 1.983e-5
  Sound speed = 343.0
  Heat expansion Coefficient = 3.43e-3
  Relative Permittivity = 1.00059
  Porosity Model = Always saturated
  Relative Permittivity = 1.00059
  Relative Permittivity = 1.00059
  Density = 1.205
  Relative Permeability = 1.00000037

  Specific Heat = 0.718
  Specific Heat Ratio = 1.39972144846797
  Equilibrium Density = 1.205
  Equilibrium Temperature = 20
  ! Heat Conductivity =
  ! Viscosity =
  ! Bulk Viscosity =
  ! Re Heat Source =
  ! Im Heat Source =
  ! Re Body Force i =
  ! Im Body Force i =

End

Boundary Condition 1
  Target Boundaries(1) = 11
  Name = "airRadiator"

  Re Velocity 1 = 0
  Im Velocity 1 = 0

  Re Velocity 2 = 0
  Im Velocity 2 = 0

  Re Velocity 3 = Real MATC "v"
  Im Velocity 3 = 0

End

Boundary Condition 2
  Target Boundaries(10) = 2 3 4 5 6 7 8 9 10 12
  Name = "airRigid"

  Re Velocity 1 = 0
  Im Velocity 1 = 0

  Re Velocity 2 = 0
  Im Velocity 2 = 0

  Re Velocity 3 = 0
  Im Velocity 3 = 0

End

Then I created ELMERSOLVER_STARTINFO with this content:

Code: Select all

case.sif
1
And run the simulation with:

Code: Select all

ElmerSolver >solver.log 2>&1
Here the contents of solver.log:

Code: Select all

ELMER SOLVER (v 8.3) STARTED AT: 2018/03/09 13:45:31
ParCommInit:  Initialize #PEs:            1
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.3 (Rev: unknown, Compiled: 2018-03-08)
MAIN:  HYPRE library linked in.
MAIN:  MUMPS library linked in.
MAIN: =============================================================
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Loading input file: case.sif
WARNING:: LoadInputFile: > Equation 2 < not used in any Body!
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init0]
Loading user function library: [Acoustics]...[AcousticsSolver_Init0]
LoadMesh: Base mesh name: ./FineGeometryMesh
LoadMesh: Scaling coordinates: 1.000E-03 1.000E-03 1.000E-03
LoadMesh: Elapsed REAL time:     0.2475 (s)
MAIN: -------------------------------------
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_bulk]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver]
Loading user function library: [Acoustics]...[AcousticsSolver_Init]
Loading user function library: [Acoustics]...[AcousticsSolver_bulk]
Loading user function library: [Acoustics]...[AcousticsSolver]
OptimizeBandwidth: ---------------------------------------------------------
OptimizeBandwidth: Computing matrix structure for: linearized navier–stokes...done.
OptimizeBandwidth: Half bandwidth without optimization: 67066
OptimizeBandwidth: 
OptimizeBandwidth: Bandwidth Optimization ...done.
OptimizeBandwidth: Half bandwidth after optimization: 3646
OptimizeBandwidth: ---------------------------------------------------------
MAIN: 
MAIN: -------------------------------------
MAIN:  Time: 1/1   1.0000000000000000
MAIN: -------------------------------------
MAIN: 
SingleSolver: Attempting to call solver
SingleSolver: Solver Equation string is: linearized navier–stokes
AcousticsSolver: Helmholtz solution is not available
AcousticsSolver: Acoustic interface boundary conditions cannot be applied
AcousticsSolver: 
AcousticsSolver: -------------------------------------
AcousticsSolver:  Frequency (Hz):    110.00000000000000
AcousticsSolver: -------------------------------------
AcousticsSolver: 
AcousticsSolver: Starting Assembly
AcousticsSolver: Estimated assembly time (s):   128.67
AcousticsSolver:    Assembly:   8 % done
AcousticsSolver:    Assembly:  16 % done
AcousticsSolver:    Assembly:  24 % done
AcousticsSolver:    Assembly:  33 % done
AcousticsSolver:    Assembly:  41 % done
AcousticsSolver:    Assembly:  49 % done
AcousticsSolver:    Assembly:  58 % done
AcousticsSolver:    Assembly:  66 % done
AcousticsSolver:    Assembly:  74 % done
AcousticsSolver:    Assembly:  83 % done
AcousticsSolver:    Assembly:  91 % done
AcousticsSolver:    Assembly:  99 % done
WARNING:: Acoustics: Could not find variable U for FSI simulation
DefUtils::DefaultDirichletBCs: Setting Dirichlet boundary conditions
DefUtils::DefaultDirichletBCs: Dirichlet boundary conditions set
AcousticsSolver: Assembly done
SolveSystem: Solution trivially zero!
AcousticsSolver: 
AcousticsSolver:  Result Norm    :    0.0000000000000000
AcousticsSolver:  Relative Change:    0.0000000000000000
AcousticsSolver:  Assembly: (s)  110.98
AcousticsSolver:  Solve:    (s)    0.00
AcousticsSolver: Exiting the solver...
SingleSolver: Attempting to call solver
SingleSolver: Solver Equation string is: result output
ResultOutputSolver: -------------------------------------
ResultOutputSolve: Saving with prefix: case
ResultOutputSolver: Creating list for saving - if not present
CreateListForSaving: Field Variables for Saving
ResultOutputSolver: Saving in unstructured VTK XML (.vtu) format
VtuOutputSolver: Saving results in VTK XML format with prefix: case
VtuOutputSolver: Saving number of partitions: 1
ResultOutputSolver: -------------------------------------
WritePostFile: Saving results in ElmerPost format to file FineGeometryMesh/case.ep
ElmerSolver: *** Elmer Solver: ALL DONE ***
ElmerSolver: The end
SOLVER TOTAL TIME(CPU,REAL):       124.78      126.10
ELMER SOLVER FINISHED AT: 2018/03/09 13:47:38
Any idea why I am getting a trivially 0 solution? By the way, I am not sure about what these mean:

Code: Select all

AcousticsSolver: Helmholtz solution is not available
AcousticsSolver: Acoustic interface boundary conditions cannot be applied
Should I run a Helmholtz solver first?
Last edited by CrocoDuck on 13 Mar 2018, 18:13, edited 1 time in total.
mika
Posts: 236
Joined: 15 Sep 2009, 07:44

Re: AcousticsSolver: Need Help to Set Up a Model

Post by mika »

Hi,

If the mesh files define a 3-D geometry, then I don't see immediately from the sif file why the solution is trivial because the given BCs should create a source. This solver is completely independent and doesn't need a Helmholtz solution to be solved first. Perhaps I would first check that the boundary numbering of the Elmer mesh files certainly corresponds to the sif file and also check that the test case

elmerfem/fem/tests/HarmonicNS

can be run correctly.

Best regards,
Mika
CrocoDuck
Posts: 81
Joined: 12 May 2016, 13:15
Antispam: Yes

Re: AcousticsSolver: Need Help to Set Up a Model

Post by CrocoDuck »

mika wrote:Perhaps I would first check that the boundary numbering of the Elmer mesh files certainly corresponds to the sif file and also check that the test case
Thank you very much for your help Mika!

I think that that was the reason. I loaded the unv filte into ElmerGUI, saved the resulting project in a new directory, and then I edited manually the sif file. It seems it got rid of the trivial solution problem. So, perhaps the way I was converting the unv file was messing up the boundaries.

Now, however, I have another problem. I am struggling to get the solver converging to a solution. My study is a small 3D geometry (sizes in the order of 10 mm) and I would like to study it for a number of frequencies up to 1 or 2 kHz. Can you recommend any mesh parameters and solver settings that would help the solver converge? Or better yet, can you recommend a strategy to select best parameters for a problem?
CrocoDuck
Posts: 81
Joined: 12 May 2016, 13:15
Antispam: Yes

Re: AcousticsSolver: Need Help to Set Up a Model

Post by CrocoDuck »

So, I did some experiments and I found that the model seems to work with this sif file only if my meshes are first order:

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory "results"
$ f = 5 10 20 55 100 110 200 220 300 400 440 500 600 700 800 880 900 1000 1100 1150 1200 1300 1400 1450 1500 1600 1700 1750 1760 1800 1900 2000 2050 2100 2200 2300 2400 2500
$ v = 0.001
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Scanning
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Timestep intervals = 38
  Solver Input File = case.sif
  Post File = case.ep
  Coordinate Scaling = 0.001
  Frequency = Variable time; Real MATC "f(tx - 1)"
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.67e-08
  Permittivity of Vacuum = 8.8542e-12
  Boltzmann Constant = 1.3807e-23
  Unit Charge = 1.602e-19
End

Body 1
  Target Bodies(1) = 1
  Name = "Body 1"
  Equation = 1
  Material = 1
End

Solver 2
  Equation = Linearized Navier–Stokes
  Procedure = "Acoustics" "AcousticsSolver"
  Variable = -dofs 10 Flow
  Element = "p:1 b:1"
  Bubbles in Global System = False
  Utilize Previous Solution = True
  Block Preconditioning = True
  Max Outer Iterations = 500
  Max Inner GCR Iterations = 10
  Ratio of Convergence Tolerances = 0.001
  Residual Reduction Ratio = 0.1
  !Velocity Assembly = True
  ILU Order for Velocities = 2
  ILU Order for Schur Complement = 2
  Linear System Solver = Iterative
  !Linear System Direct Method = Banded
  Linear System Iterative Method = GCR
  Linear System GCR Restart = Integer 200
  Linear System Max Iterations = 1000
  Linear System Convergence Tolerance = 1.0e-10
  Linear System Abort Not Converged = True
  Linear System Preconditioning = ILU1
  Linear System Residual Output = 1
  Linear System Precondition Recompute = 1
  Linear System Abort Not Converged = False
  Linear System Scaling = Logical True
  Linear System Row Equilibration = Logical True 
  Nonlinear System Convergence Tolerance = 1.0e-05
  Nonlinear System Max Iterations = 5
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-02
  Nonlinear System Relaxation Factor = 1.0
End

Solver 1
  Equation = Result Output
  Output File Name = case
  Save Geometry Ids = False
  Output Format = Vtu
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Exec Solver = After Timestep
End

Equation 1
  Name = "airModel"
  Active Solvers(1) = 2
End

Equation 2
  Name = "paraviewExport"
  Active Solvers(1) = 1
End

Material 1
  Name = "Air (room temperature)"
  Relative Permeability = 1.00000037
  Heat Conductivity = 0.0257
  !Turbulent Prandtl Number = 0.713
  Heat Capacity = 1005.0
  Relative Permittivity = 1.00059
  Relative Permeability = 1.00000037
  Viscosity = 1.983e-5
  Sound speed = 343.0
  Heat expansion Coefficient = 3.43e-3
  Relative Permittivity = 1.00059
  Porosity Model = Always saturated
  Relative Permittivity = 1.00059
  Relative Permittivity = 1.00059
  Density = 1.205
  Relative Permeability = 1.00000037
  Specific Heat = 718
  Specific Heat Ratio = 1.39972144846797
  Equilibrium Density = 1.205
  Equilibrium Temperature = 293
End

Boundary Condition 1
  Target Boundaries(1) = 11
  Name = "airRadiator"

  Re Velocity 1 = Real 0.0
  Im Velocity 1 = Real 0.0

  Re Velocity 2 = Real 0.0
  Im Velocity 2 = Real 0.0

  Re Velocity 3 = Real MATC "v"
  Im Velocity 3 = Real 0.0

End

Boundary Condition 2
  Target Boundaries(10) = 2 3 4 5 6 7 8 9 10 12
  Name = "airRigid"

  Re Velocity 1 = Real 0.0
  Im Velocity 1 = Real 0.0

  Re Velocity 2 = Real 0.0
  Im Velocity 2 = Real 0.0

  Re Velocity 3 = Real 0.0
  Im Velocity 3 = Real 0.0

End
I got used to use second order meshes with the Helmholtz solver. This is why I tried those first. However, every time I use second order meshes and the Element property is set, I get an error about matrices being singular (sorry, I did not note that down). Is there an argument against second order meshes for this solver?
mika
Posts: 236
Joined: 15 Sep 2009, 07:44

Re: AcousticsSolver: Need Help to Set Up a Model

Post by mika »

Hi,

An equal-order approximation of the unknown fields is not numerically stable. In principle one could apply the second-order approximation of the velocity together with the first-order approximation of the other fields, but this strategy has not been implemented into this solver. Thus the available version supports only the first-order approximation where the velocity approximation is augmented with additional elementwise bubble functions to avoid instabilities.

-- Mika
CrocoDuck
Posts: 81
Joined: 12 May 2016, 13:15
Antispam: Yes

Re: AcousticsSolver: Need Help to Set Up a Model

Post by CrocoDuck »

Oh I see. Now I understand better the things reported on the Solver manual about bubble functions and stability. I think I can mark this as SOLVED, as the model is now set up :D

Thank you for your support!
Post Reply