-
Notifications
You must be signed in to change notification settings - Fork 68
MAGMA2 SPH #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rennehan
wants to merge
39
commits into
SWIFTSIM:master
Choose a base branch
from
rennehan:magma2_sph
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
MAGMA2 SPH #63
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…AGMA2_DEBUG_CHECKS to output the ill condition nature.
…e kernel gradients are used in the equations of motion symmetrically. The Sedov test runs for a while, but still eventually crashes.
…t for the antisymmetry of the problem. Also compute dh/dt using the density of particle pi rather than summing over pj contributions.
…ture. I moved all of the gradient relevant tensors and quantites into a new gradients struct in the particle.
…e debugging for the auxiliary velocity gradient tensor. Fixed a couple of issues with the original Gasoline implementation in computing divergences.
…onstruction of the velocity field. There are convenience functions in hydro.h that will compute the tensor and matrix contractions to clean up the code a bit and make it maintainable. Added in viscosity alpha as a constant 1 and changed beta to 2, and set the softening for viscosity to 10% of the softening length. Each particle gets its own artificial pressure rather than averaging as in other methods. The number of neighbors is stored in p->num_ngb now, although this should be constant for each run. Changed correction_matrix to a float since it seems very stable even in the Sedov Blastwave example. There is still a check for numerical conditioning and it will still revert to a Gasoline2-like SPH if the correction matrix is poorly conditioned.
…the hydro.h file that clean up the code a lot and should improve efficiency. Also rewrote the van Leer slope limiter part of the code so that we can now do both scalar and vector fields easily.
…e is extreme noise in front of the shock in the Sedov Blastwave test.
…he vsig calculation as it was also wrong in the Gasoline2 code that I am using as a template.
…um signal velocity to a variable p->v_sig_max that is used to compute the timestep. Now use p->h_min (minimum smoothing length in the kernel) to compute the time-step. Removed old Gasoline2 alpha viscosity estimators and decay terms, as well as the diffusion rate estimators. Small changes to hydro tests to get them to run.
…t seems like they are building up rapidly in the 2nd order reconstruction. It might be that all of these calculations must be done in double precision, or at least zeroed out whenever the dot products are not above FLT_EPSILON.
…e in the Cooling/CoolingSedovBlastwave_3D test case. I fixed the units in the file so that they are in reasonable units.
…othing length) and v_sig_max_ij (maximum signal velocity). Defined new constants for eta_crit and eta_fold in the slope limiting procedure. It seems that slope limiting has a huge effect on the Sedov blastwave noise. I have symmetrized as many operations as possible to avoid floating point rounding errors that seem to be causing a lot of problems. Possible to use the second order velocities directly in the v_ij dot G_ij terms in the hydro equations, using hydro_props_use_second_order_velocities_in_divergence. Must compile with the desired number of neighbours for the slope limiting procedure using const_desired_number_of_neighbours or an error will occur. Must be within 5% of the computed target neighbours for a given SPH: eta in the parameter file. Should be computing the conductivity correctly with the Hubble flow added in.
…ta_crit to be a scaled version of the mean interparticle spacing which is fixed for a kernel/neighbour combination.
…ydro_props_use_double_precision (sets double precision).
…he alternative way. Reorganized the compile-time constants to separate those that can change and those that should be fixed. Changed the SPH divergence estimate to be consistent with the Swift comoving unit system. Conductivity v_sig_cond should be correct now. Allow target_neighbours to be set in the parameter file rather than resolution_eta. Fixed a mistake in makeMovie.py for the Rayleigh-Taylor test.
…dex. Added in a small debugging note if particles penetrate one another. Fixed a bug in the estimation of the mean interparticle spacing. Must not use second order velocities in the SPH divergence sums, that causes severe asymmetries.
… that Rosswog 2020 has a sign error in the conductivity equation, so I fixed that here.
…w temperatures). Got the Hubble flow additions correct for the viscosity.
… relabelled conservative to non-conservative.
…the kernel gradients. Also rewrote dh/dt calculation to match what Swift actually does -- which is a number density constraint on neighbour number, not a mass density constraint! There are more correction terms that need to be added, but those require an additional neighbor loop.
…enter into the average of the kernel gradients, and only really need the 1/Omega contribution. Using the symmetric version (like in SPHENIX) causes problems in extremely complicated flows like the Sedov blastwave. The "grad-h" terms are not actually needed in the MAGMA2 gradients, but it is required for the internal energy evolution equation because of the mismatch between the adiabatic term in the density and specific energy.
… a kernel correction term. However, it assumes that the kernel is isotropic which is most likely wrong (really it assumes that the matrix C_i^kd in Rosswog 2020 is isotropic). If we wanted the true correction factor, we would need another loop over neighbors to find the kernel anisotropies. Added a new function to weight the kernel gradient.
…turn values. Cleaned up the viscosity so that it is in hydro.h and the ifdef statements do the selection there instead of directly in hydro_iact.h.
…w terms for artificial conductivity and viscosity. Must use a much lower condition number of matrices to get good results, or else everything blows up.
…ulations to work. New updates to the best parameters.
…locities when computing the timestep and comparisons. Use a new timestep estimator from Gasoline2, similar to MAGMA2 paper but for adaptive timestepping. Apply a pressure difference limiter to the conductivity to prevent spurious conduction. Only allow conduction if the signal speed allows it. Added a factor that can reduce viscosity and conduction in the fallback SPH, since it can be highly over dissipative.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've added the MAGMA2 SPH scheme with improved gradient estimation and 2nd order reconstruction into SWIFT. The implementation follows Rosswog 2020 extremely closely except for a few important changes.
The hydro tests work well and give good results in 3D and 2D. The results require at least 114 neighbours in 3D for the Wendland C2 kernel. I recommend values of const_viscosity_alpha=2 and const_viscosity_beta=2*const_viscosity_alpha for the viscosity. For conductivity, I recommend no higher than const_conductivity_alpha=0.075 or there will be severe spreading of shocks (see the SedovBlast_3D test).