Skip to content
Snippets Groups Projects
Commit f43ca35f authored by Amaury Bilocq's avatar Amaury Bilocq
Browse files

modify computation of rhs for pressure

parent 10abdebc
No related branches found
No related tags found
No related merge requests found
Pipeline #53052 passed
...@@ -22,7 +22,7 @@ def solve(user_params)->dict: ...@@ -22,7 +22,7 @@ def solve(user_params)->dict:
- "k0" (int): Peak wavenumber (default: 4). - "k0" (int): Peak wavenumber (default: 4).
- "domain_size" (list, tuple, np.ndarray): Size of the simulation domain, should be a 3D vector (default: [2π, 2π, 2π]). - "domain_size" (list, tuple, np.ndarray): Size of the simulation domain, should be a 3D vector (default: [2π, 2π, 2π]).
- "domain_resolution" (list, tuple, np.ndarray): Resolution of the domain, should be a 3D vector (default: [64, 64, 64]). - "domain_resolution" (list, tuple, np.ndarray): Resolution of the domain, should be a 3D vector (default: [64, 64, 64]).
- "Spectrum" (str): Type of spectrum for turbulence generation. Options: "PassotPouquet", "Constant" (default: "PassotPouquet"). - "Spectrum" (str): Type of spectrum for turbulence generation. Options: "PassotPouquet", "Gaussian" (default: "PassotPouquet").
- "gamma" (float): Heat capacity ratio, typically between 1 and 2 (default: 1.4). - "gamma" (float): Heat capacity ratio, typically between 1 and 2 (default: 1.4).
- "case" (int): Dimensionalisation of the density and temperature fluctuations (from Ristorcelli & Blaisdell). Options: 1, 2 (default: 1). - "case" (int): Dimensionalisation of the density and temperature fluctuations (from Ristorcelli & Blaisdell). Options: 1, 2 (default: 1).
- "output_dir" (str): Directory to store output results (default: "results"). - "output_dir" (str): Directory to store output results (default: "results").
...@@ -202,7 +202,7 @@ def _validate_params(params) -> dict: ...@@ -202,7 +202,7 @@ def _validate_params(params) -> dict:
# Define allowed values for specific parameters # Define allowed values for specific parameters
allowed_values = { allowed_values = {
"Spectrum": {"PassotPouquet", "Gaussian", "Exponential"}, # Allowed spectrum types "Spectrum": {"PassotPouquet", "Gaussian"}, # Allowed spectrum types
"case": {1, 2}, # Allowed integer cases "case": {1, 2}, # Allowed integer cases
} }
......
...@@ -160,16 +160,9 @@ def compute_solenoidal_pressure(u: np.ndarray,v: np.ndarray,w: np.ndarray, ...@@ -160,16 +160,9 @@ def compute_solenoidal_pressure(u: np.ndarray,v: np.ndarray,w: np.ndarray,
hy = domain_size[1]/ny hy = domain_size[1]/ny
hz = domain_size[2]/nz hz = domain_size[2]/nz
dudx,dudy,dudz = np.gradient(u,hx,hy,hz,edge_order=2) velocity = np.array([u,v,w])
dvdx,dvdy,dvdz = np.gradient(v,hx,hy,hz,edge_order=2) gradVelocity = np.array([np.gradient(vel, hx, hy, hz, edge_order=2) for vel in velocity])
dwdx,dwdy,dwdz = np.gradient(w,hx,hy,hz,edge_order=2) rhs = -np.einsum('ij...,ji...->...', gradVelocity, gradVelocity)
grad = np.array([[dudx,dudy,dudz],[dvdx,dvdy,dvdz],[dwdx,dwdy,dwdz]])
rhs = np.zeros([nx,ny,nz])
for i in range(3):
for j in range(3):
rhs += -1.*grad[i][j]*grad[j][i]
pressure = poisson_3d(rhs, nx, ny, nz, hx, hy, hz) pressure = poisson_3d(rhs, nx, ny, nz, hx, hy, hz)
return pressure return pressure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment