I was able to make simple mesh myself. However, it’s result is not right…
Could you teach me how to fix it?
What I want to do is that the external fluid calculation around 3D cude.
I attach the image fig and the result I have got bellow.
From a cursory look at the msh file your mesh seems reasonable, although I’m not as familar with the gmsh v4 format as v2.
Some things you might want to consider are:
At the outlet you are imposing a characteristic riemann invarient boundary condition with the same condition as the inlet, you might want to consdier imposing a pressure boundary condition.
It looks like your using the same time integration settings as the cylinder test case. This set up is tuned to that case and might not work for you. Try increasing the max number of pseudo iterations to around 25-50,. You have the pseudostats plugin on, so have a look at the residuals to make sure that the system is actaully converging to a reasonable tolerence.
Try turning on the integration plugin and calculating abs(grad_u_x + grad_v_y) ie the integral of the absolute value of the divergence. This should be identically zero for incompressible flows so if it’sparticularly large then the system isn’t converging. (Note that your impulsive IC and BCs will probably cause some non-zero divergnce initially as the BC get enforced)
What is the figure supposed to represent? Is it a flow snapshot after some number of time steps, or just the initial condition? I’ll note that the scale is extremely misleading, as the velocity is basically uniform throughout the entire domain despite what one may think from the figure.
Thank your for replying.
The figure and below figure is the initial condition. I put the results at google drive mesh1_test.zip - Google Drive
I have got bellow error messages I cannot fix…
$pyfr run -b cuda -p tartget_with_fluid2.pyfrm tartget_with_fluid2.ini
0.7% [> ] 0.49/75.00 ela: 00:00:11 rem: 00:28:36Traceback (most recent call last):
File "/home/ubuntu2204/libxsmm/pyfr-venv/bin/pyfr", line 8, in <module>
sys.exit(main())
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/__main__.py", line 118, in main
args.process(args)
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/__main__.py", line 251, in process_run
_process_common(
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/__main__.py", line 247, in _process_common
solver.run()
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/integrators/base.py", line 115, in run
self.advance_to(t)
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/integrators/dual/phys/controllers.py", line 56, in advance_to
self._accept_step(self.pseudointegrator._idxcurr)
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/integrators/dual/phys/controllers.py", line 35, in _accept_step
csh(self)
File "/home/ubuntu2204/libxsmm/pyfr-venv/lib/python3.10/site-packages/pyfr/plugins/nancheck.py", line 21, in __call__
raise RuntimeError(f'NaNs detected at t = {intg.tcurr}')
RuntimeError: NaNs detected at t = 0.5000000000000002
Ok so the boundary conditions won’t be enforced on the initial condition as the IC will be exactly what you defined in the ini file. On the first time step they’ll be enforced, but asa with all simulations it will take some time for these to develop.
This error message means that your simulation has diverged, there are a number of things that can cause this, but normally its just that your time step is too big. Have a look at the things I listed above, the integral and the pseudostats can be helpfully in working out what needs to be done.
Thank you for replying.
To start with the ini modify, I changed velocity and presure inlet and outlet condition, and the max number of pseudo iterations (I attach ini file). The initial velocity seems correct, but puresure is as same as before velocity fig.(I attach the preview fig) . I cannot solve it still now.
Now I am looking for the way to set up the integration plugin and calculating abs(grad_u_x + grad_v_y) .
[backend]
precision = double
[constants]
nu = 0.005
Uin = 0.0
Vin = 0.0
Win = 0.0
Pc = 1.0
ac-zeta = 2.5
[solver]
system = ac-navier-stokes
order = 3
[solver-time-integrator]
formulation = dual
scheme = sdirk33
pseudo-scheme = rk45
controller = none
pseudo-controller = local-pi
tstart = 0.0
tend = 75.0
dt = 0.01
pseudo-dt = 0.005
pseudo-niters-min = 3
pseudo-niters-max = 3
pseudo-resid-norm = l2
pseudo-resid-tol = 1e-12
atol = 1e-6
pseudo-dt-max-mult = 2.5
[solver-dual-time-integrator-multip]
pseudo-dt-fact = 50
cycle = [(3, 1), (2, 1), (1, 1), (0, 2), (1, 1), (2, 1), (3, 3)]
[solver-interfaces]
riemann-solver = rusanov
ldg-beta = 0.5
ldg-tau = 0.1
[solver-interfaces-line]
flux-pts = gauss-legendre
[solver-elements-tri]
soln-pts = williams-shunn
[solver-elements-tet]
soln-pts = shunn-ham
[solver-elements-quad]
soln-pts = gauss-legendre
[solver-interfaces-tri]
flux-pts = williams-shunn
quad-deg = 10
quad-pts = williams-shunn
[soln-plugin-nancheck]
nsteps = 50
[soln-plugin-pseudostats]
flushsteps = 20
file = residual.csv
header = true
[soln-plugin-writer]
dt-out = 5.0
basedir = .
basename = tartget_with_fluid2-{t:.2f}
[soln-bcs-wall]
type = no-slp-wall
[soln-bcs-inlet]
type = ac-char-riem-inv
ac-zeta = 180
p = Pc
u = Uin
v = Vin
w = Win
[soln-bcs-inlete]
type = ac-char-riem-inv
ac-zeta = 180
p = Pc
u = Uin
v = Vin
w = Win
[soln-bcs-outlet]
type = ac-char-riem-inv
ac-zeta = 180
p = 2.0
u = Uin
v = Vin
w = Win
[soln-ics]
u = Uin
v = Vin
w = Win
p = Pc
I appliciate your comments.
I have checked initial condition is applied correctly. However when boundary condition is applied, NAN is produced(grad u seems nearby 0(the relult is bellow)(I think it is correct.).
I wrote in ini file
[soln-plugin-integrate]
nsteps = 1
file = ./results/csv/integral.csv
header = true
quad-deg = 9
div1 = grad_u_x
div2 = grad_v_y
div3 = grad_w_z
int-dive = %(div1)s + %(div2)s + %(div3)s
I got result
t,int-dive
0.0,-1.7856327527709936e-11
Due to the fact, I tried 2 cases in order to find the resone why NAN is produced,
No. 1
The U=10 P=0 initial condition is applied in the domein. The inlet BC is U=10 in ac-in-fv and outlet BC is P=0 ac-out-fp.
The ini file and simulation file are in case1_INLET_OUTLET_WALL_BC - Google Drive
No. 2
The U=10 P=0 initial condition is applied in the domein. Outlet BC is P=0 ac-out-fp.(NO INLET BC)
The ini file and simulation file are in case2_onlyOUTLET_WALL_BC - Google Drive
Both cases are calculated initial condition, but produced NAN into the next step.
I cannot find why these NAN have been produced. In my opinion, I think BC is not working well.
Could you teach me how to fix it?
Thank you.
I’m lookig at your ini file now, there are quite a few things wrong with it. Somethings to bear in mind:
A pressure of zero will always give issues
You didn’t increase the max pseudo iteration number as I recommended
You changed the pseudo-dt-fact to 50. This will definitely cause issues, this menas that as you do from the p-multigrid level p to p-1, the pseudo-dt in increasing by a factor of 50. Which will easily make things unstable.
You reduced nu to ~1e-6, this will make the Reynolds number very high and, unless you have enough mesh, will lead to instabilities.
In the integrate plugin I recommended you calculate the intgral of the absolute divergence, this is an important difference as the integral of divergence often equals zero whereas the pointwise values might not be zero.
I’ll let you know if I get a working inifile for your case
Thank you so much your supports. I could calculate my case 1 step without NAN.(Since the second and subsequent steps fall no matter how I do it, I may need to devise a way, so keep thinking of ways to make it work.) I attach ini file since I want you to review it in order to calculate it next the second and subsequent steps.)
By the way, in terms of velocity, pressure and nu(kinematic viscosity), What are the units? This is because I only know the no-dimensional NS equation and the units are not opened at User Guide.
Moreover , I would like to know how and where in codes Reynolds number and Mach number are defined.
Hi @Yujif1Aero, worth checking if your Uin value of 10 means your inflow velocity is 10 times the speed of sound. Can you describe the system you are trying to solve (i.e., mesh scale, input velocity, fluid viscosity). Also, might be worth getting this to run using the plain Navier-Stokes solver first.
Thank you for replyig.
I have tried to simulate the vortex around buldings.
inpul velocity is more than 10m/s, viscosity is air ( nu = 1.48e-5 )
In terms of mesh, I am not used to make mesh using Gmesh (I do not have commercial mesher eg pointwise) I also want to know how check the mesh scalse at wall but I only know automatic meshing by gmesh.( I am learning how to use gmesh now) If possible I want to calaculate it with mesh Y+=1 ~ 10 at wall.
Two points, you probably want to reduce the pseudo-niters-min, you don’t want to force the system to take 100 steps if it has already converged, 4 is probably more appropriate. For pseudo-niters-max, 100 is probably better too.
PyFR doesn’t assume units, see one of the many other posts asking similar questions.
For example:
Finally on you question about GMSH, this might be better asked to there support team/community.
In your case, I thought you were simulating a channel with an obstruction? I don’t see the obstuction in the pictures, rather, you seem to have mesh where it should be.
Edit: I looked at the mesh you sent previously and I now understand what your case look like.
The pressure at the inlet isn’t set by the ac-in-fv boundary and is free to change. Pressure waves will occur in incompressible fluids as the flow accelerates, initially you’ll see larger pressure waves as the solution settles down from the unrealistic IC to a more realistic state. You just have to power though this period and it normally takes a couple flow throughs of the domain. For example, given the size of the domain ([-10,10]^2\times[0,20]) and the inlet velocity (u=1), it may take until t=20 to 80 or longer. What you can do initially is reduce the order to order = 1 and increase nu. This does two things, the reduced order speeds up the simualtion and adds diffusion to damp out the waves. Increasing nu also add diffusion. Once the solution has developed you can then return the order and nu to the desired values.
Thank you for replyng so much.
I understood I needed to caluclate many period to get stable.
However I could not understand that if nu is increased, the diffusion is increasing.
Yep, changing nu will change the Retynolds number, but this is only for the initialisation. Once you’ve done some flow throughs, you then change it to the target order and nu.