Dear all, I am trying to bu
I am trying to build a cavitation flow model with dynamic mesh. However, I have a mass conservation problem when I use a moving mesh. At first, I modified cavitatingFoam solver to have moving mesh, then I modified sonicFoamAutoMotion to include barotropic cavitating model as with cavitatingFoam. With both solvers I have the same problem. Mass do not conserve as soon as vapor fraction increases if I use a moving mesh. I have two test problems. The first is a close volume with a boundary condition of constant flow out on one of the boundaries. The conditions in the volume change from liquid to a mixture of liquid and vapor as the density and pressure decrease due to the flow out. In the other case, I use moving mesh to simulate the expansion of the volume in order to get similar density and pressure decrease. As before, the conditions change from one to two phases. However, there is a small increase of total mass even though the mass flux over the boundaries is zero (I have checked it with the surfaceIntegrate function.)
I would appreciate any help to locate the source of this error.
I attach three files with the solver based on sonicFoamAutoMotion and the two test problems.
You have, of course, made sure
You have, of course, made sure that the mesh motion terms are added correctly to your momentum and pressure equation. Also, check the flux through moving walls to make sure you set up the boundary conditions correctly.
Dear Hrv, Thanks for the ad
Thanks for the advice. I have checked the boundary conditions and the calculation of the fluxes on the face (I did surfaceInegrate to get the flux into each cell and then domainIntegrate to get the total flux in/out of the domain). For all practical purpose it was zero (if not exactly zero than in the order of 1e-20 or lower). Phi itself is practically zero on the domain boundaries (I print this field).
The error is probably due to inconsistent writing of the equations or in calculating one or some of the terms. However, I could not find it yet.
One problem I found with moving mesh is in the calculation of the time derivative of a field which has limiting values. For example, let look at the vapor fraction gamma which can be between zero and one only. The time derivative for Euler method with moving mesh is calculated as (gamma1 – gamma0*v0/v1)/dt where index 1 is for current conditions and 0 for previous time step. In any cell where gamma0=1 the multiplication of gamma by the volumes fraction is not correct. In most cases local conditions prevent change in gamma. The change in cell volume will influence the fluid by other parameters but not the volume fraction.
In the test problem this problem do not has any effect since for gamma=0 the multiplication has no effect. However, due to this problem I replaced the ddt(psi) term which appears in the original cavitatingFoam solver by the term (dPsi/dGamma)*ddt(gamma) (psi is function of gamma only, all other parameters are constants).
Well Ido, that leaves only one
Well Ido, that leaves only one possibility: you did not account for mesh motion fluxes from phi after solving the pressure equation. Did you account for mesh motion when solving for phi and subtract mesh.phi() as appropriate?
There are two things you can check:
- volume conservation:
ddt(1) - div(mesh.phi()) = 0
- mass conservation, the usual way.
If both are satisfied, you will preserve boundedness on a moving mesh.
|All times are GMT -4. The time now is 17:12.|