How to Obtain the Imaginary Part in Helmholtz Equation Simulations with Elmer

Numerical methods and mathematical models of Elmer
kevinarden
Posts: 2319
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to Obtain the Imaginary Part in Helmholtz Equation Simulations with Elmer

Post by kevinarden »

They often call utility programs for common functions across all solvers.
I clone the source files to my hard drive which allows me to search inside the files for text.
IsotoCedex
Posts: 11
Joined: 18 Mar 2024, 09:51
Antispam: Yes

Re: How to Obtain the Imaginary Part in Helmholtz Equation Simulations with Elmer

Post by IsotoCedex »

Thank you kevinarden,

That's what I did. I downloaded it and explored it with VisualStudio.

I have to confess that my programming skills are very poor.

Reviewing all this, I cannot understand the reason for the difference in the outcome variables.

I will start from the hypothesis that in 2D, the "Pressure wave" vector represents the real and imaginary part.

Let's see if I can obtain satisfactory results by applying the equation 12.3 of the ElmerModelsManual.pdf:

Code: Select all

p(t) = Re(P e^(iωt)) = Re(P) cos(ωt) - Im(P) sin(ωt)
Where:
- Re(P) is Pressure Wave 1
- Im(P) is Pressure Wave 2
As I said in previous posts, the objective is to obtain p(t) at various moments of the simulation.

If I get satisfactory results I will indicate in this forum.

Thank you very much again!

Search result "pressure wave" in Elmer's code:

Code: Select all

46 results - 5 files

ElmerGUI\Application\edf\edf.xml:
   98            <Activate> /Mesh Update/BoundaryCondition/Mesh Update 3 periodic</Activate>
   99            <Activate> /Mesh Update/BoundaryCondition/Mesh Update 3 periodic</Activate>
  100:           <Activate> /Helmholtz Equation/BoundaryCondition/Pressure Wave 1 periodic</Activate>
  101:           <Activate> /Helmholtz Equation/BoundaryCondition/Pressure Wave 2 periodic</Activate>
  101            <SifName> Periodic BC </SifName>
  102            <SifName> Periodic BC </SifName>

ElmerGUI\Application\edf\helmholtz.xml:
   54             <Name> Variable </Name>
   55:            <DefaultValue> Pressure Wave(2) </DefaultValue>
   56           </Parameter>

  102             <Name> Volume source 1 (real part)</Name>
  103:            <SifName> Pressure Wave Source 1 </SifName>
  104          </Parameter>

  106             <Name> Volume source 2 (imag part)</Name>
  107:            <SifName> Pressure Wave Source 2 </SifName>
  108          </Parameter>

  148           <Parameter  Widget="Edit">
  149:            <Name> Pressure wave 1 (real part)</Name>
  150:            <SifName> Pressure Wave 1 </SifName>
  151           </Parameter>
  152           <Parameter  Widget="Edit">
  153:            <Name> Pressure wave 2 (imag part) </Name>
  154:            <SifName> Pressure Wave 2 </SifName>
  155           </Parameter>

  172           <Parameter  Widget="Edit">
  173:            <Name> Pressure Wave 1 (real part) </Name>
  174:            <SifName> Pressure Wave 1 </SifName>
  175:            <Activate> /Helmholtz Equation/BoundaryCondition/Pressure Wave 1 Condition </Activate>
  176           </Parameter>
  177           <Parameter  Widget="Edit">
  178:            <Name> Pressure Wave 2 (imag part)  </Name>
  179:            <SifName> Pressure Wave 2 </SifName>
  180:            <Activate> /Helmholtz Equation/BoundaryCondition/Pressure Wave 2 Condition </Activate>
  181           </Parameter>

  183           <Parameter  Widget="Edit" Enabled="False">
  184:            <Name> Pressure Wave 1 Condition </Name>
  185             <Whatis> If the given value is less than zero, apply flux condition instead of the Dirichlet Condition. To be generally useful space and/or time varying values may be given. </Whatis>

  188           <Parameter  Widget="Edit" Enabled="False">
  189:            <Name> Pressure Wave 2 Condition </Name>
  190             <Whatis> If the given value is less than zero, apply flux condition instead of the Dirichlet Condition. To be generally useful space and/or time varying values may be given. </Whatis>

  217            <Parameter Widget="CheckBox" Enabled="False">
  218:               <Name> Pressure Wave 1 periodic </Name>
  219:               <SifName> Periodic BC Pressure Wave 1 </SifName>
  220            </Parameter>
  221            <Parameter Widget="CheckBox" Enabled="False">
  222:               <Name> Pressure Wave 2 periodic </Name>
  223:               <SifName> Periodic BC Pressure Wave 2 </SifName>
  224            </Parameter>

fem\src\SOLVER.KEYWORDS:
  271  BC:Real:            'Pressure 3'
  272: BC:Real:            'Pressure Wave 1 Condition'
  273: BC:Real:            'Pressure Wave 1'
  274: BC:Real:            'Pressure Wave 2 Condition'
  275: BC:Real:            'Pressure Wave 2'
  276  BC:Real:            'Pressure'

  569  IC:Real:            'Potential'
  570: IC:Real:            'Pressure Wave 1'
  571: IC:Real:            'Pressure Wave 2'
  572  IC:Real:            'Pressure'

fem\src\modules\WaveSolver.F90:
  87  
  88:   CALL Info('WaveSolver','Solving the compressional pressure wave')
  89    

fem\tests\periodic_rot\egproject.xml:
  6899           <widget type="Edit" >
  6900:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 Condition/0</key>
  6901              <value></value>

  6939           <widget type="Edit" >
  6940:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 Condition/0</key>
  6941              <value></value>

  7039           <widget type="Edit" >
  7040:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 (imag part)/0</key>
  7041              <value></value>

  7047           <widget type="CheckBox" >
  7048:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 periodic/0</key>
  7049              <value>0</value>

  7091           <widget type="Edit" >
  7092:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 (real part)/0</key>
  7093              <value></value>

  7207           <widget type="CheckBox" >
  7208:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 periodic/0</key>
  7209              <value>0</value>

  7367           <widget type="Edit" >
  7368:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 Condition/1</key>
  7369              <value></value>

  7407           <widget type="Edit" >
  7408:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 Condition/1</key>
  7409              <value></value>

  7507           <widget type="Edit" >
  7508:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 (imag part)/1</key>
  7509              <value></value>

  7515           <widget type="CheckBox" >
  7516:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 periodic/1</key>
  7517              <value>0</value>

  7559           <widget type="Edit" >
  7560:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 (real part)/1</key>
  7561              <value></value>

  7675           <widget type="CheckBox" >
  7676:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 periodic/1</key>
  7677              <value>0</value>

  7835           <widget type="Edit" >
  7836:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 Condition/2</key>
  7837              <value></value>

  7879           <widget type="Edit" >
  7880:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 Condition/2</key>
  7881              <value></value>

  7975           <widget type="Edit" >
  7976:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 (imag part)/2</key>
  7977              <value></value>

  7983           <widget type="CheckBox" >
  7984:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 2 periodic/2</key>
  7985              <value>0</value>

  8027           <widget type="Edit" >
  8028:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 (real part)/2</key>
  8029              <value></value>

  8143           <widget type="CheckBox" >
  8144:             <key>/Helmholtz Equation/BoundaryCondition/Pressure Wave 1 periodic/2</key>
  8145              <value>0</value>
IsotoCedex
Posts: 11
Joined: 18 Mar 2024, 09:51
Antispam: Yes

Re: How to Obtain the Imaginary Part in Helmholtz Equation Simulations with Elmer

Post by IsotoCedex »

Hello again,

I have been playing with the equation 12.3 of the ElmerModelsManual and, although it gives different results from p(t), I do not find a physical sense to them.

I expected, for example, that at p(t)=0, no waves would be seen in space, however, the result is PW1. This is logical, considering that sin(0) =0.

From there, it is not possible to generate any instant in which the wavefront is at a distance X (tx) from the source.
ScreenT0.png
ScreenT0.png (503.43 KiB) Viewed 110 times
For example, in the following image the wavefront should not reach the acoustic screen (4m) or the upper edge of the domain (15m).
ScreenT0292.png
ScreenT0292.png (537.72 KiB) Viewed 110 times
The same thing happens with the example of https://www.elmerfem.org/forum/viewtopic.php?t=4553, where variation with respect to "t" is also seen, but the evolution of the wave front cannot be observed.
tubo.png
(118.14 KiB) Not downloaded yet
In conclusion of this whole matter:
- In 2D and 3D, Helmer Helmholtz gives different results
- In 2D, the "pressure wave" field represents the real and imaginary part
- Equation 12.3 of the models manual, referring to p(t), is not useful to see the evolution of the wave front over time, and I do not understand very well what physical meaning its results have.

Any ideas or contributions?

Thank you so much!
kevinarden
Posts: 2319
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to Obtain the Imaginary Part in Helmholtz Equation Simulations with Elmer

Post by kevinarden »

I believe the intention was to use the wave solver for the time domain solution

Model 14
Wave Equation
Module name: WaveSolver
Module subroutines: WaveSolver
Module authors: Juha Ruokolainen, Peter R˚aback, Mika Malinen
Document authors: Mika Malinen
14.1 Introduction
This module can be used to solve a generalized version of the wave equation in time domain. It provides an
alternative to the Helmholtz equation which follows from the wave equation by transforming to the frequency
domain.
IsotoCedex
Posts: 11
Joined: 18 Mar 2024, 09:51
Antispam: Yes

Re: How to Obtain the Imaginary Part in Helmholtz Equation Simulations with Elmer

Post by IsotoCedex »

Thank you so much!

Wave equation: https://youtu.be/zN7UiyHBNmg
Post Reply