Commit b65b49f4 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'external_potential_refactorisation' into 'master'

Re-factored the whole external potential mechanism to match what is done for cooling

Also, renamed 'disk' to 'disc' and improved the documentation and description of the parameters. 

@pdraper this is just code rearrangement, no changes to the actual physics has been done.

See merge request !249
parents d68d760e 4a86f7b7
......@@ -763,6 +763,7 @@ INPUT = @top_srcdir@ @top_srcdir@/src @top_srcdir@/tests @top_
INPUT += @top_srcdir@/src/hydro/Minimal
INPUT += @top_srcdir@/src/gravity/Default
INPUT += @top_srcdir@/src/riemann
INPUT += @top_srcdir@/src/potential/point_mass
INPUT += @top_srcdir@/src/cooling/const_du
# This tag can be used to specify the character encoding of the source files
......
......@@ -19,7 +19,7 @@ Statistics:
# Parameters governing the snapshots
Snapshots:
basename: Disk-Patch # Common part of the name of output files
basename: Disc-Patch # Common part of the name of output files
time_first: 0. # Time of the first output (in internal units)
delta_time: 8. # Time difference between consecutive outputs (in internal units)
......@@ -33,11 +33,11 @@ SPH:
# Parameters related to the initial conditions
InitialConditions:
file_name: Disk-Patch.hdf5 # The file to read
file_name: Disc-Patch.hdf5 # The file to read
# External potential parameters
Disk-PatchPotential:
DiscPatchPotential:
surface_density: 10.
scale_height: 100.
z_disk: 300.
z_disc: 300.
timestep_mult: 0.03
......@@ -26,7 +26,7 @@ import random
# Generates N particles in a box of [0:BoxSize,0:BoxSize,-2scale_height:2scale_height]
# see Creasey, Theuns & Bower, 2013, for the equations:
# disk parameters are: surface density sigma
# disc parameters are: surface density sigma
# scale height b
# density: rho(z) = (sigma/2b) sech^2(z/b)
# isothermal velocity dispersion = <v_z^2? = b pi G sigma
......@@ -79,7 +79,7 @@ N = int(sys.argv[1]) # Number of particles
rho = 2. # Density
P = 1. # Pressure
gamma = 5./3. # Gas adiabatic index
fileName = "Disk-Patch.hdf5"
fileName = "Disc-Patch.hdf5"
#---------------------------------------------------
......
#!/bin/bash
# Generate the initial conditions if they are not present.
if [ ! -e Isothermal.hdf5 ]
if [ ! -e Disc-Patch.hdf5 ]
then
echo "Generating initial conditions for the disk-patch example..."
echo "Generating initial conditions for the disc-patch example..."
python makeIC.py 1000
fi
../../swift -g -t 2 disk-patch.yml
../../swift -g -t 2 disc-patch.yml
......@@ -8,7 +8,7 @@ iplot = 1 ; if iplot = 1, make plot of E/Lz conservation, else, simply compare f
@physunits
indir = './'
basefile = 'Disk-Patch_'
basefile = 'Disc-Patch_'
; set properties of potential
uL = phys.pc ; unit of length
......
Generates and evolves a disk-patch, where gas is in hydrostatic
Generates and evolves a disc-patch, where gas is in hydrostatic
equilibrium with an imposed external gravitational force, using the
equations from Creasey, Theuns & Bower, 2013, MNRAS, Volume 429,
Issue 3, p.1922-1948.
......@@ -10,11 +10,11 @@ To generate ICs ready for a scientific run:
2) Generate pre-ICs by running the 'makeIC.py' script.
3) Run SWIFT with an isothermal EoS, no cooling nor feedback, and the
disk-patch potential switched on and using the parameters from
'disk-patch-icc.yml'
disc-patch potential switched on and using the parameters from
'disc-patch-icc.yml'
4) The ICs are then ready to be run for a science problem. Rename the last
output to 'Disk-Patch-dynamic.hdf5'. These are now the ICs for the actual test.
output to 'Disc-Patch-dynamic.hdf5'. These are now the ICs for the actual test.
When running SWIFT with the parameters from 'disk-patch.yml' and an
ideal gas EoS on these ICs the disk should stay in equilibrium.
When running SWIFT with the parameters from 'disc-patch.yml' and an
ideal gas EoS on these ICs the disc should stay in equilibrium.
......@@ -19,7 +19,7 @@ Statistics:
# Parameters governing the snapshots
Snapshots:
basename: Disk-Patch # Common part of the name of output files
basename: Disc-Patch # Common part of the name of output files
time_first: 0. # Time of the first output (in internal units)
delta_time: 12. # Time difference between consecutive outputs (in internal units)
......@@ -33,12 +33,12 @@ SPH:
# Parameters related to the initial conditions
InitialConditions:
file_name: Disk-Patch.hdf5 # The file to read
file_name: Disc-Patch.hdf5 # The file to read
# External potential parameters
Disk-PatchPotential:
DiscPatchPotential:
surface_density: 10.
scale_height: 100.
z_disk: 200.
z_disc: 200.
timestep_mult: 0.03
growth_time: 5.
......@@ -19,7 +19,7 @@ Statistics:
# Parameters governing the snapshots
Snapshots:
basename: Disk-Patch-dynamic # Common part of the name of output files
basename: Disc-Patch-dynamic # Common part of the name of output files
time_first: 968. # Time of the first output (in internal units)
delta_time: 24. # Time difference between consecutive outputs (in internal units)
......@@ -33,11 +33,11 @@ SPH:
# Parameters related to the initial conditions
InitialConditions:
file_name: Disk-Patch-dynamic.hdf5 # The file to read
file_name: Disc-Patch-dynamic.hdf5 # The file to read
# External potential parameters
Disk-PatchPotential:
DiscPatchPotential:
surface_density: 10.
scale_height: 100.
z_disk: 200.
z_disc: 200.
timestep_mult: 0.03
......@@ -25,9 +25,9 @@ import math
import random
import matplotlib.pyplot as plt
# Generates a disk-patch in hydrostatic equilibrium
# Generates a disc-patch in hydrostatic equilibrium
# see Creasey, Theuns & Bower, 2013, for the equations:
# disk parameters are: surface density sigma
# disc parameters are: surface density sigma
# scale height b
# density: rho(z) = (sigma/2b) sech^2(z/b)
# isothermal velocity dispersion = <v_z^2? = b pi G sigma
......@@ -79,7 +79,7 @@ Radius = 100. # maximum radius of particles [kpc]
G = const_G
# File
fileName = "Disk-Patch.hdf5"
fileName = "Disc-Patch.hdf5"
#---------------------------------------------------
mass = 1
......@@ -145,7 +145,7 @@ mass = 0.*h + pmass
entropy_flag = 0
vel = 0 + 0 * pos
# move centre of disk to middle of box
# move centre of disc to middle of box
pos[:,:] += boxSize/2
......
......@@ -8,7 +8,7 @@ iplot = 1 ; if iplot = 1, make plot of E/Lz conservation, else, simply compare f
@physunits
indir = './'
basefile = 'Disk-Patch_'
basefile = 'Disc-Patch_'
; set properties of potential
uL = phys.pc ; unit of length
......
......@@ -38,7 +38,7 @@ InitialConditions:
shift_z: 50.
# External potential parameters
PointMass:
PointMassPotential:
position_x: 50. # location of external point mass in internal units
position_y: 50.
position_z: 50.
......
......@@ -35,7 +35,7 @@ InitialConditions:
file_name: ./multiTypes.hdf5 # The file to read
# External potential parameters
PointMass:
PointMassPotential:
position_x: 50. # location of external point mass in internal units
position_y: 50.
position_z: 50.
......
......@@ -33,11 +33,3 @@ SPH:
# Parameters related to the initial conditions
InitialConditions:
file_name: ./uniformBox.hdf5 # The file to read
# External potential parameters
PointMass:
position_x: 50. # location of external point mass in internal units
position_y: 50.
position_z: 50.
mass: 1e10 # mass of external point mass in internal units
......@@ -66,7 +66,7 @@ DomainDecomposition:
# Parameters related to external potentials --------------------------------------------
# Point mass external potentials
PointMass:
PointMassPotential:
position_x: 50. # location of external point mass (internal units)
position_y: 50.
position_z: 50.
......@@ -82,12 +82,12 @@ IsothermalPotential:
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
# Disk-patch potential parameters
Disk-PatchPotential:
surface_density: 10. # Surface density of the disk (internal units)
scale_height: 100. # Scale height of the disk (internal units)
z_disk: 200. # Disk height (internal units)
DiscPatchPotential:
surface_density: 10. # Surface density of the disc (internal units)
scale_height: 100. # Scale height of the disc (internal units)
z_disc: 200. # Position of the disc along the z-axis (internal units)
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
growth_time: 5. # (Optional) Time for the disk to grow to its final size (multiple of the dynamical time)
growth_time: 5. # (Optional) Time for the disc to grow to its final size (multiple of the dynamical time)
# Parameters related to cooling function ----------------------------------------------
......
......@@ -42,7 +42,7 @@ endif
include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
engine.h swift.h serial_io.h timers.h debug.h scheduler.h proxy.h parallel_io.h \
common_io.h single_io.h multipole.h map.h tools.h partition.h clocks.h parser.h \
physical_constants.h physical_constants_cgs.h potentials.h version.h \
physical_constants.h physical_constants_cgs.h potential.h version.h \
hydro_properties.h threadpool.h cooling.h cooling_struct.h
......@@ -51,7 +51,7 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
serial_io.c timers.c debug.c scheduler.c proxy.c parallel_io.c \
units.c common_io.c single_io.c multipole.c version.c map.c \
kernel_hydro.c tools.c part.c partition.c clocks.c parser.c \
physical_constants.c potentials.c hydro_properties.c \
physical_constants.c potential.c hydro_properties.c \
runner_doiact_fft.c threadpool.c cooling.c
# Include files for distribution, not installation.
......
......@@ -90,9 +90,10 @@
#define const_gravity_eta 0.025f
/* External gravity properties */
#define EXTERNAL_POTENTIAL_POINTMASS
#define EXTERNAL_POTENTIAL_NONE
//#define EXTERNAL_POTENTIAL_POINTMASS
//#define EXTERNAL_POTENTIAL_ISOTHERMALPOTENTIAL
//#define EXTERNAL_POTENTIAL_DISK_PATCH
//#define EXTERNAL_POTENTIAL_DISC_PATCH
/* Cooling properties */
#define COOLING_NONE
......
......@@ -41,7 +41,7 @@
#include "cooling_struct.h"
#include "parser.h"
#include "partition.h"
#include "potentials.h"
#include "potential.h"
#include "runner.h"
#include "scheduler.h"
#include "space.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment